Rev 8826 | Rev 8868 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8826 | Rev 8861 | ||
---|---|---|---|
Line 43... | Line 43... | ||
43 | byte copy_to[4096]; |
43 | byte copy_to[4096]; |
44 | byte copy_from[4096]; |
44 | byte copy_from[4096]; |
45 | bool cut_active = false; |
45 | bool cut_active = false; |
46 | 46 | ||
Line 47... | Line 47... | ||
47 | enum {NOCUT, CUT}; |
47 | enum {COPY, CUT, DELETE}; |
Line 48... | Line 48... | ||
48 | 48 | ||
49 | void EventCopy(bool _cut_active) |
49 | void CopyFilesListToClipboard(bool _cut_active) |
50 | { |
50 | { |
51 | byte copy_t[4096]; |
51 | byte copy_t[4096]; |
52 | dword buff_data; |
52 | dword buff_data; |
53 | dword path_len = 0; |
53 | dword path_len = 0; |
54 | dword size_buf = 0; |
54 | dword size_buf = 0; |
55 | dword copy_buf_offset = 0; |
55 | dword copy_buf_offset = 0; |
Line 56... | Line 56... | ||
56 | dword i; |
56 | dword i; |
Line 57... | Line 57... | ||
57 | 57 | ||
Line 58... | Line 58... | ||
58 | if (files.count<=0) return; //no files |
58 | if (files.count<=0) return; //no files |
59 | 59 | ||
60 | cut_active = _cut_active; |
60 | if (cut_active!=DELETE) cut_active = _cut_active; |
61 | 61 | ||
Line 86... | Line 86... | ||
86 | if (getElementSelectedFlag(i) == true) { |
86 | if (getElementSelectedFlag(i) == true) { |
87 | sprintf(copy_buf_offset,"%s/%s",#path,items.get(i)*304+buf+72); |
87 | sprintf(copy_buf_offset,"%s/%s",#path,items.get(i)*304+buf+72); |
88 | copy_buf_offset += strlen(copy_buf_offset) + 1; |
88 | copy_buf_offset += strlen(copy_buf_offset) + 1; |
89 | 89 | ||
Line 90... | Line -... | ||
90 | //setElementSelectedFlag(i, false); |
- | |
91 | - | ||
92 | if (cut_active) { |
90 | if (cut_active) { |
93 | if (i>=files.first) && (i |
91 | if (i>=files.first) && (i |
94 | PutShadow(files.x+4,i-files.first*files.item_h+files.y,16,files.item_h,1,-3); |
92 | PutShadow(files.x+4,i-files.first*files.item_h+files.y,16,files.item_h,1,-3); |
95 | } |
93 | } |
96 | } |
94 | } |
Line 136... | Line 134... | ||
136 | RenameMove(#copy_to+i, path_offset); |
134 | RenameMove(#copy_to+i, path_offset); |
137 | if (EAX!=0) goto _DIFFERENT_DRIVES; |
135 | if (EAX!=0) goto _DIFFERENT_DRIVES; |
138 | path_offset += strlen(path_offset) + 1; |
136 | path_offset += strlen(path_offset) + 1; |
139 | } |
137 | } |
140 | cut_active=false; |
138 | DialogExit(); |
141 | DialogExit(); |
- | |
142 | } |
139 | } |
143 | 140 | ||
Line 144... | Line 141... | ||
144 | _DIFFERENT_DRIVES: |
141 | _DIFFERENT_DRIVES: |
145 | path_offset = buf + 10; |
142 | path_offset = buf + 10; |
Line 159... | Line 156... | ||
159 | sprintf(#copy_to, "%s/NEW_%s", #path, #copy_from+strrchr(#copy_from,'/')); |
156 | sprintf(#copy_to, "%s/NEW_%s", #path, #copy_from+strrchr(#copy_from,'/')); |
160 | } |
157 | } |
161 | if (strstr(#copy_to, #copy_from)) |
158 | if (strstr(#copy_to, #copy_from)) |
162 | { |
159 | { |
163 | notify("Copy directory into itself is a bad idea..."); |
160 | notify("'Not possible to copy directory into itself.\nProcess terminated.' -E"); |
164 | DialogExit(); |
161 | DialogExit(); |
165 | } |
162 | } |
166 | 163 | ||
Line 167... | Line 164... | ||
167 | if (copy_rezult = copyf(#copy_from,#copy_to)) |
164 | if (copy_rezult = copyf(#copy_from,#copy_to)) |
168 | { |
165 | { |
Line 171... | Line 168... | ||
171 | } |
168 | } |
172 | else if (cut_active) |
169 | else if (cut_active) |
173 | { |
170 | { |
174 | strcpy(#file_path, #copy_from); |
171 | strcpy(#file_path, #copy_from); |
175 | Del_File2(#copy_from, 0); |
172 | RecursiveDelete(#copy_from, false); |
176 | 173 | ||
Line 177... | Line 174... | ||
177 | } |
174 | } |
178 | path_offset += strlen(path_offset) + 1; |
175 | path_offset += strlen(path_offset) + 1; |
179 | } |
176 | } |
180 | cut_active=false; |
- | |
181 | DialogExit(); |
177 | DialogExit(); |
182 | } |
178 | } |
Line 183... | Line 179... | ||
183 | 179 | ||
Line 188... | Line 184... | ||
188 | // // |
184 | // // |
189 | //===================================================// |
185 | //===================================================// |
190 | 186 | ||
Line 191... | Line 187... | ||
191 | int del_error; |
187 | int del_error; |
192 | int Del_File2(dword way, sh_progr) |
188 | int RecursiveDelete(dword way, bool show_progress) |
193 | { |
189 | { |
194 | dword dirbuf, fcount, i, filename; |
190 | dword dirbuf, fcount, i, filename; |
195 | int error; |
191 | int error; |
196 | char del_from[4096]; |
192 | char del_from[4096]; |
197 | if (dir_exists(way)) |
193 | if (dir_exists(way)) |
Line 203... | Line 199... | ||
203 | filename = i*304+dirbuf+72; |
199 | filename = i*304+dirbuf+72; |
204 | sprintf(#del_from,"%s/%s",way,filename); |
200 | sprintf(#del_from,"%s/%s",way,filename); |
205 | if ( TestBit(ESDWORD[filename-40], 4) ) |
201 | if ( TestBit(ESDWORD[filename-40], 4) ) |
206 | { |
202 | { |
207 | Del_File2(#del_from, 1); |
203 | RecursiveDelete(#del_from, true); |
208 | } |
204 | } |
209 | else |
205 | else |
210 | { |
206 | { |
211 | if (sh_progr) Operation_Draw_Progress(filename); |
207 | if (show_progress) Operation_Draw_Progress(filename); |
212 | if (error = DeleteFile(#del_from)) del_error = error; |
208 | if (error = DeleteFile(#del_from)) del_error = error; |
213 | } |
209 | } |
214 | } |
210 | } |
215 | } |
211 | } |
216 | if (error = DeleteFile(way)) del_error = error; |
212 | if (error = DeleteFile(way)) del_error = error; |
217 | } |
213 | } |
218 | 214 | ||
Line 219... | Line 215... | ||
219 | void DeleteSingleElement() |
215 | void DeleteThread() |
220 | { |
216 | { |
221 | DIR_SIZE delete_dir_size; |
- | |
222 | del_error = NULL; |
- | |
223 | - | ||
224 | if (itdir) { |
- | |
225 | copy_bar.max = delete_dir_size.get(#file_path); |
- | |
226 | } else { |
217 | int j; |
227 | copy_bar.max = 1; |
- | |
228 | } |
- | |
229 | - | ||
230 | Del_File2(#file_path, 1); |
218 | int elements_count = 0; |
231 | - | ||
232 | if (del_error) Write_Error(del_error); |
- | |
233 | DialogExit(); |
219 | dword buf; |
234 | } |
- | |
235 | - | ||
236 | void DeleteSelectedElements() |
- | |
237 | { |
- | |
238 | byte del_from[4096]; |
220 | dword path_offset; |
239 | int i; |
- | |
Line 240... | Line 221... | ||
240 | 221 | ||
Line 241... | Line 222... | ||
241 | DisplayOperationForm(DELETE_FLAG); |
222 | DisplayOperationForm(DELETE_FLAG); |
- | 223 | ||
- | 224 | buf = Clipboard__GetSlotData(Clipboard__GetSlotCount()-1); |
|
- | 225 | Clipboard__DeleteLastSlot(); |
|
Line 242... | Line 226... | ||
242 | 226 | if (DSDWORD[buf+4] != 3) return; |
|
243 | if (!selected_count) { DeleteSingleElement(); return; } |
- | |
244 | 227 | elements_count = ESINT[buf+8]; |
|
245 | for (i=0; i |
228 | |
246 | { |
229 | path_offset = buf + 10; |
247 | if (getElementSelectedFlag(i) == true) { |
- | |
248 | sprintf(#del_from,"%s/%s",#path,items.get(i)*304+buf+72); |
230 | for (j = 0; j < elements_count; j++) { |
Line 249... | Line 231... | ||
249 | copy_bar.max += GetFilesCount(#del_from); |
231 | copy_bar.max += GetFilesCount(path_offset); |
250 | } |
- | |
251 | } |
232 | path_offset += strlen(path_offset) + 1; |
252 | - | ||
253 | del_error = 0; |
233 | } |
254 | - | ||
255 | for (i=0; i |
234 | |
256 | { |
- | |
257 | if (getElementSelectedFlag(i) == true) { |
235 | path_offset = buf + 10; |
258 | sprintf(#del_from,"%s/%s", #path, items.get(i)*304+buf+72); |
- | |
259 | Del_File2(#del_from, 1); |
236 | for (j = 0; j < elements_count; j++) { |
260 | } |
- | |
261 | } |
237 | RecursiveDelete(path_offset, true); |
262 | 238 | path_offset += strlen(path_offset) + 1; |