Rev 8871 | Rev 8881 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8750 | leency | 1 | //Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2021 |
7490 | leency | 2 | //GNU GPL license. |
3363 | leency | 3 | |
7361 | leency | 4 | // 70.5 - get volume info and label |
5 | |||
8872 | leency | 6 | #define ABOUT_TITLE "EOLITE 5 Beta5" |
7 | #define TITLE_EOLITE "Eolite File Manager 5 Beta5" |
||
8 | #define TITLE_KFM "Kolibri File Manager 2 Beta5"; |
||
8012 | leency | 9 | |
4022 | leency | 10 | #ifndef AUTOBUILD |
11 | #include "lang.h--" |
||
12 | #endif |
||
13 | |||
3363 | leency | 14 | //libraries |
8417 | leency | 15 | #define MEMSIZE 1024 * 250 |
7054 | leency | 16 | #include "../lib/clipboard.h" |
17 | #include "../lib/strings.h" |
||
18 | #include "../lib/mem.h" |
||
7219 | leency | 19 | #include "../lib/fs.h" |
7054 | leency | 20 | #include "../lib/gui.h" |
21 | #include "../lib/list_box.h" |
||
22 | #include "../lib/random.h" |
||
23 | #include "../lib/kfont.h" |
||
24 | #include "../lib/collection.h" |
||
25 | #include "../lib/copyf.h" |
||
5834 | pavelyakov | 26 | |
7054 | leency | 27 | #include "../lib/obj/libini.h" |
28 | #include "../lib/obj/box_lib.h" |
||
7230 | leency | 29 | #include "../lib/obj/libimg.h" |
7054 | leency | 30 | |
31 | #include "../lib/patterns/history.h" |
||
8764 | leency | 32 | #include "../lib/patterns/toolbar_button.h" |
7054 | leency | 33 | |
7462 | leency | 34 | #include "imgs/images.h" |
3363 | leency | 35 | |
6278 | leency | 36 | //Button IDs |
37 | enum { |
||
7422 | leency | 38 | PATH_BTN = 10, |
6278 | leency | 39 | POPUP_BTN1 = 201, |
6289 | leency | 40 | POPUP_BTN2 = 202, |
8854 | leency | 41 | KFM_DEV_DROPDOWN_1 = 205, |
42 | KFM_DEV_DROPDOWN_2 = 207, |
||
43 | BREADCRUMB_ID = 300, |
||
44 | |||
45 | BACK_BTN = 400, |
||
46 | FWRD_BTN, |
||
47 | GOUP_BTN, |
||
48 | COPY_BTN, |
||
49 | CUT_BTN, |
||
50 | PASTE_BTN |
||
6278 | leency | 51 | }; |
3444 | leency | 52 | |
6278 | leency | 53 | //NewElement options |
54 | enum { |
||
55 | CREATE_FILE=1, |
||
56 | CREATE_FOLDER, |
||
57 | RENAME_ITEM |
||
58 | }; |
||
59 | |||
60 | //OpenDir options |
||
61 | enum { |
||
62 | WITH_REDRAW, |
||
63 | ONLY_OPEN |
||
64 | }; |
||
65 | |||
7757 | leency | 66 | _history history; |
67 | |||
7634 | leency | 68 | struct Eolite_colors |
69 | { |
||
7647 | leency | 70 | bool def; |
7634 | leency | 71 | dword lpanel; |
72 | dword list_vert_line; //vertical line between columns in list |
||
73 | dword selec; |
||
74 | dword selec_active; |
||
75 | dword selec_inactive; |
||
76 | dword selec_text; |
||
77 | dword list_bg; |
||
78 | dword list_gb_text; |
||
79 | dword list_text_hidden; |
||
80 | dword work_gradient[24]; |
||
81 | dword slider_bg_big; |
||
82 | dword slider_bg_left; |
||
83 | dword odd_line; |
||
84 | } col; |
||
8240 | leency | 85 | dword waves_pal[256]; |
3363 | leency | 86 | |
8764 | leency | 87 | bool efm = false; |
88 | |||
3434 | leency | 89 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
3363 | leency | 90 | |
7628 | leency | 91 | bool active_about = false; |
92 | bool active_settings = false; |
||
93 | bool _not_draw = false; |
||
94 | bool dir_at_fat16 = NULL; |
||
95 | |||
8872 | leency | 96 | bool disk_popin_active_on_panel=0; |
4136 | punk_joker | 97 | |
8854 | leency | 98 | dword about_thread_id; |
99 | dword settings_window; |
||
100 | |||
5733 | leency | 101 | byte del_active=0; |
102 | byte new_element_active=0; |
||
5698 | leency | 103 | |
5733 | leency | 104 | llist files, files_active, files_inactive; |
3434 | leency | 105 | |
5694 | leency | 106 | byte list_full_redraw; |
107 | |||
5698 | leency | 108 | dword buf; |
7972 | leency | 109 | collection_int items=0; |
5698 | leency | 110 | int selected_count; |
6406 | punk_joker | 111 | int count_dir; |
5698 | leency | 112 | |
7628 | leency | 113 | byte path[4096]; |
114 | byte file_path[4096]; |
||
115 | byte file_name[256]; |
||
116 | byte new_element_name[256]; |
||
117 | byte temp[4096]; |
||
118 | bool itdir; |
||
3363 | leency | 119 | |
5719 | leency | 120 | char active_path[4096], inactive_path[4096]; |
5698 | leency | 121 | |
7202 | leency | 122 | dword eolite_ini_path[4096]; |
123 | _ini ini; |
||
5441 | leency | 124 | |
5698 | leency | 125 | char scroll_used=false; |
5695 | leency | 126 | |
8861 | leency | 127 | dword about_stak=0,properties_stak=0,settings_stak=0; |
5608 | leency | 128 | |
3363 | leency | 129 | proc_info Form; |
7252 | leency | 130 | int sc_slider_h; |
4028 | leency | 131 | int action_buf; |
4863 | leency | 132 | int rand_n; |
3363 | leency | 133 | |
7490 | leency | 134 | char sort_type=2; |
135 | bool sort_desc=false; |
||
7244 | leency | 136 | int active_panel=1; |
5549 | punk_joker | 137 | |
7054 | leency | 138 | libimg_image icons16_default; |
139 | libimg_image icons16_selected; |
||
140 | |||
7242 | leency | 141 | libimg_image icons32_default; |
142 | libimg_image icons32_selected; |
||
7197 | leency | 143 | |
6564 | leency | 144 | #define STATUS_BAR_H 16; |
145 | int status_bar_h = 0; |
||
146 | |||
8868 | leency | 147 | int icon_size = 18; |
7197 | leency | 148 | |
7252 | leency | 149 | edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000, |
8334 | leency | 150 | 248,#new_element_name,0,ed_focus+ed_always_focus,6,0}; |
7004 | leency | 151 | PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
5694 | leency | 152 | byte cmd_free=0; |
5698 | leency | 153 | #include "include\translations.h" |
5834 | pavelyakov | 154 | |
7462 | leency | 155 | #include "include\gui.h" |
5748 | leency | 156 | #include "include\settings.h" |
5804 | punk_joker | 157 | #include "include\progress_dialog.h" |
7878 | leency | 158 | #include "include\copy_and_delete.h" |
3363 | leency | 159 | #include "include\sorting.h" |
4042 | leency | 160 | #include "include\icons.h" |
3363 | leency | 161 | #include "include\left_panel.h" |
4042 | leency | 162 | #include "include\menu.h" |
163 | #include "include\about.h" |
||
5447 | punk_joker | 164 | #include "include\properties.h" |
6289 | leency | 165 | #include "include\breadcrumbs.h" |
3363 | leency | 166 | |
7786 | leency | 167 | void load_libraries() |
168 | { |
||
169 | load_dll(boxlib, #box_lib_init,0); |
||
170 | load_dll(libini, #lib_init,1); |
||
171 | load_dll(libimg, #libimg_init,1); |
||
172 | } |
||
173 | |||
7878 | leency | 174 | void handle_param() |
175 | { |
||
7879 | leency | 176 | //-p |
177 | //-d |
||
178 | //-v : paste files/folder from clipboard |
||
8764 | leency | 179 | dword p = #param; |
8779 | leency | 180 | if (param[0]=='\\') && (param[1]=='E') && (param[2]=='F') && (param[3]=='M') { |
8764 | leency | 181 | efm = true; |
182 | p += 4; |
||
183 | if (param[4]==' ') p++; |
||
184 | } |
||
185 | |||
8779 | leency | 186 | LoadIniSettings(); |
187 | |||
8764 | leency | 188 | if (ESBYTE[p]=='\0') return; |
189 | |||
190 | if (ESBYTE[p]=='-') switch (ESBYTE[p+1]) |
||
7878 | leency | 191 | { |
192 | case 'p': |
||
8764 | leency | 193 | strcpy(#file_path, p + 3); |
7920 | leency | 194 | itdir = dir_exists(#file_path); |
8764 | leency | 195 | strcpy(#file_name, p + strrchr(p, '/')); |
196 | ESBYTE[strrchr(p, '/')+p-1] = '\0'; |
||
197 | strcpy(#path, p + 3); |
||
7878 | leency | 198 | properties_dialog(); |
8020 | leency | 199 | ExitProcess(); |
7878 | leency | 200 | case 'd': |
8861 | leency | 201 | strcpy(#path, p + 3); |
202 | DeleteThread(); |
||
8020 | leency | 203 | ExitProcess(); |
7879 | leency | 204 | case 'v': |
8764 | leency | 205 | cut_active = ESBYTE[p+2] - '0'; |
206 | strcpy(#path, p + 4); |
||
7879 | leency | 207 | PasteThread(); |
8020 | leency | 208 | ExitProcess(); |
7878 | leency | 209 | } |
8764 | leency | 210 | |
8779 | leency | 211 | ESBYTE[0] = NULL; |
8764 | leency | 212 | |
8779 | leency | 213 | if (param[strlen(#param)-1]=='/') ESBYTE[strlen(#param)-1]=NULL; //no "/" at the end |
214 | |||
8764 | leency | 215 | if (dir_exists(p)) { |
216 | strcpy(#path, p); |
||
217 | } else { |
||
218 | if (file_exists(p)) { |
||
219 | ESBYTE[strrchr(p, '/')+p-1] = '\0'; |
||
220 | strcpy(#path, p); |
||
8779 | leency | 221 | SelectFileByName(p+strlen(#path)+1); |
8764 | leency | 222 | } else { |
223 | notify(T_NOTIFY_APP_PARAM_WRONG); |
||
224 | } |
||
225 | } |
||
7878 | leency | 226 | } |
227 | |||
3363 | leency | 228 | void main() |
229 | { |
||
6289 | leency | 230 | dword id; |
7993 | leency | 231 | int old_cur_y; |
7786 | leency | 232 | |
8765 | leency | 233 | load_libraries(); |
234 | SetAppColors(); |
||
235 | |||
8780 | leency | 236 | ESBYTE[0] = NULL; |
237 | |||
8764 | leency | 238 | handle_param(); |
7816 | leency | 239 | rand_n = random(80); |
5651 | pavelyakov | 240 | |
8780 | leency | 241 | ESBYTE[0] = NULL; |
242 | |||
6034 | leency | 243 | SystemDiscs.Get(); |
5733 | leency | 244 | Open_Dir(#path,ONLY_OPEN); |
5719 | leency | 245 | strcpy(#inactive_path, #path); |
5733 | leency | 246 | llist_copy(#files_inactive, #files); |
7051 | leency | 247 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
7913 | leency | 248 | loop() switch(@WaitEventTimeout(80)) |
7786 | leency | 249 | { |
250 | case evMouse: |
||
8872 | leency | 251 | if (del_active) || (disk_popin_active_on_panel) || (Form.status_window>2) break; |
7786 | leency | 252 | if (new_element_active) |
253 | { |
||
254 | edit_box_mouse stdcall(#new_file_ed); |
||
255 | break; |
||
256 | } |
||
257 | |||
258 | mouse.get(); |
||
7422 | leency | 259 | |
7786 | leency | 260 | ProceedMouseGestures(); |
7989 | leency | 261 | |
7993 | leency | 262 | if (mouse.vert) |
263 | { |
||
264 | if (files.MouseScroll(mouse.vert)) List_ReDraw(); |
||
7989 | leency | 265 | break; |
266 | } |
||
7993 | leency | 267 | |
7786 | leency | 268 | if (files.MouseOver(mouse.x, mouse.y)) |
269 | { |
||
270 | //select file |
||
271 | if (mouse.key&MOUSE_LEFT) && (mouse.up) |
||
5549 | punk_joker | 272 | { |
7993 | leency | 273 | GetKeyModifier(); |
274 | old_cur_y = files.cur_y; |
||
8012 | leency | 275 | if (files.ProcessMouse(mouse.x, mouse.y)) && (!key_modifier) { |
276 | List_ReDraw(); |
||
277 | break; |
||
278 | } |
||
7993 | leency | 279 | if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) { |
280 | EventChooseFilesRange(old_cur_y, files.cur_y); |
||
281 | } else if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) { |
||
282 | EventChooseFile(files.cur_y); |
||
283 | DrawStatusBar(); |
||
7989 | leency | 284 | List_ReDraw(); |
285 | } else { |
||
8417 | leency | 286 | if (mouse.y - files.y / files.item_h + files.first == files.cur_y) EventOpen(0); |
7786 | leency | 287 | } |
5591 | pavelyakov | 288 | } |
7786 | leency | 289 | //file menu |
290 | if (mouse.key&MOUSE_RIGHT) && (mouse.up) |
||
5591 | pavelyakov | 291 | { |
7786 | leency | 292 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
293 | if (getElementSelectedFlag(files.cur_y) == false) selected_count = 0; //on redraw selection would be flashed, see [L001] |
||
294 | EventShowListMenu(); |
||
295 | } |
||
296 | } |
||
297 | |||
298 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y-17) && (mouse.y |
||
299 | { |
||
7806 | leency | 300 | if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_dark,sc.work_light); |
7786 | leency | 301 | WHILE (mouse.lkm) && (files.first>0) |
5549 | punk_joker | 302 | { |
7786 | leency | 303 | pause(8); |
304 | files.first--; |
||
305 | List_ReDraw(); |
||
306 | mouse.get(); |
||
5575 | pavelyakov | 307 | } |
7806 | leency | 308 | DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_light,sc.work_dark); |
7786 | leency | 309 | } |
5591 | pavelyakov | 310 | |
7786 | leency | 311 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y+files.h-16) && (mouse.y |
312 | { |
||
7806 | leency | 313 | if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_dark,sc.work_light); |
7786 | leency | 314 | while (mouse.lkm) && (files.first |
5575 | pavelyakov | 315 | { |
7786 | leency | 316 | pause(8); |
317 | files.first++; |
||
318 | List_ReDraw(); |
||
319 | mouse.get(); |
||
5591 | pavelyakov | 320 | } |
7806 | leency | 321 | DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_light,sc.work_dark); |
7786 | leency | 322 | } |
5591 | pavelyakov | 323 | |
7786 | leency | 324 | //Scrooll |
8872 | leency | 325 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) |
326 | && (mouse.y |
||
8764 | leency | 327 | if (scroll_used) && (!mouse.key&MOUSE_LEFT) { scroll_used=false; Scroll(); } |
7786 | leency | 328 | |
329 | if (scroll_used) |
||
330 | { |
||
331 | 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 |
||
332 | id = files.first; |
||
333 | files.first = -sc_slider_h / 2 + mouse.y -files.y * files.count; |
||
334 | files.first /= files.h - 18; |
||
335 | if (files.visible+files.first>files.count) files.first=files.count-files.visible; |
||
336 | if (files.first<0) files.first=0; |
||
337 | if (id!=files.first) List_ReDraw(); |
||
338 | break; |
||
339 | } |
||
340 | |||
8854 | leency | 341 | if (efm) && (mouse.y > files.y) && (mouse.down) { |
8872 | leency | 342 | if (mouse.x |
343 | if (active_panel!=1) ChangeActivePanel(); |
||
8861 | leency | 344 | } else { |
8872 | leency | 345 | if (active_panel!=2) ChangeActivePanel(); |
3363 | leency | 346 | } |
7786 | leency | 347 | } |
348 | break; |
||
349 | //Button pressed----------------------------------------------------------------------------- |
||
350 | case evButton: |
||
8417 | leency | 351 | id = GetButtonID(); |
3363 | leency | 352 | |
8872 | leency | 353 | if (id==CLOSE_BTN) { |
354 | KillProcess(about_thread_id); |
||
355 | SaveIniSettings(); |
||
356 | ExitProcess(); |
||
357 | } |
||
358 | |||
359 | if (new_element_active) || (del_active) || (disk_popin_active_on_panel) { |
||
7878 | leency | 360 | if (POPUP_BTN1==id) && (del_active) EventDelete(); |
361 | if (POPUP_BTN1==id) && (new_element_active) NewElement(); |
||
362 | if (POPUP_BTN2==id) EventClosePopinForm(); |
||
8872 | leency | 363 | if (disk_popin_active_on_panel) { |
8868 | leency | 364 | if (id>=100) && (id<=120) EventDriveClick(id); |
365 | else EventClosePopinForm(); |
||
366 | } |
||
7786 | leency | 367 | break; |
368 | } |
||
5719 | leency | 369 | |
7786 | leency | 370 | switch(id) |
371 | { |
||
372 | case PATH_BTN: |
||
373 | notify(COPY_PATH_STR); |
||
374 | Clipboard__CopyText(#path); |
||
375 | break; |
||
8854 | leency | 376 | case KFM_DEV_DROPDOWN_1: |
377 | case KFM_DEV_DROPDOWN_1+1: |
||
8872 | leency | 378 | EventOpenDiskPopin(1); |
7786 | leency | 379 | break; |
8854 | leency | 380 | case KFM_DEV_DROPDOWN_2: |
381 | case KFM_DEV_DROPDOWN_2+1: |
||
8872 | leency | 382 | EventOpenDiskPopin(2); |
7786 | leency | 383 | break; |
8854 | leency | 384 | case BACK_BTN...PASTE_BTN: |
8872 | leency | 385 | if (active_panel==2) ChangeActivePanel(); |
8854 | leency | 386 | EventToolbarButtonClick(id); |
7786 | leency | 387 | break; |
8854 | leency | 388 | case BACK_BTN+100...PASTE_BTN+100: |
8872 | leency | 389 | if (active_panel==1) ChangeActivePanel(); |
8854 | leency | 390 | EventToolbarButtonClick(id-100); |
7786 | leency | 391 | break; |
392 | case 31...33: |
||
393 | EventSort(id-30); |
||
394 | break; |
||
7813 | leency | 395 | case 51: |
396 | EventShowBurgerMenu(); |
||
397 | break; |
||
398 | case 52...60: //Actions |
||
7786 | leency | 399 | FnProcess(id-50); |
400 | break; |
||
401 | case 61: // Set path as default |
||
402 | SetDefaultPath(#path); |
||
403 | break; |
||
404 | case 100...120: |
||
8854 | leency | 405 | EventDriveClick(id); |
7786 | leency | 406 | break; |
407 | case BREADCRUMB_ID...360: |
||
408 | ClickOnBreadCrumb(id-BREADCRUMB_ID); |
||
409 | break; |
||
410 | } |
||
411 | break; |
||
412 | |||
413 | //Key pressed----------------------------------------------------------------------------- |
||
414 | case evKey: |
||
415 | GetKeys(); |
||
7398 | leency | 416 | |
7786 | leency | 417 | if (Form.status_window>2) break; |
418 | |||
8872 | leency | 419 | if (new_element_active) || (del_active) || (disk_popin_active_on_panel) |
7786 | leency | 420 | { |
8861 | leency | 421 | if (key_scancode == SCAN_CODE_ESC) EventClosePopinForm(); |
422 | |||
8854 | leency | 423 | if (del_active) { |
7878 | leency | 424 | if (key_scancode == SCAN_CODE_ENTER) EventDelete(); |
7398 | leency | 425 | } |
8854 | leency | 426 | if (new_element_active) { |
7878 | leency | 427 | if (key_scancode == SCAN_CODE_ENTER) NewElement(); |
7786 | leency | 428 | EAX = key_editbox; |
429 | edit_box_key stdcall (#new_file_ed); |
||
430 | } |
||
431 | break; |
||
432 | } |
||
7398 | leency | 433 | |
8872 | leency | 434 | if (key_modifier&KEY_LALT) || (key_modifier&KEY_RALT) { |
435 | if (key_scancode == SCAN_CODE_F1) EventOpenDiskPopin(1); |
||
436 | if (key_scancode == SCAN_CODE_F2) EventOpenDiskPopin(2); |
||
437 | break; |
||
438 | } |
||
7989 | leency | 439 | if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) { |
8417 | leency | 440 | |
441 | if (key_scancode == SCAN_CODE_ENTER) { |
||
442 | EventOpenSelected(); |
||
443 | break; |
||
444 | } |
||
445 | |||
7993 | leency | 446 | old_cur_y = files.cur_y; |
447 | files.ProcessKey(key_scancode); |
||
448 | EventChooseFilesRange(old_cur_y, files.cur_y); |
||
7989 | leency | 449 | break; |
450 | } |
||
451 | |||
7786 | leency | 452 | if (files.ProcessKey(key_scancode)) |
453 | { |
||
454 | List_ReDraw(); |
||
455 | break; |
||
456 | } |
||
457 | |||
458 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) |
||
459 | { |
||
460 | switch(key_scancode) |
||
5591 | pavelyakov | 461 | { |
7786 | leency | 462 | case SCAN_CODE_F1...SCAN_CODE_F3: |
463 | EventSort(key_scancode - 58); |
||
7422 | leency | 464 | break; |
7786 | leency | 465 | case SCAN_CODE_1...SCAN_CODE_10: |
466 | key_scancode-=2; |
||
467 | if (key_scancode >= SystemDiscs.list.count) break; |
||
8861 | leency | 468 | if (!efm) { |
7786 | leency | 469 | DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click |
470 | pause(7); |
||
5591 | pavelyakov | 471 | } |
7786 | leency | 472 | SystemDiscs.Click(key_scancode); |
5591 | pavelyakov | 473 | break; |
7786 | leency | 474 | case SCAN_CODE_KEY_X: |
8861 | leency | 475 | CopyFilesListToClipboard(CUT); |
7786 | leency | 476 | break; |
477 | case SCAN_CODE_KEY_C: |
||
8861 | leency | 478 | CopyFilesListToClipboard(COPY); |
3363 | leency | 479 | break; |
7813 | leency | 480 | case SCAN_CODE_KEY_G: |
481 | EventOpenConsoleHere(); |
||
482 | break; |
||
7786 | leency | 483 | case SCAN_CODE_KEY_V: |
8854 | leency | 484 | EventPaste(#path); |
3363 | leency | 485 | break; |
7786 | leency | 486 | case SCAN_CODE_KEY_D: //set image as bg |
487 | strlcpy(#temp, "\\S__",4); |
||
488 | strcat(#temp, #file_path); |
||
489 | RunProgram("/sys/media/kiv", #temp); |
||
5512 | punk_joker | 490 | break; |
7813 | leency | 491 | case SCAN_CODE_KEY_N: |
492 | EventOpenNewEolite(); |
||
7786 | leency | 493 | break; |
8854 | leency | 494 | case SCAN_CODE_KEY_R: |
495 | EventRefresh(); |
||
496 | break; |
||
7786 | leency | 497 | case SCAN_CODE_ENTER: |
498 | if (!itdir) ShowOpenWithDialog(); |
||
8417 | leency | 499 | else EventOpen(1); |
5512 | punk_joker | 500 | break; |
7786 | leency | 501 | case SCAN_CODE_KEY_A: |
7993 | leency | 502 | EventChooseAllFiles(true); |
7386 | pavelyakov | 503 | break; |
7786 | leency | 504 | case SCAN_CODE_KEY_U: //unselect all files |
7993 | leency | 505 | EventChooseAllFiles(false); |
7786 | leency | 506 | break; |
5591 | pavelyakov | 507 | } |
508 | break; |
||
7786 | leency | 509 | } |
5698 | leency | 510 | |
7786 | leency | 511 | switch (key_scancode) |
512 | { |
||
513 | case SCAN_CODE_BS: |
||
514 | Dir_Up(); |
||
515 | break; |
||
516 | case SCAN_CODE_ENTER: |
||
8417 | leency | 517 | EventOpen(0); |
7786 | leency | 518 | break; |
519 | case SCAN_CODE_TAB: |
||
8854 | leency | 520 | if (!efm) break; |
7786 | leency | 521 | ChangeActivePanel(); |
522 | break; |
||
523 | case SCAN_CODE_MENU: |
||
524 | mouse.x = files.x+15; |
||
525 | mouse.y = files.cur_y - files.first * files.item_h + files.y + 5; |
||
526 | EventShowListMenu(); |
||
527 | break; |
||
528 | case SCAN_CODE_DEL: |
||
529 | Del_Form(); |
||
530 | break; |
||
8872 | leency | 531 | case SCAN_CODE_SPACE: |
532 | EventChooseFile(files.cur_y); |
||
533 | DrawStatusBar(); |
||
534 | Line_ReDraw(col.selec, files.cur_y); |
||
535 | break; |
||
7786 | leency | 536 | case SCAN_CODE_INS: |
7989 | leency | 537 | EventChooseFile(files.cur_y); |
7786 | leency | 538 | files.KeyDown(); |
7999 | leency | 539 | DrawStatusBar(); |
7786 | leency | 540 | List_ReDraw(); |
541 | break; |
||
8780 | leency | 542 | case SCAN_CODE_F1...SCAN_CODE_F10: |
7786 | leency | 543 | FnProcess(key_scancode-58); |
544 | break; |
||
545 | default: |
||
546 | EventSelectFileByKeyPress(); |
||
547 | } |
||
8861 | leency | 548 | break; |
7786 | leency | 549 | case evIPC: |
550 | case evReDraw: |
||
551 | draw_window(); |
||
552 | if (CheckActiveProcess(Form.ID)) && (GetMenuClick()) break; |
||
8861 | leency | 553 | if (action_buf==OPERATION_END) { |
8854 | leency | 554 | EventRefresh(); |
7786 | leency | 555 | action_buf=0; |
556 | } |
||
8861 | leency | 557 | break; |
7786 | leency | 558 | default: |
8861 | leency | 559 | if (Form.status_window<=2) EventRefreshDisksAndFolders(); |
8872 | leency | 560 | //sprintf(#param, "/tmp0/1/%i", random(99999)); //for testing purpose |
561 | //CreateFile(0, 0, #param); |
||
5576 | pavelyakov | 562 | } |
7786 | leency | 563 | |
564 | if(cmd_free) |
||
565 | { |
||
566 | if(cmd_free==2) about_stak=free(about_stak); |
||
567 | else if(cmd_free==3) properties_stak=free(properties_stak); |
||
568 | else if(cmd_free==4) settings_stak=free(settings_stak); |
||
569 | cmd_free = false; |
||
570 | } |
||
3363 | leency | 571 | } |
572 | |||
3444 | leency | 573 | void draw_window() |
574 | { |
||
8854 | leency | 575 | dword i=0; |
8764 | leency | 576 | incn x; |
8854 | leency | 577 | dword title; |
8872 | leency | 578 | if (show_status_bar.checked) { |
579 | status_bar_h = STATUS_BAR_H; |
||
580 | } else { |
||
581 | status_bar_h = 0; |
||
582 | } |
||
8861 | leency | 583 | if (efm) title = TITLE_KFM; else title = TITLE_EOLITE; |
8854 | leency | 584 | DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,title,0); |
3444 | leency | 585 | GetProcessInfo(#Form, SelfInfo); |
586 | if (Form.status_window>2) return; |
||
8854 | leency | 587 | if (Form.height < 356) { MoveSize(OLD,OLD,OLD,356); return; } |
7490 | leency | 588 | GetProcessInfo(#Form, SelfInfo); |
7635 | leency | 589 | SetAppColors(); |
8854 | leency | 590 | if (efm) { |
591 | if (screen.width > 693) && (Form.width < 693) { MoveSize(OLD,OLD,693,OLD); return; } |
||
8764 | leency | 592 | DrawBar(0, 0, Form.cwidth, 34, sc.work); |
593 | #define PAD 7 |
||
594 | #define GAP_S 26+5 |
||
595 | #define GAP_B 26+14 |
||
8854 | leency | 596 | x.set(Form.cwidth/2-DDW-203/2-GAP_S); |
597 | while (i<200) { |
||
598 | DrawTopPanelButton(i+BACK_BTN, x.inc(GAP_S), PAD, 30, false); |
||
599 | DrawTopPanelButton(i+FWRD_BTN, x.inc(GAP_S), PAD, 31, false); |
||
600 | DrawTopPanelButton(i+GOUP_BTN, x.inc(GAP_B), PAD, 01, false); |
||
601 | DrawTopPanelButton(i+COPY_BTN, x.inc(GAP_B), PAD, 55, false); |
||
602 | DrawTopPanelButton(i+CUT_BTN, x.inc(GAP_S), PAD, 20, false); |
||
603 | DrawTopPanelButton(i+PASTE_BTN,x.inc(GAP_S), PAD, 56, false); |
||
604 | x.set(Form.cwidth/2-DDW-203/2-GAP_S+calc(Form.cwidth/2)); |
||
605 | i+=100; |
||
606 | } |
||
607 | //DrawTopPanelButton(51, Form.cwidth-GAP_S-PAD, PAD, -1, false); //burger menu |
||
8764 | leency | 608 | } else { |
609 | if (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; } |
||
610 | ESDWORD[#toolbar_pal] = sc.work; |
||
611 | ESDWORD[#toolbar_pal+4] = MixColors(0, sc.work, 35); |
||
612 | PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal); |
||
8861 | leency | 613 | for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,BACK_BTN+i); |
614 | for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i], 5,31, 29, BACK_BTN+i); |
||
8764 | leency | 615 | DrawBar(127, 8, 1, 25, sc.work_graph); |
616 | DrawBar(246,0, Form.cwidth - 246, 34, sc.work); |
||
617 | DrawDot(Form.cwidth-17,12); |
||
618 | DrawDot(Form.cwidth-17,12+6); |
||
619 | DrawDot(Form.cwidth-17,12+12); |
||
620 | DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots |
||
621 | } |
||
3434 | leency | 622 | //main rectangles |
7806 | leency | 623 | DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,sc.work_graph); |
7634 | leency | 624 | DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg |
7806 | leency | 625 | for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10)); |
7819 | leency | 626 | for (i=0; i<6; i++) DrawBar(0, 5-i, Form.cwidth, 1, MixColors(sc.work_light, sc.work, i*10)); |
5733 | leency | 627 | llist_copy(#files_active, #files); |
5723 | leency | 628 | strcpy(#active_path, #path); |
6564 | leency | 629 | DrawStatusBar(); |
7993 | leency | 630 | if (!selected_count) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] |
5723 | leency | 631 | DrawFilePanels(); |
8872 | leency | 632 | disk_popin_active_on_panel = 0; |
5723 | leency | 633 | } |
634 | |||
8872 | leency | 635 | void DrawButtonsAroundList() |
5723 | leency | 636 | { |
5733 | leency | 637 | word sorting_arrow_x; |
7490 | leency | 638 | dword sorting_arrow_t = "\x19"; |
639 | if (sort_desc) sorting_arrow_t = "\x18"; |
||
8764 | leency | 640 | DrawFlatButtonSmall(files.x - efm, files.y-17,files.w-141+efm,16,31,T_FILE); |
6678 | leency | 641 | DrawFlatButtonSmall(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE); |
642 | DrawFlatButtonSmall(files.x + files.w - 68, files.y-17,68,16,33,T_SIZE); |
||
643 | DrawFlatButtonSmall(files.x + files.w, files.y-17,16,16, 0,"\x18"); |
||
644 | DrawFlatButtonSmall(files.x + files.w,files.y+files.h-16,16,16,0,"\x19"); |
||
7490 | leency | 645 | if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18; |
646 | if (sort_type==2) sorting_arrow_x = files.x + files.w - 90; |
||
647 | if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
||
7806 | leency | 648 | WriteText(sorting_arrow_x,files.y-12,0x80, sc.work_text, sorting_arrow_t); |
649 | DrawBar(files.x+files.w,files.y,1,files.h,sc.work_graph); |
||
8854 | leency | 650 | if (efm) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,sc.work_graph); |
5723 | leency | 651 | } |
652 | |||
6404 | punk_joker | 653 | void DrawStatusBar() |
654 | { |
||
6572 | leency | 655 | char status_bar_str[80]; |
6570 | leency | 656 | int go_up_folder_exists=0; |
8854 | leency | 657 | |
658 | if (efm) { |
||
659 | DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, sc.work); |
||
660 | WriteTextCenter(0,Form.cheight - 12, Form.cwidth,sc.work_text,T_KFM_FUNC); |
||
661 | return; |
||
662 | } |
||
663 | |||
7244 | leency | 664 | if (!show_status_bar.checked) return; |
7972 | leency | 665 | if (files.count>0) && (streq(items.get(0)*304+buf+72,"..")) go_up_folder_exists=1; |
7806 | leency | 666 | DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, sc.work); |
7804 | leency | 667 | sprintf(#status_bar_str, T_STATUS_EVEMENTS, count_dir-go_up_folder_exists, files.count-count_dir); |
7806 | leency | 668 | WriteText(6,Form.cheight - 13,0x80,sc.work_text,#status_bar_str); |
7804 | leency | 669 | if (selected_count) { |
670 | sprintf(#status_bar_str, T_STATUS_SELECTED, selected_count); |
||
671 | WriteText(Form.cwidth - calc(strlen(#status_bar_str)*6)-6,Form.cheight - 13, |
||
7806 | leency | 672 | 0x80,sc.work_text,#status_bar_str); |
7804 | leency | 673 | } |
6404 | punk_joker | 674 | } |
675 | |||
5723 | leency | 676 | void DrawFilePanels() |
677 | { |
||
6034 | leency | 678 | int files_y; |
8826 | leency | 679 | int w2 = -Form.cwidth-1/2+Form.cwidth; |
680 | int h2; |
||
8854 | leency | 681 | if (!efm) |
5698 | leency | 682 | { |
5723 | leency | 683 | DrawDeviceAndActionsLeftPanel(); |
6564 | leency | 684 | files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h); |
8872 | leency | 685 | DrawButtonsAroundList(); |
686 | List_ReDraw(); |
||
5698 | leency | 687 | } |
688 | else |
||
689 | { |
||
5733 | leency | 690 | llist_copy(#files, #files_inactive); |
691 | strcpy(#path, #inactive_path); |
||
6034 | leency | 692 | files_y = files.y; |
8826 | leency | 693 | h2 = Form.cheight-files_y-2 - status_bar_h; |
8872 | leency | 694 | col.selec = col.selec_inactive; //this is a bad code: need to use some var to set inactive panel for DrawButtonsAroundList(); |
5733 | leency | 695 | |
5719 | leency | 696 | if (active_panel==1) |
697 | { |
||
8826 | leency | 698 | files.SetSizes(Form.cwidth/2, files_y, w2-17, h2, files.item_h); |
8872 | leency | 699 | DrawButtonsAroundList(); |
5733 | leency | 700 | Open_Dir(#path,WITH_REDRAW); |
701 | llist_copy(#files, #files_active); |
||
5719 | leency | 702 | strcpy(#path, #active_path); |
7634 | leency | 703 | col.selec = col.selec_active; |
8826 | leency | 704 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h); |
8872 | leency | 705 | DrawButtonsAroundList(); |
5733 | leency | 706 | Open_Dir(#path,WITH_REDRAW); |
5719 | leency | 707 | } |
708 | if (active_panel==2) |
||
709 | { |
||
8826 | leency | 710 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h); |
8872 | leency | 711 | DrawButtonsAroundList(); |
5733 | leency | 712 | Open_Dir(#path,WITH_REDRAW); |
713 | llist_copy(#files, #files_active); |
||
5719 | leency | 714 | strcpy(#path, #active_path); |
7634 | leency | 715 | col.selec = col.selec_active; |
8826 | leency | 716 | files.SetSizes(Form.cwidth/2, files_y, w2 -17, h2, files.item_h); |
8872 | leency | 717 | DrawButtonsAroundList(); |
5733 | leency | 718 | Open_Dir(#path,WITH_REDRAW); |
5719 | leency | 719 | } |
5698 | leency | 720 | } |
3363 | leency | 721 | } |
722 | |||
5694 | leency | 723 | void List_ReDraw() |
3363 | leency | 724 | { |
5719 | leency | 725 | int all_lines_h; |
7422 | leency | 726 | dword j; |
5825 | leency | 727 | static int old_cur_y, old_first; |
8779 | leency | 728 | dword separator_color; |
3363 | leency | 729 | |
5694 | leency | 730 | files.CheckDoesValuesOkey(); //prevent some shit |
8872 | leency | 731 | if (files.count < files.visible) files.visible = files.count; |
3363 | leency | 732 | |
5694 | leency | 733 | if (list_full_redraw) || (old_first != files.first) |
3363 | leency | 734 | { |
5825 | leency | 735 | old_cur_y = files.cur_y; |
5694 | leency | 736 | old_first = files.first; |
737 | list_full_redraw = false; |
||
738 | goto _ALL_LIST_REDRAW; |
||
3363 | leency | 739 | } |
5825 | leency | 740 | if (old_cur_y != files.cur_y) |
3363 | leency | 741 | { |
7634 | leency | 742 | if (old_cur_y-files.first |
743 | Line_ReDraw(col.selec, files.cur_y-files.first); |
||
5825 | leency | 744 | old_cur_y = files.cur_y; |
5694 | leency | 745 | return; |
3363 | leency | 746 | } |
747 | |||
5694 | leency | 748 | _ALL_LIST_REDRAW: |
3363 | leency | 749 | |
7634 | leency | 750 | for (j=0; j |
751 | if (files.cur_y-files.first!=j) Line_ReDraw(col.list_bg, j); |
||
752 | else Line_ReDraw(col.selec, files.cur_y-files.first); |
||
753 | } |
||
3434 | leency | 754 | //in the bottom |
5825 | leency | 755 | all_lines_h = j * files.item_h; |
7634 | leency | 756 | DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h, col.list_bg); |
8779 | leency | 757 | if (colored_lines.checked) separator_color = col.list_bg; else separator_color = col.list_vert_line; |
758 | DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h, separator_color); |
||
759 | DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h, separator_color); |
||
3434 | leency | 760 | Scroll(); |
7398 | leency | 761 | |
762 | if (del_active) Del_Form(); |
||
7634 | leency | 763 | if (new_element_active) && (col.selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name); |
3363 | leency | 764 | } |
765 | |||
7628 | leency | 766 | bool file_name_is_8_3(dword name) |
767 | { |
||
768 | int name_len = strlen(name); |
||
769 | int dot_pos = strrchr(name, '.'); |
||
770 | if (name_len<=12) |
||
771 | { |
||
772 | if (dot_pos) { |
||
773 | if (name_len - dot_pos > 3) return false; |
||
774 | } |
||
775 | else { |
||
776 | if (name_len>8) return false; |
||
777 | } |
||
778 | return true; |
||
779 | } |
||
780 | return false; |
||
781 | } |
||
3444 | leency | 782 | |
5761 | leency | 783 | void Line_ReDraw(dword bgcol, filenum){ |
7634 | leency | 784 | dword text_col=col.list_gb_text, |
5991 | leency | 785 | ext1, attr, |
786 | file_offet, |
||
787 | file_name_off, |
||
7515 | leency | 788 | file_size=0, |
6290 | leency | 789 | y=filenum*files.item_h+files.y, |
8762 | leency | 790 | icon_y = files.item_h-icon_size/2+y; |
5991 | leency | 791 | BDVK file; |
7921 | leency | 792 | char full_path[4096]; |
8779 | leency | 793 | dword separator_color; |
5996 | leency | 794 | char label_file_name[4096]; |
4859 | leency | 795 | if (filenum==-1) return; |
8779 | leency | 796 | |
7054 | leency | 797 | DrawBar(files.x,y,4,files.item_h,bgcol); |
7197 | leency | 798 | DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol); |
799 | 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); |
||
8779 | leency | 800 | if (colored_lines.checked) { |
801 | if (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line; |
||
802 | separator_color = bgcol; |
||
803 | } else { |
||
804 | separator_color = col.list_vert_line; |
||
805 | } |
||
7422 | leency | 806 | DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol); |
8779 | leency | 807 | DrawBar(files.x+files.w-141,y,1,files.item_h, separator_color); |
808 | DrawBar(files.x+files.w-68,y,1,files.item_h, separator_color); |
||
3363 | leency | 809 | |
7972 | leency | 810 | file_offet = items.get(filenum+files.first)*304 + buf+32; |
5487 | leency | 811 | attr = ESDWORD[file_offet]; |
4897 | leency | 812 | file.selected = ESBYTE[file_offet+7]; |
813 | file.sizelo = ESDWORD[file_offet+32]; |
||
6987 | leency | 814 | file.sizehi = ESDWORD[file_offet+36]; |
4897 | leency | 815 | file_name_off = file_offet+40; |
3363 | leency | 816 | |
5487 | leency | 817 | if (! TestBit(attr, 4) ) //file or folder? |
3363 | leency | 818 | { |
5698 | leency | 819 | ext1 = strrchr(file_name_off,'.') + file_name_off; |
7515 | leency | 820 | if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing |
821 | file_size = ConvertSize64(file.sizelo, file.sizehi); |
||
7634 | leency | 822 | if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); |
3363 | leency | 823 | } |
824 | else |
||
4846 | leency | 825 | { |
7149 | leency | 826 | if (!strcmp(file_name_off,"..")) ext1=" |
6278 | leency | 827 | ext1=" |
7634 | leency | 828 | WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); |
6278 | leency | 829 | } |
8276 | leency | 830 | if (chrnum(#path, '/')==1) && (streq(#path, "/kolibrios")==false) file_size = GetDeviceSizeLabel(#full_path); |
4846 | leency | 831 | } |
7515 | leency | 832 | if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58, |
7634 | leency | 833 | files.text_y+y+1, files.font_type, col.list_gb_text, file_size); |
4846 | leency | 834 | |
7634 | leency | 835 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=col.list_text_hidden; //system or hiden? |
836 | if (bgcol==col.selec) |
||
3363 | leency | 837 | { |
7628 | leency | 838 | file_name_is_8_3(file_name_off); |
5487 | leency | 839 | itdir = TestBit(attr, 4); |
4897 | leency | 840 | strcpy(#file_name, file_name_off); |
6635 | leency | 841 | if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off); |
842 | else sprintf(#file_path,"%s/%s",#path,file_name_off); |
||
7634 | leency | 843 | if (text_col==col.list_text_hidden) { |
844 | text_col=MixColors(col.selec_text, col.list_text_hidden, 65); |
||
845 | } else text_col=col.selec_text; |
||
3363 | leency | 846 | } |
4897 | leency | 847 | if (file.selected) text_col=0xFF0000; |
6806 | leency | 848 | if (kfont.size.pt==9) || (!kfont.font) |
3434 | leency | 849 | { |
5745 | leency | 850 | if (Form.width>=480) |
851 | { |
||
8789 | leency | 852 | FileShow.start_x = files.x + icon_size + 7; |
5745 | leency | 853 | FileShow.font_color = text_col; |
854 | FileShow.area_size_x = files.w - 164; |
||
855 | FileShow.text_pointer = file_name_off; |
||
7004 | leency | 856 | FileShow.start_y = files.text_y + y - 3; |
5745 | leency | 857 | PathShow_prepare stdcall(#FileShow); |
858 | PathShow_draw stdcall(#FileShow); |
||
859 | } |
||
3434 | leency | 860 | } |
5745 | leency | 861 | else |
862 | { |
||
5996 | leency | 863 | strcpy(#label_file_name, file_name_off); |
6806 | leency | 864 | if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) |
5996 | leency | 865 | { |
6806 | leency | 866 | while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) { |
5996 | leency | 867 | ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL; |
868 | } |
||
869 | strcpy(#label_file_name+strlen(#label_file_name)-2, "..."); |
||
870 | } |
||
7634 | leency | 871 | kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, |
872 | bgcol, text_col, kfont.size.pt, #label_file_name); |
||
5745 | leency | 873 | } |
8854 | leency | 874 | if (bgcol == col.selec_inactive) DrawWideRectangle(files.x+2, y, files.w-4, files.item_h, 2, col.selec_active); |
8821 | leency | 875 | |
876 | sprintf(#full_path,"%s/%s",#path,file_name_off); |
||
8779 | leency | 877 | DrawIconByExtension(#full_path, ext1, files.x+4, icon_y, bgcol); |
3363 | leency | 878 | } |
879 | |||
880 | |||
3444 | leency | 881 | void Open_Dir(dword dir_path, redraw){ |
8868 | leency | 882 | int errornum; |
8872 | leency | 883 | |
884 | selected_count = 0; |
||
885 | if (buf) free(buf); |
||
886 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
||
887 | if (errornum) |
||
3363 | leency | 888 | { |
8872 | leency | 889 | history.add(#path); |
890 | EventHistoryGoBack(); |
||
891 | Write_Error(errornum); |
||
892 | return; |
||
3363 | leency | 893 | } |
8872 | leency | 894 | if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0; |
895 | |||
3444 | leency | 896 | if (files.count!=-1) |
3363 | leency | 897 | { |
8854 | leency | 898 | if(!_not_draw) DrawPathBar(); |
6021 | leency | 899 | history.add(#path); |
6034 | leency | 900 | SystemDiscs.Draw(); |
5825 | leency | 901 | files.visible = files.h / files.item_h; |
5591 | pavelyakov | 902 | if (files.count < files.visible) files.visible = files.count; |
8868 | leency | 903 | if (!strncmp(dir_path, "/rd/1/",5)) || (!strncmp(dir_path, "/sys/",4)) |
7628 | leency | 904 | dir_at_fat16 = true; else dir_at_fat16 = false; |
8872 | leency | 905 | Sorting(); |
5694 | leency | 906 | list_full_redraw = true; |
6564 | leency | 907 | if (redraw!=ONLY_OPEN)&&(!_not_draw) {DrawStatusBar(); List_ReDraw();} |
6570 | leency | 908 | SetCurDir(dir_path); |
3363 | leency | 909 | } |
5694 | leency | 910 | if (files.count==-1) && (redraw!=ONLY_OPEN) |
911 | { |
||
912 | files.KeyHome(); |
||
6564 | leency | 913 | if(!_not_draw) { list_full_redraw=true; DrawStatusBar(); List_ReDraw(); } |
5694 | leency | 914 | } |
3363 | leency | 915 | } |
916 | |||
917 | inline Sorting() |
||
918 | { |
||
7490 | leency | 919 | dword d=0, f=1; |
7422 | leency | 920 | int j=0; |
4897 | leency | 921 | dword file_off; |
7422 | leency | 922 | |
7972 | leency | 923 | items.drop(); |
924 | |||
6604 | leency | 925 | if (!strcmp(#path,"/")) //do not sort root folder |
3363 | leency | 926 | { |
7972 | leency | 927 | for(d=1;d |
7490 | leency | 928 | count_dir = d; |
3363 | leency | 929 | return; |
930 | } |
||
5591 | pavelyakov | 931 | for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders |
3363 | leency | 932 | { |
7628 | leency | 933 | if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40); |
4897 | leency | 934 | if (TestBit(ESDWORD[file_off],4)) //directory? |
3363 | leency | 935 | { |
7972 | leency | 936 | items.set(d, j); |
7490 | leency | 937 | d++; |
3363 | leency | 938 | } |
939 | else |
||
940 | { |
||
7972 | leency | 941 | items.set(files.count-f, j); |
7490 | leency | 942 | f++; |
3363 | leency | 943 | } |
944 | } |
||
7490 | leency | 945 | count_dir = d; |
3434 | leency | 946 | //sorting: files first, then folders |
7490 | leency | 947 | Sort_by_Name(0,d-1); |
948 | if (sort_type==1) Sort_by_Name(d,files.count-1); |
||
949 | else if (sort_type==2) Sort_by_Type(d,files.count-1); |
||
950 | else if (sort_type==3) Sort_by_Size(d,files.count-1); |
||
951 | //reversed sorting |
||
952 | if (sort_desc) { |
||
7972 | leency | 953 | for (j=0; j |
954 | items.swap(files.count-j-1, d+j); |
||
955 | } |
||
956 | //if (sort_type==1) for (j=0; j |
||
7490 | leency | 957 | } |
5581 | leency | 958 | //make ".." first item in list |
7972 | leency | 959 | if (d>0) && (strncmp(items.get(0)*304+buf+72,"..",2)!=0) |
960 | for(d--; d>0; d--;) if (!strncmp(items.get(d)*304+buf+72,"..",2)) {items.swap(d,0); break;} |
||
3363 | leency | 961 | } |
962 | |||
963 | |||
964 | void Del_Form() |
||
965 | { |
||
5512 | punk_joker | 966 | byte f_count[128]; |
5581 | leency | 967 | int dform_x = files.w - 220 / 2 + files.x; |
7993 | leency | 968 | if (!selected_count) && (!strncmp(#file_name,"..",2)) return; |
3991 | leency | 969 | else |
970 | { |
||
4002 | leency | 971 | if (!files.count) return; |
6008 | leency | 972 | DrawEolitePopup(T_YES, T_NO); |
7806 | leency | 973 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,sc.work_text,T_DELETE_FILE); |
6278 | leency | 974 | if (selected_count) |
5512 | punk_joker | 975 | { |
6278 | leency | 976 | sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2); |
7806 | leency | 977 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count); |
5512 | punk_joker | 978 | } |
4002 | leency | 979 | else |
980 | { |
||
5591 | pavelyakov | 981 | if (strlen(#file_name)<28) |
5512 | punk_joker | 982 | { |
7806 | leency | 983 | WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?"); |
984 | WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name); |
||
5512 | punk_joker | 985 | } |
986 | else |
||
987 | { |
||
988 | WriteText(164+dform_x,190,0x80,0,"...?"); |
||
989 | ESI = 24; |
||
990 | WriteText(dform_x+20,190,0,0,#file_name); |
||
991 | } |
||
6008 | leency | 992 | } |
4002 | leency | 993 | del_active=1; |
3991 | leency | 994 | } |
3363 | leency | 995 | } |
996 | |||
5694 | leency | 997 | void SelectFileByName(dword that_file) |
3363 | leency | 998 | { |
5694 | leency | 999 | int ind; |
1000 | files.KeyHome(); |
||
5991 | leency | 1001 | Open_Dir(#path,ONLY_OPEN); |
7628 | leency | 1002 | if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file); |
8392 | leency | 1003 | for (ind=files.count-1; ind>=0; ind--;) { if (!strcmpi(items.get(ind)*304+buf+72,that_file)) break; } |
5825 | leency | 1004 | files.cur_y = ind - 1; |
5694 | leency | 1005 | files.KeyDown(); |
6570 | leency | 1006 | DrawStatusBar(); |
3363 | leency | 1007 | List_ReDraw(); |
1008 | } |
||
1009 | |||
1010 | |||
1011 | void Dir_Up() |
||
1012 | { |
||
7422 | leency | 1013 | int iii; |
6635 | leency | 1014 | char old_folder_name[4096]; |
7422 | leency | 1015 | iii=strlen(#path)-1; |
1016 | if (iii==0) return; |
||
1017 | iii = strrchr(#path, '/'); |
||
1018 | strcpy(#old_folder_name, #path+iii); |
||
1019 | if (iii>1) path[iii-1]=NULL; else path[iii]=NULL; |
||
6635 | leency | 1020 | SelectFileByName(#old_folder_name); |
3363 | leency | 1021 | } |
1022 | |||
8417 | leency | 1023 | void EventOpenSelected() |
3434 | leency | 1024 | { |
8417 | leency | 1025 | int i; |
1026 | for (i=0; i |
||
1027 | EDX = items.get(i)*304 + buf+32; |
||
1028 | if (TestBit(ESDWORD[EDX], 4)) continue; //is foder |
||
1029 | sprintf(#param,"%s/%s",#path, EDX+40); |
||
1030 | RunProgram("/sys/@open", #param); |
||
1031 | } |
||
1032 | } |
||
1033 | |||
1034 | void EventOpen(byte _new_window) |
||
1035 | { |
||
1036 | if (selected_count) && (!itdir) notify(T_USE_SHIFT_ENTER); |
||
1037 | if (_new_window) |
||
5443 | punk_joker | 1038 | { |
8417 | leency | 1039 | if (streq(#file_name,"..")) return; |
1040 | RunProgram(I_Path, #file_path); |
||
5443 | punk_joker | 1041 | return; |
1042 | } |
||
3444 | leency | 1043 | if (!files.count) return; |
3441 | leency | 1044 | if (!itdir) |
3434 | leency | 1045 | { |
5401 | leency | 1046 | if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path); |
3434 | leency | 1047 | } |
1048 | else |
||
1049 | { |
||
5606 | pavelyakov | 1050 | if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; } |
3434 | leency | 1051 | strcpy(#path, #file_path); |
5825 | leency | 1052 | files.first=files.cur_y=0; |
3444 | leency | 1053 | Open_Dir(#path,WITH_REDRAW); |
3434 | leency | 1054 | } |
1055 | } |
||
3363 | leency | 1056 | |
7786 | leency | 1057 | inline fastcall void EventHistoryGoBack() |
3363 | leency | 1058 | { |
1059 | char cur_folder[4096]; |
||
5974 | leency | 1060 | strcpy(#cur_folder, #path); |
6021 | leency | 1061 | if (history.back()) { |
1062 | strcpy(#path, history.current()); |
||
5977 | leency | 1063 | SelectFileByName(#cur_folder+strrchr(#cur_folder,'/')); |
1064 | } |
||
3363 | leency | 1065 | } |
1066 | |||
5397 | punk_joker | 1067 | void ShowOpenWithDialog() |
1068 | { |
||
6930 | leency | 1069 | byte open_param[4097]; |
1070 | sprintf(#open_param,"~%s",#file_path); |
||
1071 | RunProgram("/sys/@open", #open_param); |
||
5397 | punk_joker | 1072 | } |
1073 | |||
7878 | leency | 1074 | void NewElement() |
5555 | punk_joker | 1075 | { |
5557 | punk_joker | 1076 | BDVK element_info; |
8868 | leency | 1077 | byte copy_result, info_result; |
7878 | leency | 1078 | |
1079 | sprintf(#temp,"%s/%s",#path,new_file_ed.text); |
||
1080 | info_result = GetFileInfo(#temp, #element_info); |
||
1081 | switch(new_element_active) |
||
5555 | punk_joker | 1082 | { |
7878 | leency | 1083 | case CREATE_FILE: |
8750 | leency | 1084 | if (info_result!=5) { |
1085 | notify(FS_ITEM_ALREADY_EXISTS); |
||
1086 | } else { |
||
7878 | leency | 1087 | CreateFile(0, 0, #temp); |
1088 | if (EAX) |
||
5557 | punk_joker | 1089 | { |
7878 | leency | 1090 | if (EAX==5) notify(NOT_CREATE_FILE); |
1091 | else Write_Error(EAX); |
||
5557 | punk_joker | 1092 | } |
7878 | leency | 1093 | } |
1094 | break; |
||
1095 | case CREATE_FOLDER: |
||
8750 | leency | 1096 | if (info_result!=5) { |
1097 | notify(FS_ITEM_ALREADY_EXISTS); |
||
1098 | } else { |
||
7878 | leency | 1099 | CreateDir(#temp); |
1100 | if (EAX) |
||
5557 | punk_joker | 1101 | { |
7878 | leency | 1102 | if (EAX==5) notify(NOT_CREATE_FOLDER); |
1103 | else Write_Error(EAX); |
||
5557 | punk_joker | 1104 | } |
7878 | leency | 1105 | } |
1106 | break; |
||
1107 | case RENAME_ITEM: |
||
8750 | leency | 1108 | if (info_result!=5) { |
1109 | notify(FS_ITEM_ALREADY_EXISTS); |
||
1110 | } else { |
||
8751 | leency | 1111 | if (RenameMove(new_file_ed.text, #file_path)) |
5571 | punk_joker | 1112 | { |
8750 | leency | 1113 | if (itdir) { |
1114 | notify("'Error renaming folder' -E"); |
||
7878 | leency | 1115 | return; |
8750 | leency | 1116 | } else { |
1117 | if (copy_result = CopyFile(#file_path,#temp)) { |
||
1118 | Write_Error(copy_result); |
||
1119 | } else { |
||
1120 | DeleteFile(#file_path); |
||
1121 | SelectFileByName(new_file_ed.text); |
||
1122 | } |
||
5571 | punk_joker | 1123 | } |
1124 | } |
||
7878 | leency | 1125 | } |
5555 | punk_joker | 1126 | } |
5557 | punk_joker | 1127 | Open_Dir(#path,WITH_REDRAW); |
7878 | leency | 1128 | SelectFileByName(new_file_ed.text); |
1129 | EventClosePopinForm(); |
||
5555 | punk_joker | 1130 | } |
1131 | |||
5571 | punk_joker | 1132 | void NewElement_Form(byte crt, dword strng) |
5555 | punk_joker | 1133 | { |
1134 | int dform_x=files.w-220/2+files.x; |
||
5557 | punk_joker | 1135 | if (!new_element_active) |
5555 | punk_joker | 1136 | { |
5557 | punk_joker | 1137 | new_element_active = crt; |
8334 | leency | 1138 | edit_box_set_text stdcall (#new_file_ed, strng); |
5555 | punk_joker | 1139 | } |
6008 | leency | 1140 | if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL); |
1141 | else DrawEolitePopup(T_CREATE, T_CANCEL); |
||
6678 | leency | 1142 | new_file_ed.left = dform_x+10; |
6278 | leency | 1143 | DrawEditBox(#new_file_ed); |
5555 | punk_joker | 1144 | } |
1145 | |||
8780 | leency | 1146 | void EventShowAbout() |
1147 | { |
||
1148 | if (!active_about) { |
||
1149 | about_stak = malloc(4096); |
||
1150 | about_thread_id = CreateThread(#about_dialog,about_stak+4092); |
||
1151 | } else { |
||
1152 | ActivateWindow(GetProcessSlot(about_thread_id)); |
||
1153 | } |
||
1154 | } |
||
1155 | |||
5576 | pavelyakov | 1156 | void FnProcess(byte N) |
3434 | leency | 1157 | { |
1158 | switch(N) |
||
1159 | { |
||
1160 | case 1: |
||
8780 | leency | 1161 | EventShowProperties(); |
3434 | leency | 1162 | break; |
1163 | case 2: |
||
7786 | leency | 1164 | if (files.count) NewElement_Form(RENAME_ITEM, #file_name); |
3434 | leency | 1165 | break; |
1166 | case 3: |
||
8780 | leency | 1167 | if (files.count) && (!itdir) RunProgram("/sys/quark", #file_path); |
3434 | leency | 1168 | break; |
1169 | case 4: |
||
8780 | leency | 1170 | if (files.count) && (!itdir) RunProgram("/sys/develop/cedit", #file_path); |
3434 | leency | 1171 | break; |
8854 | leency | 1172 | case 5: |
1173 | if (efm) { |
||
8861 | leency | 1174 | CopyFilesListToClipboard(COPY); |
8854 | leency | 1175 | EventPaste(#inactive_path); |
8779 | leency | 1176 | } else { |
8854 | leency | 1177 | EventRefresh(); |
5719 | leency | 1178 | } |
3434 | leency | 1179 | break; |
1180 | case 6: |
||
8854 | leency | 1181 | if (efm) { |
8861 | leency | 1182 | CopyFilesListToClipboard(CUT); |
8854 | leency | 1183 | EventPaste(#inactive_path); |
1184 | } |
||
3434 | leency | 1185 | break; |
1186 | case 7: |
||
8780 | leency | 1187 | NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER); |
3434 | leency | 1188 | break; |
5447 | punk_joker | 1189 | case 8: |
8780 | leency | 1190 | Del_Form(); |
5447 | punk_joker | 1191 | break; |
8780 | leency | 1192 | case 9: |
1193 | NewElement_Form(CREATE_FILE, T_NEW_FILE); |
||
1194 | break; |
||
3434 | leency | 1195 | case 10: //F10 |
5753 | leency | 1196 | if (!active_settings) |
5416 | punk_joker | 1197 | { |
5576 | pavelyakov | 1198 | settings_stak = malloc(4096); |
1199 | settings_window = CreateThread(#settings_dialog, settings_stak+4092); |
||
5416 | punk_joker | 1200 | break; |
1201 | } |
||
1202 | else |
||
1203 | { |
||
1204 | ActivateWindow(GetProcessSlot(settings_window)); |
||
1205 | } |
||
3434 | leency | 1206 | break; |
1207 | } |
||
1208 | } |
||
1209 | |||
8854 | leency | 1210 | void EventRefresh() |
1211 | { |
||
1212 | if (efm) |
||
1213 | { |
||
1214 | DrawFilePanels(); |
||
1215 | } else { |
||
1216 | Tip(56, T_DEVICES, 55, "-"); |
||
1217 | Open_Dir(#path,WITH_REDRAW); |
||
1218 | pause(10); |
||
1219 | SystemDiscs.Get(); |
||
1220 | Open_Dir(#path,WITH_REDRAW); |
||
1221 | DrawDeviceAndActionsLeftPanel(); |
||
1222 | } |
||
1223 | } |
||
1224 | |||
5738 | leency | 1225 | void ChangeActivePanel() |
1226 | { |
||
8872 | leency | 1227 | if (active_panel==1) active_panel=2; else active_panel=1; |
5738 | leency | 1228 | llist_copy(#files_active, #files_inactive); |
1229 | llist_copy(#files_inactive, #files); |
||
1230 | strcpy(#active_path, #inactive_path); |
||
1231 | strcpy(#inactive_path, #path); |
||
1232 | DrawFilePanels(); |
||
1233 | } |
||
1234 | |||
7422 | leency | 1235 | void EventSelectFileByKeyPress() |
1236 | { |
||
1237 | int i; |
||
1238 | for (i=files.cur_y+1; i |
||
1239 | { |
||
7972 | leency | 1240 | strcpy(#temp, items.get(i)*304+buf+72); |
7422 | leency | 1241 | if (temp[0]==key_ascii) || (temp[0]==key_ascii-32) |
1242 | { |
||
1243 | files.cur_y = i - 1; |
||
1244 | files.KeyDown(); |
||
1245 | List_ReDraw(); |
||
1246 | return; |
||
1247 | } |
||
1248 | } |
||
1249 | } |
||
1250 | |||
7515 | leency | 1251 | dword GetDeviceSizeLabel(dword path) |
1252 | { |
||
1253 | BDVK bdvk; |
||
1254 | if (ESBYTE[path+1] == '/') path++; |
||
1255 | if (ESBYTE[path+1] == 'c') && (ESBYTE[path+2] == 'd') |
||
7518 | leency | 1256 | && (ESBYTE[path+4] == 0) return 0; |
7515 | leency | 1257 | GetFileInfo(path, #bdvk); |
1258 | return ConvertSize64(bdvk.sizelo, bdvk.sizehi); |
||
1259 | } |
||
1260 | |||
7422 | leency | 1261 | int GetRealFileCountInFolder(dword folder_path) |
1262 | { |
||
1263 | int fcount; |
||
1264 | dword countbuf; |
||
1265 | |||
1266 | GetDir(#countbuf, #fcount, folder_path, DIRS_NOROOT); |
||
1267 | if (countbuf) free(countbuf); |
||
1268 | |||
1269 | return fcount; |
||
1270 | } |
||
1271 | |||
1272 | void EventRefreshDisksAndFolders() |
||
1273 | { |
||
1274 | if(GetRealFileCountInFolder("/")+dir_exists("/kolibrios") != SystemDiscs.dev_num) { |
||
8854 | leency | 1275 | EventRefresh(); |
7422 | leency | 1276 | } |
8854 | leency | 1277 | if(efm) |
7422 | leency | 1278 | { |
1279 | if(GetRealFileCountInFolder(#inactive_path) != files_inactive.count) { |
||
1280 | ChangeActivePanel(); |
||
1281 | ChangeActivePanel(); |
||
1282 | } |
||
1283 | } |
||
8872 | leency | 1284 | if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW); |
7422 | leency | 1285 | } |
1286 | |||
7628 | leency | 1287 | void EventSort(dword id) |
1288 | { |
||
1289 | char selected_filename[256]; |
||
1290 | if (sort_type == id) sort_desc ^= 1; |
||
1291 | else sort_type = id; |
||
1292 | strcpy(#selected_filename, #file_name); |
||
8872 | leency | 1293 | DrawButtonsAroundList(); |
7628 | leency | 1294 | Open_Dir(#path,WITH_REDRAW); |
1295 | SelectFileByName(#selected_filename); |
||
1296 | } |
||
1297 | |||
7786 | leency | 1298 | void EventHistoryGoForward() |
1299 | { |
||
1300 | if (history.forward()) { |
||
1301 | strcpy(#path, history.current()); |
||
1302 | files.KeyHome(); |
||
1303 | Open_Dir(#path,WITH_REDRAW); |
||
1304 | } |
||
1305 | } |
||
1306 | |||
7813 | leency | 1307 | void EventOpenNewEolite() |
1308 | { |
||
1309 | RunProgram(I_Path, #path); |
||
1310 | } |
||
1311 | |||
1312 | void EventOpenConsoleHere() |
||
1313 | { |
||
1314 | sprintf(#param, "pwd cd %s", #path); |
||
1315 | RunProgram("/sys/shell", #param); |
||
1316 | } |
||
1317 | |||
7786 | leency | 1318 | void ProceedMouseGestures() |
1319 | { |
||
1320 | char stats; |
||
1321 | signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; |
||
1322 | if (!mouse.mkm) && (stats>0) stats = 0; |
||
1323 | if (mouse.mkm) && (!stats) |
||
1324 | { |
||
1325 | x_old = mouse.x; |
||
1326 | y_old = mouse.y; |
||
1327 | stats = 1; |
||
1328 | } |
||
1329 | if (mouse.mkm) && (stats==1) |
||
1330 | { |
||
1331 | dif_x = mouse.x-x_old; |
||
1332 | dif_y = mouse.y-y_old; |
||
1333 | adif_x = fabs(dif_x); |
||
1334 | adif_y = fabs(dif_y); |
||
1335 | |||
1336 | if (adif_x>adif_y) { |
||
1337 | if (dif_x > 150) { |
||
1338 | EventHistoryGoForward(); |
||
1339 | stats = 0; |
||
1340 | } |
||
1341 | if (dif_x < -150) { |
||
1342 | EventHistoryGoBack(); |
||
1343 | stats = 0; |
||
1344 | } |
||
1345 | } else { |
||
1346 | if (dif_y < -100) { |
||
1347 | Dir_Up(); |
||
1348 | stats = 0; |
||
1349 | } |
||
1350 | } |
||
1351 | } |
||
1352 | } |
||
1353 | |||
8854 | leency | 1354 | void EventPaste(dword _into_path) { |
7878 | leency | 1355 | char paste_line[4096+6]; |
8854 | leency | 1356 | sprintf(#paste_line, "-v%i %s", cut_active, _into_path); |
7878 | leency | 1357 | RunProgram(#program_path, #paste_line); |
1358 | EventClosePopinForm(); |
||
1359 | } |
||
1360 | |||
1361 | void EventDelete() |
||
1362 | { |
||
8861 | leency | 1363 | char line_param[4096+5]; |
1364 | CopyFilesListToClipboard(DELETE); |
||
7878 | leency | 1365 | EventClosePopinForm(); |
8861 | leency | 1366 | sprintf(#line_param, "-d %s", #file_path); |
1367 | RunProgram(#program_path, #line_param); |
||
7878 | leency | 1368 | } |
1369 | |||
1370 | void EventClosePopinForm() |
||
1371 | { |
||
8854 | leency | 1372 | del_active = 0; |
7878 | leency | 1373 | new_element_active = 0; |
8872 | leency | 1374 | disk_popin_active_on_panel = 0; |
7878 | leency | 1375 | draw_window(); |
1376 | } |
||
1377 | |||
1378 | void EventShowProperties() |
||
1379 | char line_param[4096+5]; |
||
1380 | { |
||
1381 | if (!selected_count) { |
||
1382 | sprintf(#line_param, "-p %s", #file_path); |
||
1383 | RunProgram(#program_path, #line_param); |
||
1384 | } else { |
||
1385 | properties_stak = malloc(8096); |
||
1386 | CreateThread(#properties_dialog, properties_stak+8092); |
||
1387 | } |
||
1388 | } |
||
1389 | |||
7989 | leency | 1390 | void EventChooseFile(int _id) |
1391 | { |
||
1392 | if (getElementSelectedFlag(_id) == true) { |
||
1393 | setElementSelectedFlag(_id, false); |
||
1394 | } else { |
||
1395 | setElementSelectedFlag(_id, true); |
||
1396 | } |
||
7993 | leency | 1397 | } |
1398 | |||
1399 | void EventChooseFilesRange(int _start, _end) |
||
1400 | { |
||
1401 | if (_start > _end) _start >< _end; |
||
1402 | if (_end - _start > 1) list_full_redraw = true; |
||
1403 | while (_start < _end) { |
||
1404 | EventChooseFile(_start); |
||
1405 | _start++; |
||
1406 | } |
||
7989 | leency | 1407 | DrawStatusBar(); |
7993 | leency | 1408 | List_ReDraw(); |
7989 | leency | 1409 | } |
1410 | |||
7993 | leency | 1411 | void EventChooseAllFiles(dword state) |
1412 | { |
||
1413 | int i; |
||
1414 | for (i=0; i |
||
1415 | List_ReDraw(); |
||
1416 | DrawStatusBar(); |
||
1417 | } |
||
1418 | |||
8854 | leency | 1419 | void EventToolbarButtonClick(int _btid) |
1420 | { |
||
1421 | switch(_btid) { |
||
1422 | case BACK_BTN: EventHistoryGoBack(); break; |
||
1423 | case FWRD_BTN: EventHistoryGoForward(); break; |
||
1424 | case GOUP_BTN: Dir_Up(); break; |
||
8861 | leency | 1425 | case COPY_BTN: CopyFilesListToClipboard(CUT); break; |
1426 | case CUT_BTN: CopyFilesListToClipboard(COPY); break; |
||
8854 | leency | 1427 | case PASTE_BTN:EventPaste(#path); break; |
1428 | } |
||
1429 | } |
||
7993 | leency | 1430 | |
8854 | leency | 1431 | void EventDriveClick(int __id) |
1432 | { |
||
8872 | leency | 1433 | if (disk_popin_active_on_panel != active_panel) { |
8854 | leency | 1434 | ChangeActivePanel(); |
1435 | } |
||
7993 | leency | 1436 | |
8854 | leency | 1437 | SystemDiscs.Click(__id-100); |
1438 | if (efm) { |
||
1439 | draw_window(); |
||
1440 | } |
||
1441 | } |
||
1442 | |||
8872 | leency | 1443 | void EventOpenDiskPopin(int panel_n) |
1444 | { |
||
1445 | DefineHiddenButton(0,0,5000,3000,9999+BT_NOFRAME); |
||
1446 | disk_popin_active_on_panel = panel_n; |
||
1447 | SystemDiscs.Get(); |
||
1448 | if (disk_popin_active_on_panel==1) { |
||
1449 | SystemDiscs.DrawOptions(Form.cwidth/2-DDW, 8+DEV_H_HOR+3); |
||
1450 | } else { |
||
1451 | SystemDiscs.DrawOptions(Form.cwidth-DDW-2, 8+DEV_H_HOR+3); |
||
1452 | } |
||
1453 | } |
||
1454 | |||
3363 | leency | 1455 | stop:>>>>28)> |