Eolite 2.31: optimization of the copy function

git-svn-id: svn://kolibrios.org@4896 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Serhii Sakhno 2014-04-25 22:31:07 +00:00
parent e068c839b9
commit 2f985ba4ca
3 changed files with 51 additions and 43 deletions

View File

@ -82,8 +82,8 @@
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
#define TITLE "Eolite File Manager v2.3"
#define ABOUT_TITLE "Eolite v2.3"
#define TITLE "Eolite File Manager v2.31"
#define ABOUT_TITLE "Eolite v2.31"
dword col_padding, col_selec, col_lpanel;
int toolbar_buttons_x[7]={9,46,85,134,167,203};
@ -125,6 +125,7 @@ edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_nam
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
#include "include\mark.h"
#include "include\copy.h"
#include "include\other.h"
#include "include\sorting.h"
@ -164,6 +165,7 @@ void main()
mem_Init();
if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_1);
SystemDiscsGet();
mark_default();
GetIni(1);
SetAppColors();
if (param)
@ -428,9 +430,8 @@ void main()
Del_Form();
break;
case 185: //ins
add_to_copy_active=1;
add_to_copy(#file_path);
notify("'Eolite\nFile was added to copy queue' -tI");
add_to_mark(#file_path);
//notify("'Eolite\nFile was added to copy queue' -tI");
break;
case 050...059: //F1-F10
FnProcess(key-49);
@ -775,6 +776,10 @@ int Del_File2(dword way)
void Del_File(byte dodel)
{
byte del_from[4096];
int tst, count, j;
dword buf;
if (dodel==true)
{
del_active=2;
@ -857,6 +862,7 @@ void Dir_Up()
void Open()
{
mark_default();
if (!files.count) return;
if (!itdir)
{

View File

@ -2,45 +2,19 @@
byte copy_to[4096];
byte cut_active=0;
byte id_add_to_copy=0;
byte add_to_copy_active=0;
enum {NOCUT, CUT, COPY_PASTE_END};
struct path_str {
char Item[4096];
};
#define MAX_HISTORY_NUM 10
enum {NOCUT, CUT, COPY_PASTE_END};
Clipboard clipboard;
struct Copy_Path {
dword size;
dword type;
int count;
path_str copy_list[MAX_HISTORY_NUM];
};
Copy_Path copy_path;
void add_to_copy(dword pcth)
{
strlcpy(#copy_path.copy_list[id_add_to_copy].Item, pcth);
if (add_to_copy_active == 1)
{
id_add_to_copy++;
copy_path.count = id_add_to_copy;
}
else copy_path.count = 1;
}
void Copy(dword pcth, char cut)
{
if (add_to_copy_active == 0) add_to_copy(pcth);
copy_path.type = 3;
copy_path.size = sizeof(copy_path);
clipboard.SetSlotData(sizeof(copy_path), #copy_path);
if (mark_active == 0) {
strlcpy(#elements_path.element_list[elements_path.count].Item, pcth);
elements_path.count++;
}
elements_path.size = sizeof(elements_path);
clipboard.SetSlotData(sizeof(elements_path), #elements_path);
cut_active = cut;
}
@ -58,7 +32,6 @@ void copyf_Draw_Progress(dword filename) {
}
}
void Paste()
{
char copy_rezult;
@ -71,9 +44,6 @@ void Paste()
if (DSDWORD[buf+4] != 3) return;
debugi(count);
add_to_copy_active=0;
id_add_to_copy=0;
for (j = 0; j < count; j++) {
tst = j*4096;
strlcpy(#copy_from, buf+12+tst, 4096);
@ -107,7 +77,7 @@ void Paste()
{
cut_active=false;
}
for (j = 0; j < count; j++) strcpy(#copy_path.copy_list[j].Item[0], 0);
mark_default();
CopyExit();
}

View File

@ -0,0 +1,32 @@
#define MAX_ELEMENT 10
byte mark_active = 0;
struct path_strng {
char Item[4096];
};
struct Elements_Path {
dword size;
dword type;
int count;
path_strng element_list[MAX_ELEMENT];
};
Elements_Path elements_path;
void mark_default()
{
mark_active = 0;
elements_path.count = 0;
elements_path.type = 3;
for (i = 0; i < MAX_ELEMENT; i++) strcpy(#elements_path.element_list[i].Item[0], 0);
}
void add_to_mark(dword pcth)
{
if (mark_active) mark_active = 1;
strlcpy(#elements_path.element_list[elements_path.count].Item, pcth);
elements_path.count++;
}