Subversion Repositories Kolibri OS

Rev

Rev 4427 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. //Leency 2008-2014
  2.  
  3. byte copy_to[4096];
  4. byte cut_active=0;
  5. enum {NOCUT, CUT, COPY_PASTE_END};
  6.  
  7. Clipboard clipboard;
  8.  
  9.  
  10. void Copy(dword pcth, char cut)
  11. {
  12.         clipboard.data.size = sizeof(buffer_data);
  13.         clipboard.data.type = 0;
  14.         clipboard.data.encoding = 1;
  15.         strcpy(#clipboard.data.buffer_data, pcth);
  16.         clipboard.SetSlotData(sizeof(buffer_data), #clipboard.data);
  17.         cut_active = cut;
  18. }
  19.  
  20. void copyf_Draw_Progress(dword filename) {
  21.         #define WIN_W 300
  22.         #define WIN_H 50
  23.         DefineAndDrawWindow(Form.left+Form.width-200,Form.top+90,WIN_W,GetSkinHeight()+WIN_H-1,0x34,sc.work,T_PASTE_WINDOW);
  24.         WriteText(5,8, 0x80, sc.work_text, T_PASTE_WINDOW_TEXT);
  25.         DrawBar(5, 26, WIN_W-10, 10, sc.work);
  26.         WriteText(5,26, 0x80, sc.work_text, filename);
  27.         if (CheckEvent()==evButton)
  28.         {
  29.                 notify(T_CANCEL_PASTE);
  30.                 ExitProcess();
  31.         }
  32. }
  33.  
  34.  
  35. void Paste()
  36. {
  37.         char copy_rezult;
  38.         byte copy_from[4096];
  39.        
  40.         strcpy(#copy_from, clipboard.GetSlotData(clipboard.GetSlotCount()-1)+12);
  41.        
  42.         if (!copy_from) ExitProcess();
  43.         strcpy(#copy_to, #path);
  44.         strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
  45.         if (!strcmp(#copy_from,#copy_to))
  46.         {
  47.                 strcpy(#copy_to, #path);
  48.                 strcat(#copy_to, "new_");
  49.                 strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
  50.         }
  51.         if (strstr(#copy_to, #copy_from))
  52.         {
  53.                 notify("Copy directory into itself is a bad idea...");
  54.                 ExitProcess();
  55.         }
  56.         if (copy_rezult = copyf(#copy_from,#copy_to))
  57.         {
  58.                 Write_Error(copy_rezult);
  59.         }
  60.         else if (cut_active)
  61.         {
  62.                 strcpy(#file_path, #copy_from);
  63.                 Del_File(true);
  64.                 cut_active=false;
  65.         }
  66.         action_buf = COPY_PASTE_END;
  67.         ActivateWindow(GetProcessSlot(Form.ID));
  68.         ExitProcess();
  69. }
  70.