Subversion Repositories Kolibri OS

Rev

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

Rev 7268 Rev 7271
Line 30... Line 30...
30
//                                                   //
30
//                                                   //
31
//                       DATA                        //
31
//                       DATA                        //
32
//                                                   //
32
//                                                   //
33
//===================================================//
33
//===================================================//
Line 34... Line 34...
34
 
34
 
Line 35... Line 35...
35
#define T_TITLE "Icon Editor 0.54 Alpha"
35
#define T_TITLE "Icon Editor 0.54.1 Alpha"
36
 
36
 
37
#define TOOLBAR_H    24+8
37
#define TOPBAR_H    24+8
Line 38... Line 38...
38
#define PANEL_LEFT_W 16+5+5+3+3
38
#define LEFTBAR_W 16+5+5+3+3
39
#define PALLETE_SIZE 116
39
#define PALLETE_SIZE 116
40
 
40
 
Line 41... Line 41...
41
#define PAL_ITEMS_X_COUNT 13
41
#define PAL_ITEMS_X_COUNT 13
42
#define COLSIZE 18
42
#define COLSIZE 18
Line 43... Line 43...
43
#define RIGHT_BAR_W PAL_ITEMS_X_COUNT*COLSIZE
43
#define RIGHT_BAR_W PAL_ITEMS_X_COUNT*COLSIZE
44
 
44
 
45
#define TO_CANVAS_X(xval) xval - canvas.x/zoom.value
45
#define TO_CANVAS_X(xval) xval - canvas.x/zoom.value
Line 46... Line 46...
46
#define TO_CANVAS_Y(yval) yval - canvas.y/zoom.value
46
#define TO_CANVAS_Y(yval) yval - canvas.y/zoom.value
47
 
47
 
48
block canvas = { NULL, NULL, NULL, NULL };
48
block canvas = { NULL, NULL, NULL, NULL };
Line 49... Line 49...
49
block wrapper = { PANEL_LEFT_W, TOOLBAR_H, NULL, NULL };
49
block wrapper = { LEFTBAR_W, TOPBAR_H, NULL, NULL };
50
block right_bar = { NULL, 10+TOOLBAR_H, RIGHT_BAR_W+10, NULL };
50
block right_bar = { NULL, 10+TOPBAR_H, RIGHT_BAR_W+10, NULL };
51
 
51
 
Line 303... Line 303...
303
			GetKeys();
303
			GetKeys();
Line 304... Line 304...
304
 
304
 
305
			if (currentTool != TOOL_NONE) && (tools[currentTool].onKeyEvent != 0)
305
			if (currentTool != TOOL_NONE) && (tools[currentTool].onKeyEvent != 0)
Line 306... Line -...
306
				tools[currentTool].onKeyEvent(key_scancode);
-
 
307
 
306
				tools[currentTool].onKeyEvent(key_scancode);
308
			if (key_scancode == SCAN_CODE_ESC) setCurrentTool(TOOL_PENCIL);
307
 
309
			if (key_scancode == SCAN_CODE_KEY_P) setCurrentTool(TOOL_PENCIL);
308
			if (key_scancode == SCAN_CODE_KEY_P) setCurrentTool(TOOL_PENCIL);
310
			if (key_scancode == SCAN_CODE_KEY_I) setCurrentTool(TOOL_PIPETTE);
309
			if (key_scancode == SCAN_CODE_KEY_I) setCurrentTool(TOOL_PIPETTE);
311
			if (key_scancode == SCAN_CODE_KEY_F) setCurrentTool(TOOL_FILL);
310
			if (key_scancode == SCAN_CODE_KEY_F) setCurrentTool(TOOL_FILL);
Line 331... Line 330...
331
}
330
}
Line 332... Line 331...
332
 
331
 
