From 97789e09b968bc10fcf2c2fc2a551c19c81d5f89 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Tue, 24 Feb 2015 17:47:47 +0000 Subject: [PATCH] Eolite 2.56: fixed bug when different dialog windows used the same stack, use custom check boxes git-svn-id: svn://kolibrios.org@5463 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/eolite/Eolite.c | 12 +++--- programs/cmm/eolite/include/properties.h | 50 +++++++++++++----------- programs/cmm/eolite/include/settings.h | 48 +++++++++++------------ programs/cmm/lib/figures.h | 2 +- 4 files changed, 60 insertions(+), 52 deletions(-) diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 1bea38a88b..d30a53e4e5 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.55" -#define ABOUT_TITLE "Eolite v2.55" +#define TITLE "Eolite File Manager v2.56" +#define ABOUT_TITLE "Eolite v2.56" dword col_padding, col_selec, col_lpanel; int toolbar_buttons_x[7]={9,46,85,134,167,203}; @@ -1006,13 +1006,13 @@ void FnProcess(char N) break; case 8: SwitchToAnotherThread(); - CreateThread(#properties_dialog,#about_stak+4092); + CreateThread(#properties_dialog, #properties_stak+4092); break; case 10: //F10 if (!active_settings) { SwitchToAnotherThread(); - settings_window=CreateThread(#settings_dialog,#about_stak+4092); + settings_window=CreateThread(#settings_dialog, #settings_stak+4092); break; } else @@ -1032,4 +1032,6 @@ stop: char menu_stak[4096]; char copy_stak[4096]; char open_with_stak[4096]; -char about_stak[4096]; \ No newline at end of file +char about_stak[4096]; +char properties_stak[4096]; +char settings_stak[4096]; \ No newline at end of file diff --git a/programs/cmm/eolite/include/properties.h b/programs/cmm/eolite/include/properties.h index 0d92ad993e..9115a82e69 100644 --- a/programs/cmm/eolite/include/properties.h +++ b/programs/cmm/eolite/include/properties.h @@ -51,17 +51,18 @@ dword mouse_ddd2; char path_to_file[4096]="\0"; char file_name2[4096]="\0"; -edit_box file_name_ed = {150,50,25,0xffffff,0x94AECE,0x000000,0xffffff,2,4098,#file_name2,#mouse_ddd2, 1000000000000000b,2,2}; -edit_box path_to_file_ed = {150,100,46,0xffffff,0x94AECE,0x000000,0xffffff,2,4098,#path_to_file,#mouse_ddd2, 1000000000000000b,2,2}; +edit_box file_name_ed = {195,50,25,0xffffff,0x94AECE,0x000000,0xffffff,2,4098,#file_name2,#mouse_ddd2, 1000000000000000b,2,2}; +edit_box path_to_file_ed = {145,100,46,0xffffff,0x94AECE,0x000000,0xffffff,2,4098,#path_to_file,#mouse_ddd2, 1000000000000000b,2,2}; +frame flags_frame = { 0, 280, 10, 83, 106, 0x000111, 0xFFFfff, 1, FLAGS, 0, 0, 6, 0x000111, 0xCCCccc }; -frame flags_frame = { 0, 180, 10, 80, 106, 0x000111, 0xFFFfff, 1, FLAGS, 0, 0, 6, 0x000111, 0xCCCccc }; -checkbox2 HIDDEN_chb = {22*65536+15, 120*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, PR_T_HIDDEN, CH_FLAG_MIDDLE, 0}; -checkbox2 SYSTEM_chb = {22*65536+15, 140*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, PR_T_SYSTEM, CH_FLAG_MIDDLE, 0}; -checkbox2 ONLY_READ_chb = {22*65536+15, 160*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, PR_T_ONLY_READ, CH_FLAG_MIDDLE, 0}; +byte HIDDEN_chb, + SYSTEM_chb, + ONLY_READ_chb; int file_count, dir_count, size_dir; char folder_info[200]; -BDVK file_info2; +BDVK file_info_general; +BDVK file_info_dirsize; void GetSizeDir(dword way) { @@ -83,8 +84,8 @@ void GetSizeDir(dword way) } else { - GetFileInfo(#cur_file, #file_info2); - size_dir = size_dir + file_info2.sizelo; + GetFileInfo(#cur_file, #file_info_dirsize); + size_dir = size_dir + file_info_dirsize.sizelo; file_count++; } } @@ -96,14 +97,13 @@ void properties_dialog() byte id; unsigned int key; dword file_name_off; - BDVK file_info; proc_info settings_form; strcpy(#folder_info, "\0"); file_count = 0; dir_count = 0; size_dir = 0; - GetFileInfo(#file_path, #file_info); + GetFileInfo(#file_path, #file_info_general); strcpy(#file_name2, #file_name); file_name_ed.size = strlen(#file_name2); strcpy(#path_to_file, #path); @@ -133,11 +133,11 @@ void properties_dialog() break; case evReDraw: - DefineAndDrawWindow(Form.left + 150,150,300,238+GetSkinHeight(),0x34,sc.work,WINDOW_TITLE_PROPERTIES); + DefineAndDrawWindow(Form.left + 150,150,270,240+GetSkinHeight(),0x34,sc.work,WINDOW_TITLE_PROPERTIES); GetProcessInfo(#settings_form, SelfInfo); - DrawFlatButton(208, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, BTN_CLOSE); + DrawFlatButton(settings_form.cwidth - 70 - 13, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, BTN_CLOSE); DrawBar(10, 10, 32, 32, 0xFFFfff); - if (! TestBit(file_info.attr, 4) ) + if (! TestBit(file_info_general.attr, 4) ) Put_icon(#file_name2+strrchr(#file_name2,'.'), 18, 20, 0xFFFfff, 0); else Put_icon("", 18, 20, 0xFFFfff, 0); @@ -157,7 +157,7 @@ void properties_dialog() WriteText(10, 65, 0x80, 0x000000, PR_T_SIZE); if (!itdir) { - WriteText(100, 65, 0x80, 0x000000, ConvertSize(file_info.sizelo)); + WriteText(100, 65, 0x80, 0x000000, ConvertSize(file_info_general.sizelo)); } else { @@ -170,16 +170,22 @@ void properties_dialog() WriteText(100, 65, 0x80, 0x000000, ConvertSize(size_dir)); } - flags_frame.size_x = - flags_frame.start_x * 2 + settings_form.cwidth - 60; + flags_frame.size_x = - flags_frame.start_x * 2 + settings_form.cwidth - 2; flags_frame.font_color = sc.work_text; flags_frame.font_backgr_color = sc.work; + flags_frame.ext_col = sc.work_graph; frame_draw stdcall (#flags_frame); - if (TestBit(file_info.attr, 0)) ONLY_READ_chb.flags = 110b; - if (TestBit(file_info.attr, 1)) HIDDEN_chb.flags = 110b; - if (TestBit(file_info.attr, 2)) SYSTEM_chb.flags = 110b; - check_box_draw stdcall (#HIDDEN_chb); - check_box_draw stdcall (#SYSTEM_chb); - check_box_draw stdcall (#ONLY_READ_chb); + DrawPropertiesCheckBoxes(); } +} + +void DrawPropertiesCheckBoxes() +{ + ONLY_READ_chb = TestBit(file_info_general.attr, 0); + HIDDEN_chb = TestBit(file_info_general.attr, 1); + SYSTEM_chb = TestBit(file_info_general.attr, 2); + CheckBox2(22, 120, 20, PR_T_ONLY_READ, ONLY_READ_chb); + CheckBox2(22, 142, 21, PR_T_HIDDEN, HIDDEN_chb); + CheckBox2(22, 164, 22, PR_T_SYSTEM, SYSTEM_chb); } \ No newline at end of file diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h index 116f2296de..9d31bbc2ee 100644 --- a/programs/cmm/eolite/include/settings.h +++ b/programs/cmm/eolite/include/settings.h @@ -24,10 +24,7 @@ int mouse_ddd; char lineh_s[30]="18\0"; -edit_box LineHeight_ed = {52,10,90,0xffffff,0x94AECE,0xffc90E,0xffffff,2,4,#lineh_s,#mouse_ddd, 1000000000000000b,2,2}; -checkbox2 ShowDeviceName_chb = {10*65536+15, 10*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, SET_1, CH_FLAG_MIDDLE, 0}; -checkbox2 RealFileNamesCase_chb = {10*65536+15, 30*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, SET_2, CH_FLAG_MIDDLE, 0}; -checkbox2 InfoAfterCopy_chb = {10*65536+15, 50*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, SET_4, CH_FLAG_MIDDLE, 0}; +edit_box LineHeight_ed = {52,10,97,0xffffff,0x94AECE,0xffc90E,0xffffff,2,4,#lineh_s,#mouse_ddd, 1000000000000000b,2,2}; void settings_dialog() { @@ -38,10 +35,6 @@ void settings_dialog() if (active_settings) ExitProcess(); active_settings=1; - ShowDeviceName_chb.size_of_str = strlen(SET_1) * 6; - RealFileNamesCase_chb.size_of_str = strlen(SET_2) * 6; - InfoAfterCopy_chb.size_of_str = strlen(SET_4) * 6; - SetEventMask(0x27); loop() switch(WaitEvent()) { @@ -62,7 +55,12 @@ void settings_dialog() if (id==5) { RunProgram("tinypad", "/sys/settings/assoc.ini"); + break; } + if (id==20) show_dev_name ^= 1; + if (id==21) real_files_names_case ^= 1; + if (id==22) info_after_copy ^= 1; + DrawSettingsCheckBoxes(); break; case evKey: @@ -78,35 +76,35 @@ void settings_dialog() break; case evMouse: - check_box_mouse stdcall (#ShowDeviceName_chb); - check_box_mouse stdcall (#RealFileNamesCase_chb); - check_box_mouse stdcall (#InfoAfterCopy_chb); edit_box_mouse stdcall (#LineHeight_ed); break; case evReDraw: - DefineAndDrawWindow(Form.left + 100, 150, 300, 200+GetSkinHeight(),0x34,sc.work,TITLE_SETT); + DefineAndDrawWindow(Form.left + 100, 150, 300, 210+GetSkinHeight(),0x34,sc.work,TITLE_SETT); GetProcessInfo(#settings_form, SelfInfo); - ShowDeviceName_chb.flags |= 1 << show_dev_name; - RealFileNamesCase_chb.flags |= 1 << real_files_names_case; - InfoAfterCopy_chb.flags |= 1 << info_after_copy; + DrawSettingsCheckBoxes(); + WriteText(10, 84, 0x80, 0x000000, SET_3); key = itoa(files.line_h); strcpy(#lineh_s, key); - - check_box_draw stdcall (#ShowDeviceName_chb); - check_box_draw stdcall (#RealFileNamesCase_chb); - check_box_draw stdcall (#InfoAfterCopy_chb); edit_box_draw stdcall (#LineHeight_ed); DrawRectangle(LineHeight_ed.left-1, LineHeight_ed.top-1, LineHeight_ed.width+2, 16, sc.work_graph); - WriteText(10, 77, 0x80, 0x000000, SET_3); - DrawFlatButton(9, 120, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS); + + DrawFlatButton(9, 127, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS); + DrawFlatButton(128, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, APPLY_T); DrawFlatButton(208, settings_form.cheight - 34, 70, 22, 11, 0xE4DFE1, CANCEL_T); } } +void DrawSettingsCheckBoxes() +{ + CheckBox2(10, 11, 20, SET_1, show_dev_name); + CheckBox2(10, 33, 21, SET_2, real_files_names_case); + CheckBox2(10, 55, 22, SET_3, info_after_copy); +} + void LoadIniSettings() { @@ -125,9 +123,6 @@ void LoadIniSettings() void SaveIniSettings() { - show_dev_name = TestBit(ShowDeviceName_chb.flags, 1); - real_files_names_case = TestBit(RealFileNamesCase_chb.flags, 1); - info_after_copy = TestBit(InfoAfterCopy_chb.flags, 1); ini_set_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", show_dev_name); ini_set_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", real_files_names_case); ini_set_int stdcall (eolite_ini_path, "Config", "InfoAfterCopy", info_after_copy); @@ -159,4 +154,9 @@ void SetAppColors() col_padding = 0xC8C9C9; //col_selec = 0x94AECE; col_lpanel = 0x00699C; +} + + +void CheckBox2(dword x, y, id, text, byte value) { + CheckBox(x, y, 14, 14, id, text, sc.work_graph, sc.work_text, value); } \ No newline at end of file diff --git a/programs/cmm/lib/figures.h b/programs/cmm/lib/figures.h index ecc6aa80b0..3f7b8ba6e5 100644 --- a/programs/cmm/lib/figures.h +++ b/programs/cmm/lib/figures.h @@ -44,7 +44,7 @@ :void CheckBox(dword x,y,w,h, bt_id, text, graph_color, text_color, is_checked) { DefineButton(x-1, y-1, strlen(text)*6 + w + 17, h+2, bt_id+BT_HIDE+BT_NOFRAME, graph_color); - WriteText(x+w+10, h / 2 + y -3, 0x80, text_color, text); + WriteText(x+w+8, h / 2 + y -3, 0x80, text_color, text); DrawRectangle(x, y, w, h, graph_color); if (is_checked == 1) {