Update list disk and files.

git-svn-id: svn://kolibrios.org@7310 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pavelyakov 2018-08-11 20:02:54 +00:00
parent eb70351e10
commit 64951a7689
3 changed files with 77 additions and 6 deletions

View File

@ -180,7 +180,7 @@ void main()
llist_copy(#files_inactive, #files); llist_copy(#files_inactive, #files);
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
loop(){ loop(){
switch(WaitEvent()) switch(WaitEventTimeout(50))
{ {
case evMouse: case evMouse:
if (del_active) || (Form.status_window>2) break; if (del_active) || (Form.status_window>2) break;
@ -527,7 +527,14 @@ void main()
if (action_buf==110) FnProcess(8); if (action_buf==110) FnProcess(8);
action_buf=0; action_buf=0;
} }
break;
default:
IF( SystemDiscs.Get() ) DrawDeviceAndActionsLeftPanel();
Update_Dir(#path,WITH_REDRAW);
} }
if(cmd_free) if(cmd_free)
{ {
if(cmd_free==1) menu_stak=free(menu_stak); if(cmd_free==1) menu_stak=free(menu_stak);
@ -810,6 +817,60 @@ void Open_Dir(dword dir_path, redraw){
} }
} }
dword __updateDirCount = 0;
void Update_Dir(dword dir_path, redraw){
int errornum, maxcount, i;
if (redraw!=ONLY_SHOW)
{
selected_count = 0;
if (buf) free(buf);
errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
if (errornum)
{
history.add(#path);
GoBack();
Write_Error(errornum);
return;
}
maxcount = sizeof(file_mas)/sizeof(dword)-1;
if (files.count>maxcount) files.count = maxcount;
if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
}
if (files.count!=-1)
{
if(!_not_draw) if (show_breadcrumb.checked) DrawBreadCrumbs(); else DrawPathBar();
history.add(#path);
SystemDiscs.Draw();
files.visible = files.h / files.item_h;
if (files.count < files.visible) files.visible = files.count;
if (redraw!=ONLY_SHOW) Sorting();
list_full_redraw = true;
if (redraw!=ONLY_OPEN)&&(!_not_draw)
{
if ( __updateDirCount!=files.count )
{
DrawStatusBar();
List_ReDraw();
__updateDirCount = files.count;
}
}
SetCurDir(dir_path);
}
if (files.count==-1) && (redraw!=ONLY_OPEN)
{
files.KeyHome();
if(!_not_draw)
{
list_full_redraw=true;
if ( __updateDirCount!=files.count )
{
DrawStatusBar();
List_ReDraw();
__updateDirCount = files.count;
}
}
}
}
inline Sorting() inline Sorting()
{ {

View File

@ -40,7 +40,7 @@
struct _SystemDiscs struct _SystemDiscs
{ {
collection list; collection list;
void Get(); byte Get();
void Draw(); void Draw();
void Click(); void Click();
} SystemDiscs; } SystemDiscs;
@ -88,9 +88,10 @@ void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)
strcpy(disc_name, T_UNC); strcpy(disc_name, T_UNC);
} }
} }
dword __countSysDiscs = 0;
void _SystemDiscs::Get() byte _SystemDiscs::Get()
{ {
byte ret = 0;
char dev_name[10], sys_discs[10]; char dev_name[10], sys_discs[10];
int i1, j1, dev_num, dev_disc_num; int i1, j1, dev_num, dev_disc_num;
dword temp_file_count, tempbuf; dword temp_file_count, tempbuf;
@ -100,6 +101,11 @@ void _SystemDiscs::Get()
devbuf = malloc(10000); devbuf = malloc(10000);
ReadDir(19, devbuf, "/"); ReadDir(19, devbuf, "/");
dev_num = EBX; dev_num = EBX;
if (dev_num != __countSysDiscs)
{
__countSysDiscs = dev_num;
ret = 0xFF;
}
for (i1=0; i1<dev_num; i1++) for (i1=0; i1<dev_num; i1++)
{ {
sprintf(#dev_name,"/%s",i1*304+ devbuf+72); sprintf(#dev_name,"/%s",i1*304+ devbuf+72);
@ -118,6 +124,7 @@ void _SystemDiscs::Get()
} }
} }
free(devbuf); free(devbuf);
return ret;
} }
void _SystemDiscs::Draw() void _SystemDiscs::Draw()

View File

@ -91,12 +91,15 @@ inline fastcall dword CheckEvent()
{ {
$mov eax,11 $mov eax,11
$int 0x40 $int 0x40
wait_event_code = EAX;
} }
inline fastcall dword WaitEventTimeout(EBX) :dword WaitEventTimeout(dword time)
{ {
$mov eax,23 EAX = 23;
EBX = time;
$int 0x40 $int 0x40
wait_event_code = EAX;
} }
inline fastcall dword SetEventMask(EBX) inline fastcall dword SetEventMask(EBX)