Rev 7605 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7605 | Rev 7635 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* |
1 | /* |
2 | SOFTWARE CENTER v2.85 |
2 | SOFTWARE CENTER v2.86 |
3 | */ |
3 | */ |
Line 4... | Line 4... | ||
4 | 4 | ||
5 | #define MEMSIZE 4096 * 15 |
5 | #define MEMSIZE 4096 * 15 |
6 | #include "..\lib\strings.h" |
6 | #include "..\lib\strings.h" |
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 34... | Line 34... | ||
34 | bool small_screen = false; |
34 | bool small_screen = false; |
- | 35 | ||
- | 36 | struct SW_COLORS |
|
- | 37 | { |
|
- | 38 | dword list_bg; |
|
- | 39 | dword text; |
|
- | 40 | dword graph; |
|
- | 41 | dword dark; |
|
Line 35... | Line 42... | ||
35 | 42 | dword light; |
|
Line 36... | Line 43... | ||
36 | #define LIST_BACKGROUND_COLOR 0xF3F3F3 |
43 | } swc; |
37 | 44 | ||
Line 57... | Line 64... | ||
57 | kfont.init(DEFAULT_FONT); |
64 | kfont.init(DEFAULT_FONT); |
58 | load_dll(libio, #libio_init,1); |
65 | load_dll(libio, #libio_init,1); |
59 | load_dll(libimg, #libimg_init,1); |
66 | load_dll(libimg, #libimg_init,1); |
60 | load_dll(libini, #lib_init,1); |
67 | load_dll(libini, #lib_init,1); |
Line 61... | Line -... | ||
61 | - | ||
62 | Libimg_LoadImage(#skin, "/sys/icons32.png"); |
- | |
63 | Libimg_FillTransparent(skin.image, skin.w, skin.h, LIST_BACKGROUND_COLOR); |
68 | |
Line 64... | Line 69... | ||
64 | kolibrios_mounted = dir_exists("/kolibrios"); |
69 | kolibrios_mounted = dir_exists("/kolibrios"); |
65 | 70 | ||
66 | if (param) |
71 | if (param) |
Line 101... | Line 106... | ||
101 | if (id==1) ExitProcess(); |
106 | if (id==1) ExitProcess(); |
102 | if (id>=100) EventRunApp(id-100); |
107 | if (id>=100) EventRunApp(id-100); |
103 | break; |
108 | break; |
Line 104... | Line 109... | ||
104 | 109 | ||
105 | case evReDraw: |
110 | case evReDraw: |
106 | system.color.get(); |
111 | SetAppColors(); |
107 | DefineAndDrawWindow(screen.width-window_width/2,screen.height-window_height/2,window_width,window_height,0x74,system.color.work,"",0); |
112 | DefineAndDrawWindow(screen.width-window_width/2,screen.height-window_height/2,window_width,window_height,0x74,system.color.work,"",0); |
108 | GetProcessInfo(#Form, SelfInfo); |
113 | GetProcessInfo(#Form, SelfInfo); |
109 | if (Form.status_window>2) { |
114 | if (Form.status_window>2) { |
110 | DrawTitle(#window_title); |
115 | DrawTitle(#window_title); |
Line 116... | Line 121... | ||
116 | } else { |
121 | } else { |
117 | DrawTitle(NULL); |
122 | DrawTitle(NULL); |
118 | draw_top_bar(); |
123 | draw_top_bar(); |
119 | } |
124 | } |
120 | DrawList(); |
125 | DrawList(); |
121 | DrawBar(0, row +1 * list.item_h + list_pos, Form.cwidth, -row - 1 * list.item_h - list_pos + Form.cheight, LIST_BACKGROUND_COLOR); |
126 | DrawBar(0, row +1 * list.item_h + list_pos, Form.cwidth, -row - 1 * list.item_h - list_pos + Form.cheight, swc.list_bg); |
122 | DrawSelection(); |
127 | DrawSelection(); |
123 | } |
128 | } |
124 | } |
129 | } |
Line -... | Line 130... | ||
- | 130 | ||
- | 131 | void SetAppColors() |
|
- | 132 | { |
|
- | 133 | dword bg_col, old_list_bg_color; |
|
- | 134 | system.color.get(); |
|
- | 135 | old_list_bg_color = swc.list_bg; |
|
- | 136 | bg_col = system.color.work; |
|
- | 137 | if (GrayScaleImage(#bg_col,1,1)>=65) |
|
- | 138 | { |
|
- | 139 | //light colors |
|
- | 140 | swc.list_bg = 0xF3F3F3; |
|
- | 141 | swc.text = 0x000000; |
|
- | 142 | swc.dark = 0xDCDCDC; |
|
- | 143 | swc.light = 0xFCFCFC; |
|
- | 144 | } else { |
|
- | 145 | //dark colors |
|
- | 146 | swc.list_bg = system.color.work; |
|
- | 147 | swc.text = system.color.work_text; |
|
- | 148 | swc.dark = system.color.work_dark; |
|
- | 149 | swc.light = system.color.work_light; |
|
- | 150 | } |
|
- | 151 | ||
- | 152 | if (swc.list_bg != old_list_bg_color) |
|
- | 153 | { |
|
- | 154 | Libimg_LoadImage(#skin, "/sys/icons32.png"); |
|
- | 155 | Libimg_FillTransparent(skin.image, skin.w, skin.h, swc.list_bg); |
|
- | 156 | } |
|
- | 157 | } |
|
- | 158 | ||
125 | 159 | ||
126 | void DrawList() { |
160 | void DrawList() { |
127 | list.count = 0; |
161 | list.count = 0; |
128 | row = -1; |
162 | row = -1; |
129 | app_path_collection.drop(); |
163 | app_path_collection.drop(); |
Line 147... | Line 181... | ||
147 | if (col==list.column_max) { |
181 | if (col==list.column_max) { |
148 | row++; |
182 | row++; |
149 | col=0; |
183 | col=0; |
150 | } |
184 | } |
Line 151... | Line 185... | ||
151 | 185 | ||
152 | if (col==0) DrawBar(0, row * list.item_h + list_pos, Form.cwidth, list.item_h, LIST_BACKGROUND_COLOR); |
186 | if (col==0) DrawBar(0, row * list.item_h + list_pos, Form.cwidth, list.item_h, swc.list_bg); |
153 | DefineButton(col*list.item_w+6, row*list.item_h + list_pos,list.item_w,list.item_h-5,list.count + 100 + BT_HIDE,0); |
187 | DefineButton(col*list.item_w+6, row*list.item_h + list_pos,list.item_w,list.item_h-5,list.count + 100 + BT_HIDE,0); |
Line 154... | Line 188... | ||
154 | tmp = list.item_w/2; |
188 | tmp = list.item_w/2; |
155 | 189 | ||
156 | icon_char_pos = strchr(key_value, ','); |
190 | icon_char_pos = strchr(key_value, ','); |
157 | if (icon_char_pos) icon_id = atoi(icon_char_pos+1); else icon_id = default_icon; |
191 | if (icon_char_pos) icon_id = atoi(icon_char_pos+1); else icon_id = default_icon; |
158 | img_draw stdcall(skin.image, col*list.item_w+tmp-10, row*list.item_h+5 + list_pos, 32, 32, 0, icon_id*32); |
192 | img_draw stdcall(skin.image, col*list.item_w+tmp-10, row*list.item_h+5 + list_pos, 32, 32, 0, icon_id*32); |
159 | if (icon_char_pos) ESBYTE[icon_char_pos] = '\0'; //delete icon from string |
193 | if (icon_char_pos) ESBYTE[icon_char_pos] = '\0'; //delete icon from string |
160 | app_path_collection.add(key_value); |
194 | app_path_collection.add(key_value); |
161 | //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); |
195 | //kfont.WriteIntoWindowCenter(col*list.item_w+7,row*list.item_h+47 + list_pos, list.item_w,0, swc.list_bg, swc.dark, 12, key_name); |
162 | 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); |
196 | text_w = kfont.WriteIntoWindowCenter(col*list.item_w+5,row*list.item_h+46 + list_pos, list.item_w,0, swc.list_bg, swc.text, 12, key_name); |
163 | ipos[list.count].x = list.item_w-text_w/2+calc(col*list.item_w)+5; |
197 | ipos[list.count].x = list.item_w-text_w/2+calc(col*list.item_w)+5; |
164 | ipos[list.count].y = row*list.item_h+46 + list_pos + 16; |
198 | ipos[list.count].y = row*list.item_h+46 + list_pos + 16; |
165 | ipos[list.count].w = text_w; |
199 | ipos[list.count].w = text_w; |
Line 185... | Line 219... | ||
185 | } |
219 | } |
186 | col = 0; |
220 | col = 0; |
187 | old_row = row; |
221 | old_row = row; |
Line 188... | Line 222... | ||
188 | 222 | ||
189 | if (!small_screen) { |
223 | if (!small_screen) { |
190 | DrawBar(0, row * list.item_h + list_pos, Form.cwidth , 29, LIST_BACKGROUND_COLOR); |
224 | DrawBar(0, row * list.item_h + list_pos, Form.cwidth , 29, swc.list_bg); |
191 | text_len = kfont.WriteIntoWindow(10, row * list.item_h + 10 + list_pos, LIST_BACKGROUND_COLOR, 0, 15, sec_name); |
225 | text_len = kfont.WriteIntoWindow(10, row * list.item_h + 10 + list_pos, swc.list_bg, swc.text, 15, sec_name); |
192 | DrawBar(text_len+20, row * list.item_h + list_pos + 20, Form.cwidth-text_len-20, 1, 0xDCDCDC); |
226 | DrawBar(text_len+20, row * list.item_h + list_pos + 20, Form.cwidth-text_len-20, 1, swc.dark); |
193 | DrawBar(text_len+20, row * list.item_h + list_pos + 21, Form.cwidth-text_len-20, 1, 0xFCFCFC); |
227 | DrawBar(text_len+20, row * list.item_h + list_pos + 21, Form.cwidth-text_len-20, 1, swc.light); |
194 | list_pos += 29; |
228 | list_pos += 29; |
195 | } |
229 | } |
196 | ini_enum_keys stdcall (f_name, sec_name, #draw_icons_from_section); |
230 | ini_enum_keys stdcall (f_name, sec_name, #draw_icons_from_section); |
197 | return true; |
231 | return true; |
Line 244... | Line 278... | ||
244 | void DrawSelection() |
278 | void DrawSelection() |
245 | { |
279 | { |
246 | int i; |
280 | int i; |
247 | dword col; |
281 | dword col; |
248 | for (i=0; i |
282 | for (i=0; i |
249 | if (i==list.cur_y) col=0x0080FF; else col=LIST_BACKGROUND_COLOR; |
283 | if (i==list.cur_y) col=0x0080FF; else col=swc.list_bg; |
250 | DrawBar(ipos[i].x, ipos[i].y, ipos[i].w+2, 3, col); |
284 | DrawBar(ipos[i].x, ipos[i].y, ipos[i].w+2, 3, col); |
251 | } |
285 | } |
252 | } |
286 | } |