2014-01-07 02:04:38 +01:00
|
|
|
|
//Leency 2008-2014
|
2013-04-04 19:07:38 +02:00
|
|
|
|
|
2015-02-24 13:48:22 +01:00
|
|
|
|
#ifdef LANG_RUS
|
|
|
|
|
?define INFO_AFTER_COPY "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>襭<EFBFBD>"
|
|
|
|
|
#elif LANG_EST
|
|
|
|
|
?define INFO_AFTER_COPY "Copy finished"
|
|
|
|
|
#else
|
|
|
|
|
?define INFO_AFTER_COPY "Copy finished"
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-01-07 02:04:38 +01:00
|
|
|
|
byte copy_to[4096];
|
|
|
|
|
byte cut_active=0;
|
2014-01-06 01:36:08 +01:00
|
|
|
|
|
2014-04-26 00:31:07 +02:00
|
|
|
|
enum {NOCUT, CUT, COPY_PASTE_END};
|
2014-03-26 13:51:42 +01:00
|
|
|
|
|
2014-01-06 01:36:08 +01:00
|
|
|
|
Clipboard clipboard;
|
|
|
|
|
|
2013-04-04 19:07:38 +02:00
|
|
|
|
void Copy(dword pcth, char cut)
|
|
|
|
|
{
|
2014-11-05 23:34:25 +01:00
|
|
|
|
dword selected_offset2;
|
|
|
|
|
byte copy_t[4096];
|
|
|
|
|
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++;
|
|
|
|
|
}
|
2014-12-01 21:11:26 +01:00
|
|
|
|
if (!cont)
|
|
|
|
|
{
|
|
|
|
|
buff_data = malloc(4106);
|
|
|
|
|
ESDWORD[buff_data] = 4106;
|
|
|
|
|
ESDWORD[buff_data+4] = 3;
|
|
|
|
|
ESINT[buff_data+8] = 1;
|
|
|
|
|
strlcpy(buff_data+10, #file_path, 4096);;
|
|
|
|
|
clipboard.SetSlotData(4106, buff_data);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
buff_data = malloc(cont*4096+10);
|
|
|
|
|
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);
|
|
|
|
|
}
|
2013-04-04 19:07:38 +02:00
|
|
|
|
cut_active = cut;
|
2014-12-01 21:11:26 +01:00
|
|
|
|
free(buff_data);
|
2013-04-04 19:07:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-14 00:18:41 +02:00
|
|
|
|
void copyf_Draw_Progress(dword filename) {
|
2014-01-07 02:04:38 +01:00
|
|
|
|
#define WIN_W 300
|
|
|
|
|
#define WIN_H 50
|
2013-10-23 19:55:07 +02:00
|
|
|
|
DefineAndDrawWindow(Form.left+Form.width-200,Form.top+90,WIN_W,GetSkinHeight()+WIN_H-1,0x34,sc.work,T_PASTE_WINDOW);
|
|
|
|
|
WriteText(5,8, 0x80, sc.work_text, T_PASTE_WINDOW_TEXT);
|
|
|
|
|
DrawBar(5, 26, WIN_W-10, 10, sc.work);
|
|
|
|
|
WriteText(5,26, 0x80, sc.work_text, filename);
|
2013-10-14 00:18:41 +02:00
|
|
|
|
if (CheckEvent()==evButton)
|
|
|
|
|
{
|
|
|
|
|
notify(T_CANCEL_PASTE);
|
2014-04-20 11:52:52 +02:00
|
|
|
|
CopyExit();
|
2013-10-14 00:18:41 +02:00
|
|
|
|
}
|
2013-04-04 19:07:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Paste()
|
|
|
|
|
{
|
2013-10-15 01:16:04 +02:00
|
|
|
|
char copy_rezult;
|
2014-01-07 02:04:38 +01:00
|
|
|
|
byte copy_from[4096];
|
2014-11-05 23:34:25 +01:00
|
|
|
|
int j;
|
2014-12-01 21:11:26 +01:00
|
|
|
|
int cnt = 0;
|
2014-04-21 05:01:45 +02:00
|
|
|
|
dword buf;
|
|
|
|
|
|
|
|
|
|
buf = clipboard.GetSlotData(clipboard.GetSlotCount()-1);
|
2014-12-01 21:11:26 +01:00
|
|
|
|
if (DSDWORD[buf+4] != 3) return;
|
2014-11-05 23:34:25 +01:00
|
|
|
|
cnt = ESINT[buf+8];
|
2014-12-01 21:11:26 +01:00
|
|
|
|
for (j = 0; j < cnt; j++) {
|
2014-11-05 23:34:25 +01:00
|
|
|
|
strlcpy(#copy_from, j*4096+buf+10, 4096);
|
2014-04-20 11:52:52 +02:00
|
|
|
|
if (!copy_from) CopyExit();
|
2013-04-04 19:07:38 +02:00
|
|
|
|
strcpy(#copy_to, #path);
|
|
|
|
|
strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
|
2014-03-26 13:51:42 +01:00
|
|
|
|
if (!strcmp(#copy_from,#copy_to))
|
|
|
|
|
{
|
|
|
|
|
strcpy(#copy_to, #path);
|
|
|
|
|
strcat(#copy_to, "new_");
|
|
|
|
|
strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
|
|
|
|
|
}
|
|
|
|
|
if (strstr(#copy_to, #copy_from))
|
|
|
|
|
{
|
|
|
|
|
notify("Copy directory into itself is a bad idea...");
|
2014-04-20 11:52:52 +02:00
|
|
|
|
CopyExit();
|
2014-03-26 13:51:42 +01:00
|
|
|
|
}
|
|
|
|
|
if (copy_rezult = copyf(#copy_from,#copy_to))
|
|
|
|
|
{
|
|
|
|
|
Write_Error(copy_rezult);
|
|
|
|
|
}
|
2014-04-25 18:20:33 +02:00
|
|
|
|
|
|
|
|
|
else if (cut_active)
|
|
|
|
|
{
|
|
|
|
|
strcpy(#file_path, #copy_from);
|
|
|
|
|
Del_File(true);
|
|
|
|
|
|
|
|
|
|
}
|
2013-04-04 19:07:38 +02:00
|
|
|
|
}
|
2014-04-25 18:20:33 +02:00
|
|
|
|
if (cut_active)
|
2013-04-04 19:07:38 +02:00
|
|
|
|
{
|
|
|
|
|
cut_active=false;
|
|
|
|
|
}
|
2015-02-24 13:48:22 +01:00
|
|
|
|
if (info_after_copy) notify(INFO_AFTER_COPY);
|
2014-04-20 11:52:52 +02:00
|
|
|
|
CopyExit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CopyExit()
|
|
|
|
|
{
|
|
|
|
|
action_buf = COPY_PASTE_END;
|
2013-04-04 19:07:38 +02:00
|
|
|
|
ActivateWindow(GetProcessSlot(Form.ID));
|
|
|
|
|
ExitProcess();
|
2014-04-20 11:52:52 +02:00
|
|
|
|
}
|