Rev 8951 | Rev 8953 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8951 | Rev 8952 | ||
---|---|---|---|
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 -... | Line 3... | ||
- | 3 | ||
- | 4 | /* |
|
- | 5 | TODO: |
|
- | 6 | - fix a kfm2 bug with selected files on window deactivation |
|
- | 7 | - click on a path bar opens edit |
|
3 | 8 | - click to show breadcrumbs |
|
- | 9 | - 70.5 - get volume info and label |
|
4 | // 70.5 - get volume info and label |
10 | */ |
5 | 11 | ||
6 | #define ABOUT_TITLE "EOLITE 5 Beta10" |
12 | #define ABOUT_TITLE "EOLITE 5 Beta11" |
7 | #define TITLE_EOLITE "Eolite File Manager 5 Beta10" |
13 | #define TITLE_EOLITE "Eolite File Manager 5 Beta11" |
Line 8... | Line 14... | ||
8 | #define TITLE_KFM "Kolibri File Manager 2 Beta10"; |
14 | #define TITLE_KFM "Kolibri File Manager 2 Beta11"; |
9 | 15 | ||
10 | #define MEMSIZE 1024 * 250 |
16 | #define MEMSIZE 1024 * 250 |
11 | #include "../lib/clipboard.h" |
17 | #include "../lib/clipboard.h" |
Line 22... | Line 28... | ||
22 | #include "../lib/obj/libini.h" |
28 | #include "../lib/obj/libini.h" |
23 | #include "../lib/obj/box_lib.h" |
29 | #include "../lib/obj/box_lib.h" |
24 | #include "../lib/obj/libimg.h" |
30 | #include "../lib/obj/libimg.h" |
Line 25... | Line 31... | ||
25 | 31 | ||
26 | #include "../lib/patterns/history.h" |
- | |
Line 27... | Line 32... | ||
27 | #include "../lib/patterns/toolbar_button.h" |
32 | #include "../lib/patterns/history.h" |
28 | - | ||
29 | #include "imgs/images.h" |
33 | |
Line 30... | Line 34... | ||
30 | 34 | #include "imgs/images.h" |
|
Line 31... | Line 35... | ||
31 | #include "include/const.h" |
35 | #include "include/const.h" |
Line 53... | Line 57... | ||
53 | 57 | ||
Line 54... | Line 58... | ||
54 | bool efm = false; |
58 | bool efm = false; |
Line 55... | Line -... | ||
55 | - | ||
56 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
- | |
57 | - | ||
58 | bool dir_at_fat16 = NULL; |
- | |
59 | - | ||
60 | dword about_thread_id; |
- | |
61 | dword settings_window; |
- | |
62 | bool active_about = false; |
59 | |
63 | bool active_settings = false; |
60 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
Line 64... | Line 61... | ||
64 | 61 | ||
Line 73... | Line 70... | ||
73 | dword buf; |
70 | dword buf; |
74 | collection_int items=0; |
71 | collection_int items=0; |
75 | int selected_count; |
72 | int selected_count; |
76 | int folder_count; |
73 | int folder_count; |
77 | dword path; |
74 | dword path; |
- | 75 | bool dir_at_fat16 = NULL; |
|
Line 78... | Line 76... | ||
78 | 76 | ||
79 | //Sselected element data |
77 | //Sselected element data |
80 | byte file_path[4096]; |
78 | byte file_path[4096]; |
81 | byte file_name[256]; |
79 | byte file_name[256]; |
Line 90... | Line 88... | ||
90 | char sort_type=2; |
88 | char sort_type=2; |
91 | bool sort_desc=false; |
89 | bool sort_desc=false; |
92 | int status_bar_h; |
90 | int status_bar_h; |
93 | int icon_size = 18; |
91 | int icon_size = 18; |
Line -... | Line 92... | ||
- | 92 | ||
- | 93 | //Threads data |
|
- | 94 | dword about_thread_id; |
|
- | 95 | dword settings_window; |
|
- | 96 | bool active_about = false; |
|
- | 97 | bool active_settings = false; |
|
- | 98 | dword about_stak=0,properties_stak=0,settings_stak=0; |
|
- | 99 | byte cmd_free=0; |
|
- | 100 | ||
94 | 101 | //Multipanes |
|
95 | int active_panel=0; |
102 | int active_panel=0; |
96 | int disk_popin_active_on_panel=0; |
103 | int disk_popin_active_on_panel=0; |
97 | #define PANES_COUNT 2 |
104 | #define PANES_COUNT 2 |
Line 98... | Line -... | ||
98 | dword location[PANES_COUNT]; |
- | |
99 | - | ||
100 | dword about_stak=0,properties_stak=0,settings_stak=0; |
- | |
101 | byte cmd_free=0; |
105 | dword location[PANES_COUNT]; |
102 | 106 | ||
Line 103... | Line 107... | ||
103 | libimg_image icons16_default; |
107 | libimg_image icons16_default; |
104 | libimg_image icons16_selected; |
108 | libimg_image icons16_selected; |
Line 325... | Line 329... | ||
325 | case KFM_DEV_DROPDOWN_2: |
329 | case KFM_DEV_DROPDOWN_2: |
326 | case KFM_DEV_DROPDOWN_2+1: |
330 | case KFM_DEV_DROPDOWN_2+1: |
327 | EventOpenDiskPopin(active_panel); |
331 | EventOpenDiskPopin(active_panel); |
328 | break; |
332 | break; |
329 | case BACK_BTN...PASTE_BTN: |
333 | case BACK_BTN...PASTE_BTN: |
330 | SetActivePanel(0); |
- | |
331 | EventToolbarButtonClick(id); |
334 | EventToolbarButtonClick(id); |
332 | break; |
335 | break; |
333 | case BACK_BTN+100...PASTE_BTN+100: |
- | |
334 | SetActivePanel(1); |
- | |
335 | EventToolbarButtonClick(id-100); |
- | |
336 | break; |
- | |
337 | case 31...33: |
336 | case 31...33: |
338 | EventSort(id-30); |
337 | EventSort(id-30); |
339 | break; |
338 | break; |
340 | case 51: |
339 | case 51: |
341 | EventShowBurgerMenu(); |
340 | EventShowBurgerMenu(); |
Line 519... | Line 518... | ||
519 | dword title; |
518 | dword title; |
520 | static int rand_n; |
519 | static int rand_n; |
521 | if (rand_n) rand_n = random(80); |
520 | if (rand_n) rand_n = random(80); |
Line 522... | Line 521... | ||
522 | 521 | ||
523 | if (show_status_bar.checked) { |
522 | if (show_status_bar.checked) { |
524 | #define STBAR_EOLITE_H 16; |
523 | #define STBAR_EOLITE_H 16 |
525 | #define STBAR_KFM_H 21+16; |
524 | #define STBAR_KFM_H 21 |
526 | if (efm) status_bar_h = STBAR_KFM_H; |
525 | if (efm) status_bar_h = STBAR_KFM_H; |
527 | else status_bar_h = STBAR_EOLITE_H; |
526 | else status_bar_h = STBAR_EOLITE_H; |
528 | } else { |
527 | } else { |
529 | status_bar_h = 0; |
528 | status_bar_h = 0; |
Line 535... | Line 534... | ||
535 | if (Form.height < 356) { MoveSize(OLD,OLD,OLD,356); return; } |
534 | if (Form.height < 356) { MoveSize(OLD,OLD,OLD,356); return; } |
536 | GetProcessInfo(#Form, SelfInfo); |
535 | GetProcessInfo(#Form, SelfInfo); |
537 | SetAppColors(); |
536 | SetAppColors(); |
538 | if (efm) { |
537 | if (efm) { |
539 | if (screen.width > 693) && (Form.width < 693) { MoveSize(OLD,OLD,693,OLD); return; } |
538 | if (screen.width > 693) && (Form.width < 693) { MoveSize(OLD,OLD,693,OLD); return; } |
540 | DrawBar(0, 0, Form.cwidth, 34, sc.work); |
539 | DrawBar(0, 4, Form.cwidth, SELECTY-5, sc.work); |
- | 540 | DrawBar(0, SELECTY+KFM2_DEVH+1, Form.cwidth, 3, sc.work); |
|
- | 541 | DrawBar(0, SELECTY-1, 1, KFM2_DEVH+2, sc.work); |
|
- | 542 | 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); |
|
- | 544 | /* |
|
541 | #define PAD 7 |
545 | #define PAD 7 |
542 | #define GAP_S 26+5 |
546 | #define GAP_S 26+5 |
543 | #define GAP_B 26+14 |
547 | #define GAP_B 26+14 |
544 | x.set(Form.cwidth/2-DDW-203/2-GAP_S); |
548 | x.set(Form.cwidth/2-DDW-203/2-GAP_S); |
545 | while (i<200) { |
549 | while (i<200) { |
Line 551... | Line 555... | ||
551 | DrawTopPanelButton(i+PASTE_BTN,x.inc(GAP_S), PAD, 56, false); |
555 | DrawTopPanelButton(i+PASTE_BTN,x.inc(GAP_S), PAD, 56, false); |
552 | x.set(Form.cwidth/2-DDW-203/2-GAP_S+calc(Form.cwidth/2)); |
556 | x.set(Form.cwidth/2-DDW-203/2-GAP_S+calc(Form.cwidth/2)); |
553 | i+=100; |
557 | i+=100; |
554 | } |
558 | } |
555 | //DrawTopPanelButton(51, Form.cwidth-GAP_S-PAD, PAD, -1, false); //burger menu |
559 | //DrawTopPanelButton(51, Form.cwidth-GAP_S-PAD, PAD, -1, false); //burger menu |
- | 560 | */ |
|
556 | } else { |
561 | } else { |
557 | if (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; } |
562 | if (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; } |
558 | ESDWORD[#toolbar_pal] = sc.work; |
563 | ESDWORD[#toolbar_pal] = sc.work; |
559 | ESDWORD[#toolbar_pal+4] = MixColors(0, sc.work, 35); |
564 | ESDWORD[#toolbar_pal+4] = MixColors(0, sc.work, 35); |
560 | PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal); |
565 | PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal); |
Line 572... | Line 577... | ||
572 | DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg |
577 | DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg |
573 | for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10)); |
578 | for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10)); |
574 | for (i=0; i<6; i++) DrawBar(0, 5-i, Form.cwidth, 1, MixColors(sc.work_light, sc.work, i*10)); |
579 | for (i=0; i<6; i++) DrawBar(0, 5-i, Form.cwidth, 1, MixColors(sc.work_light, sc.work, i*10)); |
575 | llist_copy(#files_active, #files); |
580 | llist_copy(#files_active, #files); |
576 | DrawStatusBar(); |
581 | DrawStatusBar(); |
- | 582 | if (!selected_count) { |
|
577 | if (!selected_count) Open_Dir(path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] |
583 | Open_Dir(path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] |
- | 584 | } |
|
578 | DrawFilePanels(); |
585 | DrawFilePanels(); |
579 | disk_popin_active_on_panel = 0; |
586 | disk_popin_active_on_panel = 0; |
580 | } |
587 | } |
Line 581... | Line 588... | ||
581 | 588 | ||
Line 617... | Line 624... | ||
617 | { |
624 | { |
618 | char status_bar_str[80]; |
625 | char status_bar_str[80]; |
619 | int go_up_folder_exists=0; |
626 | int go_up_folder_exists=0; |
Line 620... | Line 627... | ||
620 | 627 | ||
621 | if (efm) { |
628 | if (efm) { |
622 | DrawBar(0, Form.cheight - status_bar_h+15, Form.cwidth, 3, sc.work); |
629 | DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, 2, sc.work); |
623 | DrawBar(0, Form.cheight - 2, Form.cwidth, 2, sc.work); |
630 | DrawBar(0, Form.cheight - 2, Form.cwidth, 2, sc.work); |
624 | DrawBar(Form.cwidth-1, Form.cheight - 19, 1, 17, sc.work); |
631 | DrawBar(Form.cwidth-1, Form.cheight - 19, 1, 17, sc.work); |
625 | DrawFuncButtonsInKfm(); |
- | |
626 | DrawPathBar(); |
632 | DrawFuncButtonsInKfm(); |
627 | return; |
- | |
628 | } |
- | |
629 | 633 | } else { |
|
630 | if (!show_status_bar.checked) return; |
634 | if (!show_status_bar.checked) return; |
631 | if (files.count>0) && (streq(items.get(0)*304+buf+72,"..")) go_up_folder_exists=1; |
635 | if (files.count>0) && (streq(items.get(0)*304+buf+72,"..")) go_up_folder_exists=1; |
632 | DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, sc.work); |
636 | DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, sc.work); |
633 | sprintf(#status_bar_str, T_STATUS_EVEMENTS, folder_count-go_up_folder_exists, files.count-folder_count); |
637 | sprintf(#status_bar_str, T_STATUS_EVEMENTS, folder_count-go_up_folder_exists, files.count-folder_count); |
Line 636... | Line 640... | ||
636 | sprintf(#status_bar_str, T_STATUS_SELECTED, selected_count); |
640 | sprintf(#status_bar_str, T_STATUS_SELECTED, selected_count); |
637 | WriteText(Form.cwidth - calc(strlen(#status_bar_str)*6)-6,Form.cheight - 13, |
641 | WriteText(Form.cwidth - calc(strlen(#status_bar_str)*6)-6,Form.cheight - 13, |
638 | 0x80,sc.work_text,#status_bar_str); |
642 | 0x80,sc.work_text,#status_bar_str); |
639 | } |
643 | } |
640 | } |
644 | } |
- | 645 | } |
|
Line 641... | Line 646... | ||
641 | 646 | ||
642 | void DrawFilePanels() |
647 | void DrawFilePanels() |
643 | { |
648 | { |
644 | int files_y = files.y; |
649 | int files_y = files.y; |
Line 648... | Line 653... | ||
648 | { |
653 | { |
649 | SystemDiscs.Draw(); |
654 | SystemDiscs.Draw(); |
650 | files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h); |
655 | files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h); |
651 | DrawButtonsAroundList(); |
656 | DrawButtonsAroundList(); |
652 | List_ReDraw(); |
657 | List_ReDraw(); |
- | 658 | DrawPathBar(); |
|
653 | } |
659 | } |
654 | else |
660 | else |
655 | { |
661 | { |
- | 662 | llist_copy(#files_active, #files); |
|
- | 663 | llist_copy(#files, #files_inactive); |
|
- | 664 | ||
656 | if (!active_panel) { |
665 | if (!active_panel) { |
657 | files.SetSizes(Form.cwidth/2, files_y, w2-17, h2, files.item_h); |
666 | files.SetSizes(Form.cwidth/2, files_y, w2-17, h2, files.item_h); |
658 | } else { |
667 | } else { |
659 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h); |
668 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h); |
660 | } |
669 | } |
Line 661... | Line 670... | ||
661 | 670 | ||
662 | files_inactive.x = files.x; |
671 | files_inactive.x = files.x; |
663 | DrawButtonsAroundList(); |
672 | DrawButtonsAroundList(); |
664 | path = location[active_panel^1]; |
673 | path = location[active_panel^1]; |
- | 674 | Open_Dir(path,WITH_REDRAW); |
|
665 | Open_Dir(location[active_panel^1],WITH_REDRAW); |
675 | if (!selected_count) files_inactive.count = files.count; |
Line 666... | Line 676... | ||
666 | llist_copy(#files_inactive, #files); |
676 | llist_copy(#files, #files_active); |
667 | 677 | ||
668 | if (!active_panel) { |
678 | if (!active_panel) { |
669 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h); |
679 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h); |
670 | } else { |
680 | } else { |
Line 671... | Line 681... | ||
671 | files.SetSizes(Form.cwidth/2, files_y, w2 -17, h2, files.item_h); |
681 | files.SetSizes(Form.cwidth/2, files_y, w2 -17, h2, files.item_h); |
672 | } |
682 | } |
673 | 683 | ||
674 | DrawButtonsAroundList(); |
684 | DrawButtonsAroundList(); |
675 | path = location[active_panel]; |
685 | path = location[active_panel]; |
Line 676... | Line 686... | ||
676 | Open_Dir(location[active_panel],WITH_REDRAW); |
686 | Open_Dir(path,WITH_REDRAW); |
677 | } |
687 | } |
Line 826... | Line 836... | ||
826 | void Open_Dir(dword dir_path, redraw){ |
836 | void Open_Dir(dword dir_path, redraw){ |
827 | int errornum; |
837 | int errornum; |
Line 828... | Line 838... | ||
828 | 838 | ||
829 | selected_count = 0; |
839 | selected_count = 0; |
830 | if (buf) free(buf); |
840 | if (buf) free(buf); |
831 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
- | |
832 | if (errornum) |
841 | if (errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT)) |
833 | { |
842 | { |
834 | history.add(path); |
843 | history.add(path); |
835 | EventHistoryGoBack(); |
844 | EventHistoryGoBack(); |
836 | Write_Error(errornum); |
845 | Write_Error(errornum); |
Line 844... | Line 853... | ||
844 | if (!strncmp(dir_path, "/rd/1",5)) || (!strncmp(dir_path, "/sys/",4)) |
853 | if (!strncmp(dir_path, "/rd/1",5)) || (!strncmp(dir_path, "/sys/",4)) |
845 | dir_at_fat16 = true; else dir_at_fat16 = false; |
854 | dir_at_fat16 = true; else dir_at_fat16 = false; |
846 | Sorting(); |
855 | Sorting(); |
847 | list_full_redraw = true; |
856 | list_full_redraw = true; |
848 | SetCurDir(dir_path); |
857 | SetCurDir(dir_path); |
849 | DrawPathBar(); |
- | |
850 | if (redraw!=ONLY_OPEN) { |
858 | if (redraw!=ONLY_OPEN) { |
851 | history.add(path); |
859 | history.add(path); |
852 | List_ReDraw(); |
860 | List_ReDraw(); |
853 | DrawStatusBar(); |
861 | DrawStatusBar(); |
- | 862 | DrawPathBar(); |
|
854 | } |
863 | } |
855 | } |
864 | } |
Line 856... | Line 865... | ||
856 | 865 | ||
857 | inline Sorting() |
866 | inline Sorting() |
Line 953... | Line 962... | ||
953 | if (iii==0) return; |
962 | if (iii==0) return; |
954 | iii = strrchr(path, '/'); |
963 | iii = strrchr(path, '/'); |
955 | strcpy(#old_folder_name, path+iii); |
964 | strcpy(#old_folder_name, path+iii); |
956 | if (iii>1) ESBYTE[path+iii-1]=NULL; else ESBYTE[path+iii]=NULL; |
965 | if (iii>1) ESBYTE[path+iii-1]=NULL; else ESBYTE[path+iii]=NULL; |
957 | SelectFileByName(#old_folder_name); |
966 | SelectFileByName(#old_folder_name); |
- | 967 | if(efm)DrawPathBarKfm(); |
|
958 | } |
968 | } |
Line 959... | Line 969... | ||
959 | 969 | ||
960 | void EventOpenSelected() |
970 | void EventOpenSelected() |
961 | { |
971 | { |
Line 1367... | Line 1377... | ||
1367 | void EventOpenDiskPopin(int panel_n) |
1377 | void EventOpenDiskPopin(int panel_n) |
1368 | { |
1378 | { |
1369 | DefineHiddenButton(0,0,5000,3000,9999+BT_NOFRAME); |
1379 | DefineHiddenButton(0,0,5000,3000,9999+BT_NOFRAME); |
1370 | if (panel_n==0) { |
1380 | if (panel_n==0) { |
1371 | disk_popin_active_on_panel = 1; |
1381 | disk_popin_active_on_panel = 1; |
1372 | SystemDiscs.DrawOptions(Form.cwidth/2-DDW); |
1382 | SystemDiscs.DrawOptions(1); |
1373 | } else { |
1383 | } else { |
1374 | disk_popin_active_on_panel = 2; |
1384 | disk_popin_active_on_panel = 2; |
1375 | SystemDiscs.DrawOptions(Form.cwidth-DDW-2); |
1385 | SystemDiscs.DrawOptions(Form.cwidth/2-1); |
1376 | } |
1386 | } |
1377 | } |
1387 | } |
Line 1378... | Line 1388... | ||
1378 | 1388 |