Rev 8854 | Rev 8868 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8750 | leency | 1 | //Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2021 |
7490 | leency | 2 | //GNU GPL license. |
3363 | leency | 3 | |
7361 | leency | 4 | // 70.5 - get volume info and label |
5 | |||
8861 | leency | 6 | #define ABOUT_TITLE "EOLITE 5 Beta2" |
7 | #define TITLE_EOLITE "Eolite File Manager 5 Beta2" |
||
8 | #define TITLE_KFM "Kolibri File Manager 2 Beta2"; |
||
8012 | leency | 9 | |
4022 | leency | 10 | #ifndef AUTOBUILD |
11 | #include "lang.h--" |
||
12 | #endif |
||
13 | |||
3363 | leency | 14 | //libraries |
8417 | leency | 15 | #define MEMSIZE 1024 * 250 |
7054 | leency | 16 | #include "../lib/clipboard.h" |
17 | #include "../lib/strings.h" |
||
18 | #include "../lib/mem.h" |
||
7219 | leency | 19 | #include "../lib/fs.h" |
7054 | leency | 20 | #include "../lib/gui.h" |
21 | #include "../lib/list_box.h" |
||
22 | #include "../lib/random.h" |
||
23 | #include "../lib/kfont.h" |
||
24 | #include "../lib/collection.h" |
||
25 | #include "../lib/copyf.h" |
||
5834 | pavelyakov | 26 | |
7054 | leency | 27 | #include "../lib/obj/libini.h" |
28 | #include "../lib/obj/box_lib.h" |
||
7230 | leency | 29 | #include "../lib/obj/libimg.h" |
7054 | leency | 30 | |
31 | #include "../lib/patterns/history.h" |
||
8764 | leency | 32 | #include "../lib/patterns/toolbar_button.h" |
7054 | leency | 33 | |
7462 | leency | 34 | #include "imgs/images.h" |
3363 | leency | 35 | |
6278 | leency | 36 | //Button IDs |
37 | enum { |
||
7422 | leency | 38 | PATH_BTN = 10, |
6278 | leency | 39 | POPUP_BTN1 = 201, |
6289 | leency | 40 | POPUP_BTN2 = 202, |
8854 | leency | 41 | KFM_DEV_DROPDOWN_1 = 205, |
42 | KFM_DEV_DROPDOWN_2 = 207, |
||
43 | BREADCRUMB_ID = 300, |
||
44 | |||
45 | BACK_BTN = 400, |
||
46 | FWRD_BTN, |
||
47 | GOUP_BTN, |
||
48 | COPY_BTN, |
||
49 | CUT_BTN, |
||
50 | PASTE_BTN |
||
6278 | leency | 51 | }; |
3444 | leency | 52 | |
6278 | leency | 53 | //NewElement options |
54 | enum { |
||
55 | CREATE_FILE=1, |
||
56 | CREATE_FOLDER, |
||
57 | RENAME_ITEM |
||
58 | }; |
||
59 | |||
60 | //OpenDir options |
||
61 | enum { |
||
62 | ONLY_SHOW, |
||
63 | WITH_REDRAW, |
||
64 | ONLY_OPEN |
||
65 | }; |
||
66 | |||
7757 | leency | 67 | _history history; |
68 | |||
7634 | leency | 69 | struct Eolite_colors |
70 | { |
||
7647 | leency | 71 | bool def; |
7634 | leency | 72 | dword lpanel; |
73 | dword list_vert_line; //vertical line between columns in list |
||
74 | dword selec; |
||
75 | dword selec_active; |
||
76 | dword selec_inactive; |
||
77 | dword selec_text; |
||
78 | dword list_bg; |
||
79 | dword list_gb_text; |
||
80 | dword list_text_hidden; |
||
81 | dword work_gradient[24]; |
||
82 | dword slider_bg_big; |
||
83 | dword slider_bg_left; |
||
84 | dword odd_line; |
||
85 | } col; |
||
8240 | leency | 86 | dword waves_pal[256]; |
3363 | leency | 87 | |
8764 | leency | 88 | bool efm = false; |
89 | |||
3434 | leency | 90 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
3363 | leency | 91 | |
7628 | leency | 92 | bool active_about = false; |
93 | bool active_settings = false; |
||
94 | bool _not_draw = false; |
||
95 | bool exif_load = false; |
||
96 | bool dir_at_fat16 = NULL; |
||
97 | |||
8854 | leency | 98 | bool dev_popin_active_on_panel=0; |
4136 | punk_joker | 99 | |
8854 | leency | 100 | dword about_thread_id; |
101 | dword settings_window; |
||
102 | |||
5733 | leency | 103 | byte del_active=0; |
104 | byte new_element_active=0; |
||
5698 | leency | 105 | |
5733 | leency | 106 | llist files, files_active, files_inactive; |
3434 | leency | 107 | |
5694 | leency | 108 | byte list_full_redraw; |
109 | |||
5698 | leency | 110 | dword buf; |
7972 | leency | 111 | collection_int items=0; |
5698 | leency | 112 | int selected_count; |
6406 | punk_joker | 113 | int count_dir; |
5698 | leency | 114 | |
7628 | leency | 115 | byte path[4096]; |
116 | byte file_path[4096]; |
||
117 | byte file_name[256]; |
||
118 | byte new_element_name[256]; |
||
119 | byte temp[4096]; |
||
120 | bool itdir; |
||
3363 | leency | 121 | |
5719 | leency | 122 | char active_path[4096], inactive_path[4096]; |
5698 | leency | 123 | |
7202 | leency | 124 | dword eolite_ini_path[4096]; |
125 | _ini ini; |
||
5441 | leency | 126 | |
5698 | leency | 127 | char scroll_used=false; |
5695 | leency | 128 | |
8861 | leency | 129 | dword about_stak=0,properties_stak=0,settings_stak=0; |
5608 | leency | 130 | |
3363 | leency | 131 | proc_info Form; |
7252 | leency | 132 | int sc_slider_h; |
4028 | leency | 133 | int action_buf; |
4863 | leency | 134 | int rand_n; |
3363 | leency | 135 | |
7490 | leency | 136 | char sort_type=2; |
137 | bool sort_desc=false; |
||
7244 | leency | 138 | int active_panel=1; |
5549 | punk_joker | 139 | |
7054 | leency | 140 | libimg_image icons16_default; |
141 | libimg_image icons16_selected; |
||
142 | |||
7242 | leency | 143 | libimg_image icons32_default; |
144 | libimg_image icons32_selected; |
||
7197 | leency | 145 | |
6564 | leency | 146 | #define STATUS_BAR_H 16; |
147 | int status_bar_h = 0; |
||
148 | |||
7197 | leency | 149 | int icon_size = 16; |
150 | |||
7252 | leency | 151 | edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000, |
8334 | leency | 152 | 248,#new_element_name,0,ed_focus+ed_always_focus,6,0}; |
7004 | leency | 153 | PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
5694 | leency | 154 | byte cmd_free=0; |
5698 | leency | 155 | #include "include\translations.h" |
5834 | pavelyakov | 156 | |
7462 | leency | 157 | #include "include\gui.h" |
5748 | leency | 158 | #include "include\settings.h" |
5804 | punk_joker | 159 | #include "include\progress_dialog.h" |
7878 | leency | 160 | #include "include\copy_and_delete.h" |
3363 | leency | 161 | #include "include\sorting.h" |
4042 | leency | 162 | #include "include\icons.h" |
3363 | leency | 163 | #include "include\left_panel.h" |
4042 | leency | 164 | #include "include\menu.h" |
165 | #include "include\about.h" |
||
5447 | punk_joker | 166 | #include "include\properties.h" |
6289 | leency | 167 | #include "include\breadcrumbs.h" |
3363 | leency | 168 | |
7786 | leency | 169 | void load_libraries() |
170 | { |
||
171 | load_dll(boxlib, #box_lib_init,0); |
||
172 | load_dll(libini, #lib_init,1); |
||
173 | load_dll(libimg, #libimg_init,1); |
||
174 | } |
||
175 | |||
7878 | leency | 176 | void handle_param() |
177 | { |
||
7879 | leency | 178 | //-p |
179 | //-d |
||
180 | //-v : paste files/folder from clipboard |
||
8764 | leency | 181 | dword p = #param; |
8779 | leency | 182 | if (param[0]=='\\') && (param[1]=='E') && (param[2]=='F') && (param[3]=='M') { |
8764 | leency | 183 | efm = true; |
184 | p += 4; |
||
185 | if (param[4]==' ') p++; |
||
186 | } |
||
187 | |||
8779 | leency | 188 | LoadIniSettings(); |
189 | |||
8764 | leency | 190 | if (ESBYTE[p]=='\0') return; |
191 | |||
192 | if (ESBYTE[p]=='-') switch (ESBYTE[p+1]) |
||
7878 | leency | 193 | { |
194 | case 'p': |
||
8764 | leency | 195 | strcpy(#file_path, p + 3); |
7920 | leency | 196 | itdir = dir_exists(#file_path); |
8764 | leency | 197 | strcpy(#file_name, p + strrchr(p, '/')); |
198 | ESBYTE[strrchr(p, '/')+p-1] = '\0'; |
||
199 | strcpy(#path, p + 3); |
||
7878 | leency | 200 | properties_dialog(); |
8020 | leency | 201 | ExitProcess(); |
7878 | leency | 202 | case 'd': |
8861 | leency | 203 | strcpy(#path, p + 3); |
204 | DeleteThread(); |
||
8020 | leency | 205 | ExitProcess(); |
7879 | leency | 206 | case 'v': |
8764 | leency | 207 | cut_active = ESBYTE[p+2] - '0'; |
208 | strcpy(#path, p + 4); |
||
7879 | leency | 209 | PasteThread(); |
8020 | leency | 210 | ExitProcess(); |
7878 | leency | 211 | } |
8764 | leency | 212 | |
8779 | leency | 213 | ESBYTE[0] = NULL; |
8764 | leency | 214 | |
8779 | leency | 215 | if (param[strlen(#param)-1]=='/') ESBYTE[strlen(#param)-1]=NULL; //no "/" at the end |
216 | |||
8764 | leency | 217 | if (dir_exists(p)) { |
218 | strcpy(#path, p); |
||
219 | } else { |
||
220 | if (file_exists(p)) { |
||
221 | ESBYTE[strrchr(p, '/')+p-1] = '\0'; |
||
222 | strcpy(#path, p); |
||
8779 | leency | 223 | SelectFileByName(p+strlen(#path)+1); |
8764 | leency | 224 | } else { |
225 | notify(T_NOTIFY_APP_PARAM_WRONG); |
||
226 | } |
||
227 | } |
||
7878 | leency | 228 | } |
229 | |||
3363 | leency | 230 | void main() |
231 | { |
||
6289 | leency | 232 | dword id; |
7993 | leency | 233 | int old_cur_y; |
7786 | leency | 234 | |
8765 | leency | 235 | load_libraries(); |
236 | SetAppColors(); |
||
237 | |||
8780 | leency | 238 | ESBYTE[0] = NULL; |
239 | |||
8764 | leency | 240 | handle_param(); |
7816 | leency | 241 | rand_n = random(80); |
5651 | pavelyakov | 242 | |
8780 | leency | 243 | ESBYTE[0] = NULL; |
244 | |||
6034 | leency | 245 | SystemDiscs.Get(); |
5733 | leency | 246 | Open_Dir(#path,ONLY_OPEN); |
5719 | leency | 247 | strcpy(#inactive_path, #path); |
5733 | leency | 248 | llist_copy(#files_inactive, #files); |
7051 | leency | 249 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
7913 | leency | 250 | loop() switch(@WaitEventTimeout(80)) |
7786 | leency | 251 | { |
252 | case evMouse: |
||
8854 | leency | 253 | if (del_active) || (dev_popin_active_on_panel) || (Form.status_window>2) break; |
7786 | leency | 254 | if (new_element_active) |
255 | { |
||
256 | edit_box_mouse stdcall(#new_file_ed); |
||
257 | break; |
||
258 | } |
||
259 | |||
260 | mouse.get(); |
||
7422 | leency | 261 | |
7786 | leency | 262 | ProceedMouseGestures(); |
7989 | leency | 263 | |
7993 | leency | 264 | if (mouse.vert) |
265 | { |
||
266 | if (files.MouseScroll(mouse.vert)) List_ReDraw(); |
||
7989 | leency | 267 | break; |
268 | } |
||
7993 | leency | 269 | |
7786 | leency | 270 | if (files.MouseOver(mouse.x, mouse.y)) |
271 | { |
||
272 | //select file |
||
273 | if (mouse.key&MOUSE_LEFT) && (mouse.up) |
||
5549 | punk_joker | 274 | { |
7993 | leency | 275 | GetKeyModifier(); |
276 | old_cur_y = files.cur_y; |
||
8012 | leency | 277 | if (files.ProcessMouse(mouse.x, mouse.y)) && (!key_modifier) { |
278 | List_ReDraw(); |
||
279 | break; |
||
280 | } |
||
7993 | leency | 281 | if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) { |
282 | EventChooseFilesRange(old_cur_y, files.cur_y); |
||
283 | } else if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) { |
||
284 | EventChooseFile(files.cur_y); |
||
285 | DrawStatusBar(); |
||
7989 | leency | 286 | List_ReDraw(); |
287 | } else { |
||
8417 | leency | 288 | if (mouse.y - files.y / files.item_h + files.first == files.cur_y) EventOpen(0); |
7786 | leency | 289 | } |
5591 | pavelyakov | 290 | } |
7786 | leency | 291 | //file menu |
292 | if (mouse.key&MOUSE_RIGHT) && (mouse.up) |
||
5591 | pavelyakov | 293 | { |
7786 | leency | 294 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
295 | if (getElementSelectedFlag(files.cur_y) == false) selected_count = 0; //on redraw selection would be flashed, see [L001] |
||
296 | EventShowListMenu(); |
||
297 | } |
||
298 | } |
||
299 | |||
300 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y-17) && (mouse.y |
||
301 | { |
||
7806 | leency | 302 | if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_dark,sc.work_light); |
7786 | leency | 303 | WHILE (mouse.lkm) && (files.first>0) |
5549 | punk_joker | 304 | { |
7786 | leency | 305 | pause(8); |
306 | files.first--; |
||
307 | List_ReDraw(); |
||
308 | mouse.get(); |
||
5575 | pavelyakov | 309 | } |
7806 | leency | 310 | DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_light,sc.work_dark); |
7786 | leency | 311 | } |
5591 | pavelyakov | 312 | |
7786 | leency | 313 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y+files.h-16) && (mouse.y |
314 | { |
||
7806 | leency | 315 | if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_dark,sc.work_light); |
7786 | leency | 316 | while (mouse.lkm) && (files.first |
5575 | pavelyakov | 317 | { |
7786 | leency | 318 | pause(8); |
319 | files.first++; |
||
320 | List_ReDraw(); |
||
321 | mouse.get(); |
||
5591 | pavelyakov | 322 | } |
7806 | leency | 323 | DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_light,sc.work_dark); |
7786 | leency | 324 | } |
5591 | pavelyakov | 325 | |
7786 | leency | 326 | //Scrooll |
327 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) && (mouse.y |
||
8764 | leency | 328 | if (scroll_used) && (!mouse.key&MOUSE_LEFT) { scroll_used=false; Scroll(); } |
7786 | leency | 329 | |
330 | if (scroll_used) |
||
331 | { |
||
332 | if (sc_slider_h/2+files.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii |
||
333 | id = files.first; |
||
334 | files.first = -sc_slider_h / 2 + mouse.y -files.y * files.count; |
||
335 | files.first /= files.h - 18; |
||
336 | if (files.visible+files.first>files.count) files.first=files.count-files.visible; |
||
337 | if (files.first<0) files.first=0; |
||
338 | if (id!=files.first) List_ReDraw(); |
||
339 | break; |
||
340 | } |
||
341 | |||
8854 | leency | 342 | if (efm) && (mouse.y > files.y) && (mouse.down) { |
7786 | leency | 343 | if (mouse.x |
5591 | pavelyakov | 344 | { |
8861 | leency | 345 | if (active_panel!=1) { |
7786 | leency | 346 | active_panel = 1; |
347 | ChangeActivePanel(); |
||
5575 | pavelyakov | 348 | } |
8861 | leency | 349 | } else { |
350 | if (active_panel!=2) { |
||
7786 | leency | 351 | active_panel = 2; |
352 | ChangeActivePanel(); |
||
5591 | pavelyakov | 353 | } |
3363 | leency | 354 | } |
7786 | leency | 355 | } |
356 | break; |
||
357 | //Button pressed----------------------------------------------------------------------------- |
||
358 | case evButton: |
||
8417 | leency | 359 | id = GetButtonID(); |
3363 | leency | 360 | |
8854 | leency | 361 | if (new_element_active) || (del_active) || (dev_popin_active_on_panel) { |
7878 | leency | 362 | if (POPUP_BTN1==id) && (del_active) EventDelete(); |
363 | if (POPUP_BTN1==id) && (new_element_active) NewElement(); |
||
364 | if (POPUP_BTN2==id) EventClosePopinForm(); |
||
8854 | leency | 365 | if (dev_popin_active_on_panel) EventDriveClick(id); |
7786 | leency | 366 | break; |
367 | } |
||
5719 | leency | 368 | |
7786 | leency | 369 | switch(id) |
370 | { |
||
371 | case CLOSE_BTN: |
||
372 | KillProcess(about_thread_id); |
||
373 | SaveIniSettings(); |
||
374 | ExitProcess(); |
||
375 | case PATH_BTN: |
||
376 | notify(COPY_PATH_STR); |
||
377 | Clipboard__CopyText(#path); |
||
378 | break; |
||
8854 | leency | 379 | case KFM_DEV_DROPDOWN_1: |
380 | case KFM_DEV_DROPDOWN_1+1: |
||
381 | dev_popin_active_on_panel = 1; |
||
382 | SystemDiscs.DrawOptions(Form.cwidth/2-DDW, 8+DEV_H_HOR+3); |
||
7786 | leency | 383 | break; |
8854 | leency | 384 | case KFM_DEV_DROPDOWN_2: |
385 | case KFM_DEV_DROPDOWN_2+1: |
||
386 | dev_popin_active_on_panel = 2; |
||
387 | SystemDiscs.DrawOptions(Form.cwidth-DDW-2, 8+DEV_H_HOR+3); |
||
7786 | leency | 388 | break; |
8854 | leency | 389 | case BACK_BTN...PASTE_BTN: |
390 | if (active_panel==2) { |
||
391 | active_panel = 1; |
||
392 | ChangeActivePanel(); |
||
393 | } |
||
394 | EventToolbarButtonClick(id); |
||
7786 | leency | 395 | break; |
8854 | leency | 396 | case BACK_BTN+100...PASTE_BTN+100: |
397 | if (active_panel==1) { |
||
398 | active_panel = 2; |
||
399 | ChangeActivePanel(); |
||
400 | } |
||
401 | EventToolbarButtonClick(id-100); |
||
7786 | leency | 402 | break; |
403 | case 31...33: |
||
404 | EventSort(id-30); |
||
405 | break; |
||
7813 | leency | 406 | case 51: |
407 | EventShowBurgerMenu(); |
||
408 | break; |
||
409 | case 52...60: //Actions |
||
7786 | leency | 410 | FnProcess(id-50); |
411 | break; |
||
412 | case 61: // Set path as default |
||
413 | SetDefaultPath(#path); |
||
414 | break; |
||
415 | case 100...120: |
||
8854 | leency | 416 | EventDriveClick(id); |
7786 | leency | 417 | break; |
418 | case BREADCRUMB_ID...360: |
||
419 | ClickOnBreadCrumb(id-BREADCRUMB_ID); |
||
420 | break; |
||
421 | } |
||
422 | break; |
||
423 | |||
424 | //Key pressed----------------------------------------------------------------------------- |
||
425 | case evKey: |
||
426 | GetKeys(); |
||
7398 | leency | 427 | |
7786 | leency | 428 | if (Form.status_window>2) break; |
429 | |||
8854 | leency | 430 | if (new_element_active) || (del_active) || (dev_popin_active_on_panel) |
7786 | leency | 431 | { |
8861 | leency | 432 | if (key_scancode == SCAN_CODE_ESC) EventClosePopinForm(); |
433 | |||
8854 | leency | 434 | if (del_active) { |
7878 | leency | 435 | if (key_scancode == SCAN_CODE_ENTER) EventDelete(); |
7398 | leency | 436 | } |
8854 | leency | 437 | if (new_element_active) { |
7878 | leency | 438 | if (key_scancode == SCAN_CODE_ENTER) NewElement(); |
7786 | leency | 439 | EAX = key_editbox; |
440 | edit_box_key stdcall (#new_file_ed); |
||
441 | } |
||
442 | break; |
||
443 | } |
||
7398 | leency | 444 | |
7989 | leency | 445 | if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) { |
8417 | leency | 446 | |
447 | if (key_scancode == SCAN_CODE_ENTER) { |
||
448 | EventOpenSelected(); |
||
449 | break; |
||
450 | } |
||
451 | |||
7993 | leency | 452 | old_cur_y = files.cur_y; |
453 | files.ProcessKey(key_scancode); |
||
454 | EventChooseFilesRange(old_cur_y, files.cur_y); |
||
7989 | leency | 455 | break; |
456 | } |
||
457 | |||
7786 | leency | 458 | if (files.ProcessKey(key_scancode)) |
459 | { |
||
460 | List_ReDraw(); |
||
461 | break; |
||
462 | } |
||
463 | |||
464 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) |
||
465 | { |
||
466 | switch(key_scancode) |
||
5591 | pavelyakov | 467 | { |
7786 | leency | 468 | case SCAN_CODE_F1...SCAN_CODE_F3: |
469 | EventSort(key_scancode - 58); |
||
7422 | leency | 470 | break; |
7786 | leency | 471 | case SCAN_CODE_1...SCAN_CODE_10: |
472 | key_scancode-=2; |
||
473 | if (key_scancode >= SystemDiscs.list.count) break; |
||
8861 | leency | 474 | if (!efm) { |
7786 | leency | 475 | DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click |
476 | pause(7); |
||
5591 | pavelyakov | 477 | } |
7786 | leency | 478 | SystemDiscs.Click(key_scancode); |
5591 | pavelyakov | 479 | break; |
7786 | leency | 480 | case SCAN_CODE_KEY_X: |
8861 | leency | 481 | CopyFilesListToClipboard(CUT); |
7786 | leency | 482 | break; |
483 | case SCAN_CODE_KEY_C: |
||
8861 | leency | 484 | CopyFilesListToClipboard(COPY); |
3363 | leency | 485 | break; |
7813 | leency | 486 | case SCAN_CODE_KEY_G: |
487 | EventOpenConsoleHere(); |
||
488 | break; |
||
7786 | leency | 489 | case SCAN_CODE_KEY_V: |
8854 | leency | 490 | EventPaste(#path); |
3363 | leency | 491 | break; |
7786 | leency | 492 | case SCAN_CODE_KEY_D: //set image as bg |
493 | strlcpy(#temp, "\\S__",4); |
||
494 | strcat(#temp, #file_path); |
||
495 | RunProgram("/sys/media/kiv", #temp); |
||
5512 | punk_joker | 496 | break; |
7813 | leency | 497 | case SCAN_CODE_KEY_N: |
498 | EventOpenNewEolite(); |
||
7786 | leency | 499 | break; |
500 | case SCAN_CODE_KEY_M: |
||
501 | Open_Dir(#inactive_path,WITH_REDRAW); |
||
502 | break; |
||
8854 | leency | 503 | case SCAN_CODE_KEY_R: |
504 | EventRefresh(); |
||
505 | break; |
||
7786 | leency | 506 | case SCAN_CODE_ENTER: |
507 | if (!itdir) ShowOpenWithDialog(); |
||
8417 | leency | 508 | else EventOpen(1); |
5512 | punk_joker | 509 | break; |
7786 | leency | 510 | case SCAN_CODE_KEY_A: |
7993 | leency | 511 | EventChooseAllFiles(true); |
7386 | pavelyakov | 512 | break; |
7786 | leency | 513 | case SCAN_CODE_KEY_U: //unselect all files |
7993 | leency | 514 | EventChooseAllFiles(false); |
7786 | leency | 515 | break; |
5591 | pavelyakov | 516 | } |
517 | break; |
||
7786 | leency | 518 | } |
5698 | leency | 519 | |
7786 | leency | 520 | switch (key_scancode) |
521 | { |
||
522 | case SCAN_CODE_BS: |
||
523 | Dir_Up(); |
||
524 | break; |
||
525 | case SCAN_CODE_ENTER: |
||
8417 | leency | 526 | EventOpen(0); |
7786 | leency | 527 | break; |
528 | case SCAN_CODE_TAB: |
||
8854 | leency | 529 | if (!efm) break; |
7786 | leency | 530 | if (active_panel==1) active_panel=2; else active_panel=1; |
531 | ChangeActivePanel(); |
||
532 | DrawFilePanels(); |
||
533 | break; |
||
534 | case SCAN_CODE_MENU: |
||
535 | mouse.x = files.x+15; |
||
536 | mouse.y = files.cur_y - files.first * files.item_h + files.y + 5; |
||
537 | EventShowListMenu(); |
||
538 | break; |
||
539 | case SCAN_CODE_DEL: |
||
540 | Del_Form(); |
||
541 | break; |
||
542 | case SCAN_CODE_INS: |
||
7989 | leency | 543 | EventChooseFile(files.cur_y); |
7786 | leency | 544 | files.KeyDown(); |
7999 | leency | 545 | DrawStatusBar(); |
7786 | leency | 546 | List_ReDraw(); |
547 | break; |
||
8780 | leency | 548 | case SCAN_CODE_F1...SCAN_CODE_F10: |
7786 | leency | 549 | FnProcess(key_scancode-58); |
550 | break; |
||
551 | default: |
||
552 | EventSelectFileByKeyPress(); |
||
553 | } |
||
8861 | leency | 554 | break; |
7786 | leency | 555 | case evIPC: |
556 | case evReDraw: |
||
557 | draw_window(); |
||
558 | if (CheckActiveProcess(Form.ID)) && (GetMenuClick()) break; |
||
8861 | leency | 559 | if (action_buf==OPERATION_END) { |
8854 | leency | 560 | EventRefresh(); |
7786 | leency | 561 | action_buf=0; |
562 | } |
||
8861 | leency | 563 | break; |
7786 | leency | 564 | default: |
8861 | leency | 565 | if (Form.status_window<=2) EventRefreshDisksAndFolders(); |
5576 | pavelyakov | 566 | } |
7786 | leency | 567 | |
568 | if(cmd_free) |
||
569 | { |
||
570 | if(cmd_free==2) about_stak=free(about_stak); |
||
571 | else if(cmd_free==3) properties_stak=free(properties_stak); |
||
572 | else if(cmd_free==4) settings_stak=free(settings_stak); |
||
573 | cmd_free = false; |
||
574 | } |
||
3363 | leency | 575 | } |
576 | |||
3444 | leency | 577 | void draw_window() |
578 | { |
||
8854 | leency | 579 | dword i=0; |
8764 | leency | 580 | incn x; |
8854 | leency | 581 | dword title; |
7244 | leency | 582 | if (show_status_bar.checked) status_bar_h = STATUS_BAR_H; else status_bar_h = 0; |
8861 | leency | 583 | if (efm) title = TITLE_KFM; else title = TITLE_EOLITE; |
8854 | leency | 584 | DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,title,0); |
3444 | leency | 585 | GetProcessInfo(#Form, SelfInfo); |
586 | if (Form.status_window>2) return; |
||
8854 | leency | 587 | if (Form.height < 356) { MoveSize(OLD,OLD,OLD,356); return; } |
7490 | leency | 588 | GetProcessInfo(#Form, SelfInfo); |
7635 | leency | 589 | SetAppColors(); |
8854 | leency | 590 | if (efm) { |
591 | if (screen.width > 693) && (Form.width < 693) { MoveSize(OLD,OLD,693,OLD); return; } |
||
8764 | leency | 592 | DrawBar(0, 0, Form.cwidth, 34, sc.work); |
593 | #define PAD 7 |
||
594 | #define GAP_S 26+5 |
||
595 | #define GAP_B 26+14 |
||
8854 | leency | 596 | x.set(Form.cwidth/2-DDW-203/2-GAP_S); |
597 | while (i<200) { |
||
598 | DrawTopPanelButton(i+BACK_BTN, x.inc(GAP_S), PAD, 30, false); |
||
599 | DrawTopPanelButton(i+FWRD_BTN, x.inc(GAP_S), PAD, 31, false); |
||
600 | DrawTopPanelButton(i+GOUP_BTN, x.inc(GAP_B), PAD, 01, false); |
||
601 | DrawTopPanelButton(i+COPY_BTN, x.inc(GAP_B), PAD, 55, false); |
||
602 | DrawTopPanelButton(i+CUT_BTN, x.inc(GAP_S), PAD, 20, false); |
||
603 | DrawTopPanelButton(i+PASTE_BTN,x.inc(GAP_S), PAD, 56, false); |
||
604 | x.set(Form.cwidth/2-DDW-203/2-GAP_S+calc(Form.cwidth/2)); |
||
605 | i+=100; |
||
606 | } |
||
607 | //DrawTopPanelButton(51, Form.cwidth-GAP_S-PAD, PAD, -1, false); //burger menu |
||
8764 | leency | 608 | } else { |
609 | if (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; } |
||
610 | ESDWORD[#toolbar_pal] = sc.work; |
||
611 | ESDWORD[#toolbar_pal+4] = MixColors(0, sc.work, 35); |
||
612 | PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal); |
||
8861 | leency | 613 | for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,BACK_BTN+i); |
614 | for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i], 5,31, 29, BACK_BTN+i); |
||
8764 | leency | 615 | DrawBar(127, 8, 1, 25, sc.work_graph); |
616 | DrawBar(246,0, Form.cwidth - 246, 34, sc.work); |
||
617 | DrawDot(Form.cwidth-17,12); |
||
618 | DrawDot(Form.cwidth-17,12+6); |
||
619 | DrawDot(Form.cwidth-17,12+12); |
||
620 | DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots |
||
621 | } |
||
3434 | leency | 622 | //main rectangles |
7806 | leency | 623 | DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,sc.work_graph); |
7634 | leency | 624 | DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg |
7806 | leency | 625 | for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10)); |
7819 | leency | 626 | for (i=0; i<6; i++) DrawBar(0, 5-i, Form.cwidth, 1, MixColors(sc.work_light, sc.work, i*10)); |
5733 | leency | 627 | llist_copy(#files_active, #files); |
5723 | leency | 628 | strcpy(#active_path, #path); |
6564 | leency | 629 | DrawStatusBar(); |
7993 | leency | 630 | if (!selected_count) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] |
5723 | leency | 631 | DrawFilePanels(); |
8854 | leency | 632 | dev_popin_active_on_panel = 0; |
5723 | leency | 633 | } |
634 | |||
635 | void DrawList() |
||
636 | { |
||
5733 | leency | 637 | word sorting_arrow_x; |
7490 | leency | 638 | dword sorting_arrow_t = "\x19"; |
639 | if (sort_desc) sorting_arrow_t = "\x18"; |
||
8764 | leency | 640 | DrawFlatButtonSmall(files.x - efm, files.y-17,files.w-141+efm,16,31,T_FILE); |
6678 | leency | 641 | DrawFlatButtonSmall(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE); |
642 | DrawFlatButtonSmall(files.x + files.w - 68, files.y-17,68,16,33,T_SIZE); |
||
643 | DrawFlatButtonSmall(files.x + files.w, files.y-17,16,16, 0,"\x18"); |
||
644 | DrawFlatButtonSmall(files.x + files.w,files.y+files.h-16,16,16,0,"\x19"); |
||
7490 | leency | 645 | if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18; |
646 | if (sort_type==2) sorting_arrow_x = files.x + files.w - 90; |
||
647 | if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
||
7806 | leency | 648 | WriteText(sorting_arrow_x,files.y-12,0x80, sc.work_text, sorting_arrow_t); |
649 | DrawBar(files.x+files.w,files.y,1,files.h,sc.work_graph); |
||
8854 | leency | 650 | if (efm) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,sc.work_graph); |
5723 | leency | 651 | } |
652 | |||
6404 | punk_joker | 653 | void DrawStatusBar() |
654 | { |
||
6572 | leency | 655 | char status_bar_str[80]; |
6570 | leency | 656 | int go_up_folder_exists=0; |
8854 | leency | 657 | |
658 | if (efm) { |
||
659 | DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, sc.work); |
||
660 | WriteTextCenter(0,Form.cheight - 12, Form.cwidth,sc.work_text,T_KFM_FUNC); |
||
661 | return; |
||
662 | } |
||
663 | |||
7244 | leency | 664 | if (!show_status_bar.checked) return; |
7972 | leency | 665 | if (files.count>0) && (streq(items.get(0)*304+buf+72,"..")) go_up_folder_exists=1; |
7806 | leency | 666 | DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, sc.work); |
7804 | leency | 667 | sprintf(#status_bar_str, T_STATUS_EVEMENTS, count_dir-go_up_folder_exists, files.count-count_dir); |
7806 | leency | 668 | WriteText(6,Form.cheight - 13,0x80,sc.work_text,#status_bar_str); |
7804 | leency | 669 | if (selected_count) { |
670 | sprintf(#status_bar_str, T_STATUS_SELECTED, selected_count); |
||
671 | WriteText(Form.cwidth - calc(strlen(#status_bar_str)*6)-6,Form.cheight - 13, |
||
7806 | leency | 672 | 0x80,sc.work_text,#status_bar_str); |
7804 | leency | 673 | } |
6404 | punk_joker | 674 | } |
675 | |||
5723 | leency | 676 | void DrawFilePanels() |
677 | { |
||
6034 | leency | 678 | int files_y; |
8826 | leency | 679 | int w2 = -Form.cwidth-1/2+Form.cwidth; |
680 | int h2; |
||
8854 | leency | 681 | if (!efm) |
5698 | leency | 682 | { |
5723 | leency | 683 | DrawDeviceAndActionsLeftPanel(); |
6564 | leency | 684 | files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h); |
5719 | leency | 685 | DrawList(); |
5733 | leency | 686 | Open_Dir(#path,ONLY_SHOW); |
5698 | leency | 687 | } |
688 | else |
||
689 | { |
||
8779 | leency | 690 | //SystemDiscs.Get(); |
5733 | leency | 691 | llist_copy(#files, #files_inactive); |
692 | strcpy(#path, #inactive_path); |
||
7634 | leency | 693 | col.selec = col.selec_inactive; |
6034 | leency | 694 | SystemDiscs.Draw(); |
695 | files_y = files.y; |
||
8826 | leency | 696 | h2 = Form.cheight-files_y-2 - status_bar_h; |
5733 | leency | 697 | |
5719 | leency | 698 | if (active_panel==1) |
699 | { |
||
5761 | leency | 700 | llist_copy(#files, #files_inactive); |
701 | strcpy(#path, #inactive_path); |
||
7634 | leency | 702 | col.selec = col.selec_inactive; //this is a bad code: need to use some var to set inactive panel for DrawList(); |
8826 | leency | 703 | files.SetSizes(Form.cwidth/2, files_y, w2-17, h2, files.item_h); |
5719 | leency | 704 | DrawList(); |
5733 | leency | 705 | Open_Dir(#path,WITH_REDRAW); |
706 | llist_copy(#files, #files_active); |
||
5719 | leency | 707 | strcpy(#path, #active_path); |
7634 | leency | 708 | col.selec = col.selec_active; |
8826 | leency | 709 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h); |
5719 | leency | 710 | DrawList(); |
5733 | leency | 711 | Open_Dir(#path,WITH_REDRAW); |
5719 | leency | 712 | } |
713 | if (active_panel==2) |
||
714 | { |
||
8826 | leency | 715 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h); |
5719 | leency | 716 | DrawList(); |
5733 | leency | 717 | Open_Dir(#path,WITH_REDRAW); |
718 | llist_copy(#files, #files_active); |
||
5719 | leency | 719 | strcpy(#path, #active_path); |
7634 | leency | 720 | col.selec = col.selec_active; |
8826 | leency | 721 | files.SetSizes(Form.cwidth/2, files_y, w2 -17, h2, files.item_h); |
5719 | leency | 722 | DrawList(); |
5733 | leency | 723 | Open_Dir(#path,WITH_REDRAW); |
5719 | leency | 724 | } |
5698 | leency | 725 | } |
3363 | leency | 726 | } |
727 | |||
728 | |||
5694 | leency | 729 | void List_ReDraw() |
3363 | leency | 730 | { |
5719 | leency | 731 | int all_lines_h; |
7422 | leency | 732 | dword j; |
5825 | leency | 733 | static int old_cur_y, old_first; |
8779 | leency | 734 | dword separator_color; |
3363 | leency | 735 | |
5694 | leency | 736 | files.CheckDoesValuesOkey(); //prevent some shit |
3363 | leency | 737 | |
5694 | leency | 738 | if (list_full_redraw) || (old_first != files.first) |
3363 | leency | 739 | { |
5825 | leency | 740 | old_cur_y = files.cur_y; |
5694 | leency | 741 | old_first = files.first; |
742 | list_full_redraw = false; |
||
743 | goto _ALL_LIST_REDRAW; |
||
3363 | leency | 744 | } |
5825 | leency | 745 | if (old_cur_y != files.cur_y) |
3363 | leency | 746 | { |
7634 | leency | 747 | if (old_cur_y-files.first |
748 | Line_ReDraw(col.selec, files.cur_y-files.first); |
||
5825 | leency | 749 | old_cur_y = files.cur_y; |
5694 | leency | 750 | return; |
3363 | leency | 751 | } |
752 | |||
5694 | leency | 753 | _ALL_LIST_REDRAW: |
3363 | leency | 754 | |
7634 | leency | 755 | for (j=0; j |
756 | if (files.cur_y-files.first!=j) Line_ReDraw(col.list_bg, j); |
||
757 | else Line_ReDraw(col.selec, files.cur_y-files.first); |
||
758 | } |
||
3434 | leency | 759 | //in the bottom |
5825 | leency | 760 | all_lines_h = j * files.item_h; |
7634 | leency | 761 | DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h, col.list_bg); |
8779 | leency | 762 | if (colored_lines.checked) separator_color = col.list_bg; else separator_color = col.list_vert_line; |
763 | DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h, separator_color); |
||
764 | DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h, separator_color); |
||
3434 | leency | 765 | Scroll(); |
7398 | leency | 766 | |
767 | if (del_active) Del_Form(); |
||
7634 | leency | 768 | if (new_element_active) && (col.selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name); |
3363 | leency | 769 | } |
770 | |||
7628 | leency | 771 | bool file_name_is_8_3(dword name) |
772 | { |
||
773 | int name_len = strlen(name); |
||
774 | int dot_pos = strrchr(name, '.'); |
||
775 | if (name_len<=12) |
||
776 | { |
||
777 | if (dot_pos) { |
||
778 | if (name_len - dot_pos > 3) return false; |
||
779 | } |
||
780 | else { |
||
781 | if (name_len>8) return false; |
||
782 | } |
||
783 | return true; |
||
784 | } |
||
785 | return false; |
||
786 | } |
||
3444 | leency | 787 | |
5761 | leency | 788 | void Line_ReDraw(dword bgcol, filenum){ |
7634 | leency | 789 | dword text_col=col.list_gb_text, |
5991 | leency | 790 | ext1, attr, |
791 | file_offet, |
||
792 | file_name_off, |
||
7515 | leency | 793 | file_size=0, |
6290 | leency | 794 | y=filenum*files.item_h+files.y, |
8762 | leency | 795 | icon_y = files.item_h-icon_size/2+y; |
5991 | leency | 796 | BDVK file; |
7921 | leency | 797 | char full_path[4096]; |
8779 | leency | 798 | dword separator_color; |
5996 | leency | 799 | char label_file_name[4096]; |
4859 | leency | 800 | if (filenum==-1) return; |
8779 | leency | 801 | |
7054 | leency | 802 | DrawBar(files.x,y,4,files.item_h,bgcol); |
7197 | leency | 803 | DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol); |
804 | if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size-1,icon_size,y+files.item_h-icon_y-icon_size+1,bgcol); |
||
8779 | leency | 805 | if (colored_lines.checked) { |
806 | if (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line; |
||
807 | separator_color = bgcol; |
||
808 | } else { |
||
809 | separator_color = col.list_vert_line; |
||
810 | } |
||
7422 | leency | 811 | DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol); |
8779 | leency | 812 | DrawBar(files.x+files.w-141,y,1,files.item_h, separator_color); |
813 | DrawBar(files.x+files.w-68,y,1,files.item_h, separator_color); |
||
3363 | leency | 814 | |
7972 | leency | 815 | file_offet = items.get(filenum+files.first)*304 + buf+32; |
5487 | leency | 816 | attr = ESDWORD[file_offet]; |
4897 | leency | 817 | file.selected = ESBYTE[file_offet+7]; |
818 | file.sizelo = ESDWORD[file_offet+32]; |
||
6987 | leency | 819 | file.sizehi = ESDWORD[file_offet+36]; |
4897 | leency | 820 | file_name_off = file_offet+40; |
3363 | leency | 821 | |
5487 | leency | 822 | if (! TestBit(attr, 4) ) //file or folder? |
3363 | leency | 823 | { |
5698 | leency | 824 | ext1 = strrchr(file_name_off,'.') + file_name_off; |
7515 | leency | 825 | if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing |
826 | file_size = ConvertSize64(file.sizelo, file.sizehi); |
||
7634 | leency | 827 | if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); |
3363 | leency | 828 | } |
829 | else |
||
4846 | leency | 830 | { |
7149 | leency | 831 | if (!strcmp(file_name_off,"..")) ext1=" |
6278 | leency | 832 | ext1=" |
7634 | leency | 833 | WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); |
6278 | leency | 834 | } |
8276 | leency | 835 | if (chrnum(#path, '/')==1) && (streq(#path, "/kolibrios")==false) file_size = GetDeviceSizeLabel(#full_path); |
4846 | leency | 836 | } |
7515 | leency | 837 | if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58, |
7634 | leency | 838 | files.text_y+y+1, files.font_type, col.list_gb_text, file_size); |
4846 | leency | 839 | |
7634 | leency | 840 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=col.list_text_hidden; //system or hiden? |
841 | if (bgcol==col.selec) |
||
3363 | leency | 842 | { |
7628 | leency | 843 | file_name_is_8_3(file_name_off); |
5487 | leency | 844 | itdir = TestBit(attr, 4); |
4897 | leency | 845 | strcpy(#file_name, file_name_off); |
6635 | leency | 846 | if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off); |
847 | else sprintf(#file_path,"%s/%s",#path,file_name_off); |
||
7634 | leency | 848 | if (text_col==col.list_text_hidden) { |
849 | text_col=MixColors(col.selec_text, col.list_text_hidden, 65); |
||
850 | } else text_col=col.selec_text; |
||
3363 | leency | 851 | } |
4897 | leency | 852 | if (file.selected) text_col=0xFF0000; |
6806 | leency | 853 | if (kfont.size.pt==9) || (!kfont.font) |
3434 | leency | 854 | { |
5745 | leency | 855 | if (Form.width>=480) |
856 | { |
||
8789 | leency | 857 | FileShow.start_x = files.x + icon_size + 7; |
5745 | leency | 858 | FileShow.font_color = text_col; |
859 | FileShow.area_size_x = files.w - 164; |
||
860 | FileShow.text_pointer = file_name_off; |
||
7004 | leency | 861 | FileShow.start_y = files.text_y + y - 3; |
5745 | leency | 862 | PathShow_prepare stdcall(#FileShow); |
863 | PathShow_draw stdcall(#FileShow); |
||
864 | } |
||
3434 | leency | 865 | } |
5745 | leency | 866 | else |
867 | { |
||
5996 | leency | 868 | strcpy(#label_file_name, file_name_off); |
6806 | leency | 869 | if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) |
5996 | leency | 870 | { |
6806 | leency | 871 | while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) { |
5996 | leency | 872 | ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL; |
873 | } |
||
874 | strcpy(#label_file_name+strlen(#label_file_name)-2, "..."); |
||
875 | } |
||
7634 | leency | 876 | kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, |
877 | bgcol, text_col, kfont.size.pt, #label_file_name); |
||
5745 | leency | 878 | } |
8854 | leency | 879 | if (bgcol == col.selec_inactive) DrawWideRectangle(files.x+2, y, files.w-4, files.item_h, 2, col.selec_active); |
8821 | leency | 880 | |
881 | sprintf(#full_path,"%s/%s",#path,file_name_off); |
||
8779 | leency | 882 | DrawIconByExtension(#full_path, ext1, files.x+4, icon_y, bgcol); |
3363 | leency | 883 | } |
884 | |||
885 | |||
3444 | leency | 886 | void Open_Dir(dword dir_path, redraw){ |
6406 | punk_joker | 887 | int errornum, maxcount, i; |
3444 | leency | 888 | if (redraw!=ONLY_SHOW) |
3363 | leency | 889 | { |
6602 | leency | 890 | selected_count = 0; |
3363 | leency | 891 | if (buf) free(buf); |
3444 | leency | 892 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
893 | if (errornum) |
||
3363 | leency | 894 | { |
6021 | leency | 895 | history.add(#path); |
7786 | leency | 896 | EventHistoryGoBack(); |
3363 | leency | 897 | Write_Error(errornum); |
898 | return; |
||
899 | } |
||
5825 | leency | 900 | if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0; |
3363 | leency | 901 | } |
3444 | leency | 902 | if (files.count!=-1) |
3363 | leency | 903 | { |
8854 | leency | 904 | if(!_not_draw) DrawPathBar(); |
6021 | leency | 905 | history.add(#path); |
6034 | leency | 906 | SystemDiscs.Draw(); |
5825 | leency | 907 | files.visible = files.h / files.item_h; |
5591 | pavelyakov | 908 | if (files.count < files.visible) files.visible = files.count; |
7628 | leency | 909 | if (!strncmp(dir_path, "/rd/1/",5)) |
910 | dir_at_fat16 = true; else dir_at_fat16 = false; |
||
5591 | pavelyakov | 911 | if (redraw!=ONLY_SHOW) Sorting(); |
5694 | leency | 912 | list_full_redraw = true; |
6564 | leency | 913 | if (redraw!=ONLY_OPEN)&&(!_not_draw) {DrawStatusBar(); List_ReDraw();} |
6570 | leency | 914 | SetCurDir(dir_path); |
3363 | leency | 915 | } |
5694 | leency | 916 | if (files.count==-1) && (redraw!=ONLY_OPEN) |
917 | { |
||
918 | files.KeyHome(); |
||
6564 | leency | 919 | if(!_not_draw) { list_full_redraw=true; DrawStatusBar(); List_ReDraw(); } |
5694 | leency | 920 | } |
3363 | leency | 921 | } |
922 | |||
923 | inline Sorting() |
||
924 | { |
||
7490 | leency | 925 | dword d=0, f=1; |
7422 | leency | 926 | int j=0; |
7972 | leency | 927 | dword tmp; |
4897 | leency | 928 | dword file_off; |
7422 | leency | 929 | |
7972 | leency | 930 | items.drop(); |
931 | |||
6604 | leency | 932 | if (!strcmp(#path,"/")) //do not sort root folder |
3363 | leency | 933 | { |
7972 | leency | 934 | for(d=1;d |
7490 | leency | 935 | count_dir = d; |
3363 | leency | 936 | return; |
937 | } |
||
5591 | pavelyakov | 938 | for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders |
3363 | leency | 939 | { |
7628 | leency | 940 | if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40); |
4897 | leency | 941 | if (TestBit(ESDWORD[file_off],4)) //directory? |
3363 | leency | 942 | { |
7972 | leency | 943 | items.set(d, j); |
7490 | leency | 944 | d++; |
3363 | leency | 945 | } |
946 | else |
||
947 | { |
||
7972 | leency | 948 | items.set(files.count-f, j); |
7490 | leency | 949 | f++; |
3363 | leency | 950 | } |
951 | } |
||
7490 | leency | 952 | count_dir = d; |
3434 | leency | 953 | //sorting: files first, then folders |
7490 | leency | 954 | Sort_by_Name(0,d-1); |
955 | if (sort_type==1) Sort_by_Name(d,files.count-1); |
||
956 | else if (sort_type==2) Sort_by_Type(d,files.count-1); |
||
957 | else if (sort_type==3) Sort_by_Size(d,files.count-1); |
||
958 | //reversed sorting |
||
959 | if (sort_desc) { |
||
7972 | leency | 960 | for (j=0; j |
961 | items.swap(files.count-j-1, d+j); |
||
962 | } |
||
963 | //if (sort_type==1) for (j=0; j |
||
7490 | leency | 964 | } |
5581 | leency | 965 | //make ".." first item in list |
7972 | leency | 966 | if (d>0) && (strncmp(items.get(0)*304+buf+72,"..",2)!=0) |
967 | for(d--; d>0; d--;) if (!strncmp(items.get(d)*304+buf+72,"..",2)) {items.swap(d,0); break;} |
||
3363 | leency | 968 | } |
969 | |||
970 | |||
971 | void Del_Form() |
||
972 | { |
||
5512 | punk_joker | 973 | byte f_count[128]; |
5581 | leency | 974 | int dform_x = files.w - 220 / 2 + files.x; |
7993 | leency | 975 | if (!selected_count) && (!strncmp(#file_name,"..",2)) return; |
3991 | leency | 976 | else |
977 | { |
||
4002 | leency | 978 | if (!files.count) return; |
6008 | leency | 979 | DrawEolitePopup(T_YES, T_NO); |
7806 | leency | 980 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,sc.work_text,T_DELETE_FILE); |
6278 | leency | 981 | if (selected_count) |
5512 | punk_joker | 982 | { |
6278 | leency | 983 | sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2); |
7806 | leency | 984 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count); |
5512 | punk_joker | 985 | } |
4002 | leency | 986 | else |
987 | { |
||
5591 | pavelyakov | 988 | if (strlen(#file_name)<28) |
5512 | punk_joker | 989 | { |
7806 | leency | 990 | WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?"); |
991 | WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name); |
||
5512 | punk_joker | 992 | } |
993 | else |
||
994 | { |
||
995 | WriteText(164+dform_x,190,0x80,0,"...?"); |
||
996 | ESI = 24; |
||
997 | WriteText(dform_x+20,190,0,0,#file_name); |
||
998 | } |
||
6008 | leency | 999 | } |
4002 | leency | 1000 | del_active=1; |
3991 | leency | 1001 | } |
3363 | leency | 1002 | } |
1003 | |||
5694 | leency | 1004 | void SelectFileByName(dword that_file) |
3363 | leency | 1005 | { |
5694 | leency | 1006 | int ind; |
1007 | files.KeyHome(); |
||
5991 | leency | 1008 | Open_Dir(#path,ONLY_OPEN); |
7628 | leency | 1009 | if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file); |
8392 | leency | 1010 | for (ind=files.count-1; ind>=0; ind--;) { if (!strcmpi(items.get(ind)*304+buf+72,that_file)) break; } |
5825 | leency | 1011 | files.cur_y = ind - 1; |
5694 | leency | 1012 | files.KeyDown(); |
6570 | leency | 1013 | DrawStatusBar(); |
3363 | leency | 1014 | List_ReDraw(); |
1015 | } |
||
1016 | |||
1017 | |||
1018 | void Dir_Up() |
||
1019 | { |
||
7422 | leency | 1020 | int iii; |
6635 | leency | 1021 | char old_folder_name[4096]; |
7422 | leency | 1022 | iii=strlen(#path)-1; |
1023 | if (iii==0) return; |
||
1024 | iii = strrchr(#path, '/'); |
||
1025 | strcpy(#old_folder_name, #path+iii); |
||
1026 | if (iii>1) path[iii-1]=NULL; else path[iii]=NULL; |
||
6635 | leency | 1027 | SelectFileByName(#old_folder_name); |
3363 | leency | 1028 | } |
1029 | |||
8417 | leency | 1030 | void EventOpenSelected() |
3434 | leency | 1031 | { |
8417 | leency | 1032 | int i; |
1033 | dword file_off; |
||
1034 | for (i=0; i |
||
1035 | EDX = items.get(i)*304 + buf+32; |
||
1036 | if (TestBit(ESDWORD[EDX], 4)) continue; //is foder |
||
1037 | sprintf(#param,"%s/%s",#path, EDX+40); |
||
1038 | RunProgram("/sys/@open", #param); |
||
1039 | } |
||
1040 | } |
||
1041 | |||
1042 | void EventOpen(byte _new_window) |
||
1043 | { |
||
1044 | if (selected_count) && (!itdir) notify(T_USE_SHIFT_ENTER); |
||
1045 | if (_new_window) |
||
5443 | punk_joker | 1046 | { |
8417 | leency | 1047 | if (streq(#file_name,"..")) return; |
1048 | RunProgram(I_Path, #file_path); |
||
5443 | punk_joker | 1049 | return; |
1050 | } |
||
3444 | leency | 1051 | if (!files.count) return; |
3441 | leency | 1052 | if (!itdir) |
3434 | leency | 1053 | { |
5401 | leency | 1054 | if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path); |
3434 | leency | 1055 | } |
1056 | else |
||
1057 | { |
||
5606 | pavelyakov | 1058 | if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; } |
3434 | leency | 1059 | strcpy(#path, #file_path); |
5825 | leency | 1060 | files.first=files.cur_y=0; |
3444 | leency | 1061 | Open_Dir(#path,WITH_REDRAW); |
3434 | leency | 1062 | } |
1063 | } |
||
3363 | leency | 1064 | |
7786 | leency | 1065 | inline fastcall void EventHistoryGoBack() |
3363 | leency | 1066 | { |
1067 | char cur_folder[4096]; |
||
5974 | leency | 1068 | strcpy(#cur_folder, #path); |
6021 | leency | 1069 | if (history.back()) { |
1070 | strcpy(#path, history.current()); |
||
5977 | leency | 1071 | SelectFileByName(#cur_folder+strrchr(#cur_folder,'/')); |
1072 | } |
||
3363 | leency | 1073 | } |
1074 | |||
5397 | punk_joker | 1075 | void ShowOpenWithDialog() |
1076 | { |
||
6930 | leency | 1077 | byte open_param[4097]; |
1078 | sprintf(#open_param,"~%s",#file_path); |
||
1079 | RunProgram("/sys/@open", #open_param); |
||
5397 | punk_joker | 1080 | } |
1081 | |||
7878 | leency | 1082 | void NewElement() |
5555 | punk_joker | 1083 | { |
5557 | punk_joker | 1084 | BDVK element_info; |
8750 | leency | 1085 | byte del_result, copy_result, info_result; |
7878 | leency | 1086 | |
1087 | sprintf(#temp,"%s/%s",#path,new_file_ed.text); |
||
1088 | info_result = GetFileInfo(#temp, #element_info); |
||
1089 | switch(new_element_active) |
||
5555 | punk_joker | 1090 | { |
7878 | leency | 1091 | case CREATE_FILE: |
8750 | leency | 1092 | if (info_result!=5) { |
1093 | notify(FS_ITEM_ALREADY_EXISTS); |
||
1094 | } else { |
||
7878 | leency | 1095 | CreateFile(0, 0, #temp); |
1096 | if (EAX) |
||
5557 | punk_joker | 1097 | { |
7878 | leency | 1098 | if (EAX==5) notify(NOT_CREATE_FILE); |
1099 | else Write_Error(EAX); |
||
5557 | punk_joker | 1100 | } |
7878 | leency | 1101 | } |
1102 | break; |
||
1103 | case CREATE_FOLDER: |
||
8750 | leency | 1104 | if (info_result!=5) { |
1105 | notify(FS_ITEM_ALREADY_EXISTS); |
||
1106 | } else { |
||
7878 | leency | 1107 | CreateDir(#temp); |
1108 | if (EAX) |
||
5557 | punk_joker | 1109 | { |
7878 | leency | 1110 | if (EAX==5) notify(NOT_CREATE_FOLDER); |
1111 | else Write_Error(EAX); |
||
5557 | punk_joker | 1112 | } |
7878 | leency | 1113 | } |
1114 | break; |
||
1115 | case RENAME_ITEM: |
||
8750 | leency | 1116 | if (info_result!=5) { |
1117 | notify(FS_ITEM_ALREADY_EXISTS); |
||
1118 | } else { |
||
8751 | leency | 1119 | if (RenameMove(new_file_ed.text, #file_path)) |
5571 | punk_joker | 1120 | { |
8750 | leency | 1121 | if (itdir) { |
1122 | notify("'Error renaming folder' -E"); |
||
7878 | leency | 1123 | return; |
8750 | leency | 1124 | } else { |
1125 | if (copy_result = CopyFile(#file_path,#temp)) { |
||
1126 | Write_Error(copy_result); |
||
1127 | } else { |
||
1128 | DeleteFile(#file_path); |
||
1129 | SelectFileByName(new_file_ed.text); |
||
1130 | } |
||
5571 | punk_joker | 1131 | } |
1132 | } |
||
7878 | leency | 1133 | } |
5555 | punk_joker | 1134 | } |
5557 | punk_joker | 1135 | Open_Dir(#path,WITH_REDRAW); |
7878 | leency | 1136 | SelectFileByName(new_file_ed.text); |
1137 | EventClosePopinForm(); |
||
5555 | punk_joker | 1138 | } |
1139 | |||
5571 | punk_joker | 1140 | void NewElement_Form(byte crt, dword strng) |
5555 | punk_joker | 1141 | { |
1142 | int dform_x=files.w-220/2+files.x; |
||
5557 | punk_joker | 1143 | if (!new_element_active) |
5555 | punk_joker | 1144 | { |
5557 | punk_joker | 1145 | new_element_active = crt; |
8334 | leency | 1146 | edit_box_set_text stdcall (#new_file_ed, strng); |
5555 | punk_joker | 1147 | } |
6008 | leency | 1148 | if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL); |
1149 | else DrawEolitePopup(T_CREATE, T_CANCEL); |
||
6678 | leency | 1150 | new_file_ed.left = dform_x+10; |
6278 | leency | 1151 | DrawEditBox(#new_file_ed); |
5555 | punk_joker | 1152 | } |
1153 | |||
8780 | leency | 1154 | void EventShowAbout() |
1155 | { |
||
1156 | if (!active_about) { |
||
1157 | about_stak = malloc(4096); |
||
1158 | about_thread_id = CreateThread(#about_dialog,about_stak+4092); |
||
1159 | } else { |
||
1160 | ActivateWindow(GetProcessSlot(about_thread_id)); |
||
1161 | } |
||
1162 | } |
||
1163 | |||
5576 | pavelyakov | 1164 | void FnProcess(byte N) |
3434 | leency | 1165 | { |
1166 | switch(N) |
||
1167 | { |
||
1168 | case 1: |
||
8780 | leency | 1169 | EventShowProperties(); |
3434 | leency | 1170 | break; |
1171 | case 2: |
||
7786 | leency | 1172 | if (files.count) NewElement_Form(RENAME_ITEM, #file_name); |
3434 | leency | 1173 | break; |
1174 | case 3: |
||
8780 | leency | 1175 | if (files.count) && (!itdir) RunProgram("/sys/quark", #file_path); |
3434 | leency | 1176 | break; |
1177 | case 4: |
||
8780 | leency | 1178 | if (files.count) && (!itdir) RunProgram("/sys/develop/cedit", #file_path); |
3434 | leency | 1179 | break; |
8854 | leency | 1180 | case 5: |
1181 | if (efm) { |
||
8861 | leency | 1182 | CopyFilesListToClipboard(COPY); |
8854 | leency | 1183 | EventPaste(#inactive_path); |
8779 | leency | 1184 | } else { |
8854 | leency | 1185 | EventRefresh(); |
5719 | leency | 1186 | } |
3434 | leency | 1187 | break; |
1188 | case 6: |
||
8854 | leency | 1189 | if (efm) { |
8861 | leency | 1190 | CopyFilesListToClipboard(CUT); |
8854 | leency | 1191 | EventPaste(#inactive_path); |
1192 | } |
||
3434 | leency | 1193 | break; |
1194 | case 7: |
||
8780 | leency | 1195 | NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER); |
3434 | leency | 1196 | break; |
5447 | punk_joker | 1197 | case 8: |
8780 | leency | 1198 | Del_Form(); |
5447 | punk_joker | 1199 | break; |
8780 | leency | 1200 | case 9: |
1201 | NewElement_Form(CREATE_FILE, T_NEW_FILE); |
||
1202 | break; |
||
3434 | leency | 1203 | case 10: //F10 |
5753 | leency | 1204 | if (!active_settings) |
5416 | punk_joker | 1205 | { |
5576 | pavelyakov | 1206 | settings_stak = malloc(4096); |
1207 | settings_window = CreateThread(#settings_dialog, settings_stak+4092); |
||
5416 | punk_joker | 1208 | break; |
1209 | } |
||
1210 | else |
||
1211 | { |
||
1212 | ActivateWindow(GetProcessSlot(settings_window)); |
||
1213 | } |
||
3434 | leency | 1214 | break; |
1215 | } |
||
1216 | } |
||
1217 | |||
8854 | leency | 1218 | void EventRefresh() |
1219 | { |
||
1220 | if (efm) |
||
1221 | { |
||
1222 | DrawFilePanels(); |
||
1223 | } else { |
||
1224 | Tip(56, T_DEVICES, 55, "-"); |
||
1225 | Open_Dir(#path,WITH_REDRAW); |
||
1226 | pause(10); |
||
1227 | SystemDiscs.Get(); |
||
1228 | Open_Dir(#path,WITH_REDRAW); |
||
1229 | DrawDeviceAndActionsLeftPanel(); |
||
1230 | } |
||
1231 | } |
||
1232 | |||
5738 | leency | 1233 | void ChangeActivePanel() |
1234 | { |
||
1235 | llist_copy(#files_active, #files_inactive); |
||
1236 | llist_copy(#files_inactive, #files); |
||
1237 | strcpy(#active_path, #inactive_path); |
||
1238 | strcpy(#inactive_path, #path); |
||
1239 | DrawFilePanels(); |
||
1240 | } |
||
1241 | |||
7422 | leency | 1242 | void EventSelectFileByKeyPress() |
1243 | { |
||
1244 | int i; |
||
1245 | for (i=files.cur_y+1; i |
||
1246 | { |
||
7972 | leency | 1247 | strcpy(#temp, items.get(i)*304+buf+72); |
7422 | leency | 1248 | if (temp[0]==key_ascii) || (temp[0]==key_ascii-32) |
1249 | { |
||
1250 | files.cur_y = i - 1; |
||
1251 | files.KeyDown(); |
||
1252 | List_ReDraw(); |
||
1253 | return; |
||
1254 | } |
||
1255 | } |
||
1256 | } |
||
1257 | |||
7515 | leency | 1258 | dword GetDeviceSizeLabel(dword path) |
1259 | { |
||
1260 | BDVK bdvk; |
||
1261 | char cdname[8]; |
||
1262 | if (ESBYTE[path+1] == '/') path++; |
||
1263 | if (ESBYTE[path+1] == 'c') && (ESBYTE[path+2] == 'd') |
||
7518 | leency | 1264 | && (ESBYTE[path+4] == 0) return 0; |
7515 | leency | 1265 | GetFileInfo(path, #bdvk); |
1266 | return ConvertSize64(bdvk.sizelo, bdvk.sizehi); |
||
1267 | } |
||
1268 | |||
7422 | leency | 1269 | int GetRealFileCountInFolder(dword folder_path) |
1270 | { |
||
1271 | int fcount; |
||
1272 | dword countbuf; |
||
1273 | |||
1274 | GetDir(#countbuf, #fcount, folder_path, DIRS_NOROOT); |
||
1275 | if (countbuf) free(countbuf); |
||
1276 | |||
1277 | return fcount; |
||
1278 | } |
||
1279 | |||
1280 | void EventRefreshDisksAndFolders() |
||
1281 | { |
||
1282 | if(GetRealFileCountInFolder("/")+dir_exists("/kolibrios") != SystemDiscs.dev_num) { |
||
8854 | leency | 1283 | EventRefresh(); |
7422 | leency | 1284 | } |
8854 | leency | 1285 | if(efm) |
7422 | leency | 1286 | { |
1287 | if(GetRealFileCountInFolder(#inactive_path) != files_inactive.count) { |
||
1288 | ChangeActivePanel(); |
||
1289 | Open_Dir(#path,WITH_REDRAW); |
||
1290 | ChangeActivePanel(); |
||
1291 | } |
||
1292 | if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW); |
||
8854 | leency | 1293 | } else { |
7422 | leency | 1294 | if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW); |
1295 | } |
||
1296 | } |
||
1297 | |||
7628 | leency | 1298 | void EventSort(dword id) |
1299 | { |
||
1300 | char selected_filename[256]; |
||
1301 | if (sort_type == id) sort_desc ^= 1; |
||
1302 | else sort_type = id; |
||
1303 | strcpy(#selected_filename, #file_name); |
||
1304 | DrawList(); |
||
1305 | Open_Dir(#path,WITH_REDRAW); |
||
1306 | SelectFileByName(#selected_filename); |
||
1307 | } |
||
1308 | |||
7786 | leency | 1309 | void EventHistoryGoForward() |
1310 | { |
||
1311 | if (history.forward()) { |
||
1312 | strcpy(#path, history.current()); |
||
1313 | files.KeyHome(); |
||
1314 | Open_Dir(#path,WITH_REDRAW); |
||
1315 | } |
||
1316 | } |
||
1317 | |||
7813 | leency | 1318 | void EventOpenNewEolite() |
1319 | { |
||
1320 | RunProgram(I_Path, #path); |
||
1321 | } |
||
1322 | |||
1323 | void EventOpenConsoleHere() |
||
1324 | { |
||
1325 | sprintf(#param, "pwd cd %s", #path); |
||
1326 | RunProgram("/sys/shell", #param); |
||
1327 | } |
||
1328 | |||
7786 | leency | 1329 | void ProceedMouseGestures() |
1330 | { |
||
1331 | char stats; |
||
1332 | signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; |
||
1333 | if (!mouse.mkm) && (stats>0) stats = 0; |
||
1334 | if (mouse.mkm) && (!stats) |
||
1335 | { |
||
1336 | x_old = mouse.x; |
||
1337 | y_old = mouse.y; |
||
1338 | stats = 1; |
||
1339 | } |
||
1340 | if (mouse.mkm) && (stats==1) |
||
1341 | { |
||
1342 | dif_x = mouse.x-x_old; |
||
1343 | dif_y = mouse.y-y_old; |
||
1344 | adif_x = fabs(dif_x); |
||
1345 | adif_y = fabs(dif_y); |
||
1346 | |||
1347 | if (adif_x>adif_y) { |
||
1348 | if (dif_x > 150) { |
||
1349 | EventHistoryGoForward(); |
||
1350 | stats = 0; |
||
1351 | } |
||
1352 | if (dif_x < -150) { |
||
1353 | EventHistoryGoBack(); |
||
1354 | stats = 0; |
||
1355 | } |
||
1356 | } else { |
||
1357 | if (dif_y < -100) { |
||
1358 | Dir_Up(); |
||
1359 | stats = 0; |
||
1360 | } |
||
1361 | } |
||
1362 | } |
||
1363 | } |
||
1364 | |||
8854 | leency | 1365 | void EventPaste(dword _into_path) { |
7878 | leency | 1366 | char paste_line[4096+6]; |
8854 | leency | 1367 | sprintf(#paste_line, "-v%i %s", cut_active, _into_path); |
7878 | leency | 1368 | RunProgram(#program_path, #paste_line); |
1369 | EventClosePopinForm(); |
||
1370 | } |
||
1371 | |||
1372 | void EventDelete() |
||
1373 | { |
||
8861 | leency | 1374 | char line_param[4096+5]; |
1375 | CopyFilesListToClipboard(DELETE); |
||
7878 | leency | 1376 | EventClosePopinForm(); |
8861 | leency | 1377 | sprintf(#line_param, "-d %s", #file_path); |
1378 | RunProgram(#program_path, #line_param); |
||
7878 | leency | 1379 | } |
1380 | |||
1381 | void EventClosePopinForm() |
||
1382 | { |
||
8854 | leency | 1383 | del_active = 0; |
7878 | leency | 1384 | new_element_active = 0; |
8854 | leency | 1385 | dev_popin_active_on_panel = 0; |
7878 | leency | 1386 | draw_window(); |
1387 | } |
||
1388 | |||
1389 | void EventShowProperties() |
||
1390 | char line_param[4096+5]; |
||
1391 | { |
||
1392 | if (!selected_count) { |
||
1393 | sprintf(#line_param, "-p %s", #file_path); |
||
1394 | RunProgram(#program_path, #line_param); |
||
1395 | } else { |
||
1396 | properties_stak = malloc(8096); |
||
1397 | CreateThread(#properties_dialog, properties_stak+8092); |
||
1398 | } |
||
1399 | } |
||
1400 | |||
7989 | leency | 1401 | void EventChooseFile(int _id) |
1402 | { |
||
1403 | if (getElementSelectedFlag(_id) == true) { |
||
1404 | setElementSelectedFlag(_id, false); |
||
1405 | } else { |
||
1406 | setElementSelectedFlag(_id, true); |
||
1407 | } |
||
7993 | leency | 1408 | } |
1409 | |||
1410 | void EventChooseFilesRange(int _start, _end) |
||
1411 | { |
||
1412 | if (_start > _end) _start >< _end; |
||
1413 | if (_end - _start > 1) list_full_redraw = true; |
||
1414 | while (_start < _end) { |
||
1415 | EventChooseFile(_start); |
||
1416 | _start++; |
||
1417 | } |
||
7989 | leency | 1418 | DrawStatusBar(); |
7993 | leency | 1419 | List_ReDraw(); |
7989 | leency | 1420 | } |
1421 | |||
7993 | leency | 1422 | void EventChooseAllFiles(dword state) |
1423 | { |
||
1424 | int i; |
||
1425 | for (i=0; i |
||
1426 | List_ReDraw(); |
||
1427 | DrawStatusBar(); |
||
1428 | } |
||
1429 | |||
8854 | leency | 1430 | void EventToolbarButtonClick(int _btid) |
1431 | { |
||
1432 | switch(_btid) { |
||
1433 | case BACK_BTN: EventHistoryGoBack(); break; |
||
1434 | case FWRD_BTN: EventHistoryGoForward(); break; |
||
1435 | case GOUP_BTN: Dir_Up(); break; |
||
8861 | leency | 1436 | case COPY_BTN: CopyFilesListToClipboard(CUT); break; |
1437 | case CUT_BTN: CopyFilesListToClipboard(COPY); break; |
||
8854 | leency | 1438 | case PASTE_BTN:EventPaste(#path); break; |
1439 | } |
||
1440 | } |
||
7993 | leency | 1441 | |
8854 | leency | 1442 | void EventDriveClick(int __id) |
1443 | { |
||
1444 | if (dev_popin_active_on_panel != active_panel) { |
||
1445 | if (active_panel == 1) active_panel=2; else active_panel=1; |
||
1446 | ChangeActivePanel(); |
||
1447 | } |
||
7993 | leency | 1448 | |
8854 | leency | 1449 | SystemDiscs.Click(__id-100); |
1450 | if (efm) { |
||
1451 | draw_window(); |
||
1452 | } |
||
1453 | } |
||
1454 | |||
3363 | leency | 1455 | stop:>>>>28)> |