Rev 7804 | Rev 7972 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7804 | Rev 7878 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | byte copy_to[4096]; |
1 | //===================================================// |
2 | byte copy_from[4096]; |
2 | // // |
3 | byte cut_active=0; |
3 | // MASS ACTIONS // |
4 | - | ||
5 | enum {NOCUT, CUT}; |
4 | // // |
- | 5 | //===================================================// |
|
Line 6... | Line 6... | ||
6 | 6 | ||
7 | void setElementSelectedFlag(dword n, int state) { |
7 | void setElementSelectedFlag(dword n, int state) { |
8 | dword selected_offset = file_mas[n]*304 + buf+32 + 7; |
8 | dword selected_offset = file_mas[n]*304 + buf+32 + 7; |
9 | ESBYTE[selected_offset] = state; |
9 | ESBYTE[selected_offset] = state; |
Line 20... | Line 20... | ||
20 | dword selected_offset = file_mas[n]*304 + buf+32 + 7; |
20 | dword selected_offset = file_mas[n]*304 + buf+32 + 7; |
21 | return ESBYTE[selected_offset]; |
21 | return ESBYTE[selected_offset]; |
22 | } |
22 | } |
23 | 23 | ||
Line -... | Line 24... | ||
- | 24 | dword GetFilesCount(dword _in_path) |
|
- | 25 | { |
|
- | 26 | int j; |
|
- | 27 | BDVK file_info_count; |
|
- | 28 | DIR_SIZE paste_dir_size; |
|
- | 29 | ||
- | 30 | GetFileInfo(_in_path, #file_info_count); |
|
- | 31 | if ( file_info_count.isfolder ) { |
|
- | 32 | return paste_dir_size.get(_in_path); |
|
- | 33 | } else { |
|
- | 34 | return 1; |
|
- | 35 | } |
|
- | 36 | } |
|
- | 37 | ||
- | 38 | //===================================================// |
|
- | 39 | // // |
|
- | 40 | // COPY AND PASTE // |
|
- | 41 | // // |
|
- | 42 | //===================================================// |
|
- | 43 | byte copy_to[4096]; |
|
- | 44 | byte copy_from[4096]; |
|
- | 45 | bool cut_active = false; |
|
- | 46 | ||
- | 47 | enum {NOCUT, CUT}; |
|
- | 48 | ||
24 | void Copy(dword pcth, char cut) |
49 | void EventCopy(bool _cut_active) |
25 | { |
50 | { |
26 | byte copy_t[4096]; |
51 | byte copy_t[4096]; |
27 | dword buff_data; |
52 | dword buff_data; |
28 | dword path_len = 0; |
53 | dword path_len = 0; |
29 | dword size_buf = 0; |
54 | dword size_buf = 0; |
30 | dword copy_buf_offset = 0; |
55 | dword copy_buf_offset = 0; |
31 | dword i; |
56 | dword i; |
Line 32... | Line 57... | ||
32 | 57 | ||
Line -... | Line 58... | ||
- | 58 | if (files.count<=0) return; //no files |
|
- | 59 | ||
33 | if (files.count<=0) return; //no files |
60 | cut_active = _cut_active; |
34 | 61 | ||
35 | //if no element selected by "Insert" key, then we copy current element |
62 | //if no element selected by "Insert" key, then we copy current element |
- | 63 | if (!selected_count) { |
|
Line 36... | Line 64... | ||
36 | if (!selected_count) |
64 | setElementSelectedFlag(files.cur_y, true); |
Line 37... | Line 65... | ||
37 | setElementSelectedFlag(files.cur_y, true); |
65 | } |
38 | 66 | ||
Line 61... | Line 89... | ||
61 | } |
89 | } |
62 | } |
90 | } |
63 | if (selected_count==1) setElementSelectedFlag(files.cur_y, false); |
91 | if (selected_count==1) setElementSelectedFlag(files.cur_y, false); |
64 | Clipboard__SetSlotData(size_buf, buff_data); |
92 | Clipboard__SetSlotData(size_buf, buff_data); |
65 | cut_active = cut; |
93 | free(buff_data); |
66 | free(buff_data); |
- | |
67 | } |
94 | } |
68 | 95 | ||
Line 69... | Line -... | ||
69 | void Paste() { |
- | |
70 | copy_stak = free(copy_stak); |
- | |
71 | copy_stak = malloc(64000); |
- | |
72 | CreateThread(#PasteThread,copy_stak+64000-4); |
- | |
73 | } |
- | |
Line 74... | Line 96... | ||
74 | 96 | ||
75 | void PasteThread() |
97 | void PasteThread() |
76 | { |
98 | { |
77 | char copy_rezult; |
99 | char copy_rezult; |
78 | int j; |
100 | int j; |
79 | int paste_elements_count = 0; |
101 | int paste_elements_count = 0; |
80 | dword buf; |
102 | dword buf; |
81 | dword path_offset; |
- | |
82 | dword file_count_paste = 0; |
- | |
83 | _dir_size paste_dir_size; |
- | |
84 | BDVK file_info_count; |
- | |
85 | - | ||
Line 86... | Line 103... | ||
86 | copy_bar.value = 0; |
103 | dword path_offset; |
87 | 104 | ||
88 | buf = Clipboard__GetSlotData(Clipboard__GetSlotCount()-1); |
105 | buf = Clipboard__GetSlotData(Clipboard__GetSlotCount()-1); |
89 | if (DSDWORD[buf+4] != 3) return; |
106 | if (DSDWORD[buf+4] != 3) return; |
90 | paste_elements_count = ESINT[buf+8]; |
- | |
- | 107 | paste_elements_count = ESINT[buf+8]; |
|
91 | path_offset = buf + 10; |
108 | path_offset = buf + 10; |
92 | //calculate copy files count for progress bar |
109 | |
93 | for (j = 0; j < paste_elements_count; j++) { |
110 | if (cut_active) { |
94 | GetFileInfo(path_offset, #file_info_count); |
111 | DisplayOperationForm(MOVE_FLAG); |
95 | if ( file_info_count.isfolder ) { |
- | |
96 | paste_dir_size.get(path_offset); |
112 | } else { |
- | 113 | DisplayOperationForm(COPY_FLAG); |
|
- | 114 | } |
|
97 | file_count_paste += paste_dir_size.files; |
115 | |
98 | } |
116 | for (j = 0; j < paste_elements_count; j++) { |
99 | else file_count_paste++; |
117 | copy_bar.max += GetFilesCount(path_offset); |
100 | path_offset += strlen(path_offset) + 1; |
- | |
101 | } |
- | |
102 | copy_bar.max = file_count_paste; |
- | |
103 | - | ||
Line 104... | Line 118... | ||
104 | if (cut_active) operation_flag = MOVE_FLAG; |
118 | path_offset += strlen(path_offset) + 1; |
105 | else operation_flag = COPY_FLAG; |
- | |
106 | 119 | } |
|
107 | path_offset = buf + 10; |
120 | |
108 | DisplayOperationForm(); |
121 | path_offset = buf + 10; |
109 | for (j = 0; j < paste_elements_count; j++) { |
122 | for (j = 0; j < paste_elements_count; j++) { |
110 | strcpy(#copy_from, path_offset); |
123 | strcpy(#copy_from, path_offset); |
Line 137... | Line 150... | ||
137 | if (info_after_copy.checked) notify(INFO_AFTER_COPY); |
150 | if (info_after_copy.checked) notify(INFO_AFTER_COPY); |
138 | DialogExit(); |
151 | DialogExit(); |
139 | }>>=0)>0)> |
152 | } |
140 | 153 | ||
Line -... | Line 154... | ||
- | 154 | ||
- | 155 | //===================================================// |
|
- | 156 | // // |
|
- | 157 | // DELETE // |
|
- | 158 | // // |
|
- | 159 | //===================================================// |
|
- | 160 | ||
- | 161 | int del_error; |
|
- | 162 | int Del_File2(dword way, sh_progr) |
|
- | 163 | { |
|
- | 164 | dword dirbuf, fcount, i, filename; |
|
- | 165 | int error; |
|
- | 166 | char del_from[4096]; |
|
- | 167 | if (dir_exists(way)) |
|
- | 168 | { |
|
- | 169 | if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error; |
|
- | 170 | for (i=0; i |
|
- | 171 | { |
|
- | 172 | //if (CheckEvent()==evReDraw) draw_window(); |
|
- | 173 | filename = i*304+dirbuf+72; |
|
- | 174 | sprintf(#del_from,"%s/%s",way,filename); |
|
- | 175 | if ( TestBit(ESDWORD[filename-40], 4) ) |
|
- | 176 | { |
|
- | 177 | Del_File2(#del_from, 1); |
|
- | 178 | } |
|
- | 179 | else |
|
- | 180 | { |
|
- | 181 | if (sh_progr) Operation_Draw_Progress(filename); |
|
- | 182 | if (error = DeleteFile(#del_from)) del_error = error; |
|
- | 183 | } |
|
- | 184 | } |
|
- | 185 | } |
|
- | 186 | if (error = DeleteFile(way)) del_error = error; |
|
- | 187 | } |
|
- | 188 | ||
- | 189 | void DeleteSingleElement() |
|
- | 190 | { |
|
- | 191 | DIR_SIZE delete_dir_size; |
|
- | 192 | del_error = NULL; |
|
- | 193 | ||
- | 194 | if (itdir) { |
|
- | 195 | copy_bar.max = delete_dir_size.get(#file_path); |
|
- | 196 | } else { |
|
- | 197 | copy_bar.max = 1; |
|
- | 198 | } |
|
- | 199 | ||
- | 200 | Del_File2(#file_path, 1); |
|
- | 201 | ||
- | 202 | if (del_error) Write_Error(del_error); |
|
- | 203 | DialogExit(); |
|
- | 204 | } |
|
- | 205 | ||
- | 206 | void DeleteSelectedElements() |
|
- | 207 | { |
|
- | 208 | byte del_from[4096]; |
|
- | 209 | int i; |
|
- | 210 | ||
- | 211 | DisplayOperationForm(DELETE_FLAG); |
|
- | 212 | ||
- | 213 | if (!selected_count) { DeleteSingleElement(); return; } |
|
- | 214 | ||
- | 215 | for (i=0; i |
|
- | 216 | { |
|
- | 217 | if (getElementSelectedFlag(i) == true) { |
|
- | 218 | sprintf(#del_from,"%s/%s",#path,file_mas[i]*304+buf+72); |
|
- | 219 | copy_bar.max += GetFilesCount(#del_from); |
|
- | 220 | } |
|
- | 221 | } |
|
- | 222 | ||
- | 223 | del_error = 0; |
|
- | 224 | ||
- | 225 | for (i=0; i |
|
- | 226 | { |
|
- | 227 | if (getElementSelectedFlag(i) == true) { |
|
- | 228 | sprintf(#del_from,"%s/%s", #path, file_mas[i]*304+buf+72); |
|
- | 229 | Del_File2(#del_from, 1); |
|
- | 230 | } |
|
- | 231 | } |
|
- | 232 | ||
- | 233 | if (del_error) Write_Error(del_error); |
|
- | 234 | cmd_free = 6; |
|
- | 235 | DialogExit(); |
|
- | 236 | }>>=0)>0)> |