2015-02-24 15:48:22 +03:00
|
|
|
|
2014-01-07 05:04:38 +04:00
|
|
|
byte copy_to[4096];
|
2015-03-09 21:49:34 +03:00
|
|
|
byte copy_from[4096];
|
2014-01-07 05:04:38 +04:00
|
|
|
byte cut_active=0;
|
2014-01-06 04:36:08 +04:00
|
|
|
|
2014-04-26 02:31:07 +04:00
|
|
|
enum {NOCUT, CUT, COPY_PASTE_END};
|
2014-03-26 16:51:42 +04:00
|
|
|
|
2014-01-06 04:36:08 +04:00
|
|
|
Clipboard clipboard;
|
|
|
|
|
2013-04-04 21:07:38 +04:00
|
|
|
void Copy(dword pcth, char cut)
|
|
|
|
{
|
2015-03-09 21:02:10 +03:00
|
|
|
dword selected_offset2;
|
|
|
|
byte copy_t[4096];
|
|
|
|
dword buff_data;
|
|
|
|
int ind = 0;
|
|
|
|
|
|
|
|
if (selected_count)
|
|
|
|
{
|
|
|
|
buff_data = malloc(selected_count*4096+10);
|
|
|
|
ESDWORD[buff_data] = selected_count*4096+10;
|
|
|
|
ESDWORD[buff_data+4] = 3;
|
|
|
|
ESINT[buff_data+8] = selected_count;
|
2014-11-06 01:34:25 +03:00
|
|
|
for (i=0; i<files.count; i++)
|
|
|
|
{
|
2015-03-09 21:02:10 +03:00
|
|
|
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++;
|
2014-12-01 23:11:26 +03:00
|
|
|
}
|
2015-03-09 21:02:10 +03:00
|
|
|
}
|
|
|
|
clipboard.SetSlotData(selected_count*4096+10, buff_data);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
2013-04-04 21:07:38 +04:00
|
|
|
cut_active = cut;
|
2014-12-01 23:11:26 +03:00
|
|
|
free(buff_data);
|
2013-04-04 21:07:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-07-23 15:23:52 +03:00
|
|
|
void Paste() {
|
|
|
|
copy_stak = malloc(20000);
|
2015-07-29 15:14:49 +03:00
|
|
|
CreateThread(#PasteThread,copy_stak+20000-4);
|
2015-07-23 15:23:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-07-23 15:15:53 +03:00
|
|
|
void PasteThread()
|
2013-04-04 21:07:38 +04:00
|
|
|
{
|
2013-10-15 03:16:04 +04:00
|
|
|
char copy_rezult;
|
2014-11-06 01:34:25 +03:00
|
|
|
int j;
|
2015-03-09 21:49:34 +03:00
|
|
|
int cnt = 0;
|
2014-04-21 07:01:45 +04:00
|
|
|
dword buf;
|
|
|
|
|
|
|
|
buf = clipboard.GetSlotData(clipboard.GetSlotCount()-1);
|
2015-03-09 21:49:34 +03:00
|
|
|
if (DSDWORD[buf+4] != 3) return;
|
2014-11-06 01:34:25 +03:00
|
|
|
cnt = ESINT[buf+8];
|
2015-03-09 21:49:34 +03:00
|
|
|
for (j = 0; j < cnt; j++) {
|
2014-11-06 01:34:25 +03:00
|
|
|
strlcpy(#copy_from, j*4096+buf+10, 4096);
|
2014-04-20 13:52:52 +04:00
|
|
|
if (!copy_from) CopyExit();
|
2013-04-04 21:07:38 +04:00
|
|
|
strcpy(#copy_to, #path);
|
|
|
|
strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
|
2014-03-26 16:51:42 +04: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 13:52:52 +04:00
|
|
|
CopyExit();
|
2014-03-26 16:51:42 +04:00
|
|
|
}
|
2015-03-09 21:49:34 +03:00
|
|
|
|
2015-08-07 01:18:15 +03:00
|
|
|
copyf_Draw_Progress(#copy_from);
|
|
|
|
pause(1000);
|
2015-03-09 21:49:34 +03:00
|
|
|
|
2014-03-26 16:51:42 +04:00
|
|
|
if (copy_rezult = copyf(#copy_from,#copy_to))
|
|
|
|
{
|
|
|
|
Write_Error(copy_rezult);
|
|
|
|
}
|
2014-04-25 20:20:33 +04:00
|
|
|
else if (cut_active)
|
|
|
|
{
|
|
|
|
strcpy(#file_path, #copy_from);
|
|
|
|
Del_File(true);
|
|
|
|
|
|
|
|
}
|
2013-04-04 21:07:38 +04:00
|
|
|
}
|
2014-04-25 20:20:33 +04:00
|
|
|
if (cut_active)
|
2013-04-04 21:07:38 +04:00
|
|
|
{
|
|
|
|
cut_active=false;
|
|
|
|
}
|
2015-02-24 15:48:22 +03:00
|
|
|
if (info_after_copy) notify(INFO_AFTER_COPY);
|
2014-04-20 13:52:52 +04:00
|
|
|
CopyExit();
|
|
|
|
}
|
|
|
|
|
2015-03-09 21:49:34 +03:00
|
|
|
#define WIN_COPY_W 345
|
|
|
|
#define WIN_COPY_H 80
|
|
|
|
proc_info Copy_Form;
|
|
|
|
|
|
|
|
void DisplayCopyfForm()
|
2014-04-20 13:52:52 +04:00
|
|
|
{
|
2015-03-09 21:49:34 +03:00
|
|
|
switch(CheckEvent())
|
|
|
|
{
|
|
|
|
case evButton:
|
|
|
|
notify(T_CANCEL_PASTE);
|
|
|
|
CopyExit();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evReDraw:
|
2015-08-07 01:18:15 +03:00
|
|
|
DefineAndDrawWindow(Form.left+Form.width-200,Form.top+90,WIN_COPY_W,GetSkinHeight()+WIN_COPY_H,0x34,0xFFFFFF,T_PASTE_WINDOW_TITLE);
|
2015-03-09 21:49:34 +03:00
|
|
|
GetProcessInfo(#Copy_Form, SelfInfo);
|
2015-08-04 17:36:07 +03:00
|
|
|
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);
|
2015-03-09 21:49:34 +03:00
|
|
|
DrawBar(8, 10, 32, 32, 0xFFFfff);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CopyExit() {
|
2014-04-20 13:52:52 +04:00
|
|
|
action_buf = COPY_PASTE_END;
|
2013-04-04 21:07:38 +04:00
|
|
|
ActivateWindow(GetProcessSlot(Form.ID));
|
|
|
|
ExitProcess();
|
2015-03-09 21:49:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void copyf_Draw_Progress(dword copying_filename) {
|
2015-08-07 01:18:15 +03:00
|
|
|
//if (Copy_Form.cwidth==0) return;
|
2015-03-09 21:49:34 +03:00
|
|
|
DisplayCopyfForm();
|
|
|
|
Put_icon(copying_filename+strrchr(copying_filename,'.'), 16, 19, 0xFFFfff, 0);
|
2015-08-07 01:18:15 +03:00
|
|
|
DrawBar(45, 29, Copy_Form.cwidth-45, 10, 0xFFFFFF);
|
2015-08-04 17:36:07 +03:00
|
|
|
WriteText(45, 29, 0x80, system.color.work_text, copying_filename);
|
2014-04-20 13:52:52 +04:00
|
|
|
}
|