From 05b495ef7ecc8583a88806374550dea36ecdef36 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sat, 26 Jun 2021 07:59:13 +0000 Subject: [PATCH] KFM2: refactoring two-panes mode git-svn-id: svn://kolibrios.org@8946 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/appearance/appearance.c | 2 +- programs/cmm/barscfg/barscfg.c | 2 +- programs/cmm/clipview/clipview.c | 2 +- programs/cmm/dicty/dicty.c | 2 +- programs/cmm/drvinst/drvinst.c | 2 +- programs/cmm/eolite/Eolite.c | 74 +++++++++-------------- programs/cmm/eolite/include/breadcrumbs.h | 4 +- programs/cmm/eolite/include/left_panel.h | 2 +- programs/cmm/eolite/include/settings.h | 2 +- programs/cmm/iconedit/iconedit.c | 2 +- programs/cmm/kf_font_viewer/font_viewer.c | 2 +- programs/cmm/lib/fs.h | 19 ++++++ programs/cmm/lib/kolibri.h | 2 +- programs/cmm/liza/liza.c | 2 +- programs/cmm/misc/software_widget.c | 2 +- programs/cmm/mousecfg/mousecfg.c | 2 +- programs/cmm/pixie2/pixie.c | 2 +- programs/cmm/quark/quark.c | 4 +- programs/cmm/search/search.c | 2 +- programs/cmm/sysmon/sysmon.c | 2 +- programs/cmm/tmpdisk/t_gui.c | 2 +- 21 files changed, 67 insertions(+), 68 deletions(-) diff --git a/programs/cmm/appearance/appearance.c b/programs/cmm/appearance/appearance.c index b6f60c5df2..f695700f17 100644 --- a/programs/cmm/appearance/appearance.c +++ b/programs/cmm/appearance/appearance.c @@ -185,7 +185,7 @@ void draw_window() sc.get(); DefineAndDrawWindow(screen.width-600/2,80,630,504+skin_height,0x34,sc.work,WINDOW_HEADER,0); GetProcessInfo(#Form, SelfInfo); - IF (Form.status_window>=2) return; + IF (Form.status_window&ROLLED_UP) return; DrawWindowContent(); } diff --git a/programs/cmm/barscfg/barscfg.c b/programs/cmm/barscfg/barscfg.c index 1275778c4f..04fd40bd81 100644 --- a/programs/cmm/barscfg/barscfg.c +++ b/programs/cmm/barscfg/barscfg.c @@ -130,7 +130,7 @@ void main() sc.get(); DefineAndDrawWindow(130, 150, 465, 398 + skin_height, 0x34, sc.work, WINDOW_TITLE, 0); GetProcessInfo(#Form, SelfInfo); - if (Form.status_window>2) break; + if (Form.status_window&ROLLED_UP) break; DrawWindowContent(); } } diff --git a/programs/cmm/clipview/clipview.c b/programs/cmm/clipview/clipview.c index e9665a8cfb..6ad917c866 100644 --- a/programs/cmm/clipview/clipview.c +++ b/programs/cmm/clipview/clipview.c @@ -87,7 +87,7 @@ void main() sc.get(); DefineAndDrawWindow(GetScreenWidth()-600/2,80,600,400,0x73,NULL,"Clipboard Viewer",NULL); GetProcessInfo(#Form, SelfInfo); - IF (Form.status_window>=2) break; + IF (Form.status_window&ROLLED_UP) break; IF (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); break; } IF (Form.width < 570) { MoveSize(OLD,OLD,570,OLD); break; } DrawWindowContent(); diff --git a/programs/cmm/dicty/dicty.c b/programs/cmm/dicty/dicty.c index e142bde4b5..fa30104c3c 100644 --- a/programs/cmm/dicty/dicty.c +++ b/programs/cmm/dicty/dicty.c @@ -96,7 +96,7 @@ void main() sc.get(); DefineAndDrawWindow(215,120,500,350,0x73,sc.work,WINDOW_TITLE,0); GetProcessInfo(#Form, SelfInfo); - if (Form.status_window>2) break; + if (Form.status_window&ROLLED_UP) break; if (Form.height<140) { MoveSize(OLD,OLD,OLD,140); break; } if (Form.width<400) { MoveSize(OLD,OLD,400,OLD); break; } DrawBar(0, 0, Form.cwidth, TOPH, sc.work); //top bg diff --git a/programs/cmm/drvinst/drvinst.c b/programs/cmm/drvinst/drvinst.c index 1a32b2ae66..6e1234ac36 100644 --- a/programs/cmm/drvinst/drvinst.c +++ b/programs/cmm/drvinst/drvinst.c @@ -211,7 +211,7 @@ void Event_DrawWindow() sc.get(); DefineAndDrawWindow(215, 100, 600, 400, 0x33, sc.work, WINDOW_TITLE,0); GetProcessInfo(#Form, SelfInfo); - if (Form.status_window>2) return; + if (Form.status_window&ROLLED_UP) return; if (Form.width < 450) { MoveSize(OLD,OLD,450,OLD); return; } if (Form.height < 250) { MoveSize(OLD,OLD,OLD,250); return; } if (window_step == WINDOW_STEP_INTRO) Draw_IntroWindow(); diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index db7b005eb1..1953e89309 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -3,9 +3,9 @@ // 70.5 - get volume info and label -#define ABOUT_TITLE "EOLITE 5 RC4" -#define TITLE_EOLITE "Eolite File Manager 5 RC4" -#define TITLE_KFM "Kolibri File Manager 2 RC4"; +#define ABOUT_TITLE "EOLITE 5 RC5" +#define TITLE_EOLITE "Eolite File Manager 5 RC5" +#define TITLE_KFM "Kolibri File Manager 2 RC5"; #define MEMSIZE 1024 * 250 #include "../lib/clipboard.h" @@ -129,7 +129,7 @@ int rand_n; char sort_type=2; bool sort_desc=false; -int active_panel=1; +int active_panel=0; libimg_image icons16_default; libimg_image icons16_selected; @@ -243,7 +243,7 @@ void main() loop() switch(@WaitEventTimeout(80)) { case evMouse: - if (del_active) || (disk_popin_active_on_panel) || (Form.status_window>2) break; + if (del_active) || (disk_popin_active_on_panel) || (Form.status_window&ROLLED_UP) break; if (new_element_active) { edit_box_mouse stdcall(#new_file_ed); @@ -335,9 +335,9 @@ void main() if (efm) && (mouse.y < files.y + files.h) && (mouse.down) { if (mouse.x2) break; + if (Form.status_window&ROLLED_UP) break; if (new_element_active) || (del_active) || (disk_popin_active_on_panel) { @@ -516,7 +514,7 @@ void main() break; case SCAN_CODE_TAB: if (!efm) break; - ChangeActivePanel(); + SetActivePanel(active_panel^1); break; case SCAN_CODE_MENU: mouse.x = files.x+15; @@ -584,7 +582,7 @@ void draw_window() if (efm) title = TITLE_KFM; else title = TITLE_EOLITE; DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,title,0); GetProcessInfo(#Form, SelfInfo); - if (Form.status_window>2) return; + if (Form.status_window&ROLLED_UP) return; if (Form.height < 356) { MoveSize(OLD,OLD,OLD,356); return; } GetProcessInfo(#Form, SelfInfo); SetAppColors(); @@ -708,7 +706,7 @@ void DrawFilePanels() h2 = Form.cheight-files_y-2 - status_bar_h; col.selec = col.selec_inactive; //this is a bad code: need to use some var to set inactive panel for DrawButtonsAroundList(); - if (active_panel==1) + if (active_panel==0) { files.SetSizes(Form.cwidth/2, files_y, w2-17, h2, files.item_h); DrawButtonsAroundList(); @@ -721,7 +719,7 @@ void DrawFilePanels() DrawButtonsAroundList(); Open_Dir(#path,WITH_REDRAW); } - if (active_panel==2) + if (active_panel==1) { files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h); DrawButtonsAroundList(); @@ -780,23 +778,6 @@ void List_ReDraw() if (new_element_active) && (col.selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name); } -bool file_name_is_8_3(dword name) -{ - int name_len = strlen(name); - int dot_pos = strrchr(name, '.'); - if (name_len<=12) - { - if (dot_pos) { - if (name_len - dot_pos > 3) return false; - } - else { - if (name_len>8) return false; - } - return true; - } - return false; -} - void Line_ReDraw(dword bgcol, filenum){ dword text_col=col.list_gb_text, ext1, attr, @@ -1234,14 +1215,16 @@ void EventRefresh() } } -void ChangeActivePanel() +void SetActivePanel(int _active) { - if (active_panel==1) active_panel=2; else active_panel=1; - llist_copy(#files_active, #files_inactive); - llist_copy(#files_inactive, #files); - strcpy(#active_path, #inactive_path); - strcpy(#inactive_path, #path); - DrawFilePanels(); + if (active_panel != _active) { + active_panel = _active; + llist_copy(#files_active, #files_inactive); + llist_copy(#files_inactive, #files); + strcpy(#active_path, #inactive_path); + strcpy(#inactive_path, #path); + DrawFilePanels(); + } } void EventSelectFileByKeyPress() @@ -1440,10 +1423,6 @@ void EventToolbarButtonClick(int _btid) void EventDriveClick(int __id) { - if (disk_popin_active_on_panel != active_panel) { - ChangeActivePanel(); - } - SystemDiscs.Click(__id-100); if (efm) { draw_window(); @@ -1453,10 +1432,11 @@ void EventDriveClick(int __id) void EventOpenDiskPopin(int panel_n) { DefineHiddenButton(0,0,5000,3000,9999+BT_NOFRAME); - disk_popin_active_on_panel = panel_n; - if (disk_popin_active_on_panel==1) { + if (panel_n==0) { + disk_popin_active_on_panel = 1; SystemDiscs.DrawOptions(Form.cwidth/2-DDW, 8+DEV_H_HOR+3); } else { + disk_popin_active_on_panel = 2; SystemDiscs.DrawOptions(Form.cwidth-DDW-2, 8+DEV_H_HOR+3); } } diff --git a/programs/cmm/eolite/include/breadcrumbs.h b/programs/cmm/eolite/include/breadcrumbs.h index 4900063af4..c225c84048 100644 --- a/programs/cmm/eolite/include/breadcrumbs.h +++ b/programs/cmm/eolite/include/breadcrumbs.h @@ -47,7 +47,7 @@ void DrawPathBarKfm() bgc = 0xFFFFCC; PathShow.font_color = 0x222222; } - if (active_panel==1) PathShow.text_pointer = #path; else PathShow.text_pointer = #inactive_path; + if (active_panel==0) PathShow.text_pointer = #path; else PathShow.text_pointer = #inactive_path; PathShow.start_x = 4; PathShow.area_size_x = Form.cwidth/2-8; PathShow.start_y = Form.cheight - status_bar_h+2; @@ -59,7 +59,7 @@ void DrawPathBarKfm() PathShow_draw stdcall(#PathShow); i++; if (i<2) { - if (active_panel==1) PathShow.text_pointer = #inactive_path; else PathShow.text_pointer = #path; + if (active_panel==0) PathShow.text_pointer = #inactive_path; else PathShow.text_pointer = #path; PathShow.start_x = Form.cwidth/2 + 2; PathShow.area_size_x = Form.cwidth - PathShow.start_x - 5; goto _DRAW_BAR; diff --git a/programs/cmm/eolite/include/left_panel.h b/programs/cmm/eolite/include/left_panel.h index fbb72a1fd5..87001313f3 100644 --- a/programs/cmm/eolite/include/left_panel.h +++ b/programs/cmm/eolite/include/left_panel.h @@ -136,7 +136,7 @@ void _SystemDiscs::Draw() for (i=0; i<30; i++) DeleteButton(100+i); if (efm) { - if (active_panel==1) { + if (active_panel==0) { DrawSelect(Form.cwidth/2-DDW, 10, #path, KFM_DEV_DROPDOWN_1); DrawSelect(Form.cwidth-DDW-2, 10, #inactive_path, KFM_DEV_DROPDOWN_2); } else { diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h index 9563d1fe06..4cc6269185 100644 --- a/programs/cmm/eolite/include/settings.h +++ b/programs/cmm/eolite/include/settings.h @@ -146,7 +146,7 @@ void LoadIniSettings() ini.path = GetIni(#eolite_ini_path, "app.ini"); if (efm) ini.section = "EFM"; else ini.section = "Eolite"; - files.SetFont(8, 14, 10000000b); + files.SetFont(6, 9, 10000000b); show_dev_name.checked = ini.GetInt("ShowDeviceName", true); show_status_bar.checked = ini.GetInt("ShowStatusBar", true); big_icons.checked = ini.GetInt("BigIcons", false); BigIconsSwitch(); diff --git a/programs/cmm/iconedit/iconedit.c b/programs/cmm/iconedit/iconedit.c index 8e86a0f551..4c2511d062 100644 --- a/programs/cmm/iconedit/iconedit.c +++ b/programs/cmm/iconedit/iconedit.c @@ -373,7 +373,7 @@ void DrawWindow() sc.get(); DefineAndDrawWindow(115+random(100), 50+random(100), 700, 540, 0x73, NULL, T_TITLE, 0); GetProcessInfo(#Form, SelfInfo); - if (Form.status_window>2) return; + if (Form.status_window&ROLLED_UP) return; if (Form.width < 560) { MoveSize(OLD,OLD,560,OLD); return; } if (Form.height < 430) { MoveSize(OLD,OLD,OLD,430); return; } button.init(40); diff --git a/programs/cmm/kf_font_viewer/font_viewer.c b/programs/cmm/kf_font_viewer/font_viewer.c index 7c6bdd9290..b10f5125d8 100644 --- a/programs/cmm/kf_font_viewer/font_viewer.c +++ b/programs/cmm/kf_font_viewer/font_viewer.c @@ -44,7 +44,7 @@ void main() sc.get(); DefineAndDrawWindow(215,100,WIN_W+9,WIN_H+skin_height+5,0x74,0xFFFFFF,#title,0); GetProcessInfo(#Form, SelfInfo); - if (Form.status_window>2) break; + if (Form.status_window&ROLLED_UP) break; _DRAW_WINDOW_CONTENT: kfont.bold = bold.checked; diff --git a/programs/cmm/lib/fs.h b/programs/cmm/lib/fs.h index 2f28cc09c8..83325d04ed 100644 --- a/programs/cmm/lib/fs.h +++ b/programs/cmm/lib/fs.h @@ -331,6 +331,25 @@ char readbuf[32]; ExitProcess(); } +:bool file_name_is_8_3(dword name) +{ + strlen(name); + if (EAX>12) return false; + $push eax + strrchr(name, '.'); + $pop ebx + + //EAX = dot pos + //EBX = name length + + if (EAX) { + if (EBX-EAX>3) return false; + } else { + if (EBX>8) return false; + } + return true; +} + //===================================================// // // // Convert Size // diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index b0e12c76a5..0c5bdda763 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -384,6 +384,7 @@ inline fastcall int TestBit( EAX, CL) //------------------------------------------------------------------------------ +#define ROLLED_UP 0x04 :void DefineAndDrawWindow(dword _x, _y, _w, _h, _window_type, _bgcolor, _title, _flags) { EAX = 12; // function 12:tell os about windowdraw @@ -398,7 +399,6 @@ inline fastcall int TestBit( EAX, CL) ESI = _flags; $int 0x40 - EAX = 12; // function 12:tell os about windowdraw EBX = 2; $int 0x40 diff --git a/programs/cmm/liza/liza.c b/programs/cmm/liza/liza.c index cedd7c9129..55bfdff057 100644 --- a/programs/cmm/liza/liza.c +++ b/programs/cmm/liza/liza.c @@ -125,7 +125,7 @@ int DefineWindow(dword wtitle) { DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2, WIN_W, WIN_H, 0x73,sc.work, 0,0); DrawTitle(wtitle); GetProcessInfo(#Form, SelfInfo); - if (Form.status_window>2) return 0; //rolled_up + if (Form.status_window&ROLLED_UP) return 0; //rolled_up if (Form.width < WIN_MIN_W) MoveSize(OLD,OLD,WIN_MIN_W,OLD); if (Form.height < WIN_MIN_H) MoveSize(OLD,OLD,OLD,WIN_MIN_H); return 1; diff --git a/programs/cmm/misc/software_widget.c b/programs/cmm/misc/software_widget.c index 8764ac7b37..420aad7e36 100644 --- a/programs/cmm/misc/software_widget.c +++ b/programs/cmm/misc/software_widget.c @@ -104,7 +104,7 @@ void main() SetAppColors(); DefineAndDrawWindow(screen.width-window_width/2,screen.height-window_height/2,window_width,window_height,0x74,sc.work,"",0); GetProcessInfo(#Form, SelfInfo); - if (Form.status_window>2) { + if (Form.status_window&ROLLED_UP) { DrawTitle(#window_title); break; } diff --git a/programs/cmm/mousecfg/mousecfg.c b/programs/cmm/mousecfg/mousecfg.c index 0306a5b0ed..090a4da429 100644 --- a/programs/cmm/mousecfg/mousecfg.c +++ b/programs/cmm/mousecfg/mousecfg.c @@ -103,7 +103,7 @@ void main() { sc.get(); DefineAndDrawWindow(430, 150, 424, 343+skin_height,0x34,sc.work,WINDOW_TITLE,0); GetProcessInfo(#Form, SelfInfo); - if (Form.status_window>2) break; + if (Form.status_window&ROLLED_UP) break; mouse_frame.w = - FRAME_X * 2 + Form.cwidth; DefineButton(FRAME_X, FRAME_Y, mouse_frame.w, mouse_frame.h, 99+BT_NOFRAME, 0xF0F2F3); //needed to handle mouse_up and refresh mouse image diff --git a/programs/cmm/pixie2/pixie.c b/programs/cmm/pixie2/pixie.c index a47bac10f2..7124282d48 100644 --- a/programs/cmm/pixie2/pixie.c +++ b/programs/cmm/pixie2/pixie.c @@ -254,7 +254,7 @@ void DrawPlayList() void draw_window() { GetProcessInfo(#Form, SelfInfo); DrawTopPanel(); - IF (Form.status_window>=2) return; + IF (Form.status_window&ROLLED_UP) return; if (window_mode == WINDOW_MODE_NORMAL) { DrawPlayList(); diff --git a/programs/cmm/quark/quark.c b/programs/cmm/quark/quark.c index ecb7bd6e8c..f490470291 100644 --- a/programs/cmm/quark/quark.c +++ b/programs/cmm/quark/quark.c @@ -644,7 +644,7 @@ void DrawToolbar() void DrawStatusBar(dword _in_text) { static char status_text[64]; - if (Form.status_window>2) return; + if (Form.status_window&ROLLED_UP) return; if (_in_text) strncpy(#status_text, _in_text, sizeof(status_text)); DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, sc.work_graph); DrawBar(0,Form.cheight - STATUSBAR_H+1, Form.cwidth,STATUSBAR_H-1, sc.work); @@ -664,7 +664,7 @@ void draw_window() DefineAndDrawWindow(Form.left,Form.top,Form.width,Form.height,0x73,0,#title,0); GetProcessInfo(#Form, SelfInfo); sc.get(); - if (Form.status_window>2) return; + if (Form.status_window&ROLLED_UP) return; if (Form.width < 450) { MoveSize(OLD,OLD,450,OLD); return; } if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); return; } diff --git a/programs/cmm/search/search.c b/programs/cmm/search/search.c index 20f2439f9e..8b2302af38 100644 --- a/programs/cmm/search/search.c +++ b/programs/cmm/search/search.c @@ -164,7 +164,7 @@ void draw_window() sc.get(); DefineAndDrawWindow(screen.width-600/2,100,640,600+skin_height,0x73,sc.work,T_WINDOW_HEADER,0); GetProcessInfo(#Form, SelfInfo); - IF (Form.status_window>=2) return; + IF (Form.status_window&ROLLED_UP) return; if (Form.width < 270) { MoveSize(OLD,OLD,270,OLD); return; } if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); return; } SelectList_Init( 0, TOOLBAR_H, diff --git a/programs/cmm/sysmon/sysmon.c b/programs/cmm/sysmon/sysmon.c index 88eecfa6fb..f44c25a44a 100644 --- a/programs/cmm/sysmon/sysmon.c +++ b/programs/cmm/sysmon/sysmon.c @@ -137,7 +137,7 @@ void main() sc.get(); DefineAndDrawWindow(screen.width/2 - 350, 100, 700, 490, 0x33, sc.work, T_APP_TITLE,0); GetProcessInfo(#Form, SelfInfo); - if (Form.status_window>2) break; + if (Form.status_window&ROLLED_UP) break; if (Form.width < RIGHT_X+370) { MoveSize(OLD,OLD,RIGHT_X+370,OLD); break; } if (Form.height < 420) { MoveSize(OLD,OLD,OLD,420); break; } right_w = Form.cwidth - RIGHT_X - GAP; diff --git a/programs/cmm/tmpdisk/t_gui.c b/programs/cmm/tmpdisk/t_gui.c index 4065fa7f36..78619bd8f7 100644 --- a/programs/cmm/tmpdisk/t_gui.c +++ b/programs/cmm/tmpdisk/t_gui.c @@ -145,7 +145,7 @@ void Main_Window() sc.get(); DefineAndDrawWindow(170,150,405,290,0x74,sc.work,"Virtual Disk Manager 0.69",0); GetProcessInfo(#Form, SelfInfo); - if (Form.status_window>2) break; + if (Form.status_window&ROLLED_UP) break; DrawBar(0,0, Form.cwidth,TOPPANELH, sc.work); DrawBar(0,TOPPANELH, Form.cwidth,1, sc.work_graph);