Rev 8256 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
7274 | leency | 1 | |
2 | |||
3 | |||
4 | // // |
||
5 | // CODE // |
||
6 | // // |
||
7 | //===================================================// |
||
8 | |||
9 | |||
7506 | leency | 10 | char text_rows[5]; |
11 | |||
7274 | leency | 12 | |
7506 | leency | 13 | 0x10000000,sizeof(text_columns)-2,#text_columns,0, ed_figure_only+ed_focus}; |
14 | edit_box edit_rows = {60,NULL,NULL,0xffffff,0x94AECE,0xffc90E,0xffffff, |
||
15 | 0x10000000,sizeof(text_rows)-2,#text_rows,0, ed_figure_only}; |
||
16 | |||
7274 | leency | 17 | |
18 | |||
19 | |||
20 | { |
||
21 | int id, butw; |
||
22 | |||
23 | |||
24 | sprintf(#text_rows, "%i", image.rows); |
||
25 | EditBox_UpdateText(#edit_columns, ed_figure_only+ed_focus); |
||
7506 | leency | 26 | EditBox_UpdateText(#edit_rows, ed_figure_only); |
27 | |||
7274 | leency | 28 | |
29 | loop() switch(WaitEvent()) |
||
30 | { |
||
31 | case evMouse: |
||
32 | edit_box_mouse stdcall (#edit_columns); |
||
33 | edit_box_mouse stdcall (#edit_rows); |
||
34 | break; |
||
35 | |||
36 | |||
37 | GetKeys(); |
||
38 | |||
39 | |||
40 | if (SCAN_CODE_ENTER == key_scancode) EventApplyClick(); |
||
41 | if (SCAN_CODE_TAB == key_scancode) EventTabClick(); |
||
42 | |||
43 | |||
8256 | leency | 44 | edit_box_key stdcall (#edit_columns); |
7274 | leency | 45 | edit_box_key stdcall (#edit_rows); |
46 | break; |
||
47 | |||
48 | |||
49 | id = GetButtonID(); |
||
50 | if (CLOSE_BTN == id) ExitProcess(); |
||
51 | if (BTN_APPLY == id) EventApplyClick(); |
||
52 | break; |
||
53 | |||
54 | |||
55 | DefineAndDrawWindow(Form.left+canvas.x + 100, Form.top+skin_h+canvas.y+40, |
||
9597 | leency | 56 | 200, 170, 0x34, sc.work, "Canvas", 0); |
7806 | leency | 57 | WriteText(20, 20, 0x90, sc.work_text, "Width"); |
58 | WriteText(20, 60, 0x90, sc.work_text, "Height"); |
||
59 | DrawStandartCaptButton(20, 100, BTN_APPLY, "OK"); |
||
7274 | leency | 60 | DrawEditBoxes(); |
61 | } |
||
62 | } |
||
63 | |||
64 | |||
65 | { |
||
66 | DrawEditBoxPos(20+70, 20-4, #edit_columns); |
||
67 | DrawEditBoxPos(20+70, 60-4, #edit_rows); |
||
68 | } |
||
69 | |||
70 | |||
71 | // // |
||
72 | // EVENTS // |
||
73 | // // |
||
74 | //===================================================// |
||
75 | |||
76 | |||
77 | { |
||
78 | int new_rows = atoi(#text_rows); |
||
79 | int new_columns = atoi(#text_columns); |
||
80 | if (new_columns>MAX_CELL_SIZE) || (new_rows>MAX_CELL_SIZE) { |
||
81 | sprintf(#param, |
||
7275 | leency | 82 | "'Maximum icon size exceeded! Please, try\nsomething less or equal to %ix%i.' -E", |
83 | MAX_CELL_SIZE, MAX_CELL_SIZE); |
||
84 | notify(#param); |
||
85 | return; |
||
7274 | leency | 86 | } |
87 | image.create(new_rows, new_columns); |
||
88 | actionsHistory.init(); |
||
89 | ActivateWindow(GetProcessSlot(Form.ID)); |
||
90 | DrawEditArea(); |
||
7275 | leency | 91 | ExitProcess(); |
7274 | leency | 92 | } |
93 | |||
94 | |||
95 | { |
||
96 | if ( edit_columns.flags & ed_focus ) { |
||
7506 | leency | 97 | EditBox_UpdateText(#edit_columns, ed_figure_only); |
98 | EditBox_UpdateText(#edit_rows, ed_focus+ed_figure_only); |
||
99 | } else { |
||
100 | EditBox_UpdateText(#edit_columns, ed_focus+ed_figure_only); |
||
101 | EditBox_UpdateText(#edit_rows, ed_figure_only); |
||
102 | } |
||
103 | DrawEditBoxes(); |
||
7274 | leency | 104 | } |
105 |