2014-01-07 05:04:38 +04:00
|
|
|
//Leency 2008-2014
|
2013-04-04 21:07:38 +04:00
|
|
|
|
2014-01-07 05:04:38 +04:00
|
|
|
byte copy_to[4096];
|
|
|
|
byte cut_active=0;
|
2013-10-15 03:16:04 +04:00
|
|
|
enum {NOCUT, CUT, COPY_PASTE_END};
|
2014-01-06 04:36:08 +04:00
|
|
|
|
|
|
|
Clipboard clipboard;
|
|
|
|
|
2013-04-04 21:07:38 +04:00
|
|
|
|
|
|
|
void Copy(dword pcth, char cut)
|
|
|
|
{
|
2014-01-07 05:04:38 +04:00
|
|
|
clipboard.data.size = sizeof(buffer_data);
|
|
|
|
clipboard.data.type = 0;
|
|
|
|
clipboard.data.encoding = 1;
|
|
|
|
strcpy(#clipboard.data.buffer_data, pcth);
|
|
|
|
clipboard.SetSlotData(sizeof(buffer_data), #clipboard.data);
|
2013-04-04 21:07:38 +04:00
|
|
|
cut_active = cut;
|
|
|
|
}
|
|
|
|
|
2013-10-14 02:18:41 +04:00
|
|
|
void copyf_Draw_Progress(dword filename) {
|
2014-01-07 05:04:38 +04:00
|
|
|
#define WIN_W 300
|
|
|
|
#define WIN_H 50
|
2013-10-23 21:55:07 +04: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 02:18:41 +04:00
|
|
|
if (CheckEvent()==evButton)
|
|
|
|
{
|
|
|
|
notify(T_CANCEL_PASTE);
|
|
|
|
ExitProcess();
|
|
|
|
}
|
2013-04-04 21:07:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Paste()
|
|
|
|
{
|
2013-10-15 03:16:04 +04:00
|
|
|
char copy_rezult;
|
2014-01-07 05:04:38 +04:00
|
|
|
byte copy_from[4096];
|
2013-04-04 21:07:38 +04:00
|
|
|
|
2014-01-06 04:36:08 +04:00
|
|
|
strcpy(#copy_from, clipboard.GetSlotData(clipboard.GetSlotCount()-1)+12);
|
|
|
|
|
2013-04-04 21:07:38 +04:00
|
|
|
if (!copy_from) ExitProcess();
|
|
|
|
strcpy(#copy_to, #path);
|
|
|
|
strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
|
|
|
|
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...");
|
|
|
|
ExitProcess();
|
|
|
|
}
|
2013-04-05 04:26:21 +04:00
|
|
|
if (copy_rezult = copyf(#copy_from,#copy_to))
|
2013-04-04 21:07:38 +04:00
|
|
|
{
|
|
|
|
Write_Error(copy_rezult);
|
|
|
|
}
|
2013-04-05 04:26:21 +04:00
|
|
|
else if (cut_active)
|
2013-04-04 21:07:38 +04:00
|
|
|
{
|
|
|
|
strcpy(#file_path, #copy_from);
|
|
|
|
Del_File(true);
|
|
|
|
cut_active=false;
|
|
|
|
}
|
2013-10-15 03:16:04 +04:00
|
|
|
action_buf = COPY_PASTE_END;
|
2013-04-04 21:07:38 +04:00
|
|
|
ActivateWindow(GetProcessSlot(Form.ID));
|
|
|
|
ExitProcess();
|
|
|
|
}
|