Rev 7424 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7424 | Rev 7493 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | char window_title[128], |
31 | char window_title[128], |
32 | settings_ini_path[256] = "/sys/settings/"; |
32 | settings_ini_path[256] = "/sys/settings/"; |
Line 33... | Line 33... | ||
33 | 33 | ||
Line -... | Line 34... | ||
- | 34 | #define LIST_BACKGROUND_COLOR 0xF3F3F3 |
|
- | 35 | ||
34 | #define LIST_BACKGROUND_COLOR 0xF3F3F3 |
36 | block ipos[128]; |
35 | 37 | ||
36 | void load_config() |
38 | void load_config() |
37 | { |
39 | { |
38 | ini_get_str stdcall (#settings_ini_path, "Config", "window_title", #window_title, sizeof(window_title), "Software widget"); |
40 | ini_get_str stdcall (#settings_ini_path, "Config", "window_title", #window_title, sizeof(window_title), "Software widget"); |
Line 76... | Line 78... | ||
76 | DrawList(); |
78 | DrawList(); |
77 | window_height = row+1*list.item_h + list_pos + skin_height + 15; |
79 | window_height = row+1*list.item_h + list_pos + skin_height + 15; |
Line 78... | Line 80... | ||
78 | 80 | ||
79 | loop() switch(WaitEvent()) |
81 | loop() switch(WaitEvent()) |
80 | { |
82 | { |
81 | // case evKey: |
83 | case evKey: |
- | 84 | GetKeys(); |
|
- | 85 | if (SCAN_CODE_LEFT == key_scancode) key_scancode = SCAN_CODE_UP; |
|
82 | // GetKeys(); |
86 | if (SCAN_CODE_RIGHT == key_scancode) key_scancode = SCAN_CODE_DOWN; |
- | 87 | if (list.ProcessKey(key_scancode)) DrawSelection(); |
|
83 | // if (list.ProcessKey(key_scancode)) DrawList(); |
88 | if (SCAN_CODE_ENTER == key_scancode) EventRunApp(list.cur_y); |
Line 84... | Line 89... | ||
84 | // break; |
89 | break; |
85 | 90 | ||
86 | case evButton: |
91 | case evButton: |
87 | id=GetButtonID(); |
92 | id=GetButtonID(); |
Line 95... | Line 100... | ||
95 | GetProcessInfo(#Form, SelfInfo); |
100 | GetProcessInfo(#Form, SelfInfo); |
96 | if (Form.status_window>2) { DrawTitle(#window_title); break; } else DrawTitle(""); |
101 | if (Form.status_window>2) { DrawTitle(#window_title); break; } else DrawTitle(""); |
97 | draw_top_bar(); |
102 | draw_top_bar(); |
98 | DrawList(); |
103 | DrawList(); |
99 | DrawBar(0, row + 1 * list.item_h + list_pos, Form.cwidth, -row - 1 * list.item_h - list_pos + Form.cheight, LIST_BACKGROUND_COLOR); |
104 | DrawBar(0, row +1 * list.item_h + list_pos, Form.cwidth, -row - 1 * list.item_h - list_pos + Form.cheight, LIST_BACKGROUND_COLOR); |
- | 105 | //if (list.cur_y == list.count) |
|
- | 106 | DrawSelection(); |
|
100 | break; |
107 | break; |
101 | } |
108 | } |
102 | } |
109 | } |
Line 103... | Line 110... | ||
103 | 110 | ||
Line 114... | Line 121... | ||
114 | byte draw_icons_from_section(dword key_value, key_name, sec_name, f_name) |
121 | byte draw_icons_from_section(dword key_value, key_name, sec_name, f_name) |
115 | { |
122 | { |
116 | int tmp, |
123 | int tmp, |
117 | icon_id, |
124 | icon_id, |
118 | icon_char_pos; |
125 | icon_char_pos; |
- | 126 | int text_w; |
|
Line 119... | Line 127... | ||
119 | 127 | ||
120 | //do not show items located in /kolibrios/ if this directory not mounted |
128 | //do not show items located in /kolibrios/ if this directory not mounted |
121 | if (!strncmp(key_value, "/kolibrios/", 11)) || (!strncmp(key_value, "/k/", 3)) |
129 | if (!strncmp(key_value, "/kolibrios/", 11)) || (!strncmp(key_value, "/k/", 3)) |
Line 134... | Line 142... | ||
134 | if (icon_char_pos) icon_id = atoi(icon_char_pos+1); else icon_id = default_icon; |
142 | if (icon_char_pos) icon_id = atoi(icon_char_pos+1); else icon_id = default_icon; |
135 | img_draw stdcall(skin.image, col*list.item_w+tmp-10, row*list.item_h+5 + list_pos, 32, 32, 0, icon_id*32); |
143 | img_draw stdcall(skin.image, col*list.item_w+tmp-10, row*list.item_h+5 + list_pos, 32, 32, 0, icon_id*32); |
136 | if (icon_char_pos) ESBYTE[icon_char_pos] = '\0'; //delete icon from string |
144 | if (icon_char_pos) ESBYTE[icon_char_pos] = '\0'; //delete icon from string |
137 | app_path_collection.add(key_value); |
145 | app_path_collection.add(key_value); |
138 | //kfont.WriteIntoWindowCenter(col*list.item_w+7,row*list.item_h+47 + list_pos, list.item_w,0, LIST_BACKGROUND_COLOR, 0xDCDCDC, 12, key_name); |
146 | //kfont.WriteIntoWindowCenter(col*list.item_w+7,row*list.item_h+47 + list_pos, list.item_w,0, LIST_BACKGROUND_COLOR, 0xDCDCDC, 12, key_name); |
139 | kfont.WriteIntoWindowCenter(col*list.item_w+5,row*list.item_h+46 + list_pos, list.item_w,0, LIST_BACKGROUND_COLOR, 0x000000, 12, key_name); |
147 | text_w = kfont.WriteIntoWindowCenter(col*list.item_w+5,row*list.item_h+46 + list_pos, list.item_w,0, LIST_BACKGROUND_COLOR, 0x000000, 12, key_name); |
140 | if (list.cur_y == list.count) DrawWideRectangle(col*list.item_w+6, row*list.item_h + list_pos,list.item_w,list.item_h-5, 2, 0x0080FF); |
148 | ipos[list.count].x = list.item_w-text_w/2+calc(col*list.item_w)+5; |
- | 149 | ipos[list.count].y = row*list.item_h+46 + list_pos + 16; |
|
- | 150 | ipos[list.count].w = text_w; |
|
141 | list.count++; |
151 | list.count++; |
142 | col++; |
152 | col++; |
143 | return true; |
153 | return true; |
144 | } |
154 | } |
Line 209... | Line 219... | ||
209 | } |
219 | } |
210 | else |
220 | else |
211 | { |
221 | { |
212 | notify("'Application not found' -E"); |
222 | notify("'Application not found' -E"); |
213 | } |
223 | } |
214 | - | ||
215 | } |
224 | } |
Line -... | Line 225... | ||
- | 225 | ||
- | 226 | void DrawSelection() |
|
- | 227 | { |
|
- | 228 | int i; |
|
- | 229 | dword col; |
|
- | 230 | for (i=0; i |
|
- | 231 | if (i==list.cur_y) col=0x0080FF; else col=LIST_BACKGROUND_COLOR; |
|
- | 232 | DrawBar(ipos[i].x, ipos[i].y, ipos[i].w+2, 3, col); |
|
- | 233 | } |
|
Line 216... | Line 234... | ||
216 | 234 | } |