Rev 9453 | Rev 9461 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9453 | Rev 9455 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | #include "../lib/patterns/select_list.h" |
15 | #include "../lib/patterns/select_list.h" |
16 | #include "../lib/patterns/simple_open_dialog.h" |
16 | #include "../lib/patterns/simple_open_dialog.h" |
17 | #include "../lib/patterns/restart_process.h" |
17 | #include "../lib/patterns/restart_process.h" |
Line 18... | Line 18... | ||
18 | 18 | ||
- | 19 | #include "ui_elements_preview.h" |
|
Line 19... | Line 20... | ||
19 | #include "ui_elements_preview.h" |
20 | #include "const.h" |
20 | 21 | ||
21 | //===================================================// |
22 | //===================================================// |
22 | // // |
23 | // // |
23 | // DATA // |
24 | // DATA // |
Line 24... | Line -... | ||
24 | // // |
- | |
25 | //===================================================// |
- | |
26 | - | ||
27 | #ifdef LANG_RUS |
- | |
28 | ?define WINDOW_HEADER " áâனª¨ ®ä®à¬«¥¨ï" |
- | |
29 | ?define T_SELECT_FOLDER "ë¡à âì ¯ ¯ªã" |
- | |
30 | ?define MENU_LIST "âªàëâì ä ©« |Enter\n¤ «¨âì ä ©« |Del" |
- | |
31 | ?define T_PICTURE_MODE " ®«®¦¥¨¥ ª à⨪¨ " |
- | |
32 | ?define T_CHECKBOX_STRETCH " áâïãâì" |
- | |
33 | ?define T_CHECKBOX_TILED " ¬®áâ¨âì" |
- | |
34 | ?define T_UPDATE_DOCK "¡®¢«ïâì Dock-¯ ¥«ì" |
- | |
35 | char t_skins[] = " â¨«ì ®ª®"; |
- | |
36 | char t_wallpapers[] = " ¡®¨"; |
- | |
37 | char t_screensaver[] = " ªà¨á¥©¢¥à"; |
- | |
38 | #else |
- | |
39 | ?define WINDOW_HEADER "Appearance" |
- | |
40 | ?define T_SELECT_FOLDER "Select folder" |
- | |
41 | ?define MENU_LIST "Open file |Enter\nDelete file |Del" |
- | |
42 | ?define T_PICTURE_MODE " Picture Mode " |
- | |
43 | ?define T_CHECKBOX_STRETCH "Stretch" |
- | |
44 | ?define T_CHECKBOX_TILED "Tiled" |
- | |
45 | ?define T_UPDATE_DOCK "Update Dock" |
- | |
46 | char t_skins[] = " Skins"; |
- | |
47 | char t_wallpapers[] = " Wallpapers"; |
- | |
48 | char t_screensaver[] = " Screensaver"; |
- | |
49 | #endif |
- | |
50 | - | ||
51 | #define WIN_W 621 |
- | |
52 | #define PANEL_H 58 |
- | |
53 | #define LP 10 //LIST_PADDING |
- | |
54 | char skins_folder_path[4096]; |
25 | // // |
55 | char wallp_folder_path[4096]; |
26 | //===================================================// |
56 | 27 | ||
57 | signed int active_skin=-1, active_wallpaper=-1, active_screensaver=-1; |
28 | signed int active_skin=-1, active_wallpaper=-1, active_screensaver=-1; |
58 | enum { |
29 | enum { |
Line 64... | Line 35... | ||
64 | char cur_file_path[4096]; |
35 | char cur_file_path[4096]; |
65 | char cur_skin_path[4096]; |
36 | char cur_skin_path[4096]; |
66 | char temp_filename[4096]; |
37 | char temp_filename[4096]; |
67 | int files_mas[400]; |
38 | int files_mas[400]; |
Line 68... | Line 39... | ||
68 | 39 | ||
Line 69... | Line 40... | ||
69 | _ini ini = { "/sys/settings/system.ini", "style" }; |
40 | _ini ini = { "/sys/settings/system.ini" }; |
Line 70... | Line 41... | ||
70 | 41 | ||
71 | int cur; |
42 | int cur; |
Line 90... | Line 61... | ||
90 | // // |
61 | // // |
91 | // CODE // |
62 | // CODE // |
92 | // // |
63 | // // |
93 | //===================================================// |
64 | //===================================================// |
Line 94... | Line -... | ||
94 | - | ||
95 | void GetRealFolderPathes() |
- | |
96 | { |
- | |
97 | char real_kolibrios_path[4096]; |
- | |
98 | SetCurDir("/kolibrios"); |
- | |
99 | GetCurDir(#real_kolibrios_path, sizeof(real_kolibrios_path)); |
- | |
100 | miniprintf(#skins_folder_path, "%s/res/skins", #real_kolibrios_path); |
- | |
101 | miniprintf(#wallp_folder_path, "%s/res/wallpapers", #real_kolibrios_path); |
- | |
102 | } |
- | |
103 | 65 | ||
104 | void main() |
66 | void main() |
105 | { |
67 | { |
106 | int id; |
- | |
107 | - | ||
108 | GetRealFolderPathes(); |
- | |
109 | 68 | int id; |
|
110 | load_dll(boxlib, #box_lib_init,0); |
69 | load_dll(boxlib, #box_lib_init,0); |
111 | load_dll(libini, #lib_init,1); |
70 | load_dll(libini, #lib_init,1); |
112 | load_dll(Proc_lib, #OpenDialog_init,0); |
71 | load_dll(Proc_lib, #OpenDialog_init,0); |
113 | o_dialog.type = 2; //select folder |
72 | o_dialog.type = 2; //select folder |
Line 157... | Line 116... | ||
157 | if (key_scancode==SCAN_CODE_DEL) EventDeleteFile(); |
116 | if (key_scancode==SCAN_CODE_DEL) EventDeleteFile(); |
158 | if (key_scancode==SCAN_CODE_TAB) { |
117 | if (key_scancode==SCAN_CODE_TAB) { |
159 | id = tabs.active_tab+1; |
118 | id = tabs.active_tab+1; |
160 | if(id==3)id=0; |
119 | if(id==3)id=0; |
161 | tabs.click(id + tabs.base_id); |
120 | tabs.click(id + tabs.base_id); |
162 | draw_window(); |
121 | DrawWindowContent(); |
163 | break; |
122 | break; |
164 | } |
123 | } |
Line 165... | Line 124... | ||
165 | 124 | ||
166 | if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus) |
125 | if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus) |
Line 190... | Line 149... | ||
190 | } |
149 | } |
Line 191... | Line 150... | ||
191 | 150 | ||
192 | void draw_window() |
151 | void draw_window() |
193 | { |
152 | { |
194 | sc.get(); |
153 | sc.get(); |
195 | DefineAndDrawWindow(screen.width-600/2,80,WIN_W+9,504+skin_height,0x34,sc.work,WINDOW_HEADER,0); |
154 | DefineAndDrawWindow(screen.width-600/2,80,WIN_W+9,WIN_H+skin_height,0x34,sc.work,WINDOW_HEADER,0); |
196 | GetProcessInfo(#Form, SelfInfo); |
155 | GetProcessInfo(#Form, SelfInfo); |
197 | IF (Form.status_window&ROLLED_UP) return; |
156 | IF (Form.status_window&ROLLED_UP) return; |
198 | DrawWindowContent(); |
157 | DrawWindowContent(); |
Line 204... | Line 163... | ||
204 | 163 | ||
Line 205... | Line 164... | ||
205 | sc.get(); |
164 | sc.get(); |
206 | 165 | ||
207 | //tabs.w = Form.cwidth-LP-LP; |
166 | //tabs.w = Form.cwidth-LP-LP; |
208 | tabs.draw(); |
167 | tabs.draw(); |
209 | draw_icon_16w(tabs.x + TAB_PADDING, 15, 17); |
168 | draw_icon_16w(tabs.x + TAB_PADDING, LP+5, 17); |
Line 210... | Line 169... | ||
210 | draw_icon_16w(sizeof(t_skins)-1*8 + TAB_PADDING + TAB_PADDING + tabs.x, 15, 6); |
169 | draw_icon_16w(sizeof(t_skins)-1*8 + TAB_PADDING + TAB_PADDING + tabs.x, LP+5, 6); |
211 | draw_icon_16w(sizeof(t_wallpapers)+sizeof(t_skins)-2*8 + TAB_PADDING + TAB_PADDING + TAB_PADDING + tabs.x, 15, 61); |
- | |
212 | 170 | draw_icon_16w(sizeof(t_wallpapers)+sizeof(t_skins)-2*8 + TAB_PADDING + TAB_PADDING + TAB_PADDING + tabs.x, LP+5, 61); |
|
213 | id = select_list.cur_y; |
171 | |
214 | #define LIST_W 280 |
172 | id = select_list.cur_y; |
215 | SelectList_Init( |
173 | SelectList_Init( |
216 | LP + TAB_PADDING, |
174 | LP + TAB_PADDING, |
217 | PANEL_H, |
175 | PANEL_H, |
218 | LIST_W, |
176 | LIST_W, |
Line 219... | Line 177... | ||
219 | Form.cheight-LP-LP - TAB_PADDING - PANEL_H |
177 | Form.cheight-LP - TAB_PADDING - PANEL_H |
220 | ); |
178 | ); |
221 | select_list.cur_y = id; |
179 | select_list.cur_y = id; |
222 | 180 | ||
223 | skp.set_size( |
181 | skp.set_size( |
224 | LP + TAB_PADDING + LIST_W + TAB_PADDING + 30, |
182 | LP + TAB_PADDING + LIST_W + TAB_PADDING + 30, |
- | 183 | PANEL_H, |
|
Line 225... | Line 184... | ||
225 | PANEL_H, |
184 | 226, |
226 | WIN_W - 400, |
185 | 230 //select_list.h - 50 - 50 |
Line 227... | Line 186... | ||
227 | 230 //select_list.h - 50 - 50 |
186 | ); |
Line 247... | Line 206... | ||
247 | { |
206 | { |
248 | DrawStandartCaptButton(skp.x, PANEL_H, BTN_TEST_SCREENSAVER, "Test"); |
207 | DrawStandartCaptButton(skp.x, PANEL_H, BTN_TEST_SCREENSAVER, "Test"); |
249 | } |
208 | } |
250 | } |
209 | } |
Line -... | Line 210... | ||
- | 210 | ||
- | 211 | bool strreqi(dword _left, _right) |
|
- | 212 | { |
|
- | 213 | return strcmpi(_left+strrchr(_left,'.')-1, _right); |
|
Line 251... | Line 214... | ||
251 | 214 | } |
|
252 | 215 | ||
253 | void Open_Dir() |
216 | void Open_Dir() |
254 | { |
217 | { |
Line 259... | Line 222... | ||
259 | for (j=0; j |
222 | for (j=0; j |
260 | { |
223 | { |
261 | strcpy(#temp_filename, io.dir.position(j)); |
224 | strcpy(#temp_filename, io.dir.position(j)); |
262 | strlwr(#temp_filename); |
225 | strlwr(#temp_filename); |
263 | if (tabs.active_tab==SKINS) { |
226 | if (tabs.active_tab==SKINS) { |
264 | if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue; |
227 | if (strreqi(#temp_filename,".skn")!=0) continue; |
265 | } |
228 | } |
266 | if (tabs.active_tab==WALLPAPERS) { |
229 | if (tabs.active_tab==WALLPAPERS) { |
267 | if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".png")!=0) |
230 | if (strreqi(#temp_filename,".png")!=0) |
268 | && (strcmpi(#temp_filename+strlen(#temp_filename)-4,".jpg")!=0) |
231 | && (strreqi(#temp_filename,".jpg")!=0) |
269 | && (strcmpi(#temp_filename+strlen(#temp_filename)-5,".jpeg")!=0) |
232 | && (strreqi(#temp_filename,".jpeg")!=0) |
270 | && (strcmpi(#temp_filename+strlen(#temp_filename)-4,".gif")!=0) continue; |
233 | && (strreqi(#temp_filename,".gif")!=0) continue; |
271 | } |
234 | } |
272 | cur = select_list.count; |
235 | cur = select_list.count; |
273 | files_mas[cur]=j; |
236 | files_mas[cur]=j; |
274 | select_list.count++; |
237 | select_list.count++; |
275 | } |
238 | } |
Line 323... | Line 286... | ||
323 | Open_Dir(); |
286 | Open_Dir(); |
324 | if (!select_list.count) notify("'No files were found' -E"); |
287 | if (!select_list.count) notify("'No files were found' -E"); |
325 | select_list.cur_y = _id; |
288 | select_list.cur_y = _id; |
326 | if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; |
289 | if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; |
327 | select_list.CheckDoesValuesOkey(); |
290 | select_list.CheckDoesValuesOkey(); |
328 | if (select_list.w) draw_window(); |
291 | if (select_list.w) DrawWindowContent(); |
- | 292 | } |
|
- | 293 | ||
- | 294 | dword GetRealKolibriosPath() |
|
- | 295 | { |
|
- | 296 | char real_kolibrios_path[4096]; |
|
- | 297 | SetCurDir("/kolibrios"); |
|
- | 298 | GetCurDir(#real_kolibrios_path, sizeof(real_kolibrios_path)); |
|
- | 299 | return #real_kolibrios_path; |
|
329 | } |
300 | } |
Line 330... | Line 301... | ||
330 | 301 | ||
331 | //===================================================// |
302 | //===================================================// |
332 | // // |
303 | // // |
Line 335... | Line 306... | ||
335 | //===================================================// |
306 | //===================================================// |
Line 336... | Line 307... | ||
336 | 307 | ||
337 | void EventTabSkinsClick() |
308 | void EventTabSkinsClick() |
338 | { |
309 | { |
339 | active_wallpaper = select_list.cur_y; |
310 | active_wallpaper = select_list.cur_y; |
340 | strcpy(#folder_path, #skins_folder_path); |
311 | miniprintf(#folder_path, "%s/res/skins", GetRealKolibriosPath()); |
341 | ActivateTab(active_skin); |
312 | ActivateTab(active_skin); |
Line 342... | Line 313... | ||
342 | } |
313 | } |
343 | 314 | ||
344 | void EventTabWallpappersClick() |
315 | void EventTabWallpappersClick() |
- | 316 | { |
|
345 | { |
317 | active_skin = select_list.cur_y; |
- | 318 | if (opendir_path) { |
|
- | 319 | strcpy(#folder_path, #opendir_path); |
|
- | 320 | } else { |
|
346 | active_skin = select_list.cur_y; |
321 | miniprintf(#folder_path, "%s/res/wallpapers", GetRealKolibriosPath()); |
347 | strcpy(#folder_path, #wallp_folder_path); |
322 | } |
Line 348... | Line 323... | ||
348 | ActivateTab(active_wallpaper); |
323 | ActivateTab(active_wallpaper); |
349 | } |
324 | } |
Line 369... | Line 344... | ||
369 | } |
344 | } |
Line 370... | Line 345... | ||
370 | 345 | ||
371 | void EventSelectWallpFolder() |
346 | void EventSelectWallpFolder() |
372 | { |
347 | { |
373 | OpenDialog_start stdcall (#o_dialog); |
- | |
374 | if (o_dialog.status) { |
- | |
375 | strcpy(#wallp_folder_path, #opendir_path); |
348 | OpenDialog_start stdcall (#o_dialog); |
376 | EventTabWallpappersClick(); |
- | |
377 | } |
349 | if (o_dialog.status) EventTabWallpappersClick(); |
Line 378... | Line 350... | ||
378 | } |
350 | } |
379 | 351 | ||
380 | void EventSetWallpMode_Stretch() |
352 | void EventSetWallpMode_Stretch() |
Line 427... | Line 399... | ||
427 | if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path); |
399 | if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path); |
428 | } |
400 | } |
Line 429... | Line 401... | ||
429 | 401 | ||
430 | void EventExit() |
402 | void EventExit() |
- | 403 | { |
|
- | 404 | if (cur_skin_path) { |
|
431 | { |
405 | ini.section = "style"; |
- | 406 | ini.SetString("skin", #cur_skin_path, strlen(#cur_skin_path)); |
|
432 | if (cur_skin_path) ini.SetString("skin", #cur_skin_path, strlen(#cur_skin_path)); |
407 | } |
433 | ExitProcess(); |
408 | ExitProcess(); |
Line 434... | Line 409... | ||
434 | } |
409 | } |
435 | 410 |