Rev 7960 | Rev 8261 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7960 | Rev 8020 | ||
---|---|---|---|
1 | //11.03.12 - start! |
1 | //11.03.12 - start! |
2 | //ver 2.3 |
2 | //ver 2.3 |
3 | 3 | ||
4 | #ifndef AUTOBUILD |
4 | #ifndef AUTOBUILD |
5 | ?include "lang.h--" |
5 | ?include "lang.h--" |
6 | #endif |
6 | #endif |
7 | 7 | ||
8 | #define MEMSIZE 200*1024 |
8 | #define MEMSIZE 200*1024 |
9 | #include "../lib/mem.h" |
9 | #include "../lib/mem.h" |
10 | #include "../lib/strings.h" |
10 | #include "../lib/strings.h" |
11 | #include "../lib/io.h" |
11 | #include "../lib/io.h" |
12 | #include "../lib/list_box.h" |
12 | #include "../lib/list_box.h" |
13 | #include "../lib/obj/libimg.h" |
13 | #include "../lib/obj/libimg.h" |
14 | #include "../lib/gui.h" |
14 | #include "../lib/gui.h" |
15 | 15 | ||
16 | #include "../lib/obj/box_lib.h" |
16 | #include "../lib/obj/box_lib.h" |
17 | #include "../lib/obj/proc_lib.h" |
17 | #include "../lib/obj/proc_lib.h" |
18 | #include "../lib/obj/libini.h" |
18 | #include "../lib/obj/libini.h" |
19 | 19 | ||
20 | #include "../lib/patterns/select_list.h" |
20 | #include "../lib/patterns/select_list.h" |
21 | #include "../lib/patterns/simple_open_dialog.h" |
21 | #include "../lib/patterns/simple_open_dialog.h" |
22 | 22 | ||
23 | #include "ui_elements_preview.h" |
23 | #include "ui_elements_preview.h" |
24 | 24 | ||
25 | //===================================================// |
25 | //===================================================// |
26 | // // |
26 | // // |
27 | // DATA // |
27 | // DATA // |
28 | // // |
28 | // // |
29 | //===================================================// |
29 | //===================================================// |
30 | 30 | ||
31 | #ifdef LANG_RUS |
31 | #ifdef LANG_RUS |
32 | ?define WINDOW_HEADER " áâனª¨ ®ä®à¬«¥¨ï" |
32 | ?define WINDOW_HEADER " áâனª¨ ®ä®à¬«¥¨ï" |
33 | ?define T_SKINS " â¨«ì ®ª®" |
33 | ?define T_SKINS " â¨«ì ®ª®" |
34 | ?define T_WALLPAPERS " ¡®¨" |
34 | ?define T_WALLPAPERS " ¡®¨" |
35 | ?define T_SELECT_FOLDER "ë¡à âì ¯ ¯ªã" |
35 | ?define T_SELECT_FOLDER "ë¡à âì ¯ ¯ªã" |
36 | ?define MENU_LIST "âªàëâì ä ©« |Enter\n¤ «¨âì ä ©« |Del" |
36 | ?define MENU_LIST "âªàëâì ä ©« |Enter\n¤ «¨âì ä ©« |Del" |
37 | ?define T_PICTURE_MODE " ®«®¦¥¨¥ ª à⨪¨ " |
37 | ?define T_PICTURE_MODE " ®«®¦¥¨¥ ª à⨪¨ " |
38 | ?define T_CHECKBOX_STRETCH " áâïãâì" |
38 | ?define T_CHECKBOX_STRETCH " áâïãâì" |
39 | ?define T_CHECKBOX_TILED " ¬®áâ¨âì" |
39 | ?define T_CHECKBOX_TILED " ¬®áâ¨âì" |
40 | ?define T_UPDATE_DOCK "¡®¢«ïâì Dock-¯ ¥«ì" |
40 | ?define T_UPDATE_DOCK "¡®¢«ïâì Dock-¯ ¥«ì" |
41 | #else |
41 | #else |
42 | ?define WINDOW_HEADER "Appearance" |
42 | ?define WINDOW_HEADER "Appearance" |
43 | ?define T_SKINS " Skins" |
43 | ?define T_SKINS " Skins" |
44 | ?define T_WALLPAPERS " Wallpapers" |
44 | ?define T_WALLPAPERS " Wallpapers" |
45 | ?define T_SELECT_FOLDER "Select folder" |
45 | ?define T_SELECT_FOLDER "Select folder" |
46 | ?define MENU_LIST "Open file |Enter\nDelete file |Del" |
46 | ?define MENU_LIST "Open file |Enter\nDelete file |Del" |
47 | ?define T_PICTURE_MODE " Picture Mode " |
47 | ?define T_PICTURE_MODE " Picture Mode " |
48 | ?define T_CHECKBOX_STRETCH "Stretch" |
48 | ?define T_CHECKBOX_STRETCH "Stretch" |
49 | ?define T_CHECKBOX_TILED "Tiled" |
49 | ?define T_CHECKBOX_TILED "Tiled" |
50 | ?define T_UPDATE_DOCK "Update Dock" |
50 | ?define T_UPDATE_DOCK "Update Dock" |
51 | #endif |
51 | #endif |
52 | 52 | ||
53 | #define PANEL_H 40 |
53 | #define PANEL_H 40 |
54 | #define LP 10 //LIST_PADDING |
54 | #define LP 10 //LIST_PADDING |
55 | char skins_folder_path[4096]; |
55 | char skins_folder_path[4096]; |
56 | char wallp_folder_path[4096]; |
56 | char wallp_folder_path[4096]; |
57 | 57 | ||
58 | signed int active_skin=-1, active_wallpaper=-1; |
58 | signed int active_skin=-1, active_wallpaper=-1; |
59 | enum { |
59 | enum { |
60 | BASE_TAB_BUTTON_ID=2, |
60 | BASE_TAB_BUTTON_ID=2, |
61 | BTN_SELECT_WALLP_FOLDER=10 }; |
61 | BTN_SELECT_WALLP_FOLDER=10 }; |
62 | 62 | ||
63 | char folder_path[4096]; |
63 | char folder_path[4096]; |
64 | char cur_file_path[4096]; |
64 | char cur_file_path[4096]; |
65 | char cur_skin_path[4096]; |
65 | char cur_skin_path[4096]; |
66 | char temp_filename[4096]; |
66 | char temp_filename[4096]; |
67 | int files_mas[400]; |
67 | int files_mas[400]; |
68 | 68 | ||
69 | int cur; |
69 | int cur; |
70 | 70 | ||
71 | proc_info Form; |
71 | proc_info Form; |
72 | block skp; |
72 | block skp; |
73 | 73 | ||
74 | enum {SKINS, WALLPAPERS}; |
74 | enum {SKINS, WALLPAPERS}; |
75 | 75 | ||
76 | _tabs tabs = { LP, LP, NULL, BASE_TAB_BUTTON_ID }; |
76 | _tabs tabs = { LP, LP, NULL, BASE_TAB_BUTTON_ID }; |
77 | 77 | ||
78 | checkbox update_docky = { T_UPDATE_DOCK, false }; |
78 | checkbox update_docky = { T_UPDATE_DOCK, false }; |
79 | 79 | ||
80 | char default_dir[] = "/rd/1"; |
80 | char default_dir[] = "/rd/1"; |
81 | od_filter filter2 = { 8, "TXT\0\0" }; |
81 | od_filter filter2 = { 8, "TXT\0\0" }; |
82 | 82 | ||
83 | checkbox optionbox_stretch = { T_CHECKBOX_STRETCH, true }; |
83 | checkbox optionbox_stretch = { T_CHECKBOX_STRETCH, true }; |
84 | checkbox optionbox_tiled = { T_CHECKBOX_TILED, false }; |
84 | checkbox optionbox_tiled = { T_CHECKBOX_TILED, false }; |
85 | 85 | ||
86 | //===================================================// |
86 | //===================================================// |
87 | // // |
87 | // // |
88 | // CODE // |
88 | // CODE // |
89 | // // |
89 | // // |
90 | //===================================================// |
90 | //===================================================// |
91 | 91 | ||
92 | void GetRealFolderPathes() |
92 | void GetRealFolderPathes() |
93 | { |
93 | { |
94 | char real_skin_path[4096]; |
94 | char real_skin_path[4096]; |
95 | SetCurDir("/kolibrios"); |
95 | SetCurDir("/kolibrios"); |
96 | GetCurDir(#real_skin_path, sizeof(real_skin_path)); |
96 | GetCurDir(#real_skin_path, sizeof(real_skin_path)); |
97 | sprintf(#skins_folder_path, "%s/res/skins", #real_skin_path); |
97 | sprintf(#skins_folder_path, "%s/res/skins", #real_skin_path); |
98 | sprintf(#wallp_folder_path, "%s/res/wallpapers", #real_skin_path); |
98 | sprintf(#wallp_folder_path, "%s/res/wallpapers", #real_skin_path); |
99 | } |
99 | } |
100 | 100 | ||
101 | void main() |
101 | void main() |
102 | { |
102 | { |
103 | int id; |
103 | int id; |
104 | 104 | ||
105 | GetRealFolderPathes(); |
105 | GetRealFolderPathes(); |
106 | 106 | ||
107 | load_dll(boxlib, #box_lib_init,0); |
107 | load_dll(boxlib, #box_lib_init,0); |
108 | load_dll(libini, #lib_init,1); |
108 | load_dll(libini, #lib_init,1); |
109 | load_dll(libio, #libio_init,1); |
109 | load_dll(libio, #libio_init,1); |
110 | load_dll(libimg, #libimg_init,1); |
110 | load_dll(libimg, #libimg_init,1); |
111 | load_dll(Proc_lib, #OpenDialog_init,0); |
111 | load_dll(Proc_lib, #OpenDialog_init,0); |
112 | o_dialog.type = 2; //select folder |
112 | o_dialog.type = 2; //select folder |
113 | OpenDialog_init stdcall (#o_dialog); |
113 | OpenDialog_init stdcall (#o_dialog); |
114 | 114 | ||
115 | tabs.add(T_SKINS, #EventTabSkinsClick); |
115 | tabs.add(T_SKINS, #EventTabSkinsClick); |
116 | tabs.add(T_WALLPAPERS, #EventTabWallpappersClick); |
116 | tabs.add(T_WALLPAPERS, #EventTabWallpappersClick); |
117 | tabs.draw_active_tab(); |
117 | tabs.draw_active_tab(); |
118 | 118 | ||
119 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
119 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
120 | loop() switch(WaitEvent()) |
120 | loop() switch(WaitEvent()) |
121 | { |
121 | { |
122 | case evMouse: |
122 | case evMouse: |
123 | SelectList_ProcessMouse(); |
123 | SelectList_ProcessMouse(); |
124 | 124 | ||
125 | if (tabs.active_tab == SKINS) { |
125 | if (tabs.active_tab == SKINS) { |
126 | edit_box_mouse stdcall (#edit_cmm); |
126 | edit_box_mouse stdcall (#edit_cmm); |
127 | edit_box_mouse stdcall (#edit_st); |
127 | edit_box_mouse stdcall (#edit_st); |
128 | } |
128 | } |
129 | 129 | ||
130 | if (mouse.key&MOUSE_RIGHT) && (mouse.up) |
130 | if (mouse.key&MOUSE_RIGHT) && (mouse.up) |
131 | &&(select_list.MouseOver(mouse.x, mouse.y)) { |
131 | &&(select_list.MouseOver(mouse.x, mouse.y)) { |
132 | select_list.ProcessMouse(mouse.x, mouse.y); |
132 | select_list.ProcessMouse(mouse.x, mouse.y); |
133 | SelectList_Draw(); |
133 | SelectList_Draw(); |
134 | EventSetNewCurrent(); |
134 | EventSetNewCurrent(); |
135 | open_lmenu(Form.left+mouse.x+5, Form.top+mouse.y+skin_height, 1, 0, MENU_LIST); |
135 | open_lmenu(mouse.x, mouse.y, MENU_TOP_RIGHT, NULL, MENU_LIST); |
136 | } |
136 | } |
137 | break; |
137 | break; |
138 | 138 | ||
139 | case evButton: |
139 | case evButton: |
140 | id=GetButtonID(); |
140 | id=GetButtonID(); |
141 | if (id==1) EventExit(); |
141 | if (id==1) EventExit(); |
142 | if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder(); |
142 | if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder(); |
143 | tabs.click(id); |
143 | tabs.click(id); |
144 | checkbox1.click(id); |
144 | checkbox1.click(id); |
145 | spinbox1.click(id); |
145 | spinbox1.click(id); |
146 | if (update_docky.click(id)) EventUpdateDocky(); |
146 | if (update_docky.click(id)) EventUpdateDocky(); |
147 | if (!optionbox_stretch.checked) && (optionbox_stretch.click(id)) EventSetWallpMode_Stretch(); |
147 | if (!optionbox_stretch.checked) && (optionbox_stretch.click(id)) EventSetWallpMode_Stretch(); |
148 | if (!optionbox_tiled.checked) && (optionbox_tiled.click(id)) EventSetWallpMode_Tiled(); |
148 | if (!optionbox_tiled.checked) && (optionbox_tiled.click(id)) EventSetWallpMode_Tiled(); |
149 | break; |
149 | break; |
150 | 150 | ||
151 | case evKey: |
151 | case evKey: |
152 | GetKeys(); |
152 | GetKeys(); |
153 | if (select_list.ProcessKey(key_scancode)) EventApply(); |
153 | if (select_list.ProcessKey(key_scancode)) EventApply(); |
154 | if (key_scancode==SCAN_CODE_ENTER) EventOpenFile(); |
154 | if (key_scancode==SCAN_CODE_ENTER) EventOpenFile(); |
155 | if (key_scancode==SCAN_CODE_TAB) tabs.click(tabs.active_tab ^ 1); |
155 | if (key_scancode==SCAN_CODE_TAB) tabs.click(tabs.active_tab ^ 1); |
156 | if (key_scancode==SCAN_CODE_DEL) EventDeleteFile(); |
156 | if (key_scancode==SCAN_CODE_DEL) EventDeleteFile(); |
157 | 157 | ||
158 | if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus) |
158 | if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus) |
159 | for (id=select_list.cur_y+1; id |
159 | for (id=select_list.cur_y+1; id |
160 | { |
160 | { |
161 | strcpy(#temp_filename, io.dir.position(files_mas[id])); |
161 | strcpy(#temp_filename, io.dir.position(files_mas[id])); |
162 | if (temp_filename[0]==key_ascii) || (temp_filename[0]==key_ascii-32) |
162 | if (temp_filename[0]==key_ascii) || (temp_filename[0]==key_ascii-32) |
163 | { |
163 | { |
164 | select_list.cur_y = id - 1; |
164 | select_list.cur_y = id - 1; |
165 | select_list.KeyDown(); |
165 | select_list.KeyDown(); |
166 | EventApply(); |
166 | EventApply(); |
167 | break; |
167 | break; |
168 | } |
168 | } |
169 | } |
169 | } |
170 | 170 | ||
171 | if (tabs.active_tab == SKINS) { |
171 | if (tabs.active_tab == SKINS) { |
172 | EAX = key_ascii << 8; |
172 | EAX = key_ascii << 8; |
173 | edit_box_key stdcall (#edit_cmm); |
173 | edit_box_key stdcall (#edit_cmm); |
174 | edit_box_key stdcall (#edit_st); |
174 | edit_box_key stdcall (#edit_st); |
175 | } |
175 | } |
176 | break; |
176 | break; |
177 | 177 | ||
178 | case evReDraw: |
178 | case evReDraw: |
179 | draw_window(); |
179 | draw_window(); |
180 | EventHandleMenuClick(); |
180 | EventHandleMenuClick(); |
181 | } |
181 | } |
182 | } |
182 | } |
183 | 183 | ||
184 | void draw_window() |
184 | void draw_window() |
185 | { |
185 | { |
186 | sc.get(); |
186 | sc.get(); |
187 | DefineAndDrawWindow(screen.width-600/2,80,630,504+skin_height,0x34,sc.work,WINDOW_HEADER,0); |
187 | DefineAndDrawWindow(screen.width-600/2,80,630,504+skin_height,0x34,sc.work,WINDOW_HEADER,0); |
188 | GetProcessInfo(#Form, SelfInfo); |
188 | GetProcessInfo(#Form, SelfInfo); |
189 | IF (Form.status_window>=2) return; |
189 | IF (Form.status_window>=2) return; |
190 | DrawWindowContent(); |
190 | DrawWindowContent(); |
191 | } |
191 | } |
192 | 192 | ||
193 | void DrawWindowContent() |
193 | void DrawWindowContent() |
194 | { |
194 | { |
195 | int id; |
195 | int id; |
196 | int list_w; |
196 | int list_w; |
197 | 197 | ||
198 | sc.get(); |
198 | sc.get(); |
199 | 199 | ||
200 | if (tabs.active_tab == SKINS) list_w=250; else list_w=350; |
200 | if (tabs.active_tab == SKINS) list_w=250; else list_w=350; |
201 | 201 | ||
202 | tabs.w = Form.cwidth-LP-LP; |
202 | tabs.w = Form.cwidth-LP-LP; |
203 | tabs.draw(); |
203 | tabs.draw(); |
204 | DrawIcon16(tabs.x + TAB_PADDING, 15, sc.work, 17); |
204 | DrawIcon16(tabs.x + TAB_PADDING, 15, sc.work, 17); |
205 | DrawIcon16(strlen(T_SKINS)*8 + tabs.x + TAB_PADDING + TAB_PADDING, 15, sc.work, 6); |
205 | DrawIcon16(strlen(T_SKINS)*8 + tabs.x + TAB_PADDING + TAB_PADDING, 15, sc.work, 6); |
206 | 206 | ||
207 | id = select_list.cur_y; |
207 | id = select_list.cur_y; |
208 | SelectList_Init( |
208 | SelectList_Init( |
209 | tabs.x+TAB_PADDING, |
209 | tabs.x+TAB_PADDING, |
210 | tabs.y+TAB_HEIGHT+TAB_PADDING, |
210 | tabs.y+TAB_HEIGHT+TAB_PADDING, |
211 | list_w, |
211 | list_w, |
212 | Form.cheight-LP-LP - TAB_PADDING - TAB_PADDING - TAB_HEIGHT, |
212 | Form.cheight-LP-LP - TAB_PADDING - TAB_PADDING - TAB_HEIGHT, |
213 | false |
213 | false |
214 | ); |
214 | ); |
215 | select_list.cur_y = id; |
215 | select_list.cur_y = id; |
216 | 216 | ||
217 | skp.set_size( |
217 | skp.set_size( |
218 | select_list.x + select_list.w + TAB_PADDING + scroll1.size_x + 20, |
218 | select_list.x + select_list.w + TAB_PADDING + scroll1.size_x + 20, |
219 | select_list.y + 30 + 50, |
219 | select_list.y + 30 + 50, |
220 | list_w, |
220 | list_w, |
221 | 230 //select_list.h - 50 - 50 |
221 | 230 //select_list.h - 50 - 50 |
222 | ); |
222 | ); |
223 | 223 | ||
224 | SelectList_Draw(); |
224 | SelectList_Draw(); |
225 | SelectList_DrawBorder(); |
225 | SelectList_DrawBorder(); |
226 | //DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, LP, sc.work); |
226 | //DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, LP, sc.work); |
227 | 227 | ||
228 | if (tabs.active_tab == SKINS) |
228 | if (tabs.active_tab == SKINS) |
229 | { |
229 | { |
230 | update_docky.draw(skp.x, select_list.y+15); |
230 | update_docky.draw(skp.x, select_list.y+15); |
231 | DrawFrame(skp.x, skp.y, skp.w, skp.h, " Components Preview "); |
231 | DrawFrame(skp.x, skp.y, skp.w, skp.h, " Components Preview "); |
232 | DrawUiElementsPreview(skp.x+20, skp.y, skp.h); |
232 | DrawUiElementsPreview(skp.x+20, skp.y, skp.h); |
233 | } |
233 | } |
234 | if (tabs.active_tab == WALLPAPERS) |
234 | if (tabs.active_tab == WALLPAPERS) |
235 | { |
235 | { |
236 | skp.x -= TAB_PADDING + 3; |
236 | skp.x -= TAB_PADDING + 3; |
237 | DrawStandartCaptButton(skp.x, select_list.y, BTN_SELECT_WALLP_FOLDER, T_SELECT_FOLDER); |
237 | DrawStandartCaptButton(skp.x, select_list.y, BTN_SELECT_WALLP_FOLDER, T_SELECT_FOLDER); |
238 | DrawFrame(skp.x, select_list.y+50, 180, 80, T_PICTURE_MODE); |
238 | DrawFrame(skp.x, select_list.y+50, 180, 80, T_PICTURE_MODE); |
239 | optionbox_stretch.draw(skp.x+14, select_list.y+70); |
239 | optionbox_stretch.draw(skp.x+14, select_list.y+70); |
240 | optionbox_tiled.draw(skp.x+14, select_list.y+97); |
240 | optionbox_tiled.draw(skp.x+14, select_list.y+97); |
241 | } |
241 | } |
242 | } |
242 | } |
243 | 243 | ||
244 | 244 | ||
245 | void Open_Dir() |
245 | void Open_Dir() |
246 | { |
246 | { |
247 | int j; |
247 | int j; |
248 | select_list.count = 0; |
248 | select_list.count = 0; |
249 | if(io.dir.buffer)free(io.dir.buffer); |
249 | if(io.dir.buffer)free(io.dir.buffer); |
250 | io.dir.load(#folder_path,DIR_ONLYREAL); |
250 | io.dir.load(#folder_path,DIR_ONLYREAL); |
251 | for (j=0; j |
251 | for (j=0; j |
252 | { |
252 | { |
253 | strcpy(#temp_filename, io.dir.position(j)); |
253 | strcpy(#temp_filename, io.dir.position(j)); |
254 | strlwr(#temp_filename); |
254 | strlwr(#temp_filename); |
255 | if (tabs.active_tab==SKINS) { |
255 | if (tabs.active_tab==SKINS) { |
256 | if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue; |
256 | if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue; |
257 | } |
257 | } |
258 | if (tabs.active_tab==WALLPAPERS) { |
258 | if (tabs.active_tab==WALLPAPERS) { |
259 | if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".png")!=0) |
259 | if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".png")!=0) |
260 | && (strcmpi(#temp_filename+strlen(#temp_filename)-4,".jpg")!=0) |
260 | && (strcmpi(#temp_filename+strlen(#temp_filename)-4,".jpg")!=0) |
261 | && (strcmpi(#temp_filename+strlen(#temp_filename)-5,".jpeg")!=0) |
261 | && (strcmpi(#temp_filename+strlen(#temp_filename)-5,".jpeg")!=0) |
262 | && (strcmpi(#temp_filename+strlen(#temp_filename)-4,".gif")!=0) continue; |
262 | && (strcmpi(#temp_filename+strlen(#temp_filename)-4,".gif")!=0) continue; |
263 | } |
263 | } |
264 | cur = select_list.count; |
264 | cur = select_list.count; |
265 | files_mas[cur]=j; |
265 | files_mas[cur]=j; |
266 | if (!strcmpi("default.skn",#temp_filename)) files_mas[0]> |
266 | if (!strcmpi("default.skn",#temp_filename)) files_mas[0]> |
267 | select_list.count++; |
267 | select_list.count++; |
268 | } |
268 | } |
269 | } |
269 | } |
270 | 270 | ||
271 | void SelectList_DrawLine(dword i) |
271 | void SelectList_DrawLine(dword i) |
272 | { |
272 | { |
273 | int yyy, list_last; |
273 | int yyy, list_last; |
274 | 274 | ||
275 | cur = select_list.first + i; |
275 | cur = select_list.first + i; |
276 | strcpy(#temp_filename, io.dir.position(files_mas[cur])); |
276 | strcpy(#temp_filename, io.dir.position(files_mas[cur])); |
277 | temp_filename[strlen(#temp_filename)-4] = 0; |
277 | temp_filename[strlen(#temp_filename)-4] = 0; |
278 | yyy = i*select_list.item_h+select_list.y; |
278 | yyy = i*select_list.item_h+select_list.y; |
279 | 279 | ||
280 | if (select_list.cur_y-select_list.first==i) |
280 | if (select_list.cur_y-select_list.first==i) |
281 | { |
281 | { |
282 | DrawBar(select_list.x, yyy, select_list.w, select_list.item_h, sc.button); |
282 | DrawBar(select_list.x, yyy, select_list.w, select_list.item_h, sc.button); |
283 | WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,sc.button_text, #temp_filename); |
283 | WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,sc.button_text, #temp_filename); |
284 | } |
284 | } |
285 | else |
285 | else |
286 | { |
286 | { |
287 | DrawBar(select_list.x,yyy,select_list.w, select_list.item_h, 0xFFFfff); |
287 | DrawBar(select_list.x,yyy,select_list.w, select_list.item_h, 0xFFFfff); |
288 | WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,0, #temp_filename); |
288 | WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,0, #temp_filename); |
289 | } |
289 | } |
290 | } |
290 | } |
291 | 291 | ||
292 | void SelectList_LineChanged() |
292 | void SelectList_LineChanged() |
293 | { |
293 | { |
294 | EventApply(); |
294 | EventApply(); |
295 | } |
295 | } |
296 | 296 | ||
297 | void ActivateTab(int _id) |
297 | void ActivateTab(int _id) |
298 | { |
298 | { |
299 | select_list.ClearList(); |
299 | select_list.ClearList(); |
300 | Open_Dir(); |
300 | Open_Dir(); |
301 | if (!select_list.count) notify("'No files were found' -E"); |
301 | if (!select_list.count) notify("'No files were found' -E"); |
302 | select_list.cur_y = _id; |
302 | select_list.cur_y = _id; |
303 | if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; |
303 | if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; |
304 | select_list.CheckDoesValuesOkey(); |
304 | select_list.CheckDoesValuesOkey(); |
305 | if (select_list.w) draw_window(); |
305 | if (select_list.w) draw_window(); |
306 | } |
306 | } |
307 | 307 | ||
308 | //===================================================// |
308 | //===================================================// |
309 | // // |
309 | // // |
310 | // EVENTS // |
310 | // EVENTS // |
311 | // // |
311 | // // |
312 | //===================================================// |
312 | //===================================================// |
313 | 313 | ||
314 | void EventTabSkinsClick() |
314 | void EventTabSkinsClick() |
315 | { |
315 | { |
316 | active_wallpaper = select_list.cur_y; |
316 | active_wallpaper = select_list.cur_y; |
317 | strcpy(#folder_path, #skins_folder_path); |
317 | strcpy(#folder_path, #skins_folder_path); |
318 | ActivateTab(active_skin); |
318 | ActivateTab(active_skin); |
319 | } |
319 | } |
320 | 320 | ||
321 | void EventTabWallpappersClick() |
321 | void EventTabWallpappersClick() |
322 | { |
322 | { |
323 | active_skin = select_list.cur_y; |
323 | active_skin = select_list.cur_y; |
324 | strcpy(#folder_path, #wallp_folder_path); |
324 | strcpy(#folder_path, #wallp_folder_path); |
325 | ActivateTab(active_wallpaper); |
325 | ActivateTab(active_wallpaper); |
326 | } |
326 | } |
327 | 327 | ||
328 | void EventDeleteFile() |
328 | void EventDeleteFile() |
329 | { |
329 | { |
330 | io.del(#cur_file_path); |
330 | io.del(#cur_file_path); |
331 | Open_Dir(); |
331 | Open_Dir(); |
332 | EventApply(); |
332 | EventApply(); |
333 | } |
333 | } |
334 | 334 | ||
335 | void EventSetNewCurrent() |
335 | void EventSetNewCurrent() |
336 | { |
336 | { |
337 | cur = select_list.cur_y; |
337 | cur = select_list.cur_y; |
338 | sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur])); |
338 | sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur])); |
339 | } |
339 | } |
340 | 340 | ||
341 | void EventSelectWallpFolder() |
341 | void EventSelectWallpFolder() |
342 | { |
342 | { |
343 | OpenDialog_start stdcall (#o_dialog); |
343 | OpenDialog_start stdcall (#o_dialog); |
344 | if (o_dialog.status) { |
344 | if (o_dialog.status) { |
345 | strcpy(#wallp_folder_path, #opendir_path); |
345 | strcpy(#wallp_folder_path, #opendir_path); |
346 | EventTabWallpappersClick(); |
346 | EventTabWallpappersClick(); |
347 | } |
347 | } |
348 | } |
348 | } |
349 | 349 | ||
350 | void EventSetWallpMode_Stretch() |
350 | void EventSetWallpMode_Stretch() |
351 | { |
351 | { |
352 | optionbox_tiled.checked = false; |
352 | optionbox_tiled.checked = false; |
353 | optionbox_tiled.redraw(); |
353 | optionbox_tiled.redraw(); |
354 | EventApply(); |
354 | EventApply(); |
355 | } |
355 | } |
356 | 356 | ||
357 | void EventSetWallpMode_Tiled() |
357 | void EventSetWallpMode_Tiled() |
358 | { |
358 | { |
359 | optionbox_stretch.checked = false; |
359 | optionbox_stretch.checked = false; |
360 | optionbox_stretch.redraw(); |
360 | optionbox_stretch.redraw(); |
361 | EventApply(); |
361 | EventApply(); |
362 | } |
362 | } |
363 | 363 | ||
364 | #include "..\lib\patterns\restart_process.h" |
364 | #include "..\lib\patterns\restart_process.h" |
365 | void EventApply() |
365 | void EventApply() |
366 | { |
366 | { |
367 | char kivpath[4096+10]; |
367 | char kivpath[4096+10]; |
368 | EventSetNewCurrent(); |
368 | EventSetNewCurrent(); |
369 | if (tabs.active_tab==SKINS) |
369 | if (tabs.active_tab==SKINS) |
370 | { |
370 | { |
371 | cur = select_list.cur_y; |
371 | cur = select_list.cur_y; |
372 | SetSystemSkin(#cur_file_path); |
372 | SetSystemSkin(#cur_file_path); |
373 | SelectList_Draw(); |
373 | SelectList_Draw(); |
374 | strcpy(#cur_skin_path, #cur_file_path); |
374 | strcpy(#cur_skin_path, #cur_file_path); |
375 | EventUpdateDocky(); |
375 | EventUpdateDocky(); |
376 | } |
376 | } |
377 | if (tabs.active_tab==WALLPAPERS) |
377 | if (tabs.active_tab==WALLPAPERS) |
378 | { |
378 | { |
379 | SelectList_Draw(); |
379 | SelectList_Draw(); |
380 | if (optionbox_stretch.checked) strcpy(#kivpath, "\\S__"); |
380 | if (optionbox_stretch.checked) strcpy(#kivpath, "\\S__"); |
381 | if (optionbox_tiled.checked) strcpy(#kivpath, "\\T__"); |
381 | if (optionbox_tiled.checked) strcpy(#kivpath, "\\T__"); |
382 | strcat(#kivpath, #cur_file_path); |
382 | strcat(#kivpath, #cur_file_path); |
383 | RunProgram("/sys/media/kiv", #kivpath); |
383 | RunProgram("/sys/media/kiv", #kivpath); |
384 | } |
384 | } |
385 | } |
385 | } |
386 | 386 | ||
387 | void EventUpdateDocky() |
387 | void EventUpdateDocky() |
388 | { |
388 | { |
389 | if (!update_docky.checked) return; |
389 | if (!update_docky.checked) return; |
390 | KillProcessByName("@docky", MULTIPLE); |
390 | KillProcessByName("@docky", MULTIPLE); |
391 | RunProgram("/sys/@docky",NULL); |
391 | RunProgram("/sys/@docky",NULL); |
392 | pause(50); |
392 | pause(50); |
393 | ActivateWindow(GetProcessSlot(Form.ID)); |
393 | ActivateWindow(GetProcessSlot(Form.ID)); |
394 | } |
394 | } |
395 | 395 | ||
396 | void EventOpenFile() |
396 | void EventOpenFile() |
397 | { |
397 | { |
398 | if (tabs.active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path); |
398 | if (tabs.active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path); |
399 | 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); |
400 | } |
400 | } |
401 | 401 | ||
402 | _ini ini = { "/sys/settings/system.ini", "style" }; |
402 | _ini ini = { "/sys/settings/system.ini", "style" }; |
403 | void EventExit() |
403 | void EventExit() |
404 | { |
404 | { |
405 | if (cur_skin_path) ini.SetString("skin", #cur_skin_path, strlen(#cur_skin_path)); |
405 | if (cur_skin_path) ini.SetString("skin", #cur_skin_path, strlen(#cur_skin_path)); |
406 | ExitProcess(); |
406 | ExitProcess(); |
407 | } |
407 | } |
408 | 408 | ||
409 | void EventHandleMenuClick() |
409 | void EventHandleMenuClick() |
410 | { |
410 | { |
411 | switch (get_menu_click()) |
411 | switch (get_menu_click()) |
412 | { |
412 | { |
413 | case 1: |
413 | case 1: |
414 | EventOpenFile(); |
414 | EventOpenFile(); |
415 | break; |
415 | break; |
416 | case 2: |
416 | case 2: |
417 | EventDeleteFile(); |
417 | EventDeleteFile(); |
418 | break; |
418 | break; |
419 | }; |
419 | }; |
420 | } |
420 | } |
421 | 421 | ||
422 | stop: |
422 | stop: |
423 | >><> |
423 | >><> |