forked from KolibriOS/kolibrios
(From Leency) Eolite 2.15: RealFileNamesCase support; show OpenWithDialog if associated program not found; add ram disk free space bar; small fix;
git-svn-id: svn://kolibrios.org@4225 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
4a605f1fb2
commit
31165f9b8d
@ -79,8 +79,8 @@
|
||||
|
||||
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
|
||||
|
||||
#define TITLE "Eolite File Manager v2.0.4"
|
||||
#define ABOUT_TITLE "Eolite v2.0.4"
|
||||
#define TITLE "Eolite File Manager v2.15"
|
||||
#define ABOUT_TITLE "Eolite v2.15"
|
||||
dword col_padding, col_selec, col_lpanel;
|
||||
|
||||
int toolbar_buttons_x[7]={9,46,85,134,167,203};
|
||||
@ -103,6 +103,7 @@ byte
|
||||
rename_active=0,
|
||||
del_active=0,
|
||||
show_dev_name=1,
|
||||
real_files_names_case=0,
|
||||
sort_num=2,
|
||||
itdir;
|
||||
|
||||
@ -310,6 +311,13 @@ void main()
|
||||
case 26: //paste
|
||||
CreateThread(#Paste,#copy_stak+4092);
|
||||
break;
|
||||
case 27:
|
||||
strcpy(#temp, "Ram Disk free space: ");
|
||||
i = GetFreeRamDiskClusters() / 2;
|
||||
itoa_(#temp+21, i);
|
||||
strcat(#temp, "Kb");
|
||||
notify(#temp);
|
||||
break;
|
||||
case 31...33: //sort
|
||||
IF(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10);
|
||||
IF(sort_num==2) DrawFilledBar(sorting_arrow_x,42,6,10);
|
||||
@ -396,11 +404,7 @@ void main()
|
||||
CreateThread(#FileMenu,#menu_stak+4092);
|
||||
break;
|
||||
case 173: //Ctrl+Enter
|
||||
if (!itdir)
|
||||
{
|
||||
SwitchToAnotherThread();
|
||||
CreateThread(#OpenWith,#open_with_stak+4092);
|
||||
}
|
||||
if (!itdir) ShowOpenWithDialog();
|
||||
break;
|
||||
case 178: //up
|
||||
List_Current(-1);
|
||||
@ -444,6 +448,8 @@ void main()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void menu_action(dword id)
|
||||
{
|
||||
if (id==COPY_PASTE_END)
|
||||
@ -452,11 +458,7 @@ void menu_action(dword id)
|
||||
SelectFile(#copy_to+strrchr(#copy_to,'/'));
|
||||
}
|
||||
if (id==100) Open();
|
||||
if (id==201)
|
||||
{
|
||||
SwitchToAnotherThread();
|
||||
CreateThread(#OpenWith,#open_with_stak+4092);
|
||||
}
|
||||
if (id==201) ShowOpenWithDialog();
|
||||
if (id==202) FnProcess(3); //F3
|
||||
if (id==203) FnProcess(4); //F4
|
||||
if (id==104) Copy(#file_path, NOCUT);
|
||||
@ -470,7 +472,7 @@ void menu_action(dword id)
|
||||
|
||||
void draw_window()
|
||||
{
|
||||
DefineAndDrawWindow(40,20,550,500,0x73,sc.work,TITLE);
|
||||
DefineAndDrawWindow(40,20,550,500,0x73,sc.work,TITLE,0);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
if (Form.status_window>2) return;
|
||||
files.SetSizes(192, 57, onLeft(192,27), onTop(57,6), disc_num*16+195,files.line_h);
|
||||
@ -650,7 +652,8 @@ void Open_Dir(dword dir_path, redraw){
|
||||
return;
|
||||
}
|
||||
maxcount = sizeof(file_mas)/sizeof(dword)-1;
|
||||
if (files.count>maxcount) files.count = maxcount;
|
||||
if (files.count>maxcount) files.count = maxcount;
|
||||
DrawRamDiskSpace();
|
||||
}
|
||||
if (files.count!=-1)
|
||||
{
|
||||
@ -680,7 +683,7 @@ inline Sorting()
|
||||
}
|
||||
FOR (j=files.count-1, off=files.count-1*304+buf+32; j>=0; j--, off-=304;) //files | folders
|
||||
{
|
||||
strttl(off+40);
|
||||
if (!real_files_names_case) strttl(off+40);
|
||||
if (TestBit(ESDWORD[off],4)) //directory?
|
||||
{
|
||||
file_mas[k]=j;
|
||||
@ -823,7 +826,7 @@ void SelectFile(dword that_file)
|
||||
{
|
||||
files.first=files.current=0;
|
||||
Open_Dir(#path,ONLY_OPEN);
|
||||
strttl(that_file);
|
||||
if (!real_files_names_case) strttl(that_file);
|
||||
for (i=files.count-1; i>=0; i--;)
|
||||
if (!strcmp(file_mas[i]*304+buf+72,that_file)) break;
|
||||
List_Current(i);
|
||||
|
@ -1,6 +1,6 @@
|
||||
char *ext[]={
|
||||
"..", 17,
|
||||
"<DIR>",16,
|
||||
"<dir>",16, "<DIR>",16,
|
||||
"txt", 1, "doc", 1, "rtf", 1, "odt", 1, "log", 1, "docx",1,
|
||||
"htm", 2, "html",2, "mht", 2,
|
||||
"ini", 3, "js", 3, "conf",3, "inf", 3,
|
||||
@ -30,10 +30,18 @@ char *ext[]={
|
||||
|
||||
#include "imgs\icons.txt"
|
||||
|
||||
void Put_icon(dword extension, xx, yy, fairing_color, default_icon)
|
||||
{
|
||||
int icon_n=default_icon, i;
|
||||
for (i=0; ext[i]!=0; i+=2;) if (!strcmp(extension, ext[i])) { icon_n = ext[i+1]; break; }
|
||||
void Put_icon(dword extension, xx, yy, fairing_color, icon_n)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (extension) for (i=0; ext[i]!=0; i+=2;)
|
||||
{
|
||||
if (strcmpi(extension, ext[i])==0)
|
||||
{
|
||||
icon_n = ext[i+1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ficons_pal[0] = fairing_color;
|
||||
PutPaletteImage(icon_n*16*15+#ficons,16,15,xx,yy,8,#ficons_pal);
|
||||
|
@ -33,11 +33,15 @@ void GetIni(byte onload)
|
||||
IF (!strcmp(#parametr,"SelectionColor")) edit2.shift_color=col_selec=StrToCol(#option);
|
||||
IF (!strcmp(#parametr,"LineHeight")) files.line_h = atoi(#option);
|
||||
IF (!strcmp(#parametr,"ShowDeviceName")) show_dev_name=atoi(#option);
|
||||
IF (!strcmp(#parametr,"RealFileNamesCase")) real_files_names_case=atoi(#option);
|
||||
|
||||
IF (parametr) && (!strcmp(#file_name+strrchr(#file_name,'.'),#parametr)) && (!onload)
|
||||
{
|
||||
errornum=RunProgram(#option,#file_path);
|
||||
IF (errornum<0) Write_Error(errornum);
|
||||
errornum = RunProgram(#option,#file_path);
|
||||
if (errornum<0)
|
||||
{
|
||||
if (errornum==-5) ShowOpenWithDialog(); else Write_Error(errornum);
|
||||
}
|
||||
return;
|
||||
}
|
||||
parametr=option=NULL;
|
||||
@ -50,7 +54,7 @@ void GetIni(byte onload)
|
||||
}
|
||||
if (file_path) && (!onload)
|
||||
{
|
||||
errornum=RunProgram(#file_path,NULL);
|
||||
errornum = RunProgram(#file_path,NULL);
|
||||
if (errornum==-31) menu_action(201); else if (errornum<0) Write_Error(errornum);
|
||||
return;
|
||||
}
|
||||
|
@ -1,36 +1,32 @@
|
||||
//Leency 2008-2013
|
||||
|
||||
#ifdef LANG_RUS
|
||||
char *actions[] = {
|
||||
57, "<EFBFBD>®¢ë© ä ©«", "F7",
|
||||
56, "<EFBFBD>®¢ ï ¯ ¯ª ", "F6",
|
||||
60, "<EFBFBD> áâனª¨", "F10",
|
||||
0,0,0
|
||||
};
|
||||
?define T_DEVICES "“áâனá⢠"
|
||||
?define T_ACTIONS "„¥©á⢨ï"
|
||||
|
||||
?define T_DEVICES "“áâனá⢠"
|
||||
?define T_ACTIONS "„¥©á⢨ï"
|
||||
char *actions[] = {
|
||||
57, "<EFBFBD>®¢ë© ä ©«", "F7",
|
||||
56, "<EFBFBD>®¢ ï ¯ ¯ª ", "F6",
|
||||
60, "<EFBFBD> áâனª¨", "F10",
|
||||
0,0,0
|
||||
};
|
||||
#elif LANG_EST
|
||||
char *actions[] = {
|
||||
57, "Uus fail", "F7",
|
||||
56, "Uus kataloog", "F6",
|
||||
60, "Seaded", "F10",
|
||||
0,0,0
|
||||
};
|
||||
|
||||
?define T_DEVICES "Seadmed"
|
||||
?define T_ACTIONS "Toimingud"
|
||||
|
||||
?define T_DEVICES "Seadmed"
|
||||
?define T_ACTIONS "Toimingud"
|
||||
char *actions[] = {
|
||||
57, "Uus fail", "F7",
|
||||
56, "Uus kataloog", "F6",
|
||||
60, "Seaded", "F10",
|
||||
0,0,0
|
||||
};
|
||||
#else
|
||||
char *actions[] = {
|
||||
57, "New file", "F7",
|
||||
56, "New folder", "F6",
|
||||
60, "Options", "F10",
|
||||
0,0,0
|
||||
};
|
||||
|
||||
?define T_DEVICES "Devices"
|
||||
?define T_ACTIONS "Actions"
|
||||
?define T_DEVICES "Devices"
|
||||
?define T_ACTIONS "Actions"
|
||||
char *actions[] = {
|
||||
57, "New file", "F7",
|
||||
56, "New folder", "F6",
|
||||
60, "Options", "F10",
|
||||
0,0,0
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@ -77,15 +73,30 @@ void SystemDiscsGet()
|
||||
strcpy(#disk_list[disc_num].Item, #sys_discs);
|
||||
disc_num++;
|
||||
}
|
||||
if (strcmp(#disk_list[disc_num-1].Item, "/rd/1/")==0) if (GetDir(nullbuf, nullbuf, "/kolibrios/", DIRS_ALL)==0)
|
||||
if (strcmp(#disk_list[disc_num-1].Item, "/rd/1/")==0)
|
||||
{
|
||||
strcpy(#disk_list[disc_num].Item, "/kolibrios/");
|
||||
kolibrios_drive = true;
|
||||
disc_num++;
|
||||
} else kolibrios_drive = false;
|
||||
if (GetDir(nullbuf, nullbuf, "/kolibrios/", DIRS_ALL)==0)
|
||||
{
|
||||
strcpy(#disk_list[disc_num].Item, "/kolibrios/");
|
||||
kolibrios_drive = true;
|
||||
disc_num++;
|
||||
} else kolibrios_drive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DrawRamDiskSpace()
|
||||
{
|
||||
int free_rd_space = GetFreeRamDiskClusters() * 49 / ALL_RD_CLUSTERS;
|
||||
DefineButton(120, 80, 49, 4, 27+BT_HIDE, 0);
|
||||
if (!free_rd_space)
|
||||
DrawBar(121, 81, 49-free_rd_space, 3, 0xFF0000);
|
||||
else
|
||||
{
|
||||
DrawBar(121, 81, 49-free_rd_space, 3, 0x7A7F84);
|
||||
DrawBar(121+49-free_rd_space, 81, free_rd_space, 3, 0xC4C4C4);
|
||||
}
|
||||
}
|
||||
|
||||
void SystemDiscsDraw()
|
||||
{
|
||||
@ -109,6 +120,7 @@ void SystemDiscsDraw()
|
||||
case 'r':
|
||||
dev_icon=0;
|
||||
strcpy(#disc_name, "System ");
|
||||
DrawRamDiskSpace();
|
||||
break;
|
||||
case 'c':
|
||||
dev_icon=1;
|
||||
@ -143,8 +155,7 @@ void SystemDiscsDraw()
|
||||
strcpy(#disc_name, "Unknown ");
|
||||
}
|
||||
strcat(#disc_name, #dev_name);
|
||||
if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name);
|
||||
else WriteText(45,i*16+79,0x80,0,#dev_name);
|
||||
if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name); else WriteText(45,i*16+79,0x80,0,#dev_name);
|
||||
_PutImage(21,i*16+76, 14,13, dev_icon*14*13*3+#devices);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,11 @@
|
||||
//Leency 2013
|
||||
|
||||
void ShowOpenWithDialog()
|
||||
{
|
||||
SwitchToAnotherThread();
|
||||
CreateThread(#OpenWith,#open_with_stak+4092);
|
||||
}
|
||||
|
||||
llist app_list;
|
||||
struct app_list_string { char item[1024]; char ext[5]; };
|
||||
app_list_string app_paths[100];
|
||||
|
@ -74,4 +74,39 @@ void DrawFilledBar(dword x, y, w, h)
|
||||
if (h <= 14) fill_h = h; else fill_h = 14;
|
||||
for (i=0; i<fill_h; i++) DrawBar(x, y+i, w, 1, col_palette[14-i]);
|
||||
DrawBar(x, y+i, w, h-fill_h, col_palette[14-i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct rd_info
|
||||
{
|
||||
dword function_number, reserved[4];
|
||||
char path[4];
|
||||
} rd_info;
|
||||
|
||||
#define ALL_RD_CLUSTERS 2847
|
||||
int GetFreeRamDiskClusters()
|
||||
{
|
||||
dword free_size;
|
||||
static dword old_free_size;
|
||||
|
||||
rd_info.function_number = 15;
|
||||
strcpy(#rd_info.path, "/rd");
|
||||
$mov eax,58
|
||||
$mov ebx, #rd_info;
|
||||
$int 0x40
|
||||
if (EAX==0)
|
||||
{
|
||||
free_size=ECX;
|
||||
old_free_size = ECX;
|
||||
}
|
||||
else
|
||||
{
|
||||
debugi(EAX);
|
||||
free_size = old_free_size;
|
||||
}
|
||||
return free_size;
|
||||
}
|
Loading…
Reference in New Issue
Block a user