Rev 8954 | Rev 9597 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8954 | Rev 9016 | ||
---|---|---|---|
Line 158... | Line 158... | ||
158 | // // |
158 | // // |
159 | // CODE // |
159 | // CODE // |
160 | // // |
160 | // // |
161 | //===================================================// |
161 | //===================================================// |
Line 162... | Line 162... | ||
162 | 162 | ||
163 | libimg_image top_icons; |
- | |
Line 164... | Line 163... | ||
164 | libimg_image left_icons; |
163 | libimg_image icons16; |
165 | 164 | ||
166 | void main() |
165 | void main() |
167 | { |
166 | { |
Line 168... | Line 167... | ||
168 | word btn; |
167 | word btn; |
169 | libimg_image open_image; |
168 | libimg_image open_image; |
Line 170... | Line 169... | ||
170 | 169 | ||
171 | load_dll(libimg, #libimg_init, 1); |
- | |
172 | load_dll(boxlib, #box_lib_init,0); |
170 | load_dll(libimg, #libimg_init, 1); |
Line 173... | Line 171... | ||
173 | 171 | load_dll(boxlib, #box_lib_init,0); |
|
174 | top_icons.load("/sys/icons16.png"); |
172 | |
Line 175... | Line 173... | ||
175 | left_icons.load("/sys/icons16.png"); |
173 | icons16.load("/sys/icons16.png"); |
176 | leftbar_w = left_icons.w + 16; |
- | |
177 | - | ||
178 | sc.get(); |
- | |
179 | bg_dark = skin_is_dark(); |
174 | leftbar_w = icons16.w + 16; |
180 | 175 | ||
Line 181... | Line 176... | ||
181 | semi_white = MixColors(sc.work, 0xFFFfff, bg_dark*90 + 96); |
176 | sc.get(); |
182 | top_icons.replace_color(0xffFFFfff, semi_white); |
177 | bg_dark = skin_is_dark(); |
Line 183... | Line 178... | ||
183 | top_icons.replace_color(0xffCACBD6, MixColors(semi_white, 0, 220)); |
178 | |
Line 184... | Line 179... | ||
184 | 179 | semi_white = MixColors(sc.work, 0xFFFfff, bg_dark*90 + 96); |
|
185 | left_icons.replace_color(0xffFFFfff, sc.work); |
180 | icons16.replace_color(0xffFFFfff, sc.work); |
Line 301... | Line 296... | ||
301 | } |
296 | } |
302 | } |
297 | } |
Line 303... | Line 298... | ||
303 | 298 | ||
304 | void DrawTopPanelButton1(dword _event, _hotkey, _x, _icon_n) |
299 | void DrawTopPanelButton1(dword _event, _hotkey, _x, _icon_n) |
305 | { |
- | |
306 | DrawWideRectangle(_x, 4, 22, 22, 3, semi_white); |
300 | { |
307 | PutPixel(_x,4,sc.work); |
- | |
308 | PutPixel(_x,4+21,sc.work); |
301 | #define ISIZE 18 |
309 | PutPixel(_x+21,4,sc.work); |
- | |
310 | PutPixel(_x+21,4+21,sc.work); |
302 | #define YPOS 6 |
311 | DefineHiddenButton(_x, 4, 21, 21, button.add(_event)); |
303 | DefineHiddenButton(_x-4, YPOS-4, ISIZE+7, ISIZE+7, button.add(_event)); |
312 | img_draw stdcall(top_icons.image, -top_icons.w+16/2+_x+3, -top_icons.w+16/2+7, left_icons.w, |
- | |
313 | left_icons.w, 0, _icon_n*left_icons.w); |
- | |
314 | //DrawTopPanelButton(button.add(_event), _x, 5, _icon_n, false); |
304 | img_draw stdcall(icons16.image, _x, YPOS, ISIZE, ISIZE, 0, _icon_n*ISIZE); |
315 | if (_hotkey) key.add_n(_hotkey, _event); |
305 | if (_hotkey) key.add_n(_hotkey, _event); |
Line 316... | Line 306... | ||
316 | } |
306 | } |
Line 331... | Line 321... | ||
331 | } |
321 | } |
Line 332... | Line 322... | ||
332 | 322 | ||
333 | void DrawLeftPanelButton(dword _event, _hotkey, _y, _icon_n) |
323 | void DrawLeftPanelButton(dword _event, _hotkey, _y, _icon_n) |
334 | { |
324 | { |
335 | int x = 5; |
325 | int x = 5; |
336 | DrawRectangle(x, _y, left_icons.w + 5, left_icons.w + 5, sc.work); |
326 | DrawRectangle(x, _y, icons16.w + 5, icons16.w + 5, sc.work); |
337 | DefineHiddenButton(x, _y, left_icons.w + 5, left_icons.w + 5, button.add(_event)); |
327 | DefineHiddenButton(x, _y, icons16.w + 5, icons16.w + 5, button.add(_event)); |
338 | img_draw stdcall(left_icons.image, x+3, _y+3, left_icons.w, |
328 | img_draw stdcall(icons16.image, x+3, _y+3, icons16.w, |
339 | left_icons.w, 0, _icon_n*left_icons.w); |
329 | icons16.w, 0, _icon_n*icons16.w); |
340 | key.add_n(_hotkey, _event); |
330 | key.add_n(_hotkey, _event); |
341 | } |
331 | } |
342 | void DrawStatusBar() |
332 | void DrawStatusBar() |
343 | { |
333 | { |
Line 359... | Line 349... | ||
359 | 349 | ||
360 | void DrawWindow() |
350 | void DrawWindow() |
361 | { |
351 | { |
362 | #define GAPH 27 |
352 | #define GAPH 27 |
363 | #define GAPV 28 |
353 | #define GAPV 28 |
364 | #define GAP_S 26+5 |
354 | #define GAP_S 24+7 |
365 | #define GAP_B 26+18 |
355 | #define GAP_B 24+20 |
366 | #define BLOCK_SPACE 10 |
356 | #define BLOCK_SPACE 10 |
367 | incn tx; |
357 | incn tx; |
368 | incn ty; |
358 | incn ty; |
369 | sc.get(); |
359 | sc.get(); |
Line 378... | Line 368... | ||
378 | right_bar.x = Form.cwidth - right_bar.w; |
368 | right_bar.x = Form.cwidth - right_bar.w; |
379 | 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; |
380 | DrawBar(0, 0, Form.cwidth, TOPBAR_H-1, sc.work); |
370 | DrawBar(0, 0, Form.cwidth, TOPBAR_H-1, sc.work); |
381 | DrawBar(0, TOPBAR_H-1, Form.cwidth, 1, sc.work_graph); |
371 | DrawBar(0, TOPBAR_H-1, Form.cwidth, 1, sc.work_graph); |
Line 382... | Line 372... | ||
382 | 372 | ||
383 | DrawTopPanelButton1(#EventCreateNewIcon, ECTRL + SCAN_CODE_KEY_N, tx.set(5), 2); |
373 | DrawTopPanelButton1(#EventCreateNewIcon, ECTRL + SCAN_CODE_KEY_N, tx.set(7), 2); |
384 | DrawTopPanelButton1(#EventOpenIcon, ECTRL + SCAN_CODE_KEY_O, tx.inc(GAP_S), 0); |
374 | DrawTopPanelButton1(#EventOpenIcon, ECTRL + SCAN_CODE_KEY_O, tx.inc(GAP_S), 0); |
385 | DrawTopPanelButton1(#EventSaveIconToFile, ECTRL + SCAN_CODE_KEY_S, tx.inc(GAP_S), 5); |
375 | DrawTopPanelButton1(#EventSaveIconToFile, ECTRL + SCAN_CODE_KEY_S, tx.inc(GAP_S), 5); |
386 | DrawTopPanelButton1(#EventMoveLeft, ECTRL + SCAN_CODE_LEFT, tx.inc(GAP_B), 30); |
376 | DrawTopPanelButton1(#EventMoveLeft, ECTRL + SCAN_CODE_LEFT, tx.inc(GAP_B), 30); |
387 | DrawTopPanelButton1(#EventMoveRight, ECTRL + SCAN_CODE_RIGHT, tx.inc(GAP_S), 31); |
377 | DrawTopPanelButton1(#EventMoveRight, ECTRL + SCAN_CODE_RIGHT, tx.inc(GAP_S), 31); |
Line 427... | Line 417... | ||
427 | DrawStatusBar(); |
417 | DrawStatusBar(); |
428 | } |
418 | } |
Line 429... | Line 419... | ||
429 | 419 | ||
430 | void DrawLeftPanelSelection() |
420 | void DrawLeftPanelSelection() |
431 | { |
421 | { |
432 | if (previousTool!=-1) DrawRectangle3D(5, previousTool*GAPV+right_bar.y-2, left_icons.w+5, left_icons.w+5, sc.work, sc.work); |
422 | if (previousTool!=-1) DrawRectangle3D(5, previousTool*GAPV+right_bar.y-2, icons16.w+5, icons16.w+5, sc.work, sc.work); |
433 | DrawRectangle3D(5, currentTool*GAPV+right_bar.y-2, left_icons.w+5, left_icons.w+5, 0x333333, 0x777777); |
423 | DrawRectangle3D(5, currentTool*GAPV+right_bar.y-2, icons16.w+5, icons16.w+5, 0x333333, 0x777777); |
Line 434... | Line 424... | ||
434 | } |
424 | } |
435 | 425 | ||
436 | void DrawEditArea() |
426 | void DrawEditArea() |
437 | { |
427 | { |
438 | dword color1=0xC0C0C0; |
428 | dword color1=0xC0C0C0; |
Line 439... | Line 429... | ||
439 | int top_side; |
429 | int top_side; |
440 | int left_side; |
430 | int left_side; |
441 | 431 | ||
Line 442... | Line 432... | ||
442 | wrapper.x = left_icons.w + 16; |
432 | wrapper.x = icons16.w + 16; |
443 | wrapper.w = Form.cwidth - right_bar.w - 10 - wrapper.x; |
433 | wrapper.w = Form.cwidth - right_bar.w - 10 - wrapper.x; |
Line 663... | Line 653... | ||
663 | void EventOpenIcon() |
653 | void EventOpenIcon() |
664 | { |
654 | { |
665 | RunProgram("/sys/lod", sprintf(#param, "*png* %s",#program_path)); |
655 | RunProgram("/sys/lod", sprintf(#param, "*png* %s",#program_path)); |
666 | } |
656 | } |
Line -... | Line 657... | ||
- | 657 | ||
- | 658 | #ifdef LANG_RUS |
|
- | 659 | #define TEXT_FILE_SAVED_AS "' ©« á®åà ¥ ª ª %s' -O" |
|
- | 660 | #else |
|
- | 661 | #define TEXT_FILE_SAVED_AS "'File saved as %s' -O" |
|
667 | 662 | #endif |
|
668 | void EventSaveIconToFile() |
663 | void EventSaveIconToFile() |
669 | { |
664 | { |
670 | int i=0; |
665 | int i=0; |
671 | char save_file_name[4096]; |
666 | char save_file_name[4096]; |
- | 667 | char save_path_stable[4096]; |
|
672 | char save_path_stable[4096]; |
668 | char save_success_message[4096+200]; |
673 | strcpy(#save_path_stable, "/tmp0/1"); |
669 | strcpy(#save_path_stable, "/tmp0/1"); |
674 | do { |
670 | do { |
675 | i++; |
671 | i++; |
676 | sprintf(#save_file_name, "%s/saved_icon_%i.png", #save_path_stable, i); |
672 | sprintf(#save_file_name, "%s/icon_%i.png", #save_path_stable, i); |
677 | } while (file_exists(#save_file_name)); |
673 | } while (file_exists(#save_file_name)); |
- | 674 | save_image(image.get_image(), image.columns, image.rows, #save_file_name); |
|
- | 675 | ||
- | 676 | sprintf(#save_success_message, TEXT_FILE_SAVED_AS, #save_file_name); |
|
678 | save_image(image.get_image(), image.columns, image.rows, #save_file_name); |
677 | notify(#save_success_message); |
Line 679... | Line 678... | ||
679 | } |
678 | } |
680 | 679 | ||
681 | void EventCleanCanvas() |
680 | void EventCleanCanvas() |