Rev 7089 | Rev 7218 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7089 | Rev 7160 | ||
---|---|---|---|
1 | #ifndef INCLUDE_GUI_H |
1 | #ifndef INCLUDE_GUI_H |
2 | #define INCLUDE_GUI_H |
2 | #define INCLUDE_GUI_H |
3 | 3 | ||
4 | #ifndef INCLUDE_KOLIBRI_H |
4 | #ifndef INCLUDE_KOLIBRI_H |
5 | #include "../lib/kolibri.h" |
5 | #include "../lib/kolibri.h" |
6 | #endif |
6 | #endif |
7 | 7 | ||
8 | #ifndef INCLUDE_STRING_H |
8 | #ifndef INCLUDE_STRING_H |
9 | #include "../lib/strings.h" |
9 | #include "../lib/strings.h" |
10 | #endif |
10 | #endif |
11 | 11 | ||
12 | #ifndef INCLUDE_RGB_H |
12 | #ifndef INCLUDE_RGB_H |
13 | #include "../lib/patterns/rgb.h" |
13 | #include "../lib/patterns/rgb.h" |
14 | #endif |
14 | #endif |
15 | 15 | ||
16 | #ifndef INCLUDE_MATH_H |
16 | #ifndef INCLUDE_MATH_H |
17 | #include "../lib/math.h" |
17 | #include "../lib/math.h" |
18 | #endif |
18 | #endif |
19 | 19 | ||
20 | :void DrawRectangle(dword x,y,w,h,color1) |
20 | :void DrawRectangle(dword x,y,w,h,color1) |
21 | { |
21 | { |
22 | if (w<=0) || (h<=0) return; |
22 | if (w<=0) || (h<=0) return; |
23 | DrawBar(x,y,w,1,color1); |
23 | DrawBar(x,y,w,1,color1); |
24 | DrawBar(x,y+h,w,1,color1); |
24 | DrawBar(x,y+h,w,1,color1); |
25 | DrawBar(x,y,1,h,color1); |
25 | DrawBar(x,y,1,h,color1); |
26 | DrawBar(x+w,y,1,h+1,color1); |
26 | DrawBar(x+w,y,1,h+1,color1); |
27 | } |
27 | } |
28 | 28 | ||
29 | :void DrawWideRectangle(dword x,y,w,h,boder,color1) |
29 | :void DrawWideRectangle(dword x,y,w,h,boder,color1) |
30 | { |
30 | { |
31 | if (w<=0) || (h<=0) return; |
31 | if (w<=0) || (h<=0) return; |
32 | DrawBar(x, y, w, boder, color1); |
32 | DrawBar(x, y, w, boder, color1); |
33 | DrawBar(x, y+h-boder, w, boder, color1); |
33 | DrawBar(x, y+h-boder, w, boder, color1); |
34 | DrawBar(x, y+boder, boder, h-boder-boder, color1); |
34 | DrawBar(x, y+boder, boder, h-boder-boder, color1); |
35 | DrawBar(x+w-boder, y+boder, boder, h-boder-boder, color1); |
35 | DrawBar(x+w-boder, y+boder, boder, h-boder-boder, color1); |
36 | } |
36 | } |
37 | 37 | ||
38 | :void DrawRectangle3D(dword x,y,w,h,color1,color2) |
38 | :void DrawRectangle3D(dword x,y,w,h,color1,color2) |
39 | { |
39 | { |
40 | if (w<=0) || (h<=0) return; |
40 | if (w<=0) || (h<=0) return; |
41 | DrawBar(x,y,w+1,1,color1); |
41 | DrawBar(x,y,w+1,1,color1); |
42 | DrawBar(x,y+1,1,h-1,color1); |
42 | DrawBar(x,y+1,1,h-1,color1); |
43 | DrawBar(x+w,y+1,1,h,color2); |
43 | DrawBar(x+w,y+1,1,h,color2); |
44 | DrawBar(x,y+h,w,1,color2); |
44 | DrawBar(x,y+h,w,1,color2); |
45 | } |
45 | } |
46 | 46 | ||
47 | :void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text) |
47 | :void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text) |
48 | { |
48 | { |
49 | dword tx = -strlen(text)*8+w/2+x; |
49 | dword tx = -strlen(text)*8+w/2+x; |
50 | dword ty = h/2-7+y; |
50 | dword ty = h/2-7+y; |
51 | 51 | ||
52 | if (id>0) DefineButton(x,y,w,h,id,color_b); |
52 | if (id>0) DefineButton(x,y,w,h,id,color_b); |
53 | WriteText(tx+1,ty+1,0x90,MixColors(color_b,0,230),text); |
53 | WriteText(tx+1,ty+1,0x90,MixColors(color_b,0,230),text); |
54 | WriteText(tx,ty,0x90,color_t,text); |
54 | WriteText(tx,ty,0x90,color_t,text); |
55 | } |
55 | } |
56 | 56 | ||
57 | :int active_button_id = 0; |
57 | :int active_button_id = 0; |
58 | :int DrawStandartCaptButton(dword x, y, id, text) |
58 | :int DrawStandartCaptButton(dword x, y, id, text) |
59 | { |
59 | { |
60 | int padding_v = 5; |
60 | int padding_v = 5; |
61 | int padding_h = 15; |
61 | int padding_h = 15; |
62 | int right_margin = 12; |
62 | int right_margin = 12; |
63 | int tx = x + padding_h; |
63 | int tx = x + padding_h; |
64 | int ty = y + padding_v+1; |
64 | int ty = y + padding_v+1; |
65 | int tw = strlen(text)*8; |
65 | int tw = strlen(text)*8; |
66 | int h = padding_v + padding_v + 16; //16 font height |
66 | int h = padding_v + padding_v + 16; //16 font height |
67 | int w = tw + padding_h + padding_h; |
67 | int w = tw + padding_h + padding_h; |
68 | 68 | ||
69 | 69 | ||
70 | if (id>0) DefineButton(x,y,w,h,id,system.color.work_button); |
70 | if (id>0) DefineButton(x,y,w,h,id,system.color.work_button); |
71 | 71 | ||
72 | WriteText(tx+1,ty+1,0x90,MixColors(system.color.work_button,0,230),text); |
72 | WriteText(tx+1,ty+1,0x90,MixColors(system.color.work_button,0,230),text); |
73 | WriteText(tx,ty,0x90,system.color.work_button_text,text); |
73 | WriteText(tx,ty,0x90,system.color.work_button_text,text); |
74 | 74 | ||
75 | if (active_button_id==id) { |
75 | if (active_button_id==id) { |
76 | DrawBar(tx,ty+15,tw,1, MixColors(system.color.work_button,0,230)); |
76 | DrawBar(tx,ty+15,tw,1, MixColors(system.color.work_button,0,230)); |
77 | DrawBar(tx,ty+14,tw,1, system.color.work_button_text); |
77 | DrawBar(tx,ty+14,tw,1, system.color.work_button_text); |
78 | } |
78 | } |
79 | 79 | ||
80 | return w + right_margin; |
80 | return w + right_margin; |
81 | } |
81 | } |
82 | 82 | ||
83 | :void ActiveButtonSwitch(int min, max) |
83 | :void ActiveButtonSwitch(int min, max) |
84 | { |
84 | { |
85 | active_button_id++; |
85 | active_button_id++; |
86 | if (active_button_id>max) || (active_button_id |
86 | if (active_button_id>max) || (active_button_id |
87 | } |
87 | } |
88 | 88 | ||
89 | :void WriteTextCenter(dword x,y,w,color_t,text) |
89 | :void WriteTextCenter(dword x,y,w,color_t,text) |
90 | { |
90 | { |
91 | WriteText(-strlen(text)*6+w/2+x+1,y,0x80,color_t,text); |
91 | WriteText(-strlen(text)*6+w/2+x+1,y,0x80,color_t,text); |
92 | } |
92 | } |
93 | 93 | ||
94 | :void DrawCircle(int x, y, r, color) |
94 | :void DrawCircle(int x, y, r, color) |
95 | { |
95 | { |
96 | int i; |
96 | int i; |
97 | float px=0, py=r, ii = r * 3.1415926 * 2; |
97 | float px=0, py=r, ii = r * 3.1415926 * 2; |
98 | FOR (i = 0; i < ii; i++) |
98 | FOR (i = 0; i < ii; i++) |
99 | { |
99 | { |
100 | PutPixel(px + x, y - py, color); |
100 | PutPixel(px + x, y - py, color); |
101 | px = py / r + px; |
101 | px = py / r + px; |
102 | py = -px / r + py; |
102 | py = -px / r + py; |
103 | } |
103 | } |
104 | } |
104 | } |
105 | 105 | ||
106 | :unsigned char checkbox_flag[507] = { |
106 | :unsigned char checkbox_flag[507] = { |
107 | 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, |
107 | 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, |
108 | 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, |
108 | 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, |
109 | 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xC8, 0x04, 0xFC, 0xDC, 0x04, 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x64, 0x04, 0xF9, 0x98, 0x04, 0xFA, |
125 | 0xFF, 0xFF, 0xFF, 0xFD, 0xFD, 0xF6, 0xF7, 0xE0, 0x95, 0xBC, 0x64, 0x04, 0xF9, 0x98, 0x04, 0xFA, |
126 | 0x9F, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xD4, 0x04, 0xF9, 0x98, 0x04, 0xBC, 0x64, |
126 | 0x9F, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xD4, 0x04, 0xF9, 0x98, 0x04, 0xBC, 0x64, |
127 | 0x04, 0xF7, 0xE0, 0x95, 0xFD, 0xFD, 0xF6, 0xFD, 0xFD, 0xF6, 0xF7, 0xE0, 0x95, 0xBC, 0x64, 0x04, |
127 | 0x04, 0xF7, 0xE0, 0x95, 0xFD, 0xFD, 0xF6, 0xFD, 0xFD, 0xF6, 0xF7, 0xE0, 0x95, 0xBC, 0x64, 0x04, |
128 | 0xF9, 0x98, 0x04, 0xFA, 0x9F, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFC, |
128 | 0xF9, 0x98, 0x04, 0xFA, 0x9F, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFC, |
129 | 0xC8, 0x04, 0xFA, 0xA5, 0x04, 0xF9, 0x98, 0x04, 0xBC, 0x64, 0x04, 0xF7, 0xE0, 0x95, 0xF7, 0xE0, |
129 | 0xC8, 0x04, 0xFA, 0xA5, 0x04, 0xF9, 0x98, 0x04, 0xBC, 0x64, 0x04, 0xF7, 0xE0, 0x95, 0xF7, 0xE0, |
130 | 0x95, 0xBC, 0x64, 0x04, 0xF9, 0x98, 0x04, 0xFA, 0x9F, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, |
130 | 0x95, 0xBC, 0x64, 0x04, 0xF9, 0x98, 0x04, 0xFA, 0x9F, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, |
131 | 0xFC, 0xA9, 0x04, 0xFA, 0x9F, 0x04, 0xFC, 0xC8, 0x04, 0xFC, 0xA9, 0x04, 0xFA, 0x9F, 0x04, 0xF9, |
131 | 0xFC, 0xA9, 0x04, 0xFA, 0x9F, 0x04, 0xFC, 0xC8, 0x04, 0xFC, 0xA9, 0x04, 0xFA, 0x9F, 0x04, 0xF9, |
132 | 0x98, 0x04, 0xBC, 0x64, 0x04, 0xBC, 0x64, 0x04, 0xF9, 0x98, 0x04, 0xFA, 0x9F, 0x04, 0xFC, 0xA9, |
132 | 0x98, 0x04, 0xBC, 0x64, 0x04, 0xBC, 0x64, 0x04, 0xF9, 0x98, 0x04, 0xFA, 0x9F, 0x04, 0xFC, 0xA9, |
133 | 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFA, 0x9F, 0x04, 0xFA, 0x9F, 0x04, 0xFC, 0xC8, 0x04, |
133 | 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFA, 0x9F, 0x04, 0xFA, 0x9F, 0x04, 0xFC, 0xC8, 0x04, |
134 | 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFA, 0x9F, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xFA, |
134 | 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFA, 0x9F, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xFA, |
135 | 0x9F, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFA, 0x9F, 0x04, 0xFA, 0x9F, |
135 | 0x9F, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFC, 0xA9, 0x04, 0xFA, 0x9F, 0x04, 0xFA, 0x9F, |
136 | 0x04, 0xF9, 0x98, 0x04, 0xFC, 0xB4, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, |
136 | 0x04, 0xF9, 0x98, 0x04, 0xFC, 0xB4, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, |
137 | 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, |
137 | 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, |
138 | 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04 |
138 | 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04 |
139 | }; |
139 | }; |
140 | 140 | ||
141 | :void CheckBox(dword x,y,bt_id, text, is_checked) |
141 | :void CheckBox(dword x,y,bt_id, text, is_checked) |
142 | { |
142 | { |
143 | byte w=14, h=14; |
143 | byte w=14, h=14; |
144 | DefineButton(x-1, y-1, strlen(text)*8 + w + 17, h+2, bt_id+BT_HIDE+BT_NOFRAME, 0); |
144 | DefineButton(x-1, y-1, strlen(text)*8 + w + 17, h+2, bt_id+BT_HIDE+BT_NOFRAME, 0); |
145 | EDI = system.color.work; |
145 | EDI = system.color.work; |
146 | WriteText(x+w+8, h / 2 + y -7, 0xD0, system.color.work_text, text); |
146 | WriteText(x+w+8, h / 2 + y -7, 0xD0, system.color.work_text, text); |
147 | DrawRectangle(x, y, w, h, system.color.work_graph); |
147 | DrawRectangle(x, y, w, h, system.color.work_graph); |
148 | if (is_checked == 0) |
148 | if (is_checked == 0) |
149 | { |
149 | { |
150 | DrawRectangle3D(x+1, y+1, w-2, h-2, 0xDDDddd, 0xffffff); |
150 | DrawRectangle3D(x+1, y+1, w-2, h-2, 0xDDDddd, 0xffffff); |
151 | DrawBar(x+2, y+2, w-3, h-3, 0xffffff); |
151 | DrawBar(x+2, y+2, w-3, h-3, 0xffffff); |
152 | } |
152 | } |
153 | else if (is_checked == 1) |
153 | else if (is_checked == 1) |
154 | { |
154 | { |
155 | DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff); |
155 | DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff); |
156 | _PutImage(x+1, y+1, 13, 13, #checkbox_flag); |
156 | _PutImage(x+1, y+1, 13, 13, #checkbox_flag); |
157 | } |
157 | } |
158 | else if (is_checked == 2) //not active |
158 | else if (is_checked == 2) //not active |
159 | { |
159 | { |
160 | DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff); |
160 | DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff); |
161 | DrawBar(x+3, y+3, w-5, h-5, 0x888888); |
161 | DrawBar(x+3, y+3, w-5, h-5, 0x888888); |
162 | } |
162 | } |
163 | DrawRectangle3D(x-1,y-1,w+2,h+2,system.color.work_dark,system.color.work_light); |
163 | DrawRectangle3D(x-1,y-1,w+2,h+2,system.color.work_dark,system.color.work_light); |
164 | } |
164 | } |
165 | 165 | ||
166 | :void MoreLessBox(dword x,y, bt_id_more, bt_id_less, value, text) |
166 | :void MoreLessBox(dword x,y, bt_id_more, bt_id_less, value, text) |
167 | { |
167 | { |
168 | #define VALUE_FIELD_W 34 |
168 | #define VALUE_FIELD_W 34 |
169 | #define SIZE 18 |
169 | #define SIZE 18 |
170 | dword value_text = itoa(value); |
170 | dword value_text = itoa(value); |
171 | 171 | ||
172 | DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph); |
172 | DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph); |
173 | DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff); |
173 | DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff); |
174 | DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff); |
174 | DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff); |
175 | WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text); |
175 | WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text); |
176 | 176 | ||
177 | DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+"); |
177 | DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+"); |
178 | DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-"); |
178 | DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-"); |
179 | EDI = system.color.work; |
179 | EDI = system.color.work; |
180 | WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text); |
180 | WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text); |
181 | DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light); |
181 | DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light); |
182 | } |
182 | } |
183 | 183 | ||
184 | :void DrawEditBox(dword edit_box_pointer) |
184 | :void DrawEditBox(dword edit_box_pointer) |
185 | { |
185 | { |
186 | dword x,y,w,h,bg; |
186 | dword x,y,w,h,bg; |
187 | ESI = edit_box_pointer; |
187 | ESI = edit_box_pointer; |
188 | x = ESI.edit_box.left; |
188 | x = ESI.edit_box.left; |
189 | y = ESI.edit_box.top; |
189 | y = ESI.edit_box.top; |
190 | w = ESI.edit_box.width+1; |
190 | w = ESI.edit_box.width+1; |
191 | if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff; |
191 | if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff; |
192 | edit_box_draw stdcall (edit_box_pointer); |
192 | edit_box_draw stdcall (edit_box_pointer); |
193 | h = 22; |
193 | h = 22; |
194 | DrawRectangle(x-1, y-1, w+1, h+1, bg); |
194 | DrawRectangle(x-1, y-1, w+1, h+1, bg); |
195 | DrawRectangle3D(x-2, y-2, w+3, h+3, 0xDDDddd, bg); |
195 | DrawRectangle3D(x-2, y-2, w+3, h+3, 0xDDDddd, bg); |
196 | DrawRectangle(x-3, y-3, w+5, h+5, system.color.work_graph); |
196 | DrawRectangle(x-3, y-3, w+5, h+5, system.color.work_graph); |
197 | DrawRectangle3D(x-4, y-4, w+7, h+7, system.color.work_dark, system.color.work_light); |
197 | DrawRectangle3D(x-4, y-4, w+7, h+7, system.color.work_dark, system.color.work_light); |
198 | } |
198 | } |
199 | 199 | ||
200 | :void DrawProgressBar(dword st_x, st_y, st_w, st_h, col_fon, col_border, col_fill, col_text, progress_percent) |
200 | :void DrawProgressBar(dword st_x, st_y, st_w, st_h, col_fon, col_border, col_fill, col_text, progress_percent) |
201 | { |
201 | { |
202 | int progress_w; |
202 | int progress_w; |
203 | static int fill_old; |
203 | static int fill_old; |
204 | 204 | ||
205 | //if (progress_percent<=0) {DrawBar(st_x,st_y, st_x + st_w + fill_old + 15,st_h+1, col_fon); fill_old=0; return;} |
205 | //if (progress_percent<=0) {DrawBar(st_x,st_y, st_x + st_w + fill_old + 15,st_h+1, col_fon); fill_old=0; return;} |
206 | if (progress_percent<=0) || (progress_percent>=100) return; |
206 | if (progress_percent<=0) || (progress_percent>=100) return; |
207 | 207 | ||
208 | DrawRectangle(st_x, st_y, st_w,st_h, col_border); |
208 | DrawRectangle(st_x, st_y, st_w,st_h, col_border); |
209 | DrawRectangle3D(st_x+1, st_y+1, st_w-2,st_h-2, 0xFFFfff, 0xFFFfff); |
209 | DrawRectangle3D(st_x+1, st_y+1, st_w-2,st_h-2, 0xFFFfff, 0xFFFfff); |
210 | 210 | ||
211 | if (progress_percent>0) && (progress_percent<=100) |
211 | if (progress_percent>0) && (progress_percent<=100) |
212 | { |
212 | { |
213 | progress_w = st_w - 3 * progress_percent / 100; |
213 | progress_w = st_w - 3 * progress_percent / 100; |
214 | DrawBar(st_x+2, st_y+2, progress_w, st_h-3, col_fill); |
214 | DrawBar(st_x+2, st_y+2, progress_w, st_h-3, col_fill); |
215 | DrawBar(st_x+2+progress_w, st_y+2, st_w-progress_w-3, st_h-3, 0xFFFfff); |
215 | DrawBar(st_x+2+progress_w, st_y+2, st_w-progress_w-3, st_h-3, 0xFFFfff); |
216 | } |
216 | } |
217 | } |
217 | } |
218 | 218 | ||
219 | :void DrawLink(dword x,y,font_type,btn_id, inscription) |
219 | :void DrawLink(dword x,y,font_type,btn_id, inscription) |
220 | { |
220 | { |
221 | int w; |
221 | int w; |
222 | WriteText(x,y,font_type,0x4E00E7,inscription); |
222 | WriteText(x,y,font_type,0x4E00E7,inscription); |
223 | if (font_type==0x80) w = strlen(inscription)*6; else w = strlen(inscription)*8; |
223 | if (font_type==0x80) w = strlen(inscription)*6; else w = strlen(inscription)*8; |
224 | DefineButton(x-1,y-1,w,10,btn_id+BT_HIDE,0); |
224 | DefineButton(x-1,y-1,w,10,btn_id+BT_HIDE,0); |
225 | DrawBar(x,y+8,w,1,0x4E00E7); |
225 | DrawBar(x,y+8,w,1,0x4E00E7); |
226 | } |
226 | } |
227 | 227 | ||
228 | :void PutShadow(dword x,y,w,h,skinned,strength) |
228 | :void PutShadow(dword x,y,w,h,skinned,strength) |
229 | { |
229 | { |
230 | proc_info wForm; |
230 | proc_info wForm; |
231 | dword shadow_buf, skin_height; |
231 | dword shadow_buf, skin_height; |
232 | shadow_buf = mem_Alloc(w*h*3); |
232 | shadow_buf = mem_Alloc(w*h*3); |
233 | GetProcessInfo(#wForm, SelfInfo); |
233 | GetProcessInfo(#wForm, SelfInfo); |
234 | CopyScreen(shadow_buf, 5*skinned+x+wForm.left, GetSkinHeight()*skinned+y+wForm.top, w, h); |
234 | CopyScreen(shadow_buf, 5*skinned+x+wForm.left, GetSkinHeight()*skinned+y+wForm.top, w, h); |
235 | ShadowImage(shadow_buf, w, h, strength); |
235 | ShadowImage(shadow_buf, w, h, strength); |
236 | _PutImage(x,y,w,h,shadow_buf); |
236 | _PutImage(x,y,w,h,shadow_buf); |
237 | mem_Free(shadow_buf); |
237 | mem_Free(shadow_buf); |
238 | } |
238 | } |
239 | 239 | ||
240 | :void DrawPopup(dword x,y,w,h,skinned, col_work,col_border) |
240 | :void DrawPopup(dword x,y,w,h,skinned, col_work,col_border) |
241 | { |
241 | { |
242 | DrawRectangle(x,y,w,h,col_border); |
242 | DrawRectangle(x,y,w,h,col_border); |
243 | DrawBar(x+1,y+1,w-1,1,0xFFFfff); |
243 | DrawBar(x+1,y+1,w-1,1,0xFFFfff); |
244 | DrawBar(x+1,y+2,1,h-2,0xFFFfff); |
244 | DrawBar(x+1,y+2,1,h-2,0xFFFfff); |
245 | if (col_work!=-1) DrawBar(x+2,y+2,w-2,h-2,col_work); |
245 | if (col_work!=-1) DrawBar(x+2,y+2,w-2,h-2,col_work); |
246 | DrawPopupShadow(x,y,w,h-1,skinned); |
246 | DrawPopupShadow(x,y,w,h-1,skinned); |
247 | } |
247 | } |
248 | 248 | ||
249 | :void DrawPopupShadow(dword x,y,w,h,skinned) |
249 | :void DrawPopupShadow(dword x,y,w,h,skinned) |
250 | { |
250 | { |
251 | PutShadow(w+x+1,y,1,h+2,skinned,2); |
251 | PutShadow(w+x+1,y,1,h+2,skinned,2); |
252 | PutShadow(w+x+2,y+1,1,h+2,skinned,1); |
252 | PutShadow(w+x+2,y+1,1,h+2,skinned,1); |
253 | PutShadow(x,y+h+2,w+2,1,skinned,2); |
253 | PutShadow(x,y+h+2,w+2,1,skinned,2); |
254 | PutShadow(x+1,y+h+3,w+1,1,skinned,1); |
254 | PutShadow(x+1,y+h+3,w+1,1,skinned,1); |
255 | } |
255 | } |
256 | 256 | ||
257 | :void GrayScaleImage(dword color_image, w, h) |
257 | :void GrayScaleImage(dword color_image, w, h) |
258 | { |
258 | { |
259 | dword i,gray,to,rr,gg,bb; |
259 | dword i,gray,to,rr,gg,bb; |
260 | to = w*h*3 + color_image; |
260 | to = w*h*3 + color_image; |
261 | for (i = color_image; i < to; i+=3) |
261 | for (i = color_image; i < to; i+=3) |
262 | { |
262 | { |
263 | rr = DSBYTE[i]; |
263 | rr = DSBYTE[i]; |
264 | gg = DSBYTE[i+1]; |
264 | gg = DSBYTE[i+1]; |
265 | bb = DSBYTE[i+2]; |
265 | bb = DSBYTE[i+2]; |
266 | gray = rr*rr; |
266 | gray = rr*rr; |
267 | gray += gg*gg; |
267 | gray += gg*gg; |
268 | gray += bb*bb; |
268 | gray += bb*bb; |
269 | gray = sqrt(gray) / 3; |
269 | gray = sqrt(gray) / 3; |
270 | DSBYTE[i] = DSBYTE[i+1] = DSBYTE[i+2] = gray; |
270 | DSBYTE[i] = DSBYTE[i+1] = DSBYTE[i+2] = gray; |
271 | } |
271 | } |
272 | } |
272 | } |
273 | 273 | ||
274 | :void ShadowImage(dword color_image, w, h, strength) |
274 | :void ShadowImage(dword color_image, w, h, strength) |
275 | { |
275 | { |
276 | dword col, to; |
276 | dword col, to; |
277 | strength = 10 - strength; |
277 | strength = 10 - strength; |
278 | to = w*h*3 + color_image; |
278 | to = w*h*3 + color_image; |
279 | for ( ; color_image < to; color_image++) |
279 | for ( ; color_image < to; color_image++) |
280 | { |
280 | { |
281 | col = strength * DSBYTE[color_image] / 10; |
281 | col = strength * DSBYTE[color_image] / 10; |
282 | DSBYTE[color_image] = col; |
282 | DSBYTE[color_image] = col; |
283 | } |
283 | } |
284 | } |
284 | } |
285 | 285 | ||
286 | :void WriteTextLines(dword x,y,byte fontType, dword color, text_pointer, line_h) |
286 | :void WriteTextLines(dword x,y,byte fontType, dword color, text_pointer, line_h) |
287 | { |
287 | { |
288 | dword next_word_pointer = strchr(text_pointer, '\n'); |
288 | dword next_word_pointer = strchr(text_pointer, '\n'); |
289 | if (next_word_pointer) WriteTextLines(dword x, y+line_h, byte fontType, dword color, next_word_pointer+2, line_h); |
289 | if (next_word_pointer) WriteTextLines(dword x, y+line_h, byte fontType, dword color, next_word_pointer+2, line_h); |
290 | ESBYTE[next_word_pointer] = NULL; |
290 | ESBYTE[next_word_pointer] = NULL; |
291 | WriteText(dword x, y, byte fontType, dword color, text_pointer); |
291 | WriteText(dword x, y, byte fontType, dword color, text_pointer); |
292 | ESBYTE[next_word_pointer] = '\n'; |
292 | ESBYTE[next_word_pointer] = '\n'; |
293 | } |
293 | } |
294 | 294 | ||
295 | /* |
295 | /* |
296 | We have a long text and need to show it in block. |
296 | We have a long text and need to show it in block. |
297 | Normal line break '\n' must be applied. |
297 | Normal line break '\n' must be applied. |
298 | Long lines should be breaked by word. |
298 | Long lines should be breaked by word. |
299 | TODO: scroll |
299 | TODO: scroll |
300 | */ |
300 | */ |
301 | :int DrawTextViewArea(int x,y,w,h, dword buf_start, bg_col, text_col) |
301 | :int DrawTextViewArea(int x,y,w,h, dword buf_start, bg_col, text_col) |
302 | { |
302 | { |
303 | dword write_start; |
303 | dword write_start; |
304 | dword buf_end; |
304 | dword buf_end; |
305 | int line_h = 15; |
305 | int line_h = 15; |
306 | int label_length_max; |
306 | int label_length_max; |
307 | int write_length; |
307 | int write_length; |
308 | bool end_found; |
308 | bool end_found; |
309 | 309 | ||
310 | write_start = buf_start; |
310 | write_start = buf_start; |
311 | buf_end = strlen(buf_start) + buf_start; |
311 | buf_end = strlen(buf_start) + buf_start; |
312 | label_length_max = w / 8; // 8 big font char width |
312 | label_length_max = w / 8; // 8 big font char width |
313 | 313 | ||
314 | loop() |
314 | loop() |
315 | { |
315 | { |
316 | if (bg_col!=-1) DrawBar(x, y, w+1, line_h, bg_col); |
316 | if (bg_col!=-1) DrawBar(x, y, w+1, line_h, bg_col); |
317 | end_found = false; |
317 | end_found = false; |
318 | write_length = strchr(write_start, '\n') - write_start; //search normal line break |
318 | write_length = strchr(write_start, '\n') - write_start; //search normal line break |
319 | if (write_length > label_length_max) || (write_length<=0) //check its position: exceeds maximum line length or not found |
319 | if (write_length > label_length_max) || (write_length<=0) //check its position: exceeds maximum line length or not found |
320 | { |
320 | { |
321 | if (buf_end - write_start < label_length_max) //check does current line the last |
321 | if (buf_end - write_start < label_length_max) //check does current line the last |
322 | { |
322 | { |
323 | write_length = buf_end - write_start; |
323 | write_length = buf_end - write_start; |
324 | end_found = true; |
324 | end_found = true; |
325 | } |
325 | } |
326 | else |
326 | else |
327 | { |
327 | { |
328 | for (write_length=label_length_max; write_length>0; write_length--) { //search for white space to make the line break |
328 | for (write_length=label_length_max; write_length>0; write_length--) { //search for white space to make the line break |
329 | if (ESBYTE[write_start+write_length] == ' ') { |
329 | if (ESBYTE[write_start+write_length] == ' ') { |
330 | end_found = true; |
330 | end_found = true; |
331 | break; |
331 | break; |
332 | } |
332 | } |
333 | } |
333 | } |
334 | } |
334 | } |
335 | if (end_found != true) write_length = label_length_max; //no white space, so we write label_length_max |
335 | if (end_found != true) write_length = label_length_max; //no white space, so we write label_length_max |
336 | } |
336 | } |
337 | ESI = write_length; //set text length attribute for WriteText() |
337 | ESI = write_length; //set text length attribute for WriteText() |
338 | WriteText(x, y, 0x10, text_col, write_start); |
338 | WriteText(x, y, 0x10, text_col, write_start); |
339 | // if (editpos >= write_start-buf_start) && (editpos <= write_start-buf_start + write_length) { |
339 | // if (editpos >= write_start-buf_start) && (editpos <= write_start-buf_start + write_length) { |
340 | // WriteTextB(-write_start+buf_start+editpos * 8 + x - 5 +1, y, 0x90, 0xFF0000, "|"); |
340 | // WriteTextB(-write_start+buf_start+editpos * 8 + x - 5 +1, y, 0x90, 0xFF0000, "|"); |
341 | // } |
341 | // } |
342 | write_start += write_length + 1; |
342 | write_start += write_length + 1; |
343 | y += line_h; |
343 | y += line_h; |
344 | if (write_start >= buf_end) break; |
344 | if (write_start >= buf_end) break; |
345 | } |
345 | } |
346 | if (bg_col!=-1) DrawBar(x,y,w+1,h-y+line_h-4,bg_col); |
346 | if (bg_col!=-1) DrawBar(x,y,w+1,h-y+line_h-4,bg_col); |
347 | return y+line_h; |
347 | return y+line_h; |
348 | } |
348 | } |
349 | 349 | ||
350 | 350 | ||
351 | //this function increase falue and return it |
351 | //this function increase falue and return it |
352 | //useful for list of controls which goes one after one |
352 | //useful for list of controls which goes one after one |
353 | struct incn |
353 | :struct incn |
354 | { |
354 | { |
355 | dword n; |
355 | dword n; |
356 | dword inc(dword _addition); |
356 | dword inc(dword _addition); |
357 | }; |
357 | }; |
358 | 358 | ||
359 | dword incn::inc(dword _addition) |
359 | :dword incn::inc(dword _addition) |
360 | { |
360 | { |
361 | n+=_addition; |
361 | n+=_addition; |
362 | return n; |
362 | return n; |
363 | } |
363 | } |
364 | 364 | ||
365 | 365 | ||
366 | /*========================================================= |
366 | /*========================================================= |
367 | == |
367 | == |
368 | == TABS |
368 | == TABS |
369 | == |
369 | == |
370 | /========================================================*/ |
370 | /========================================================*/ |
371 | 371 | ||
372 | #define TAB_PADDING 25 |
372 | #define TAB_PADDING 25 |
373 | #define TAB_HEIGHT 25 |
373 | #define TAB_HEIGHT 25 |
374 | 374 | ||
375 | :struct _tabs |
375 | :struct _tabs |
376 | { |
376 | { |
377 | int active_tab; |
377 | int active_tab; |
378 | void draw(); |
378 | void draw(); |
379 | int click(); |
379 | int click(); |
380 | } tabs; |
380 | } tabs; |
381 | 381 | ||
382 | :void _tabs::draw(dword x,y, but_id, text) |
382 | :void _tabs::draw(dword x,y, but_id, text) |
383 | { |
383 | { |
384 | dword col_bg, col_text; |
384 | dword col_bg, col_text; |
385 | dword w=strlen(text)*8+TAB_PADDING, h=TAB_HEIGHT; |
385 | dword w=strlen(text)*8+TAB_PADDING, h=TAB_HEIGHT; |
386 | y -= h; |
386 | y -= h; |
387 | 387 | ||
388 | if (but_id==active_tab) |
388 | if (but_id==active_tab) |
389 | { |
389 | { |
390 | col_bg=system.color.work_button; |
390 | col_bg=system.color.work_button; |
391 | col_text=system.color.work_button_text; |
391 | col_text=system.color.work_button_text; |
392 | } |
392 | } |
393 | else |
393 | else |
394 | { |
394 | { |
395 | col_bg=system.color.work; |
395 | col_bg=system.color.work; |
396 | col_text=system.color.work_text; |
396 | col_text=system.color.work_text; |
397 | } |
397 | } |
398 | DrawCaptButton(x,y, w-1,h+1, but_id, col_bg, col_text, text); |
398 | DrawCaptButton(x,y, w-1,h+1, but_id, col_bg, col_text, text); |
399 | } |
399 | } |
400 | 400 | ||
401 | :int _tabs::click(int N) |
401 | :int _tabs::click(int N) |
402 | { |
402 | { |
403 | if (N==active_tab) return false; |
403 | if (N==active_tab) return false; |
404 | active_tab = N; |
404 | active_tab = N; |
405 | return true; |
405 | return true; |
406 | } |
406 | } |
407 | 407 | ||
408 | /*========================================================= |
408 | /*========================================================= |
409 | == |
409 | == |
410 | == MORE LESS BOX |
410 | == MORE LESS BOX |
411 | == |
411 | == |
412 | /========================================================*/ |
412 | /========================================================*/ |
413 | 413 | ||
414 | struct more_less_box |
414 | :struct more_less_box |
415 | { |
415 | { |
416 | signed x,y; |
416 | signed x,y; |
417 | unsigned value, min, max; |
417 | unsigned value, min, max; |
418 | unsigned bt_id_more, bt_id_less; |
418 | unsigned bt_id_more, bt_id_less; |
419 | dword text; |
419 | dword text; |
420 | bool click(); |
420 | bool click(); |
421 | void draw(); |
421 | void draw(); |
422 | }; |
422 | }; |
423 | 423 | ||
424 | bool more_less_box::click(unsigned id) |
424 | :bool more_less_box::click(unsigned id) |
425 | { |
425 | { |
426 | if (id==bt_id_less) { value = math.max(value-1, min); draw(); return 1; } |
426 | if (id==bt_id_less) { value = math.max(value-1, min); draw(); return 1; } |
427 | if (id==bt_id_more) { value = math.min(value+1, max); draw(); return 1; } |
427 | if (id==bt_id_more) { value = math.min(value+1, max); draw(); return 1; } |
428 | return 0; |
428 | return 0; |
429 | } |
429 | } |
430 | 430 | ||
431 | void more_less_box::draw() |
431 | :void more_less_box::draw() |
432 | { |
432 | { |
433 | #define VALUE_FIELD_W 34 |
433 | #define VALUE_FIELD_W 34 |
434 | #define SIZE 18 |
434 | #define SIZE 18 |
435 | dword value_text = itoa(value); |
435 | dword value_text = itoa(value); |
436 | 436 | ||
437 | DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph); |
437 | DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph); |
438 | DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff); |
438 | DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff); |
439 | DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff); |
439 | DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff); |
440 | WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text); |
440 | WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text); |
441 | 441 | ||
442 | DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+"); |
442 | DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+"); |
443 | DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-"); |
443 | DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-"); |
444 | EDI = system.color.work; |
444 | EDI = system.color.work; |
445 | WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text); |
445 | WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text); |
446 | DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light); |
446 | DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light); |
447 | } |
447 | } |
448 | 448 | ||
449 | 449 | ||
450 | 450 | ||
451 | 451 | ||
452 | #endif=>>=0)>>>=100) |
452 | #endif=>>=0)>>>=100) |
453 | >=0)>=0)>>=0)>=0)>=0)>=0)>=0)>=0)> |
453 | >=0)>=0)>>=0)>=0)>=0)>=0)>=0)>=0)> |