Subversion Repositories Kolibri OS

Rev

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

Rev 7265 Rev 7266
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.53 Alpha"
35
#define T_TITLE "Icon Editor 0.53.1 Alpha"
36
 
36
 
37
#define TOOLBAR_H    24+8
37
#define TOOLBAR_H    24+8
38
#define PANEL_LEFT_W 16+5+5+3+3
-
 
Line 39... Line 38...
39
#define PALLETE_SIZE 116
38
#define PANEL_LEFT_W 16+5+5+3+3
40
#define TB_ICON_PADDING 26
39
#define PALLETE_SIZE 116
41
 
40
 
Line 137... Line 136...
137
//                                                   //
136
//                                                   //
138
//                       CODE                        //
137
//                       CODE                        //
139
//                                                   //
138
//                                                   //
140
//===================================================//
139
//===================================================//
Line -... Line 140...
-
 
140
 
-
 
141
libimg_image top_icons;
-
 
142
libimg_image left_icons;
141
 
143
 
142
void main()
144
void main()
143
{
145
{
144
	word btn;
146
	word btn;
Line 145... Line 147...
145
	libimg_image open_image;
147
	libimg_image open_image;
146
 
148
 
147
	load_dll(libio,  #libio_init,  1);
149
	load_dll(libio,  #libio_init,  1);
Line 148... Line 150...
148
	load_dll(libimg, #libimg_init, 1);
150
	load_dll(libimg, #libimg_init, 1);
-
 
151
	load_dll(boxlib, #box_lib_init,0);
-
 
152
 
149
	load_dll(boxlib, #box_lib_init,0);
153
	Libimg_LoadImage(#top_icons, "/sys/icons16.png");
150
 
154
	Libimg_LoadImage(#left_icons, "/sys/icons16.png");
151
	Libimg_LoadImage(#skin, "/sys/icons16.png");
155
 
-
 
156
	system.color.get();
-
 
157
	semi_white = MixColors(system.color.work, 0xFFFfff, 96);
152
	system.color.get();
158
	Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffFFFfff, semi_white);
-
 
159
	Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffCACBD6, MixColors(semi_white, 0, 220));
Line 153... Line 160...
153
	semi_white = MixColors(system.color.work, 0xFFFfff, 64);
160
 
154
	Libimg_ReplaceColor(skin.image, skin.w, skin.h, 
161
	Libimg_ReplaceColor(left_icons.image, left_icons.w, left_icons.h, 0xffFFFfff, system.color.work);
155
		0xffFFFfff, semi_white);
162
	Libimg_ReplaceColor(left_icons.image, left_icons.w, left_icons.h, 0xffCACBD6, MixColors(system.color.work, 0, 200));
156
 
163
 
Line 327... Line 334...
327
			draw_window();
334
			draw_window();
328
			break;
335
			break;
329
	}
336
	}
330
}
337
}
Line 331... Line 338...
331
 
338
 
332
void DrawToolbarButton(dword _id, _x, _icon_n)
339
void DrawTopPanelButton(dword _id, _x, _icon_n)
333
{
340
{
334
	DrawWideRectangle(_x, 4, 22, 22, 3, semi_white);
341
	DrawWideRectangle(_x, 4, 22, 22, 3, semi_white);
335
	DefineHiddenButton(_x, 4, 21, 21, _id);
342
	DefineHiddenButton(_x, 4, 21, 21, _id);
336
	img_draw stdcall(skin.image, _x+3, 7, 16, 16, 0, _icon_n*16);
343
	img_draw stdcall(top_icons.image, _x+3, 7, 16, 16, 0, _icon_n*16);
Line 337... Line 344...
337
}
344
}
338
 
345
 
339
void DrawLeftPanelButton(dword _id, _y, _icon_n)
346
void DrawLeftPanelButton(dword _id, _y, _icon_n)
340
{
347
{
341
	int x = 5;
348
	int x = 5;
342
	DrawWideRectangle(x, _y, 22, 22, 3, semi_white);
349
	DrawRectangle(x, _y, 22-1, 22-1, system.color.work);
343
	DefineHiddenButton(x, _y, 21, 21, _id);
350
	DefineHiddenButton(x, _y, 21, 21, _id);
Line 344... Line 351...
344
	img_draw stdcall(skin.image, x+3, _y+3, 16, 16, 0, _icon_n*16);
351
	img_draw stdcall(left_icons.image, x+3, _y+3, 16, 16, 0, _icon_n*16);
345
}
352
}
346
 
353
 
Line 352... Line 359...
352
	WriteText(wrapper.x+wrapper.w-calc(strlen(#param)*8), zoom.y+2, 0x90, system.color.work_text, #param);
359
	WriteText(wrapper.x+wrapper.w-calc(strlen(#param)*8), zoom.y+2, 0x90, system.color.work_text, #param);
353
}
360
}
Line 354... Line 361...
354
 
361
 
355
void draw_window()
362
void draw_window()
-
 
363
{
-
 
364
	#define GAP 27
356
{
365
	#define BLOCK_SPACE 10
357
	incn tx;
366
	incn tx;
358
	system.color.get();
367
	system.color.get();
359
	DefineAndDrawWindow(115+random(100), 50+random(100), 700, 540, 0x33, system.color.work, T_TITLE, 0);
368
	DefineAndDrawWindow(115+random(100), 50+random(100), 700, 540, 0x33, system.color.work, T_TITLE, 0);
360
	GetProcessInfo(#Form, SelfInfo);
369
	GetProcessInfo(#Form, SelfInfo);
Line 364... Line 373...
364
 
373
 
365
	right_bar.x = Form.cwidth - right_bar.w;
374
	right_bar.x = Form.cwidth - right_bar.w;
366
	b_color_gradient.x = b_last_colors.x = b_default_palette.x = right_bar.x;
375
	b_color_gradient.x = b_last_colors.x = b_default_palette.x = right_bar.x;
Line 367... Line 376...
367
	DrawBar(0, TOOLBAR_H-1, Form.cwidth, 1, system.color.work_graph);
376
	DrawBar(0, TOOLBAR_H-1, Form.cwidth, 1, system.color.work_graph);
368
 
377
 
369
	tx.n = 5-TB_ICON_PADDING;
378
	tx.n = 5-GAP;
370
	DrawToolbarButton(BTN_NEW,    tx.inc(TB_ICON_PADDING), 2); //not implemented
379
	DrawTopPanelButton(BTN_NEW,    tx.inc(GAP), 2); //not implemented
371
	DrawToolbarButton(BTN_OPEN,   tx.inc(TB_ICON_PADDING), 0); //not implemented
380
	DrawTopPanelButton(BTN_OPEN,   tx.inc(GAP), 0); //not implemented
372
	DrawToolbarButton(BTN_SAVE,   tx.inc(TB_ICON_PADDING), 5);
381
	DrawTopPanelButton(BTN_SAVE,   tx.inc(GAP), 5);
373
	DrawToolbarButton(BTN_MOVE_LEFT,  tx.inc(TB_ICON_PADDING+8), 30);
382
	DrawTopPanelButton(BTN_MOVE_LEFT,  tx.inc(GAP+BLOCK_SPACE), 30);
374
	DrawToolbarButton(BTN_MOVE_RIGHT, tx.inc(TB_ICON_PADDING),   31);
383
	DrawTopPanelButton(BTN_MOVE_RIGHT, tx.inc(GAP),   31);
375
	DrawToolbarButton(BTN_MOVE_UP,    tx.inc(TB_ICON_PADDING),   32);
384
	DrawTopPanelButton(BTN_MOVE_UP,    tx.inc(GAP),   32);
376
	DrawToolbarButton(BTN_MOVE_DOWN,  tx.inc(TB_ICON_PADDING),   33);
385
	DrawTopPanelButton(BTN_MOVE_DOWN,  tx.inc(GAP),   33);
377
	
386
	
378
	DrawToolbarButton(BTN_FLIP_HOR,   tx.inc(TB_ICON_PADDING+8), 34);
387
	DrawTopPanelButton(BTN_FLIP_HOR,   tx.inc(GAP+BLOCK_SPACE), 34);
379
	DrawToolbarButton(BTN_FLIP_VER,   tx.inc(TB_ICON_PADDING),   35);
388
	DrawTopPanelButton(BTN_FLIP_VER,   tx.inc(GAP),   35);
380
 
389
 
381
	DrawToolbarButton(BTN_TEST_ICON,  tx.inc(TB_ICON_PADDING+8), 12);
390
	DrawTopPanelButton(BTN_TEST_ICON,  tx.inc(GAP+BLOCK_SPACE), 12);
Line 382... Line 391...
382
	// DrawToolbarButton(BTN_ROTATE_LEFT,   tx.inc(TB_ICON_PADDING), 36); //not implemented
391
	// DrawTopPanelButton(BTN_ROTATE_LEFT,   tx.inc(GAP), 36); //not implemented
Line 383... Line 392...
383
	// DrawToolbarButton(BTN_ROTATE_RIGHT,  tx.inc(TB_ICON_PADDING), 37); //not implemented
392
	// DrawTopPanelButton(BTN_ROTATE_RIGHT,  tx.inc(GAP), 37); //not implemented
Line 392... Line 401...
392
	DrawStatusBar();
401
	DrawStatusBar();
393
}
402
}
Line 394... Line 403...
394
 
403
 
395
void DrawLeftPanel()
404
void DrawLeftPanel()
-
 
405
{
396
{
406
	#define GAP 28
397
	incn ty;
407
	incn ty;
398
	ty.n = right_bar.y - TB_ICON_PADDING;
408
	ty.n = right_bar.y - GAP - 2;
399
	DrawLeftPanelButton(BTN_PENCIL, ty.inc(TB_ICON_PADDING), 38);
409
	DrawLeftPanelButton(BTN_PENCIL, ty.inc(GAP), 38);
400
	DrawLeftPanelButton(BTN_PICK,   ty.inc(TB_ICON_PADDING), 39);
410
	DrawLeftPanelButton(BTN_PICK,   ty.inc(GAP), 39);
401
	DrawLeftPanelButton(BTN_FILL,   ty.inc(TB_ICON_PADDING), 40);
411
	DrawLeftPanelButton(BTN_FILL,   ty.inc(GAP), 40);
402
	DrawLeftPanelButton(BTN_LINE,   ty.inc(TB_ICON_PADDING), 41);
412
	DrawLeftPanelButton(BTN_LINE,   ty.inc(GAP), 41);
403
	DrawLeftPanelButton(BTN_RECT,   ty.inc(TB_ICON_PADDING), 42);
413
	DrawLeftPanelButton(BTN_RECT,   ty.inc(GAP), 42);
404
	DrawLeftPanelButton(BTN_BAR,    ty.inc(TB_ICON_PADDING), 43);
414
	DrawLeftPanelButton(BTN_BAR,    ty.inc(GAP), 43);
405
	DrawLeftPanelButton(BTN_SELECT, ty.inc(TB_ICON_PADDING), 44);
415
	DrawLeftPanelButton(BTN_SELECT, ty.inc(GAP), 44);
406
	DrawLeftPanelButton(BTN_SCREEN_COPY, ty.inc(TB_ICON_PADDING), 45);
416
	DrawLeftPanelButton(BTN_SCREEN_COPY, ty.inc(GAP), 45);
407
	DrawRectangle3D(5, currentTool*TB_ICON_PADDING+right_bar.y, 16+3+2, 16+3+2, 0x333333, 0x777777);
417
	DrawRectangle3D(5, currentTool*GAP+right_bar.y-2, 16+3+2, 16+3+2, 0x333333, 0x777777);
Line 408... Line 418...
408
}
418
}
409
 
419
 
410
void DrawEditArea()
420
void DrawEditArea()