Subversion Repositories Kolibri OS

Rev

Rev 4896 | 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.  
  6. enum {NOCUT, CUT, COPY_PASTE_END};
  7.  
  8. Clipboard clipboard;
  9.  
  10. void Copy(dword pcth, char cut)
  11. {
  12.         dword selected_offset2;
  13.         byte copy_t[4096];
  14.         int cont = 0;
  15.         dword buff_data;
  16.         int ind = 0;
  17.        
  18.         for (i=0; i<files.count; i++)
  19.         {
  20.                 selected_offset2 = file_mas[i]*304 + buf+32 + 7;
  21.                 if (ESBYTE[selected_offset2]) cont++;
  22.         }
  23.         buff_data = malloc(cont*4096+10);
  24.         ESDWORD[buff_data] = cont*4096+10;
  25.         ESDWORD[buff_data+4] = 3;
  26.         ESINT[buff_data+8] = cont;
  27.         for (i=0; i<files.count; i++)
  28.         {
  29.                 selected_offset2 = file_mas[i]*304 + buf+32 + 7;
  30.                 if (ESBYTE[selected_offset2]) {
  31.                         strcpy(#copy_t, #path);
  32.                         strcat(#copy_t, file_mas[i]*304+buf+72);
  33.                        
  34.                         strlcpy(ind*4096+buff_data+10, #copy_t, 4096);
  35.                         ind++;
  36.                 }
  37.         }
  38.         clipboard.SetSlotData(cont*4096+10, buff_data);
  39.         cut_active = cut;
  40. }
  41.  
  42. void copyf_Draw_Progress(dword filename) {
  43.         #define WIN_W 300
  44.         #define WIN_H 50
  45.         DefineAndDrawWindow(Form.left+Form.width-200,Form.top+90,WIN_W,GetSkinHeight()+WIN_H-1,0x34,sc.work,T_PASTE_WINDOW);
  46.         WriteText(5,8, 0x80, sc.work_text, T_PASTE_WINDOW_TEXT);
  47.         DrawBar(5, 26, WIN_W-10, 10, sc.work);
  48.         WriteText(5,26, 0x80, sc.work_text, filename);
  49.         if (CheckEvent()==evButton)
  50.         {
  51.                 notify(T_CANCEL_PASTE);
  52.                 CopyExit();
  53.         }
  54. }
  55.  
  56. void Paste()
  57. {
  58.         char copy_rezult;
  59.         byte copy_from[4096];
  60.         int j;
  61.         int cnt = 0;
  62.         dword buf;
  63.        
  64.         buf = clipboard.GetSlotData(clipboard.GetSlotCount()-1);
  65.         if (DSDWORD[buf+4] != 3) return;
  66.         cnt = ESINT[buf+8];
  67.         for (j = 0; j < cnt; j++) {
  68.                 strlcpy(#copy_from, j*4096+buf+10, 4096);
  69.                 if (!copy_from) CopyExit();
  70.                 strcpy(#copy_to, #path);
  71.                 strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
  72.                 if (!strcmp(#copy_from,#copy_to))
  73.                 {
  74.                         strcpy(#copy_to, #path);
  75.                         strcat(#copy_to, "new_");
  76.                         strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
  77.                 }
  78.                 if (strstr(#copy_to, #copy_from))
  79.                 {
  80.                         notify("Copy directory into itself is a bad idea...");
  81.                         CopyExit();
  82.                 }
  83.                 if (copy_rezult = copyf(#copy_from,#copy_to))
  84.                 {
  85.                         Write_Error(copy_rezult);
  86.                 }
  87.        
  88.                 else if (cut_active)
  89.                 {
  90.                         strcpy(#file_path, #copy_from);
  91.                         Del_File(true);
  92.                        
  93.                 }
  94.         }
  95.         if (cut_active)
  96.         {
  97.                 cut_active=false;
  98.         }
  99.         //mark_default();
  100.         CopyExit();
  101. }
  102.  
  103. void CopyExit()
  104. {
  105.         action_buf = COPY_PASTE_END;
  106.         ActivateWindow(GetProcessSlot(Form.ID));
  107.         ExitProcess();
  108. }