Subversion Repositories Kolibri OS

Rev

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

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