Eolite 5 and KFM 2: versions Gold.

git-svn-id: svn://kolibrios.org@8983 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-06-30 11:38:29 +00:00
parent 2995e59834
commit fa1df98a61
5 changed files with 180 additions and 141 deletions

View File

@ -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 {

View File

@ -54,13 +54,44 @@ char *actions[] = {
};
#define T_PROG "<22>ணࠬ¬ë "
#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 "<22>¥¨§¢¥áâ­® "
#define WINDOW_TITLE_PROPERTIES "‘¢®©á⢠"
#define T_CLOSE "‡ ªàëâì"
#define T_APPLY "<22>ਬ¥­¨âì"
#define QUEST_1 "<22>ਬ¥­¨âì ª® ¢á¥¬ ¢«®¦¥­­ë¬"
#define QUEST_2 "ä ©« ¬ ¨ ¯ ¯ª ¬?"
#define PR_T_NAME "ˆ¬ï:"
#define PR_T_DEST "<22> á¯®«®¦¥­¨¥:"
#define PR_T_SIZE "<22> §¬¥à:"
#define CREATED_OPENED_MODIFIED "‘®§¤ ­:\nŽâªàëâ:\nˆ§¬¥­¥­:"
#define SET_6 "” ©«®¢: "
#define SET_7 " <20> ¯®ª: "
#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 "<22> áâனª¨"
#define SHOW_DEVICE_CLASS "‚뢮¤¨âì ­ §¢ ­¨ï ª« áá  ãáâனáâ¢"
#define SHOW_STATUS_BAR "<22>®ª §ë¢ âì áâ âãá ¡ à"
#define BIG_ICONS "ˆá¯®«ì§®¢ âì ¡®«ì訥 ¨ª®­ª¨"
#define COLORED_LINES "<22>®¤á¢¥ç¨¢ âì ç¥â­ë¥ «¨­¨¨ ¢ ᯨ᪥"
#define FONT_SIZE_LABEL "<22> §¬¥à èà¨äâ "
#define LIST_LINE_HEIGHT "‚ëá®â  áâப¨ ¢ ᯨ᪥"
#define SAVE_PATH_AS_DEFAULT "’¥ªã騩 ¯ãâì"
#define SAVE_START_PATH_AS_DEFAULT "‚¢¥¤¥­­ë© ¯ãâì"
#define EDIT_FILE_ASSOCIATIONS "<22>¥¤ ªâ¨à®¢ âì  áá®æ¨ æ¨¨ ä ©«®¢"
#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};
int toolbar_buttons_x[7]={9,46,85,134,167,203};

View File

@ -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<files.count; i++)
@ -78,7 +94,7 @@ void CopyFilesListToClipboard(bool _cut_active)
buff_data = malloc(size_buf);
ESDWORD[buff_data] = size_buf;
ESDWORD[buff_data+4] = SLOT_DATA_TYPE_RAW;
ESINT[buff_data+8] = selected_count;
ESINT[buff_data+8] = getSelectedCount();
copy_buf_offset = buff_data + 10;
for (i=0; i<files.count; i++)
{
@ -96,7 +112,7 @@ void CopyFilesListToClipboard(bool _cut_active)
pause(20);
List_ReDraw();
}
if (selected_count==1) setElementSelectedFlag(files.cur_y, false);
if (getSelectedCount()==1) setElementSelectedFlag(files.cur_y, false);
Clipboard__SetSlotData(size_buf, buff_data);
free(buff_data);
}

View File

@ -1,45 +1,3 @@
#ifdef LANG_RUS
?define WINDOW_TITLE_PROPERTIES "‘¢®©á⢠"
?define T_CLOSE "‡ ªàëâì"
?define T_APPLY "<EFBFBD>ਬ¥­¨âì"
?define QUEST_1 "<EFBFBD>ਬ¥­¨âì ª® ¢á¥¬ ¢«®¦¥­­ë¬"
?define QUEST_2 "ä ©« ¬ ¨ ¯ ¯ª ¬?"
?define PR_T_NAME "ˆ¬ï:"
?define PR_T_DEST "<EFBFBD> á¯®«®¦¥­¨¥:"
?define PR_T_SIZE "<EFBFBD> §¬¥à:"
?define CREATED_OPENED_MODIFIED "‘®§¤ ­:\nŽâªàëâ:\nˆ§¬¥­¥­:"
?define SET_6 "” ©«®¢: "
?define SET_7 " <20> ¯®ª: "
?define PR_T_CONTAINS "‘®¤¥à¦¨â: "
?define FLAGS " €ââਡãâë "
?define PR_T_HIDDEN "‘ªàëâë©"
?define PR_T_SYSTEM "‘¨á⥬­ë©"
?define PR_T_ONLY_READ "’®«ìª® ç⥭¨¥"
?define SET_BYTE_LANG "¡ ©â"
#else // Apply to all subfolders
?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"
#endif
#define B_SETINGS_APPLY_SUBFOLDER 301
#define B_SETINGS_APPLY_NO_SUBFOLDER 302
#define B_APPLY 11
#define B_CLOSE 12
char path_to_file[4096];
char file_name2[4096];
@ -109,7 +67,7 @@ void SetProperties(int mode)
if (SET_PROPERTIES_ALL_SUBFOLDER == mode)
|| (SET_PROPERTIES_NO_SUBFOLDER == mode)
{
if (selected_count)
if (getSelectedCount())
{
for (i=0; i<files.count; i++)
{
@ -174,7 +132,7 @@ void properties_dialog()
{
int id;
if (selected_count)
if (getSelectedCount())
{
more_files_count.get(NULL);
GetSizeMoreFiles(path);
@ -280,7 +238,7 @@ void DrawPropertiesWindow()
WriteText(10, 97, 0x90, sc.work_text, PR_T_SIZE);
if (selected_count)
if (getSelectedCount())
{
PropertiesDrawIcon(NULL, "<lot>");
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);

View File

@ -1,30 +1,4 @@
#ifdef LANG_RUS
?define TITLE_SETT "<EFBFBD> áâனª¨"
?define SHOW_DEVICE_CLASS "‚뢮¤¨âì ­ §¢ ­¨ï ª« áá  ãáâனáâ¢"
?define SHOW_STATUS_BAR "<EFBFBD>®ª §ë¢ âì áâ âãá ¡ à"
?define BIG_ICONS "ˆá¯®«ì§®¢ âì ¡®«ì訥 ¨ª®­ª¨"
?define COLORED_LINES "<EFBFBD>®¤á¢¥ç¨¢ âì ç¥â­ë¥ «¨­¨¨ ¢ ᯨ᪥"
?define FONT_SIZE_LABEL "<EFBFBD> §¬¥à èà¨äâ "
?define LIST_LINE_HEIGHT "‚ëá®â  áâப¨ ¢ ᯨ᪥"
?define SAVE_PATH_AS_DEFAULT "’¥ªã騩 ¯ãâì"
?define SAVE_START_PATH_AS_DEFAULT "‚¢¥¤¥­­ë© ¯ãâì"
?define EDIT_FILE_ASSOCIATIONS "<EFBFBD>¥¤ ªâ¨à®¢ âì  áá®æ¨ æ¨¨ ä ©«®¢"
?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;