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