Rev 7981 | Rev 8383 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7981 | Rev 7995 | ||
---|---|---|---|
Line 85... | Line 85... | ||
85 | list.item_h -= 5; |
85 | list.item_h -= 5; |
86 | window_height = row+1*list.item_h + list_pos + skin_height + 15; |
86 | window_height = row+1*list.item_h + list_pos + skin_height + 15; |
87 | small_screen = true; |
87 | small_screen = true; |
88 | } |
88 | } |
Line 89... | Line 89... | ||
89 | 89 | ||
90 | loop() switch(WaitEvent()) |
90 | loop() switch(@WaitEvent()) |
91 | { |
91 | { |
92 | case evKey: |
92 | case evKey: |
93 | GetKeys(); |
93 | key_scancode = @GetKeyScancode(); |
94 | if (SCAN_CODE_LEFT == key_scancode) key_scancode = SCAN_CODE_UP; |
94 | if (SCAN_CODE_LEFT == key_scancode) key_scancode = SCAN_CODE_UP; |
95 | if (SCAN_CODE_RIGHT == key_scancode) key_scancode = SCAN_CODE_DOWN; |
95 | if (SCAN_CODE_RIGHT == key_scancode) key_scancode = SCAN_CODE_DOWN; |
96 | if (list.ProcessKey(key_scancode)) DrawSelection(); |
96 | if (list.ProcessKey(key_scancode)) DrawSelection(); |
97 | if (SCAN_CODE_ENTER == key_scancode) EventIconClick(list.cur_y); |
97 | if (SCAN_CODE_ENTER == key_scancode) EventIconClick(list.cur_y); |
Line 98... | Line 98... | ||
98 | break; |
98 | break; |
99 | 99 | ||
100 | case evButton: |
100 | case evButton: |
101 | id=GetButtonID(); |
101 | id = @GetButtonID(); |
102 | if (id==1) ExitProcess(); |
102 | if (id==1) ExitProcess(); |
Line 103... | Line 103... | ||
103 | if (id>=100) EventIconClick(id-100); |
103 | if (id>=100) EventIconClick(id-100); |
Line 142... | Line 142... | ||
142 | swc.list_bg = 0xF3F3F3; |
142 | swc.list_bg = 0xF3F3F3; |
143 | swc.text = 0x000000; |
143 | swc.text = 0x000000; |
144 | swc.dark = 0xDCDCDC; |
144 | swc.dark = 0xDCDCDC; |
145 | swc.light = 0xFCFCFC; |
145 | swc.light = 0xFCFCFC; |
146 | } |
146 | } |
147 | - | ||
148 | if (!skin.image) LoadImages(); |
- | |
149 | else if (swc.list_bg != old_list_bg_color) LoadImages(); |
- | |
150 | } |
147 | } |
Line 151... | Line -... | ||
151 | - | ||
152 | void LoadImages() |
- | |
153 | { |
- | |
154 | skin.load("/sys/icons32.png"); |
- | |
155 | skin.replace_color(0x00000000, swc.list_bg); |
- | |
156 | } |
- | |
157 | - | ||
158 | 148 | ||
159 | void DrawList() { |
149 | void DrawList() { |
160 | list.count = 0; |
150 | list.count = 0; |
161 | row = -1; |
151 | row = -1; |
162 | app_path_collection.drop(); |
152 | app_path_collection.drop(); |
Line 196... | Line 186... | ||
196 | 186 | ||
197 | text_x = col*list.item_w+5; |
187 | text_x = col*list.item_w+5; |
198 | text_y = list.item_h - 40 / 2; |
188 | text_y = list.item_h - 40 / 2; |
199 | if (!strchr(key_name, ' ')) {//|| (kfont.getsize(key_name)+30 |
189 | if (!strchr(key_name, ' ')) {//|| (kfont.getsize(key_name)+30 |
200 | kfont.WriteIntoWindowCenter(text_x, row*list.item_h+46 + list_pos, list.item_w,0, swc.list_bg, swc.text, 12, key_name); |
- | |
201 | //WriteTextCenter(text_x, row*list.item_h+46 + list_pos+3, list.item_w, swc.text, key_name); |
190 | kfont.WriteIntoWindowCenter(text_x, row*list.item_h+46 + list_pos, list.item_w,0, swc.list_bg, swc.text, 12, key_name); |
202 | } else { |
191 | } else { |
203 | space_pos = strrchr(key_name, ' '); |
192 | space_pos = strrchr(key_name, ' '); |
204 | ESBYTE[key_name+space_pos-1] = '\0'; |
193 | ESBYTE[key_name+space_pos-1] = '\0'; |
205 | kfont.WriteIntoWindowCenter(text_x, row*list.item_h+46 + list_pos - 2, list.item_w,0, swc.list_bg, swc.text, 12, key_name); |
194 | kfont.WriteIntoWindowCenter(text_x, row*list.item_h+46 + list_pos - 2, list.item_w,0, swc.list_bg, swc.text, 12, key_name); |
206 | kfont.WriteIntoWindowCenter(text_x, row*list.item_h+46 + list_pos + 13, list.item_w,0, swc.list_bg, swc.text, 12, key_name+space_pos); |
- | |
207 | //WriteTextCenter(text_x, row*list.item_h+46 + list_pos, list.item_w, swc.text, key_name); |
- | |
208 | //WriteTextCenter(text_x, row*list.item_h+46 + list_pos + 10, list.item_w, swc.text, key_name+space_pos); |
195 | kfont.WriteIntoWindowCenter(text_x, row*list.item_h+46 + list_pos + 13, list.item_w,0, swc.list_bg, swc.text, 12, key_name+space_pos); |
209 | } |
196 | } |
210 | if (icon_char_pos) icon_id = atoi(icon_char_pos+1); |
197 | if (icon_char_pos) icon_id = atoi(icon_char_pos+1); |
211 | img_draw stdcall(skin.image, icon_x, icon_y, 32, 32, 0, icon_id*32); |
198 | if (Form.cwidth) DrawIcon32(icon_x, icon_y, swc.list_bg, icon_id); |
212 | list.count++; |
199 | list.count++; |
213 | col++; |
200 | col++; |
214 | return true; |
201 | return true; |
Line 215... | Line -... | ||
215 | } |
- | |
216 | 202 | } |
|
217 | 203 | ||
- | 204 | ||
218 | int old_row; //to detect empty sections |
205 | byte process_sections(dword sec_name, f_name) |
219 | byte process_sections(dword sec_name, f_name) |
206 | { |
Line 220... | Line 207... | ||
220 | { |
207 | static int old_row; //to detect empty sections |
221 | int text_len; |
- | |
222 | if (!strcmp(sec_name, "Config")) return true; |
208 | int text_len; |
223 | - | ||
224 | if ((col==0) && (row==old_row)) |
209 | if (!strcmp(sec_name, "Config")) return true; |
225 | { |
- | |
226 | list_pos -= 28; |
210 | |
227 | } |
211 | if ((col==0) && (row==old_row)) { |
228 | else |
212 | list_pos -= 28; |
229 | { |
213 | } else { |
Line 251... | Line 235... | ||
251 | kfont.WriteIntoWindowCenter(0,5, Form.cwidth, list.y, sc.work, sc.work_text, 16, #window_title); |
235 | kfont.WriteIntoWindowCenter(0,5, Form.cwidth, list.y, sc.work, sc.work_text, 16, #window_title); |
252 | } |
236 | } |
Line 253... | Line 237... | ||
253 | 237 | ||
254 | void EventIconClick(dword appid) |
238 | void EventIconClick(dword appid) |
255 | { |
239 | { |
256 | char run_app_path[4096]=0; |
240 | char run_app_path[4096]; |
257 | dword app_path = app_path_collection.get(appid); |
241 | dword app_path = app_path_collection.get(appid); |
258 | dword param_pos = strchr(app_path, '|'); |
242 | dword param_pos = strchr(app_path, '|'); |
259 | if (param_pos) { |
243 | if (param_pos) { |
260 | ESBYTE[param_pos] = NULL; |
244 | ESBYTE[param_pos] = NULL; |