Rev 7450 | Rev 7533 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7450 | Rev 7506 | ||
---|---|---|---|
1 | //11.03.12 - start! |
1 | //11.03.12 - start! |
2 | //ver 2.1 |
2 | //ver 2.1 |
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 0xFE800 |
8 | #define MEMSIZE 0xFE800 |
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\gui.h" |
13 | #include "..\lib\gui.h" |
14 | 14 | ||
15 | #include "..\lib\obj\box_lib.h" |
15 | #include "..\lib\obj\box_lib.h" |
16 | #include "..\lib\obj\proc_lib.h" |
16 | #include "..\lib\obj\proc_lib.h" |
17 | 17 | ||
18 | #include "..\lib\patterns\select_list.h" |
18 | #include "..\lib\patterns\select_list.h" |
19 | #include "..\lib\patterns\simple_open_dialog.h" |
19 | #include "..\lib\patterns\simple_open_dialog.h" |
20 | 20 | ||
21 | //===================================================// |
21 | //===================================================// |
22 | // // |
22 | // // |
23 | // DATA // |
23 | // DATA // |
24 | // // |
24 | // // |
25 | //===================================================// |
25 | //===================================================// |
26 | 26 | ||
27 | #ifdef LANG_RUS |
27 | #ifdef LANG_RUS |
28 | ?define WINDOW_HEADER " áâனª¨ ®ä®à¬«¥¨ï" |
28 | ?define WINDOW_HEADER " áâனª¨ ®ä®à¬«¥¨ï" |
29 | ?define T_SKINS "â¨«ì ®ª®" |
29 | ?define T_SKINS "â¨«ì ®ª®" |
30 | ?define T_WALLPAPERS "¡®¨" |
30 | ?define T_WALLPAPERS "¡®¨" |
31 | ?define T_SELECT_FOLDER "ë¡à âì ¯ ¯ªã" |
31 | ?define T_SELECT_FOLDER "ë¡à âì ¯ ¯ªã" |
32 | ?define MENU_LIST "âªàëâì ä ©« Enter\n¤ «¨âì ä ©« Del" |
32 | ?define MENU_LIST "âªàëâì ä ©« Enter\n¤ «¨âì ä ©« Del" |
33 | #else |
33 | #else |
34 | ?define WINDOW_HEADER "Appearance" |
34 | ?define WINDOW_HEADER "Appearance" |
35 | ?define T_SKINS "Skins" |
35 | ?define T_SKINS "Skins" |
36 | ?define T_WALLPAPERS "Wallpapers" |
36 | ?define T_WALLPAPERS "Wallpapers" |
37 | ?define T_SELECT_FOLDER "Select wallpapers" |
37 | ?define T_SELECT_FOLDER "Select wallpapers" |
38 | ?define MENU_LIST "Open file Enter\nDelete file Del" |
38 | ?define MENU_LIST "Open file Enter\nDelete file Del" |
39 | #endif |
39 | #endif |
40 | 40 | ||
41 | #define PANEL_H 40 |
41 | #define PANEL_H 40 |
42 | #define LP 10 //LIST_PADDING |
42 | #define LP 10 //LIST_PADDING |
43 | char skins_folder_path[4096] = "/kolibrios/res/skins"; |
43 | char skins_folder_path[4096] = "/kolibrios/res/skins"; |
44 | char wallp_folder_path[4096] = "/kolibrios/res/wallpapers"; |
44 | char wallp_folder_path[4096] = "/kolibrios/res/wallpapers"; |
45 | 45 | ||
46 | signed int active_skin=-1, active_wallpaper=-1; |
46 | signed int active_skin=-1, active_wallpaper=-1; |
47 | enum { |
47 | enum { |
48 | SKINS=2, |
48 | SKINS=2, |
49 | WALLPAPERS, |
49 | WALLPAPERS, |
50 | BTN_SELECT_WALLP_FOLDER }; |
50 | BTN_SELECT_WALLP_FOLDER }; |
51 | 51 | ||
52 | char folder_path[4096]; |
52 | char folder_path[4096]; |
53 | char cur_file_path[4096]; |
53 | char cur_file_path[4096]; |
54 | char temp_filename[4096]; |
54 | char temp_filename[4096]; |
55 | int files_mas[400]; |
55 | int files_mas[400]; |
56 | 56 | ||
57 | int cur; |
57 | int cur; |
58 | 58 | ||
59 | proc_info Form; |
59 | proc_info Form; |
60 | block skp; |
60 | block skp; |
61 | 61 | ||
62 | _tabs tabs = { LP, LP, NULL, NULL, SKINS }; |
62 | _tabs tabs = { LP, LP, NULL, NULL, SKINS }; |
63 | 63 | ||
64 | checkbox checkbox1 = { "Checkbox", true }; |
64 | checkbox checkbox1 = { "Checkbox", true }; |
65 | more_less_box spinbox1 = { 23, 0, 999, "SpinBox" }; |
65 | more_less_box spinbox1 = { 23, 0, 999, "SpinBox" }; |
66 | edit_box edit_cmm = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff, |
66 | edit_box edit_cmm = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff, |
67 | 0x10000000,sizeof(param),#param,0, 0b}; |
67 | 0x10000000,sizeof(param)-2,#param,0, 0b}; |
68 | 68 | ||
69 | char st_str[16]; |
69 | char st_str[16]; |
70 | edit_box edit_st = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff, |
70 | edit_box edit_st = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff, |
71 | 0x10000000,sizeof(st_str),#st_str,0, 0b}; |
71 | 0x10000000,sizeof(st_str)-2,#st_str,0, 0b}; |
72 | 72 | ||
73 | char default_dir[] = "/rd/1"; |
73 | char default_dir[] = "/rd/1"; |
74 | od_filter filter2 = { 8, "TXT\0\0" }; |
74 | od_filter filter2 = { 8, "TXT\0\0" }; |
75 | 75 | ||
76 | //===================================================// |
76 | //===================================================// |
77 | // // |
77 | // // |
78 | // CODE // |
78 | // CODE // |
79 | // // |
79 | // // |
80 | //===================================================// |
80 | //===================================================// |
81 | 81 | ||
82 | void main() |
82 | void main() |
83 | { |
83 | { |
84 | int id, mouse_clicked; |
84 | int id, mouse_clicked; |
85 | 85 | ||
86 | load_dll(boxlib, #box_lib_init,0); |
86 | load_dll(boxlib, #box_lib_init,0); |
87 | load_dll(Proc_lib, #OpenDialog_init,0); |
87 | load_dll(Proc_lib, #OpenDialog_init,0); |
88 | o_dialog.type = 2; //select folder |
88 | o_dialog.type = 2; //select folder |
89 | OpenDialog_init stdcall (#o_dialog); |
89 | OpenDialog_init stdcall (#o_dialog); |
90 | 90 | ||
91 | EventTabClick(SKINS); |
91 | EventTabClick(SKINS); |
92 | 92 | ||
93 | SetEventMask(0x27); |
93 | SetEventMask(0x27); |
94 | loop() switch(WaitEvent()) |
94 | loop() switch(WaitEvent()) |
95 | { |
95 | { |
96 | case evMouse: |
96 | case evMouse: |
97 | if (!CheckActiveProcess(Form.ID)) break; |
97 | if (!CheckActiveProcess(Form.ID)) break; |
98 | SelectList_ProcessMouse(); |
98 | SelectList_ProcessMouse(); |
99 | 99 | ||
100 | if (tabs.active_tab == SKINS) { |
100 | if (tabs.active_tab == SKINS) { |
101 | edit_box_mouse stdcall (#edit_cmm); |
101 | edit_box_mouse stdcall (#edit_cmm); |
102 | edit_box_mouse stdcall (#edit_st); |
102 | edit_box_mouse stdcall (#edit_st); |
103 | } |
103 | } |
104 | 104 | ||
105 | if (mouse.pkm)&&(select_list.MouseOver(mouse.x, mouse.y)) { |
105 | if (mouse.pkm)&&(select_list.MouseOver(mouse.x, mouse.y)) { |
106 | select_list.ProcessMouse(mouse.x, mouse.y); |
106 | select_list.ProcessMouse(mouse.x, mouse.y); |
107 | SelectList_Draw(); |
107 | SelectList_Draw(); |
108 | EventSetNewCurrent(); |
108 | EventSetNewCurrent(); |
109 | menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 146, MENU_LIST, 10); |
109 | menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 146, MENU_LIST, 10); |
110 | } |
110 | } |
111 | break; |
111 | break; |
112 | 112 | ||
113 | case evButton: |
113 | case evButton: |
114 | id=GetButtonID(); |
114 | id=GetButtonID(); |
115 | if (id==1) ExitProcess(); |
115 | if (id==1) ExitProcess(); |
116 | if (id==SKINS) EventTabClick(SKINS); |
116 | if (id==SKINS) EventTabClick(SKINS); |
117 | if (id==WALLPAPERS) EventTabClick(WALLPAPERS); |
117 | if (id==WALLPAPERS) EventTabClick(WALLPAPERS); |
118 | if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder(); |
118 | if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder(); |
119 | checkbox1.click(id); |
119 | checkbox1.click(id); |
120 | spinbox1.click(id); |
120 | spinbox1.click(id); |
121 | break; |
121 | break; |
122 | 122 | ||
123 | case evKey: |
123 | case evKey: |
124 | GetKeys(); |
124 | GetKeys(); |
125 | if (select_list.ProcessKey(key_scancode)) EventApply(); |
125 | if (select_list.ProcessKey(key_scancode)) EventApply(); |
126 | if (key_scancode==SCAN_CODE_ENTER) EventOpenFile(); |
126 | if (key_scancode==SCAN_CODE_ENTER) EventOpenFile(); |
127 | if (key_scancode==SCAN_CODE_TAB) { |
127 | if (key_scancode==SCAN_CODE_TAB) { |
128 | if (tabs.active_tab==SKINS) EventTabClick(WALLPAPERS); |
128 | if (tabs.active_tab==SKINS) EventTabClick(WALLPAPERS); |
129 | else EventTabClick(SKINS); |
129 | else EventTabClick(SKINS); |
130 | } |
130 | } |
131 | if (key_scancode==SCAN_CODE_DEL) EventDeleteFile(); |
131 | if (key_scancode==SCAN_CODE_DEL) EventDeleteFile(); |
132 | 132 | ||
133 | if (! edit_cmm.flags & 0b10) && (! edit_st.flags & 0b10) |
133 | if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus) |
134 | for (id=select_list.cur_y+1; id |
134 | for (id=select_list.cur_y+1; id |
135 | { |
135 | { |
136 | strcpy(#temp_filename, io.dir.position(files_mas[id])); |
136 | strcpy(#temp_filename, io.dir.position(files_mas[id])); |
137 | if (temp_filename[0]==key_ascii) || (temp_filename[0]==key_ascii-32) |
137 | if (temp_filename[0]==key_ascii) || (temp_filename[0]==key_ascii-32) |
138 | { |
138 | { |
139 | select_list.cur_y = id - 1; |
139 | select_list.cur_y = id - 1; |
140 | select_list.KeyDown(); |
140 | select_list.KeyDown(); |
141 | EventApply(); |
141 | EventApply(); |
142 | break; |
142 | break; |
143 | } |
143 | } |
144 | } |
144 | } |
145 | 145 | ||
146 | if (tabs.active_tab == SKINS) { |
146 | if (tabs.active_tab == SKINS) { |
147 | EAX = key_ascii << 8; |
147 | EAX = key_ascii << 8; |
148 | edit_box_key stdcall (#edit_cmm); |
148 | edit_box_key stdcall (#edit_cmm); |
149 | edit_box_key stdcall (#edit_st); |
149 | edit_box_key stdcall (#edit_st); |
150 | } |
150 | } |
151 | break; |
151 | break; |
152 | 152 | ||
153 | case evReDraw: |
153 | case evReDraw: |
154 | draw_window(); |
154 | draw_window(); |
155 | if (menu.cur_y) { |
155 | if (menu.cur_y) { |
156 | if (menu.cur_y == 10) EventOpenFile(); |
156 | if (menu.cur_y == 10) EventOpenFile(); |
157 | if (menu.cur_y == 11) EventDeleteFile(); |
157 | if (menu.cur_y == 11) EventDeleteFile(); |
158 | menu.cur_y = 0; |
158 | menu.cur_y = 0; |
159 | }; |
159 | }; |
160 | } |
160 | } |
161 | } |
161 | } |
162 | 162 | ||
163 | void draw_window() |
163 | void draw_window() |
164 | { |
164 | { |
165 | system.color.get(); |
165 | system.color.get(); |
166 | DefineAndDrawWindow(screen.width-600/2,80,630,404+skin_height,0x74,0xE4DFE1,WINDOW_HEADER,0); |
166 | DefineAndDrawWindow(screen.width-600/2,80,630,404+skin_height,0x74,0xE4DFE1,WINDOW_HEADER,0); |
167 | GetProcessInfo(#Form, SelfInfo); |
167 | GetProcessInfo(#Form, SelfInfo); |
168 | IF (Form.status_window>=2) return; |
168 | IF (Form.status_window>=2) return; |
169 | DrawWindowContent(); |
169 | DrawWindowContent(); |
170 | } |
170 | } |
171 | 171 | ||
172 | void DrawWindowContent() |
172 | void DrawWindowContent() |
173 | { |
173 | { |
174 | int id; |
174 | int id; |
175 | incn y; |
175 | incn y; |
176 | int list_w; |
176 | int list_w; |
177 | 177 | ||
178 | if (tabs.active_tab == SKINS) list_w=250; else list_w=370; |
178 | if (tabs.active_tab == SKINS) list_w=250; else list_w=370; |
179 | 179 | ||
180 | DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, LP, system.color.work); |
180 | DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, LP, system.color.work); |
181 | 181 | ||
182 | tabs.w = Form.cwidth-LP-LP; |
182 | tabs.w = Form.cwidth-LP-LP; |
183 | tabs.h = Form.cheight-LP-LP; |
183 | tabs.h = Form.cheight-LP-LP; |
184 | tabs.draw_wrapper(); |
184 | tabs.draw_wrapper(); |
185 | 185 | ||
186 | tabs.draw_button(tabs.x+TAB_PADDING, SKINS, T_SKINS); |
186 | tabs.draw_button(tabs.x+TAB_PADDING, SKINS, T_SKINS); |
187 | tabs.draw_button(strlen(T_SKINS)*8+tabs.x+TAB_PADDING+TAB_PADDING, WALLPAPERS, T_WALLPAPERS); |
187 | tabs.draw_button(strlen(T_SKINS)*8+tabs.x+TAB_PADDING+TAB_PADDING, WALLPAPERS, T_WALLPAPERS); |
188 | 188 | ||
189 | id = select_list.cur_y; |
189 | id = select_list.cur_y; |
190 | SelectList_Init( |
190 | SelectList_Init( |
191 | tabs.x+TAB_PADDING, |
191 | tabs.x+TAB_PADDING, |
192 | tabs.y+TAB_HEIGHT+TAB_PADDING, |
192 | tabs.y+TAB_HEIGHT+TAB_PADDING, |
193 | list_w, |
193 | list_w, |
194 | tabs.h - TAB_PADDING - TAB_PADDING - TAB_HEIGHT, |
194 | tabs.h - TAB_PADDING - TAB_PADDING - TAB_HEIGHT, |
195 | false |
195 | false |
196 | ); |
196 | ); |
197 | select_list.cur_y = id; |
197 | select_list.cur_y = id; |
198 | 198 | ||
199 | skp.set_size( |
199 | skp.set_size( |
200 | select_list.x + select_list.w + TAB_PADDING + scroll1.size_x + 20, |
200 | select_list.x + select_list.w + TAB_PADDING + scroll1.size_x + 20, |
201 | select_list.y + 30, |
201 | select_list.y + 30, |
202 | list_w, |
202 | list_w, |
203 | select_list.h - 50 |
203 | select_list.h - 50 |
204 | ); |
204 | ); |
205 | 205 | ||
206 | SelectList_Draw(); |
206 | SelectList_Draw(); |
207 | SelectList_DrawBorder(); |
207 | SelectList_DrawBorder(); |
208 | 208 | ||
209 | if (tabs.active_tab == SKINS) |
209 | if (tabs.active_tab == SKINS) |
210 | { |
210 | { |
211 | DrawBar(skp.x-20, select_list.y, skp.w+40, select_list.h, system.color.work); |
211 | DrawBar(skp.x-20, select_list.y, skp.w+40, select_list.h, system.color.work); |
212 | DrawRectangle(skp.x-20, select_list.y, skp.w+40, select_list.h, system.color.work_graph); |
212 | DrawRectangle(skp.x-20, select_list.y, skp.w+40, select_list.h, system.color.work_graph); |
213 | y.n = skp.y; |
213 | y.n = skp.y; |
214 | DrawFrame(skp.x, skp.y, skp.w, skp.h, " Components Preview "); |
214 | DrawFrame(skp.x, skp.y, skp.w, skp.h, " Components Preview "); |
215 | checkbox1.draw(skp.x+20, y.inc(30)); |
215 | checkbox1.draw(skp.x+20, y.inc(30)); |
216 | spinbox1.draw(skp.x+20, y.inc(30)); |
216 | spinbox1.draw(skp.x+20, y.inc(30)); |
217 | WriteText(skp.x+20, y.inc(30), 0x90, system.color.work_text, "C-- Edit"); |
217 | WriteText(skp.x+20, y.inc(30), 0x90, system.color.work_text, "C-- Edit"); |
218 | DrawEditBoxPos(skp.x+20, y.inc(20), #edit_cmm); |
218 | DrawEditBoxPos(skp.x+20, y.inc(20), #edit_cmm); |
219 | WriteText(skp.x+20, y.inc(35), 0x90, system.color.work_text, "Strandard Edit"); |
219 | WriteText(skp.x+20, y.inc(35), 0x90, system.color.work_text, "Strandard Edit"); |
220 | DrawStEditBoxPos(skp.x+20, y.inc(20), #edit_st); |
220 | DrawStEditBoxPos(skp.x+20, y.inc(20), #edit_st); |
221 | DrawStandartCaptButton(skp.x+20, skp.y+skp.h-40, GetFreeButtonId(), "Button1"); |
221 | DrawStandartCaptButton(skp.x+20, skp.y+skp.h-40, GetFreeButtonId(), "Button1"); |
222 | DrawStandartCaptButton(skp.x+120, skp.y+skp.h-40, GetFreeButtonId(), "Button2"); |
222 | DrawStandartCaptButton(skp.x+120, skp.y+skp.h-40, GetFreeButtonId(), "Button2"); |
223 | } |
223 | } |
224 | if (tabs.active_tab == WALLPAPERS) |
224 | if (tabs.active_tab == WALLPAPERS) |
225 | { |
225 | { |
226 | DrawStandartCaptButton(skp.x, select_list.y, BTN_SELECT_WALLP_FOLDER, T_SELECT_FOLDER); |
226 | DrawStandartCaptButton(skp.x, select_list.y, BTN_SELECT_WALLP_FOLDER, T_SELECT_FOLDER); |
227 | } |
227 | } |
228 | } |
228 | } |
229 | 229 | ||
230 | :void DrawStEditBoxPos(dword x,y, edit_box_pointer) |
230 | :void DrawStEditBoxPos(dword x,y, edit_box_pointer) |
231 | { |
231 | { |
232 | dword c_inactive = MixColors(system.color.work_graph, system.color.work, 128); |
232 | dword c_inactive = MixColors(system.color.work_graph, system.color.work, 128); |
233 | dword c_active = MixColors(system.color.work_graph, 0, 128); |
233 | dword c_active = MixColors(system.color.work_graph, 0, 128); |
234 | ESI = edit_box_pointer; |
234 | ESI = edit_box_pointer; |
235 | ESI.edit_box.left = x; |
235 | ESI.edit_box.left = x; |
236 | ESI.edit_box.top = y; |
236 | ESI.edit_box.top = y; |
237 | ESI.edit_box.blur_border_color = c_inactive; |
237 | ESI.edit_box.blur_border_color = c_inactive; |
238 | ESI.edit_box.focus_border_color = c_active; |
238 | ESI.edit_box.focus_border_color = c_active; |
239 | edit_box_draw stdcall (edit_box_pointer); |
239 | edit_box_draw stdcall (edit_box_pointer); |
240 | } |
240 | } |
241 | 241 | ||
242 | 242 | ||
243 | 243 | ||
244 | void Open_Dir() |
244 | void Open_Dir() |
245 | { |
245 | { |
246 | int j; |
246 | int j; |
247 | select_list.count = 0; |
247 | select_list.count = 0; |
248 | if(io.dir.buffer)free(io.dir.buffer); |
248 | if(io.dir.buffer)free(io.dir.buffer); |
249 | io.dir.load(#folder_path,DIR_ONLYREAL); |
249 | io.dir.load(#folder_path,DIR_ONLYREAL); |
250 | for (j=0; j |
250 | for (j=0; j |
251 | { |
251 | { |
252 | strcpy(#temp_filename, io.dir.position(j)); |
252 | strcpy(#temp_filename, io.dir.position(j)); |
253 | strlwr(#temp_filename); |
253 | strlwr(#temp_filename); |
254 | if (tabs.active_tab==SKINS) { |
254 | if (tabs.active_tab==SKINS) { |
255 | if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue; |
255 | if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue; |
256 | } |
256 | } |
257 | if (tabs.active_tab==WALLPAPERS) { |
257 | if (tabs.active_tab==WALLPAPERS) { |
258 | if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".png")!=0) |
258 | if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".png")!=0) |
259 | && (strcmpi(#temp_filename+strlen(#temp_filename)-4,".jpg")!=0) |
259 | && (strcmpi(#temp_filename+strlen(#temp_filename)-4,".jpg")!=0) |
260 | && (strcmpi(#temp_filename+strlen(#temp_filename)-5,".jpeg")!=0) |
260 | && (strcmpi(#temp_filename+strlen(#temp_filename)-5,".jpeg")!=0) |
261 | && (strcmpi(#temp_filename+strlen(#temp_filename)-4,".gif")!=0) continue; |
261 | && (strcmpi(#temp_filename+strlen(#temp_filename)-4,".gif")!=0) continue; |
262 | } |
262 | } |
263 | cur = select_list.count; |
263 | cur = select_list.count; |
264 | files_mas[cur]=j; |
264 | files_mas[cur]=j; |
265 | if (!strcmpi("default.skn",#temp_filename)) files_mas[0]> |
265 | if (!strcmpi("default.skn",#temp_filename)) files_mas[0]> |
266 | select_list.count++; |
266 | select_list.count++; |
267 | } |
267 | } |
268 | } |
268 | } |
269 | 269 | ||
270 | void SelectList_DrawLine(dword i) |
270 | void SelectList_DrawLine(dword i) |
271 | { |
271 | { |
272 | int yyy, list_last; |
272 | int yyy, list_last; |
273 | 273 | ||
274 | cur = select_list.first + i; |
274 | cur = select_list.first + i; |
275 | strcpy(#temp_filename, io.dir.position(files_mas[cur])); |
275 | strcpy(#temp_filename, io.dir.position(files_mas[cur])); |
276 | temp_filename[strlen(#temp_filename)-4] = 0; |
276 | temp_filename[strlen(#temp_filename)-4] = 0; |
277 | yyy = i*select_list.item_h+select_list.y; |
277 | yyy = i*select_list.item_h+select_list.y; |
278 | 278 | ||
279 | if (select_list.cur_y-select_list.first==i) |
279 | if (select_list.cur_y-select_list.first==i) |
280 | { |
280 | { |
281 | DrawBar(select_list.x, yyy, select_list.w, select_list.item_h, system.color.work_button); |
281 | DrawBar(select_list.x, yyy, select_list.w, select_list.item_h, system.color.work_button); |
282 | WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,system.color.work_button_text, #temp_filename); |
282 | WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,system.color.work_button_text, #temp_filename); |
283 | } |
283 | } |
284 | else |
284 | else |
285 | { |
285 | { |
286 | DrawBar(select_list.x,yyy,select_list.w, select_list.item_h, 0xFFFfff); |
286 | 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); |
287 | WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,0, #temp_filename); |
288 | } |
288 | } |
289 | } |
289 | } |
290 | 290 | ||
291 | void SelectList_LineChanged() |
291 | void SelectList_LineChanged() |
292 | { |
292 | { |
293 | EventApply(); |
293 | EventApply(); |
294 | } |
294 | } |
295 | 295 | ||
296 | //===================================================// |
296 | //===================================================// |
297 | // // |
297 | // // |
298 | // EVENTS // |
298 | // EVENTS // |
299 | // // |
299 | // // |
300 | //===================================================// |
300 | //===================================================// |
301 | 301 | ||
302 | void EventTabClick(int N) |
302 | void EventTabClick(int N) |
303 | { |
303 | { |
304 | tabs.click(N); |
304 | tabs.click(N); |
305 | if (tabs.active_tab == SKINS) |
305 | if (tabs.active_tab == SKINS) |
306 | { |
306 | { |
307 | active_wallpaper = select_list.cur_y; |
307 | active_wallpaper = select_list.cur_y; |
308 | strcpy(#folder_path, #skins_folder_path); |
308 | strcpy(#folder_path, #skins_folder_path); |
309 | select_list.ClearList(); |
309 | select_list.ClearList(); |
310 | Open_Dir(); |
310 | Open_Dir(); |
311 | if (!select_list.count) notify("'No skins were found' -E"); |
311 | if (!select_list.count) notify("'No skins were found' -E"); |
312 | select_list.cur_y = active_skin; |
312 | select_list.cur_y = active_skin; |
313 | } |
313 | } |
314 | if (tabs.active_tab == WALLPAPERS) |
314 | if (tabs.active_tab == WALLPAPERS) |
315 | { |
315 | { |
316 | active_skin = select_list.cur_y; |
316 | active_skin = select_list.cur_y; |
317 | strcpy(#folder_path, #wallp_folder_path); |
317 | strcpy(#folder_path, #wallp_folder_path); |
318 | select_list.ClearList(); |
318 | select_list.ClearList(); |
319 | Open_Dir(); |
319 | Open_Dir(); |
320 | if (!select_list.count) notify("'No wallpapers were found' -E"); |
320 | if (!select_list.count) notify("'No wallpapers were found' -E"); |
321 | select_list.cur_y = active_wallpaper; |
321 | select_list.cur_y = active_wallpaper; |
322 | } |
322 | } |
323 | if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; select_list.CheckDoesValuesOkey(); |
323 | if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; select_list.CheckDoesValuesOkey(); |
324 | if (select_list.w) DrawWindowContent(); |
324 | if (select_list.w) DrawWindowContent(); |
325 | } |
325 | } |
326 | 326 | ||
327 | void EventDeleteFile() |
327 | void EventDeleteFile() |
328 | { |
328 | { |
329 | io.del(#cur_file_path); |
329 | io.del(#cur_file_path); |
330 | Open_Dir(); |
330 | Open_Dir(); |
331 | EventApply(); |
331 | EventApply(); |
332 | } |
332 | } |
333 | 333 | ||
334 | void EventSetNewCurrent() |
334 | void EventSetNewCurrent() |
335 | { |
335 | { |
336 | cur = select_list.cur_y; |
336 | cur = select_list.cur_y; |
337 | sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur])); |
337 | sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur])); |
338 | } |
338 | } |
339 | 339 | ||
340 | void EventSelectWallpFolder() |
340 | void EventSelectWallpFolder() |
341 | { |
341 | { |
342 | OpenDialog_start stdcall (#o_dialog); |
342 | OpenDialog_start stdcall (#o_dialog); |
343 | if (o_dialog.status) { |
343 | if (o_dialog.status) { |
344 | strcpy(#wallp_folder_path, #opendir_path); |
344 | strcpy(#wallp_folder_path, #opendir_path); |
345 | EventTabClick(WALLPAPERS); |
345 | EventTabClick(WALLPAPERS); |
346 | } |
346 | } |
347 | } |
347 | } |
348 | 348 | ||
349 | void EventApply() |
349 | void EventApply() |
350 | { |
350 | { |
351 | char kivpath[4096+10]; |
351 | char kivpath[4096+10]; |
352 | EventSetNewCurrent(); |
352 | EventSetNewCurrent(); |
353 | if (tabs.active_tab==SKINS) |
353 | if (tabs.active_tab==SKINS) |
354 | { |
354 | { |
355 | cur = select_list.cur_y; |
355 | cur = select_list.cur_y; |
356 | SetSystemSkin(#cur_file_path); |
356 | SetSystemSkin(#cur_file_path); |
357 | } |
357 | } |
358 | if (tabs.active_tab==WALLPAPERS) |
358 | if (tabs.active_tab==WALLPAPERS) |
359 | { |
359 | { |
360 | strcpy(#kivpath, "\\S__"); |
360 | strcpy(#kivpath, "\\S__"); |
361 | strcat(#kivpath, #cur_file_path); |
361 | strcat(#kivpath, #cur_file_path); |
362 | RunProgram("/sys/media/kiv", #kivpath); |
362 | RunProgram("/sys/media/kiv", #kivpath); |
363 | SelectList_Draw(); |
363 | SelectList_Draw(); |
364 | } |
364 | } |
365 | } |
365 | } |
366 | 366 | ||
367 | void EventOpenFile() |
367 | void EventOpenFile() |
368 | { |
368 | { |
369 | if (tabs.active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path); |
369 | if (tabs.active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path); |
370 | if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path); |
370 | if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path); |
371 | } |
371 | } |
372 | 372 | ||
373 | stop: |
373 | stop: |
374 | >><> |
374 | >><> |