Rev 7816 | Rev 7878 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7816 | Rev 7819 | ||
---|---|---|---|
1 | //Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2020 |
1 | //Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2020 |
2 | //GNU GPL license. |
2 | //GNU GPL license. |
3 | 3 | ||
4 | // 70.5 - get volume info and label |
4 | // 70.5 - get volume info and label |
5 | 5 | ||
6 | #ifndef AUTOBUILD |
6 | #ifndef AUTOBUILD |
7 | #include "lang.h--" |
7 | #include "lang.h--" |
8 | #endif |
8 | #endif |
9 | 9 | ||
10 | //libraries |
10 | //libraries |
11 | #define MEMSIZE 1024 * 720 |
11 | #define MEMSIZE 1024 * 720 |
12 | #include "../lib/clipboard.h" |
12 | #include "../lib/clipboard.h" |
13 | #include "../lib/strings.h" |
13 | #include "../lib/strings.h" |
14 | #include "../lib/mem.h" |
14 | #include "../lib/mem.h" |
15 | #include "../lib/fs.h" |
15 | #include "../lib/fs.h" |
16 | #include "../lib/gui.h" |
16 | #include "../lib/gui.h" |
17 | #include "../lib/list_box.h" |
17 | #include "../lib/list_box.h" |
18 | #include "../lib/random.h" |
18 | #include "../lib/random.h" |
19 | #include "../lib/kfont.h" |
19 | #include "../lib/kfont.h" |
20 | #include "../lib/collection.h" |
20 | #include "../lib/collection.h" |
21 | #include "../lib/copyf.h" |
21 | #include "../lib/copyf.h" |
22 | 22 | ||
23 | #include "../lib/obj/libini.h" |
23 | #include "../lib/obj/libini.h" |
24 | #include "../lib/obj/box_lib.h" |
24 | #include "../lib/obj/box_lib.h" |
25 | #include "../lib/obj/libimg.h" |
25 | #include "../lib/obj/libimg.h" |
26 | 26 | ||
27 | #include "../lib/patterns/history.h" |
27 | #include "../lib/patterns/history.h" |
28 | 28 | ||
29 | #include "imgs/images.h" |
29 | #include "imgs/images.h" |
30 | 30 | ||
31 | //Button IDs |
31 | //Button IDs |
32 | enum { |
32 | enum { |
33 | PATH_BTN = 10, |
33 | PATH_BTN = 10, |
34 | POPUP_BTN1 = 201, |
34 | POPUP_BTN1 = 201, |
35 | POPUP_BTN2 = 202, |
35 | POPUP_BTN2 = 202, |
36 | BREADCRUMB_ID = 300 |
36 | BREADCRUMB_ID = 300 |
37 | }; |
37 | }; |
38 | 38 | ||
39 | //NewElement options |
39 | //NewElement options |
40 | enum { |
40 | enum { |
41 | CREATE_FILE=1, |
41 | CREATE_FILE=1, |
42 | CREATE_FOLDER, |
42 | CREATE_FOLDER, |
43 | RENAME_ITEM |
43 | RENAME_ITEM |
44 | }; |
44 | }; |
45 | 45 | ||
46 | //OpenDir options |
46 | //OpenDir options |
47 | enum { |
47 | enum { |
48 | ONLY_SHOW, |
48 | ONLY_SHOW, |
49 | WITH_REDRAW, |
49 | WITH_REDRAW, |
50 | ONLY_OPEN |
50 | ONLY_OPEN |
51 | }; |
51 | }; |
52 | 52 | ||
53 | _history history; |
53 | _history history; |
54 | 54 | ||
55 | struct Eolite_colors |
55 | struct Eolite_colors |
56 | { |
56 | { |
57 | bool def; |
57 | bool def; |
58 | dword lpanel; |
58 | dword lpanel; |
59 | dword list_vert_line; //vertical line between columns in list |
59 | dword list_vert_line; //vertical line between columns in list |
60 | dword selec; |
60 | dword selec; |
61 | dword selec_active; |
61 | dword selec_active; |
62 | dword selec_inactive; |
62 | dword selec_inactive; |
63 | dword selec_text; |
63 | dword selec_text; |
64 | dword work; |
- | |
65 | dword graph; |
- | |
66 | dword list_bg; |
64 | dword list_bg; |
67 | dword list_gb_text; |
65 | dword list_gb_text; |
68 | dword list_text_hidden; |
66 | dword list_text_hidden; |
69 | dword work_gradient[24]; |
67 | dword work_gradient[24]; |
70 | dword slider_bg_big; |
68 | dword slider_bg_big; |
71 | dword slider_bg_left; |
69 | dword slider_bg_left; |
72 | dword odd_line; |
70 | dword odd_line; |
73 | } col; |
71 | } col; |
74 | 72 | ||
75 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
73 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
76 | 74 | ||
77 | bool active_about = false; |
75 | bool active_about = false; |
78 | bool active_settings = false; |
76 | bool active_settings = false; |
79 | bool _not_draw = false; |
77 | bool _not_draw = false; |
80 | bool exif_load = false; |
78 | bool exif_load = false; |
81 | bool dir_at_fat16 = NULL; |
79 | bool dir_at_fat16 = NULL; |
82 | 80 | ||
83 | word about_thread_id; |
81 | word about_thread_id; |
84 | word settings_window; |
82 | word settings_window; |
85 | 83 | ||
86 | byte del_active=0; |
84 | byte del_active=0; |
87 | byte new_element_active=0; |
85 | byte new_element_active=0; |
88 | 86 | ||
89 | llist files, files_active, files_inactive; |
87 | llist files, files_active, files_inactive; |
90 | 88 | ||
91 | byte list_full_redraw; |
89 | byte list_full_redraw; |
92 | 90 | ||
93 | dword buf; |
91 | dword buf; |
94 | dword file_mas[6898]; |
92 | dword file_mas[6898]; |
95 | int selected_count; |
93 | int selected_count; |
96 | int count_dir; |
94 | int count_dir; |
97 | 95 | ||
98 | byte path[4096]; |
96 | byte path[4096]; |
99 | byte file_path[4096]; |
97 | byte file_path[4096]; |
100 | byte file_name[256]; |
98 | byte file_name[256]; |
101 | byte new_element_name[256]; |
99 | byte new_element_name[256]; |
102 | byte temp[4096]; |
100 | byte temp[4096]; |
103 | bool itdir; |
101 | bool itdir; |
104 | 102 | ||
105 | char active_path[4096], inactive_path[4096]; |
103 | char active_path[4096], inactive_path[4096]; |
106 | 104 | ||
107 | dword eolite_ini_path[4096]; |
105 | dword eolite_ini_path[4096]; |
108 | _ini ini; |
106 | _ini ini; |
109 | 107 | ||
110 | char scroll_used=false; |
108 | char scroll_used=false; |
111 | 109 | ||
112 | dword about_stak,properties_stak,settings_stak,copy_stak,delete_stak; |
110 | dword about_stak,properties_stak,settings_stak,copy_stak,delete_stak; |
113 | 111 | ||
114 | proc_info Form; |
112 | proc_info Form; |
115 | int sc_slider_h; |
113 | int sc_slider_h; |
116 | int action_buf; |
114 | int action_buf; |
117 | int rand_n; |
115 | int rand_n; |
118 | 116 | ||
119 | char sort_type=2; |
117 | char sort_type=2; |
120 | bool sort_desc=false; |
118 | bool sort_desc=false; |
121 | int active_panel=1; |
119 | int active_panel=1; |
122 | 120 | ||
123 | libimg_image icons16_default; |
121 | libimg_image icons16_default; |
124 | libimg_image icons16_selected; |
122 | libimg_image icons16_selected; |
125 | 123 | ||
126 | libimg_image icons32_default; |
124 | libimg_image icons32_default; |
127 | libimg_image icons32_selected; |
125 | libimg_image icons32_selected; |
128 | 126 | ||
129 | #define STATUS_BAR_H 16; |
127 | #define STATUS_BAR_H 16; |
130 | int status_bar_h = 0; |
128 | int status_bar_h = 0; |
131 | 129 | ||
132 | int icon_size = 16; |
130 | int icon_size = 16; |
133 | 131 | ||
134 | edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000, |
132 | edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000, |
135 | 248,#new_element_name,0,100000000000010b,6,0}; |
133 | 248,#new_element_name,0,100000000000010b,6,0}; |
136 | PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
134 | PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
137 | byte cmd_free=0; |
135 | byte cmd_free=0; |
138 | #include "include\translations.h" |
136 | #include "include\translations.h" |
139 | 137 | ||
140 | #include "include\gui.h" |
138 | #include "include\gui.h" |
141 | #include "include\settings.h" |
139 | #include "include\settings.h" |
142 | #include "include\progress_dialog.h" |
140 | #include "include\progress_dialog.h" |
143 | #include "include\copy.h" |
141 | #include "include\copy.h" |
144 | #include "include\sorting.h" |
142 | #include "include\sorting.h" |
145 | #include "include\icons.h" |
143 | #include "include\icons.h" |
146 | #include "include\left_panel.h" |
144 | #include "include\left_panel.h" |
147 | #include "include\menu.h" |
145 | #include "include\menu.h" |
148 | #include "include\delete.h" |
146 | #include "include\delete.h" |
149 | #include "include\about.h" |
147 | #include "include\about.h" |
150 | #include "include\properties.h" |
148 | #include "include\properties.h" |
151 | #include "include\breadcrumbs.h" |
149 | #include "include\breadcrumbs.h" |
152 | 150 | ||
153 | void load_libraries() |
151 | void load_libraries() |
154 | { |
152 | { |
155 | load_dll(boxlib, #box_lib_init,0); |
153 | load_dll(boxlib, #box_lib_init,0); |
156 | load_dll(libini, #lib_init,1); |
154 | load_dll(libini, #lib_init,1); |
157 | load_dll(libio, #libio_init,1); |
155 | load_dll(libio, #libio_init,1); |
158 | load_dll(libimg, #libimg_init,1); |
156 | load_dll(libimg, #libimg_init,1); |
159 | } |
157 | } |
160 | 158 | ||
161 | void main() |
159 | void main() |
162 | { |
160 | { |
163 | dword id; |
161 | dword id; |
164 | byte count_sl = 0; |
162 | byte count_sl = 0; |
165 | 163 | ||
166 | rand_n = random(80); |
164 | rand_n = random(80); |
167 | 165 | ||
168 | load_libraries(); |
166 | load_libraries(); |
169 | 167 | ||
170 | SetAppColors(); |
168 | SetAppColors(); |
171 | LoadIniSettings(); |
169 | LoadIniSettings(); |
172 | SystemDiscs.Get(); |
170 | SystemDiscs.Get(); |
173 | 171 | ||
174 | //-p just show file/folder properties dialog |
172 | //-p just show file/folder properties dialog |
175 | if (param) && (param[0]=='-') && (param[1]=='p') |
173 | if (param) && (param[0]=='-') && (param[1]=='p') |
176 | { |
174 | { |
177 | strcpy(#file_path, #param + 3); |
175 | strcpy(#file_path, #param + 3); |
178 | strcpy(#file_name, #param + strrchr(#param, '/')); |
176 | strcpy(#file_name, #param + strrchr(#param, '/')); |
179 | properties_dialog(); |
177 | properties_dialog(); |
180 | ExitProcess(); |
178 | ExitProcess(); |
181 | } |
179 | } |
182 | 180 | ||
183 | ESBYTE[0] = NULL; |
181 | ESBYTE[0] = NULL; |
184 | 182 | ||
185 | if (param) |
183 | if (param) |
186 | { |
184 | { |
187 | if (strlen(#param)>1) && (param[strlen(#param)-1]=='/') param[strlen(#param)-1]=NULL; //no "/" at the end |
185 | if (strlen(#param)>1) && (param[strlen(#param)-1]=='/') param[strlen(#param)-1]=NULL; //no "/" at the end |
188 | 186 | ||
189 | if (dir_exists(#param)) { |
187 | if (dir_exists(#param)) { |
190 | strcpy(#path, #param); |
188 | strcpy(#path, #param); |
191 | } else { |
189 | } else { |
192 | notify(T_NOTIFY_APP_PARAM_WRONG); |
190 | notify(T_NOTIFY_APP_PARAM_WRONG); |
193 | } |
191 | } |
194 | } |
192 | } |
195 | 193 | ||
196 | Open_Dir(#path,ONLY_OPEN); |
194 | Open_Dir(#path,ONLY_OPEN); |
197 | strcpy(#inactive_path, #path); |
195 | strcpy(#inactive_path, #path); |
198 | llist_copy(#files_inactive, #files); |
196 | llist_copy(#files_inactive, #files); |
199 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
197 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
200 | loop() switch(WaitEventTimeout(50)) |
198 | loop() switch(WaitEventTimeout(50)) |
201 | { |
199 | { |
202 | case evMouse: |
200 | case evMouse: |
203 | if (del_active) || (Form.status_window>2) break; |
201 | if (del_active) || (Form.status_window>2) break; |
204 | if (new_element_active) |
202 | if (new_element_active) |
205 | { |
203 | { |
206 | edit_box_mouse stdcall(#new_file_ed); |
204 | edit_box_mouse stdcall(#new_file_ed); |
207 | break; |
205 | break; |
208 | } |
206 | } |
209 | 207 | ||
210 | mouse.get(); |
208 | mouse.get(); |
211 | 209 | ||
212 | ProceedMouseGestures(); |
210 | ProceedMouseGestures(); |
213 | 211 | ||
214 | if (files.MouseOver(mouse.x, mouse.y)) |
212 | if (files.MouseOver(mouse.x, mouse.y)) |
215 | { |
213 | { |
216 | //select file |
214 | //select file |
217 | if (mouse.key&MOUSE_LEFT) && (mouse.up) |
215 | if (mouse.key&MOUSE_LEFT) && (mouse.up) |
218 | { |
216 | { |
219 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); else { |
217 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); else { |
220 | if (mouse.y - files.y / files.item_h + files.first == files.cur_y) Open(0); |
218 | if (mouse.y - files.y / files.item_h + files.first == files.cur_y) Open(0); |
221 | } |
219 | } |
222 | } |
220 | } |
223 | //file menu |
221 | //file menu |
224 | if (mouse.key&MOUSE_RIGHT) && (mouse.up) |
222 | if (mouse.key&MOUSE_RIGHT) && (mouse.up) |
225 | { |
223 | { |
226 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
224 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
227 | if (getElementSelectedFlag(files.cur_y) == false) selected_count = 0; //on redraw selection would be flashed, see [L001] |
225 | if (getElementSelectedFlag(files.cur_y) == false) selected_count = 0; //on redraw selection would be flashed, see [L001] |
228 | EventShowListMenu(); |
226 | EventShowListMenu(); |
229 | break; |
227 | break; |
230 | } |
228 | } |
231 | } |
229 | } |
232 | 230 | ||
233 | if (mouse.vert) |
231 | if (mouse.vert) |
234 | { |
232 | { |
235 | if (files.MouseScroll(mouse.vert)) List_ReDraw(); |
233 | if (files.MouseScroll(mouse.vert)) List_ReDraw(); |
236 | break; |
234 | break; |
237 | } |
235 | } |
238 | 236 | ||
239 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y-17) && (mouse.y |
237 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y-17) && (mouse.y |
240 | { |
238 | { |
241 | if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_dark,sc.work_light); |
239 | if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_dark,sc.work_light); |
242 | WHILE (mouse.lkm) && (files.first>0) |
240 | WHILE (mouse.lkm) && (files.first>0) |
243 | { |
241 | { |
244 | pause(8); |
242 | pause(8); |
245 | files.first--; |
243 | files.first--; |
246 | List_ReDraw(); |
244 | List_ReDraw(); |
247 | mouse.get(); |
245 | mouse.get(); |
248 | } |
246 | } |
249 | DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_light,sc.work_dark); |
247 | DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_light,sc.work_dark); |
250 | } |
248 | } |
251 | 249 | ||
252 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y+files.h-16) && (mouse.y |
250 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y+files.h-16) && (mouse.y |
253 | { |
251 | { |
254 | if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_dark,sc.work_light); |
252 | if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_dark,sc.work_light); |
255 | while (mouse.lkm) && (files.first |
253 | while (mouse.lkm) && (files.first |
256 | { |
254 | { |
257 | pause(8); |
255 | pause(8); |
258 | files.first++; |
256 | files.first++; |
259 | List_ReDraw(); |
257 | List_ReDraw(); |
260 | mouse.get(); |
258 | mouse.get(); |
261 | } |
259 | } |
262 | DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_light,sc.work_dark); |
260 | DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_light,sc.work_dark); |
263 | } |
261 | } |
264 | 262 | ||
265 | //Scrooll |
263 | //Scrooll |
266 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) && (mouse.y |
264 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) && (mouse.y |
267 | if (scroll_used) && (mouse.up) { scroll_used=false; Scroll(); } |
265 | if (scroll_used) && (mouse.up) { scroll_used=false; Scroll(); } |
268 | 266 | ||
269 | if (scroll_used) |
267 | if (scroll_used) |
270 | { |
268 | { |
271 | if (sc_slider_h/2+files.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii |
269 | if (sc_slider_h/2+files.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii |
272 | id = files.first; |
270 | id = files.first; |
273 | files.first = -sc_slider_h / 2 + mouse.y -files.y * files.count; |
271 | files.first = -sc_slider_h / 2 + mouse.y -files.y * files.count; |
274 | files.first /= files.h - 18; |
272 | files.first /= files.h - 18; |
275 | if (files.visible+files.first>files.count) files.first=files.count-files.visible; |
273 | if (files.visible+files.first>files.count) files.first=files.count-files.visible; |
276 | if (files.first<0) files.first=0; |
274 | if (files.first<0) files.first=0; |
277 | if (id!=files.first) List_ReDraw(); |
275 | if (id!=files.first) List_ReDraw(); |
278 | break; |
276 | break; |
279 | } |
277 | } |
280 | 278 | ||
281 | if (two_panels.checked) && (mouse.y > files.y) && (mouse.down) { |
279 | if (two_panels.checked) && (mouse.y > files.y) && (mouse.down) { |
282 | if (mouse.x |
280 | if (mouse.x |
283 | { |
281 | { |
284 | if (active_panel!=1) |
282 | if (active_panel!=1) |
285 | { |
283 | { |
286 | active_panel = 1; |
284 | active_panel = 1; |
287 | ChangeActivePanel(); |
285 | ChangeActivePanel(); |
288 | } |
286 | } |
289 | } |
287 | } |
290 | else |
288 | else |
291 | { |
289 | { |
292 | if (active_panel!=2) |
290 | if (active_panel!=2) |
293 | { |
291 | { |
294 | active_panel = 2; |
292 | active_panel = 2; |
295 | ChangeActivePanel(); |
293 | ChangeActivePanel(); |
296 | } |
294 | } |
297 | } |
295 | } |
298 | } |
296 | } |
299 | break; |
297 | break; |
300 | //Button pressed----------------------------------------------------------------------------- |
298 | //Button pressed----------------------------------------------------------------------------- |
301 | case evButton: |
299 | case evButton: |
302 | id=GetButtonID(); |
300 | id=GetButtonID(); |
303 | 301 | ||
304 | if (new_element_active) || (del_active) { |
302 | if (new_element_active) || (del_active) { |
305 | if(POPUP_BTN1==id) || (POPUP_BTN2==id) { |
303 | if(POPUP_BTN1==id) || (POPUP_BTN2==id) { |
306 | if (del_active) Del_File(id-POPUP_BTN2); |
304 | if (del_active) Del_File(id-POPUP_BTN2); |
307 | if (new_element_active) NewElement(id-POPUP_BTN2); |
305 | if (new_element_active) NewElement(id-POPUP_BTN2); |
308 | DeleteButton(POPUP_BTN1); |
306 | DeleteButton(POPUP_BTN1); |
309 | DeleteButton(POPUP_BTN2); |
307 | DeleteButton(POPUP_BTN2); |
310 | } |
308 | } |
311 | break; |
309 | break; |
312 | } |
310 | } |
313 | 311 | ||
314 | switch(id) |
312 | switch(id) |
315 | { |
313 | { |
316 | case CLOSE_BTN: |
314 | case CLOSE_BTN: |
317 | KillProcess(about_thread_id); |
315 | KillProcess(about_thread_id); |
318 | SaveIniSettings(); |
316 | SaveIniSettings(); |
319 | ExitProcess(); |
317 | ExitProcess(); |
320 | case PATH_BTN: |
318 | case PATH_BTN: |
321 | notify(COPY_PATH_STR); |
319 | notify(COPY_PATH_STR); |
322 | Clipboard__CopyText(#path); |
320 | Clipboard__CopyText(#path); |
323 | break; |
321 | break; |
324 | case 21: //Back |
322 | case 21: //Back |
325 | EventHistoryGoBack(); |
323 | EventHistoryGoBack(); |
326 | break; |
324 | break; |
327 | case 22: //Forward |
325 | case 22: //Forward |
328 | EventHistoryGoForward(); |
326 | EventHistoryGoForward(); |
329 | break; |
327 | break; |
330 | case 23: |
328 | case 23: |
331 | Dir_Up(); |
329 | Dir_Up(); |
332 | break; |
330 | break; |
333 | case 24: |
331 | case 24: |
334 | Copy(#file_path, CUT); |
332 | Copy(#file_path, CUT); |
335 | break; |
333 | break; |
336 | case 25: |
334 | case 25: |
337 | Copy(#file_path, NOCUT); |
335 | Copy(#file_path, NOCUT); |
338 | break; |
336 | break; |
339 | case 26: |
337 | case 26: |
340 | Paste(); |
338 | Paste(); |
341 | break; |
339 | break; |
342 | case 31...33: |
340 | case 31...33: |
343 | EventSort(id-30); |
341 | EventSort(id-30); |
344 | break; |
342 | break; |
345 | case 51: |
343 | case 51: |
346 | EventShowBurgerMenu(); |
344 | EventShowBurgerMenu(); |
347 | break; |
345 | break; |
348 | case 52...60: //Actions |
346 | case 52...60: //Actions |
349 | FnProcess(id-50); |
347 | FnProcess(id-50); |
350 | break; |
348 | break; |
351 | case 61: // Set path as default |
349 | case 61: // Set path as default |
352 | SetDefaultPath(#path); |
350 | SetDefaultPath(#path); |
353 | break; |
351 | break; |
354 | case 100...120: |
352 | case 100...120: |
355 | SystemDiscs.Click(id-100); |
353 | SystemDiscs.Click(id-100); |
356 | break; |
354 | break; |
357 | case BREADCRUMB_ID...360: |
355 | case BREADCRUMB_ID...360: |
358 | ClickOnBreadCrumb(id-BREADCRUMB_ID); |
356 | ClickOnBreadCrumb(id-BREADCRUMB_ID); |
359 | break; |
357 | break; |
360 | } |
358 | } |
361 | break; |
359 | break; |
362 | 360 | ||
363 | //Key pressed----------------------------------------------------------------------------- |
361 | //Key pressed----------------------------------------------------------------------------- |
364 | case evKey: |
362 | case evKey: |
365 | GetKeys(); |
363 | GetKeys(); |
366 | 364 | ||
367 | if (Form.status_window>2) break; |
365 | if (Form.status_window>2) break; |
368 | 366 | ||
369 | if (new_element_active) || (del_active) |
367 | if (new_element_active) || (del_active) |
370 | { |
368 | { |
371 | if (del_active) |
369 | if (del_active) |
372 | { |
370 | { |
373 | if (key_scancode == SCAN_CODE_ENTER) Del_File(true); |
371 | if (key_scancode == SCAN_CODE_ENTER) Del_File(true); |
374 | if (key_scancode == SCAN_CODE_ESC) Del_File(false); |
372 | if (key_scancode == SCAN_CODE_ESC) Del_File(false); |
375 | } |
373 | } |
376 | if (new_element_active) |
374 | if (new_element_active) |
377 | { |
375 | { |
378 | if (key_scancode == SCAN_CODE_ENTER) NewElement(true); |
376 | if (key_scancode == SCAN_CODE_ENTER) NewElement(true); |
379 | if (key_scancode == SCAN_CODE_ESC) NewElement(false); |
377 | if (key_scancode == SCAN_CODE_ESC) NewElement(false); |
380 | EAX = key_editbox; |
378 | EAX = key_editbox; |
381 | edit_box_key stdcall (#new_file_ed); |
379 | edit_box_key stdcall (#new_file_ed); |
382 | } |
380 | } |
383 | break; |
381 | break; |
384 | } |
382 | } |
385 | 383 | ||
386 | if (files.ProcessKey(key_scancode)) |
384 | if (files.ProcessKey(key_scancode)) |
387 | { |
385 | { |
388 | List_ReDraw(); |
386 | List_ReDraw(); |
389 | break; |
387 | break; |
390 | } |
388 | } |
391 | 389 | ||
392 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) |
390 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) |
393 | { |
391 | { |
394 | switch(key_scancode) |
392 | switch(key_scancode) |
395 | { |
393 | { |
396 | case SCAN_CODE_F1...SCAN_CODE_F3: |
394 | case SCAN_CODE_F1...SCAN_CODE_F3: |
397 | EventSort(key_scancode - 58); |
395 | EventSort(key_scancode - 58); |
398 | break; |
396 | break; |
399 | case SCAN_CODE_1...SCAN_CODE_10: |
397 | case SCAN_CODE_1...SCAN_CODE_10: |
400 | key_scancode-=2; |
398 | key_scancode-=2; |
401 | if (key_scancode >= SystemDiscs.list.count) break; |
399 | if (key_scancode >= SystemDiscs.list.count) break; |
402 | if (!two_panels.checked) |
400 | if (!two_panels.checked) |
403 | { |
401 | { |
404 | DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click |
402 | DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click |
405 | pause(7); |
403 | pause(7); |
406 | } |
404 | } |
407 | SystemDiscs.Click(key_scancode); |
405 | SystemDiscs.Click(key_scancode); |
408 | break; |
406 | break; |
409 | case SCAN_CODE_KEY_X: |
407 | case SCAN_CODE_KEY_X: |
410 | Copy(#file_path, CUT); |
408 | Copy(#file_path, CUT); |
411 | break; |
409 | break; |
412 | case SCAN_CODE_KEY_C: |
410 | case SCAN_CODE_KEY_C: |
413 | Copy(#file_path, NOCUT); |
411 | Copy(#file_path, NOCUT); |
414 | break; |
412 | break; |
415 | case SCAN_CODE_KEY_G: |
413 | case SCAN_CODE_KEY_G: |
416 | EventOpenConsoleHere(); |
414 | EventOpenConsoleHere(); |
417 | break; |
415 | break; |
418 | case SCAN_CODE_KEY_V: |
416 | case SCAN_CODE_KEY_V: |
419 | Paste(); |
417 | Paste(); |
420 | break; |
418 | break; |
421 | case SCAN_CODE_KEY_D: //set image as bg |
419 | case SCAN_CODE_KEY_D: //set image as bg |
422 | strlcpy(#temp, "\\S__",4); |
420 | strlcpy(#temp, "\\S__",4); |
423 | strcat(#temp, #file_path); |
421 | strcat(#temp, #file_path); |
424 | RunProgram("/sys/media/kiv", #temp); |
422 | RunProgram("/sys/media/kiv", #temp); |
425 | break; |
423 | break; |
426 | case SCAN_CODE_KEY_N: |
424 | case SCAN_CODE_KEY_N: |
427 | EventOpenNewEolite(); |
425 | EventOpenNewEolite(); |
428 | break; |
426 | break; |
429 | case SCAN_CODE_KEY_M: |
427 | case SCAN_CODE_KEY_M: |
430 | Open_Dir(#inactive_path,WITH_REDRAW); |
428 | Open_Dir(#inactive_path,WITH_REDRAW); |
431 | break; |
429 | break; |
432 | case SCAN_CODE_ENTER: |
430 | case SCAN_CODE_ENTER: |
433 | if (!itdir) ShowOpenWithDialog(); |
431 | if (!itdir) ShowOpenWithDialog(); |
434 | else Open(1); |
432 | else Open(1); |
435 | break; |
433 | break; |
436 | case SCAN_CODE_KEY_A: |
434 | case SCAN_CODE_KEY_A: |
437 | EventSelectAllFiles(true); |
435 | EventSelectAllFiles(true); |
438 | break; |
436 | break; |
439 | case SCAN_CODE_KEY_U: //unselect all files |
437 | case SCAN_CODE_KEY_U: //unselect all files |
440 | EventSelectAllFiles(false); |
438 | EventSelectAllFiles(false); |
441 | break; |
439 | break; |
442 | } |
440 | } |
443 | break; |
441 | break; |
444 | } |
442 | } |
445 | 443 | ||
446 | switch (key_scancode) |
444 | switch (key_scancode) |
447 | { |
445 | { |
448 | case SCAN_CODE_BS: |
446 | case SCAN_CODE_BS: |
449 | //EventHistoryGoBack(); |
447 | //EventHistoryGoBack(); |
450 | Dir_Up(); |
448 | Dir_Up(); |
451 | break; |
449 | break; |
452 | case SCAN_CODE_ENTER: |
450 | case SCAN_CODE_ENTER: |
453 | Open(0); |
451 | Open(0); |
454 | break; |
452 | break; |
455 | case SCAN_CODE_TAB: |
453 | case SCAN_CODE_TAB: |
456 | if (!two_panels.checked) break; |
454 | if (!two_panels.checked) break; |
457 | if (active_panel==1) active_panel=2; else active_panel=1; |
455 | if (active_panel==1) active_panel=2; else active_panel=1; |
458 | ChangeActivePanel(); |
456 | ChangeActivePanel(); |
459 | DrawFilePanels(); |
457 | DrawFilePanels(); |
460 | break; |
458 | break; |
461 | case SCAN_CODE_MENU: |
459 | case SCAN_CODE_MENU: |
462 | mouse.x = files.x+15; |
460 | mouse.x = files.x+15; |
463 | mouse.y = files.cur_y - files.first * files.item_h + files.y + 5; |
461 | mouse.y = files.cur_y - files.first * files.item_h + files.y + 5; |
464 | EventShowListMenu(); |
462 | EventShowListMenu(); |
465 | break; |
463 | break; |
466 | case SCAN_CODE_DEL: |
464 | case SCAN_CODE_DEL: |
467 | Del_Form(); |
465 | Del_Form(); |
468 | break; |
466 | break; |
469 | case SCAN_CODE_INS: |
467 | case SCAN_CODE_INS: |
470 | if (getElementSelectedFlag(files.cur_y) == true) setElementSelectedFlag(files.cur_y, false); |
468 | if (getElementSelectedFlag(files.cur_y) == true) setElementSelectedFlag(files.cur_y, false); |
471 | else setElementSelectedFlag(files.cur_y, true); |
469 | else setElementSelectedFlag(files.cur_y, true); |
472 | files.KeyDown(); |
470 | files.KeyDown(); |
473 | List_ReDraw(); |
471 | List_ReDraw(); |
474 | DrawStatusBar(); |
472 | DrawStatusBar(); |
475 | break; |
473 | break; |
476 | case SCAN_CODE_F1...SCAN_CODE_F10: |
474 | case SCAN_CODE_F1...SCAN_CODE_F10: |
477 | FnProcess(key_scancode-58); |
475 | FnProcess(key_scancode-58); |
478 | break; |
476 | break; |
479 | default: |
477 | default: |
480 | EventSelectFileByKeyPress(); |
478 | EventSelectFileByKeyPress(); |
481 | } |
479 | } |
482 | break; |
480 | break; |
483 | case evIPC: |
481 | case evIPC: |
484 | case evReDraw: |
482 | case evReDraw: |
485 | draw_window(); |
483 | draw_window(); |
486 | if (CheckActiveProcess(Form.ID)) && (GetMenuClick()) break; |
484 | if (CheckActiveProcess(Form.ID)) && (GetMenuClick()) break; |
487 | if (action_buf==OPERATION_END) |
485 | if (action_buf==OPERATION_END) |
488 | { |
486 | { |
489 | FnProcess(5); |
487 | FnProcess(5); |
490 | if (copy_stak) SelectFileByName(#copy_to+strrchr(#copy_to,'/')); |
488 | if (copy_stak) SelectFileByName(#copy_to+strrchr(#copy_to,'/')); |
491 | action_buf=0; |
489 | action_buf=0; |
492 | } |
490 | } |
493 | break; |
491 | break; |
494 | default: |
492 | default: |
495 | if (Form.status_window>2) break; |
493 | if (Form.status_window>2) break; |
496 | EventRefreshDisksAndFolders(); |
494 | EventRefreshDisksAndFolders(); |
497 | } |
495 | } |
498 | 496 | ||
499 | if(cmd_free) |
497 | if(cmd_free) |
500 | { |
498 | { |
501 | if(cmd_free==2) about_stak=free(about_stak); |
499 | if(cmd_free==2) about_stak=free(about_stak); |
502 | else if(cmd_free==3) properties_stak=free(properties_stak); |
500 | else if(cmd_free==3) properties_stak=free(properties_stak); |
503 | else if(cmd_free==4) settings_stak=free(settings_stak); |
501 | else if(cmd_free==4) settings_stak=free(settings_stak); |
504 | else if(cmd_free==5) copy_stak=free(copy_stak); |
502 | else if(cmd_free==5) copy_stak=free(copy_stak); |
505 | else if(cmd_free==6) delete_stak=free(delete_stak); |
503 | else if(cmd_free==6) delete_stak=free(delete_stak); |
506 | cmd_free = false; |
504 | cmd_free = false; |
507 | } |
505 | } |
508 | } |
506 | } |
509 | 507 | ||
510 | void draw_window() |
508 | void draw_window() |
511 | { |
509 | { |
512 | dword i; |
510 | dword i; |
513 | if (show_status_bar.checked) status_bar_h = STATUS_BAR_H; else status_bar_h = 0; |
511 | if (show_status_bar.checked) status_bar_h = STATUS_BAR_H; else status_bar_h = 0; |
514 | DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,TITLE,0); |
512 | DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,TITLE,0); |
515 | GetProcessInfo(#Form, SelfInfo); |
513 | GetProcessInfo(#Form, SelfInfo); |
516 | if (Form.status_window>2) return; |
514 | if (Form.status_window>2) return; |
517 | if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; } |
515 | if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; } |
518 | if (!two_panels.checked) && (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; } |
516 | if (!two_panels.checked) && (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; } |
519 | if ( two_panels.checked) && (Form.width < 573) { MoveSize(OLD,OLD,573,OLD); return; } |
517 | if ( two_panels.checked) && (Form.width < 573) { MoveSize(OLD,OLD,573,OLD); return; } |
520 | GetProcessInfo(#Form, SelfInfo); |
518 | GetProcessInfo(#Form, SelfInfo); |
521 | SetAppColors(); |
519 | SetAppColors(); |
522 | ESDWORD[#toolbar_pal] = sc.work; |
520 | ESDWORD[#toolbar_pal] = sc.work; |
523 | ESDWORD[#toolbar_pal+4] = MixColors(0, sc.work, 35); |
521 | ESDWORD[#toolbar_pal+4] = MixColors(0, sc.work, 35); |
524 | PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal); |
522 | PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal); |
525 | DrawBar(127, 8, 1, 25, sc.work_graph); |
523 | DrawBar(127, 8, 1, 25, sc.work_graph); |
526 | for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,21+i); |
524 | for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,21+i); |
527 | for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i], 5,31, 29, 21+i); |
525 | for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i], 5,31, 29, 21+i); |
528 | DrawBar(246,0, Form.cwidth - 246, 34, sc.work); |
526 | DrawBar(246,0, Form.cwidth - 246, 34, sc.work); |
529 | DrawDot(Form.cwidth-17,12); |
527 | DrawDot(Form.cwidth-17,12); |
530 | DrawDot(Form.cwidth-17,12+6); |
528 | DrawDot(Form.cwidth-17,12+6); |
531 | DrawDot(Form.cwidth-17,12+12); |
529 | DrawDot(Form.cwidth-17,12+12); |
532 | DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots |
530 | DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots |
533 | //main rectangles |
531 | //main rectangles |
534 | DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,sc.work_graph); |
532 | DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,sc.work_graph); |
535 | DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg |
533 | DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg |
536 | for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10)); |
534 | for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10)); |
- | 535 | for (i=0; i<6; i++) DrawBar(0, 5-i, Form.cwidth, 1, MixColors(sc.work_light, sc.work, i*10)); |
|
537 | llist_copy(#files_active, #files); |
536 | llist_copy(#files_active, #files); |
538 | strcpy(#active_path, #path); |
537 | strcpy(#active_path, #path); |
539 | DrawStatusBar(); |
538 | DrawStatusBar(); |
540 | if (selected_count==0) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] |
539 | if (selected_count==0) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] |
541 | DrawFilePanels(); |
540 | DrawFilePanels(); |
542 | } |
541 | } |
543 | 542 | ||
544 | void DrawList() |
543 | void DrawList() |
545 | { |
544 | { |
546 | word sorting_arrow_x; |
545 | word sorting_arrow_x; |
547 | dword sorting_arrow_t = "\x19"; |
546 | dword sorting_arrow_t = "\x19"; |
548 | if (sort_desc) sorting_arrow_t = "\x18"; |
547 | if (sort_desc) sorting_arrow_t = "\x18"; |
549 | DrawFlatButtonSmall(files.x, files.y-17, files.w - 141,16,31,T_FILE); |
548 | DrawFlatButtonSmall(files.x, files.y-17, files.w - 141,16,31,T_FILE); |
550 | DrawFlatButtonSmall(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE); |
549 | DrawFlatButtonSmall(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE); |
551 | DrawFlatButtonSmall(files.x + files.w - 68, files.y-17,68,16,33,T_SIZE); |
550 | DrawFlatButtonSmall(files.x + files.w - 68, files.y-17,68,16,33,T_SIZE); |
552 | DrawFlatButtonSmall(files.x + files.w, files.y-17,16,16, 0,"\x18"); |
551 | DrawFlatButtonSmall(files.x + files.w, files.y-17,16,16, 0,"\x18"); |
553 | DrawFlatButtonSmall(files.x + files.w,files.y+files.h-16,16,16,0,"\x19"); |
552 | DrawFlatButtonSmall(files.x + files.w,files.y+files.h-16,16,16,0,"\x19"); |
554 | if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18; |
553 | if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18; |
555 | if (sort_type==2) sorting_arrow_x = files.x + files.w - 90; |
554 | if (sort_type==2) sorting_arrow_x = files.x + files.w - 90; |
556 | if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
555 | if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
557 | WriteText(sorting_arrow_x,files.y-12,0x80, sc.work_text, sorting_arrow_t); |
556 | WriteText(sorting_arrow_x,files.y-12,0x80, sc.work_text, sorting_arrow_t); |
558 | DrawBar(files.x+files.w,files.y,1,files.h,sc.work_graph); |
557 | DrawBar(files.x+files.w,files.y,1,files.h,sc.work_graph); |
559 | if (two_panels.checked) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,sc.work_graph); |
558 | if (two_panels.checked) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,sc.work_graph); |
560 | } |
559 | } |
561 | 560 | ||
562 | void DrawStatusBar() |
561 | void DrawStatusBar() |
563 | { |
562 | { |
564 | char status_bar_str[80]; |
563 | char status_bar_str[80]; |
565 | int go_up_folder_exists=0; |
564 | int go_up_folder_exists=0; |
566 | if (!show_status_bar.checked) return; |
565 | if (!show_status_bar.checked) return; |
567 | if (files.count>0) && (strcmp(file_mas[0]*304+buf+72,"..")==0) go_up_folder_exists=1; |
566 | if (files.count>0) && (strcmp(file_mas[0]*304+buf+72,"..")==0) go_up_folder_exists=1; |
568 | DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, sc.work); |
567 | DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, sc.work); |
569 | sprintf(#status_bar_str, T_STATUS_EVEMENTS, count_dir-go_up_folder_exists, files.count-count_dir); |
568 | sprintf(#status_bar_str, T_STATUS_EVEMENTS, count_dir-go_up_folder_exists, files.count-count_dir); |
570 | WriteText(6,Form.cheight - 13,0x80,sc.work_text,#status_bar_str); |
569 | WriteText(6,Form.cheight - 13,0x80,sc.work_text,#status_bar_str); |
571 | if (selected_count) { |
570 | if (selected_count) { |
572 | sprintf(#status_bar_str, T_STATUS_SELECTED, selected_count); |
571 | sprintf(#status_bar_str, T_STATUS_SELECTED, selected_count); |
573 | WriteText(Form.cwidth - calc(strlen(#status_bar_str)*6)-6,Form.cheight - 13, |
572 | WriteText(Form.cwidth - calc(strlen(#status_bar_str)*6)-6,Form.cheight - 13, |
574 | 0x80,sc.work_text,#status_bar_str); |
573 | 0x80,sc.work_text,#status_bar_str); |
575 | } |
574 | } |
576 | } |
575 | } |
577 | 576 | ||
578 | void DrawFilePanels() |
577 | void DrawFilePanels() |
579 | { |
578 | { |
580 | int files_y; |
579 | int files_y; |
581 | if (!two_panels.checked) |
580 | if (!two_panels.checked) |
582 | { |
581 | { |
583 | DrawDeviceAndActionsLeftPanel(); |
582 | DrawDeviceAndActionsLeftPanel(); |
584 | files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h); |
583 | files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h); |
585 | DrawList(); |
584 | DrawList(); |
586 | Open_Dir(#path,ONLY_SHOW); |
585 | Open_Dir(#path,ONLY_SHOW); |
587 | } |
586 | } |
588 | else |
587 | else |
589 | { |
588 | { |
590 | SystemDiscs.Get(); |
589 | SystemDiscs.Get(); |
591 | llist_copy(#files, #files_inactive); |
590 | llist_copy(#files, #files_inactive); |
592 | strcpy(#path, #inactive_path); |
591 | strcpy(#path, #inactive_path); |
593 | col.selec = col.selec_inactive; |
592 | col.selec = col.selec_inactive; |
594 | SystemDiscs.Draw(); |
593 | SystemDiscs.Draw(); |
595 | files_y = files.y; |
594 | files_y = files.y; |
596 | 595 | ||
597 | if (active_panel==1) |
596 | if (active_panel==1) |
598 | { |
597 | { |
599 | llist_copy(#files, #files_inactive); |
598 | llist_copy(#files, #files_inactive); |
600 | strcpy(#path, #inactive_path); |
599 | strcpy(#path, #inactive_path); |
601 | col.selec = col.selec_inactive; //this is a bad code: need to use some var to set inactive panel for DrawList(); |
600 | col.selec = col.selec_inactive; //this is a bad code: need to use some var to set inactive panel for DrawList(); |
602 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
601 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
603 | DrawList(); |
602 | DrawList(); |
604 | Open_Dir(#path,WITH_REDRAW); |
603 | Open_Dir(#path,WITH_REDRAW); |
605 | llist_copy(#files, #files_active); |
604 | llist_copy(#files, #files_active); |
606 | strcpy(#path, #active_path); |
605 | strcpy(#path, #active_path); |
607 | col.selec = col.selec_active; |
606 | col.selec = col.selec_active; |
608 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
607 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
609 | DrawList(); |
608 | DrawList(); |
610 | Open_Dir(#path,WITH_REDRAW); |
609 | Open_Dir(#path,WITH_REDRAW); |
611 | } |
610 | } |
612 | if (active_panel==2) |
611 | if (active_panel==2) |
613 | { |
612 | { |
614 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
613 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
615 | DrawList(); |
614 | DrawList(); |
616 | Open_Dir(#path,WITH_REDRAW); |
615 | Open_Dir(#path,WITH_REDRAW); |
617 | llist_copy(#files, #files_active); |
616 | llist_copy(#files, #files_active); |
618 | strcpy(#path, #active_path); |
617 | strcpy(#path, #active_path); |
619 | col.selec = col.selec_active; |
618 | col.selec = col.selec_active; |
620 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
619 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
621 | DrawList(); |
620 | DrawList(); |
622 | Open_Dir(#path,WITH_REDRAW); |
621 | Open_Dir(#path,WITH_REDRAW); |
623 | } |
622 | } |
624 | } |
623 | } |
625 | } |
624 | } |
626 | 625 | ||
627 | 626 | ||
628 | void List_ReDraw() |
627 | void List_ReDraw() |
629 | { |
628 | { |
630 | int all_lines_h; |
629 | int all_lines_h; |
631 | dword j; |
630 | dword j; |
632 | static int old_cur_y, old_first; |
631 | static int old_cur_y, old_first; |
633 | 632 | ||
634 | files.CheckDoesValuesOkey(); //prevent some shit |
633 | files.CheckDoesValuesOkey(); //prevent some shit |
635 | 634 | ||
636 | if (list_full_redraw) || (old_first != files.first) |
635 | if (list_full_redraw) || (old_first != files.first) |
637 | { |
636 | { |
638 | old_cur_y = files.cur_y; |
637 | old_cur_y = files.cur_y; |
639 | old_first = files.first; |
638 | old_first = files.first; |
640 | list_full_redraw = false; |
639 | list_full_redraw = false; |
641 | goto _ALL_LIST_REDRAW; |
640 | goto _ALL_LIST_REDRAW; |
642 | } |
641 | } |
643 | if (old_cur_y != files.cur_y) |
642 | if (old_cur_y != files.cur_y) |
644 | { |
643 | { |
645 | if (old_cur_y-files.first |
644 | if (old_cur_y-files.first |
646 | Line_ReDraw(col.selec, files.cur_y-files.first); |
645 | Line_ReDraw(col.selec, files.cur_y-files.first); |
647 | old_cur_y = files.cur_y; |
646 | old_cur_y = files.cur_y; |
648 | return; |
647 | return; |
649 | } |
648 | } |
650 | 649 | ||
651 | _ALL_LIST_REDRAW: |
650 | _ALL_LIST_REDRAW: |
652 | 651 | ||
653 | for (j=0; j |
652 | for (j=0; j |
654 | if (files.cur_y-files.first!=j) Line_ReDraw(col.list_bg, j); |
653 | if (files.cur_y-files.first!=j) Line_ReDraw(col.list_bg, j); |
655 | else Line_ReDraw(col.selec, files.cur_y-files.first); |
654 | else Line_ReDraw(col.selec, files.cur_y-files.first); |
656 | } |
655 | } |
657 | //in the bottom |
656 | //in the bottom |
658 | all_lines_h = j * files.item_h; |
657 | all_lines_h = j * files.item_h; |
659 | DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h, col.list_bg); |
658 | DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h, col.list_bg); |
660 | DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,col.list_vert_line); |
659 | DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,col.list_vert_line); |
661 | DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,col.list_vert_line); |
660 | DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,col.list_vert_line); |
662 | Scroll(); |
661 | Scroll(); |
663 | 662 | ||
664 | if (del_active) Del_Form(); |
663 | if (del_active) Del_Form(); |
665 | if (new_element_active) && (col.selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name); |
664 | if (new_element_active) && (col.selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name); |
666 | } |
665 | } |
667 | 666 | ||
668 | bool file_name_is_8_3(dword name) |
667 | bool file_name_is_8_3(dword name) |
669 | { |
668 | { |
670 | int name_len = strlen(name); |
669 | int name_len = strlen(name); |
671 | int dot_pos = strrchr(name, '.'); |
670 | int dot_pos = strrchr(name, '.'); |
672 | if (name_len<=12) |
671 | if (name_len<=12) |
673 | { |
672 | { |
674 | if (dot_pos) { |
673 | if (dot_pos) { |
675 | if (name_len - dot_pos > 3) return false; |
674 | if (name_len - dot_pos > 3) return false; |
676 | } |
675 | } |
677 | else { |
676 | else { |
678 | if (name_len>8) return false; |
677 | if (name_len>8) return false; |
679 | } |
678 | } |
680 | return true; |
679 | return true; |
681 | } |
680 | } |
682 | return false; |
681 | return false; |
683 | } |
682 | } |
684 | 683 | ||
685 | void Line_ReDraw(dword bgcol, filenum){ |
684 | void Line_ReDraw(dword bgcol, filenum){ |
686 | dword text_col=col.list_gb_text, |
685 | dword text_col=col.list_gb_text, |
687 | ext1, attr, |
686 | ext1, attr, |
688 | file_offet, |
687 | file_offet, |
689 | file_name_off, |
688 | file_name_off, |
690 | file_size=0, |
689 | file_size=0, |
691 | y=filenum*files.item_h+files.y, |
690 | y=filenum*files.item_h+files.y, |
692 | icon_y = files.item_h-icon_size/2+1+y; |
691 | icon_y = files.item_h-icon_size/2+1+y; |
693 | BDVK file; |
692 | BDVK file; |
694 | char temp_path[sizeof(file_path)]; |
693 | char temp_path[sizeof(file_path)]; |
695 | char label_file_name[4096]; |
694 | char label_file_name[4096]; |
696 | if (filenum==-1) return; |
695 | if (filenum==-1) return; |
697 | DrawBar(files.x,y,4,files.item_h,bgcol); |
696 | DrawBar(files.x,y,4,files.item_h,bgcol); |
698 | DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol); |
697 | DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol); |
699 | if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size-1,icon_size,y+files.item_h-icon_y-icon_size+1,bgcol); |
698 | if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size-1,icon_size,y+files.item_h-icon_y-icon_size+1,bgcol); |
700 | if (colored_lines.checked) && (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line; |
699 | if (colored_lines.checked) && (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line; |
701 | DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol); |
700 | DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol); |
702 | 701 | ||
703 | file_offet = file_mas[filenum+files.first]*304 + buf+32; |
702 | file_offet = file_mas[filenum+files.first]*304 + buf+32; |
704 | attr = ESDWORD[file_offet]; |
703 | attr = ESDWORD[file_offet]; |
705 | file.selected = ESBYTE[file_offet+7]; |
704 | file.selected = ESBYTE[file_offet+7]; |
706 | file.sizelo = ESDWORD[file_offet+32]; |
705 | file.sizelo = ESDWORD[file_offet+32]; |
707 | file.sizehi = ESDWORD[file_offet+36]; |
706 | file.sizehi = ESDWORD[file_offet+36]; |
708 | file_name_off = file_offet+40; |
707 | file_name_off = file_offet+40; |
709 | sprintf(#temp_path,"%s/%s",#path,file_name_off); |
708 | sprintf(#temp_path,"%s/%s",#path,file_name_off); |
710 | 709 | ||
711 | if (! TestBit(attr, 4) ) //file or folder? |
710 | if (! TestBit(attr, 4) ) //file or folder? |
712 | { |
711 | { |
713 | ext1 = strrchr(file_name_off,'.') + file_name_off; |
712 | ext1 = strrchr(file_name_off,'.') + file_name_off; |
714 | if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing |
713 | if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing |
715 | file_size = ConvertSize64(file.sizelo, file.sizehi); |
714 | file_size = ConvertSize64(file.sizelo, file.sizehi); |
716 | if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); |
715 | if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); |
717 | } |
716 | } |
718 | else |
717 | else |
719 | { |
718 | { |
720 | if (!strcmp(file_name_off,"..")) ext1=" |
719 | if (!strcmp(file_name_off,"..")) ext1=" |
721 | ext1=" |
720 | ext1=" |
722 | WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); |
721 | WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); |
723 | } |
722 | } |
724 | if (chrnum(#path, '/')==1) file_size = GetDeviceSizeLabel(#temp_path); |
723 | if (chrnum(#path, '/')==1) file_size = GetDeviceSizeLabel(#temp_path); |
725 | } |
724 | } |
726 | if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58, |
725 | if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58, |
727 | files.text_y+y+1, files.font_type, col.list_gb_text, file_size); |
726 | files.text_y+y+1, files.font_type, col.list_gb_text, file_size); |
728 | DrawIconByExtension(#temp_path, ext1, files.x+4, icon_y, bgcol); |
727 | DrawIconByExtension(#temp_path, ext1, files.x+4, icon_y, bgcol); |
729 | 728 | ||
730 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=col.list_text_hidden; //system or hiden? |
729 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=col.list_text_hidden; //system or hiden? |
731 | if (bgcol==col.selec) |
730 | if (bgcol==col.selec) |
732 | { |
731 | { |
733 | file_name_is_8_3(file_name_off); |
732 | file_name_is_8_3(file_name_off); |
734 | itdir = TestBit(attr, 4); |
733 | itdir = TestBit(attr, 4); |
735 | strcpy(#file_name, file_name_off); |
734 | strcpy(#file_name, file_name_off); |
736 | if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off); |
735 | if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off); |
737 | else sprintf(#file_path,"%s/%s",#path,file_name_off); |
736 | else sprintf(#file_path,"%s/%s",#path,file_name_off); |
738 | if (text_col==col.list_text_hidden) { |
737 | if (text_col==col.list_text_hidden) { |
739 | text_col=MixColors(col.selec_text, col.list_text_hidden, 65); |
738 | text_col=MixColors(col.selec_text, col.list_text_hidden, 65); |
740 | } else text_col=col.selec_text; |
739 | } else text_col=col.selec_text; |
741 | } |
740 | } |
742 | if (file.selected) text_col=0xFF0000; |
741 | if (file.selected) text_col=0xFF0000; |
743 | if (kfont.size.pt==9) || (!kfont.font) |
742 | if (kfont.size.pt==9) || (!kfont.font) |
744 | { |
743 | { |
745 | if (Form.width>=480) |
744 | if (Form.width>=480) |
746 | { |
745 | { |
747 | FileShow.start_x = files.x + 23; |
746 | FileShow.start_x = files.x + 23; |
748 | FileShow.font_color = text_col; |
747 | FileShow.font_color = text_col; |
749 | FileShow.area_size_x = files.w - 164; |
748 | FileShow.area_size_x = files.w - 164; |
750 | FileShow.text_pointer = file_name_off; |
749 | FileShow.text_pointer = file_name_off; |
751 | FileShow.start_y = files.text_y + y - 3; |
750 | FileShow.start_y = files.text_y + y - 3; |
752 | PathShow_prepare stdcall(#FileShow); |
751 | PathShow_prepare stdcall(#FileShow); |
753 | PathShow_draw stdcall(#FileShow); |
752 | PathShow_draw stdcall(#FileShow); |
754 | } |
753 | } |
755 | } |
754 | } |
756 | else |
755 | else |
757 | { |
756 | { |
758 | strcpy(#label_file_name, file_name_off); |
757 | strcpy(#label_file_name, file_name_off); |
759 | if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) |
758 | if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) |
760 | { |
759 | { |
761 | while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) { |
760 | while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) { |
762 | ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL; |
761 | ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL; |
763 | } |
762 | } |
764 | strcpy(#label_file_name+strlen(#label_file_name)-2, "..."); |
763 | strcpy(#label_file_name+strlen(#label_file_name)-2, "..."); |
765 | } |
764 | } |
766 | kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, |
765 | kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, |
767 | bgcol, text_col, kfont.size.pt, #label_file_name); |
766 | bgcol, text_col, kfont.size.pt, #label_file_name); |
768 | } |
767 | } |
769 | DrawBar(files.x+files.w-141,y,1,files.item_h,col.list_vert_line); //gray line 1 |
768 | DrawBar(files.x+files.w-141,y,1,files.item_h,col.list_vert_line); //gray line 1 |
770 | DrawBar(files.x+files.w-68,y,1,files.item_h,col.list_vert_line); //gray line 2 |
769 | DrawBar(files.x+files.w-68,y,1,files.item_h,col.list_vert_line); //gray line 2 |
771 | } |
770 | } |
772 | 771 | ||
773 | 772 | ||
774 | void Open_Dir(dword dir_path, redraw){ |
773 | void Open_Dir(dword dir_path, redraw){ |
775 | int errornum, maxcount, i; |
774 | int errornum, maxcount, i; |
776 | if (redraw!=ONLY_SHOW) |
775 | if (redraw!=ONLY_SHOW) |
777 | { |
776 | { |
778 | selected_count = 0; |
777 | selected_count = 0; |
779 | if (buf) free(buf); |
778 | if (buf) free(buf); |
780 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
779 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
781 | if (errornum) |
780 | if (errornum) |
782 | { |
781 | { |
783 | history.add(#path); |
782 | history.add(#path); |
784 | EventHistoryGoBack(); |
783 | EventHistoryGoBack(); |
785 | Write_Error(errornum); |
784 | Write_Error(errornum); |
786 | return; |
785 | return; |
787 | } |
786 | } |
788 | maxcount = sizeof(file_mas)/sizeof(dword)-1; |
787 | maxcount = sizeof(file_mas)/sizeof(dword)-1; |
789 | if (files.count>maxcount) files.count = maxcount; |
788 | if (files.count>maxcount) files.count = maxcount; |
790 | if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0; |
789 | if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0; |
791 | } |
790 | } |
792 | if (files.count!=-1) |
791 | if (files.count!=-1) |
793 | { |
792 | { |
794 | if(!_not_draw) if (show_breadcrumb.checked) DrawBreadCrumbs(); else DrawPathBar(); |
793 | if(!_not_draw) if (show_breadcrumb.checked) DrawBreadCrumbs(); else DrawPathBar(); |
795 | history.add(#path); |
794 | history.add(#path); |
796 | SystemDiscs.Draw(); |
795 | SystemDiscs.Draw(); |
797 | files.visible = files.h / files.item_h; |
796 | files.visible = files.h / files.item_h; |
798 | if (files.count < files.visible) files.visible = files.count; |
797 | if (files.count < files.visible) files.visible = files.count; |
799 | if (!strncmp(dir_path, "/rd/1/",5)) |
798 | if (!strncmp(dir_path, "/rd/1/",5)) |
800 | dir_at_fat16 = true; else dir_at_fat16 = false; |
799 | dir_at_fat16 = true; else dir_at_fat16 = false; |
801 | if (redraw!=ONLY_SHOW) Sorting(); |
800 | if (redraw!=ONLY_SHOW) Sorting(); |
802 | list_full_redraw = true; |
801 | list_full_redraw = true; |
803 | if (redraw!=ONLY_OPEN)&&(!_not_draw) {DrawStatusBar(); List_ReDraw();} |
802 | if (redraw!=ONLY_OPEN)&&(!_not_draw) {DrawStatusBar(); List_ReDraw();} |
804 | SetCurDir(dir_path); |
803 | SetCurDir(dir_path); |
805 | } |
804 | } |
806 | if (files.count==-1) && (redraw!=ONLY_OPEN) |
805 | if (files.count==-1) && (redraw!=ONLY_OPEN) |
807 | { |
806 | { |
808 | files.KeyHome(); |
807 | files.KeyHome(); |
809 | if(!_not_draw) { list_full_redraw=true; DrawStatusBar(); List_ReDraw(); } |
808 | if(!_not_draw) { list_full_redraw=true; DrawStatusBar(); List_ReDraw(); } |
810 | } |
809 | } |
811 | } |
810 | } |
812 | 811 | ||
813 | inline Sorting() |
812 | inline Sorting() |
814 | { |
813 | { |
815 | dword d=0, f=1; |
814 | dword d=0, f=1; |
816 | int j=0; |
815 | int j=0; |
817 | dword file_off; |
816 | dword file_off; |
818 | 817 | ||
819 | if (!strcmp(#path,"/")) //do not sort root folder |
818 | if (!strcmp(#path,"/")) //do not sort root folder |
820 | { |
819 | { |
821 | for(d=1;d |
820 | for(d=1;d |
822 | count_dir = d; |
821 | count_dir = d; |
823 | return; |
822 | return; |
824 | } |
823 | } |
825 | for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders |
824 | for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders |
826 | { |
825 | { |
827 | if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40); |
826 | if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40); |
828 | if (TestBit(ESDWORD[file_off],4)) //directory? |
827 | if (TestBit(ESDWORD[file_off],4)) //directory? |
829 | { |
828 | { |
830 | file_mas[d]=j; |
829 | file_mas[d]=j; |
831 | d++; |
830 | d++; |
832 | } |
831 | } |
833 | else |
832 | else |
834 | { |
833 | { |
835 | file_mas[files.count-f]=j; |
834 | file_mas[files.count-f]=j; |
836 | f++; |
835 | f++; |
837 | } |
836 | } |
838 | } |
837 | } |
839 | count_dir = d; |
838 | count_dir = d; |
840 | //sorting: files first, then folders |
839 | //sorting: files first, then folders |
841 | Sort_by_Name(0,d-1); |
840 | Sort_by_Name(0,d-1); |
842 | if (sort_type==1) Sort_by_Name(d,files.count-1); |
841 | if (sort_type==1) Sort_by_Name(d,files.count-1); |
843 | else if (sort_type==2) Sort_by_Type(d,files.count-1); |
842 | else if (sort_type==2) Sort_by_Type(d,files.count-1); |
844 | else if (sort_type==3) Sort_by_Size(d,files.count-1); |
843 | else if (sort_type==3) Sort_by_Size(d,files.count-1); |
845 | //reversed sorting |
844 | //reversed sorting |
846 | if (sort_desc) { |
845 | if (sort_desc) { |
847 | for (j=0; j |
846 | for (j=0; j |
848 | //if (sort_type==1) for (j=0; j |
847 | //if (sort_type==1) for (j=0; j |
849 | } |
848 | } |
850 | //make ".." first item in list |
849 | //make ".." first item in list |
851 | if (d>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0) |
850 | if (d>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0) |
852 | for(d--; d>0; d--;) if (!strncmp(file_mas[d]*304+buf+72,"..",2)) {file_mas[d]> |
851 | for(d--; d>0; d--;) if (!strncmp(file_mas[d]*304+buf+72,"..",2)) {file_mas[d]> |
853 | } |
852 | } |
854 | 853 | ||
855 | 854 | ||
856 | void Del_Form() |
855 | void Del_Form() |
857 | { |
856 | { |
858 | byte f_count[128]; |
857 | byte f_count[128]; |
859 | int dform_x = files.w - 220 / 2 + files.x; |
858 | int dform_x = files.w - 220 / 2 + files.x; |
860 | if (selected_count==0) && (!strncmp(#file_name,"..",2)) return; |
859 | if (selected_count==0) && (!strncmp(#file_name,"..",2)) return; |
861 | else |
860 | else |
862 | { |
861 | { |
863 | if (!files.count) return; |
862 | if (!files.count) return; |
864 | DrawEolitePopup(T_YES, T_NO); |
863 | DrawEolitePopup(T_YES, T_NO); |
865 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,sc.work_text,T_DELETE_FILE); |
864 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,sc.work_text,T_DELETE_FILE); |
866 | if (selected_count) |
865 | if (selected_count) |
867 | { |
866 | { |
868 | sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2); |
867 | sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2); |
869 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count); |
868 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count); |
870 | } |
869 | } |
871 | else |
870 | else |
872 | { |
871 | { |
873 | if (strlen(#file_name)<28) |
872 | if (strlen(#file_name)<28) |
874 | { |
873 | { |
875 | WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?"); |
874 | WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?"); |
876 | WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name); |
875 | WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name); |
877 | } |
876 | } |
878 | else |
877 | else |
879 | { |
878 | { |
880 | WriteText(164+dform_x,190,0x80,0,"...?"); |
879 | WriteText(164+dform_x,190,0x80,0,"...?"); |
881 | ESI = 24; |
880 | ESI = 24; |
882 | WriteText(dform_x+20,190,0,0,#file_name); |
881 | WriteText(dform_x+20,190,0,0,#file_name); |
883 | } |
882 | } |
884 | } |
883 | } |
885 | del_active=1; |
884 | del_active=1; |
886 | } |
885 | } |
887 | } |
886 | } |
888 | 887 | ||
889 | void SelectFileByName(dword that_file) |
888 | void SelectFileByName(dword that_file) |
890 | { |
889 | { |
891 | int ind; |
890 | int ind; |
892 | files.KeyHome(); |
891 | files.KeyHome(); |
893 | Open_Dir(#path,ONLY_OPEN); |
892 | Open_Dir(#path,ONLY_OPEN); |
894 | if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file); |
893 | if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file); |
895 | for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; } |
894 | for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; } |
896 | files.cur_y = ind - 1; |
895 | files.cur_y = ind - 1; |
897 | files.KeyDown(); |
896 | files.KeyDown(); |
898 | DrawStatusBar(); |
897 | DrawStatusBar(); |
899 | List_ReDraw(); |
898 | List_ReDraw(); |
900 | } |
899 | } |
901 | 900 | ||
902 | 901 | ||
903 | void Dir_Up() |
902 | void Dir_Up() |
904 | { |
903 | { |
905 | int iii; |
904 | int iii; |
906 | char old_folder_name[4096]; |
905 | char old_folder_name[4096]; |
907 | iii=strlen(#path)-1; |
906 | iii=strlen(#path)-1; |
908 | if (iii==0) return; |
907 | if (iii==0) return; |
909 | iii = strrchr(#path, '/'); |
908 | iii = strrchr(#path, '/'); |
910 | strcpy(#old_folder_name, #path+iii); |
909 | strcpy(#old_folder_name, #path+iii); |
911 | if (iii>1) path[iii-1]=NULL; else path[iii]=NULL; |
910 | if (iii>1) path[iii-1]=NULL; else path[iii]=NULL; |
912 | SelectFileByName(#old_folder_name); |
911 | SelectFileByName(#old_folder_name); |
913 | } |
912 | } |
914 | 913 | ||
915 | void Open(byte rez) |
914 | void Open(byte rez) |
916 | { |
915 | { |
917 | byte temp[4096]; |
916 | byte temp[4096]; |
918 | selected_count = 0; |
917 | selected_count = 0; |
919 | if (rez) |
918 | if (rez) |
920 | { |
919 | { |
921 | if (!strncmp(#file_name,"..",3)) return; |
920 | if (!strncmp(#file_name,"..",3)) return; |
922 | strcpy(#temp, #file_path); |
921 | strcpy(#temp, #file_path); |
923 | RunProgram(I_Path, #temp); |
922 | RunProgram(I_Path, #temp); |
924 | return; |
923 | return; |
925 | } |
924 | } |
926 | if (!files.count) return; |
925 | if (!files.count) return; |
927 | if (!itdir) |
926 | if (!itdir) |
928 | { |
927 | { |
929 | if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path); |
928 | if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path); |
930 | } |
929 | } |
931 | else |
930 | else |
932 | { |
931 | { |
933 | if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; } |
932 | if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; } |
934 | strcpy(#path, #file_path); |
933 | strcpy(#path, #file_path); |
935 | files.first=files.cur_y=0; |
934 | files.first=files.cur_y=0; |
936 | Open_Dir(#path,WITH_REDRAW); |
935 | Open_Dir(#path,WITH_REDRAW); |
937 | } |
936 | } |
938 | } |
937 | } |
939 | 938 | ||
940 | inline fastcall void EventHistoryGoBack() |
939 | inline fastcall void EventHistoryGoBack() |
941 | { |
940 | { |
942 | char cur_folder[4096]; |
941 | char cur_folder[4096]; |
943 | strcpy(#cur_folder, #path); |
942 | strcpy(#cur_folder, #path); |
944 | if (history.back()) { |
943 | if (history.back()) { |
945 | strcpy(#path, history.current()); |
944 | strcpy(#path, history.current()); |
946 | SelectFileByName(#cur_folder+strrchr(#cur_folder,'/')); |
945 | SelectFileByName(#cur_folder+strrchr(#cur_folder,'/')); |
947 | } |
946 | } |
948 | } |
947 | } |
949 | 948 | ||
950 | void ShowOpenWithDialog() |
949 | void ShowOpenWithDialog() |
951 | { |
950 | { |
952 | byte open_param[4097]; |
951 | byte open_param[4097]; |
953 | sprintf(#open_param,"~%s",#file_path); |
952 | sprintf(#open_param,"~%s",#file_path); |
954 | RunProgram("/sys/@open", #open_param); |
953 | RunProgram("/sys/@open", #open_param); |
955 | } |
954 | } |
956 | 955 | ||
957 | void NewElement(byte newf) |
956 | void NewElement(byte newf) |
958 | { |
957 | { |
959 | BDVK element_info; |
958 | BDVK element_info; |
960 | byte del_rezult, copy_rezult, info_result; |
959 | byte del_rezult, copy_rezult, info_result; |
961 | if (newf) |
960 | if (newf) |
962 | { |
961 | { |
963 | sprintf(#temp,"%s/%s",#path,new_file_ed.text); |
962 | sprintf(#temp,"%s/%s",#path,new_file_ed.text); |
964 | info_result = GetFileInfo(#temp, #element_info); |
963 | info_result = GetFileInfo(#temp, #element_info); |
965 | switch(new_element_active) |
964 | switch(new_element_active) |
966 | { |
965 | { |
967 | case CREATE_FILE: |
966 | case CREATE_FILE: |
968 | if (info_result==5) |
967 | if (info_result==5) |
969 | { |
968 | { |
970 | CreateFile(0, 0, #temp); |
969 | CreateFile(0, 0, #temp); |
971 | if (EAX) |
970 | if (EAX) |
972 | { |
971 | { |
973 | if (EAX==5) notify(NOT_CREATE_FILE); |
972 | if (EAX==5) notify(NOT_CREATE_FILE); |
974 | else Write_Error(EAX); |
973 | else Write_Error(EAX); |
975 | } |
974 | } |
976 | } |
975 | } |
977 | else |
976 | else |
978 | { |
977 | { |
979 | notify(FS_ITEM_ALREADY_EXISTS); |
978 | notify(FS_ITEM_ALREADY_EXISTS); |
980 | } |
979 | } |
981 | break; |
980 | break; |
982 | case CREATE_FOLDER: |
981 | case CREATE_FOLDER: |
983 | if (info_result==5) |
982 | if (info_result==5) |
984 | { |
983 | { |
985 | CreateDir(#temp); |
984 | CreateDir(#temp); |
986 | if (EAX) |
985 | if (EAX) |
987 | { |
986 | { |
988 | if (EAX==5) notify(NOT_CREATE_FOLDER); |
987 | if (EAX==5) notify(NOT_CREATE_FOLDER); |
989 | else Write_Error(EAX); |
988 | else Write_Error(EAX); |
990 | } |
989 | } |
991 | } |
990 | } |
992 | else |
991 | else |
993 | { |
992 | { |
994 | notify(FS_ITEM_ALREADY_EXISTS); |
993 | notify(FS_ITEM_ALREADY_EXISTS); |
995 | } |
994 | } |
996 | break; |
995 | break; |
997 | case RENAME_ITEM: |
996 | case RENAME_ITEM: |
998 | if (info_result==5) |
997 | if (info_result==5) |
999 | { |
998 | { |
1000 | if (itdir) |
999 | if (itdir) |
1001 | { |
1000 | { |
1002 | //rename only empty folders |
1001 | //rename only empty folders |
1003 | if (del_rezult = DeleteFile(#file_path)) |
1002 | if (del_rezult = DeleteFile(#file_path)) |
1004 | { |
1003 | { |
1005 | Write_Error(del_rezult); |
1004 | Write_Error(del_rezult); |
1006 | return; |
1005 | return; |
1007 | } |
1006 | } |
1008 | if (CreateDir(#temp)) CreateDir(#file_path); |
1007 | if (CreateDir(#temp)) CreateDir(#file_path); |
1009 | Open_Dir(#path,WITH_REDRAW); |
1008 | Open_Dir(#path,WITH_REDRAW); |
1010 | SelectFileByName(new_file_ed.text); |
1009 | SelectFileByName(new_file_ed.text); |
1011 | } |
1010 | } |
1012 | else |
1011 | else |
1013 | { |
1012 | { |
1014 | if (copy_rezult = CopyFile(#file_path,#temp)) |
1013 | if (copy_rezult = CopyFile(#file_path,#temp)) |
1015 | { |
1014 | { |
1016 | Write_Error(copy_rezult); |
1015 | Write_Error(copy_rezult); |
1017 | } |
1016 | } |
1018 | else |
1017 | else |
1019 | { |
1018 | { |
1020 | DeleteFile(#file_path); |
1019 | DeleteFile(#file_path); |
1021 | SelectFileByName(new_file_ed.text); |
1020 | SelectFileByName(new_file_ed.text); |
1022 | } |
1021 | } |
1023 | } |
1022 | } |
1024 | } |
1023 | } |
1025 | else |
1024 | else |
1026 | { |
1025 | { |
1027 | notify(FS_ITEM_ALREADY_EXISTS); |
1026 | notify(FS_ITEM_ALREADY_EXISTS); |
1028 | } |
1027 | } |
1029 | } |
1028 | } |
1030 | new_element_active = 0; |
1029 | new_element_active = 0; |
1031 | Open_Dir(#path,WITH_REDRAW); |
1030 | Open_Dir(#path,WITH_REDRAW); |
1032 | SelectFileByName(new_file_ed.text); |
1031 | SelectFileByName(new_file_ed.text); |
1033 | } |
1032 | } |
1034 | new_element_active = 0; |
1033 | new_element_active = 0; |
1035 | Open_Dir(#path,WITH_REDRAW); |
1034 | Open_Dir(#path,WITH_REDRAW); |
1036 | } |
1035 | } |
1037 | 1036 | ||
1038 | void NewElement_Form(byte crt, dword strng) |
1037 | void NewElement_Form(byte crt, dword strng) |
1039 | { |
1038 | { |
1040 | int dform_x=files.w-220/2+files.x; |
1039 | int dform_x=files.w-220/2+files.x; |
1041 | if (!new_element_active) |
1040 | if (!new_element_active) |
1042 | { |
1041 | { |
1043 | new_element_active = crt; |
1042 | new_element_active = crt; |
1044 | strcpy(#new_element_name, strng); |
1043 | strcpy(#new_element_name, strng); |
1045 | EditBox_UpdateText(#new_file_ed, ed_focus+ed_always_focus); |
1044 | EditBox_UpdateText(#new_file_ed, ed_focus+ed_always_focus); |
1046 | } |
1045 | } |
1047 | if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL); |
1046 | if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL); |
1048 | else DrawEolitePopup(T_CREATE, T_CANCEL); |
1047 | else DrawEolitePopup(T_CREATE, T_CANCEL); |
1049 | new_file_ed.left = dform_x+10; |
1048 | new_file_ed.left = dform_x+10; |
1050 | DrawEditBox(#new_file_ed); |
1049 | DrawEditBox(#new_file_ed); |
1051 | } |
1050 | } |
1052 | 1051 | ||
1053 | void FnProcess(byte N) |
1052 | void FnProcess(byte N) |
1054 | { |
1053 | { |
1055 | switch(N) |
1054 | switch(N) |
1056 | { |
1055 | { |
1057 | case 1: |
1056 | case 1: |
1058 | if (!active_about) { |
1057 | if (!active_about) { |
1059 | about_stak = malloc(4096); |
1058 | about_stak = malloc(4096); |
1060 | about_thread_id = CreateThread(#about_dialog,about_stak+4092); |
1059 | about_thread_id = CreateThread(#about_dialog,about_stak+4092); |
1061 | break; |
1060 | break; |
1062 | } else { |
1061 | } else { |
1063 | ActivateWindow(GetProcessSlot(about_thread_id)); |
1062 | ActivateWindow(GetProcessSlot(about_thread_id)); |
1064 | } |
1063 | } |
1065 | break; |
1064 | break; |
1066 | case 2: |
1065 | case 2: |
1067 | if (files.count) NewElement_Form(RENAME_ITEM, #file_name); |
1066 | if (files.count) NewElement_Form(RENAME_ITEM, #file_name); |
1068 | break; |
1067 | break; |
1069 | case 3: |
1068 | case 3: |
1070 | if (files.count) && (!itdir) RunProgram("/sys/tinypad", #file_path); |
1069 | if (files.count) && (!itdir) RunProgram("/sys/tinypad", #file_path); |
1071 | break; |
1070 | break; |
1072 | case 4: |
1071 | case 4: |
1073 | if (files.count) && (!itdir) RunProgram("/sys/develop/heed", #file_path); |
1072 | if (files.count) && (!itdir) RunProgram("/sys/develop/heed", #file_path); |
1074 | break; |
1073 | break; |
1075 | case 5: //refresh cur dir & devs |
1074 | case 5: //refresh cur dir & devs |
1076 | if (two_panels.checked) |
1075 | if (two_panels.checked) |
1077 | { |
1076 | { |
1078 | DrawFilePanels(); |
1077 | DrawFilePanels(); |
1079 | } |
1078 | } |
1080 | else |
1079 | else |
1081 | { |
1080 | { |
1082 | Tip(56, T_DEVICES, 55, "-"); |
1081 | Tip(56, T_DEVICES, 55, "-"); |
1083 | Open_Dir(#path,WITH_REDRAW); |
1082 | Open_Dir(#path,WITH_REDRAW); |
1084 | pause(10); |
1083 | pause(10); |
1085 | SystemDiscs.Get(); |
1084 | SystemDiscs.Get(); |
1086 | Open_Dir(#path,WITH_REDRAW); |
1085 | Open_Dir(#path,WITH_REDRAW); |
1087 | DrawDeviceAndActionsLeftPanel(); |
1086 | DrawDeviceAndActionsLeftPanel(); |
1088 | } |
1087 | } |
1089 | break; |
1088 | break; |
1090 | case 6: |
1089 | case 6: |
1091 | NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER); |
1090 | NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER); |
1092 | break; |
1091 | break; |
1093 | case 7: |
1092 | case 7: |
1094 | NewElement_Form(CREATE_FILE, T_NEW_FILE); |
1093 | NewElement_Form(CREATE_FILE, T_NEW_FILE); |
1095 | break; |
1094 | break; |
1096 | case 8: |
1095 | case 8: |
1097 | properties_stak = malloc(8096); |
1096 | properties_stak = malloc(8096); |
1098 | CreateThread(#properties_dialog, properties_stak+8092); |
1097 | CreateThread(#properties_dialog, properties_stak+8092); |
1099 | break; |
1098 | break; |
1100 | case 10: //F10 |
1099 | case 10: //F10 |
1101 | if (!active_settings) |
1100 | if (!active_settings) |
1102 | { |
1101 | { |
1103 | settings_stak = malloc(4096); |
1102 | settings_stak = malloc(4096); |
1104 | settings_window = CreateThread(#settings_dialog, settings_stak+4092); |
1103 | settings_window = CreateThread(#settings_dialog, settings_stak+4092); |
1105 | break; |
1104 | break; |
1106 | } |
1105 | } |
1107 | else |
1106 | else |
1108 | { |
1107 | { |
1109 | ActivateWindow(GetProcessSlot(settings_window)); |
1108 | ActivateWindow(GetProcessSlot(settings_window)); |
1110 | } |
1109 | } |
1111 | break; |
1110 | break; |
1112 | } |
1111 | } |
1113 | } |
1112 | } |
1114 | 1113 | ||
1115 | void ChangeActivePanel() |
1114 | void ChangeActivePanel() |
1116 | { |
1115 | { |
1117 | llist_copy(#files_active, #files_inactive); |
1116 | llist_copy(#files_active, #files_inactive); |
1118 | llist_copy(#files_inactive, #files); |
1117 | llist_copy(#files_inactive, #files); |
1119 | strcpy(#active_path, #inactive_path); |
1118 | strcpy(#active_path, #inactive_path); |
1120 | strcpy(#inactive_path, #path); |
1119 | strcpy(#inactive_path, #path); |
1121 | DrawFilePanels(); |
1120 | DrawFilePanels(); |
1122 | } |
1121 | } |
1123 | 1122 | ||
1124 | void EventSelectAllFiles(dword state) |
1123 | void EventSelectAllFiles(dword state) |
1125 | { |
1124 | { |
1126 | int i; |
1125 | int i; |
1127 | for (i=0; i |
1126 | for (i=0; i |
1128 | List_ReDraw(); |
1127 | List_ReDraw(); |
1129 | DrawStatusBar(); |
1128 | DrawStatusBar(); |
1130 | } |
1129 | } |
1131 | 1130 | ||
1132 | void EventSelectFileByKeyPress() |
1131 | void EventSelectFileByKeyPress() |
1133 | { |
1132 | { |
1134 | int i; |
1133 | int i; |
1135 | for (i=files.cur_y+1; i |
1134 | for (i=files.cur_y+1; i |
1136 | { |
1135 | { |
1137 | strcpy(#temp, file_mas[i]*304+buf+72); |
1136 | strcpy(#temp, file_mas[i]*304+buf+72); |
1138 | if (temp[0]==key_ascii) || (temp[0]==key_ascii-32) |
1137 | if (temp[0]==key_ascii) || (temp[0]==key_ascii-32) |
1139 | { |
1138 | { |
1140 | files.cur_y = i - 1; |
1139 | files.cur_y = i - 1; |
1141 | files.KeyDown(); |
1140 | files.KeyDown(); |
1142 | List_ReDraw(); |
1141 | List_ReDraw(); |
1143 | return; |
1142 | return; |
1144 | } |
1143 | } |
1145 | } |
1144 | } |
1146 | } |
1145 | } |
1147 | 1146 | ||
1148 | dword GetDeviceSizeLabel(dword path) |
1147 | dword GetDeviceSizeLabel(dword path) |
1149 | { |
1148 | { |
1150 | BDVK bdvk; |
1149 | BDVK bdvk; |
1151 | char cdname[8]; |
1150 | char cdname[8]; |
1152 | if (ESBYTE[path+1] == '/') path++; |
1151 | if (ESBYTE[path+1] == '/') path++; |
1153 | if (ESBYTE[path+1] == 'c') && (ESBYTE[path+2] == 'd') |
1152 | if (ESBYTE[path+1] == 'c') && (ESBYTE[path+2] == 'd') |
1154 | && (ESBYTE[path+4] == 0) return 0; |
1153 | && (ESBYTE[path+4] == 0) return 0; |
1155 | GetFileInfo(path, #bdvk); |
1154 | GetFileInfo(path, #bdvk); |
1156 | return ConvertSize64(bdvk.sizelo, bdvk.sizehi); |
1155 | return ConvertSize64(bdvk.sizelo, bdvk.sizehi); |
1157 | } |
1156 | } |
1158 | 1157 | ||
1159 | int GetRealFileCountInFolder(dword folder_path) |
1158 | int GetRealFileCountInFolder(dword folder_path) |
1160 | { |
1159 | { |
1161 | int fcount; |
1160 | int fcount; |
1162 | dword countbuf; |
1161 | dword countbuf; |
1163 | 1162 | ||
1164 | GetDir(#countbuf, #fcount, folder_path, DIRS_NOROOT); |
1163 | GetDir(#countbuf, #fcount, folder_path, DIRS_NOROOT); |
1165 | if (countbuf) free(countbuf); |
1164 | if (countbuf) free(countbuf); |
1166 | 1165 | ||
1167 | return fcount; |
1166 | return fcount; |
1168 | } |
1167 | } |
1169 | 1168 | ||
1170 | void EventRefreshDisksAndFolders() |
1169 | void EventRefreshDisksAndFolders() |
1171 | { |
1170 | { |
1172 | if(GetRealFileCountInFolder("/")+dir_exists("/kolibrios") != SystemDiscs.dev_num) { |
1171 | if(GetRealFileCountInFolder("/")+dir_exists("/kolibrios") != SystemDiscs.dev_num) { |
1173 | FnProcess(5); |
1172 | FnProcess(5); |
1174 | } |
1173 | } |
1175 | if(two_panels.checked) |
1174 | if(two_panels.checked) |
1176 | { |
1175 | { |
1177 | if(GetRealFileCountInFolder(#inactive_path) != files_inactive.count) { |
1176 | if(GetRealFileCountInFolder(#inactive_path) != files_inactive.count) { |
1178 | ChangeActivePanel(); |
1177 | ChangeActivePanel(); |
1179 | Open_Dir(#path,WITH_REDRAW); |
1178 | Open_Dir(#path,WITH_REDRAW); |
1180 | ChangeActivePanel(); |
1179 | ChangeActivePanel(); |
1181 | } |
1180 | } |
1182 | if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW); |
1181 | if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW); |
1183 | } |
1182 | } |
1184 | else |
1183 | else |
1185 | { |
1184 | { |
1186 | if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW); |
1185 | if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW); |
1187 | } |
1186 | } |
1188 | } |
1187 | } |
1189 | 1188 | ||
1190 | void EventSort(dword id) |
1189 | void EventSort(dword id) |
1191 | { |
1190 | { |
1192 | char selected_filename[256]; |
1191 | char selected_filename[256]; |
1193 | if (sort_type == id) sort_desc ^= 1; |
1192 | if (sort_type == id) sort_desc ^= 1; |
1194 | else sort_type = id; |
1193 | else sort_type = id; |
1195 | strcpy(#selected_filename, #file_name); |
1194 | strcpy(#selected_filename, #file_name); |
1196 | DrawList(); |
1195 | DrawList(); |
1197 | Open_Dir(#path,WITH_REDRAW); |
1196 | Open_Dir(#path,WITH_REDRAW); |
1198 | SelectFileByName(#selected_filename); |
1197 | SelectFileByName(#selected_filename); |
1199 | } |
1198 | } |
1200 | 1199 | ||
1201 | void EventHistoryGoForward() |
1200 | void EventHistoryGoForward() |
1202 | { |
1201 | { |
1203 | if (history.forward()) { |
1202 | if (history.forward()) { |
1204 | strcpy(#path, history.current()); |
1203 | strcpy(#path, history.current()); |
1205 | files.KeyHome(); |
1204 | files.KeyHome(); |
1206 | Open_Dir(#path,WITH_REDRAW); |
1205 | Open_Dir(#path,WITH_REDRAW); |
1207 | } |
1206 | } |
1208 | } |
1207 | } |
1209 | 1208 | ||
1210 | void EventOpenNewEolite() |
1209 | void EventOpenNewEolite() |
1211 | { |
1210 | { |
1212 | RunProgram(I_Path, #path); |
1211 | RunProgram(I_Path, #path); |
1213 | } |
1212 | } |
1214 | 1213 | ||
1215 | void EventOpenConsoleHere() |
1214 | void EventOpenConsoleHere() |
1216 | { |
1215 | { |
1217 | sprintf(#param, "pwd cd %s", #path); |
1216 | sprintf(#param, "pwd cd %s", #path); |
1218 | RunProgram("/sys/shell", #param); |
1217 | RunProgram("/sys/shell", #param); |
1219 | } |
1218 | } |
1220 | 1219 | ||
1221 | void ProceedMouseGestures() |
1220 | void ProceedMouseGestures() |
1222 | { |
1221 | { |
1223 | char stats; |
1222 | char stats; |
1224 | signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; |
1223 | signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; |
1225 | if (!mouse.mkm) && (stats>0) stats = 0; |
1224 | if (!mouse.mkm) && (stats>0) stats = 0; |
1226 | if (mouse.mkm) && (!stats) |
1225 | if (mouse.mkm) && (!stats) |
1227 | { |
1226 | { |
1228 | x_old = mouse.x; |
1227 | x_old = mouse.x; |
1229 | y_old = mouse.y; |
1228 | y_old = mouse.y; |
1230 | stats = 1; |
1229 | stats = 1; |
1231 | } |
1230 | } |
1232 | if (mouse.mkm) && (stats==1) |
1231 | if (mouse.mkm) && (stats==1) |
1233 | { |
1232 | { |
1234 | dif_x = mouse.x-x_old; |
1233 | dif_x = mouse.x-x_old; |
1235 | dif_y = mouse.y-y_old; |
1234 | dif_y = mouse.y-y_old; |
1236 | adif_x = fabs(dif_x); |
1235 | adif_x = fabs(dif_x); |
1237 | adif_y = fabs(dif_y); |
1236 | adif_y = fabs(dif_y); |
1238 | 1237 | ||
1239 | if (adif_x>adif_y) { |
1238 | if (adif_x>adif_y) { |
1240 | if (dif_x > 150) { |
1239 | if (dif_x > 150) { |
1241 | EventHistoryGoForward(); |
1240 | EventHistoryGoForward(); |
1242 | stats = 0; |
1241 | stats = 0; |
1243 | } |
1242 | } |
1244 | if (dif_x < -150) { |
1243 | if (dif_x < -150) { |
1245 | EventHistoryGoBack(); |
1244 | EventHistoryGoBack(); |
1246 | stats = 0; |
1245 | stats = 0; |
1247 | } |
1246 | } |
1248 | } else { |
1247 | } else { |
1249 | if (dif_y < -100) { |
1248 | if (dif_y < -100) { |
1250 | Dir_Up(); |
1249 | Dir_Up(); |
1251 | stats = 0; |
1250 | stats = 0; |
1252 | } |
1251 | } |
1253 | } |
1252 | } |
1254 | } |
1253 | } |
1255 | } |
1254 | } |
1256 | 1255 | ||
1257 | stop:>>28)> |
1256 | stop:>>28)> |
1258 | > |
1257 | > |
1259 | >>9)>=12)>5)>6;>6;>3;>>>> |
1258 | >>9)>=12)>5)>6;>6;>6;>3;>>>> |
1260 | >0)>0)>=files.x+files.w+18)> |
1259 | >0)>0)>=files.x+files.w+18)> |
1261 | > |
1260 | > |
1262 | >=files.x+files.w+16)> |
1261 | >=files.x+files.w+16)> |
1263 | >=files.x+files.w+16)> |
1262 | >=files.x+files.w+16)> |