Rev 8952 | Rev 8956 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8952 | Rev 8953 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | //Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2021 |
1 | //Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2021 |
2 | //GNU GPL license. |
2 | //GNU GPL license. |
Line 3... | Line 3... | ||
3 | 3 | ||
4 | /* |
4 | /* |
5 | TODO: |
5 | BUGS: |
6 | - fix a kfm2 bug with selected files on window deactivation |
6 | - fix a kfm2 bug with selected files on window deactivation |
7 | - click on a path bar opens edit |
7 | - back button broken |
- | 8 | - bug with going to wrong path (related to prior issue?) |
|
8 | - click to show breadcrumbs |
9 | TODO: |
- | 10 | - 70.5 - get volume info and label |
|
9 | - 70.5 - get volume info and label |
11 | - click on a path bar dropdown opens breadcrumbs |
Line 10... | Line 12... | ||
10 | */ |
12 | */ |
11 | 13 | ||
12 | #define ABOUT_TITLE "EOLITE 5 Beta11" |
14 | #define ABOUT_TITLE "EOLITE 5 Beta12" |
Line 13... | Line 15... | ||
13 | #define TITLE_EOLITE "Eolite File Manager 5 Beta11" |
15 | #define TITLE_EOLITE "Eolite File Manager 5 Beta12" |
14 | #define TITLE_KFM "Kolibri File Manager 2 Beta11"; |
16 | #define TITLE_KFM "Kolibri File Manager 2 Beta12"; |
15 | 17 | ||
16 | #define MEMSIZE 1024 * 250 |
18 | #define MEMSIZE 1024 * 250 |
Line 32... | Line 34... | ||
32 | #include "../lib/patterns/history.h" |
34 | #include "../lib/patterns/history.h" |
Line 33... | Line 35... | ||
33 | 35 | ||
34 | #include "imgs/images.h" |
36 | #include "imgs/images.h" |
Line 35... | Line -... | ||
35 | #include "include/const.h" |
- | |
36 | - | ||
37 | _history history; |
37 | #include "include/const.h" |
38 | 38 | ||
39 | struct Eolite_colors |
39 | struct Eolite_colors |
40 | { |
40 | { |
41 | bool def; |
41 | bool skin_is_dark; |
42 | dword lpanel; |
42 | dword lpanel; |
43 | dword list_vert_line; //vertical line between columns in list |
43 | dword list_vert_line; //vertical line between columns in list |
44 | dword selec; |
44 | dword selec; |
Line 53... | Line 53... | ||
53 | dword slider_bg_left; |
53 | dword slider_bg_left; |
54 | dword odd_line; |
54 | dword odd_line; |
55 | } col; |
55 | } col; |
56 | dword waves_pal[256]; |
56 | dword waves_pal[256]; |
Line -... | Line 57... | ||
- | 57 | ||
57 | 58 | //Global data |
|
58 | bool efm = false; |
- | |
59 | - | ||
60 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
- | |
61 | - | ||
62 | byte del_active=0; |
- | |
63 | byte new_element_active=0; |
- | |
64 | - | ||
65 | llist files, files_active, files_inactive; |
- | |
66 | 59 | bool efm = false; |
|
Line 67... | Line 60... | ||
67 | bool list_full_redraw; |
60 | _history history; |
68 | 61 | ||
69 | //Folder data |
62 | //Folder data |
70 | dword buf; |
63 | dword buf; |
71 | collection_int items=0; |
64 | collection_int items=0; |
72 | int selected_count; |
65 | int selected_count; |
73 | int folder_count; |
66 | int folder_count; |
Line 74... | Line 67... | ||
74 | dword path; |
67 | dword path; |
75 | bool dir_at_fat16 = NULL; |
68 | bool dir_at_fat16 = NULL; |
76 | 69 | ||
77 | //Sselected element data |
- | |
78 | byte file_path[4096]; |
70 | //Selected element data |
79 | byte file_name[256]; |
71 | byte file_path[4096]; |
Line 80... | Line 72... | ||
80 | byte new_element_name[256]; |
72 | byte file_name[256]; |
81 | byte temp[4096]; |
73 | byte temp[4096]; |
Line 87... | Line 79... | ||
87 | bool scroll_used=false; |
79 | bool scroll_used=false; |
88 | char sort_type=2; |
80 | char sort_type=2; |
89 | bool sort_desc=false; |
81 | bool sort_desc=false; |
90 | int status_bar_h; |
82 | int status_bar_h; |
91 | int icon_size = 18; |
83 | int icon_size = 18; |
- | 84 | char active_popin = NULL; |
|
- | 85 | bool list_full_redraw; |
|
Line 92... | Line 86... | ||
92 | 86 | ||
93 | //Threads data |
87 | //Threads data |
94 | dword about_thread_id; |
88 | dword about_thread_id; |
95 | dword settings_window; |
89 | dword settings_window; |
Line 101... | Line 95... | ||
101 | //Multipanes |
95 | //Multipanes |
102 | int active_panel=0; |
96 | int active_panel=0; |
103 | int disk_popin_active_on_panel=0; |
97 | int disk_popin_active_on_panel=0; |
104 | #define PANES_COUNT 2 |
98 | #define PANES_COUNT 2 |
105 | dword location[PANES_COUNT]; |
99 | dword location[PANES_COUNT]; |
- | 100 | llist files, files_active, files_inactive; |
|
Line 106... | Line 101... | ||
106 | 101 | ||
107 | libimg_image icons16_default; |
102 | libimg_image icons16_default; |
108 | libimg_image icons16_selected; |
- | |
109 | 103 | libimg_image icons16_selected; |
|
110 | libimg_image icons32_default; |
104 | libimg_image icons32_default; |
Line -... | Line 105... | ||
- | 105 | libimg_image icons32_selected; |
|
111 | libimg_image icons32_selected; |
106 | |
112 | 107 | byte popin_string[4096]; |
|
- | 108 | edit_box popin_text = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000, |
|
113 | edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000, |
109 | 248,#popin_string,0,ed_focus+ed_always_focus,6,0}; |
Line 114... | Line 110... | ||
114 | 248,#new_element_name,0,ed_focus+ed_always_focus,6,0}; |
110 | |
115 | PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
111 | PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
116 | 112 | ||
Line 197... | Line 193... | ||
197 | llist_copy(#files_inactive, #files); |
193 | llist_copy(#files_inactive, #files); |
198 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
194 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
199 | loop() switch(@WaitEventTimeout(100)) |
195 | loop() switch(@WaitEventTimeout(100)) |
200 | { |
196 | { |
201 | case evMouse: |
197 | case evMouse: |
202 | if (del_active) || (disk_popin_active_on_panel) || (Form.status_window&ROLLED_UP) break; |
198 | if (Form.status_window&ROLLED_UP) break; |
- | 199 | ||
203 | if (new_element_active) |
200 | if (active_popin) { |
204 | { |
- | |
205 | edit_box_mouse stdcall(#new_file_ed); |
201 | if (popin_string[0]!=-1) edit_box_mouse stdcall(#popin_text); |
206 | break; |
202 | break; |
207 | } |
203 | } |
Line 208... | Line 204... | ||
208 | 204 | ||
Line 299... | Line 295... | ||
299 | break; |
295 | break; |
300 | //Button pressed----------------------------------------------------------------------------- |
296 | //Button pressed----------------------------------------------------------------------------- |
301 | case evButton: |
297 | case evButton: |
302 | id = GetButtonID(); |
298 | id = GetButtonID(); |
Line 303... | Line 299... | ||
303 | 299 | ||
304 | if (id==CLOSE_BTN) { |
300 | if (CLOSE_BTN == id) { |
305 | KillProcess(about_thread_id); |
301 | KillProcess(about_thread_id); |
306 | SaveIniSettings(); |
302 | SaveIniSettings(); |
307 | ExitProcess(); |
303 | ExitProcess(); |
Line 308... | Line -... | ||
308 | } |
- | |
309 | 304 | } |
|
310 | if (new_element_active) || (del_active) || (disk_popin_active_on_panel) { |
- | |
311 | if (POPUP_BTN1==id) && (del_active) EventDelete(); |
305 | |
312 | if (POPUP_BTN1==id) && (new_element_active) NewElement(); |
306 | if (active_popin) { |
313 | if (POPUP_BTN2==id) EventClosePopinForm(); |
307 | if (POPIN_DISK==active_popin) { |
314 | if (disk_popin_active_on_panel) { |
308 | if (id>=100) && (id<=120) { |
315 | if (id>=100) && (id<=120) EventDriveClick(id); |
309 | active_popin = NULL; |
- | 310 | EventDriveClick(id); |
|
- | 311 | } |
|
- | 312 | EventClosePopinForm(); //POPIN_DISK create close btn with POPUP_BTN2 |
|
- | 313 | break; } |
|
316 | else EventClosePopinForm(); |
314 | if (POPUP_BTN2==id) EventClosePopinForm(); |
317 | } |
315 | if (POPUP_BTN1==id) EventPopinClickOkay(); |
Line 318... | Line 316... | ||
318 | break; |
316 | break; |
319 | } |
317 | } |
320 | - | ||
321 | switch(id) |
- | |
322 | { |
- | |
323 | case PATH_BTN: |
- | |
324 | notify(COPY_PATH_STR); |
318 | |
325 | Clipboard__CopyText(path); |
- | |
326 | break; |
319 | switch(id) |
327 | case KFM_DEV_DROPDOWN_1: |
- | |
328 | case KFM_DEV_DROPDOWN_1+1: |
320 | { |
329 | case KFM_DEV_DROPDOWN_2: |
321 | case KFM_DEV_DROPDOWN_1: |
330 | case KFM_DEV_DROPDOWN_2+1: |
322 | case KFM_DEV_DROPDOWN_2: |
331 | EventOpenDiskPopin(active_panel); |
323 | ShowPopinForm(POPIN_DISK); |
332 | break; |
324 | break; |
- | 325 | case BACK_BTN...PASTE_BTN: |
|
- | 326 | EventToolbarButtonClick(id); |
|
- | 327 | break; |
|
- | 328 | case BTN_PATH: |
|
- | 329 | case BTN_PATH+1: |
|
- | 330 | ShowPopinForm(POPIN_PATH); |
|
- | 331 | break; |
|
- | 332 | case BTN_BREADCRUMB: |
|
333 | case BACK_BTN...PASTE_BTN: |
333 | case BTN_BREADCRUMB+1: |
334 | EventToolbarButtonClick(id); |
334 | ShowPopinForm(POPIN_BREADCR); |
335 | break; |
335 | break; |
336 | case 31...33: |
336 | case 31...33: |
337 | EventSort(id-30); |
337 | EventSort(id-30); |
338 | break; |
338 | break; |
339 | case 51: |
339 | case 51: |
340 | EventShowBurgerMenu(); |
340 | EventShowBurgerMenu(); |
341 | break; |
341 | break; |
342 | case 52...60: //Actions |
- | |
343 | FnProcess(id-50); |
- | |
344 | break; |
- | |
345 | case 61: // Set path as default |
342 | case 52...60: //Actions |
346 | SetDefaultPath(path); |
343 | FnProcess(id-50); |
347 | break; |
344 | break; |
348 | case 100...120: |
345 | case 100...120: |
349 | EventDriveClick(id); |
346 | EventDriveClick(id); |
Line 361... | Line 358... | ||
361 | case evKey: |
358 | case evKey: |
362 | GetKeys(); |
359 | GetKeys(); |
Line 363... | Line 360... | ||
363 | 360 | ||
Line 364... | Line 361... | ||
364 | if (Form.status_window&ROLLED_UP) break; |
361 | if (Form.status_window&ROLLED_UP) break; |
365 | 362 | ||
366 | if (new_element_active) || (del_active) || (disk_popin_active_on_panel) |
363 | if (active_popin) |
Line 367... | Line 364... | ||
367 | { |
364 | { |
368 | if (key_scancode == SCAN_CODE_ESC) EventClosePopinForm(); |
365 | if (key_scancode == SCAN_CODE_ESC) EventClosePopinForm(); |
- | 366 | ||
- | 367 | if (POPIN_DISK == active_popin) { |
|
369 | 368 | if (key_scancode >= SCAN_CODE_1) |
|
370 | if (del_active) { |
369 | && (key_scancode >= SCAN_CODE_10) { |
371 | if (key_scancode == SCAN_CODE_ENTER) EventDelete(); |
370 | EventDriveClick(key_scancode-1+100); |
- | 371 | } |
|
372 | } |
372 | } else { |
373 | if (new_element_active) { |
373 | if (key_scancode == SCAN_CODE_ENTER) EventPopinClickOkay(); |
374 | if (key_scancode == SCAN_CODE_ENTER) NewElement(); |
374 | if (popin_string[0] != -1) { |
375 | EAX = key_editbox; |
- | |
376 | edit_box_key stdcall (#new_file_ed); |
375 | EAX = key_editbox; |
377 | } |
- | |
378 | break; |
- | |
379 | } |
- | |
380 | - | ||
381 | if (key_modifier&KEY_LALT) || (key_modifier&KEY_RALT) { |
376 | edit_box_key stdcall (#popin_text); |
382 | if (key_scancode == SCAN_CODE_F1) EventOpenDiskPopin(1); |
377 | } |
- | 378 | } |
|
383 | if (key_scancode == SCAN_CODE_F2) EventOpenDiskPopin(2); |
379 | break; |
Line 384... | Line 380... | ||
384 | break; |
380 | } |
385 | } |
381 | |
386 | if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) { |
382 | if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) { |
Line 407... | Line 403... | ||
407 | switch(key_scancode) |
403 | switch(key_scancode) |
408 | { |
404 | { |
409 | case SCAN_CODE_F1...SCAN_CODE_F3: |
405 | case SCAN_CODE_F1...SCAN_CODE_F3: |
410 | EventSort(key_scancode - 58); |
406 | EventSort(key_scancode - 58); |
411 | break; |
407 | break; |
- | 408 | case SCAN_CODE_1...SCAN_CODE_2: |
|
- | 409 | if (efm) { |
|
- | 410 | active_panel = key_scancode - SCAN_CODE_1; |
|
- | 411 | ShowPopinForm(POPIN_DISK); |
|
- | 412 | break; |
|
- | 413 | } |
|
412 | case SCAN_CODE_1...SCAN_CODE_10: |
414 | case SCAN_CODE_3...SCAN_CODE_10: |
413 | key_scancode-=2; |
415 | key_scancode-=2; |
414 | if (key_scancode >= SystemDiscs.list.count) break; |
416 | if (key_scancode >= SystemDiscs.list.count) break; |
415 | if (!efm) { |
417 | if (!efm) { |
416 | DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click |
418 | DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click |
417 | pause(7); |
419 | pause(7); |
Line 471... | Line 473... | ||
471 | mouse.x = files.x+15; |
473 | mouse.x = files.x+15; |
472 | mouse.y = files.cur_y - files.first * files.item_h + files.y + 5; |
474 | mouse.y = files.cur_y - files.first * files.item_h + files.y + 5; |
473 | EventShowListMenu(); |
475 | EventShowListMenu(); |
474 | break; |
476 | break; |
475 | case SCAN_CODE_DEL: |
477 | case SCAN_CODE_DEL: |
476 | Del_Form(); |
478 | ShowPopinForm(POPIN_DELETE); |
477 | break; |
479 | break; |
478 | case SCAN_CODE_SPACE: |
480 | case SCAN_CODE_SPACE: |
479 | EventChooseFile(files.cur_y); |
481 | EventChooseFile(files.cur_y); |
480 | DrawStatusBar(); |
482 | DrawStatusBar(); |
481 | Line_ReDraw(col.selec, files.cur_y); |
483 | Line_ReDraw(col.selec, files.cur_y); |
Line 538... | Line 540... | ||
538 | if (screen.width > 693) && (Form.width < 693) { MoveSize(OLD,OLD,693,OLD); return; } |
540 | if (screen.width > 693) && (Form.width < 693) { MoveSize(OLD,OLD,693,OLD); return; } |
539 | DrawBar(0, 4, Form.cwidth, SELECTY-5, sc.work); |
541 | DrawBar(0, 4, Form.cwidth, SELECTY-5, sc.work); |
540 | DrawBar(0, SELECTY+KFM2_DEVH+1, Form.cwidth, 3, sc.work); |
542 | DrawBar(0, SELECTY+KFM2_DEVH+1, Form.cwidth, 3, sc.work); |
541 | DrawBar(0, SELECTY-1, 1, KFM2_DEVH+2, sc.work); |
543 | DrawBar(0, SELECTY-1, 1, KFM2_DEVH+2, sc.work); |
542 | DrawBar(Form.cwidth-1, SELECTY-1, 1, KFM2_DEVH+2, sc.work); |
544 | DrawBar(Form.cwidth-1, SELECTY-1, 1, KFM2_DEVH+2, sc.work); |
543 | DrawBar(Form.cwidth/2-16, SELECTY-1, 16, KFM2_DEVH+2, sc.work); |
545 | DrawBar(Form.cwidth/2-16, SELECTY-1, 15, KFM2_DEVH+2, sc.work); |
544 | /* |
546 | /* |
545 | #define PAD 7 |
547 | #define PAD 7 |
546 | #define GAP_S 26+5 |
548 | #define GAP_S 26+5 |
547 | #define GAP_B 26+14 |
549 | #define GAP_B 26+14 |
548 | x.set(Form.cwidth/2-DDW-203/2-GAP_S); |
550 | x.set(Form.cwidth/2-DDW-203/2-GAP_S); |
Line 724... | Line 726... | ||
724 | if (colored_lines.checked) separator_color = col.list_bg; else separator_color = col.list_vert_line; |
726 | if (colored_lines.checked) separator_color = col.list_bg; else separator_color = col.list_vert_line; |
725 | DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h, separator_color); |
727 | DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h, separator_color); |
726 | DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h, separator_color); |
728 | DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h, separator_color); |
727 | DrawScroll(scroll_used); |
729 | DrawScroll(scroll_used); |
Line 728... | Line 730... | ||
728 | 730 | ||
729 | if (del_active) Del_Form(); |
731 | if (files.x!=files_inactive.x) { |
- | 732 | if (active_popin) ShowPopinForm(active_popin); |
|
730 | if (new_element_active) && (col.selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name); |
733 | } |
Line 731... | Line 734... | ||
731 | } |
734 | } |
732 | 735 | ||
733 | void Line_ReDraw(dword bgcol, filenum){ |
736 | void Line_ReDraw(dword bgcol, filenum){ |
Line 749... | Line 752... | ||
749 | current_inactive = true; |
752 | current_inactive = true; |
750 | } |
753 | } |
Line 751... | Line 754... | ||
751 | 754 | ||
752 | DrawBar(files.x,y,4,files.item_h,bgcol); |
755 | DrawBar(files.x,y,4,files.item_h,bgcol); |
753 | DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol); |
756 | DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol); |
754 | 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); |
757 | if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size,icon_size,y+files.item_h-icon_y-icon_size,bgcol); |
755 | if (colored_lines.checked) { |
758 | if (colored_lines.checked) { |
756 | if (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line; |
759 | if (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line; |
757 | separator_color = bgcol; |
760 | separator_color = bgcol; |
758 | } else { |
761 | } else { |
Line 827... | Line 830... | ||
827 | } |
830 | } |
828 | kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, |
831 | kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, |
829 | bgcol, text_col, kfont.size.pt, #label_file_name); |
832 | bgcol, text_col, kfont.size.pt, #label_file_name); |
830 | } |
833 | } |
831 | DrawIconByExtension(#full_path, ext1, files.x+4, icon_y, bgcol); |
834 | DrawIconByExtension(#full_path, ext1, files.x+4, icon_y, bgcol); |
832 | if (current_inactive) DrawWideRectangle(files.x+2, y, files.w-4, files.item_h, 2, col.selec_active); |
835 | if (current_inactive) DrawWideRectangle(files.x+2, y, files.w-4, files.item_h, 2, col.selec); |
833 | } |
836 | } |
Line 834... | Line 837... | ||
834 | 837 | ||
835 | 838 | ||
Line 905... | Line 908... | ||
905 | if (d>0) && (strncmp(items.get(0)*304+buf+72,"..",2)!=0) |
908 | if (d>0) && (strncmp(items.get(0)*304+buf+72,"..",2)!=0) |
906 | for(d--; d>0; d--;) if (!strncmp(items.get(d)*304+buf+72,"..",2)) {items.swap(d,0); break;} |
909 | for(d--; d>0; d--;) if (!strncmp(items.get(d)*304+buf+72,"..",2)) {items.swap(d,0); break;} |
907 | } |
910 | } |
Line 908... | Line -... | ||
908 | - | ||
909 | - | ||
910 | void Del_Form() |
- | |
911 | { |
- | |
912 | byte f_count[128]; |
- | |
913 | int dform_x = files.w - 220 / 2 + files.x; |
- | |
914 | if (!selected_count) && (!strncmp(#file_name,"..",2)) return; |
- | |
915 | else |
- | |
916 | { |
- | |
917 | if (!files.count) return; |
- | |
918 | DrawEolitePopup(T_YES, T_NO); |
- | |
919 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,sc.work_text,T_DELETE_FILE); |
- | |
920 | if (selected_count) |
- | |
921 | { |
- | |
922 | sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2); |
- | |
923 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count); |
- | |
924 | } |
- | |
925 | else |
- | |
926 | { |
- | |
927 | if (strlen(#file_name)<28) |
- | |
928 | { |
- | |
929 | WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?"); |
- | |
930 | WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name); |
- | |
931 | } |
- | |
932 | else |
- | |
933 | { |
- | |
934 | WriteText(164+dform_x,190,0x80,0,"...?"); |
- | |
935 | ESI = 24; |
- | |
936 | WriteText(dform_x+20,190,0,0,#file_name); |
- | |
937 | } |
- | |
938 | } |
- | |
939 | del_active=1; |
- | |
940 | } |
- | |
941 | } |
911 | |
942 | 912 | ||
943 | void SelectFileByName(dword that_file) |
913 | void SelectFileByName(dword that_file) |
944 | { |
914 | { |
945 | int ind; |
915 | int ind; |
Line 1016... | Line 986... | ||
1016 | byte open_param[4097]; |
986 | byte open_param[4097]; |
1017 | sprintf(#open_param,"~%s",#file_path); |
987 | sprintf(#open_param,"~%s",#file_path); |
1018 | RunProgram("/sys/@open", #open_param); |
988 | RunProgram("/sys/@open", #open_param); |
1019 | } |
989 | } |
Line 1020... | Line 990... | ||
1020 | 990 | ||
1021 | void NewElement() |
- | |
1022 | { |
- | |
1023 | BDVK element_info; |
- | |
1024 | byte copy_result, info_result; |
- | |
1025 | - | ||
1026 | sprintf(#temp,"%s/%s",path,new_file_ed.text); |
- | |
1027 | info_result = GetFileInfo(#temp, #element_info); |
- | |
1028 | switch(new_element_active) |
991 | bool EventCreateAndRename() |
1029 | { |
992 | { |
1030 | case CREATE_FILE: |
993 | sprintf(#temp,"%s/%s",path,popin_text.text); |
1031 | if (info_result!=5) { |
994 | if (file_exists(#temp)) { |
1032 | notify(FS_ITEM_ALREADY_EXISTS); |
995 | notify(FS_ITEM_ALREADY_EXISTS); |
1033 | } else { |
- | |
1034 | CreateFile(0, 0, #temp); |
- | |
1035 | if (EAX) |
- | |
1036 | { |
- | |
1037 | if (EAX==5) notify(NOT_CREATE_FILE); |
- | |
1038 | else Write_Error(EAX); |
- | |
1039 | } |
996 | return false; |
1040 | } |
- | |
1041 | break; |
- | |
1042 | case CREATE_FOLDER: |
997 | } |
1043 | if (info_result!=5) { |
- | |
1044 | notify(FS_ITEM_ALREADY_EXISTS); |
- | |
1045 | } else { |
- | |
1046 | CreateDir(#temp); |
- | |
1047 | if (EAX) |
998 | switch(active_popin) |
1048 | { |
999 | { |
1049 | if (EAX==5) notify(NOT_CREATE_FOLDER); |
1000 | case POPIN_NEW_FILE: |
1050 | else Write_Error(EAX); |
- | |
1051 | } |
- | |
1052 | } |
1001 | if (CreateFile(0, 0, #temp)) goto __FAIL; |
1053 | break; |
1002 | break; |
1054 | case RENAME_ITEM: |
1003 | case POPIN_NEW_FOLDER: |
1055 | if (info_result!=5) { |
1004 | if (CreateDir(#temp)) goto __FAIL; |
1056 | notify(FS_ITEM_ALREADY_EXISTS); |
1005 | break; |
1057 | } else { |
1006 | case POPIN_RENAME: |
1058 | if (RenameMove(new_file_ed.text, #file_path)) |
1007 | if (RenameMove(popin_text.text, #file_path)) |
1059 | { |
1008 | { |
1060 | if (itdir) { |
- | |
1061 | notify("'Error renaming folder' -E"); |
1009 | if (itdir) { |
1062 | return; |
1010 | goto __FAIL; |
1063 | } else { |
1011 | } else { |
1064 | if (copy_result = CopyFile(#file_path,#temp)) { |
1012 | if (CopyFile(#file_path,#temp)) { |
1065 | Write_Error(copy_result); |
1013 | goto __FAIL; |
1066 | } else { |
1014 | } else { |
1067 | DeleteFile(#file_path); |
- | |
1068 | SelectFileByName(new_file_ed.text); |
1015 | DeleteFile(#file_path); |
1069 | } |
1016 | } |
1070 | } |
1017 | } |
1071 | } |
1018 | } |
- | 1019 | } |
|
- | 1020 | Open_Dir(path,WITH_REDRAW); |
|
- | 1021 | SelectFileByName(popin_text.text); |
|
- | 1022 | return true; |
|
- | 1023 | __FAIL: |
|
- | 1024 | Write_Error(EAX); |
|
1072 | } |
1025 | return false; |
- | 1026 | } |
|
- | 1027 | ||
- | 1028 | void EventPopinClickOkay() |
|
- | 1029 | { |
|
- | 1030 | switch(active_popin) { |
|
- | 1031 | case POPIN_PATH: |
|
1073 | } |
1032 | strcpy(path, #popin_string); |
- | 1033 | Open_Dir(path, WITH_REDRAW); |
|
- | 1034 | break; |
|
1074 | Open_Dir(path,WITH_REDRAW); |
1035 | case POPIN_DELETE: |
- | 1036 | CopyFilesListToClipboard(DELETE); |
|
- | 1037 | EventClosePopinForm(); |
|
- | 1038 | sprintf(#param, "-d %s", #file_path); |
|
- | 1039 | RunProgram(#program_path, #param); |
|
- | 1040 | break; |
|
- | 1041 | case POPIN_RENAME: |
|
- | 1042 | case POPIN_NEW_FILE: |
|
- | 1043 | case POPIN_NEW_FOLDER: |
|
- | 1044 | if (!EventCreateAndRename()) return; |
|
1075 | SelectFileByName(new_file_ed.text); |
1045 | } |
1076 | EventClosePopinForm(); |
1046 | EventClosePopinForm(); |
Line 1077... | Line 1047... | ||
1077 | } |
1047 | } |
1078 | 1048 | ||
1079 | void NewElement_Form(byte crt, dword strng) |
1049 | void EventClosePopinForm() |
- | 1050 | { |
|
- | 1051 | active_popin = NULL; |
|
- | 1052 | draw_window(); |
|
1080 | { |
1053 | } |
1081 | int dform_x=files.w-220/2+files.x; |
1054 | |
- | 1055 | void ShowPopinForm(byte _popin_type) |
|
1082 | if (!new_element_active) |
1056 | { |
- | 1057 | int popinx; |
|
- | 1058 | popin_string[0] = -1; |
|
1083 | { |
1059 | switch(_popin_type) { |
- | 1060 | case POPIN_PATH: |
|
- | 1061 | edit_box_set_text stdcall (#popin_text, path); |
|
- | 1062 | DrawEolitePopup(T_GOPATH, T_CANCEL); |
|
- | 1063 | break; |
|
- | 1064 | case POPIN_NEW_FILE: |
|
- | 1065 | edit_box_set_text stdcall (#popin_text, T_NEW_FILE); |
|
- | 1066 | DrawEolitePopup(T_CREATE, T_CANCEL); |
|
- | 1067 | break; |
|
- | 1068 | case POPIN_NEW_FOLDER: |
|
- | 1069 | edit_box_set_text stdcall (#popin_text, T_NEW_FOLDER); |
|
- | 1070 | DrawEolitePopup(T_CREATE, T_CANCEL); |
|
- | 1071 | break; |
|
- | 1072 | case POPIN_RENAME: |
|
- | 1073 | edit_box_set_text stdcall (#popin_text, #file_name); |
|
- | 1074 | DrawEolitePopup(T_RENAME, T_CANCEL); |
|
- | 1075 | break; |
|
- | 1076 | case POPIN_DELETE: |
|
- | 1077 | if (!files.count) return; |
|
- | 1078 | if (!selected_count) && (!strncmp(#file_name,"..",2)) return; |
|
- | 1079 | popinx = DrawEolitePopup(T_YES, T_NO); |
|
- | 1080 | WriteTextCenter(popinx, 178, POPIN_W, sc.work_text, T_DELETE_FILE); |
|
- | 1081 | if (selected_count) { |
|
- | 1082 | sprintf(#param,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2); |
|
- | 1083 | } else { |
|
- | 1084 | if (strlen(#file_name)<28) { |
|
- | 1085 | sprintf(#param,"%s ?",#file_name); |
|
- | 1086 | } else { |
|
- | 1087 | strncpy(#param, #file_name, POPIN_W-20/6-4); |
|
1084 | new_element_active = crt; |
1088 | strcat(#param, "...?"); |
1085 | edit_box_set_text stdcall (#new_file_ed, strng); |
1089 | } |
- | 1090 | } |
|
- | 1091 | WriteTextCenter(popinx, 192, POPIN_W, sc.work_text, #param); |
|
- | 1092 | break; |
|
- | 1093 | case POPIN_DISK: |
|
- | 1094 | DefineHiddenButton(0,0,5000,3000,9999+BT_NOFRAME); |
|
- | 1095 | if (active_panel==0) { |
|
1086 | } |
1096 | SystemDiscs.DrawOptions(1); |
- | 1097 | } else { |
|
- | 1098 | SystemDiscs.DrawOptions(Form.cwidth/2-1); |
|
- | 1099 | } |
|
1087 | if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL); |
1100 | break; |
- | 1101 | case POPIN_BREADCR: |
|
- | 1102 | notify("'Not implemented yet' C"); |
|
- | 1103 | return; |
|
- | 1104 | //DrawBreadCrumbs(); |
|
1088 | else DrawEolitePopup(T_CREATE, T_CANCEL); |
1105 | break; |
1089 | new_file_ed.left = dform_x+10; |
1106 | } |
Line 1090... | Line 1107... | ||
1090 | DrawEditBox(#new_file_ed); |
1107 | active_popin = _popin_type; |
1091 | } |
1108 | } |
1092 | 1109 | ||
Line 1106... | Line 1123... | ||
1106 | { |
1123 | { |
1107 | case 1: |
1124 | case 1: |
1108 | EventShowProperties(); |
1125 | EventShowProperties(); |
1109 | break; |
1126 | break; |
1110 | case 2: |
1127 | case 2: |
1111 | if (files.count) NewElement_Form(RENAME_ITEM, #file_name); |
1128 | if (files.count) ShowPopinForm(POPIN_RENAME); |
1112 | break; |
1129 | break; |
1113 | case 3: |
1130 | case 3: |
1114 | if (files.count) && (!itdir) RunProgram("/sys/quark", #file_path); |
1131 | if (files.count) && (!itdir) RunProgram("/sys/quark", #file_path); |
1115 | break; |
1132 | break; |
1116 | case 4: |
1133 | case 4: |
Line 1129... | Line 1146... | ||
1129 | CopyFilesListToClipboard(CUT); |
1146 | CopyFilesListToClipboard(CUT); |
1130 | EventPaste(location[active_panel^1]); |
1147 | EventPaste(location[active_panel^1]); |
1131 | } |
1148 | } |
1132 | break; |
1149 | break; |
1133 | case 7: |
1150 | case 7: |
1134 | NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER); |
1151 | ShowPopinForm(POPIN_NEW_FOLDER); |
1135 | break; |
1152 | break; |
1136 | case 8: |
1153 | case 8: |
1137 | Del_Form(); |
1154 | ShowPopinForm(POPIN_DELETE); |
1138 | break; |
1155 | break; |
1139 | case 9: |
1156 | case 9: |
1140 | NewElement_Form(CREATE_FILE, T_NEW_FILE); |
1157 | ShowPopinForm(POPIN_NEW_FILE); |
1141 | break; |
1158 | break; |
1142 | case 10: //F10 |
1159 | case 10: //F10 |
1143 | if (active_settings) { |
1160 | if (active_settings) { |
1144 | ActivateWindow(GetProcessSlot(settings_window)); |
1161 | ActivateWindow(GetProcessSlot(settings_window)); |
1145 | } else { |
1162 | } else { |
Line 1294... | Line 1311... | ||
1294 | sprintf(#paste_line, "-v%i %s", cut_active, _into_path); |
1311 | sprintf(#paste_line, "-v%i %s", cut_active, _into_path); |
1295 | RunProgram(#program_path, #paste_line); |
1312 | RunProgram(#program_path, #paste_line); |
1296 | EventClosePopinForm(); |
1313 | EventClosePopinForm(); |
1297 | } |
1314 | } |
Line 1298... | Line -... | ||
1298 | - | ||
1299 | void EventDelete() |
- | |
1300 | { |
- | |
1301 | char line_param[4096+5]; |
- | |
1302 | CopyFilesListToClipboard(DELETE); |
- | |
1303 | EventClosePopinForm(); |
- | |
1304 | sprintf(#line_param, "-d %s", #file_path); |
- | |
1305 | RunProgram(#program_path, #line_param); |
- | |
1306 | } |
- | |
1307 | - | ||
1308 | void EventClosePopinForm() |
- | |
1309 | { |
- | |
1310 | del_active = 0; |
- | |
1311 | new_element_active = 0; |
- | |
1312 | disk_popin_active_on_panel = 0; |
- | |
1313 | draw_window(); |
- | |
1314 | } |
- | |
1315 | 1315 | ||
1316 | void EventShowProperties() |
1316 | void EventShowProperties() |
1317 | char line_param[4096+5]; |
1317 | char line_param[4096+5]; |
1318 | { |
1318 | { |
1319 | if (!selected_count) { |
1319 | if (!selected_count) { |
Line 1366... | Line 1366... | ||
1366 | } |
1366 | } |
1367 | } |
1367 | } |
Line 1368... | Line 1368... | ||
1368 | 1368 | ||
1369 | void EventDriveClick(int __id) |
1369 | void EventDriveClick(int __id) |
1370 | { |
- | |
1371 | SystemDiscs.Click(__id-100); |
1370 | { |
1372 | if (efm) { |
1371 | if (efm) { |
1373 | draw_window(); |
1372 | draw_window(); |
1374 | } |
- | |
1375 | } |
- | |
1376 | - | ||
1377 | void EventOpenDiskPopin(int panel_n) |
- | |
1378 | { |
- | |
1379 | DefineHiddenButton(0,0,5000,3000,9999+BT_NOFRAME); |
- | |
1380 | if (panel_n==0) { |
- | |
1381 | disk_popin_active_on_panel = 1; |
1373 | } |
1382 | SystemDiscs.DrawOptions(1); |
- | |
1383 | } else { |
- | |
1384 | disk_popin_active_on_panel = 2; |
- | |
1385 | SystemDiscs.DrawOptions(Form.cwidth/2-1); |
- | |
1386 | } |
1374 | SystemDiscs.Click(__id-100); |
Line 1387... | Line 1375... | ||
1387 | } |
1375 | } |