Rev 9439 | Rev 9455 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9439 | Rev 9453 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | #include "../lib/obj/proc_lib.h" |
12 | #include "../lib/obj/proc_lib.h" |
13 | #include "../lib/obj/libini.h" |
13 | #include "../lib/obj/libini.h" |
Line 14... | Line 14... | ||
14 | 14 | ||
15 | #include "../lib/patterns/select_list.h" |
15 | #include "../lib/patterns/select_list.h" |
- | 16 | #include "../lib/patterns/simple_open_dialog.h" |
|
Line 16... | Line 17... | ||
16 | #include "../lib/patterns/simple_open_dialog.h" |
17 | #include "../lib/patterns/restart_process.h" |
Line 17... | Line 18... | ||
17 | 18 | ||
18 | #include "ui_elements_preview.h" |
19 | #include "ui_elements_preview.h" |
Line 23... | Line 24... | ||
23 | // // |
24 | // // |
24 | //===================================================// |
25 | //===================================================// |
Line 25... | Line 26... | ||
25 | 26 | ||
26 | #ifdef LANG_RUS |
27 | #ifdef LANG_RUS |
27 | ?define WINDOW_HEADER " áâனª¨ ®ä®à¬«¥¨ï" |
- | |
28 | ?define T_SKINS " â¨«ì ®ª®" |
- | |
29 | ?define T_WALLPAPERS " ¡®¨" |
28 | ?define WINDOW_HEADER " áâனª¨ ®ä®à¬«¥¨ï" |
30 | ?define T_SELECT_FOLDER "ë¡à âì ¯ ¯ªã" |
29 | ?define T_SELECT_FOLDER "ë¡à âì ¯ ¯ªã" |
31 | ?define MENU_LIST "âªàëâì ä ©« |Enter\n¤ «¨âì ä ©« |Del" |
30 | ?define MENU_LIST "âªàëâì ä ©« |Enter\n¤ «¨âì ä ©« |Del" |
32 | ?define T_PICTURE_MODE " ®«®¦¥¨¥ ª à⨪¨ " |
31 | ?define T_PICTURE_MODE " ®«®¦¥¨¥ ª à⨪¨ " |
33 | ?define T_CHECKBOX_STRETCH " áâïãâì" |
32 | ?define T_CHECKBOX_STRETCH " áâïãâì" |
34 | ?define T_CHECKBOX_TILED " ¬®áâ¨âì" |
33 | ?define T_CHECKBOX_TILED " ¬®áâ¨âì" |
- | 34 | ?define T_UPDATE_DOCK "¡®¢«ïâì Dock-¯ ¥«ì" |
|
- | 35 | char t_skins[] = " â¨«ì ®ª®"; |
|
- | 36 | char t_wallpapers[] = " ¡®¨"; |
|
35 | ?define T_UPDATE_DOCK "¡®¢«ïâì Dock-¯ ¥«ì" |
37 | char t_screensaver[] = " ªà¨á¥©¢¥à"; |
36 | #else |
38 | #else |
37 | ?define WINDOW_HEADER "Appearance" |
- | |
38 | ?define T_SKINS " Skins" |
- | |
39 | ?define T_WALLPAPERS " Wallpapers" |
39 | ?define WINDOW_HEADER "Appearance" |
40 | ?define T_SELECT_FOLDER "Select folder" |
40 | ?define T_SELECT_FOLDER "Select folder" |
41 | ?define MENU_LIST "Open file |Enter\nDelete file |Del" |
41 | ?define MENU_LIST "Open file |Enter\nDelete file |Del" |
42 | ?define T_PICTURE_MODE " Picture Mode " |
42 | ?define T_PICTURE_MODE " Picture Mode " |
43 | ?define T_CHECKBOX_STRETCH "Stretch" |
43 | ?define T_CHECKBOX_STRETCH "Stretch" |
44 | ?define T_CHECKBOX_TILED "Tiled" |
44 | ?define T_CHECKBOX_TILED "Tiled" |
- | 45 | ?define T_UPDATE_DOCK "Update Dock" |
|
- | 46 | char t_skins[] = " Skins"; |
|
- | 47 | char t_wallpapers[] = " Wallpapers"; |
|
45 | ?define T_UPDATE_DOCK "Update Dock" |
48 | char t_screensaver[] = " Screensaver"; |
Line -... | Line 49... | ||
- | 49 | #endif |
|
46 | #endif |
50 | |
47 | 51 | #define WIN_W 621 |
|
48 | #define PANEL_H 40 |
52 | #define PANEL_H 58 |
49 | #define LP 10 //LIST_PADDING |
53 | #define LP 10 //LIST_PADDING |
Line 50... | Line 54... | ||
50 | char skins_folder_path[4096]; |
54 | char skins_folder_path[4096]; |
51 | char wallp_folder_path[4096]; |
55 | char wallp_folder_path[4096]; |
52 | 56 | ||
53 | signed int active_skin=-1, active_wallpaper=-1; |
57 | signed int active_skin=-1, active_wallpaper=-1, active_screensaver=-1; |
- | 58 | enum { |
|
Line 54... | Line 59... | ||
54 | enum { |
59 | BASE_TAB_BUTTON_ID=3, |
55 | BASE_TAB_BUTTON_ID=2, |
60 | BTN_SELECT_WALLP_FOLDER=10, |
56 | BTN_SELECT_WALLP_FOLDER=10 }; |
61 | BTN_TEST_SCREENSAVER }; |
57 | 62 | ||
58 | char folder_path[4096]; |
63 | char folder_path[4096]; |
Line -... | Line 64... | ||
- | 64 | char cur_file_path[4096]; |
|
- | 65 | char cur_skin_path[4096]; |
|
59 | char cur_file_path[4096]; |
66 | char temp_filename[4096]; |
Line 60... | Line 67... | ||
60 | char cur_skin_path[4096]; |
67 | int files_mas[400]; |
61 | char temp_filename[4096]; |
68 | |
Line 62... | Line 69... | ||
62 | int files_mas[400]; |
69 | _ini ini = { "/sys/settings/system.ini", "style" }; |
Line -... | Line 70... | ||
- | 70 | ||
63 | 71 | int cur; |
|
Line 64... | Line 72... | ||
64 | int cur; |
72 | |
Line 65... | Line 73... | ||
65 | 73 | proc_info Form; |
|
66 | proc_info Form; |
74 | block skp; |
Line 84... | Line 92... | ||
84 | // // |
92 | // // |
85 | //===================================================// |
93 | //===================================================// |
Line 86... | Line 94... | ||
86 | 94 | ||
87 | void GetRealFolderPathes() |
95 | void GetRealFolderPathes() |
88 | { |
96 | { |
89 | char real_skin_path[4096]; |
97 | char real_kolibrios_path[4096]; |
90 | SetCurDir("/kolibrios"); |
98 | SetCurDir("/kolibrios"); |
91 | GetCurDir(#real_skin_path, sizeof(real_skin_path)); |
99 | GetCurDir(#real_kolibrios_path, sizeof(real_kolibrios_path)); |
92 | sprintf(#skins_folder_path, "%s/res/skins", #real_skin_path); |
100 | miniprintf(#skins_folder_path, "%s/res/skins", #real_kolibrios_path); |
93 | sprintf(#wallp_folder_path, "%s/res/wallpapers", #real_skin_path); |
101 | miniprintf(#wallp_folder_path, "%s/res/wallpapers", #real_kolibrios_path); |
Line 94... | Line 102... | ||
94 | } |
102 | } |
95 | 103 | ||
96 | void main() |
104 | void main() |
Line 103... | Line 111... | ||
103 | load_dll(libini, #lib_init,1); |
111 | load_dll(libini, #lib_init,1); |
104 | load_dll(Proc_lib, #OpenDialog_init,0); |
112 | load_dll(Proc_lib, #OpenDialog_init,0); |
105 | o_dialog.type = 2; //select folder |
113 | o_dialog.type = 2; //select folder |
106 | OpenDialog_init stdcall (#o_dialog); |
114 | OpenDialog_init stdcall (#o_dialog); |
Line 107... | Line 115... | ||
107 | 115 | ||
108 | tabs.add(T_SKINS, #EventTabSkinsClick); |
116 | tabs.add(#t_skins, #EventTabSkinsClick); |
- | 117 | tabs.add(#t_wallpapers, #EventTabWallpappersClick); |
|
109 | tabs.add(T_WALLPAPERS, #EventTabWallpappersClick); |
118 | tabs.add(#t_screensaver, #EventTabScreensaverClick); |
Line 110... | Line 119... | ||
110 | tabs.draw_active_tab(); |
119 | tabs.draw_active_tab(); |
111 | 120 | ||
112 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
121 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
Line 143... | Line 152... | ||
143 | 152 | ||
144 | case evKey: |
153 | case evKey: |
145 | GetKeys(); |
154 | GetKeys(); |
146 | if (select_list.ProcessKey(key_scancode)) EventApply(); |
155 | if (select_list.ProcessKey(key_scancode)) EventApply(); |
147 | if (key_scancode==SCAN_CODE_ENTER) EventOpenFile(); |
- | |
148 | if (key_scancode==SCAN_CODE_TAB) tabs.click(tabs.active_tab ^ 1); |
156 | if (key_scancode==SCAN_CODE_ENTER) EventOpenFile(); |
- | 157 | if (key_scancode==SCAN_CODE_DEL) EventDeleteFile(); |
|
- | 158 | if (key_scancode==SCAN_CODE_TAB) { |
|
- | 159 | id = tabs.active_tab+1; |
|
- | 160 | if(id==3)id=0; |
|
- | 161 | tabs.click(id + tabs.base_id); |
|
- | 162 | draw_window(); |
|
- | 163 | break; |
|
Line 149... | Line 164... | ||
149 | if (key_scancode==SCAN_CODE_DEL) EventDeleteFile(); |
164 | } |
150 | 165 | ||
151 | if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus) |
166 | if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus) |
152 | for (id=select_list.cur_y+1; id |
167 | for (id=select_list.cur_y+1; id |
Line 175... | Line 190... | ||
175 | } |
190 | } |
Line 176... | Line 191... | ||
176 | 191 | ||
177 | void draw_window() |
192 | void draw_window() |
178 | { |
193 | { |
179 | sc.get(); |
194 | sc.get(); |
180 | DefineAndDrawWindow(screen.width-600/2,80,630,504+skin_height,0x34,sc.work,WINDOW_HEADER,0); |
195 | DefineAndDrawWindow(screen.width-600/2,80,WIN_W+9,504+skin_height,0x34,sc.work,WINDOW_HEADER,0); |
181 | GetProcessInfo(#Form, SelfInfo); |
196 | GetProcessInfo(#Form, SelfInfo); |
182 | IF (Form.status_window&ROLLED_UP) return; |
197 | IF (Form.status_window&ROLLED_UP) return; |
183 | DrawWindowContent(); |
198 | DrawWindowContent(); |
Line 184... | Line 199... | ||
184 | } |
199 | } |
185 | 200 | ||
186 | void DrawWindowContent() |
201 | void DrawWindowContent() |
187 | { |
- | |
Line 188... | Line 202... | ||
188 | int id; |
202 | { |
Line 189... | Line -... | ||
189 | int list_w; |
- | |
190 | - | ||
191 | sc.get(); |
203 | int id; |
192 | 204 | ||
193 | if (tabs.active_tab == SKINS) list_w=250; else list_w=350; |
205 | sc.get(); |
194 | 206 | ||
- | 207 | //tabs.w = Form.cwidth-LP-LP; |
|
Line 195... | Line 208... | ||
195 | tabs.w = Form.cwidth-LP-LP; |
208 | tabs.draw(); |
- | 209 | draw_icon_16w(tabs.x + TAB_PADDING, 15, 17); |
|
196 | tabs.draw(); |
210 | draw_icon_16w(sizeof(t_skins)-1*8 + TAB_PADDING + TAB_PADDING + tabs.x, 15, 6); |
197 | draw_icon_16w(tabs.x + TAB_PADDING, 15, 17); |
211 | draw_icon_16w(sizeof(t_wallpapers)+sizeof(t_skins)-2*8 + TAB_PADDING + TAB_PADDING + TAB_PADDING + tabs.x, 15, 61); |
198 | draw_icon_16w(strlen(T_SKINS)*8 + tabs.x + TAB_PADDING + TAB_PADDING, 15, 6); |
212 | |
199 | 213 | id = select_list.cur_y; |
|
200 | id = select_list.cur_y; |
214 | #define LIST_W 280 |
201 | SelectList_Init( |
215 | SelectList_Init( |
202 | tabs.x+TAB_PADDING, |
216 | LP + TAB_PADDING, |
Line 203... | Line 217... | ||
203 | tabs.y+TAB_HEIGHT+TAB_PADDING, |
217 | PANEL_H, |
204 | list_w, |
218 | LIST_W, |
205 | Form.cheight-LP-LP - TAB_PADDING - TAB_PADDING - TAB_HEIGHT |
219 | Form.cheight-LP-LP - TAB_PADDING - PANEL_H |
206 | ); |
220 | ); |
207 | select_list.cur_y = id; |
221 | select_list.cur_y = id; |
208 | 222 | ||
Line 209... | Line 223... | ||
209 | skp.set_size( |
223 | skp.set_size( |
210 | select_list.x + select_list.w + TAB_PADDING + scroll1.size_x + 20, |
224 | LP + TAB_PADDING + LIST_W + TAB_PADDING + 30, |
211 | select_list.y + 30 + 50, |
- | |
Line 212... | Line 225... | ||
212 | list_w, |
225 | PANEL_H, |
213 | 230 //select_list.h - 50 - 50 |
226 | WIN_W - 400, |
214 | ); |
- | |
215 | 227 | 230 //select_list.h - 50 - 50 |
|
216 | SelectList_Draw(); |
228 | ); |
- | 229 | ||
217 | SelectList_DrawBorder(); |
230 | SelectList_Draw(); |
218 | //DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, LP, sc.work); |
231 | SelectList_DrawBorder(); |
219 | 232 | ||
220 | if (tabs.active_tab == SKINS) |
- | |
221 | { |
- | |
222 | update_docky.draw(skp.x, select_list.y+15); |
233 | if (tabs.active_tab == SKINS) |
223 | DrawFrame(skp.x, skp.y, skp.w, skp.h, " Components Preview "); |
234 | { |
224 | DrawUiElementsPreview(skp.x+20, skp.y, skp.h); |
235 | DrawFrame(skp.x, PANEL_H+5, skp.w, skp.h, " Components Preview "); |
- | 236 | DrawUiElementsPreview(skp.x+20, PANEL_H+5, skp.h); |
|
- | 237 | if (CheckProcessExists("@DOCKY")) update_docky.draw(skp.x, PANEL_H+250); |
|
- | 238 | } |
|
- | 239 | if (tabs.active_tab == WALLPAPERS) |
|
- | 240 | { |
|
225 | } |
241 | DrawFrame(skp.x, PANEL_H+5, 180, 80, T_PICTURE_MODE); |
226 | if (tabs.active_tab == WALLPAPERS) |
242 | optionbox_stretch.draw(skp.x+14, PANEL_H+25); |
Line 227... | Line 243... | ||
227 | { |
243 | optionbox_tiled.draw(skp.x+14, PANEL_H+52); |
Line 330... | Line 346... | ||
330 | active_skin = select_list.cur_y; |
346 | active_skin = select_list.cur_y; |
331 | strcpy(#folder_path, #wallp_folder_path); |
347 | strcpy(#folder_path, #wallp_folder_path); |
332 | ActivateTab(active_wallpaper); |
348 | ActivateTab(active_wallpaper); |
333 | } |
349 | } |
Line -... | Line 350... | ||
- | 350 | ||
- | 351 | void EventTabScreensaverClick() |
|
- | 352 | { |
|
- | 353 | //strcpy(#folder_path, #wallp_folder_path); |
|
- | 354 | ActivateTab(active_screensaver); |
|
- | 355 | } |
|
334 | 356 | ||
335 | void EventDeleteFile() |
357 | void EventDeleteFile() |
336 | { |
358 | { |
337 | io.del(#cur_file_path); |
359 | io.del(#cur_file_path); |
338 | Open_Dir(); |
360 | Open_Dir(); |
339 | EventApply(); |
361 | EventApply(); |
Line 340... | Line 362... | ||
340 | } |
362 | } |
341 | 363 | ||
342 | void EventSetNewCurrent() |
364 | void EventSetNewCurrent() |
- | 365 | { |
|
343 | { |
366 | cur = select_list.cur_y; |
344 | cur = select_list.cur_y; |
367 | miniprintf(#cur_file_path,"%s/",#folder_path); |
Line 345... | Line 368... | ||
345 | sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur])); |
368 | strcat(#cur_file_path, io.dir.position(files_mas[cur])); |
346 | } |
369 | } |
347 | 370 | ||
Line 366... | Line 389... | ||
366 | optionbox_stretch.checked = false; |
389 | optionbox_stretch.checked = false; |
367 | optionbox_stretch.redraw(); |
390 | optionbox_stretch.redraw(); |
368 | EventApply(); |
391 | EventApply(); |
369 | } |
392 | } |
Line 370... | Line -... | ||
370 | - | ||
371 | #include "..\lib\patterns\restart_process.h" |
393 | |
372 | void EventApply() |
394 | void EventApply() |
373 | { |
395 | { |
374 | char kivpath[4096+10]; |
396 | char kivpath[4096+10]; |
375 | EventSetNewCurrent(); |
397 | EventSetNewCurrent(); |
Line 382... | Line 404... | ||
382 | EventUpdateDocky(); |
404 | EventUpdateDocky(); |
383 | } |
405 | } |
384 | if (tabs.active_tab==WALLPAPERS) |
406 | if (tabs.active_tab==WALLPAPERS) |
385 | { |
407 | { |
386 | SelectList_Draw(); |
408 | SelectList_Draw(); |
387 | if (optionbox_stretch.checked) strcpy(#kivpath, "\\S__"); |
409 | if (optionbox_stretch.checked) miniprintf(#kivpath, "\\S__%s", #cur_file_path); |
388 | if (optionbox_tiled.checked) strcpy(#kivpath, "\\T__"); |
410 | if (optionbox_tiled.checked) miniprintf(#kivpath, "\\T__%s", #cur_file_path); |
389 | strcat(#kivpath, #cur_file_path); |
- | |
390 | RunProgram("/sys/media/kiv", #kivpath); |
411 | RunProgram("/sys/media/kiv", #kivpath); |
391 | } |
412 | } |
392 | } |
413 | } |
Line 393... | Line 414... | ||
393 | 414 | ||
Line 404... | Line 425... | ||
404 | { |
425 | { |
405 | if (tabs.active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path); |
426 | if (tabs.active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path); |
406 | if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path); |
427 | if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path); |
407 | } |
428 | } |
Line 408... | Line -... | ||
408 | - | ||
409 | _ini ini = { "/sys/settings/system.ini", "style" }; |
429 | |
410 | void EventExit() |
430 | void EventExit() |
411 | { |
431 | { |
412 | if (cur_skin_path) 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)); |
413 | ExitProcess(); |
433 | ExitProcess(); |