Subversion Repositories Kolibri OS

Rev

Rev 7422 | Rev 7447 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7422 Rev 7444
Line 39... Line 39...
39
You can open only files created in IconEdit for now!
39
You can open only files created in IconEdit for now!
40
In other case please use  tool to get an image from screen.' -Wt"
40
In other case please use  tool to get an image from screen.' -Wt"
41
#endif
41
#endif
Line 42... Line 42...
42
 
42
 
Line 43... Line 43...
43
 
43
 
44
#define T_TITLE "Icon Editor 0.57b Alpha"
44
#define T_TITLE "Icon Editor 0.58 Alpha"
45
 
45
 
Line 160... Line 160...
160
 
160
 
161
void main()
161
void main()
162
{
162
{
163
	word btn;
163
	word btn;
164
	libimg_image open_image;
164
	libimg_image open_image;
Line 165... Line 165...
165
	dword tmp_bg_col;
165
	dword bg_col;
166
 
166
 
167
	load_dll(libio,  #libio_init,  1);
167
	load_dll(libio,  #libio_init,  1);
Line 168... Line 168...
168
	load_dll(libimg, #libimg_init, 1);
168
	load_dll(libimg, #libimg_init, 1);
169
	load_dll(boxlib, #box_lib_init,0);
169
	load_dll(boxlib, #box_lib_init,0);
Line 170... Line 170...
170
 
170
 
-
 
171
	Libimg_LoadImage(#top_icons, "/sys/icons16.png");
-
 
172
	Libimg_LoadImage(#left_icons, "/sys/icons16.png");
Line 171... Line 173...
171
	Libimg_LoadImage(#top_icons, "/sys/icons16.png");
173
 
172
	Libimg_LoadImage(#left_icons, "/sys/icons16.png");
174
	system.color.get();
173
 
175
	bg_col = system.color.work;
Line 174... Line 176...
174
	system.color.get();
176
	if (GrayScaleImage(#bg_col,1,1)<65) bg_dark=true; else bg_dark=false;
175
 
177
 
Line 176... Line 178...
176
	semi_white = MixColors(system.color.work, 0xFFFfff, 96);
178
	semi_white = MixColors(system.color.work, 0xFFFfff, bg_dark*90 + 96);
177
	Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffFFFfff, semi_white);
-
 
178
	Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffCACBD6, MixColors(semi_white, 0, 220));
179
	Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffFFFfff, semi_white);
Line 179... Line 180...
179
 
180
	Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffCACBD6, MixColors(semi_white, 0, 220));
Line 180... Line 181...
180
	Libimg_ReplaceColor(left_icons.image, left_icons.w, left_icons.h, 0xffFFFfff, system.color.work);
181
 
Line 291... Line 292...
291
					EventMove(FLIP_VER);
292
					EventMove(FLIP_VER);
292
					break;
293
					break;
293
				case BTN_FLIP_HOR:
294
				case BTN_FLIP_HOR:
294
					EventMove(FLIP_HOR);
295
					EventMove(FLIP_HOR);
295
					break;
296
					break;
-
 
297
				case BTN_ROTATE_LEFT:
-
 
298
					EventMove(ROTATE_LEFT);
-
 
299
					break;
-
 
300
				case BTN_ROTATE_RIGHT:
-
 
301
					EventMove(ROTATE_RIGHT);
-
 
302
					break;
296
				case BTN_TEST_ICON:
303
				case BTN_TEST_ICON:
297
					EventTestIcon();
304
					EventTestIcon();
298
					break;
305
					break;
299
				case BTN_PENCIL:
306
				case BTN_PENCIL:
300
					setCurrentTool(TOOL_PENCIL);
307
					setCurrentTool(TOOL_PENCIL);
Line 343... Line 350...
343
						EventSaveIconToFile();
350
						EventSaveIconToFile();
344
						break;
351
						break;
345
					case SCAN_CODE_KEY_O:
352
					case SCAN_CODE_KEY_O:
346
						EventOpenIcon();
353
						EventOpenIcon();
347
						break;
354
						break;
-
 
355
					case SCAN_CODE_LEFT:
-
 
356
						EventMove(MOVE_LEFT);
-
 
357
						break;
-
 
358
					case SCAN_CODE_RIGHT:
-
 
359
						EventMove(MOVE_RIGHT);
-
 
360
						break;
-
 
361
					case SCAN_CODE_UP:
-
 
362
						EventMove(MOVE_UP);
-
 
363
						break;
-
 
364
					case SCAN_CODE_DOWN:
-
 
365
						EventMove(MOVE_DOWN);
-
 
366
						break;
-
 
367
					case SCAN_CODE_KEY_R:
-
 
368
						EventMove(BTN_ROTATE_RIGHT);
-
 
369
						break;
-
 
370
					case SCAN_CODE_KEY_L:
-
 
371
						EventMove(BTN_ROTATE_LEFT);
-
 
372
						break;
348
				}
373
				}
349
			}
374
			}
Line 350... Line 375...
350
 
375
 
351
			if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) {
376
			if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) {
Line 432... Line 457...
432
	b_color_gradient.x = b_last_colors.x = b_default_palette.x = right_bar.x;
457
	b_color_gradient.x = b_last_colors.x = b_default_palette.x = right_bar.x;
433
	DrawBar(0, 0, Form.cwidth, TOPBAR_H-1, system.color.work);
458
	DrawBar(0, 0, Form.cwidth, TOPBAR_H-1, system.color.work);
434
	DrawBar(0, TOPBAR_H-1, Form.cwidth, 1, system.color.work_graph);
459
	DrawBar(0, TOPBAR_H-1, Form.cwidth, 1, system.color.work_graph);
Line 435... Line 460...
435
 
460
 
436
	tx.n = 5-GAP;
461
	tx.n = 5-GAP;
437
	DrawTopPanelButton(BTN_NEW,    tx.inc(GAP), 2); //not implemented
462
	DrawTopPanelButton(BTN_NEW,    tx.inc(GAP), 2);
438
	DrawTopPanelButton(BTN_OPEN,   tx.inc(GAP), 0); //not implemented
463
	DrawTopPanelButton(BTN_OPEN,   tx.inc(GAP), 0); //not implemented
439
	DrawTopPanelButton(BTN_SAVE,   tx.inc(GAP), 5);
464
	DrawTopPanelButton(BTN_SAVE,   tx.inc(GAP), 5);
440
	DrawTopPanelButton(BTN_MOVE_LEFT,  tx.inc(GAP+BLOCK_SPACE), 30);
465
	DrawTopPanelButton(BTN_MOVE_LEFT,  tx.inc(GAP+BLOCK_SPACE), 30);
441
	DrawTopPanelButton(BTN_MOVE_RIGHT, tx.inc(GAP),   31);
466
	DrawTopPanelButton(BTN_MOVE_RIGHT, tx.inc(GAP),   31);
442
	DrawTopPanelButton(BTN_MOVE_UP,    tx.inc(GAP),   32);
467
	DrawTopPanelButton(BTN_MOVE_UP,    tx.inc(GAP),   32);
Line 443... Line 468...
443
	DrawTopPanelButton(BTN_MOVE_DOWN,  tx.inc(GAP),   33);
468
	DrawTopPanelButton(BTN_MOVE_DOWN,  tx.inc(GAP),   33);
444
	
469
	
-
 
470
	DrawTopPanelButton(BTN_FLIP_HOR,   tx.inc(GAP+BLOCK_SPACE), 34);
-
 
471
	DrawTopPanelButton(BTN_FLIP_VER,   tx.inc(GAP),   35);
Line 445... Line 472...
445
	DrawTopPanelButton(BTN_FLIP_HOR,   tx.inc(GAP+BLOCK_SPACE), 34);
472
	DrawTopPanelButton(BTN_ROTATE_LEFT,   tx.inc(GAP), 37);
Line 446... Line 473...
446
	DrawTopPanelButton(BTN_FLIP_VER,   tx.inc(GAP),   35);
473
	DrawTopPanelButton(BTN_ROTATE_RIGHT,  tx.inc(GAP), 36);
447
 
-
 
448
	DrawTopPanelButton(BTN_TEST_ICON,  tx.inc(GAP+BLOCK_SPACE), 12);
-
 
Line 449... Line 474...
449
 
474
 
Line 450... Line 475...
450
	DrawTopPanelButton(BTN_CROP,  tx.inc(GAP+BLOCK_SPACE), 46);
475
	DrawTopPanelButton(BTN_TEST_ICON,  tx.inc(GAP+BLOCK_SPACE), 12);
451
	// DrawTopPanelButton(BTN_ROTATE_LEFT,   tx.inc(GAP), 36); //not implemented
476
 
Line 564... Line 589...
564
	for (i=0 ; i<=rmax; i++) {
589
	for (i=0 ; i<=rmax; i++) {
565
		linear_gradient[lmax+rmax - i] = MixColors(color1,0x000000,255*i/rmax);
590
		linear_gradient[lmax+rmax - i] = MixColors(color1,0x000000,255*i/rmax);
566
	}
591
	}
567
}
592
}
Line -... Line 593...
-
 
593
 
-
 
594
int DrawGradientMarker(dword marker_x, marker_color)
-
 
595
{
-
 
596
	if (marker_x > b_color_gradient.w - 1) marker_x = b_color_gradient.w - 1;
-
 
597
	DrawBar(b_color_gradient.x + marker_x-2, b_color_gradient.y-3, 5, 1, marker_color);
-
 
598
	DrawBar(b_color_gradient.x + marker_x-1, b_color_gradient.y-2, 3, 1, marker_color);
-
 
599
	PutPixel(b_color_gradient.x + marker_x, b_color_gradient.y-1, marker_color);
-
 
600
	return marker_x;
-
 
601
}
-
 
602
 
568
 
603
int old_marker_pos;
569
void DrawCurrentColorGradient()
604
void DrawCurrentColorGradient()
570
{
605
{
571
	int i;
-
 
572
	dword hitch_color=system.color.work;
-
 
573
	int hitch_x = b_color_gradient.x+lmax-1;
-
 
574
	if (lmax>b_color_gradient.w-2) hitch_x=b_color_gradient.x+b_color_gradient.w-3;
-
 
575
 
606
	int i;
576
	for (i=0 ; i
607
	for (i=0 ; i
577
		DrawBar(b_color_gradient.x+i, b_color_gradient.y, 1, b_color_gradient.h, linear_gradient[i]);		
608
		DrawBar(b_color_gradient.x+i, b_color_gradient.y, 1, b_color_gradient.h, linear_gradient[i]);		
578
	}
-
 
579
	//current color marker	
609
	}
580
	DrawBar( b_color_gradient.x-1, b_color_gradient.y-2, b_color_gradient.w+4, 2, system.color.work);
-
 
581
	
-
 
582
	if (bg_dark) hitch_color=0xFFFfff; else hitch_color=0;
610
	DrawGradientMarker(old_marker_pos, system.color.work);
583
	DrawBar(hitch_x, b_color_gradient.y-2, 3,2, hitch_color);
611
	old_marker_pos = DrawGradientMarker(lmax, 0xFFFfff * bg_dark);
Line 584... Line 612...
584
}
612
}
585
 
613
 
586
void DrawColorPallets()
614
void DrawColorPallets()
Line 637... Line 665...
637
}
665
}
Line 638... Line 666...
638
 
666
 
639
void DrawPreview()
667
void DrawPreview()
640
{
668
{
641
	int x = right_bar.x;
669
	int x = right_bar.x;
-
 
670
	int y = b_default_palette.y + b_default_palette.h + 6;
-
 
671
	int preview_h = Form.cheight - y;
642
	int y = wrapper.y + wrapper.h - image.rows-2;
672
 
-
 
673
	if (image.columns > right_bar.w) return;
-
 
674
	if (image.rows > preview_h) return;
-
 
675
 
-
 
676
	_PutImage(right_bar.w - image.columns / 2 + x - 3,
643
	DrawRectangle(x, y, image.columns+1, image.rows+1, system.color.work_graph);
677
		preview_h - image.rows / 2 + y, 
-
 
678
		image.columns, image.rows, image.get_image()
644
	_PutImage(x+1,y+1, image.columns, image.rows, image.get_image());
679
		);
Line 645... Line 680...
645
}
680
}
646
 
681
 
647
dword GetPixelUnderMouse()
682
dword GetPixelUnderMouse()