From f3788423736d6bb15c20e6f53923a0c9676ac7d1 Mon Sep 17 00:00:00 2001 From: Serhii Sakhno Date: Tue, 17 Feb 2015 16:46:38 +0000 Subject: [PATCH] Eolite 1.45: the settings window git-svn-id: svn://kolibrios.org@5416 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/eolite/Eolite.c | 18 ++++- programs/cmm/eolite/include/settings.h | 93 ++++++++++++++++++++++++++ programs/cmm/lib/lib.obj/box_lib.h | 20 +++++- programs/cmm/lib/lib.obj/libini.h | 8 +-- 4 files changed, 129 insertions(+), 10 deletions(-) create mode 100644 programs/cmm/eolite/include/settings.h diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 09c89cfe99..1015af54fa 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -83,8 +83,8 @@ enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir -#define TITLE "Eolite File Manager v2.44" -#define ABOUT_TITLE "Eolite v2.44" +#define TITLE "Eolite File Manager v2.45" +#define ABOUT_TITLE "Eolite v2.45" dword col_padding, col_selec, col_lpanel; int toolbar_buttons_x[7]={9,46,85,134,167,203}; @@ -93,6 +93,8 @@ struct path_string { char Item[4096]; }; byte active_about=0; word about_window; +byte active_settings=0; +word settings_window; byte menu_call_mouse=0; @@ -134,6 +136,7 @@ PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #t #include "include\history.h" #include "include\menu.h" #include "include\about.h" +#include "include\settings.h" void SetAppColors() { @@ -994,7 +997,16 @@ void FnProcess(char N) } break; case 10: //F10 - RunProgram(EDITOR_PATH, abspath("Eolite.ini")); + if (!active_settings) + { + SwitchToAnotherThread(); + settings_window=CreateThread(#settings_dialog,#about_stak+4092); + break; + } + else + { + ActivateWindow(GetProcessSlot(settings_window)); + } break; } } diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h new file mode 100644 index 0000000000..2c7bc38ea4 --- /dev/null +++ b/programs/cmm/eolite/include/settings.h @@ -0,0 +1,93 @@ +//Leency 2008-2013 + +#define EDITOR_PATH "/sys/tinypad" +#define BROWSER_PATH "/sys/htmlv" +#define BROWSER_LINK "http://kolibri-n.org/index.php" + +#ifdef LANG_RUS + ?define TITLE_SETT "Настройки" + ?define SET_1 "Показывать имена устройств" + ?define SET_2 "Реальные имена" + ?define SET_3 "Высота выделения" + ?define CANCEL_T "Отмена" + ?define APPLY_T "Применить" +#elif LANG_EST + ?define TITLE_SETT "Programmis Eolite" +#else + ?define TITLE_SETT "About Eolite" + +#endif + +int mouse_ddd; +char lineh_s[30]="18\0"; +edit_box LineHeight_ed = {50,10,70,0xffffff,0x94AECE,0x000000,0x000000,2,4,#lineh_s,#mouse_ddd, 1000000000000010b,2,2}; +checkbox2 ShowDeviceName_chb = {10*65536+15, 10*65536+15, 5, 0xffffff, 0x000000, 0x80000000, SET_1, 110b}; +checkbox2 RealFileNamesCase_chb = {10*65536+15, 30*65536+15, 5, 0xffffff, 0x000000, 0x80000000, SET_2, 100b}; + +void settings_dialog() +{ + byte id; + unsigned int key; + dword eolite_ini_path = abspath("Eolite.ini"); + IF (active_about) ExitProcess(); + active_about=1; + SetEventMask(0x27); + loop() switch(WaitEvent()) + { + case evButton: + id=GetButtonID(); + if (id==10) + { + IF ( asm test ShowDeviceName_chb.flags, 2) ini_set_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", 1); + ELSE ini_set_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", 0); + IF ( asm test RealFileNamesCase_chb.flags, 2) ini_set_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", 1); + ELSE ini_set_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", 0); + IF (LineHeight_ed.size) ini_set_int stdcall (eolite_ini_path, "Config", "LineHeight", atoi(#lineh_s)); + active_about=0; + ExitProcess(); + } + IF (id==1) || (id==11) + { + active_about=0; + ExitProcess(); + } + IF (id==23) RunProgram(BROWSER_PATH, BROWSER_LINK); + break; + + case evKey: + key = GetKey(); + IF (key==27) + { + active_about=0; + ExitProcess(); + } + EAX=key<<8; + edit_box_key stdcall(#LineHeight_ed); + break; + + case evMouse: + check_box_mouse stdcall (#ShowDeviceName_chb); + check_box_mouse stdcall (#RealFileNamesCase_chb); + edit_box_mouse stdcall (#LineHeight_ed); + break; + + case evReDraw: + DefineAndDrawWindow(600,150,281,228+GetSkinHeight(),0x34,sc.work,TITLE_SETT); + + IF (show_dev_name) ShowDeviceName_chb.flags = 110b; + ELSE ShowDeviceName_chb.flags = 100b; + + IF (real_files_names_case) RealFileNamesCase_chb.flags = 110b; + ELSE RealFileNamesCase_chb.flags = 100b; + + key = itoa(files.line_h); + strcpy(#lineh_s, key); + + check_box_draw stdcall (#ShowDeviceName_chb); + check_box_draw stdcall (#RealFileNamesCase_chb); + edit_box_draw stdcall (#LineHeight_ed); + WriteText(10, 55, 0x80, 0x000000, SET_3); + DrawFlatButton(115,190,70,22,10,0xE4DFE1, APPLY_T); + DrawFlatButton(195,190,70,22,11,0xE4DFE1, CANCEL_T); + } +} \ No newline at end of file diff --git a/programs/cmm/lib/lib.obj/box_lib.h b/programs/cmm/lib/lib.obj/box_lib.h index bd95f6c9b5..96177b757a 100644 --- a/programs/cmm/lib/lib.obj/box_lib.h +++ b/programs/cmm/lib/lib.obj/box_lib.h @@ -21,6 +21,10 @@ dword PathShow_draw = #aPathShow_draw; dword progressbar_draw = #aProgressbar_draw; dword progressbar_progress = #aProgressbar_progress; +dword check_box_draw = #aCheck_box_draw; +dword check_box_mouse = #aCheck_box_mouse; +dword version_ch = #aVersion_ch; + $DD 2 dup 0 char aEdit_box_draw [9] = "edit_box\0"; @@ -35,9 +39,9 @@ char aScrollbar_h_draw [17] = "scrollbar_h_draw\0"; char aScrollbar_h_mouse[18] = "scrollbar_h_mouse\0"; char aVersion_scrollbar[18] = "version_scrollbar\0"; -char aCheck_box_draw [15] = "check_box_draw\0"; -char aCheck_box_mouse [16] = "check_box_mouse\0"; -char aVersion_ch [11] = "version_ch\0"; +char aCheck_box_draw [15] = "check_box_draw2\0"; +char aCheck_box_mouse [16] = "check_box_mouse2\0"; +char aVersion_ch [11] = "version_ch2\0"; char aOption_box_draw [16] = "option_box_draw\0"; char aOption_box_mouse [17] = "option_box_mouse\0"; @@ -78,6 +82,16 @@ dword width, left, top, color, shift_color, focus_border_color, blur_border_colo text_color, max, text, mouse_variable, flags, size, pos, offset, cl_curs_x, cl_curs_y, shift, shift_old; }; +struct checkbox2{ +dword left_s, top_s, ch_text_margin, color, border_color, text_color, text, flags, size_of_str; +}; + +//flags for checkbox2 +#define CH_FLAG_EN 10b +#define CH_FLAG_TOP 0x0 +#define CH_FLAG_MIDDLE 100b +#define CH_FLAG_BOTTOM 1000b + struct scroll_bar { word size_x,// equ [edi] diff --git a/programs/cmm/lib/lib.obj/libini.h b/programs/cmm/lib/lib.obj/libini.h index e5a3b9204c..6c34989bf1 100644 --- a/programs/cmm/lib/lib.obj/libini.h +++ b/programs/cmm/lib/lib.obj/libini.h @@ -9,8 +9,8 @@ dword ini_get_int = #aini_get_int; dword ini_get_color = #aini_get_color; dword ini_set_str = #aini_set_str; dword ini_set_int = #aini_set_int; -dword ini_set_color = #aini_set_color; -dword ini_get_shortcut = #aini_get_shortcut; +//dword ini_set_color = #aini_set_color; +//dword ini_get_shortcut = #aini_get_shortcut; $DD 2 dup 0 char alib_init[] = "lib_init"; @@ -20,6 +20,6 @@ char aini_get_str[] = "ini_get_str"; char aini_get_int[] = "ini_get_int"; char aini_set_str[] = "ini_set_str"; char aini_set_int[] = "ini_set_int"; -char aini_get_shortcut[] = "ini_get_shortcut"; +//char aini_get_shortcut[] = "ini_get_shortcut"; char aini_get_color[] = "ini_get_color"; -char aini_set_color[] = "ini_set_color"; +//char aini_set_color[] = "ini_set_color";