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