From 8a5c16a53a0c60a83e8902519ff4aa0bde1002ea Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Tue, 16 Nov 2021 02:05:12 +0000 Subject: [PATCH] Eolite: show volume label in a device folder git-svn-id: svn://kolibrios.org@9277 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/eolite/Eolite.c | 17 +++++++++++------ programs/cmm/eolite/include/left_panel.h | 10 ++++++++-- programs/cmm/lib/fs.h | 17 +++++++++++++++++ 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 5df4f132ca..ad54c57948 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -5,14 +5,13 @@ BUGS: - F1 in KFM (move Properties to an external app) TODO: -- 70.5 - get volume info and label - add option Preserve all timestamps (Created, Opened, Modified) http://board.kolibrios.org/viewtopic.php?f=23&t=4521&p=77334#p77334 */ -#define ABOUT_TITLE "EOLITE 5.06" -#define TITLE_EOLITE "Eolite File Manager 5.06 Gold" -#define TITLE_KFM "Kolibri File Manager 2.06 Gold"; +#define ABOUT_TITLE "EOLITE 5.1" +#define TITLE_EOLITE "Eolite File Manager 5.1" +#define TITLE_KFM "Kolibri File Manager 2.1"; #define MEMSIZE 1024 * 250 #include "../lib/clipboard.h" @@ -799,6 +798,7 @@ void Line_ReDraw(dword bgcol, filenum){ char full_path[4096]; dword separator_color; bool current_inactive = false; + char volume_label[64] = 0; char label_file_name[4096]; if (filenum==-1) return; @@ -825,6 +825,7 @@ void Line_ReDraw(dword bgcol, filenum){ file.sizelo = ESI.BDVK.sizelo; file.sizehi = ESI.BDVK.sizehi; file_name_off = #ESI.BDVK.name; + sprintf(#full_path,"%s/%s",path,file_name_off); if (attr&ATR_FOLDER) { @@ -833,7 +834,10 @@ void Line_ReDraw(dword bgcol, filenum){ 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) - && (streq(path, "/sys")==false) file_size = GetDeviceSize(#full_path); + && (streq(path, "/sys")==false) { + file_size = GetDeviceSize(#full_path); + if (ESBYTE[path+1]) strlcpy(#volume_label, GetVolumeLabel(#full_path), sizeof(volume_label)); + } } else { @@ -873,8 +877,9 @@ void Line_ReDraw(dword bgcol, filenum){ } else { - //that shit must be it a library + //that shit must be in a library strcpy(#label_file_name, file_name_off); + if (volume_label) sprintf(#label_file_name, "%s [%s]", file_name_off, #volume_label); if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) { while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) { diff --git a/programs/cmm/eolite/include/left_panel.h b/programs/cmm/eolite/include/left_panel.h index aa9296e5f1..0f37c2ece6 100644 --- a/programs/cmm/eolite/include/left_panel.h +++ b/programs/cmm/eolite/include/left_panel.h @@ -134,7 +134,8 @@ void _SystemDiscs::DrawSelect(int draw_x, btid, dword _path) void _SystemDiscs::DrawOptions(int draw_x) { int optionsy = SELECTY+KFM2_DEVH+1; - char dev_name[15], disc_name[100], i, dev_icon, is_active=0; + char dev_name[15], disc_name[100], volume_label[64], label_file_name[100]; + char i, dev_icon, is_active=0; SystemDiscs.Get(); @@ -149,7 +150,12 @@ void _SystemDiscs::DrawOptions(int draw_x) DefineButton(draw_x, optionsy, DDW, KFM2_DEVH-1, 100+i+BT_HIDE,0xFFFFFF); _PutImage(draw_x + 5, optionsy+2, 18,17, is_active*7+dev_icon*17*18*3+#devices); if (is_active) kfont.bold = true; - kfont.WriteIntoWindow(draw_x + 24, optionsy+2, 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1); + //strncpy(#volume_label, GetVolumeLabel(#dev_name), sizeof(volume_label)); + strcpy(#label_file_name, #dev_name); + //if (dev_name[1]!='k') && (dev_name[2]!='y') { + // if (volume_label) sprintf(#label_file_name, "%s [%s]", #dev_name, #volume_label); + //} + kfont.WriteIntoWindow(draw_x + 24, optionsy+2, 0xFFFfff, 0x000000, kfont.size.pt, #label_file_name+1); kfont.bold = false; optionsy += KFM2_DEVH; } diff --git a/programs/cmm/lib/fs.h b/programs/cmm/lib/fs.h index 69e804264e..3c2464147c 100644 --- a/programs/cmm/lib/fs.h +++ b/programs/cmm/lib/fs.h @@ -62,6 +62,23 @@ $int 0x40 } +:dword GetVolumeLabel(dword _path) +{ + BDVK bdvk; + //if (ESBYTE[_path+1]=='k') || (ESBYTE[_path+2]=='y') return NULL; + f70.func = 5; + f70.param1 = 0; + f70.param2 = 1; + f70.param3 = 1; + f70.param4 = #bdvk; + f70.rezerv = 0; + f70.name = _path; + $mov eax,70 + $mov ebx,#f70.func + $int 0x40 + return #bdvk.name; +} + :dword SetFileInfo(dword file_path, bdvk_struct) { f70.func = 6;