Eolite: show volume label in a device folder

git-svn-id: svn://kolibrios.org@9277 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-11-16 02:05:12 +00:00
parent 981be4e80e
commit 8a5c16a53a
3 changed files with 36 additions and 8 deletions

View File

@ -5,14 +5,13 @@
BUGS: BUGS:
- F1 in KFM (move Properties to an external app) - F1 in KFM (move Properties to an external app)
TODO: TODO:
- 70.5 - get volume info and label
- add option Preserve all timestamps (Created, Opened, Modified) - add option Preserve all timestamps (Created, Opened, Modified)
http://board.kolibrios.org/viewtopic.php?f=23&t=4521&p=77334#p77334 http://board.kolibrios.org/viewtopic.php?f=23&t=4521&p=77334#p77334
*/ */
#define ABOUT_TITLE "EOLITE 5.06" #define ABOUT_TITLE "EOLITE 5.1"
#define TITLE_EOLITE "Eolite File Manager 5.06 Gold" #define TITLE_EOLITE "Eolite File Manager 5.1"
#define TITLE_KFM "Kolibri File Manager 2.06 Gold"; #define TITLE_KFM "Kolibri File Manager 2.1";
#define MEMSIZE 1024 * 250 #define MEMSIZE 1024 * 250
#include "../lib/clipboard.h" #include "../lib/clipboard.h"
@ -799,6 +798,7 @@ void Line_ReDraw(dword bgcol, filenum){
char full_path[4096]; char full_path[4096];
dword separator_color; dword separator_color;
bool current_inactive = false; bool current_inactive = false;
char volume_label[64] = 0;
char label_file_name[4096]; char label_file_name[4096];
if (filenum==-1) return; if (filenum==-1) return;
@ -825,6 +825,7 @@ void Line_ReDraw(dword bgcol, filenum){
file.sizelo = ESI.BDVK.sizelo; file.sizelo = ESI.BDVK.sizelo;
file.sizehi = ESI.BDVK.sizehi; file.sizehi = ESI.BDVK.sizehi;
file_name_off = #ESI.BDVK.name; file_name_off = #ESI.BDVK.name;
sprintf(#full_path,"%s/%s",path,file_name_off);
if (attr&ATR_FOLDER) 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); 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) 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 else
{ {
@ -873,8 +877,9 @@ void Line_ReDraw(dword bgcol, filenum){
} }
else else
{ {
//that shit must be it a library //that shit must be in a library
strcpy(#label_file_name, file_name_off); 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) 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) { while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) {

View File

@ -134,7 +134,8 @@ void _SystemDiscs::DrawSelect(int draw_x, btid, dword _path)
void _SystemDiscs::DrawOptions(int draw_x) void _SystemDiscs::DrawOptions(int draw_x)
{ {
int optionsy = SELECTY+KFM2_DEVH+1; 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(); 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); 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); _PutImage(draw_x + 5, optionsy+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
if (is_active) kfont.bold = true; 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; kfont.bold = false;
optionsy += KFM2_DEVH; optionsy += KFM2_DEVH;
} }

View File

@ -62,6 +62,23 @@
$int 0x40 $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) :dword SetFileInfo(dword file_path, bdvk_struct)
{ {
f70.func = 6; f70.func = 6;