Eolite: show correct size in bytes in Properties dialog (thanks Mario for the code snippet)

git-svn-id: svn://kolibrios.org@9693 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2022-02-06 23:16:38 +00:00
parent 19347417f0
commit 684ee81f3e
7 changed files with 69 additions and 73 deletions

View File

@ -11,9 +11,9 @@ TODO:
http://board.kolibrios.org/viewtopic.php?f=23&t=4521&p=77334#p77334
*/
#define ABOUT_TITLE "EOLITE 5.22"
#define TITLE_EOLITE "Eolite File Manager 5.22"
#define TITLE_KFM "Kolibri File Manager 2.22";
#define ABOUT_TITLE "EOLITE 5.25"
#define TITLE_EOLITE "Eolite File Manager 5.25"
#define TITLE_KFM "Kolibri File Manager 2.25";
#define MEMSIZE 1024 * 250
#include "../lib/clipboard.h"

View File

@ -71,16 +71,17 @@ char *actions[] = {
#define T_APPLY "<22>ਬ¥­¨âì"
#define QUEST_1 "<22>ਬ¥­¨âì ª® ¢á¥¬ ¢«®¦¥­­ë¬"
#define QUEST_2 "ä ©« ¬ ¨ ¯ ¯ª ¬?"
#define PR_T_NAME "<22><>:"
#define PR_T_DEST "<22><><EFBFBD><E7948E>キ┘:"
#define T_NAME "ˆ¬ï:"
#define T_DATA "„ ­­ë¥"
#define T_BULK_SELECTION "‚뤥«¥­® ­¥áª®«ìª® í«¥¬¥­â®¢"
#define T_PATH_SIZE "<22>ãâì:\n<> §¬¥à:\n ¡ ©â å:\n®¤¥à¦¨â:"
#define T_FILES_FOLDERS "” ©«®¢ %i, <20> ¯®ª %i"
#define CREATED_OPENED_MODIFIED "‘®§¤ ­:\nŽâªàëâ:\nˆ§¬¥­¥­:"
#define T_FILES_FOLDERS "<22><><EFBFBD><EFBFBD>: %i <20><><EFBFBD><EFBFBD>: %i"
#define PR_T_CONTAINS "<22><>ムΘ<E383A0>: "
#define FLAGS " €âਡãâë "
#define PR_T_ONLY_READ "’®«ìª® ç⥭¨¥"
#define PR_T_HIDDEN "‘ªàëâë©"
#define PR_T_SYSTEM "‘¨á⥬­ë©"
#define PR_T_ONLY_READ "<22><><EFBFBD> 艪キ┘"
#define T_PROP_SIZE "<22><>Кム: %s (%i <20><><EFBFBD>)"
#define TITLE_SETT "<22> áâனª¨"
#define SHOW_DEVICE_CLASS "‚뢮¤¨âì ­ §¢ ­¨ï ª« áá  ãáâனáâ¢"
@ -168,16 +169,17 @@ char *actions[] = {
#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 "Location:"
#define T_NAME "Name:"
#define T_DATA "Data"
#define T_BULK_SELECTION "A bunch of items is selected"
#define T_PATH_SIZE "Location:\nSize:\nBytes:\nContains:"
#define T_FILES_FOLDERS "Files %i, Folders %i"
#define CREATED_OPENED_MODIFIED "Created:\nOpened:\nModified:"
#define T_FILES_FOLDERS "Files: %i Folders: %i"
#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 T_PROP_SIZE "Size: %s (%i byte)"
#define TITLE_SETT "Settings"
#define SHOW_DEVICE_CLASS "Show device class name"

View File

@ -119,8 +119,8 @@ void GetSizeMoreFiles(dword way)
else
{
GetFileInfo(#cur_file, #file_info_dirsize);
more_files_count.bytes += file_info_dirsize.sizelo;
more_files_count.bytes += file_info_dirsize.sizehi;
more_files_count.sizelo += file_info_dirsize.sizelo;
more_files_count.sizehi += file_info_dirsize.sizehi;
more_files_count.files++;
}
}
@ -171,7 +171,7 @@ void properties_dialog()
cmd_free=3;
ExitProcess();
}
if (id==B_APPLY) EventApplyProperties();
if (id==B_APPLY) goto _APPLY_PROPERTIES;
break;
case evMouse:
@ -199,7 +199,12 @@ void properties_dialog()
break;
case SCAN_CODE_ENTER:
EventApplyProperties();
_APPLY_PROPERTIES:
if (getSelectedCount()) || (itdir) {
ShowConfirmQuestionPopin();
} else {
SetProperties(SET_PROPERTIES_SINGLE_FILE);
}
break;
case SCAN_CODE_KEY_A:
@ -220,62 +225,60 @@ void properties_dialog()
void DrawPropertiesWindow()
{
proc_info pform;
char size_lbl[32];
char folder_info[200];
dword ext1;
incn y;
char temp_path[PATHLEN];
bool show_date = false;
dword p_t_formated_size;
dword p_q_size_bytes;
dword t_contains_files_and_folders[200];
if (chrnum(path, '/')>1) || (streq(path, "/kolibrios")) || (streq(path, "/sys")) show_date = true;
if (getSelectedCount()) show_date = false;
DefineAndDrawWindow(Form.left + 150,150,315,show_date*60+300+skin_h,0x34,sc.work,WINDOW_TITLE_PROPERTIES,0);
DefineAndDrawWindow(Form.left + 150,150,315,show_date*60+342+skin_h,0x34,sc.work,WINDOW_TITLE_PROPERTIES,0);
GetProcessInfo(#pform, SelfInfo);
DrawStandartCaptButton(pform.cwidth - 96, pform.cheight-34, B_CLOSE, T_CLOSE);
DrawStandartCaptButton(pform.cwidth -208, pform.cheight-34, B_APPLY, T_APPLY);
WriteText(10, 78, 0x90, sc.work_text, PR_T_DEST);
edit_box_draw stdcall (#path_to_file_ed);
if (getSelectedCount())
{
PropertiesDrawIcon(NULL, "<lot>");
sprintf(#folder_info,T_FILES_FOLDERS,more_files_count.files,more_files_count.folders);
WriteText(file_name_ed.left+4, 30, 0x90, sc.work_text, #folder_info);
sprintf(#size_lbl,T_PROP_SIZE,ConvertSize64(more_files_count.bytes, more_files_count.bytes>>32),more_files_count.bytes);
WriteText(10, 97, 0x90, sc.work_text, #size_lbl);
}
else
{
if ( file_info_general.isfolder )
PropertiesDrawIcon(NULL, "<DIR>");
else {
sprintf(#temp_path,"%s/%s",path,#file_name2);
ext1 = strrchr(#file_name2,'.');
if (ext1) ext1 += #file_name2;
PropertiesDrawIcon(#temp_path, ext1);
}
WriteText(file_name_ed.left, file_name_ed.top-15, 0x80, sc.work_text, PR_T_NAME);
WriteText(file_name_ed.left+4, 30, 0x90, sc.work_text, T_BULK_SELECTION);
p_t_formated_size = ConvertSize64(more_files_count.sizelo, more_files_count.sizehi);
p_q_size_bytes = #more_files_count.sizelo;
sprintf(#t_contains_files_and_folders,T_FILES_FOLDERS,more_files_count.files,more_files_count.folders);
} else {
WriteText(file_name_ed.left, file_name_ed.top-15, 0x80, sc.work_text, T_NAME);
DrawEditBox(#file_name_ed);
if (!itdir) {
sprintf(#size_lbl,T_PROP_SIZE,ConvertSize64(file_info_general.sizelo, file_info_general.sizehi),file_info_general.sizelo);
if (itdir) {
PropertiesDrawIcon(NULL, "<DIR>");
p_t_formated_size = ConvertSize64(dir_size.sizelo, dir_size.sizehi);
p_q_size_bytes = #dir_size.sizelo;
sprintf(#t_contains_files_and_folders,T_FILES_FOLDERS,dir_size.files,dir_size.folders);
} else {
sprintf(#folder_info,T_FILES_FOLDERS,dir_size.files,dir_size.folders);
WriteText(10, 117, 0x90, sc.work_text, PR_T_CONTAINS);
WriteText(120, 117, 0x90, sc.work_text, #folder_info);
sprintf(#size_lbl,T_PROP_SIZE,ConvertSize64(dir_size.bytes, dir_size.bytes_high),dir_size.bytes);
sprintf(#temp_path,"%s/%s",path,#file_name2);
if (ext1 = strrchr(#file_name2,'.')) ext1 += #file_name2;
PropertiesDrawIcon(#temp_path, ext1);
p_t_formated_size = ConvertSize64(file_info_general.sizelo, file_info_general.sizehi);
p_q_size_bytes = #file_info_general.sizelo;
sprintf(#t_contains_files_and_folders,T_DATA);
}
WriteText(10, 99, 0x90, sc.work_text, #size_lbl);
}
WriteTextLines(10, y.set(78), 0x90, sc.work_text, T_PATH_SIZE, 20);
edit_box_draw stdcall (#path_to_file_ed);
WriteText(120, y.inc(20), 0x90, sc.work_text, p_t_formated_size);
WriteNumber(120, y.inc(20), 0x90, sc.work_text, 0xc0140001, p_q_size_bytes);
WriteText(120, y.inc(20), 0x90, sc.work_text, #t_contains_files_and_folders);
if (show_date) {
WriteTextLines(10, 136, 0x90, sc.work_text, CREATED_OPENED_MODIFIED, 20);
DrawDateTime(120, 136, sc.work_text, #file_info_general.datecreate, #file_info_general.timecreate);
DrawDateTime(120, 156, sc.work_text, #file_info_general.datelastaccess, #file_info_general.timelastaccess);
DrawDateTime(120, 176, sc.work_text, #file_info_general.datelastedit, #file_info_general.timelastedit);
WriteTextLines(10, y.inc(32), 0x90, sc.work_text, CREATED_OPENED_MODIFIED, 20);
DrawDateTime(120, y.n, sc.work_text, #file_info_general.datecreate, #file_info_general.timecreate);
DrawDateTime(120, y.inc(20), sc.work_text, #file_info_general.datelastaccess, #file_info_general.timelastaccess);
DrawDateTime(120, y.inc(20), sc.work_text, #file_info_general.datelastedit, #file_info_general.timelastedit);
}
DrawFrame(10, y.set(pform.cheight - 143), -10*2 + pform.cwidth - 2, 92, FLAGS);
@ -290,12 +293,3 @@ void PropertiesDrawIcon(dword file_path, extension)
int icon_n = ini_icons.get(file_path, extension, 32);
draw_icon_32(12, 22, sc.work, icon_n);
}
void EventApplyProperties()
{
if (getSelectedCount()) || (itdir) {
ShowConfirmQuestionPopin();
} else {
SetProperties(SET_PROPERTIES_SINGLE_FILE);
}
}

View File

@ -491,15 +491,15 @@ int block_size=1024*1024*4; //copy by 4 MiB
BDVK dir_info;
dword folders;
dword files;
dword bytes;
dword bytes_high;
dword sizelo;
dword sizehi;
dword get();
dword calculate_loop();
};
:dword DIR_SIZE::get(dword way1)
{
folders = files = bytes = bytes_high = 0;
folders = files = sizelo = sizehi = 0;
if (!way1) return 0;
calculate_loop(way1);
}
@ -528,8 +528,8 @@ int block_size=1024*1024*4; //copy by 4 MiB
else
{
GetFileInfo(cur_file, #dir_info);
bytes += dir_info.sizelo;
bytes_high += dir_info.sizehi;
sizelo += dir_info.sizelo;
sizehi += dir_info.sizehi;
files++;
}
}

View File

@ -465,10 +465,10 @@ inline fastcall dword SetWindowLayerBehaviour(EDX, ESI)
WriteText(x,y, fontType, color, str_offset);
}
:void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset)
:void WriteNumber(dword x,y,byte fontType, dword color, flags, number_or_offset)
{
EAX = 47;
EBX = count<<16;
EBX = flags;
ECX = number_or_offset;
EDX = x<<16+y;
ESI = fontType<<24+color;

View File

@ -165,7 +165,7 @@ void Draw_Panel()
void Draw_Count()
{
EDI = sc.work; //writing a number with bg
WriteNumber(WIN_W-32, PANEL_Y + 12, 0xD0, sc.work_text, 3, count);
WriteNumber(WIN_W-32, PANEL_Y + 12, 0xD0, sc.work_text, 3<<16, count);
}

View File

@ -103,9 +103,9 @@ void EventUpdateWindowContent()
WriteTextWithBg(12,12, 0xD0, 0x000111, #picked_color_string, 0xFFFfff);
WriteNumber(12,33, 0xD0, 0xff0000, 3, rgb.r);
WriteNumber(44,33, 0xD0, 0x008000, 3, rgb.g);
WriteNumber(75,33, 0xD0, 0x0000ff, 3, rgb.b);
WriteNumber(12,33, 0xD0, 0xff0000, 3<<16, rgb.r);
WriteNumber(44,33, 0xD0, 0x008000, 3<<16, rgb.g);
WriteNumber(75,33, 0xD0, 0x0000ff, 3<<16, rgb.b);
DrawBar(PICKED_X, PICKED_PADDING, PICKED_SIZE, PICKED_SIZE, picked_color);
}