Rev 7806 | Rev 7914 | 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); |
||
85 | if ( TestBit(ESDWORD[filename-40], 4) ) |
||
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 | { |
7593 | leency | 118 | sprintf(#pcur_file,"%s/%s",#path,file_mas[i]*304+buf+72); |
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; |
134 | _not_draw = true; |
||
6646 | leency | 135 | Open_Dir(#path,WITH_REDRAW); |
136 | _not_draw = false; |
||
137 | EventRedrawWindow(Form.left,Form.top); |
||
5688 | punk_joker | 138 | ExitProcess(); |
5554 | punk_joker | 139 | } |
5487 | leency | 140 | |
6278 | leency | 141 | void ShowConfirmQuestionPopin() |
5688 | punk_joker | 142 | { |
7593 | leency | 143 | apply_question_active = 1; |
7806 | leency | 144 | DrawPopup(15,80,250,90,1,sc.work, sc.work_graph); |
6280 | punk_joker | 145 | WriteText(35, 102, 0x90, 0x000000, QUEST_1); |
146 | WriteText(65, 117, 0x90, 0x000000, QUEST_2); |
||
7593 | leency | 147 | DrawStandartCaptButton(62,138,B_SETINGS_APPLY_SUBFOLDER,T_YES); |
148 | DrawStandartCaptButton(155,138,B_SETINGS_APPLY_NO_SUBFOLDER,T_NO); |
||
5688 | punk_joker | 149 | } |
150 | |||
5510 | punk_joker | 151 | void GetSizeMoreFiles(dword way) |
152 | { |
||
153 | char cur_file[4096]; |
||
7422 | leency | 154 | dword i; |
5957 | punk_joker | 155 | |
5510 | punk_joker | 156 | for (i=0; i |
6646 | leency | 157 | { |
158 | if (getElementSelectedFlag(i) == true) |
||
159 | { |
||
6635 | leency | 160 | sprintf(#cur_file,"%s/%s",way,file_mas[i]*304+buf+72); |
5691 | punk_joker | 161 | if (TestBit(ESDWORD[file_mas[i]*304+buf+32], 4) ) |
5510 | punk_joker | 162 | { |
7369 | leency | 163 | more_files_count.calculate_loop(#cur_file); |
164 | more_files_count.folders++; |
||
5510 | punk_joker | 165 | } |
166 | else |
||
167 | { |
||
5957 | punk_joker | 168 | GetFileInfo(#cur_file, #file_info_dirsize); |
7369 | leency | 169 | more_files_count.bytes += file_info_dirsize.sizelo; |
170 | more_files_count.files++; |
||
5510 | punk_joker | 171 | } |
6646 | leency | 172 | } |
5510 | punk_joker | 173 | } |
174 | } |
||
175 | |||
5447 | punk_joker | 176 | void properties_dialog() |
177 | { |
||
7244 | leency | 178 | int id; |
5447 | punk_joker | 179 | |
5688 | punk_joker | 180 | if (selected_count) |
181 | { |
||
7369 | leency | 182 | more_files_count.get(NULL); |
5688 | punk_joker | 183 | GetSizeMoreFiles(#path); |
7244 | leency | 184 | ch_read_only.checked = 0; |
185 | ch_hidden.checked = 0; |
||
186 | ch_system.checked = 0; |
||
5688 | punk_joker | 187 | } |
5510 | punk_joker | 188 | else |
189 | { |
||
190 | GetFileInfo(#file_path, #file_info_general); |
||
191 | strcpy(#file_name2, #file_name); |
||
7506 | leency | 192 | EditBox_UpdateText(#file_name_ed, 0); |
7369 | leency | 193 | if(itdir) dir_size.get(#file_path); |
7244 | leency | 194 | ch_read_only.checked = file_info_general.readonly; |
195 | ch_hidden.checked = file_info_general.hidden; |
||
196 | ch_system.checked = file_info_general.system; |
||
5510 | punk_joker | 197 | } |
5447 | punk_joker | 198 | strcpy(#path_to_file, #path); |
199 | path_to_file_ed.size = strlen(#path_to_file); |
||
200 | |||
7227 | leency | 201 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
5447 | punk_joker | 202 | loop() switch(WaitEvent()) |
203 | { |
||
204 | case evButton: |
||
205 | id=GetButtonID(); |
||
7244 | leency | 206 | ch_read_only.click(id); |
207 | ch_hidden.click(id); |
||
208 | ch_system.click(id); |
||
7593 | leency | 209 | if (apply_question_active) |
5688 | punk_joker | 210 | { |
7593 | leency | 211 | IF (id==B_SETINGS_APPLY_SUBFOLDER) |
212 | SetProperties(SET_PROPERTIES_ALL_SUBFOLDER); |
||
213 | IF (id==B_SETINGS_APPLY_NO_SUBFOLDER) |
||
214 | SetProperties(SET_PROPERTIES_NO_SUBFOLDER); |
||
5688 | punk_joker | 215 | break; |
216 | } |
||
7593 | leency | 217 | if (id==1) || (id==B_CLOSE) |
5591 | pavelyakov | 218 | { |
219 | cmd_free=3; |
||
220 | ExitProcess(); |
||
221 | } |
||
7593 | leency | 222 | if (id==B_APPLY) EventApplyProperties(); |
5447 | punk_joker | 223 | break; |
224 | |||
225 | case evMouse: |
||
226 | edit_box_mouse stdcall (#file_name_ed); |
||
227 | edit_box_mouse stdcall (#path_to_file_ed); |
||
228 | break; |
||
229 | |||
230 | case evKey: |
||
5707 | leency | 231 | GetKeys(); |
7593 | leency | 232 | |
233 | if (apply_question_active) |
||
5688 | punk_joker | 234 | { |
7593 | leency | 235 | IF (key_scancode==SCAN_CODE_ENTER) |
236 | SetProperties(SET_PROPERTIES_ALL_SUBFOLDER); |
||
237 | IF (key_scancode==SCAN_CODE_ESC) |
||
238 | SetProperties(SET_PROPERTIES_NO_SUBFOLDER); |
||
5688 | punk_joker | 239 | break; |
240 | } |
||
7593 | leency | 241 | |
242 | switch(key_scancode) |
||
5591 | pavelyakov | 243 | { |
7593 | leency | 244 | case SCAN_CODE_ESC: |
245 | cmd_free=3; |
||
246 | ExitProcess(); |
||
247 | break; |
||
248 | |||
249 | case SCAN_CODE_ENTER: |
||
250 | EventApplyProperties(); |
||
251 | break; |
||
252 | |||
253 | default: |
||
7605 | leency | 254 | if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) { |
255 | EAX = key_editbox; |
||
256 | edit_box_key stdcall(#file_name_ed); |
||
257 | edit_box_key stdcall(#path_to_file_ed); |
||
258 | } |
||
5591 | pavelyakov | 259 | } |
5447 | punk_joker | 260 | break; |
261 | |||
262 | case evReDraw: |
||
5688 | punk_joker | 263 | DrawPropertiesWindow(); |
264 | } |
||
265 | } |
||
5450 | leency | 266 | |
5688 | punk_joker | 267 | void DrawPropertiesWindow() |
268 | { |
||
7593 | leency | 269 | proc_info pform; |
7369 | leency | 270 | char element_size_label[32]; |
271 | char folder_info[200]; |
||
6757 | leency | 272 | dword ext1; |
7369 | leency | 273 | dword element_size; |
7244 | leency | 274 | incn y; |
6757 | leency | 275 | char temp_path[sizeof(file_path)]; |
7806 | leency | 276 | DefineAndDrawWindow(Form.left + 150,150,315,360+skin_height,0x34,sc.work,WINDOW_TITLE_PROPERTIES,0); |
7593 | leency | 277 | GetProcessInfo(#pform, SelfInfo); |
7041 | leency | 278 | |
7593 | leency | 279 | DrawStandartCaptButton(pform.cwidth - 96, pform.cheight-34, B_CLOSE, T_CLOSE); |
280 | DrawStandartCaptButton(pform.cwidth -208, pform.cheight-34, B_APPLY, T_APPLY); |
||
5688 | punk_joker | 281 | |
7806 | leency | 282 | WriteText(10, 78, 0x90, sc.work_text, PR_T_DEST); |
7041 | leency | 283 | edit_box_draw stdcall (#path_to_file_ed); |
284 | |||
7806 | leency | 285 | WriteText(10, 97, 0x90, sc.work_text, PR_T_SIZE); |
7041 | leency | 286 | |
287 | if (selected_count) |
||
6403 | punk_joker | 288 | { |
7086 | leency | 289 | PropertiesDrawIcon(NULL, " |
7369 | leency | 290 | sprintf(#folder_info,"%s%d%s%d",SET_6,more_files_count.files,SET_7,more_files_count.folders); |
7806 | leency | 291 | WriteText(file_name_ed.left+4, 30, 0x90, sc.work_text, #folder_info); |
7369 | leency | 292 | sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(more_files_count.bytes, NULL),more_files_count.bytes,SET_BYTE_LANG); |
7806 | leency | 293 | WriteText(120, 97, 0x90, sc.work_text, #element_size_label); |
7041 | leency | 294 | } |
295 | else |
||
296 | { |
||
297 | if ( file_info_general.isfolder ) |
||
298 | PropertiesDrawIcon(NULL, " |
||
299 | else { |
||
300 | sprintf(#temp_path,"%s/%s",#path,#file_name2); |
||
301 | ext1 = strrchr(#file_name2,'.'); |
||
302 | if (ext1) ext1 += #file_name2; |
||
303 | PropertiesDrawIcon(#temp_path, ext1); |
||
304 | } |
||
7806 | leency | 305 | WriteText(file_name_ed.left, file_name_ed.top-15, 0x80, sc.work_text, PR_T_NAME); |
7227 | leency | 306 | DrawEditBox(#file_name_ed); |
5688 | punk_joker | 307 | |
7041 | leency | 308 | if (!itdir) element_size = file_info_general.sizelo; |
309 | else |
||
5688 | punk_joker | 310 | { |
7806 | leency | 311 | WriteText(10,116, 0x90, sc.work_text, PR_T_CONTAINS); |
7369 | leency | 312 | sprintf(#folder_info,"%s%d%s%d",SET_6,dir_size.files,SET_7,dir_size.folders); |
7806 | leency | 313 | WriteText(120, 116, 0x90, sc.work_text, #folder_info); |
7369 | leency | 314 | element_size = dir_size.bytes; |
5688 | punk_joker | 315 | } |
7806 | leency | 316 | WriteTextLines(10, 136, 0x90, sc.work_text, CREATED_OPENED_MODIFIED, 20); |
317 | DrawDate(120, 136, sc.work_text, #file_info_general.datecreate); |
||
318 | DrawDate(120, 156, sc.work_text, #file_info_general.datelastaccess); |
||
319 | DrawDate(120, 176, sc.work_text, #file_info_general.datelastedit); |
||
7041 | leency | 320 | |
321 | sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(element_size, NULL),element_size,SET_BYTE_LANG); |
||
7806 | leency | 322 | WriteText(120, 99, 0x90, sc.work_text, #element_size_label); |
5447 | punk_joker | 323 | } |
7593 | leency | 324 | DrawFrame(10, 212, -10*2 + pform.cwidth - 2, 92, FLAGS); |
7244 | leency | 325 | y.n = 212; //212 => attributes_frame.y |
326 | ch_read_only.draw(24, y.inc(18)); |
||
327 | ch_hidden.draw(24, y.inc(24)); |
||
328 | ch_system.draw(24, y.inc(24)); |
||
7593 | leency | 329 | if (apply_question_active) ShowConfirmQuestionPopin(); |
5463 | leency | 330 | } |
331 | |||
7041 | leency | 332 | void PropertiesDrawIcon(dword file_path, extension) |
333 | { |
||
7227 | leency | 334 | #define ICON_PADDING 11 |
335 | DrawBar(20-ICON_PADDING, 30-ICON_PADDING-1, ICON_PADDING*2+16, ICON_PADDING*2+16, 0xFFFfff); |
||
7425 | leency | 336 | DrawIconByExtension(file_path, extension, -icon_size/2+28, -icon_size/2+38, 0xFFFfff); |
7041 | leency | 337 | } |
7593 | leency | 338 | |
339 | void EventApplyProperties() |
||
340 | { |
||
341 | if (selected_count) || (itdir) { |
||
342 | ShowConfirmQuestionPopin(); |
||
343 | } else { |
||
344 | SetProperties(SET_PROPERTIES_SINGLE_FILE); |
||
345 | } |
||
346 | } |