Eolite 3.01: some fixes, code clean

git-svn-id: svn://kolibrios.org@5743 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2015-08-18 15:02:42 +00:00
parent 2202752431
commit 1e10eade5d
6 changed files with 50 additions and 93 deletions

View File

@ -6,7 +6,7 @@
#endif
//libraries
#define MEMSIZE 510000
#define MEMSIZE 530000
#include "..\lib\clipboard.h"
#include "..\lib\strings.h"
#include "..\lib\mem.h"
@ -15,6 +15,7 @@
#include "..\lib\list_box.h"
#include "..\lib\copyf.h"
#include "..\lib\random.h"
#include "..\lib\font.h"
//obj
#include "..\lib\obj\libini.h"
#include "..\lib\obj\box_lib.h"
@ -33,7 +34,6 @@ struct path_string { char Item[4096]; };
byte active_about=0;
word about_window;
byte active_settings=0;
word settings_window;
dword _not_draw = false;
byte menu_call_mouse=0;
@ -59,7 +59,7 @@ byte
itdir;
//struct t_settings {
byte use_big_fonts=false,
byte font_size=9,
sort_num=2,
show_dev_name=true,
real_files_names_case=false,
@ -110,21 +110,18 @@ void main()
dword selected_offset;
dword IPC_LEN,IPC_ID;
char IPC_BUF[10];
dword tmp;
rand_n = random(40);
load_dll(boxlib, #box_lib_init,0);
load_dll(libini, #lib_init,1);
eolite_ini_path = abspath("Eolite.ini");
eolite_ini_path = abspath("Eolite.ini");
LoadIniSettings();
GetSystemDiscs();
SetAppColors();
if (param)
{
tmp = strlen(#path);
strlcpy(#path, #param, tmp);
$dec tmp
if (path[tmp]!='/') DSBYTE[#path+tmp] = '/'; //add "/" to the end of the string
strcpy(#path, #param);
if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string
}
else
{
@ -133,6 +130,7 @@ void main()
Open_Dir(#path,ONLY_OPEN);
strcpy(#inactive_path, #path);
llist_copy(#files_inactive, #files);
//font.load("/sys/font/Verdana.kf");
SetEventMask(1100111b);
loop(){
switch(WaitEvent())
@ -266,8 +264,9 @@ void main()
if (sc_slider_h/2+files.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii
id = files.first;
files.first = -sc_slider_h / 2 + mouse.y -j -files.y * files.count;
files.first /= Form.cheight - 18 - files.y;
files.first /= files.h - 18;
if (files.visible+files.first>files.count) files.first=files.count-files.visible;
if (files.first<0) files.first=0;
if (id!=files.first) List_ReDraw();
break;
}
@ -510,7 +509,6 @@ void main()
if (action_buf==108) Del_Form();
if (action_buf==109) FnProcess(5);
if (action_buf==110) FnProcess(8);
if (action_buf==300) { FnProcess(5); List_ReDraw(); }
action_buf=0;
}
}
@ -1114,7 +1112,7 @@ void FnProcess(byte N)
CreateThread(#properties_dialog, properties_stak+8092);
break;
case 10: //F10
if (!active_settings)
if (!settings_window)
{
settings_stak = malloc(4096);
settings_window = CreateThread(#settings_dialog, settings_stak+4092);
@ -1137,8 +1135,5 @@ void ChangeActivePanel()
DrawFilePanels();
}
//need to remove these functiones, they are a very old shit :)
dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;}
stop:

View File

@ -20,7 +20,7 @@ void Scroll() {
sc_slider_y = files.first * sc_h / files.count + sc_y;
sc_slider_h = sc_h * files.visible - files.visible / files.count;
if (sc_slider_h < 20) sc_slider_h = 20; //minimal scroll width
if (sc_slider_h > sc_h-sc_slider_y+56) || (files.first+files.visible>=files.count) sc_slider_y=onTop(23+sc_slider_h,0); //äëÿ áîëüøîãî ñïèñêà
if (sc_slider_h > sc_h-sc_slider_y+56) || (files.first+files.visible>=files.count) sc_slider_y= Form.cheight - 19 - sc_slider_h; //äëÿ áîëüøîãî ñïèñêà
}
//slider
DrawFlatButton(sc_x,sc_slider_y,16,sc_slider_h,0,-1,"");

View File

@ -43,7 +43,7 @@ void Put_icon(dword extension, xx, yy, fairing_color, icon_n)
ficons_pal[0] = fairing_color;
PutPaletteImage(icon_n*16*15+#ficons,16,15,xx,yy,8,#ficons_pal);
if (fairing_color!=0xFFFfff) IconFairing(icon_n, xx, yy, fairing_color);
if (use_big_fonts) font_half_height=0; else font_half_height=4;
if (font_size==9) font_half_height=0; else font_half_height=4;
if (icon_n!=17) && (strlen(extension)<9) WriteText(-FileShow.font_size_x/2*strlen(extension)+files.x+files.w-103,yy+font_half_height,files.font_type,0,extension);
}

View File

@ -222,18 +222,22 @@ void DrawLeftPanelBg()
{
int actions_y=disc_num*16;
int start_y = actions_y+156;
int onTop1;
DrawBar(2,41,190,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
PutShadow(17,actions_y+75,160,1,1,3);
PutShadow(18,actions_y+75+1,158,1,1,1);
DrawBar(2,56,15,actions_y+103,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ñëåâà
DrawBar(177,56,15,actions_y+103,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
if (onTop(start_y, 6) < 268)
PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
onTop1 = Form.cheight-start_y-2;
if (onTop1 < 268)
{
PutPaletteImage(#blue_hl, 190, onTop1, 2, start_y, 8, #blue_hl_pal);
}
else
{
DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
DrawBar(2,start_y,190, onTop1-268, col_lpanel);
PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270, 8, #blue_hl_pal);
}
PutShadow(17,start_y,160,1,1,3);
PutShadow(18,start_y+1,158,1,1,1);

View File

@ -1,30 +1,23 @@
//Leency 2008-2015
#define EDITOR_PATH "/sys/tinypad"
#ifdef LANG_RUS
?define EDIT_FILE_ASSOCIATIONS "<EFBFBD>¥¤ ªâ¨à®¢ âì  áá®æ¨ æ¨¨ ä ©«®¢"
?define TITLE_SETT "<EFBFBD> áâனª¨"
?define SHOW_DEVICE_CLASS "‚뢮¤¨âì ­ §¢ ­¨ï ª« áá  ãáâனáâ¢"
?define SHOW_REAL_NAMES "<EFBFBD>®ª §ë¢ âì ¨¬¥­  ä ©«®¢ ­¥ ¬¥­ïï ॣ¨áâà"
?define USE_BIG_FONTS "<EFBFBD>®«ì让 èà¨äâ (⮫쪮  ­£«¨©áª¨¥ ᨬ¢®«ë!)"
?define FONT_SIZE_LABEL "<EFBFBD> §¬¥à èà¨äâ "
?define USE_TWO_PANELS "„¢¥ ¯ ­¥«¨"
?define LIST_LINE_HEIGHT "‚ëá®â  áâப¨ ¢ ᯨ᪥"
?define NOTIFY_COPY_END "“¢¥¤®¬«ïâì ® § ¢¥à襭¨¨ ª®¯¨à®¢ ­¨ï"
?define CANCEL_T "Žâ¬¥­ "
?define APPLY_T "<EFBFBD>ਬ¥­¨âì"
?define T_DOUBLE_CLICK "‚à¥¬ï ¤¢®©­®£® ª«¨ª  (¢ á®âëå)"
#else
?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
?define TITLE_SETT "Settings"
?define SHOW_DEVICE_CLASS "Show device class name"
?define SHOW_REAL_NAMES "Show real file names without changing case"
?define USE_BIG_FONTS "Use big fonts (English characters only!)"
?define FONT_SIZE_LABEL "Font size"
?define USE_TWO_PANELS "Two panels"
?define LIST_LINE_HEIGHT "List line height"
?define NOTIFY_COPY_END "Notify when copying finished"
?define CANCEL_T "Cancel"
?define APPLY_T "Apply"
?define T_DOUBLE_CLICK "Double click time (in hundredths)"
#endif
@ -34,101 +27,63 @@ char confir_section = "Config";
void settings_dialog()
{
byte id;
proc_info settings_form;
dword save_show_dev_name,save_real_files_names_case, save_info_after_copy, save_use_big_fonts, save_two_panels, save_files_h, save_DBLTime;
if (active_settings){
EXIT_SETTING:
show_dev_name = save_show_dev_name;
real_files_names_case = save_real_files_names_case;
info_after_copy = save_info_after_copy;
use_big_fonts = save_use_big_fonts;
two_panels = save_two_panels;
files.line_h = save_files_h;
MOUSE_TIME = save_DBLTime;
cmd_free = 4;
ExitProcess();
}
active_settings=1;
save_show_dev_name = show_dev_name;
save_real_files_names_case = real_files_names_case;
save_info_after_copy = info_after_copy;
save_use_big_fonts = use_big_fonts;
two_panels = two_panels;
save_files_h = files.line_h;
save_DBLTime = MOUSE_TIME;
loop(){
switch(WaitEvent())
{
case evButton:
id=GetButtonID();
if (id==10)
{
SaveIniSettings();
active_settings=0;
action_buf = 300;
cmd_free = 4;
ExitProcess();
}
else if (id==1) || (id==11)
{
active_settings=0;
goto EXIT_SETTING;
}
if (id==1) ExitSettings();
else if (id==5)
{
RunProgram("tinypad", "/sys/settings/assoc.ini");
break;
}
else if (id==20) show_dev_name ^= 1;
else if (id==21) real_files_names_case ^= 1;
else if (id==21) { action_buf=109; real_files_names_case ^= 1; }
else if (id==22) info_after_copy ^= 1;
else if (id==23) { use_big_fonts ^= 1; BigFontsChange(); }
else if (id==24) two_panels ^= 1;
else if (id==25) files.line_h++;
else if (id==26) && (files.line_h>14) files.line_h--;
else if (id==26) && (files.line_h>18) files.line_h--;
else if (id==27) MOUSE_TIME++;
else if (id==28) && (MOUSE_TIME>29) MOUSE_TIME--;
else if (id==30) && (font_size<30) { font_size++; BigFontsChange(); }
else if (id==31) && (font_size>10) { font_size--; BigFontsChange(); }
SaveIniSettings();
EventRedrawWindow(Form.left,Form.top);
DrawSettingsCheckBoxes();
break;
case evKey:
GetKeys();
if (key_scancode==SCAN_CODE_ESC)
{
active_settings = 0;
action_buf = 300;
goto EXIT_SETTING;
}
if (key_scancode==SCAN_CODE_ESC) ExitSettings();
break;
case evReDraw:
DefineAndDrawWindow(Form.left + Form.width/2-10, Form.top + Form.height/2 - 75, 300, 254+GetSkinHeight(),0x34,system.color.work,TITLE_SETT);
GetProcessInfo(#settings_form, SelfInfo);
DefineAndDrawWindow(Form.left + Form.width/2-10, Form.top + Form.height/2 - 75, 300, 226+GetSkinHeight(),0x34,system.color.work,TITLE_SETT);
DrawSettingsCheckBoxes();
DrawFlatButton(9, 186, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
DrawFlatButton(128, settings_form.cheight - 30, 70, 22, 10, 0xE4DFE1, APPLY_T);
DrawFlatButton(208, settings_form.cheight - 30, 70, 22, 11, 0xE4DFE1, CANCEL_T);
}
}
}
void ExitSettings()
{
settings_window = 0;
cmd_free = 4;
SaveIniSettings();
ExitProcess();
}
void DrawSettingsCheckBoxes()
{
CheckBox2(10, 11, 20, SHOW_DEVICE_CLASS, show_dev_name);
CheckBox2(10, 33, 21, SHOW_REAL_NAMES, real_files_names_case);
CheckBox2(10, 55, 22, NOTIFY_COPY_END, info_after_copy);
CheckBox2(10, 77, 23, USE_BIG_FONTS, use_big_fonts);
CheckBox2(10, 99, 24, USE_TWO_PANELS, two_panels);
MoreLessBox(10, 124, 18, 25, 26, #system.color, files.line_h, LIST_LINE_HEIGHT);
MoreLessBox(10, 154, 18, 27, 28, #system.color, MOUSE_TIME, T_DOUBLE_CLICK);
CheckBox2(10, 77, 24, USE_TWO_PANELS, two_panels);
MoreLessBox(10, 103, 18, 30, 31, #system.color, font_size, FONT_SIZE_LABEL);
MoreLessBox(10, 130, 18, 25, 26, #system.color, files.line_h, LIST_LINE_HEIGHT);
MoreLessBox(10, 157, 18, 27, 28, #system.color, MOUSE_TIME, T_DOUBLE_CLICK);
}
@ -138,7 +93,7 @@ void LoadIniSettings()
ini_get_int stdcall (eolite_ini_path, #confir_section, "ShowDeviceName", 1); show_dev_name = EAX;
ini_get_int stdcall (eolite_ini_path, #confir_section, "RealFileNamesCase", 0); real_files_names_case = EAX;
ini_get_int stdcall (eolite_ini_path, #confir_section, "InfoAfterCopy", 0); info_after_copy = EAX;
ini_get_int stdcall (eolite_ini_path, #confir_section, "UseBigFonts", 0); use_big_fonts = EAX;
ini_get_int stdcall (eolite_ini_path, #confir_section, "FontSize", 9); font_size = EAX;
ini_get_int stdcall (eolite_ini_path, #confir_section, "TwoPanels", 0); two_panels = EAX;
ini_get_int stdcall (eolite_ini_path, #confir_section, "LineHeight", 18); files.line_h = EAX;
ini_get_int stdcall (eolite_ini_path, #confir_section, "TimeDoubleClick", 50); MOUSE_TIME = EAX;
@ -151,7 +106,7 @@ void SaveIniSettings()
ini_set_int stdcall (eolite_ini_path, #confir_section, "ShowDeviceName", show_dev_name);
ini_set_int stdcall (eolite_ini_path, #confir_section, "RealFileNamesCase", real_files_names_case);
ini_set_int stdcall (eolite_ini_path, #confir_section, "InfoAfterCopy", info_after_copy);
ini_set_int stdcall (eolite_ini_path, #confir_section, "UseBigFonts", use_big_fonts);
ini_set_int stdcall (eolite_ini_path, #confir_section, "FontSize", font_size);
ini_set_int stdcall (eolite_ini_path, #confir_section, "TwoPanels", two_panels);
ini_set_int stdcall (eolite_ini_path, #confir_section, "LineHeight", files.line_h);
ini_set_int stdcall (eolite_ini_path, #confir_section, "TimeDoubleClick", MOUSE_TIME);
@ -185,7 +140,10 @@ void SetAppColors()
void BigFontsChange()
{
if (use_big_fonts)
files.line_h = font.height + 4;
if (files.line_h<18) files.line_h = 18;
if (font_size!=9)
{
files.SetFont(8, 14, 10110000b);
FileShow.font_size_x = files.font_w;

View File

@ -1,5 +1,5 @@
#define TITLE "Eolite File Manager v3.0 Final"
#define ABOUT_TITLE "Eolite 3.0 Final"
#define TITLE "Eolite File Manager v3.01"
#define ABOUT_TITLE "Eolite 3.01"
#ifdef LANG_RUS
?define T_FILE "” ©«"