mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-11-23 17:29:37 +03:00
KFM2: refactoring two-panes mode
git-svn-id: svn://kolibrios.org@8946 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
56d8f86244
commit
05b495ef7e
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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.x<Form.cwidth/2) {
|
||||
if (active_panel!=1) ChangeActivePanel();
|
||||
SetActivePanel(0);
|
||||
} else {
|
||||
if (active_panel!=2) ChangeActivePanel();
|
||||
SetActivePanel(1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -370,18 +370,16 @@ void main()
|
||||
break;
|
||||
case KFM_DEV_DROPDOWN_1:
|
||||
case KFM_DEV_DROPDOWN_1+1:
|
||||
EventOpenDiskPopin(1);
|
||||
break;
|
||||
case KFM_DEV_DROPDOWN_2:
|
||||
case KFM_DEV_DROPDOWN_2+1:
|
||||
EventOpenDiskPopin(2);
|
||||
EventOpenDiskPopin(active_panel);
|
||||
break;
|
||||
case BACK_BTN...PASTE_BTN:
|
||||
if (active_panel==2) ChangeActivePanel();
|
||||
SetActivePanel(0);
|
||||
EventToolbarButtonClick(id);
|
||||
break;
|
||||
case BACK_BTN+100...PASTE_BTN+100:
|
||||
if (active_panel==1) ChangeActivePanel();
|
||||
SetActivePanel(1);
|
||||
EventToolbarButtonClick(id-100);
|
||||
break;
|
||||
case 31...33:
|
||||
@ -412,7 +410,7 @@ void main()
|
||||
case evKey:
|
||||
GetKeys();
|
||||
|
||||
if (Form.status_window>2) 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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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 //
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user