Rev 8947 | Rev 8956 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5447 | punk_joker | 1 | #ifdef LANG_RUS |
5451 | leency | 2 | ?define WINDOW_TITLE_PROPERTIES "Свойства" |
7593 | leency | 3 | ?define T_CLOSE "Закрыть" |
4 | ?define T_APPLY "Применить" |
||
5688 | punk_joker | 5 | ?define QUEST_1 "Применить ко всем вложенным" |
6278 | leency | 6 | ?define QUEST_2 "файлам и папкам?" |
5457 | leency | 7 | ?define PR_T_NAME "Имя:" |
8 | ?define PR_T_DEST "Расположение:" |
||
9 | ?define PR_T_SIZE "Размер:" |
||
5962 | leency | 10 | ?define CREATED_OPENED_MODIFIED "Создан:\nОткрыт:\nИзменен:" |
5447 | punk_joker | 11 | ?define SET_6 "Файлов: " |
12 | ?define SET_7 " Папок: " |
||
5457 | leency | 13 | ?define PR_T_CONTAINS "Содержит: " |
5450 | leency | 14 | ?define FLAGS " Аттрибуты " |
5457 | leency | 15 | ?define PR_T_HIDDEN "Скрытый" |
16 | ?define PR_T_SYSTEM "Системный" |
||
17 | ?define PR_T_ONLY_READ "Только чтение" |
||
5591 | pavelyakov | 18 | ?define SET_BYTE_LANG "байт" |
5833 | pavelyakov | 19 | #else // Apply to all subfolders |
6281 | punk_joker | 20 | ?define WINDOW_TITLE_PROPERTIES "Properties" |
7593 | leency | 21 | ?define T_CLOSE "Close" |
22 | ?define T_APPLY "Apply" |
||
5833 | pavelyakov | 23 | ?define QUEST_1 "Apply to all subfolders" |
6278 | leency | 24 | ?define QUEST_2 "files and Folders?" |
5457 | leency | 25 | ?define PR_T_NAME "Name:" |
26 | ?define PR_T_DEST "Destination:" |
||
27 | ?define PR_T_SIZE "Size:" |
||
5962 | leency | 28 | ?define CREATED_OPENED_MODIFIED "Created:\nOpened:\nModified:" |
5450 | leency | 29 | ?define SET_6 "Files: " |
30 | ?define SET_7 " Folders: " |
||
5457 | leency | 31 | ?define PR_T_CONTAINS "Contains: " |
5450 | leency | 32 | ?define FLAGS " Attributes " |
5457 | leency | 33 | ?define PR_T_HIDDEN "Hidden" |
34 | ?define PR_T_SYSTEM "System" |
||
35 | ?define PR_T_ONLY_READ "Read-only" |
||
5591 | pavelyakov | 36 | ?define SET_BYTE_LANG "byte" |
5447 | punk_joker | 37 | #endif |
38 | |||
7593 | leency | 39 | #define B_SETINGS_APPLY_SUBFOLDER 301 |
40 | #define B_SETINGS_APPLY_NO_SUBFOLDER 302 |
||
41 | #define B_APPLY 11 |
||
42 | #define B_CLOSE 12 |
||
43 | |||
7041 | leency | 44 | char path_to_file[4096]; |
45 | char file_name2[4096]; |
||
7506 | leency | 46 | edit_box file_name_ed = {230,59,32,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(file_name2)-2,#file_name2,NULL, 0b,2,2}; |
47 | edit_box path_to_file_ed = {160,120,79,0xffffff,0x94AECE,0xFFFfff,0xffffff,2,sizeof(path_to_file)-2,#path_to_file,NULL, 0b,2,2}; |
||
5447 | punk_joker | 48 | |
5463 | leency | 49 | BDVK file_info_general; |
50 | BDVK file_info_dirsize; |
||
5447 | punk_joker | 51 | |
7593 | leency | 52 | bool apply_question_active; |
5688 | punk_joker | 53 | |
7878 | leency | 54 | DIR_SIZE more_files_count; |
55 | DIR_SIZE dir_size; |
||
7369 | leency | 56 | |
7244 | leency | 57 | checkbox ch_read_only = { PR_T_ONLY_READ, NULL }; |
58 | checkbox ch_hidden = { PR_T_HIDDEN, NULL }; |
||
59 | checkbox ch_system = { PR_T_SYSTEM, NULL }; |
||
60 | |||
61 | void SetPropertiesFile(dword cur_file, bdvk_pointer) |
||
62 | { |
||
63 | GetFileInfo(cur_file, bdvk_pointer); |
||
64 | ESI = bdvk_pointer; |
||
65 | ESI.BDVK.readonly = ch_read_only.checked; |
||
66 | ESI.BDVK.hidden = ch_hidden.checked; |
||
67 | ESI.BDVK.system = ch_system.checked; |
||
68 | SetFileInfo(cur_file, bdvk_pointer); |
||
69 | } |
||
70 | |||
5688 | punk_joker | 71 | void SetPropertiesDir(dword way) |
5554 | punk_joker | 72 | { |
5688 | punk_joker | 73 | dword dirbuf, fcount, i, filename; |
74 | dword cur_file; |
||
6251 | leency | 75 | if (dir_exists(way)) |
5688 | punk_joker | 76 | { |
77 | cur_file = malloc(4096); |
||
78 | GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL); |
||
79 | for (i=0; i |
||
80 | { |
||
81 | filename = i*304+dirbuf+72; |
||
82 | strcpy(cur_file, way); |
||
83 | chrcat(cur_file, '/'); |
||
84 | strcat(cur_file, filename); |
||
8944 | leency | 85 | if ( ESDWORD[filename-40] & ATR_FOLDER ) |
5688 | punk_joker | 86 | { |
87 | SetPropertiesDir(cur_file); |
||
88 | } |
||
7244 | leency | 89 | SetPropertiesFile(cur_file, #file_info_dirsize); |
5688 | punk_joker | 90 | } |
91 | free(cur_file); |
||
92 | } |
||
93 | } |
||
94 | |||
7593 | leency | 95 | #define SET_PROPERTIES_SINGLE_FILE 0 |
96 | #define SET_PROPERTIES_NO_SUBFOLDER 1 |
||
97 | #define SET_PROPERTIES_ALL_SUBFOLDER 2 |
||
98 | void SetProperties(int mode) |
||
5688 | punk_joker | 99 | { |
7593 | leency | 100 | char pcur_file[4096]; |
7422 | leency | 101 | dword i; |
5688 | punk_joker | 102 | |
7593 | leency | 103 | apply_question_active=false; |
104 | |||
105 | if (SET_PROPERTIES_SINGLE_FILE == mode) { |
||
106 | SetPropertiesFile(#file_path, #file_info_general); |
||
107 | } |
||
108 | |||
109 | if (SET_PROPERTIES_ALL_SUBFOLDER == mode) |
||
110 | || (SET_PROPERTIES_NO_SUBFOLDER == mode) |
||
5688 | punk_joker | 111 | { |
112 | if (selected_count) |
||
113 | { |
||
114 | for (i=0; i |
||
115 | { |
||
6646 | leency | 116 | if (getElementSelectedFlag(i) == true) |
5688 | punk_joker | 117 | { |
8949 | leency | 118 | sprintf(#pcur_file,"%s/%s",path,items.get(i)*304+buf+72); |
7593 | leency | 119 | SetPropertiesFile(#pcur_file, #file_info_general); |
120 | if (SET_PROPERTIES_ALL_SUBFOLDER == mode) { |
||
121 | if (dir_exists(#pcur_file)) SetPropertiesDir(#pcur_file); |
||
5688 | punk_joker | 122 | } |
123 | } |
||
124 | } |
||
125 | } |
||
126 | else |
||
127 | { |
||
7244 | leency | 128 | SetPropertiesFile(#file_path, #file_info_general); |
7593 | leency | 129 | if (SET_PROPERTIES_ALL_SUBFOLDER == mode) SetPropertiesDir(#file_path); |
5688 | punk_joker | 130 | } |
131 | } |
||
7593 | leency | 132 | |
5688 | punk_joker | 133 | cmd_free=3; |
8949 | leency | 134 | Open_Dir(path,ONLY_OPEN); |
5688 | punk_joker | 135 | ExitProcess(); |
5554 | punk_joker | 136 | } |
5487 | leency | 137 | |
6278 | leency | 138 | void ShowConfirmQuestionPopin() |
5688 | punk_joker | 139 | { |
7593 | leency | 140 | apply_question_active = 1; |
7806 | leency | 141 | DrawPopup(15,80,250,90,1,sc.work, sc.work_graph); |
6280 | punk_joker | 142 | WriteText(35, 102, 0x90, 0x000000, QUEST_1); |
143 | WriteText(65, 117, 0x90, 0x000000, QUEST_2); |
||
7593 | leency | 144 | DrawStandartCaptButton(62,138,B_SETINGS_APPLY_SUBFOLDER,T_YES); |
145 | DrawStandartCaptButton(155,138,B_SETINGS_APPLY_NO_SUBFOLDER,T_NO); |
||
5688 | punk_joker | 146 | } |
147 | |||
5510 | punk_joker | 148 | void GetSizeMoreFiles(dword way) |
149 | { |
||
150 | char cur_file[4096]; |
||
7422 | leency | 151 | dword i; |
5957 | punk_joker | 152 | |
5510 | punk_joker | 153 | for (i=0; i |
6646 | leency | 154 | { |
155 | if (getElementSelectedFlag(i) == true) |
||
156 | { |
||
7972 | leency | 157 | sprintf(#cur_file,"%s/%s",way,items.get(i)*304+buf+72); |
8944 | leency | 158 | if (ESDWORD[items.get(i)*304+buf+32] & ATR_FOLDER ) |
5510 | punk_joker | 159 | { |
7369 | leency | 160 | more_files_count.calculate_loop(#cur_file); |
161 | more_files_count.folders++; |
||
5510 | punk_joker | 162 | } |
163 | else |
||
164 | { |
||
5957 | punk_joker | 165 | GetFileInfo(#cur_file, #file_info_dirsize); |
7369 | leency | 166 | more_files_count.bytes += file_info_dirsize.sizelo; |
167 | more_files_count.files++; |
||
5510 | punk_joker | 168 | } |
6646 | leency | 169 | } |
5510 | punk_joker | 170 | } |
171 | } |
||
172 | |||
5447 | punk_joker | 173 | void properties_dialog() |
174 | { |
||
7244 | leency | 175 | int id; |
5447 | punk_joker | 176 | |
5688 | punk_joker | 177 | if (selected_count) |
178 | { |
||
7369 | leency | 179 | more_files_count.get(NULL); |
8949 | leency | 180 | GetSizeMoreFiles(path); |
7244 | leency | 181 | ch_read_only.checked = 0; |
182 | ch_hidden.checked = 0; |
||
183 | ch_system.checked = 0; |
||
5688 | punk_joker | 184 | } |
5510 | punk_joker | 185 | else |
186 | { |
||
187 | GetFileInfo(#file_path, #file_info_general); |
||
8336 | leency | 188 | edit_box_set_text stdcall (#file_name_ed, #file_name); |
7369 | leency | 189 | if(itdir) dir_size.get(#file_path); |
7244 | leency | 190 | ch_read_only.checked = file_info_general.readonly; |
191 | ch_hidden.checked = file_info_general.hidden; |
||
192 | ch_system.checked = file_info_general.system; |
||
5510 | punk_joker | 193 | } |
8949 | leency | 194 | edit_box_set_text stdcall (#path_to_file_ed, path); |
5447 | punk_joker | 195 | |
7227 | leency | 196 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
5447 | punk_joker | 197 | loop() switch(WaitEvent()) |
198 | { |
||
199 | case evButton: |
||
200 | id=GetButtonID(); |
||
7244 | leency | 201 | ch_read_only.click(id); |
202 | ch_hidden.click(id); |
||
203 | ch_system.click(id); |
||
7593 | leency | 204 | if (apply_question_active) |
5688 | punk_joker | 205 | { |
7593 | leency | 206 | IF (id==B_SETINGS_APPLY_SUBFOLDER) |
207 | SetProperties(SET_PROPERTIES_ALL_SUBFOLDER); |
||
208 | IF (id==B_SETINGS_APPLY_NO_SUBFOLDER) |
||
209 | SetProperties(SET_PROPERTIES_NO_SUBFOLDER); |
||
5688 | punk_joker | 210 | break; |
211 | } |
||
7593 | leency | 212 | if (id==1) || (id==B_CLOSE) |
5591 | pavelyakov | 213 | { |
214 | cmd_free=3; |
||
215 | ExitProcess(); |
||
216 | } |
||
7593 | leency | 217 | if (id==B_APPLY) EventApplyProperties(); |
5447 | punk_joker | 218 | break; |
219 | |||
220 | case evMouse: |
||
221 | edit_box_mouse stdcall (#file_name_ed); |
||
222 | edit_box_mouse stdcall (#path_to_file_ed); |
||
223 | break; |
||
224 | |||
225 | case evKey: |
||
5707 | leency | 226 | GetKeys(); |
7593 | leency | 227 | |
228 | if (apply_question_active) |
||
5688 | punk_joker | 229 | { |
7593 | leency | 230 | IF (key_scancode==SCAN_CODE_ENTER) |
231 | SetProperties(SET_PROPERTIES_ALL_SUBFOLDER); |
||
232 | IF (key_scancode==SCAN_CODE_ESC) |
||
233 | SetProperties(SET_PROPERTIES_NO_SUBFOLDER); |
||
5688 | punk_joker | 234 | break; |
235 | } |
||
7593 | leency | 236 | |
237 | switch(key_scancode) |
||
5591 | pavelyakov | 238 | { |
7593 | leency | 239 | case SCAN_CODE_ESC: |
240 | cmd_free=3; |
||
241 | ExitProcess(); |
||
242 | break; |
||
243 | |||
244 | case SCAN_CODE_ENTER: |
||
245 | EventApplyProperties(); |
||
246 | break; |
||
247 | |||
7914 | leency | 248 | case SCAN_CODE_KEY_A: |
249 | case SCAN_CODE_KEY_C: |
||
7605 | leency | 250 | if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) { |
251 | EAX = key_editbox; |
||
252 | edit_box_key stdcall(#file_name_ed); |
||
253 | edit_box_key stdcall(#path_to_file_ed); |
||
254 | } |
||
5591 | pavelyakov | 255 | } |
5447 | punk_joker | 256 | break; |
257 | |||
258 | case evReDraw: |
||
5688 | punk_joker | 259 | DrawPropertiesWindow(); |
260 | } |
||
261 | } |
||
5450 | leency | 262 | |
5688 | punk_joker | 263 | void DrawPropertiesWindow() |
264 | { |
||
7593 | leency | 265 | proc_info pform; |
7369 | leency | 266 | char element_size_label[32]; |
267 | char folder_info[200]; |
||
6757 | leency | 268 | dword ext1; |
7369 | leency | 269 | dword element_size; |
7244 | leency | 270 | incn y; |
6757 | leency | 271 | char temp_path[sizeof(file_path)]; |
7806 | leency | 272 | DefineAndDrawWindow(Form.left + 150,150,315,360+skin_height,0x34,sc.work,WINDOW_TITLE_PROPERTIES,0); |
7593 | leency | 273 | GetProcessInfo(#pform, SelfInfo); |
7041 | leency | 274 | |
7593 | leency | 275 | DrawStandartCaptButton(pform.cwidth - 96, pform.cheight-34, B_CLOSE, T_CLOSE); |
276 | DrawStandartCaptButton(pform.cwidth -208, pform.cheight-34, B_APPLY, T_APPLY); |
||
5688 | punk_joker | 277 | |
7806 | leency | 278 | WriteText(10, 78, 0x90, sc.work_text, PR_T_DEST); |
7041 | leency | 279 | edit_box_draw stdcall (#path_to_file_ed); |
280 | |||
7806 | leency | 281 | WriteText(10, 97, 0x90, sc.work_text, PR_T_SIZE); |
7041 | leency | 282 | |
283 | if (selected_count) |
||
6403 | punk_joker | 284 | { |
7086 | leency | 285 | PropertiesDrawIcon(NULL, " |
7369 | leency | 286 | sprintf(#folder_info,"%s%d%s%d",SET_6,more_files_count.files,SET_7,more_files_count.folders); |
7806 | leency | 287 | WriteText(file_name_ed.left+4, 30, 0x90, sc.work_text, #folder_info); |
7369 | leency | 288 | sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(more_files_count.bytes, NULL),more_files_count.bytes,SET_BYTE_LANG); |
7806 | leency | 289 | WriteText(120, 97, 0x90, sc.work_text, #element_size_label); |
7041 | leency | 290 | } |
291 | else |
||
292 | { |
||
293 | if ( file_info_general.isfolder ) |
||
294 | PropertiesDrawIcon(NULL, " |
||
295 | else { |
||
8949 | leency | 296 | sprintf(#temp_path,"%s/%s",path,#file_name2); |
7041 | leency | 297 | ext1 = strrchr(#file_name2,'.'); |
298 | if (ext1) ext1 += #file_name2; |
||
299 | PropertiesDrawIcon(#temp_path, ext1); |
||
300 | } |
||
7806 | leency | 301 | WriteText(file_name_ed.left, file_name_ed.top-15, 0x80, sc.work_text, PR_T_NAME); |
7227 | leency | 302 | DrawEditBox(#file_name_ed); |
5688 | punk_joker | 303 | |
7041 | leency | 304 | if (!itdir) element_size = file_info_general.sizelo; |
305 | else |
||
5688 | punk_joker | 306 | { |
7806 | leency | 307 | WriteText(10,116, 0x90, sc.work_text, PR_T_CONTAINS); |
7369 | leency | 308 | sprintf(#folder_info,"%s%d%s%d",SET_6,dir_size.files,SET_7,dir_size.folders); |
7806 | leency | 309 | WriteText(120, 116, 0x90, sc.work_text, #folder_info); |
7369 | leency | 310 | element_size = dir_size.bytes; |
5688 | punk_joker | 311 | } |
7806 | leency | 312 | WriteTextLines(10, 136, 0x90, sc.work_text, CREATED_OPENED_MODIFIED, 20); |
313 | DrawDate(120, 136, sc.work_text, #file_info_general.datecreate); |
||
314 | DrawDate(120, 156, sc.work_text, #file_info_general.datelastaccess); |
||
315 | DrawDate(120, 176, sc.work_text, #file_info_general.datelastedit); |
||
7041 | leency | 316 | |
317 | sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(element_size, NULL),element_size,SET_BYTE_LANG); |
||
7806 | leency | 318 | WriteText(120, 99, 0x90, sc.work_text, #element_size_label); |
5447 | punk_joker | 319 | } |
7593 | leency | 320 | DrawFrame(10, 212, -10*2 + pform.cwidth - 2, 92, FLAGS); |
7244 | leency | 321 | y.n = 212; //212 => attributes_frame.y |
322 | ch_read_only.draw(24, y.inc(18)); |
||
323 | ch_hidden.draw(24, y.inc(24)); |
||
324 | ch_system.draw(24, y.inc(24)); |
||
7593 | leency | 325 | if (apply_question_active) ShowConfirmQuestionPopin(); |
5463 | leency | 326 | } |
327 | |||
7041 | leency | 328 | void PropertiesDrawIcon(dword file_path, extension) |
329 | { |
||
7227 | leency | 330 | #define ICON_PADDING 11 |
331 | DrawBar(20-ICON_PADDING, 30-ICON_PADDING-1, ICON_PADDING*2+16, ICON_PADDING*2+16, 0xFFFfff); |
||
7425 | leency | 332 | DrawIconByExtension(file_path, extension, -icon_size/2+28, -icon_size/2+38, 0xFFFfff); |
7041 | leency | 333 | } |
7593 | leency | 334 | |
335 | void EventApplyProperties() |
||
336 | { |
||
337 | if (selected_count) || (itdir) { |
||
338 | ShowConfirmQuestionPopin(); |
||
339 | } else { |
||
340 | SetProperties(SET_PROPERTIES_SINGLE_FILE); |
||
341 | } |
||
342 | } |