From 5bb70bb21992360ae5d6a463311e40b576193659 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sun, 27 Jun 2021 09:28:59 +0000 Subject: [PATCH] Eolite/KFM2: global refactoring, use proper multi-panes PATH variable git-svn-id: svn://kolibrios.org@8949 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/Tupfile.lua | 2 +- data/common/File Managers/kfm2 | Bin 461 -> 0 bytes programs/cmm/eolite/Eolite.c | 212 +++++++++--------- programs/cmm/eolite/Tupfile.lua | 2 +- programs/cmm/eolite/include/breadcrumbs.h | 41 ++-- programs/cmm/eolite/include/const.h | 177 ++++++++++----- programs/cmm/eolite/include/copy_and_delete.h | 10 +- programs/cmm/eolite/include/gui.h | 12 +- programs/cmm/eolite/include/left_panel.h | 177 +++++---------- programs/cmm/eolite/include/properties.h | 10 +- programs/cmm/eolite/include/settings.h | 15 +- programs/cmm/lib/fs.h | 7 +- programs/cmm/lib/gui.h | 30 ++- programs/cmm/lib/kolibri.h | 2 +- programs/cmm/misc/Tupfile.lua | 1 + programs/cmm/misc/kfm2.c | 12 + programs/cmm/search/search.c | 2 +- 17 files changed, 354 insertions(+), 358 deletions(-) delete mode 100644 data/common/File Managers/kfm2 create mode 100644 programs/cmm/misc/kfm2.c diff --git a/data/Tupfile.lua b/data/Tupfile.lua index 6403794c86..04b8ddd35c 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -27,7 +27,6 @@ img_files = { {"NOTIFY3.PNG", "common/notify3.png"}, {"UNIMG", PROGS .. "/fs/unimg/unimg"}, {"3D/HOUSE.3DS", "common/3d/house.3ds"}, - {"File Managers/KFM2", "common/File Managers/kfm2"}, {"File Managers/ICONS.INI", "common/File Managers/icons.ini"}, {"File Managers/KFM.INI", "common/File Managers/kfm.ini"}, {"File Managers/FNAV/ABOUT.TXT", "common/File Managers/fNav/About.txt"}, @@ -656,6 +655,7 @@ tup.append_table(img_files, { {"DEVELOP/MENU", PROGS .. "/cmm/menu/menu.com"}, {"DEVELOP/PIPET", PROGS .. "/cmm/misc/pipet.com"}, {"File Managers/EOLITE", PROGS .. "/cmm/eolite/Eolite.com"}, + {"File Managers/KFM2", PROGS .. "/cmm/misc/kfm2.com"}, {"KF_VIEW", PROGS .. "/cmm/kf_font_viewer/font_viewer.com"}, {"DEVELOP/DIFF", PROGS .. "/cmm/diff/diff.com"}, {"GAMES/CLICKS", PROGS .. "/games/clicks/trunk/clicks.com"}, diff --git a/data/common/File Managers/kfm2 b/data/common/File Managers/kfm2 deleted file mode 100644 index aecda359a9dce4141b6e7c5bfb6e48ceb77b6ba8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 461 zcmeZu^$T?kF)(CgU|{G2VizE0(174`K*4i@3=Ah&7#RMS@?@#LkOGQyy8h`d{iD`U z$5_nYstHutT`JIB%hMhEM?041#WavWtw47v$BP3n<{vk=7n^~clZSX1LOY*kxkO}1 zM|b-QoOJ*yQ|lD#F6B|{WQzsLp6C!}=-pfK=KueFr+^w>lmZDTALN)9xj=r#1(0AX zNKwFxgCJFZfyBwfF|KaD3Jm(imBspQnK`Knxrup+>8VA<`mXsonI)+Vt+)A`fgWLK zKJovs;iWG24mLM;C(B#>t?WR-V{BmYhWh^urB4hG9R9OrRm*|WUxzz?8=o{j;Q48t zf9J2x?@)I0$N!zzJ5P1~IQWw3^U}_X%@3JBFX_B-7!*!GzjU#6xc+H505RC`z)MM> z`CYCY7OsEzTRDL2Zdaa{tU&s|E6?i-Cl7Ie!-Tz`^^zh3gW-Wi&w$k8MZ7E*zq3-&N>_h07ulaR{#J2 diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index db7bc7666d..b24d78c52c 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -3,9 +3,9 @@ // 70.5 - get volume info and label -#define ABOUT_TITLE "EOLITE 5 Beta8" -#define TITLE_EOLITE "Eolite File Manager 5 Beta8" -#define TITLE_KFM "Kolibri File Manager 2 Beta8"; +#define ABOUT_TITLE "EOLITE 5 Beta9" +#define TITLE_EOLITE "Eolite File Manager 5 Beta9" +#define TITLE_KFM "Kolibri File Manager 2 Beta9"; #define MEMSIZE 1024 * 250 #include "../lib/clipboard.h" @@ -74,8 +74,7 @@ bool list_full_redraw; collection_int items=0; int selected_count; int folder_count; - //dword path; - char path[4096]; + dword path; //Sselected element data byte file_path[4096]; @@ -93,13 +92,10 @@ bool list_full_redraw; int status_bar_h; int icon_size = 18; - int active_panel=0; int disk_popin_active_on_panel=0; #define PANES_COUNT 2 -unsigned char location[PANES_COUNT]; - -char active_path[4096], inactive_path[4096]; +dword location[PANES_COUNT]; dword about_stak=0,properties_stak=0,settings_stak=0; byte cmd_free=0; @@ -134,11 +130,7 @@ void handle_param() //-v : paste files/folder from clipboard int i; dword p = #param; - if (param[0]=='\\') && (param[1]=='E') && (param[2]=='F') && (param[3]=='M') { - efm = true; - p += 4; - if (param[4]==' ') p++; - } + if (streq(#program_path+strrchr(#program_path,'/'), "KFM")) efm = true; LoadIniSettings(); @@ -146,7 +138,7 @@ void handle_param() location[i] = malloc(4096); strcpy(location[i], #path_start); } - //path = location[0]; + path = location[0]; if (ESBYTE[p]=='\0') return; @@ -157,31 +149,29 @@ void handle_param() itdir = dir_exists(#file_path); strcpy(#file_name, p + strrchr(p, '/')); ESBYTE[strrchr(p, '/')+p-1] = '\0'; - strcpy(#path, p + 3); + strcpy(path, p + 3); properties_dialog(); ExitProcess(); case 'd': - strcpy(#path, p + 3); + strcpy(path, p + 3); DeleteThread(); ExitProcess(); case 'v': cut_active = ESBYTE[p+2] - '0'; - strcpy(#path, p + 4); + strcpy(path, p + 4); PasteThread(); ExitProcess(); } - ESBYTE[0] = NULL; - if (param[strlen(#param)-1]=='/') ESBYTE[strlen(#param)-1]=NULL; //no "/" at the end if (dir_exists(p)) { - strcpy(#path, p); + strcpy(path, p); } else { if (file_exists(p)) { ESBYTE[strrchr(p, '/')+p-1] = '\0'; - strcpy(#path, p); - SelectFileByName(p+strlen(#path)+1); + strcpy(path, p); + SelectFileByName(p+strlen(path)+1); } else { notify(T_NOTIFY_APP_PARAM_WRONG); } @@ -200,11 +190,8 @@ void main() SetAppColors(); handle_param(); - ESBYTE[0] = NULL; - SystemDiscs.Get(); - Open_Dir(#path,ONLY_OPEN); - strcpy(#inactive_path, #path); + Open_Dir(path,ONLY_OPEN); llist_copy(#files_inactive, #files); SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); loop() switch(@WaitEventTimeout(100)) @@ -333,7 +320,7 @@ void main() { case PATH_BTN: notify(COPY_PATH_STR); - Clipboard__CopyText(#path); + Clipboard__CopyText(path); break; case KFM_DEV_DROPDOWN_1: case KFM_DEV_DROPDOWN_1+1: @@ -359,7 +346,7 @@ void main() FnProcess(id-50); break; case 61: // Set path as default - SetDefaultPath(#path); + SetDefaultPath(path); break; case 100...120: EventDriveClick(id); @@ -444,7 +431,7 @@ void main() EventOpenConsoleHere(); break; case SCAN_CODE_KEY_V: - EventPaste(#path); + EventPaste(path); break; case SCAN_CODE_KEY_D: //set image as bg strlcpy(#temp, "\\S__",4); @@ -588,9 +575,8 @@ void draw_window() for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10)); for (i=0; i<6; i++) DrawBar(0, 5-i, Form.cwidth, 1, MixColors(sc.work_light, sc.work, i*10)); llist_copy(#files_active, #files); - strcpy(#active_path, #path); DrawStatusBar(); - if (!selected_count) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] + if (!selected_count) Open_Dir(path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] DrawFilePanels(); disk_popin_active_on_panel = 0; } @@ -610,7 +596,9 @@ void DrawButtonsAroundList() if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; WriteText(sorting_arrow_x,files.y-12,0x80, sc.work_text, sorting_arrow_t); DrawBar(files.x+files.w,files.y,1,files.h,sc.work_graph); - if (efm) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,sc.work_graph); + if (efm) && (files.x<5) { + DrawBar(files.x+files.w+16,files.y,1,files.h,EDX); //line between panel + } } void DrawFuncButtonsInKfm() @@ -621,6 +609,7 @@ void DrawFuncButtonsInKfm() for (i=0; i<10; i++) { len = strlen(kfm_func[i])+2*6 + padding; if (i==9) len = Form.cwidth - x - 3; + DrawBar(x, Form.cheight - 19, 1, 17, sc.work); DrawFuncButton(x+1, Form.cheight - 19, len, i+KFM_FUNC_ID+1, i+1, kfm_func[i]); x += len + 2; } @@ -632,7 +621,9 @@ void DrawStatusBar() int go_up_folder_exists=0; if (efm) { - DrawBar(0, Form.cheight - status_bar_h+15, Form.cwidth, status_bar_h-15, sc.work); + DrawBar(0, Form.cheight - status_bar_h+15, Form.cwidth, 3, sc.work); + DrawBar(0, Form.cheight - 2, Form.cwidth, 2, sc.work); + DrawBar(Form.cwidth-1, Form.cheight - 19, 1, 17, sc.work); DrawFuncButtonsInKfm(); DrawPathBar(); return; @@ -652,9 +643,9 @@ void DrawStatusBar() void DrawFilePanels() { - int files_y; + int files_y = files.y; int w2 = -Form.cwidth-1/2+Form.cwidth; - int h2; + int h2 = Form.cheight-files_y-2 - status_bar_h; if (!efm) { DrawDeviceAndActionsLeftPanel(); @@ -664,37 +655,33 @@ void DrawFilePanels() } else { + llist_copy(#files_active, #files); llist_copy(#files, #files_inactive); - strcpy(#path, #inactive_path); - files_y = files.y; - h2 = Form.cheight-files_y-2 - status_bar_h; - col.selec = col.selec_inactive; //this is a bad code: need to use some var to set inactive panel for DrawButtonsAroundList(); + path = location[active_panel^1]; if (active_panel==0) { files.SetSizes(Form.cwidth/2, files_y, w2-17, h2, files.item_h); DrawButtonsAroundList(); - Open_Dir(#path,WITH_REDRAW); + Open_Dir(path,WITH_REDRAW); files_inactive.count = files.count; llist_copy(#files, #files_active); - strcpy(#path, #active_path); - col.selec = col.selec_active; + path = location[active_panel]; files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h); DrawButtonsAroundList(); - Open_Dir(#path,WITH_REDRAW); + Open_Dir(path,WITH_REDRAW); } if (active_panel==1) { files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h); DrawButtonsAroundList(); - Open_Dir(#path,WITH_REDRAW); + Open_Dir(path,WITH_REDRAW); files_inactive.count = files.count; llist_copy(#files, #files_active); - strcpy(#path, #active_path); - col.selec = col.selec_active; + path = location[active_panel]; files.SetSizes(Form.cwidth/2, files_y, w2 -17, h2, files.item_h); DrawButtonsAroundList(); - Open_Dir(#path,WITH_REDRAW); + Open_Dir(path,WITH_REDRAW); } } } @@ -745,7 +732,6 @@ void List_ReDraw() void Line_ReDraw(dword bgcol, filenum){ dword text_col=col.list_gb_text, ext1, attr, - file_offet, file_name_off, file_size=0, y=filenum*files.item_h+files.y, @@ -753,9 +739,15 @@ void Line_ReDraw(dword bgcol, filenum){ BDVK file; char full_path[4096]; dword separator_color; + bool current_inactive = false; char label_file_name[4096]; if (filenum==-1) return; + if (bgcol==col.selec) && (files.x==files_inactive.x) { + bgcol = col.list_bg; + current_inactive = true; + } + DrawBar(files.x,y,4,files.item_h,bgcol); DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol); 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); @@ -769,39 +761,40 @@ void Line_ReDraw(dword bgcol, filenum){ DrawBar(files.x+files.w-141,y,1,files.item_h, separator_color); DrawBar(files.x+files.w-68,y,1,files.item_h, separator_color); - file_offet = items.get(filenum+files.first)*304 + buf+32; - attr = ESDWORD[file_offet]; - file.selected = ESBYTE[file_offet+7]; - file.sizelo = ESDWORD[file_offet+32]; - file.sizehi = ESDWORD[file_offet+36]; - file_name_off = file_offet+40; + ESI = items.get(filenum+files.first)*304 + buf+32; + attr = ESDWORD[ESI]; + file.selected = ESBYTE[ESI+7]; + file.sizelo = ESDWORD[ESI+32]; + file.sizehi = ESDWORD[ESI+36]; + file_name_off = ESI+40; + sprintf(#full_path,"%s/%s",path,file_name_off); - if (! attr & ATR_FOLDER) //file or folder? + if (attr&ATR_FOLDER) { + if (!strcmp(file_name_off,"..")) ext1=""; else { + ext1=""; + WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); + } + if (chrnum(path, '/')==1) && (streq(path, "/kolibrios")==false) file_size = GetDeviceSize(#full_path); + } + else + { ext1 = strrchr(file_name_off,'.') + file_name_off; if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing file_size = ConvertSize64(file.sizelo, file.sizehi); if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); } - else - { - if (!strcmp(file_name_off,"..")) ext1=""; else { - ext1=""; - WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); - } - if (chrnum(#path, '/')==1) && (streq(#path, "/kolibrios")==false) file_size = GetDeviceSizeLabel(#full_path); - } if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58, files.text_y+y+1, files.font_type, col.list_gb_text, file_size); - if (attr&2) || (attr&4) text_col=col.list_text_hidden; //system or hiden? + if (attr&ATR_HIDDEN) || (attr&ATR_SYSTEM) text_col=col.list_text_hidden; if (bgcol==col.selec) { file_name_is_8_3(file_name_off); itdir = attr & ATR_FOLDER; strcpy(#file_name, file_name_off); - if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off); - else sprintf(#file_path,"%s/%s",#path,file_name_off); + if (streq(path,"/")) sprintf(#file_path,"%s%s",path,file_name_off); + else sprintf(#file_path,"%s/%s",path,file_name_off); if (text_col==col.list_text_hidden) { text_col=MixColors(col.selec_text, col.list_text_hidden, 65); } else text_col=col.selec_text; @@ -822,6 +815,7 @@ void Line_ReDraw(dword bgcol, filenum){ } else { + //that shit must be it a library strcpy(#label_file_name, file_name_off); if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) { @@ -833,10 +827,8 @@ void Line_ReDraw(dword bgcol, filenum){ kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, bgcol, text_col, kfont.size.pt, #label_file_name); } - if (bgcol == col.selec_inactive) DrawWideRectangle(files.x+2, y, files.w-4, files.item_h, 2, col.selec_active); - - sprintf(#full_path,"%s/%s",#path,file_name_off); DrawIconByExtension(#full_path, ext1, files.x+4, icon_y, bgcol); + if (current_inactive) DrawWideRectangle(files.x+2, y, files.w-4, files.item_h, 2, col.selec_active); } @@ -848,24 +840,24 @@ void Open_Dir(dword dir_path, redraw){ errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); if (errornum) { - history.add(#path); + history.add(path); EventHistoryGoBack(); Write_Error(errornum); return; } if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0; - history.add(#path); SystemDiscs.Draw(); files.visible = files.h / files.item_h; if (files.count < files.visible) files.visible = files.count; - if (!strncmp(dir_path, "/rd/1/",5)) || (!strncmp(dir_path, "/sys/",4)) + if (!strncmp(dir_path, "/rd/1",5)) || (!strncmp(dir_path, "/sys/",4)) dir_at_fat16 = true; else dir_at_fat16 = false; Sorting(); list_full_redraw = true; SetCurDir(dir_path); DrawPathBar(); if (redraw!=ONLY_OPEN) { + history.add(path); List_ReDraw(); DrawStatusBar(); } @@ -879,7 +871,7 @@ inline Sorting() items.drop(); - if (!strcmp(#path,"/")) //do not sort root folder + if (streq(path,"/")) //do not sort root folder { for(d=1;d=0; ind--;) { if (!strcmpi(items.get(ind)*304+buf+72,that_file)) break; } files.cur_y = ind - 1; @@ -966,11 +958,11 @@ void Dir_Up() { int iii; char old_folder_name[4096]; - iii=strlen(#path)-1; + iii=strlen(path)-1; if (iii==0) return; - iii = strrchr(#path, '/'); - strcpy(#old_folder_name, #path+iii); - if (iii>1) path[iii-1]=NULL; else path[iii]=NULL; + iii = strrchr(path, '/'); + strcpy(#old_folder_name, path+iii); + if (iii>1) ESBYTE[path+iii-1]=NULL; else ESBYTE[path+iii]=NULL; SelectFileByName(#old_folder_name); } @@ -980,7 +972,7 @@ void EventOpenSelected() for (i=0; i sc_h-sc_slider_y+56) || (files.first+files.visible>=files.count) sc_slider_y= sc_y + sc_h - sc_slider_h; //фы  сюы№°юую ёяшёър + if (sc_slider_h < 20) { + sc_slider_h = 20; //set minimal scroll height + } + if (sc_slider_h > sc_h-sc_slider_y+56) || (files.first+files.visible>=files.count) { + sc_slider_y= sc_y + sc_h - sc_slider_h; //fix for the very long list + } } //slider DrawRectangle(sc_x,sc_slider_y,16,sc_slider_h,sc.work_graph); diff --git a/programs/cmm/eolite/include/left_panel.h b/programs/cmm/eolite/include/left_panel.h index 87001313f3..05943112c5 100644 --- a/programs/cmm/eolite/include/left_panel.h +++ b/programs/cmm/eolite/include/left_panel.h @@ -1,42 +1,4 @@ -#ifdef LANG_RUS - ?define T_DEVICES "Устройства" - ?define T_ACTIONS "Действия" - char *actions[] = { - 59, "Новый файл", "F9", - 57, "Новая папка", "F7", - 60, "Настройки", "F10", - 0,0,0 - }; - ?define T_PROG "Программы " - ?define T_SYS "Система " - ?define T_UNC "Неизвестно " - ?define T_CD "CD-ROM " - ?define T_FD "Дискета " - ?define T_HD "Жесткий диск " - ?define T_SATA "SATA диск " - ?define T_USB "USB диск " - ?define T_RAM "RAM диск " -#else - ?define T_DEVICES "Devices" - ?define T_ACTIONS "Actions" - char *actions[] = { - 59, "New file", "F9", - 57, "New folder", "F7", - 60, "Settings", "F10", - 0,0,0 - }; - ?define T_PROG "Programs " - ?define T_SYS "System " - ?define T_UNC "Unknown " - ?define T_CD "CD-ROM " - ?define T_FD "Floppy disk " - ?define T_HD "Hard disk " - ?define T_SATA "SATA disk " - ?define T_USB "USB disk " - ?define T_RAM "RAM disk " -#endif - struct _SystemDiscs { collection list; @@ -48,51 +10,6 @@ struct _SystemDiscs void Click(); } SystemDiscs=0; -#define DEV_H 17 -#define DEV_H_HOR 20 - -void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name) -{ - switch(disk_first_letter) - { - case 'r': - ESBYTE[dev_icon]=0; - strcpy(disc_name, T_SYS); - break; - case 'k': - ESBYTE[dev_icon]=1; - strcpy(disc_name, T_PROG); - break; - case 'f': - ESBYTE[dev_icon]=2; - strcpy(disc_name, T_FD); - break; - case 'c': - ESBYTE[dev_icon]=3; - strcpy(disc_name, T_CD); - break; - case 'h': - case 'b': - ESBYTE[dev_icon]=4; - strcpy(disc_name, T_HD); - break; - case 's': - ESBYTE[dev_icon]=4; - strcpy(disc_name, T_SATA); - break; - case 't': - ESBYTE[dev_icon]=5; - strcpy(disc_name, T_RAM); - break; - case 'u': - ESBYTE[dev_icon]=6; - strcpy(disc_name, T_USB); - break; - default: - ESBYTE[dev_icon]=5; - } -} - void _SystemDiscs::Get() { bool kolibrios_exists=false; @@ -126,23 +43,35 @@ void _SystemDiscs::Get() free(diskbuf); } +void GetDiskIconAndName(char disk_first_letter, dword dev_icon, dword disc_name) +{ + int i; + for (i=0; devinfo[i]!=0; i+=3) { + if (disk_first_letter == ESBYTE[devinfo[i]]) { + ESBYTE[dev_icon] = devinfo[i+1]; + strcpy(disc_name, devinfo[i+2]); + return; + } + } + ESBYTE[dev_icon]=5; + strcpy(disc_name, T_UNC); +} + +#define DEV_H 17 #define DDW 120 +#define KFM2_DEVH 20 void _SystemDiscs::Draw() { - char dev_name[15], disc_name[100], i, dev_icon, is_active=0; + char dev_name[15], disc_name[100], i, dev_icon; + bool is_active=0; int draw_y, draw_x; for (i=0; i<30; i++) DeleteButton(100+i); if (efm) { - if (active_panel==0) { - DrawSelect(Form.cwidth/2-DDW, 10, #path, KFM_DEV_DROPDOWN_1); - DrawSelect(Form.cwidth-DDW-2, 10, #inactive_path, KFM_DEV_DROPDOWN_2); - } else { - DrawSelect(Form.cwidth/2-DDW, 10, #inactive_path, KFM_DEV_DROPDOWN_1); - DrawSelect(Form.cwidth-DDW-2, 10, #path, KFM_DEV_DROPDOWN_2); - } + DrawSelect(Form.cwidth/2-DDW, KFM_DEV_DROPDOWN_1, location[0]); + DrawSelect(Form.cwidth-DDW-2, KFM_DEV_DROPDOWN_2, location[sizeof(dword)]); files.y = 40 + 17; } else { draw_y = 74; @@ -150,11 +79,11 @@ void _SystemDiscs::Draw() for (i=0;i"); else { - sprintf(#temp_path,"%s/%s",#path,#file_name2); + sprintf(#temp_path,"%s/%s",path,#file_name2); ext1 = strrchr(#file_name2,'.'); if (ext1) ext1 += #file_name2; PropertiesDrawIcon(#temp_path, ext1); diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h index d4b4a1ec11..d9801f1dda 100644 --- a/programs/cmm/eolite/include/settings.h +++ b/programs/cmm/eolite/include/settings.h @@ -68,9 +68,9 @@ void settings_dialog() } else if (id==6) { - strcpy(#path_start,#path); + strcpy(#path_start,path); path_start_ed.size = path_start_ed.pos = strlen(#path_start); - ini.SetString("DefaultPath", #path, strlen(#path)); + ini.SetString("DefaultPath", path, strlen(path)); edit_box_draw stdcall (#path_start_ed); break; } @@ -103,7 +103,7 @@ void settings_dialog() case evReDraw: DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 400, - 365+skin_height,0x34,sc.work,TITLE_SETT,0); + -efm*62+365+skin_height,0x34,sc.work,TITLE_SETT,0); GetProcessInfo(#Settings, SelfInfo); DrawSettingsCheckBoxes(); } @@ -125,9 +125,11 @@ void DrawSettingsCheckBoxes() #define FRX 26 #define XXX 11 y.n = 0; - show_dev_name.draw(XXX, y.inc(14)); - show_status_bar.draw(XXX, y.inc(25)); - show_breadcrumb.draw(XXX, y.inc(25)); + if (!efm) { + show_dev_name.draw(XXX, y.inc(14)); + show_status_bar.draw(XXX, y.inc(25)); + show_breadcrumb.draw(XXX, y.inc(25)); + } big_icons.draw(XXX, y.inc(25)); colored_lines.draw(XXX, y.inc(25)); font_size.draw(XXX, y.inc(31)); @@ -160,7 +162,6 @@ void LoadIniSettings() Form.top = ini.GetInt("WinY", 30); Form.width = ini.GetInt("WinW", efm*170+550); Form.height = ini.GetInt("WinH", efm*100+517); - ini.GetString("DefaultPath", #path, 4096, "/rd/1"); ini.GetString("DefaultPath", #path_start, 4096, "/rd/1"); path_start_ed.size = path_start_ed.pos = strlen(#path_start); kfont.init(DEFAULT_FONT); diff --git a/programs/cmm/lib/fs.h b/programs/cmm/lib/fs.h index 83325d04ed..7904221d6f 100644 --- a/programs/cmm/lib/fs.h +++ b/programs/cmm/lib/fs.h @@ -40,7 +40,12 @@ dword sizehi; char name[518]; }; +#define ATR_READONLY 1 +#define ATR_HIDDEN 2 +#define ATR_SYSTEM 4 +#define ATR_VOL_LABEL 8 #define ATR_FOLDER 0x10 +#define ATR_NONARH 0x20 :dword GetFileInfo(dword file_path, bdvk_struct) @@ -203,7 +208,7 @@ inline fastcall void GetCurDir( ECX, EDX) $int 0x40 } -void read_file(dword path1, buf, size) +:void read_file(dword path1, buf, size) { EAX = 68; EBX = 27; diff --git a/programs/cmm/lib/gui.h b/programs/cmm/lib/gui.h index 23817d423f..baa654e75f 100644 --- a/programs/cmm/lib/gui.h +++ b/programs/cmm/lib/gui.h @@ -53,17 +53,17 @@ :void DrawWideRectangle(dword x,y,w,h,boder,color1) { DrawBar(x, y, w, boder, color1); - DrawBar(x, y+h-boder, w, boder, color1); - DrawBar(x, y+boder, boder, h-boder-boder, color1); - DrawBar(x+w-boder, y+boder, boder, h-boder-boder, color1); + DrawBar(x, y+h-boder, w, boder, EDX); + DrawBar(x, y+boder, boder, h-boder-boder, EDX); + DrawBar(x+w-boder, y+boder, boder, h-boder-boder, EDX); } :void DrawRectangle3D(dword x,y,w,h,color1,color2) { DrawBar(x,y,w+1,1,color1); - DrawBar(x,y+1,1,h-1,color1); + DrawBar(x,y+1,1,h-1,EDX); DrawBar(x+w,y+1,1,h,color2); - DrawBar(x,y+h,w,1,color2); + DrawBar(x,y+h,w,1,EDX); } :void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text) @@ -220,7 +220,7 @@ { DrawRectangle(x,y,w,h,col_border); DrawBar(x+1,y+1,w-1,1,0xFFFfff); - DrawBar(x+1,y+2,1,h-2,0xFFFfff); + DrawBar(x+1,y+2,1,h-2,EDX); if (col_work!=-1) DrawBar(x+2,y+2,w-2,h-2,col_work); DrawPopupShadow(x,y,w,h-1,skinned); } @@ -289,9 +289,9 @@ DrawBar(x+w+1, y+2, 1, h-2, right); PutPixel(x, y, dots); - PutPixel(x+w+1, y+h+1, dots); - PutPixel(x, y+h+1, dots); - PutPixel(x+w+1, y, dots); + PutPixel(x+w+1, y+h+1, EDX); + PutPixel(x, y+h+1, EDX); + PutPixel(x+w+1, y, EDX); PutPixel(x, y+h, dark); PutPixel(x+w+1, y+1, light); @@ -300,15 +300,13 @@ :bool skin_is_dark() { - dword gray; - dword color_image = #sc.work; + ESI = #sc.work; - gray = DSBYTE[color_image]*DSBYTE[color_image]; - gray += DSBYTE[color_image+1]*DSBYTE[color_image+1]; - gray += DSBYTE[color_image+2]*DSBYTE[color_image+2]; - gray = sqrt(gray) / 3; + EDI = DSBYTE[ESI]*DSBYTE[ESI]; + EDI += DSBYTE[ESI+1]*DSBYTE[ESI+1]; + EDI += DSBYTE[ESI+2]*DSBYTE[ESI+2]; - if (gray < 65) { + if (sqrt(EDI) / 3 < 65) { return true; } else { return false; diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index 0c5bdda763..a4f7861560 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -18,7 +18,7 @@ #define ENTRY_POINT #______INIT______ #endif -char os_name[8] = {'M','E','N','U','E','T','0','1'}; +char os_name[] = "MENUET01"n; dword os_version = 0x00000001; dword start_addr = ENTRY_POINT; dword final_addr = #______STOP______+32; diff --git a/programs/cmm/misc/Tupfile.lua b/programs/cmm/misc/Tupfile.lua index fd6fdf865d..bff7675e3f 100644 --- a/programs/cmm/misc/Tupfile.lua +++ b/programs/cmm/misc/Tupfile.lua @@ -11,4 +11,5 @@ tup.rule("notify.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_ tup.rule("osupdate.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "osupdate.com") tup.rule("pipet.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "pipet.com") tup.rule("software_widget.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "software_widget.com") +tup.rule("kfm2.c", "c-- %f" .. tup.getconfig("KPACK_CMD"), "kfm2.com") diff --git a/programs/cmm/misc/kfm2.c b/programs/cmm/misc/kfm2.c new file mode 100644 index 0000000000..641b6cba41 --- /dev/null +++ b/programs/cmm/misc/kfm2.c @@ -0,0 +1,12 @@ +#define MEMSIZE 1024*20 +#define ENTRY_POINT #main + +#include "../lib/fs.h" + +void main() +{ + RenameMove("KFM", abspath("EOLITE")); + RunProgram(abspath("KFM"), #param); + RenameMove("EOLITE", abspath("KFM")); + ExitProcess(); +} diff --git a/programs/cmm/search/search.c b/programs/cmm/search/search.c index 8b2302af38..31bfec67ef 100644 --- a/programs/cmm/search/search.c +++ b/programs/cmm/search/search.c @@ -162,7 +162,7 @@ void main() void draw_window() { sc.get(); - DefineAndDrawWindow(screen.width-600/2,100,640,600+skin_height,0x73,sc.work,T_WINDOW_HEADER,0); + DefineAndDrawWindow(screen.width-600/2,100,640,600,0x73,sc.work,T_WINDOW_HEADER,0); GetProcessInfo(#Form, SelfInfo); IF (Form.status_window&ROLLED_UP) return; if (Form.width < 270) { MoveSize(OLD,OLD,270,OLD); return; }