Rev 5689 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5689 | Rev 5691 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | byte copy_to[4096]; |
1 | byte copy_to[4096]; |
2 | byte copy_from[4096]; |
2 | byte copy_from[4096]; |
3 | byte cut_active=0; |
3 | byte cut_active=0; |
Line -... | Line 4... | ||
- | 4 | ||
- | 5 | progress_bar copy_bar = {0,16,49,50,20,0,0,1,0xFFFFFF,0x00FF00,0x000000}; |
|
4 | 6 | ||
Line 5... | Line 7... | ||
5 | enum {NOCUT, CUT, COPY_PASTE_END}; |
7 | enum {NOCUT, CUT, COPY_PASTE_END}; |
Line 6... | Line 8... | ||
6 | 8 | ||
7 | Clipboard clipboard; |
9 | Clipboard clipboard; |
8 | 10 | ||
9 | void Copy(dword pcth, char cut) |
11 | void Copy(dword pcth, char cut) |
10 | { |
12 | { |
11 | dword selected_offset2; |
13 | dword selected_offset2; |
12 | byte copy_t[4096]; |
- | |
13 | dword buff_data; |
14 | byte copy_t[4096]; |
14 | int ind = 0; |
15 | dword buff_data; |
15 | 16 | int ind = 0; |
|
16 | if (selected_count) |
17 | if (selected_count) |
17 | { |
18 | { |
Line 49... | Line 50... | ||
49 | copy_stak = malloc(20000); |
50 | copy_stak = malloc(20000); |
50 | CreateThread(#PasteThread,copy_stak+20000-4); |
51 | CreateThread(#PasteThread,copy_stak+20000-4); |
51 | } |
52 | } |
52 | 53 | ||
Line -... | Line 54... | ||
- | 54 | BDVK file_info_count; |
|
- | 55 | int file_count_copy; |
|
- | 56 | ||
- | 57 | void DirFileCount(dword way) |
|
- | 58 | { |
|
- | 59 | dword dirbuf, fcount, i, filename; |
|
- | 60 | dword cur_file; |
|
- | 61 | if (isdir(way)) |
|
- | 62 | { |
|
- | 63 | cur_file = malloc(4096); |
|
- | 64 | // In the process of recursive descent, memory must be allocated dynamically, because the static memory -> was a bug !!! But unfortunately pass away to sacrifice speed. |
|
- | 65 | GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL); |
|
- | 66 | for (i=0; i |
|
- | 67 | { |
|
- | 68 | filename = i*304+dirbuf+72; |
|
- | 69 | sprintf(cur_file,"%s/%s",way,filename); |
|
- | 70 | ||
- | 71 | if (TestBit(ESDWORD[filename-40], 4) ) |
|
- | 72 | { |
|
- | 73 | file_count_copy++; |
|
- | 74 | DirFileCount(cur_file); |
|
- | 75 | } |
|
- | 76 | else |
|
- | 77 | { |
|
- | 78 | file_count_copy++; |
|
- | 79 | } |
|
- | 80 | } |
|
- | 81 | free(cur_file); |
|
- | 82 | } |
|
- | 83 | } |
|
Line 53... | Line 84... | ||
53 | 84 | ||
54 | void PasteThread() |
85 | void PasteThread() |
55 | { |
86 | { |
56 | char copy_rezult; |
87 | char copy_rezult; |
57 | int j; |
88 | int j; |
58 | int cnt = 0; |
89 | int cnt = 0; |
- | 90 | dword buf; |
|
- | 91 | file_count_copy = 0; |
|
Line 59... | Line 92... | ||
59 | dword buf; |
92 | copy_bar.value = 0; |
60 | 93 | ||
61 | buf = clipboard.GetSlotData(clipboard.GetSlotCount()-1); |
94 | buf = clipboard.GetSlotData(clipboard.GetSlotCount()-1); |
62 | if (DSDWORD[buf+4] != 3) return; |
95 | if (DSDWORD[buf+4] != 3) return; |
63 | cnt = ESINT[buf+8]; |
96 | cnt = ESINT[buf+8]; |
- | 97 | for (j = 0; j < cnt; j++) { |
|
- | 98 | strlcpy(#copy_from, j*4096+buf+10, 4096); |
|
- | 99 | GetFileInfo(#copy_from, #file_info_count); |
|
- | 100 | if ( file_info_count.isfolder ) DirFileCount(#copy_from); |
|
- | 101 | else file_count_copy++; |
|
- | 102 | } |
|
- | 103 | copy_bar.max = file_count_copy; |
|
- | 104 | DisplayCopyfForm(); |
|
64 | for (j = 0; j < cnt; j++) { |
105 | for (j = 0; j < cnt; j++) { |
65 | strlcpy(#copy_from, j*4096+buf+10, 4096); |
106 | strlcpy(#copy_from, j*4096+buf+10, 4096); |
66 | if (!copy_from) CopyExit(); |
107 | if (!copy_from) CopyExit(); |
67 | strcpy(#copy_to, #path); |
108 | strcpy(#copy_to, #path); |
68 | strcat(#copy_to, #copy_from+strrchr(#copy_from,'/')); |
109 | strcat(#copy_to, #copy_from+strrchr(#copy_from,'/')); |
Line 77... | Line 118... | ||
77 | notify("Copy directory into itself is a bad idea..."); |
118 | notify("Copy directory into itself is a bad idea..."); |
78 | CopyExit(); |
119 | CopyExit(); |
79 | } |
120 | } |
80 | 121 | ||
Line 81... | Line -... | ||
81 | copyf_Draw_Progress(#copy_from); |
- | |
82 | pause(1000); |
- | |
83 | - | ||
84 | if (copy_rezult = copyf(#copy_from,#copy_to)) |
122 | if (copy_rezult = copyf(#copy_from,#copy_to)) |
85 | { |
123 | { |
86 | Write_Error(copy_rezult); |
124 | Write_Error(copy_rezult); |
87 | } |
125 | } |
88 | else if (cut_active) |
126 | else if (cut_active) |
Line 100... | Line 138... | ||
100 | CopyExit(); |
138 | CopyExit(); |
101 | } |
139 | } |
102 | 140 | ||
Line 103... | Line 141... | ||
103 | #define WIN_COPY_W 345 |
141 | #define WIN_COPY_W 345 |
104 | #define WIN_COPY_H 80 |
142 | #define WIN_COPY_H 110 |
105 | proc_info Copy_Form; |
143 | proc_info Copy_Form; |
Line 106... | Line 144... | ||
106 | 144 | ||
107 | void DisplayCopyfForm() |
145 | void DisplayCopyfForm() |
108 | { |
146 | { |
Line 116... | Line 154... | ||
116 | case evReDraw: |
154 | case evReDraw: |
117 | DefineAndDrawWindow(Form.left+Form.width-200,Form.top+90,WIN_COPY_W,GetSkinHeight()+WIN_COPY_H,0x34,0xFFFFFF,T_PASTE_WINDOW_TITLE); |
155 | DefineAndDrawWindow(Form.left+Form.width-200,Form.top+90,WIN_COPY_W,GetSkinHeight()+WIN_COPY_H,0x34,0xFFFFFF,T_PASTE_WINDOW_TITLE); |
118 | GetProcessInfo(#Copy_Form, SelfInfo); |
156 | GetProcessInfo(#Copy_Form, SelfInfo); |
119 | WriteText(45, 11, 0x80, system.color.work_text, T_PASTE_WINDOW_TEXT); |
157 | WriteText(45, 11, 0x80, system.color.work_text, T_PASTE_WINDOW_TEXT); |
120 | DrawFlatButton(Copy_Form.cwidth - 90, Copy_Form.cheight - 32, 80, 22, 10, system.color.work_button, T_PASTE_WINDOW_BUTTON); |
158 | DrawFlatButton(Copy_Form.cwidth - 96, Copy_Form.cheight - 32, 80, 22, 10, system.color.work_button, T_PASTE_WINDOW_BUTTON); |
121 | DrawBar(8, 10, 32, 32, 0xFFFfff); |
159 | DrawBar(8, 10, 32, 32, 0xFFFfff); |
122 | break; |
160 | break; |
123 | } |
161 | } |
124 | } |
162 | } |
Line 130... | Line 168... | ||
130 | } |
168 | } |
131 | 169 | ||
Line 132... | Line 170... | ||
132 | 170 | ||
133 | void copyf_Draw_Progress(dword copying_filename) { |
171 | void copyf_Draw_Progress(dword copying_filename) { |
- | 172 | if (Copy_Form.cwidth==0) |
|
- | 173 | { |
|
- | 174 | copy_bar.value++; |
|
- | 175 | return; |
|
- | 176 | } |
|
134 | //if (Copy_Form.cwidth==0) return; |
177 | copy_bar.width = Copy_Form.cwidth-32; |
135 | DisplayCopyfForm(); |
178 | DisplayCopyfForm(); |
136 | Put_icon(copying_filename+strrchr(copying_filename,'.'), 16, 19, 0xFFFfff, 0); |
179 | Put_icon(copying_filename+strrchr(copying_filename,'.'), 16, 19, 0xFFFfff, 0); |
137 | DrawBar(45, 29, Copy_Form.cwidth-45, 10, 0xFFFFFF); |
180 | DrawBar(45, 29, Copy_Form.cwidth-45, 10, 0xFFFFFF); |
- | 181 | WriteText(45, 29, 0x80, 0x000000, copying_filename); |
|
- | 182 | progressbar_draw stdcall (#copy_bar); |
|
- | 183 | progressbar_progress stdcall (#copy_bar); |
|
- | 184 | //copy_bar.value++; |
|
138 | WriteText(45, 29, 0x80, system.color.work_text, copying_filename); |
185 | pause(100); |
139 | }> |
186 | }>> |