Eolite 2.39: copy the selected files

git-svn-id: svn://kolibrios.org@5174 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Serhii Sakhno 2014-11-05 22:34:25 +00:00
parent 4ef97c812c
commit 1b1d267df0
3 changed files with 38 additions and 52 deletions

View File

@ -19,6 +19,7 @@
#include "..\lib\list_box.h" #include "..\lib\list_box.h"
#include "..\lib\copyf.h" #include "..\lib\copyf.h"
#include "..\lib\random.h" #include "..\lib\random.h"
#include "..\lib\lib.obj\libini.h"
//images //images
#include "imgs\toolbar.txt" #include "imgs\toolbar.txt"
#include "imgs\left_p.txt" #include "imgs\left_p.txt"
@ -82,8 +83,8 @@
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
#define TITLE "Eolite File Manager v2.38" #define TITLE "Eolite File Manager v2.39"
#define ABOUT_TITLE "Eolite v2.38" #define ABOUT_TITLE "Eolite v2.39"
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};
@ -125,7 +126,6 @@ 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 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}; 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\copy.h"
#include "include\other.h" #include "include\other.h"
#include "include\sorting.h" #include "include\sorting.h"
@ -165,8 +165,8 @@ void main()
files.line_h=18; files.line_h=18;
mem_Init(); mem_Init();
if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_1); if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_1);
if (load_dll2(libini, #lib_init,1)!=0) notify("Error: library doesn't exists - libini");
SystemDiscsGet(); SystemDiscsGet();
mark_default();
GetIni(1); GetIni(1);
SetAppColors(); SetAppColors();
if (param) if (param)
@ -872,7 +872,6 @@ void Dir_Up()
void Open() void Open()
{ {
mark_default();
if (!files.count) return; if (!files.count) return;
if (!itdir) if (!itdir)
{ {

View File

@ -9,12 +9,33 @@ Clipboard clipboard;
void Copy(dword pcth, char cut) void Copy(dword pcth, char cut)
{ {
if (mark_active == 0) { dword selected_offset2;
strlcpy(#elements_path.element_list[elements_path.count].Item, pcth); byte copy_t[4096];
elements_path.count++; int cont = 0;
dword buff_data;
int ind = 0;
for (i=0; i<files.count; i++)
{
selected_offset2 = file_mas[i]*304 + buf+32 + 7;
if (ESBYTE[selected_offset2]) cont++;
} }
elements_path.size = sizeof(elements_path); buff_data = malloc(cont*4096+10);
clipboard.SetSlotData(sizeof(elements_path), #elements_path); ESDWORD[buff_data] = cont*4096+10;
ESDWORD[buff_data+4] = 3;
ESINT[buff_data+8] = cont;
for (i=0; i<files.count; i++)
{
selected_offset2 = file_mas[i]*304 + buf+32 + 7;
if (ESBYTE[selected_offset2]) {
strcpy(#copy_t, #path);
strcat(#copy_t, file_mas[i]*304+buf+72);
strlcpy(ind*4096+buff_data+10, #copy_t, 4096);
ind++;
}
}
clipboard.SetSlotData(cont*4096+10, buff_data);
cut_active = cut; cut_active = cut;
} }
@ -36,17 +57,15 @@ void Paste()
{ {
char copy_rezult; char copy_rezult;
byte copy_from[4096]; byte copy_from[4096];
int tst, count, j; int j;
int cnt = 0;
dword buf; dword buf;
buf = clipboard.GetSlotData(clipboard.GetSlotCount()-1); buf = clipboard.GetSlotData(clipboard.GetSlotCount()-1);
count = DSINT[buf+8];
if (DSDWORD[buf+4] != 3) return; if (DSDWORD[buf+4] != 3) return;
debugi(count); cnt = ESINT[buf+8];
for (j = 0; j < cnt; j++) {
for (j = 0; j < count; j++) { strlcpy(#copy_from, j*4096+buf+10, 4096);
tst = j*4096;
strlcpy(#copy_from, buf+12+tst, 4096);
if (!copy_from) CopyExit(); if (!copy_from) CopyExit();
strcpy(#copy_to, #path); strcpy(#copy_to, #path);
strcat(#copy_to, #copy_from+strrchr(#copy_from,'/')); strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
@ -77,7 +96,7 @@ void Paste()
{ {
cut_active=false; cut_active=false;
} }
mark_default(); //mark_default();
CopyExit(); CopyExit();
} }

View File

@ -1,32 +0,0 @@
#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++;
}