Rev 6253 | Rev 6271 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6253 | Rev 6264 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | ?define WINDOW_HEADER "Appearance" |
29 | ?define WINDOW_HEADER "Appearance" |
30 | ?define T_SKINS " Skins" |
30 | ?define T_SKINS "Skins" |
31 | ?define T_WALLPAPERS " Wallpappers" |
31 | ?define T_WALLPAPERS "Wallpappers" |
32 | #endif |
32 | #endif |
Line 33... | Line -... | ||
33 | - | ||
34 | unsigned char icons[]= FROM "icons.raw"; |
- | |
35 | 33 | ||
36 | #define PANEL_H 40 |
34 | #define PANEL_H 40 |
37 | #define LIST_PADDING 20 |
- | |
38 | #define TAB_PADDING 16 |
- | |
39 | #define TAB_HEIGHT 25 |
35 | #define LIST_PADDING 20 |
40 | #define SKINS_STANDART_PATH "/kolibrios/res/skins" |
36 | #define SKINS_STANDART_PATH "/kolibrios/res/skins" |
Line 41... | Line 37... | ||
41 | #define WALP_STANDART_PATH "/kolibrios/res/wallpapers" |
37 | #define WALP_STANDART_PATH "/kolibrios/res/wallpapers" |
42 | 38 | ||
43 | llist list; |
39 | llist list; |
Line 44... | Line 40... | ||
44 | signed int active_tab, active_skin=-1, active_wallpaper=-1; |
40 | signed int active_skin=-1, active_wallpaper=-1; |
45 | enum { SKINS=2, WALLPAPERS }; |
41 | enum { SKINS=2, WALLPAPERS }; |
46 | 42 | ||
Line 109... | Line 105... | ||
109 | 105 | ||
110 | case evKey: |
106 | case evKey: |
111 | GetKeys(); |
107 | GetKeys(); |
112 | if (list.ProcessKey(key_scancode)) EventApply(); |
108 | if (list.ProcessKey(key_scancode)) EventApply(); |
113 | if (key_scancode==SCAN_CODE_ENTER) EventOpenFile(); |
109 | if (key_scancode==SCAN_CODE_ENTER) EventOpenFile(); |
114 | if (key_scancode==SCAN_CODE_TAB) if (active_tab==SKINS) EventTabClick(WALLPAPERS); else EventTabClick(SKINS); |
110 | if (key_scancode==SCAN_CODE_TAB) if (tabs.active_tab==SKINS) EventTabClick(WALLPAPERS); else EventTabClick(SKINS); |
115 | if (key_scancode==SCAN_CODE_DEL) EventDeleteFile(); |
111 | if (key_scancode==SCAN_CODE_DEL) EventDeleteFile(); |
116 | for (id=list.cur_y+1; id |
112 | for (id=list.cur_y+1; id |
117 | { |
113 | { |
118 | strcpy(#temp_filename, io.dir.position(files_mas[id])); |
114 | strcpy(#temp_filename, io.dir.position(files_mas[id])); |
Line 150... | Line 146... | ||
150 | list.cur_y = id; |
146 | list.cur_y = id; |
Line 151... | Line 147... | ||
151 | 147 | ||
152 | DrawBar(0,0, Form.cwidth, PANEL_H-LIST_PADDING, system.color.work); |
148 | DrawBar(0,0, Form.cwidth, PANEL_H-LIST_PADDING, system.color.work); |
153 | DrawRectangle3D(list.x-2, list.y-2, list.w+3+scroll1.size_x, list.h+3, system.color.work_dark, system.color.work_light); |
149 | DrawRectangle3D(list.x-2, list.y-2, list.w+3+scroll1.size_x, list.h+3, system.color.work_dark, system.color.work_light); |
154 | DrawWideRectangle(list.x-LIST_PADDING, list.y-LIST_PADDING, LIST_PADDING*2+list.w+scroll1.size_x, LIST_PADDING*2+list.h, LIST_PADDING-2, system.color.work); |
150 | DrawWideRectangle(list.x-LIST_PADDING, list.y-LIST_PADDING, LIST_PADDING*2+list.w+scroll1.size_x, LIST_PADDING*2+list.h, LIST_PADDING-2, system.color.work); |
155 | DrawTab(list.x+10, list.y, SKINS, T_SKINS); |
151 | tabs.draw(list.x+10, list.y, SKINS, T_SKINS); |
156 | if (dir_exists(WALP_STANDART_PATH)) DrawTab(strlen(T_SKINS)*8+TAB_PADDING+list.x+21, list.y, WALLPAPERS, T_WALLPAPERS); |
152 | if (dir_exists(WALP_STANDART_PATH)) tabs.draw(strlen(T_SKINS)*8+TAB_PADDING+list.x+21, list.y, WALLPAPERS, T_WALLPAPERS); |
Line 157... | Line 153... | ||
157 | DrawRectangle(list.x-1, list.y-1, list.w+1+scroll1.size_x, list.h+1, system.color.work_graph); |
153 | DrawRectangle(list.x-1, list.y-1, list.w+1+scroll1.size_x, list.h+1, system.color.work_graph); |
158 | 154 | ||
Line 159... | Line -... | ||
159 | Draw_List(); |
- | |
160 | } |
- | |
161 | - | ||
162 | void DrawTab(dword x,y, but_id, text) |
- | |
163 | { |
- | |
164 | dword col_bg, col_text; |
- | |
165 | dword w=strlen(text)*8+TAB_PADDING, h=TAB_HEIGHT; |
- | |
166 | y -= h; |
- | |
167 | - | ||
168 | if (but_id==active_tab) |
- | |
169 | { |
- | |
170 | col_bg=system.color.work_button; |
- | |
171 | col_text=system.color.work_button_text; |
- | |
172 | } |
- | |
173 | else |
- | |
174 | { |
- | |
175 | col_bg=system.color.work; |
- | |
176 | col_text=system.color.work_text; |
- | |
177 | } |
- | |
178 | DrawCaptButton(x,y, w-1,h+1, but_id, col_bg, col_text, text); |
- | |
179 | _PutImage(x+10,h-16/2+y+1, 16,15, but_id-2*16*15*3+#icons); |
155 | Draw_List(); |
180 | } |
156 | } |
181 | 157 | ||
182 | void DrawScroller() |
158 | void DrawScroller() |
183 | { |
159 | { |
Line 205... | Line 181... | ||
205 | io.dir.load(#folder_path,DIR_ONLYREAL); |
181 | io.dir.load(#folder_path,DIR_ONLYREAL); |
206 | for (j=0; j |
182 | for (j=0; j |
207 | { |
183 | { |
208 | strcpy(#temp_filename, io.dir.position(j)); |
184 | strcpy(#temp_filename, io.dir.position(j)); |
209 | strlwr(#temp_filename); |
185 | strlwr(#temp_filename); |
210 | if (active_tab==SKINS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue; |
186 | if (tabs.active_tab==SKINS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue; |
211 | if (active_tab==WALLPAPERS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".txt")==0) continue; |
187 | if (tabs.active_tab==WALLPAPERS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".txt")==0) continue; |
212 | cur = list.count; |
188 | cur = list.count; |
213 | files_mas[cur]=j; |
189 | files_mas[cur]=j; |
214 | if (!strcmpi("default.skn",#temp_filename)) files_mas[0]> |
190 | if (!strcmpi("default.skn",#temp_filename)) files_mas[0]> |
215 | list.count++; |
191 | list.count++; |
216 | } |
192 | } |
Line 250... | Line 226... | ||
250 | // // |
226 | // // |
251 | //===================================================// |
227 | //===================================================// |
Line 252... | Line 228... | ||
252 | 228 | ||
253 | void EventTabClick(int N) |
229 | void EventTabClick(int N) |
254 | { |
230 | { |
255 | active_tab = N; |
231 | tabs.click(N); |
256 | if (active_tab == SKINS) |
232 | if (tabs.active_tab == SKINS) |
257 | { |
233 | { |
258 | active_wallpaper = list.cur_y; |
234 | active_wallpaper = list.cur_y; |
259 | strcpy(#folder_path, SKINS_STANDART_PATH); |
235 | strcpy(#folder_path, SKINS_STANDART_PATH); |
260 | list.ClearList(); |
236 | list.ClearList(); |
261 | Open_Dir(); |
237 | Open_Dir(); |
262 | if (!list.count) notify("'No skins were found' -E"); |
238 | if (!list.count) notify("'No skins were found' -E"); |
263 | list.cur_y = active_skin; |
239 | list.cur_y = active_skin; |
264 | } |
240 | } |
265 | if (active_tab == WALLPAPERS) |
241 | if (tabs.active_tab == WALLPAPERS) |
266 | { |
242 | { |
267 | active_skin = list.cur_y; |
243 | active_skin = list.cur_y; |
268 | strcpy(#folder_path, WALP_STANDART_PATH); |
244 | strcpy(#folder_path, WALP_STANDART_PATH); |
269 | list.ClearList(); |
245 | list.ClearList(); |
270 | Open_Dir(); |
246 | Open_Dir(); |
271 | if (!list.count) notify("'No wallpapers were found' -E"); |
247 | if (!list.count) notify("'No wallpapers were found' -E"); |
272 | list.cur_y = active_wallpaper; |
248 | list.cur_y = active_wallpaper; |
- | 249 | } |
|
273 | } |
250 | if (list.cur_y>list.visible) list.first=list.cur_y; list.CheckDoesValuesOkey(); |
274 | if (list.w) DrawWindowContent(); |
251 | if (list.w) DrawWindowContent(); |
Line 275... | Line 252... | ||
275 | } |
252 | } |
276 | 253 | ||
Line 281... | Line 258... | ||
281 | EventApply(); |
258 | EventApply(); |
282 | } |
259 | } |
Line 283... | Line 260... | ||
283 | 260 | ||
284 | void EventApply() |
261 | void EventApply() |
285 | { |
262 | { |
286 | if (active_tab==SKINS) |
263 | if (tabs.active_tab==SKINS) |
287 | { |
264 | { |
288 | cur = list.cur_y; |
265 | cur = list.cur_y; |
289 | sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur])); |
266 | sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur])); |
290 | SetSystemSkin(#cur_file_path); |
267 | SetSystemSkin(#cur_file_path); |
291 | } |
268 | } |
292 | if (active_tab==WALLPAPERS) |
269 | if (tabs.active_tab==WALLPAPERS) |
293 | { |
270 | { |
294 | cur = list.cur_y; |
271 | cur = list.cur_y; |
295 | sprintf(#cur_file_path,"\\S__%s/%s",#folder_path,io.dir.position(files_mas[cur])); |
272 | sprintf(#cur_file_path,"\\S__%s/%s",#folder_path,io.dir.position(files_mas[cur])); |
296 | RunProgram("/sys/media/kiv", #cur_file_path); |
273 | RunProgram("/sys/media/kiv", #cur_file_path); |
297 | Draw_List(); |
274 | Draw_List(); |
298 | } |
275 | } |
Line 299... | Line 276... | ||
299 | } |
276 | } |
300 | 277 | ||
301 | void EventOpenFile() |
278 | void EventOpenFile() |
302 | { |
279 | { |
303 | if (active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path); |
280 | if (tabs.active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path); |
Line 304... | Line 281... | ||
304 | if (active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path); |
281 | if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path); |