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);
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
loop(){
switch(WaitEvent())
switch(WaitEventTimeout(50))
{
case evMouse:
if (del_active) || (Form.status_window>2) break;
@ -527,7 +527,14 @@ void main()
if (action_buf==110) FnProcess(8);
action_buf=0;
}
break;
default:
IF( SystemDiscs.Get() ) DrawDeviceAndActionsLeftPanel();
Update_Dir(#path,WITH_REDRAW);
}
if(cmd_free)
{
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()
{

View File

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

View File

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