From 31c56c9a2c740f13b0029056851b1bc117f85e62 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 5 Jan 2022 20:24:25 +0000 Subject: [PATCH] Eolite 5.2: - show icon 32x32 in Properties window - fix "Contains:" value in Properties window - do not read ini file each time when we draw an icon, instead use a collection with a cached values git-svn-id: svn://kolibrios.org@9576 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/eolite/Eolite.c | 6 +-- programs/cmm/eolite/include/icons.h | 69 ++++++++++++++++-------- programs/cmm/eolite/include/properties.h | 7 ++- programs/cmm/lib/gui.h | 26 ++++----- programs/cmm/quark/quark.c | 4 +- 5 files changed, 69 insertions(+), 43 deletions(-) diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 0f76fe87ac..8529c3e871 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -11,9 +11,9 @@ TODO: http://board.kolibrios.org/viewtopic.php?f=23&t=4521&p=77334#p77334 */ -#define ABOUT_TITLE "EOLITE 5.19" -#define TITLE_EOLITE "Eolite File Manager 5.19" -#define TITLE_KFM "Kolibri File Manager 2.19"; +#define ABOUT_TITLE "EOLITE 5.2" +#define TITLE_EOLITE "Eolite File Manager 5.2" +#define TITLE_KFM "Kolibri File Manager 2.2"; #define MEMSIZE 1024 * 250 #include "../lib/clipboard.h" diff --git a/programs/cmm/eolite/include/icons.h b/programs/cmm/eolite/include/icons.h index 1c8c0594b8..50199b5cce 100644 --- a/programs/cmm/eolite/include/icons.h +++ b/programs/cmm/eolite/include/icons.h @@ -1,25 +1,46 @@ _ini icons_ini = { "/sys/File managers/icons.ini", NULL }; +struct ICONS_INI { + collection exts; + collection_int i18; + collection_int i32; + int get(); +} ini_icons; + +int ICONS_INI::get(dword _file_path, _ext, int size) +{ + char file_4bytes[4], ext[7]; + int ext_pos; + if (!_ext) { + ReadFile(0,4,#file_4bytes,_file_path); + IF(DSDWORD[#file_4bytes]=='KCPK') + ||(DSDWORD[#file_4bytes]=='UNEM') { + _ext = "kex"; + } + } + strlcpy(#ext, _ext, sizeof(ext)); + strlwr(#ext); + ext_pos = exts.get_pos_by_name(#ext); + if (ext_pos != -1) { + if (size == 18) return i18.get(ext_pos); + else if (size == 32) return i32.get(ext_pos); + } else { + exts.add(#ext); + icons_ini.section = "icons16"; + i18.set(exts.count-1, icons_ini.GetInt(#ext, 2)); + + icons_ini.section = "icons32"; + i32.set(exts.count-1, icons_ini.GetInt(#ext, 95)); + return get(#ext, size); + } +} + void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color) { - char BYTE_HEAD_FILE[4]; - char ext[512]; + char ext[7]; int icon_n = 2; dword selected_image; dword default_image; - dword default_icon; - - if (big_icons.checked) { - icons_ini.section = "icons32"; - selected_image = icons32_selected.image; - default_image = icons32_default.image; - default_icon=95; - } else { - icons_ini.section = "icons16"; - selected_image = icons16_selected.image; - default_image = icons16_default.image; - default_icon=2; - } if (ESBYTE[file_path+1]!='k') && (ESBYTE[file_path+1]!='s') && (chrnum(file_path, '/')==2) { if (ESBYTE[file_path+1]=='/') ext[0] = ESBYTE[file_path+2]; @@ -32,14 +53,16 @@ void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color) icons_ini.section = "drives16"; icon_n = icons_ini.GetInt(#ext, 50); } - } else if (extension) { - strcpy(#ext, extension); - strlwr(#ext); - icon_n = icons_ini.GetInt(#ext, default_icon); - } else if (file_path) { - ReadFile(0,4,#BYTE_HEAD_FILE,file_path); - IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM') - icon_n = icons_ini.GetInt("kex", 2); + } else { + icon_n = ini_icons.get(file_path, extension, icon_size); + } + + if (big_icons.checked) { + selected_image = icons32_selected.image; + default_image = icons32_default.image; + } else { + selected_image = icons16_selected.image; + default_image = icons16_default.image; } if (fairing_color==col.selec) { diff --git a/programs/cmm/eolite/include/properties.h b/programs/cmm/eolite/include/properties.h index 7ed8536b1c..a1daa657f2 100644 --- a/programs/cmm/eolite/include/properties.h +++ b/programs/cmm/eolite/include/properties.h @@ -263,7 +263,7 @@ void DrawPropertiesWindow() if (!itdir) { element_size = file_info_general.sizelo; } else { - sprintf(#folder_info,PR_T_CONTAINS,dir_size.files,dir_size.folders); + sprintf(#folder_info,T_FILES_FOLDERS,more_files_count.files,more_files_count.folders); WriteText(10, 117, 0x90, sc.work_text, PR_T_CONTAINS); WriteText(120, 117, 0x90, sc.work_text, #folder_info); element_size = dir_size.bytes; @@ -288,9 +288,8 @@ void DrawPropertiesWindow() void PropertiesDrawIcon(dword file_path, extension) { - #define ICON_PADDING 11 - DrawBar(20-ICON_PADDING, 30-ICON_PADDING-1, ICON_PADDING*2+16, ICON_PADDING*2+16, 0xFFFfff); - DrawIconByExtension(file_path, extension, -icon_size/2+28, -icon_size/2+38, 0xFFFfff); + int icon_n = ini_icons.get(file_path, extension, 32); + draw_icon_32(12, 22, sc.work, icon_n); } void EventApplyProperties() diff --git a/programs/cmm/lib/gui.h b/programs/cmm/lib/gui.h index 74ebe702df..b8006ff7d5 100644 --- a/programs/cmm/lib/gui.h +++ b/programs/cmm/lib/gui.h @@ -83,20 +83,22 @@ #define padding_h 15 #define right_margin 12 #define h padding_v + padding_v + 16 //16 font height - int tx = x + padding_h; - int ty = y + padding_v+1; int tw = strlen(text)*8; int w = tw + padding_h + padding_h; unsigned darker_color = MixColors(sc.button,0,230); DefineButton(x,y,w,h,id,sc.button); - WriteText(tx+1,ty+1,0x90,darker_color,text); - WriteText(tx,ty,0x90,sc.button_text,text); + x += padding_h; + y += padding_v+1; + + WriteText(x+1,y+1,0x90,darker_color,text); + WriteText(x,y,0x90,sc.button_text,text); if (active_button_id==id) { - DrawBar(tx,ty+15,tw,1, darker_color); - DrawBar(tx,ty+14,tw,1, sc.button_text); + + DrawBar(x,y+15,tw,1, darker_color); + DrawBar(x,y+14,tw,1, sc.button_text); } return w + right_margin; @@ -152,21 +154,21 @@ #define DOT_W 37 :void DrawFileBox(dword edit_box_pointer, title, btn) { - dword x,y,w,h,bg,t; + dword x,y,w,bg,t; ESI = edit_box_pointer; x = ESI.edit_box.left; y = ESI.edit_box.top; w = ESI.edit_box.width+1; - h = 22; + #define box_h 22 if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff; edit_box_draw stdcall (edit_box_pointer); - DrawRectangle3D(x-1, y-1, w+1, h+1, 0xE7E7E7, bg); - DrawRectangle(x-2, y-2, w+3, h+3, sc.work_graph); - DrawRectangle3D(x-3, y-3, w+DOT_W+5, h+5, sc.work_dark, sc.work_light); + DrawRectangle3D(x-1, y-1, w+1, box_h+1, 0xE7E7E7, bg); + DrawRectangle(x-2, y-2, w+3, box_h+3, sc.work_graph); + DrawRectangle3D(x-3, y-3, w+DOT_W+5, box_h+5, sc.work_dark, sc.work_light); WriteText(x-2, y-19, 0x90, sc.work_text, title); - DrawCaptButton(x+w+1, y-2, DOT_W, h+3, btn, sc.button, sc.button_text, "..."); + DrawCaptButton(x+w+1, y-2, DOT_W, box_h+3, btn, sc.button, sc.button_text, "..."); } :void DrawEditBoxPos(dword x,y, edit_box_pointer) diff --git a/programs/cmm/quark/quark.c b/programs/cmm/quark/quark.c index b445040198..804713a9be 100644 --- a/programs/cmm/quark/quark.c +++ b/programs/cmm/quark/quark.c @@ -324,7 +324,7 @@ void EventMagnifyMinus() void EventMagnifyPlus() { - font_size = math.min(3, font_size+1); + font_size = math.min(5, font_size+1); SetFontSize(font_size); ParseAndPaint(); } @@ -719,6 +719,8 @@ void SetFontSize(char _size) if (font_size == 1) list.SetFont( 8, 14, 00011000b); if (font_size == 2) list.SetFont(2*6, 2*9, 00001001b); if (font_size == 3) list.SetFont(2*8, 2*14-2, 00011001b); + if (font_size == 4) list.SetFont(3*6, 3*9, 00001010b); + if (font_size == 5) list.SetFont(3*8, 3*14-2, 00011010b); list.item_w = list.font_w; list.horisontal_selelection = true; list.SetSizes(0, TOOLBAR_H, Form.cwidth-scroll.size_x-1,