333
void DrawTopPanelButton(dword _id, _x, _icon_n)
332
void DrawTopPanelButton(dword _id, _x, _icon_n)
334
{
333
{
-
 
334
	DrawWideRectangle(_x, 4, 22, 22, 3, semi_white);
-
 
335
	PutPixel(_x,4,system.color.work);
-
 
336
	PutPixel(_x,4+21,system.color.work);
-
 
337
	PutPixel(_x+21,4,system.color.work);
335
	DrawWideRectangle(_x, 4, 22, 22, 3, semi_white);
338
	PutPixel(_x+21,4+21,system.color.work);
336
	DefineHiddenButton(_x, 4, 21, 21, _id);
339
	DefineHiddenButton(_x, 4, 21, 21, _id);
337
	img_draw stdcall(top_icons.image, _x+3, 7, 16, 16, 0, _icon_n*16);
340
	img_draw stdcall(top_icons.image, _x+3, 7, 16, 16, 0, _icon_n*16);
Line 338... Line 341...
338
}
341
}
Line 357... Line 360...
357
{
360
{
358
	#define GAP 27
361
	#define GAP 27
359
	#define BLOCK_SPACE 10
362
	#define BLOCK_SPACE 10
360
	incn tx;
363
	incn tx;
361
	system.color.get();
364
	system.color.get();
362
	DefineAndDrawWindow(115+random(100), 50+random(100), 700, 540, 0x33, system.color.work, T_TITLE, 0);
365
	DefineAndDrawWindow(115+random(100), 50+random(100), 700, 540, 0x73, NULL, T_TITLE, 0);
363
	GetProcessInfo(#Form, SelfInfo);
366
	GetProcessInfo(#Form, SelfInfo);
364
	if (Form.status_window>2) return;
367
	if (Form.status_window>2) return;
365
	if (Form.width  < 560) { MoveSize(OLD,OLD,560,OLD); return; }
368
	if (Form.width  < 560) { MoveSize(OLD,OLD,560,OLD); return; }
366
	if (Form.height < 430) { MoveSize(OLD,OLD,OLD,430); return; }
369
	if (Form.height < 430) { MoveSize(OLD,OLD,OLD,430); return; }
Line 367... Line 370...
367
 
370
 
368
	right_bar.x = Form.cwidth - right_bar.w;
371
	right_bar.x = Form.cwidth - right_bar.w;
-
 
372
	b_color_gradient.x = b_last_colors.x = b_default_palette.x = right_bar.x;
369
	b_color_gradient.x = b_last_colors.x = b_default_palette.x = right_bar.x;
373
	DrawBar(0, 0, Form.cwidth, TOPBAR_H-1, system.color.work);
Line 370... Line 374...
370
	DrawBar(0, TOOLBAR_H-1, Form.cwidth, 1, system.color.work_graph);
374
	DrawBar(0, TOPBAR_H-1, Form.cwidth, 1, system.color.work_graph);
371
 
375
 
372
	tx.n = 5-GAP;
376
	tx.n = 5-GAP;
373
	DrawTopPanelButton(BTN_NEW,    tx.inc(GAP), 2); //not implemented
377
	DrawTopPanelButton(BTN_NEW,    tx.inc(GAP), 2); //not implemented
Line 383... Line 387...
383
 
387
 
384
	DrawTopPanelButton(BTN_TEST_ICON,  tx.inc(GAP+BLOCK_SPACE), 12);
388
	DrawTopPanelButton(BTN_TEST_ICON,  tx.inc(GAP+BLOCK_SPACE), 12);
385
	// DrawTopPanelButton(BTN_ROTATE_LEFT,   tx.inc(GAP), 36); //not implemented
389
	// DrawTopPanelButton(BTN_ROTATE_LEFT,   tx.inc(GAP), 36); //not implemented
Line 386... Line -...
386
	// DrawTopPanelButton(BTN_ROTATE_RIGHT,  tx.inc(GAP), 37); //not implemented
-
 
387
 
-
 
388
	DrawLeftPanel();
390
	// DrawTopPanelButton(BTN_ROTATE_RIGHT,  tx.inc(GAP), 37); //not implemented
Line -... Line 391...
-
 
391
	
-
 
392
	DrawEditArea();
-
 
393
 
-
 
394
	//BG under LeftBar
-
 
395
	DrawBar(0, TOPBAR_H, LEFTBAR_W-1, Form.cheight - TOPBAR_H, system.color.work);
-
 
396
	//BG under RightBar
-
 
397
	DrawBar(wrapper.x+wrapper.w, TOPBAR_H, Form.cwidth-wrapper.x-wrapper.w,
-
 
398
		Form.cheight - TOPBAR_H, system.color.work);
-
 
399
	//BG under StatusBar
-
 
400
	DrawBar(LEFTBAR_W-1, wrapper.y + wrapper.h, wrapper.w+1, 
389
	
401
		Form.cheight - wrapper.y - wrapper.h, system.color.work);
390
	DrawEditArea();
402
 
391
 
-
 
392
	DrawActiveColor(right_bar.y);
403
	DrawLeftPanel();
-
 
404
	DrawActiveColor(right_bar.y);
393
	DrawColorPallets();
405
	DrawColorPallets();
Line 394... Line 406...
394
 
406
	DrawStatusBar();
395
	DrawStatusBar();
407
	DrawPreview();
396
}
408
}
Line 416... Line 428...
416
	dword color1=0xC0C0C0;
428
	dword color1=0xC0C0C0;
417
	int top_side;
429
	int top_side;
418
	int left_side;
430
	int left_side;
Line 419... Line 431...
419
 
431
 
420
	wrapper.w = Form.cwidth - right_bar.w - 10 - wrapper.x;
432
	wrapper.w = Form.cwidth - right_bar.w - 10 - wrapper.x;
Line 421... Line 433...
421
	wrapper.h = Form.cheight - TOOLBAR_H - 35;
433
	wrapper.h = Form.cheight - TOPBAR_H - 35;
422
 
434
 
423
	//canvas{
435
	//canvas{
424
	canvas.w = image.columns * zoom.value;
436
	canvas.w = image.columns * zoom.value;
Line 479... Line 491...
479
	int i;
491
	int i;
480
	int w = right_bar.w-10/2;
492
	int w = right_bar.w-10/2;
481
	for (i=0; i
493
	for (i=0; i
482
		DrawBar(b_color_gradient.x+i, b_color_gradient.y, 
494
		DrawBar(b_color_gradient.x+i, b_color_gradient.y, 
483
			1, b_color_gradient.h, MixColors(color1,0xFFFfff,255*i/w));
495
			1, b_color_gradient.h, MixColors(color1,0xFFFfff,255*i/w));
-
 
496
 
-
 
497
	//current color marker	
-
 
498
	DrawBar(b_color_gradient.x+i-1, b_color_gradient.y-2, 3,2, 0x000000);
-
 
499
 
484
	for (i=0 ; i<=w; i++)
500
	for (i=0 ; i<=w; i++)
485
		DrawBar(b_color_gradient.x+w+w-i, b_color_gradient.y, 
501
		DrawBar(b_color_gradient.x+w+w-i, b_color_gradient.y, 
486
			1, b_color_gradient.h, MixColors(color1,0x000000,255*i/w));
502
			1, b_color_gradient.h, MixColors(color1,0x000000,255*i/w));
487
}
503
}
Line 639... Line 655...
639
}
655
}
Line 640... Line 656...
640
 
656
 
641
void EventMove(dword _action)
657
void EventMove(dword _action)
642
{
658
{
643
	if (selection_state) {
-
 
644
		//debugval("selection_state", selection_state);
659
	if (selection_state) {
645
		selection.move(_action);
660
		selection.move(_action);
646
		DrawSelection();
661
		SelectTool_onCanvasDraw();
647
	}
662
	}
648
	else {
663
	else {
649
		image.move(_action);
664
		image.move(_action);
650
		DrawCanvas();
665
		DrawCanvas();
-
 
666
	}
651
	} 
667
	actionsHistory.saveCurrentState();
Line 652... Line 668...
652
}
668
}
Line 653... Line 669...
653
 
669