diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index f0d9f1b50..65ff8c05c 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -3,14 +3,14 @@ /* BUGS: -- fix a kfm2 bug with selected files on window deactivation +- F1 in KFM (move Properties to an external app) TODO: - 70.5 - get volume info and label */ -#define ABOUT_TITLE "EOLITE 5 RC6" -#define TITLE_EOLITE "Eolite File Manager 5 RC7" -#define TITLE_KFM "Kolibri File Manager 2 RC7"; +#define ABOUT_TITLE "EOLITE 5 Gold" +#define TITLE_EOLITE "Eolite File Manager 5 Gold" +#define TITLE_KFM "Kolibri File Manager 2 Gold"; #define MEMSIZE 1024 * 250 #include "../lib/clipboard.h" @@ -59,8 +59,6 @@ dword waves_pal[256]; //Folder data dword buf, buf_inactive; collection_int items=0; - collection_int selected=0; - int selected_count; int folder_count; dword path; bool dir_at_fat16 = NULL; @@ -95,6 +93,8 @@ dword waves_pal[256]; #define PANES_COUNT 2 dword location[PANES_COUNT]; llist files, files_active, files_inactive; + collection_int selected0, selected1; + dword selected_count[PANES_COUNT]=0; libimg_image icons16_default; libimg_image icons16_selected; @@ -125,7 +125,12 @@ void handle_param() //-v : paste files/folder from clipboard int i; dword p = #param; - if (streq(#program_path+strrchr(#program_path,'/'), "KFM")) efm = true; + if (streq(#program_path+strrchr(#program_path,'/'), "KFM")) { + efm = true; + //now we need to restore the original app name + //without this external operations down won't work + strcpy(#program_path+strrchr(#program_path,'/'), "EOLITE"); + } LoadIniSettings(); @@ -234,7 +239,7 @@ void main() if (mouse.key&MOUSE_RIGHT) && (mouse.up) { if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); - if (getElementSelectedFlag(files.cur_y) == false) selected_count = 0; //on redraw selection would be flashed, see [L001] + if (getElementSelectedFlag(files.cur_y) == false) unselectAll(); //on redraw selection would be flashed, see [L001] EventShowListMenu(); } } @@ -579,7 +584,7 @@ void draw_window() 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); DrawStatusBar(); - if (!selected_count) { + if (!getSelectedCount()) { OpenDir(ONLY_OPEN); //if there are no selected files -> refresh folder [L001] } DrawFilePanels(); @@ -639,8 +644,8 @@ void DrawStatusBar() DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, sc.work); sprintf(#status_bar_str, T_STATUS_EVEMENTS, folder_count-go_up_folder_exists, files.count-folder_count); WriteText(6,Form.cheight - 13,0x80,sc.work_text,#status_bar_str); - if (selected_count) { - sprintf(#status_bar_str, T_STATUS_SELECTED, selected_count); + if (getSelectedCount()) { + sprintf(#status_bar_str, T_STATUS_SELECTED, getSelectedCount()); WriteText(Form.cwidth - calc(strlen(#status_bar_str)*6)-6,Form.cheight - 13, 0x80,sc.work_text,#status_bar_str); } @@ -674,8 +679,10 @@ void DrawFilePanels() files_inactive.x = files.x; DrawButtonsAroundList(); path = location[active_panel^1]; - OpenDir(WITH_REDRAW); - if (!selected_count) files_inactive.count = files.count; + active_panel ^= 1; + OpenDir2(WITH_REDRAW); + active_panel ^= 1; + if (!getSelectedCount()) files_inactive.count = files.count; llist_copy(#files, #files_active); if (!active_panel) { @@ -686,10 +693,58 @@ void DrawFilePanels() DrawButtonsAroundList(); path = location[active_panel]; - OpenDir(WITH_REDRAW); + OpenDir2(WITH_REDRAW); } } +void OpenDir2(char redraw){ + if (buf) free(buf); + if (GetDir(#buf, #files.count, path, DIRS_NOROOT)) { + Write_Error(EAX); + history.add(path); + EventHistoryGoBack(); + return; + } + SetCurDir(path); + if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0; + files.visible = math.min(files.h / files.item_h, files.count); + if (!strncmp(path, "/rd/1",5)) || (!strncmp(path, "/sys/",4)) + dir_at_fat16 = true; else dir_at_fat16 = false; + Sorting(); + SystemDiscs.Draw(); + list_full_redraw = true; + List_ReDraw(); + DrawPathBar(); +} + + +void OpenDir(char redraw){ + int errornum; + unselectAll(); + if (buf) free(buf); + if (errornum = GetDir(#buf, #files.count, path, DIRS_NOROOT)) { + 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 = math.min(files.h / files.item_h, files.count); + if (!strncmp(path, "/rd/1",5)) || (!strncmp(path, "/sys/",4)) + dir_at_fat16 = true; else dir_at_fat16 = false; + Sorting(); + list_full_redraw = true; + SetCurDir(path); + if (redraw!=ONLY_OPEN) { + List_ReDraw(); + DrawStatusBar(); + DrawPathBar(); + } +} + + void List_ReDraw() { int all_lines_h; @@ -764,7 +819,6 @@ void Line_ReDraw(dword bgcol, filenum){ 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; @@ -801,7 +855,7 @@ void Line_ReDraw(dword bgcol, filenum){ text_col=MixColors(col.selec_text, col.list_text_hidden, 65); } else text_col=col.selec_text; } - if (file.selected) text_col=0xFF0000; + if (getElementSelectedFlag(filenum+files.first)) text_col=0xFF0000; if (kfont.size.pt==9) || (!kfont.font) { if (Form.width>=480) @@ -833,36 +887,6 @@ void Line_ReDraw(dword bgcol, filenum){ if (current_inactive) DrawWideRectangle(files.x+2, y, files.w-4, files.item_h, 2, col.selec); } - -void OpenDir(char redraw){ - int errornum; - - selected_count = 0; - if (buf) free(buf); - if (errornum = GetDir(#buf, #files.count, path, DIRS_NOROOT)) - { - 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 = math.min(files.h / files.item_h, files.count); - if (!strncmp(path, "/rd/1",5)) || (!strncmp(path, "/sys/",4)) - dir_at_fat16 = true; else dir_at_fat16 = false; - Sorting(); - list_full_redraw = true; - SetCurDir(path); - if (redraw!=ONLY_OPEN) { - List_ReDraw(); - DrawStatusBar(); - DrawPathBar(); - } -} - inline Sorting() { dword d=0, f=1; @@ -947,7 +971,7 @@ void EventOpenSelected() void EventOpen(byte _new_window) { - if (selected_count) && (!itdir) notify(T_USE_SHIFT_ENTER); + if (getSelectedCount()) && (!itdir) notify(T_USE_SHIFT_ENTER); if (_new_window) { if (streq(#file_name,"..")) return; @@ -1083,11 +1107,11 @@ void ShowPopinForm(byte _popin_type) break; case POPIN_DELETE: if (!files.count) return; - if (!selected_count) && (!strncmp(#file_name,"..",2)) return; + if (!getSelectedCount()) && (!strncmp(#file_name,"..",2)) return; popinx = DrawEolitePopup(T_YES, T_NO); WriteTextCenter(popinx, 178, POPIN_W, sc.work_text, T_DELETE_FILE); - if (selected_count) { - sprintf(#param,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2); + if (getSelectedCount()) { + sprintf(#param,"%s%d%s",DEL_MORE_FILES_1,getSelectedCount(),DEL_MORE_FILES_2); } else { if (strlen(#file_name)<28) { sprintf(#param,"%s ?",#file_name); @@ -1314,7 +1338,7 @@ void EventPaste(dword _into_path) { void EventShowProperties() char line_param[4096+5]; { - if (!selected_count) { + if (!getSelectedCount()) { sprintf(#line_param, "-p %s", #file_path); RunProgram(#program_path, #line_param); } else { diff --git a/programs/cmm/eolite/include/const.h b/programs/cmm/eolite/include/const.h index 7cd36c8d5..c8a3c1cd1 100644 --- a/programs/cmm/eolite/include/const.h +++ b/programs/cmm/eolite/include/const.h @@ -54,13 +54,44 @@ char *actions[] = { }; #define T_PROG "Программы " #define T_SYS "Система " -#define T_CD "CD-ROM " +#define T_CD "CD-Rom " #define T_FD "Дискета " #define T_HD "Жесткий диск " #define T_SATA "SATA диск " #define T_USB "USB диск " #define T_RAM "RAM диск " #define T_UNC "Неизвестно " + +#define WINDOW_TITLE_PROPERTIES "Свойства" +#define T_CLOSE "Закрыть" +#define T_APPLY "Применить" +#define QUEST_1 "Применить ко всем вложенным" +#define QUEST_2 "файлам и папкам?" +#define PR_T_NAME "Имя:" +#define PR_T_DEST "Расположение:" +#define PR_T_SIZE "Размер:" +#define CREATED_OPENED_MODIFIED "Создан:\nОткрыт:\nИзменен:" +#define SET_6 "Файлов: " +#define SET_7 " Папок: " +#define PR_T_CONTAINS "Содержит: " +#define FLAGS " Аттрибуты " +#define PR_T_HIDDEN "Скрытый" +#define PR_T_SYSTEM "Системный" +#define PR_T_ONLY_READ "Только чтение" +#define SET_BYTE_LANG "байт" + +#define TITLE_SETT "Настройки" +#define SHOW_DEVICE_CLASS "Выводить названия класса устройств" +#define SHOW_STATUS_BAR "Показывать статус бар" +#define BIG_ICONS "Использовать большие иконки" +#define COLORED_LINES "Подсвечивать четные линии в списке" +#define FONT_SIZE_LABEL "Размер шрифта" +#define LIST_LINE_HEIGHT "Высота строки в списке" +#define SAVE_PATH_AS_DEFAULT "Текущий путь" +#define SAVE_START_PATH_AS_DEFAULT "Введенный путь" +#define EDIT_FILE_ASSOCIATIONS "Редактировать ассоциации файлов" +#define START_PATH " Стартовый путь: " + //===================================================// // // // ENGLISH // @@ -118,13 +149,44 @@ char *actions[] = { }; #define T_PROG "Programs " #define T_SYS "System " -#define T_CD "CD-ROM " +#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 " #define T_UNC "Unknown " + +#define WINDOW_TITLE_PROPERTIES "Properties" +#define T_CLOSE "Close" +#define T_APPLY "Apply" +#define QUEST_1 "Apply to all subfolders" +#define QUEST_2 "files and Folders?" +#define PR_T_NAME "Name:" +#define PR_T_DEST "Destination:" +#define PR_T_SIZE "Size:" +#define CREATED_OPENED_MODIFIED "Created:\nOpened:\nModified:" +#define SET_6 "Files: " +#define SET_7 " Folders: " +#define PR_T_CONTAINS "Contains: " +#define FLAGS " Attributes " +#define PR_T_HIDDEN "Hidden" +#define PR_T_SYSTEM "System" +#define PR_T_ONLY_READ "Read-only" +#define SET_BYTE_LANG "byte" + +#define TITLE_SETT "Settings" +#define SHOW_DEVICE_CLASS "Show device class name" +#define SHOW_STATUS_BAR "Show status bar" +#define BIG_ICONS "Big icons in list" +#define COLORED_LINES "Highlight even lines in list" +#define FONT_SIZE_LABEL "Font size" +#define LIST_LINE_HEIGHT "List line height" +#define SAVE_PATH_AS_DEFAULT "Current path" +#define SAVE_START_PATH_AS_DEFAULT "Typed path" +#define EDIT_FILE_ASSOCIATIONS "Edit file associations" +#define START_PATH " Start path: " + #endif //===================================================// @@ -152,6 +214,11 @@ enum { KFM_FUNC_ID = 450 }; +#define B_SETINGS_APPLY_SUBFOLDER 301 +#define B_SETINGS_APPLY_NO_SUBFOLDER 302 +#define B_APPLY 11 +#define B_CLOSE 12 + //OpenDir options enum { WITH_REDRAW, @@ -190,4 +257,4 @@ char *devinfo = { #define SELECTY 10 #define POPIN_W 260 -int toolbar_buttons_x[7]={9,46,85,134,167,203}; \ No newline at end of file +int toolbar_buttons_x[7]={9,46,85,134,167,203}; diff --git a/programs/cmm/eolite/include/copy_and_delete.h b/programs/cmm/eolite/include/copy_and_delete.h index 0500bf625..f8e97f70e 100644 --- a/programs/cmm/eolite/include/copy_and_delete.h +++ b/programs/cmm/eolite/include/copy_and_delete.h @@ -1,25 +1,41 @@ //===================================================// // // -// MASS ACTIONS // +// SELECTION // // // //===================================================// +void unselectAll() { + selected_count[active_panel] = 0; + if (active_panel) { + selected0.drop(); + } else { + selected1.drop(); + } +} + +dword getSelectedCount() { + return selected_count[active_panel]; +} + void setElementSelectedFlag(dword n, int state) { - dword selected_offset = items.get(n)*304 + buf+32 + 7; - ESBYTE[selected_offset] = state; - if (n==0) && (strncmp(items.get(n)*304+buf+72,"..",2)==0) { - ESBYTE[selected_offset] = false; //do not selec ".." directory - return; + if (n==0) && (strncmp(items.get(n)*304+buf+72,"..",2)==0) return; + if (active_panel) { + selected0.set(n, state); + } else { + selected1.set(n, state); } - if (state==true) selected_count++; - if (state==false) selected_count--; - if (selected_count<0) selected_count=0; + if (state==true) selected_count[active_panel]++; + if (state==false) selected_count[active_panel]--; + //if (selected_count[active_panel]<0) selected_count[active_panel]=0; } int getElementSelectedFlag(dword n) { - dword selected_offset = items.get(n)*304 + buf+32 + 7; - return ESBYTE[selected_offset]; + if (active_panel) { + return selected0.get(n); + } else { + return selected1.get(n); + } } dword GetFilesCount(dword _in_path) @@ -60,11 +76,11 @@ void CopyFilesListToClipboard(bool _cut_active) if (_cut_active!=DELETE) cut_active = _cut_active; //if no element selected by "Insert" key, then we copy current element - if (!selected_count) { + if (!getSelectedCount()) { setElementSelectedFlag(files.cur_y, true); } - if (!selected_count) return; + if (!getSelectedCount()) return; size_buf = 10; for (i=0; i"); sprintf(#folder_info,"%s%d%s%d",SET_6,more_files_count.files,SET_7,more_files_count.folders); @@ -334,7 +292,7 @@ void PropertiesDrawIcon(dword file_path, extension) void EventApplyProperties() { - if (selected_count) || (itdir) { + if (getSelectedCount()) || (itdir) { ShowConfirmQuestionPopin(); } else { SetProperties(SET_PROPERTIES_SINGLE_FILE); diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h index 3e3e6e6a0..b95c97532 100644 --- a/programs/cmm/eolite/include/settings.h +++ b/programs/cmm/eolite/include/settings.h @@ -1,30 +1,4 @@ -#ifdef LANG_RUS - ?define TITLE_SETT "Настройки" - ?define SHOW_DEVICE_CLASS "Выводить названия класса устройств" - ?define SHOW_STATUS_BAR "Показывать статус бар" - ?define BIG_ICONS "Использовать большие иконки" - ?define COLORED_LINES "Подсвечивать четные линии в списке" - ?define FONT_SIZE_LABEL "Размер шрифта" - ?define LIST_LINE_HEIGHT "Высота строки в списке" - ?define SAVE_PATH_AS_DEFAULT "Текущий путь" - ?define SAVE_START_PATH_AS_DEFAULT "Введенный путь" - ?define EDIT_FILE_ASSOCIATIONS "Редактировать ассоциации файлов" - ?define START_PATH " Стартовый путь: " -#else - ?define TITLE_SETT "Settings" - ?define SHOW_DEVICE_CLASS "Show device class name" - ?define SHOW_STATUS_BAR "Show status bar" - ?define BIG_ICONS "Big icons in list" - ?define COLORED_LINES "Highlight even lines in list" - ?define FONT_SIZE_LABEL "Font size" - ?define LIST_LINE_HEIGHT "List line height" - ?define SAVE_PATH_AS_DEFAULT "Current path" - ?define SAVE_START_PATH_AS_DEFAULT "Typed path" - ?define EDIT_FILE_ASSOCIATIONS "Edit file associations" - ?define START_PATH " Start path: " -#endif - dword eolite_ini_path[4096]; _ini ini;