Eolite 2.96: progress bar ib copy dialog; fixed bugs.

git-svn-id: svn://kolibrios.org@5691 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Serhii Sakhno 2015-08-07 02:11:35 +00:00
parent 1ef1a0a3a0
commit 1883cc1ab5
3 changed files with 66 additions and 28 deletions

View File

@ -103,8 +103,8 @@
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
enum { CREATE_FILE=1, CREATE_FOLDER, RENAME_ITEM }; //NewElement enum { CREATE_FILE=1, CREATE_FOLDER, RENAME_ITEM }; //NewElement
#define TITLE "Eolite File Manager v2.95" #define TITLE "Eolite File Manager v2.96"
#define ABOUT_TITLE "Eolite 2.95" #define ABOUT_TITLE "Eolite 2.96"
dword col_padding, col_selec, col_lpanel; dword col_padding, col_selec, col_lpanel;
int toolbar_buttons_x[7]={9,46,85,134,167,203}; int toolbar_buttons_x[7]={9,46,85,134,167,203};

View File

@ -3,6 +3,8 @@ byte copy_to[4096];
byte copy_from[4096]; byte copy_from[4096];
byte cut_active=0; byte cut_active=0;
progress_bar copy_bar = {0,16,49,50,20,0,0,1,0xFFFFFF,0x00FF00,0x000000};
enum {NOCUT, CUT, COPY_PASTE_END}; enum {NOCUT, CUT, COPY_PASTE_END};
Clipboard clipboard; Clipboard clipboard;
@ -12,8 +14,7 @@ void Copy(dword pcth, char cut)
dword selected_offset2; dword selected_offset2;
byte copy_t[4096]; byte copy_t[4096];
dword buff_data; dword buff_data;
int ind = 0; int ind = 0;
if (selected_count) if (selected_count)
{ {
buff_data = malloc(selected_count*4096+10); buff_data = malloc(selected_count*4096+10);
@ -51,6 +52,36 @@ void Paste() {
CreateThread(#PasteThread,copy_stak+20000-4); CreateThread(#PasteThread,copy_stak+20000-4);
} }
BDVK file_info_count;
int file_count_copy;
void DirFileCount(dword way)
{
dword dirbuf, fcount, i, filename;
dword cur_file;
if (isdir(way))
{
cur_file = malloc(4096);
// In the process of recursive descent, memory must be allocated dynamically, because the static memory -> was a bug !!! But unfortunately pass away to sacrifice speed.
GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL);
for (i=0; i<fcount; i++)
{
filename = i*304+dirbuf+72;
sprintf(cur_file,"%s/%s",way,filename);
if (TestBit(ESDWORD[filename-40], 4) )
{
file_count_copy++;
DirFileCount(cur_file);
}
else
{
file_count_copy++;
}
}
free(cur_file);
}
}
void PasteThread() void PasteThread()
{ {
@ -58,10 +89,20 @@ void PasteThread()
int j; int j;
int cnt = 0; int cnt = 0;
dword buf; dword buf;
file_count_copy = 0;
copy_bar.value = 0;
buf = clipboard.GetSlotData(clipboard.GetSlotCount()-1); buf = clipboard.GetSlotData(clipboard.GetSlotCount()-1);
if (DSDWORD[buf+4] != 3) return; if (DSDWORD[buf+4] != 3) return;
cnt = ESINT[buf+8]; cnt = ESINT[buf+8];
for (j = 0; j < cnt; j++) {
strlcpy(#copy_from, j*4096+buf+10, 4096);
GetFileInfo(#copy_from, #file_info_count);
if ( file_info_count.isfolder ) DirFileCount(#copy_from);
else file_count_copy++;
}
copy_bar.max = file_count_copy;
DisplayCopyfForm();
for (j = 0; j < cnt; j++) { for (j = 0; j < cnt; j++) {
strlcpy(#copy_from, j*4096+buf+10, 4096); strlcpy(#copy_from, j*4096+buf+10, 4096);
if (!copy_from) CopyExit(); if (!copy_from) CopyExit();
@ -79,9 +120,6 @@ void PasteThread()
CopyExit(); CopyExit();
} }
copyf_Draw_Progress(#copy_from);
pause(1000);
if (copy_rezult = copyf(#copy_from,#copy_to)) if (copy_rezult = copyf(#copy_from,#copy_to))
{ {
Write_Error(copy_rezult); Write_Error(copy_rezult);
@ -102,7 +140,7 @@ void PasteThread()
} }
#define WIN_COPY_W 345 #define WIN_COPY_W 345
#define WIN_COPY_H 80 #define WIN_COPY_H 110
proc_info Copy_Form; proc_info Copy_Form;
void DisplayCopyfForm() void DisplayCopyfForm()
@ -118,7 +156,7 @@ void DisplayCopyfForm()
DefineAndDrawWindow(Form.left+Form.width-200,Form.top+90,WIN_COPY_W,GetSkinHeight()+WIN_COPY_H,0x34,0xFFFFFF,T_PASTE_WINDOW_TITLE); DefineAndDrawWindow(Form.left+Form.width-200,Form.top+90,WIN_COPY_W,GetSkinHeight()+WIN_COPY_H,0x34,0xFFFFFF,T_PASTE_WINDOW_TITLE);
GetProcessInfo(#Copy_Form, SelfInfo); GetProcessInfo(#Copy_Form, SelfInfo);
WriteText(45, 11, 0x80, system.color.work_text, T_PASTE_WINDOW_TEXT); WriteText(45, 11, 0x80, system.color.work_text, T_PASTE_WINDOW_TEXT);
DrawFlatButton(Copy_Form.cwidth - 90, Copy_Form.cheight - 32, 80, 22, 10, system.color.work_button, T_PASTE_WINDOW_BUTTON); DrawFlatButton(Copy_Form.cwidth - 96, Copy_Form.cheight - 32, 80, 22, 10, system.color.work_button, T_PASTE_WINDOW_BUTTON);
DrawBar(8, 10, 32, 32, 0xFFFfff); DrawBar(8, 10, 32, 32, 0xFFFfff);
break; break;
} }
@ -132,9 +170,18 @@ void CopyExit() {
void copyf_Draw_Progress(dword copying_filename) { void copyf_Draw_Progress(dword copying_filename) {
//if (Copy_Form.cwidth==0) return; if (Copy_Form.cwidth==0)
{
copy_bar.value++;
return;
}
copy_bar.width = Copy_Form.cwidth-32;
DisplayCopyfForm(); DisplayCopyfForm();
Put_icon(copying_filename+strrchr(copying_filename,'.'), 16, 19, 0xFFFfff, 0); Put_icon(copying_filename+strrchr(copying_filename,'.'), 16, 19, 0xFFFfff, 0);
DrawBar(45, 29, Copy_Form.cwidth-45, 10, 0xFFFFFF); DrawBar(45, 29, Copy_Form.cwidth-45, 10, 0xFFFFFF);
WriteText(45, 29, 0x80, system.color.work_text, copying_filename); WriteText(45, 29, 0x80, 0x000000, copying_filename);
progressbar_draw stdcall (#copy_bar);
progressbar_progress stdcall (#copy_bar);
//copy_bar.value++;
pause(100);
} }

View File

@ -187,38 +187,28 @@ void GetSizeDir(dword way)
void GetSizeMoreFiles(dword way) void GetSizeMoreFiles(dword way)
{ {
int all_file_count, all_dir_count, all_size;
char cur_file[4096]; char cur_file[4096];
dword selected_offset2; dword selected_offset2;
all_file_count = 0;
all_dir_count = 0;
all_size = 0;
for (i=0; i<files.count; i++) for (i=0; i<files.count; i++)
{ {
selected_offset2 = file_mas[i]*304 + buf+32 + 7; selected_offset2 = file_mas[i]*304 + buf+32 + 7;
if (ESBYTE[selected_offset2]) { if (ESBYTE[selected_offset2]) {
sprintf(#cur_file,"%s/%s",way,file_mas[i]*304+buf+72); sprintf(#cur_file,"%s%s",way,file_mas[i]*304+buf+72);
if (TestBit(ESDWORD[file_mas[i]*304+buf+32], 4) )
GetFileInfo(#cur_file, #file_info_general);
if ( file_info_general.isfolder )
{ {
debugln(#cur_file);
GetSizeDir(#cur_file); GetSizeDir(#cur_file);
all_file_count = all_file_count + file_count; dir_count++;
all_dir_count = all_dir_count + dir_count +1;
all_size = all_size + size_dir;
} }
else else
{ {
all_file_count++; GetFileInfo(#cur_file, #file_info_dirsize);
all_size = all_size + file_info_general.sizelo; size_dir += file_info_dirsize.sizelo;
file_count++;
} }
} }
} }
file_count = all_file_count;
dir_count = all_dir_count;
size_dir = all_size;
} }
void properties_dialog() void properties_dialog()
@ -236,6 +226,7 @@ void properties_dialog()
if (selected_count) if (selected_count)
{ {
GetSizeMoreFiles(#path); GetSizeMoreFiles(#path);
debugi(size_dir);
atr_readonly = 0; atr_readonly = 0;
atr_hidden = 0; atr_hidden = 0;
atr_system = 0; atr_system = 0;