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