eolite: bugfixes and code clean

git-svn-id: svn://kolibrios.org@8868 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-06-17 09:29:39 +00:00
parent d4bf03befc
commit 41386908d7
11 changed files with 23 additions and 29 deletions

View File

@ -3,9 +3,9 @@
// 70.5 - get volume info and label // 70.5 - get volume info and label
#define ABOUT_TITLE "EOLITE 5 Beta2" #define ABOUT_TITLE "EOLITE 5 Beta3"
#define TITLE_EOLITE "Eolite File Manager 5 Beta2" #define TITLE_EOLITE "Eolite File Manager 5 Beta3"
#define TITLE_KFM "Kolibri File Manager 2 Beta2"; #define TITLE_KFM "Kolibri File Manager 2 Beta3";
#ifndef AUTOBUILD #ifndef AUTOBUILD
#include "lang.h--" #include "lang.h--"
@ -92,7 +92,6 @@ int toolbar_buttons_x[7]={9,46,85,134,167,203};
bool active_about = false; bool active_about = false;
bool active_settings = false; bool active_settings = false;
bool _not_draw = false; bool _not_draw = false;
bool exif_load = false;
bool dir_at_fat16 = NULL; bool dir_at_fat16 = NULL;
bool dev_popin_active_on_panel=0; bool dev_popin_active_on_panel=0;
@ -146,7 +145,7 @@ libimg_image icons32_selected;
#define STATUS_BAR_H 16; #define STATUS_BAR_H 16;
int status_bar_h = 0; int status_bar_h = 0;
int icon_size = 16; int icon_size = 18;
edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000, edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000,
248,#new_element_name,0,ed_focus+ed_always_focus,6,0}; 248,#new_element_name,0,ed_focus+ed_always_focus,6,0};
@ -362,7 +361,10 @@ void main()
if (POPUP_BTN1==id) && (del_active) EventDelete(); if (POPUP_BTN1==id) && (del_active) EventDelete();
if (POPUP_BTN1==id) && (new_element_active) NewElement(); if (POPUP_BTN1==id) && (new_element_active) NewElement();
if (POPUP_BTN2==id) EventClosePopinForm(); if (POPUP_BTN2==id) EventClosePopinForm();
if (dev_popin_active_on_panel) EventDriveClick(id); if (dev_popin_active_on_panel) {
if (id>=100) && (id<=120) EventDriveClick(id);
else EventClosePopinForm();
}
break; break;
} }
@ -379,11 +381,13 @@ void main()
case KFM_DEV_DROPDOWN_1: case KFM_DEV_DROPDOWN_1:
case KFM_DEV_DROPDOWN_1+1: case KFM_DEV_DROPDOWN_1+1:
dev_popin_active_on_panel = 1; dev_popin_active_on_panel = 1;
DefineHiddenButton(0,0,5000,3000,9999+BT_NOFRAME);
SystemDiscs.DrawOptions(Form.cwidth/2-DDW, 8+DEV_H_HOR+3); SystemDiscs.DrawOptions(Form.cwidth/2-DDW, 8+DEV_H_HOR+3);
break; break;
case KFM_DEV_DROPDOWN_2: case KFM_DEV_DROPDOWN_2:
case KFM_DEV_DROPDOWN_2+1: case KFM_DEV_DROPDOWN_2+1:
dev_popin_active_on_panel = 2; dev_popin_active_on_panel = 2;
DefineHiddenButton(0,0,5000,3000,9999+BT_NOFRAME);
SystemDiscs.DrawOptions(Form.cwidth-DDW-2, 8+DEV_H_HOR+3); SystemDiscs.DrawOptions(Form.cwidth-DDW-2, 8+DEV_H_HOR+3);
break; break;
case BACK_BTN...PASTE_BTN: case BACK_BTN...PASTE_BTN:
@ -884,7 +888,7 @@ void Line_ReDraw(dword bgcol, filenum){
void Open_Dir(dword dir_path, redraw){ void Open_Dir(dword dir_path, redraw){
int errornum, maxcount, i; int errornum;
if (redraw!=ONLY_SHOW) if (redraw!=ONLY_SHOW)
{ {
selected_count = 0; selected_count = 0;
@ -906,7 +910,7 @@ void Open_Dir(dword dir_path, redraw){
SystemDiscs.Draw(); SystemDiscs.Draw();
files.visible = files.h / files.item_h; files.visible = files.h / files.item_h;
if (files.count < files.visible) files.visible = files.count; if (files.count < files.visible) files.visible = files.count;
if (!strncmp(dir_path, "/rd/1/",5)) if (!strncmp(dir_path, "/rd/1/",5)) || (!strncmp(dir_path, "/sys/",4))
dir_at_fat16 = true; else dir_at_fat16 = false; dir_at_fat16 = true; else dir_at_fat16 = false;
if (redraw!=ONLY_SHOW) Sorting(); if (redraw!=ONLY_SHOW) Sorting();
list_full_redraw = true; list_full_redraw = true;
@ -924,7 +928,6 @@ inline Sorting()
{ {
dword d=0, f=1; dword d=0, f=1;
int j=0; int j=0;
dword tmp;
dword file_off; dword file_off;
items.drop(); items.drop();
@ -1030,7 +1033,6 @@ void Dir_Up()
void EventOpenSelected() void EventOpenSelected()
{ {
int i; int i;
dword file_off;
for (i=0; i<files.count; i++) if (getElementSelectedFlag(i)) { for (i=0; i<files.count; i++) if (getElementSelectedFlag(i)) {
EDX = items.get(i)*304 + buf+32; EDX = items.get(i)*304 + buf+32;
if (TestBit(ESDWORD[EDX], 4)) continue; //is foder if (TestBit(ESDWORD[EDX], 4)) continue; //is foder
@ -1082,7 +1084,7 @@ void ShowOpenWithDialog()
void NewElement() void NewElement()
{ {
BDVK element_info; BDVK element_info;
byte del_result, copy_result, info_result; byte copy_result, info_result;
sprintf(#temp,"%s/%s",#path,new_file_ed.text); sprintf(#temp,"%s/%s",#path,new_file_ed.text);
info_result = GetFileInfo(#temp, #element_info); info_result = GetFileInfo(#temp, #element_info);

View File

@ -31,7 +31,7 @@ void DrawBreadCrumbs()
char PathShow_path[4096]; char PathShow_path[4096];
block btn; block btn;
int i; int i;
unsigned text_line, area_w; unsigned text_line;
{ {
strcat(#PathShow_path, #path); strcat(#PathShow_path, #path);
for (i=0; i<50; i++) DeleteButton(i+BREADCRUMB_ID); for (i=0; i<50; i++) DeleteButton(i+BREADCRUMB_ID);
@ -45,7 +45,7 @@ void DrawBreadCrumbs()
} }
breadCrumb.add(i+1); breadCrumb.add(i+1);
btn.set_size(246,10,NULL,20); btn.set_size(246,10,NULL,20);
area_w = Form.cwidth - btn.x - 20; //area_w = Form.cwidth - btn.x - 20;
for (i=0; i<breadCrumb.count-1; i++) for (i=0; i<breadCrumb.count-1; i++)
{ {
text_line = breadCrumb.get(i) + #PathShow_path; text_line = breadCrumb.get(i) + #PathShow_path;

View File

@ -24,7 +24,6 @@ int getElementSelectedFlag(dword n) {
dword GetFilesCount(dword _in_path) dword GetFilesCount(dword _in_path)
{ {
int j;
BDVK file_info_count; BDVK file_info_count;
DIR_SIZE paste_dir_size; DIR_SIZE paste_dir_size;

View File

@ -69,7 +69,6 @@ void DrawFilledBar(dword x, y, w, h)
int popin_w=260; int popin_w=260;
void DrawEolitePopup(dword b1_text, b2_text) void DrawEolitePopup(dword b1_text, b2_text)
{ {
int but_x;
int popin_x = files.w - popin_w / 2 + files.x ; int popin_x = files.w - popin_w / 2 + files.x ;
DrawPopup(popin_x, 160, popin_w, 95, 1, sc.work, sc.work_graph); DrawPopup(popin_x, 160, popin_w, 95, 1, sc.work, sc.work_graph);
DrawCaptButton(popin_x+23+000, 215, 100, 26, POPUP_BTN1, sc.button, sc.button_text, b1_text); DrawCaptButton(popin_x+23+000, 215, 100, 26, POPUP_BTN1, sc.button, sc.button_text, b1_text);

View File

@ -21,7 +21,7 @@ void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
default_icon=2; default_icon=2;
} }
if (ESBYTE[file_path+1]!='k') && (chrnum(file_path, '/')==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]; if (ESBYTE[file_path+1]=='/') ext[0] = ESBYTE[file_path+2];
else ext[0] = ESBYTE[file_path+1]; else ext[0] = ESBYTE[file_path+1];
ext[1] = '\0'; ext[1] = '\0';

View File

@ -130,7 +130,7 @@ void _SystemDiscs::Get()
void _SystemDiscs::Draw() void _SystemDiscs::Draw()
{ {
char dev_name[15], disc_name[100], i, dev_icon, is_active=0, name_len; char dev_name[15], disc_name[100], i, dev_icon, is_active=0;
int draw_y, draw_x; int draw_y, draw_x;
for (i=0; i<30; i++) DeleteButton(100+i); for (i=0; i<30; i++) DeleteButton(100+i);
@ -192,7 +192,7 @@ void _SystemDiscs::DrawSelect(int draw_x, draw_y, path1, btid)
DrawBar(draw_x, draw_y, DDW+1-DEV_H_HOR, DEV_H_HOR, 0xFFFFFF); DrawBar(draw_x, draw_y, DDW+1-DEV_H_HOR, DEV_H_HOR, 0xFFFFFF);
_PutImage(draw_x + 5, draw_y+2, 18,17, is_active*7+dev_icon*17*18*3+#devices); _PutImage(draw_x + 5, draw_y+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
kfont.WriteIntoWindow(draw_x + 24, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1); kfont.WriteIntoWindow(draw_x + 24, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1);
UnsafeDefineButton(draw_x, draw_y, DDW-1, DEV_H_HOR-1, btid+1+BT_HIDE,0xFFFFFF); DefineButton(draw_x, draw_y, DDW-1, DEV_H_HOR-1, btid+1+BT_HIDE,0xFFFFFF);
DrawFlatButtonSmall(draw_x+DDW-DEV_H_HOR+1, draw_y-1, DEV_H_HOR-1, DEV_H_HOR+1, btid, "\x19"); DrawFlatButtonSmall(draw_x+DDW-DEV_H_HOR+1, draw_y-1, DEV_H_HOR-1, DEV_H_HOR+1, btid, "\x19");
draw_x += DDW + 1; draw_x += DDW + 1;
@ -285,7 +285,6 @@ void DrawLeftPanelBg()
int actions_y = SystemDiscs.list.count*DEV_H; int actions_y = SystemDiscs.list.count*DEV_H;
int start_y = actions_y+159; int start_y = actions_y+159;
int area_h; int area_h;
int i;
DrawBar(2,41,190,15,waves_pal[0]); //above devices block DrawBar(2,41,190,15,waves_pal[0]); //above devices block
DrawBar(17,actions_y+75,160,15,waves_pal[0]); //below devices block DrawBar(17,actions_y+75,160,15,waves_pal[0]); //below devices block
PutShadow(17,actions_y+75,160,1,1,3); PutShadow(17,actions_y+75,160,1,1,3);

View File

@ -158,11 +158,9 @@ void LoadIniSettings()
ini.GetString("DefaultPath", #path, 4096, "/rd/1"); ini.GetString("DefaultPath", #path, 4096, "/rd/1");
ini.GetString("DefaultPath", #path_start, 4096, "/rd/1"); ini.GetString("DefaultPath", #path_start, 4096, "/rd/1");
path_start_ed.size = path_start_ed.pos = strlen(#path_start); path_start_ed.size = path_start_ed.pos = strlen(#path_start);
kfont.init(DEFAULT_FONT);
ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font file",#temp,4096,DEFAULT_FONT);
kfont.init(#temp);
ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on"); ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on");
if(!strcmp(#temp,"off")) kfont.smooth = false; else kfont.smooth = true; if(streq(#temp,"off")) kfont.smooth = false; else kfont.smooth = true;
} }

View File

@ -102,7 +102,6 @@ struct collection
}; };
:void collection::increase_data_size() { :void collection::increase_data_size() {
int filled_size;
if (realloc_size<4096) realloc_size = 4096; if (realloc_size<4096) realloc_size = 4096;
if (!data_size) { if (!data_size) {
data_size = realloc_size; data_size = realloc_size;

View File

@ -34,8 +34,7 @@
:int CopyFile(dword copy_from3, copy_in3) :int CopyFile(dword copy_from3, copy_in3)
{ {
BDVK CopyFile_atr; BDVK CopyFile_atr;
dword error, cbuf; dword error;
dword block;
if (error = GetFileInfo(copy_from3, #CopyFile_atr)) if (error = GetFileInfo(copy_from3, #CopyFile_atr))
{ {

View File

@ -137,7 +137,7 @@
:void DrawEditBox(dword edit_box_pointer) :void DrawEditBox(dword edit_box_pointer)
{ {
dword x,y,w,h,bg,t; dword x,y,w,h,bg;
ESI = edit_box_pointer; ESI = edit_box_pointer;
x = ESI.edit_box.left; x = ESI.edit_box.left;
y = ESI.edit_box.top; y = ESI.edit_box.top;

View File

@ -902,7 +902,7 @@ inline signed csshexdec(dword text)
return ret; return ret;
} }
void miniprintf(dword dst, format, insert_line) :void miniprintf(dword dst, format, insert_line)
{ {
dword in_pos = strchr(format, '%'); dword in_pos = strchr(format, '%');
if (ESBYTE[in_pos+1] == 's') { if (ESBYTE[in_pos+1] == 's') {
@ -916,7 +916,6 @@ inline cdecl int sprintf(dword buf, format,...)
{ {
#define END_ARGS 0xFF00FF //ARGS FUNCTION #define END_ARGS 0xFF00FF //ARGS FUNCTION
byte s; byte s;
char X[10];
dword ret, tmp, l; dword ret, tmp, l;
dword arg = #format; dword arg = #format;
ret = buf; ret = buf;