From c26000cc1061146ea1acb191ed54d2cf2902f02f Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sun, 6 Jan 2013 17:18:53 +0000 Subject: [PATCH] Eolite 1.51: do not sort big folders (this is hack, because there are some errors with sorting) git-svn-id: svn://kolibrios.org@3150 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/fs/Eolite/trunk/Eolite.c-- | 26 ++++++++++++------- .../fs/Eolite/trunk/include/about_dialog.h | 2 +- programs/fs/Eolite/trunk/include/ini.h | 4 +-- programs/fs/Eolite/trunk/lib/kolibri.h | 4 +-- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/programs/fs/Eolite/trunk/Eolite.c-- b/programs/fs/Eolite/trunk/Eolite.c-- index 8aa736d8f2..656df7fa31 100644 --- a/programs/fs/Eolite/trunk/Eolite.c-- +++ b/programs/fs/Eolite/trunk/Eolite.c-- @@ -20,7 +20,7 @@ int BUTTON_HEIGHT=18; #define ONLY_OPEN 2 //переменные -#define title "Eolite File Manager v1.5" +dword title[] = "Eolite File Manager v1.51"; dword col_work = 0xE4DFE1; dword col_border = 0x819FC5; dword col_padding = 0xC8C9C9; @@ -62,7 +62,8 @@ int scroll_size; int toolbar_buttons_x[7]={9,46,85,134,167,203}; char tmp_disk_del_param[3]="d0\0"; -dword file_mas[6898]; +dword file_mas[65535]; + int j, i, mouse_dd; int scroll_used; @@ -420,9 +421,9 @@ inline fastcall void draw_window() int min_size_y = disc_num*16+195; if (GetScreenHeight()<480) - DefineAndDrawWindow(20,0,582,GetScreenHeight()-30,0x73,col_work,title); + DefineAndDrawWindow(20,0,582,GetScreenHeight()-30,0x73,col_work,#title); else - DefineAndDrawWindow(98,90,582,482,0x73,col_work,title); + DefineAndDrawWindow(98,90,582,482,0x73,col_work,#title); GetProcessInfo(#Form, SelfInfo); if (Form.status_window>2) return; if (Form.height0) //ошибка при чтении папки { @@ -601,10 +602,10 @@ void Open_Dir(dword temp_, redraw){ return; } count = ESDWORD[buf+8]; - buf = realloc(count * 304 + 32, buf); //почему 32? + buf = realloc(count * 304 + 512, buf); //почему 32? ReadDir(count, buf, #path_); - IF (EBX>6897) && (EBX<>-1) EBX=6897; //1 на удачу ;) count=EBX; + if (count>sizeof(file_mas)) count=sizeof(file_mas); } if (count<>-1) { @@ -631,11 +632,13 @@ void Open_Dir(dword temp_, redraw){ inline Sorting() { dword k=0, l=1; - if (!strcmp(#path,"/")) //не сортировать папки и не менять регистр в "/" + + if (!strcmp(#path,"/")) //|| (count > 5000) //не сортировать папки и не менять регистр в "/" { FOR(k=1;k=0; j--, off-=304;) //папки вверх, файлы вниз { TitleCase(off+40); @@ -650,13 +653,16 @@ inline Sorting() l++; } } + //Собственно сортировка: вначале папки, потом файлы Sort_by_Name(0,k-1); IF (sort_num==1) Sort_by_Name(k,count-1); IF (sort_num==2) Sort_by_Type(k,count-1); IF (sort_num==3) Sort_by_Size(k,count-1); - //если папка ".." не первая, ставим её туда - IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")<>0) FOR(k--; k>0; k--;) IF (!strcmp(file_mas[k]*304+buf+72,"..")) file_mas[k]>0) //если папка ".." не первая, ставим её туда + { + FOR(k--; k>0; k--;) { IF (!strcmp(file_mas[k]*304+buf+72,"..")) file_mas[k]>