Rev 6505 | Rev 6570 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6278 | leency | 1 | //Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2016 |
3363 | leency | 2 | //GNU GPL licence. |
3 | |||
4022 | leency | 4 | #ifndef AUTOBUILD |
5 | #include "lang.h--" |
||
6 | #endif |
||
7 | |||
3363 | leency | 8 | //libraries |
5974 | leency | 9 | #define MEMSIZE 4096 * 180 |
4427 | punk_joker | 10 | #include "..\lib\clipboard.h" |
3363 | leency | 11 | #include "..\lib\strings.h" |
12 | #include "..\lib\mem.h" |
||
13 | #include "..\lib\file_system.h" |
||
5499 | leency | 14 | #include "..\lib\gui.h" |
3434 | leency | 15 | #include "..\lib\list_box.h" |
4863 | leency | 16 | #include "..\lib\random.h" |
5743 | leency | 17 | #include "..\lib\font.h" |
5960 | leency | 18 | #include "..\lib\collection.h" |
5499 | leency | 19 | #include "..\lib\obj\libini.h" |
20 | #include "..\lib\obj\box_lib.h" |
||
5977 | leency | 21 | #include "..\lib\patterns\history.h" |
5834 | pavelyakov | 22 | |
3363 | leency | 23 | //images |
24 | #include "imgs\left_p.txt" |
||
4846 | leency | 25 | #include "imgs\icons.txt" |
3363 | leency | 26 | |
6278 | leency | 27 | //Button IDs |
28 | enum { |
||
29 | POPUP_BTN1 = 201, |
||
6289 | leency | 30 | POPUP_BTN2 = 202, |
31 | BREADCRUMB_ID = 300 |
||
6278 | leency | 32 | }; |
3444 | leency | 33 | |
6278 | leency | 34 | //NewElement options |
35 | enum { |
||
36 | CREATE_FILE=1, |
||
37 | CREATE_FOLDER, |
||
38 | RENAME_ITEM |
||
39 | }; |
||
40 | |||
41 | //OpenDir options |
||
42 | enum { |
||
43 | ONLY_SHOW, |
||
44 | WITH_REDRAW, |
||
45 | ONLY_OPEN |
||
46 | }; |
||
47 | |||
6191 | leency | 48 | dword col_padding, col_selec, col_lpanel, col_work, col_graph; |
3363 | leency | 49 | |
3434 | leency | 50 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
3363 | leency | 51 | |
4136 | punk_joker | 52 | byte active_about=0; |
4070 | punk_joker | 53 | word about_window; |
5416 | punk_joker | 54 | word settings_window; |
5753 | leency | 55 | byte active_settings=0; |
5606 | pavelyakov | 56 | dword _not_draw = false; |
4136 | punk_joker | 57 | byte menu_call_mouse=0; |
6403 | punk_joker | 58 | byte exif_load=0; |
4136 | punk_joker | 59 | |
5733 | leency | 60 | byte del_active=0; |
61 | byte new_element_active=0; |
||
5698 | leency | 62 | |
5733 | leency | 63 | llist files, files_active, files_inactive; |
3434 | leency | 64 | |
5694 | leency | 65 | byte list_full_redraw; |
66 | |||
5698 | leency | 67 | dword buf; |
68 | dword file_mas[6898]; |
||
69 | int selected_count; |
||
6406 | punk_joker | 70 | int count_dir; |
5698 | leency | 71 | |
3434 | leency | 72 | byte |
3363 | leency | 73 | path[4096], |
5833 | pavelyakov | 74 | DefaultPath[4096], |
3363 | leency | 75 | file_path[4096], |
3404 | leency | 76 | file_name[256], |
5555 | punk_joker | 77 | new_element_name[256], |
5698 | leency | 78 | temp[4096], |
6404 | punk_joker | 79 | status_bar_str[50], |
3441 | leency | 80 | itdir; |
3363 | leency | 81 | |
5719 | leency | 82 | char active_path[4096], inactive_path[4096]; |
5698 | leency | 83 | |
5441 | leency | 84 | dword eolite_ini_path; |
85 | |||
5698 | leency | 86 | char scroll_used=false; |
5695 | leency | 87 | |
5804 | punk_joker | 88 | dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak,delete_stak; |
5608 | leency | 89 | |
3363 | leency | 90 | proc_info Form; |
5960 | leency | 91 | int mouse_dd, sc_slider_h; |
3434 | leency | 92 | int j, i; |
4028 | leency | 93 | int action_buf; |
4863 | leency | 94 | int rand_n; |
5591 | pavelyakov | 95 | byte CMD_REFRESH; |
3363 | leency | 96 | |
5748 | leency | 97 | //struct t_settings { |
6291 | leency | 98 | char sort_num=2; |
99 | bool show_dev_name=true, |
||
6505 | punk_joker | 100 | real_files_names_case=true, |
5748 | leency | 101 | info_after_copy=false, |
102 | two_panels=false, |
||
6289 | leency | 103 | show_breadcrumb=false, |
6505 | punk_joker | 104 | show_status_bar=true, |
5748 | leency | 105 | active_panel=1; |
106 | //} settings; |
||
5549 | punk_joker | 107 | |
6564 | leency | 108 | #define STATUS_BAR_H 16; |
109 | int status_bar_h = 0; |
||
110 | |||
5581 | leency | 111 | edit_box new_file_ed = {171,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0,248,#new_element_name,#mouse_dd,100000000000010b,6,0}; |
3363 | leency | 112 | PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
5694 | leency | 113 | byte cmd_free=0; |
5698 | leency | 114 | #include "include\translations.h" |
5804 | punk_joker | 115 | #include "include\fs.h" |
5834 | pavelyakov | 116 | |
117 | char *fd_path_eolite_ini_path; |
||
118 | |||
5748 | leency | 119 | #include "include\settings.h" |
5804 | punk_joker | 120 | #include "include\progress_dialog.h" |
121 | #include "..\lib\copyf.h" |
||
4042 | leency | 122 | #include "include\copy.h" |
5435 | leency | 123 | #include "include\gui.h" |
3363 | leency | 124 | #include "include\sorting.h" |
4042 | leency | 125 | #include "include\icons.h" |
3363 | leency | 126 | #include "include\left_panel.h" |
4042 | leency | 127 | #include "include\menu.h" |
6278 | leency | 128 | #include "include\delete.h" |
4042 | leency | 129 | #include "include\about.h" |
5447 | punk_joker | 130 | #include "include\properties.h" |
6289 | leency | 131 | #include "include\breadcrumbs.h" |
3363 | leency | 132 | |
133 | void main() |
||
134 | { |
||
6289 | leency | 135 | dword id; |
5834 | pavelyakov | 136 | byte count_sl = 0; |
5748 | leency | 137 | signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; |
5695 | leency | 138 | char can_show, can_select, stats; |
4897 | leency | 139 | dword selected_offset; |
5591 | pavelyakov | 140 | dword IPC_LEN,IPC_ID; |
141 | char IPC_BUF[10]; |
||
4863 | leency | 142 | rand_n = random(40); |
5651 | pavelyakov | 143 | |
5626 | leency | 144 | load_dll(boxlib, #box_lib_init,0); |
5991 | leency | 145 | load_dll(libini, #lib_init,1); |
5974 | leency | 146 | |
5743 | leency | 147 | eolite_ini_path = abspath("Eolite.ini"); |
5834 | pavelyakov | 148 | fd_path_eolite_ini_path = "/fd/1/File Managers/Eolite.ini"; |
149 | |||
5441 | leency | 150 | LoadIniSettings(); |
6034 | leency | 151 | SystemDiscs.Get(); |
4076 | leency | 152 | SetAppColors(); |
3363 | leency | 153 | if (param) |
154 | { |
||
5743 | leency | 155 | strcpy(#path, #param); |
156 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string |
||
5833 | pavelyakov | 157 | } |
158 | |||
5733 | leency | 159 | Open_Dir(#path,ONLY_OPEN); |
5719 | leency | 160 | strcpy(#inactive_path, #path); |
5733 | leency | 161 | llist_copy(#files_inactive, #files); |
5606 | pavelyakov | 162 | SetEventMask(1100111b); |
5591 | pavelyakov | 163 | loop(){ |
164 | switch(WaitEvent()) |
||
165 | { |
||
166 | case evMouse: |
||
167 | if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break; |
||
168 | if (new_element_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) |
||
169 | { |
||
170 | edit_box_mouse stdcall(#new_file_ed); |
||
171 | break; |
||
172 | } |
||
5549 | punk_joker | 173 | |
5640 | pavelyakov | 174 | mouse.get(); |
5591 | pavelyakov | 175 | |
5640 | pavelyakov | 176 | if (!mouse.mkm) && (stats>0) stats = 0; |
5657 | pavelyakov | 177 | if (mouse.mkm) && (!stats) |
5549 | punk_joker | 178 | { |
5640 | pavelyakov | 179 | x_old = mouse.x; |
180 | y_old = mouse.y; |
||
5591 | pavelyakov | 181 | stats = 1; |
182 | } |
||
5640 | pavelyakov | 183 | if (mouse.mkm) && (stats==1) |
5591 | pavelyakov | 184 | { |
5640 | pavelyakov | 185 | dif_x = mouse.x-x_old; |
186 | dif_y = mouse.y-y_old; |
||
5591 | pavelyakov | 187 | adif_x = fabs(dif_x); |
188 | adif_y = fabs(dif_y); |
||
189 | |||
190 | if (adif_x>adif_y) |
||
5549 | punk_joker | 191 | { |
5591 | pavelyakov | 192 | if (dif_x > 150) |
193 | { |
||
6021 | leency | 194 | if (history.forward()) |
5591 | pavelyakov | 195 | { |
6021 | leency | 196 | strcpy(#path, history.current()); |
5694 | leency | 197 | files.KeyHome(); |
5591 | pavelyakov | 198 | Open_Dir(#path,WITH_REDRAW); |
199 | } |
||
200 | stats = 0; |
||
201 | } |
||
202 | if (dif_x < -150) |
||
203 | { |
||
204 | GoBack(); |
||
205 | stats = 0; |
||
206 | } |
||
5549 | punk_joker | 207 | } |
5591 | pavelyakov | 208 | else |
5549 | punk_joker | 209 | { |
5591 | pavelyakov | 210 | if (dif_y < -100) |
211 | { |
||
212 | Dir_Up(); |
||
213 | stats = 0; |
||
214 | } |
||
5549 | punk_joker | 215 | } |
5591 | pavelyakov | 216 | } |
6191 | leency | 217 | if (files.MouseOver(mouse.x, mouse.y)) |
5549 | punk_joker | 218 | { |
6191 | leency | 219 | //select file |
6278 | leency | 220 | if (mouse.key&MOUSE_LEFT) && (mouse.up) |
5575 | pavelyakov | 221 | { |
6191 | leency | 222 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
6278 | leency | 223 | else if (mouse.dblclick)) Open(0); |
6191 | leency | 224 | } |
225 | //file menu |
||
6278 | leency | 226 | if (mouse.key&MOUSE_RIGHT) |
6191 | leency | 227 | { |
5591 | pavelyakov | 228 | menu_call_mouse = 1; |
6278 | leency | 229 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
230 | menu_stak = malloc(4096); |
||
231 | CreateThread(#FileMenu,menu_stak+4092); |
||
5591 | pavelyakov | 232 | break; |
5575 | pavelyakov | 233 | } |
234 | } |
||
5591 | pavelyakov | 235 | |
5640 | pavelyakov | 236 | if (mouse.vert) |
5575 | pavelyakov | 237 | { |
5640 | pavelyakov | 238 | if (files.MouseScroll(mouse.vert)) List_ReDraw(); |
5591 | pavelyakov | 239 | break; |
240 | } |
||
241 | |||
5723 | leency | 242 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y-17) && (mouse.y |
5591 | pavelyakov | 243 | { |
5723 | leency | 244 | if (mouse.lkm==1) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,0xC7C7C7,0xFFFFFF); |
5640 | pavelyakov | 245 | WHILE (mouse.lkm==1) && (files.first>0) |
5575 | pavelyakov | 246 | { |
5591 | pavelyakov | 247 | pause(8); |
248 | files.first--; |
||
249 | List_ReDraw(); |
||
5640 | pavelyakov | 250 | mouse.get(); |
5575 | pavelyakov | 251 | } |
5723 | leency | 252 | DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,0xFFFFFF,0xC7C7C7); |
5575 | pavelyakov | 253 | } |
3363 | leency | 254 | |
5723 | leency | 255 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y+files.h-16) && (mouse.y |
3363 | leency | 256 | { |
5723 | leency | 257 | if (mouse.lkm==1) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,0xC7C7C7,0xFFFFFF); |
5640 | pavelyakov | 258 | while (mouse.lkm==1) && (files.first |
5591 | pavelyakov | 259 | { |
260 | pause(8); |
||
261 | files.first++; |
||
262 | List_ReDraw(); |
||
5640 | pavelyakov | 263 | mouse.get(); |
5591 | pavelyakov | 264 | } |
5723 | leency | 265 | DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,0xFFFFFF,0xC7C7C7); |
3363 | leency | 266 | } |
267 | |||
5591 | pavelyakov | 268 | //Scrooll |
5695 | leency | 269 | if (!mouse.lkm) && (scroll_used) { scroll_used=false; Scroll(); } |
5723 | leency | 270 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) && (mouse.y |
5591 | pavelyakov | 271 | |
272 | if (scroll_used) |
||
3363 | leency | 273 | { |
5640 | pavelyakov | 274 | 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 |
5723 | leency | 275 | id = files.first; |
276 | files.first = -sc_slider_h / 2 + mouse.y -j -files.y * files.count; |
||
5743 | leency | 277 | files.first /= files.h - 18; |
5591 | pavelyakov | 278 | if (files.visible+files.first>files.count) files.first=files.count-files.visible; |
5743 | leency | 279 | if (files.first<0) files.first=0; |
5591 | pavelyakov | 280 | if (id!=files.first) List_ReDraw(); |
5719 | leency | 281 | break; |
3363 | leency | 282 | } |
5719 | leency | 283 | |
5735 | leency | 284 | if (two_panels) && (mouse.y > files.y) && (mouse.down) { |
5719 | leency | 285 | if (mouse.x |
286 | { |
||
287 | if (active_panel!=1) |
||
288 | { |
||
289 | active_panel = 1; |
||
5738 | leency | 290 | ChangeActivePanel(); |
5719 | leency | 291 | } |
292 | } |
||
293 | else |
||
294 | { |
||
295 | if (active_panel!=2) |
||
296 | { |
||
297 | active_panel = 2; |
||
5738 | leency | 298 | ChangeActivePanel(); |
5719 | leency | 299 | } |
300 | } |
||
301 | } |
||
5591 | pavelyakov | 302 | break; |
303 | //Button pressed----------------------------------------------------------------------------- |
||
304 | case evButton: |
||
6278 | leency | 305 | id=GetButtonID(); |
5591 | pavelyakov | 306 | switch(id) |
307 | { |
||
6278 | leency | 308 | case 01: |
309 | KillProcess(about_window); |
||
310 | SaveIniSettings(); |
||
311 | ExitProcess(); |
||
5591 | pavelyakov | 312 | case 21: //Back |
313 | GoBack(); |
||
314 | break; |
||
315 | case 22: //Forward |
||
6021 | leency | 316 | if (history.forward()) |
5591 | pavelyakov | 317 | { |
6021 | leency | 318 | strcpy(#path, history.current()); |
5694 | leency | 319 | files.KeyHome(); |
5591 | pavelyakov | 320 | Open_Dir(#path,WITH_REDRAW); |
321 | } |
||
322 | break; |
||
5608 | leency | 323 | case 23: |
3363 | leency | 324 | Dir_Up(); |
325 | break; |
||
5608 | leency | 326 | case 24: |
3444 | leency | 327 | Copy(#file_path, CUT); |
328 | break; |
||
5608 | leency | 329 | case 25: |
3444 | leency | 330 | Copy(#file_path, NOCUT); |
3363 | leency | 331 | break; |
5608 | leency | 332 | case 26: |
333 | Paste(); |
||
3363 | leency | 334 | break; |
5733 | leency | 335 | case 31...33: //sorting |
336 | sort_num = id - 30; |
||
337 | DrawList(); |
||
5591 | pavelyakov | 338 | Open_Dir(#path,WITH_REDRAW); |
5512 | punk_joker | 339 | break; |
5591 | pavelyakov | 340 | case 50...60: //Actions |
341 | FnProcess(id-50); |
||
5512 | punk_joker | 342 | break; |
5591 | pavelyakov | 343 | case 100...120: |
6034 | leency | 344 | SystemDiscs.Click(id-100); |
5698 | leency | 345 | break; |
6300 | punk_joker | 346 | case POPUP_BTN1...POPUP_BTN2: |
347 | if (del_active) Del_File(id-POPUP_BTN2); |
||
6278 | leency | 348 | if (new_element_active) NewElement(id-POPUP_BTN2); |
349 | DeleteButton(POPUP_BTN1); |
||
350 | DeleteButton(POPUP_BTN2); |
||
351 | break; |
||
6289 | leency | 352 | case BREADCRUMB_ID...400: |
353 | ClickOnBreadCrumb(id-BREADCRUMB_ID); |
||
354 | break; |
||
5591 | pavelyakov | 355 | } |
356 | break; |
||
357 | //Key pressed----------------------------------------------------------------------------- |
||
358 | case evKey: |
||
5706 | leency | 359 | GetKeys(); |
5698 | leency | 360 | |
5591 | pavelyakov | 361 | if (Form.status_window>2) break; |
362 | if (del_active) |
||
363 | { |
||
5706 | leency | 364 | if (key_scancode == SCAN_CODE_ENTER) Del_File(true); |
365 | if (key_scancode == SCAN_CODE_ESC) Del_File(false); |
||
5591 | pavelyakov | 366 | break; |
367 | } |
||
368 | if (new_element_active) |
||
369 | { |
||
5991 | leency | 370 | if (key_scancode == SCAN_CODE_ENTER) NewElement(true); |
371 | if (key_scancode == SCAN_CODE_ESC) NewElement(false); |
||
5706 | leency | 372 | EAX= key_ascii << 8; |
5591 | pavelyakov | 373 | edit_box_key stdcall (#new_file_ed); |
374 | break; |
||
375 | } |
||
5706 | leency | 376 | if (files.ProcessKey(key_scancode)) |
5694 | leency | 377 | { |
378 | List_ReDraw(); |
||
379 | break; |
||
380 | } |
||
5698 | leency | 381 | |
5795 | leency | 382 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) |
5591 | pavelyakov | 383 | { |
5706 | leency | 384 | switch(key_scancode) |
5697 | punk_joker | 385 | { |
5702 | punk_joker | 386 | case 059...068: |
5706 | leency | 387 | key_scancode -= 59; |
6034 | leency | 388 | if (key_scancode < SystemDiscs.list.count) |
5702 | punk_joker | 389 | { |
5723 | leency | 390 | if (!two_panels) |
391 | { |
||
392 | DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click |
||
393 | pause(7); |
||
394 | } |
||
6034 | leency | 395 | SystemDiscs.Click(key_scancode); |
5702 | punk_joker | 396 | } |
397 | break; |
||
5697 | punk_joker | 398 | case 45: //Ctrl+X |
399 | Copy(#file_path, CUT); |
||
400 | break; |
||
401 | case 46: //Ctrl+C |
||
402 | Copy(#file_path, NOCUT); |
||
403 | break; |
||
404 | case 47: //Ctrl+V |
||
405 | Paste(); |
||
406 | break; |
||
407 | case 032: //Ctrl+D - set as bg |
||
5803 | leency | 408 | strlcpy(#temp, "\\S__",4); |
5591 | pavelyakov | 409 | strcat(#temp, #file_path); |
410 | RunProgram("/sys/media/kiv", #temp); |
||
411 | break; |
||
5697 | punk_joker | 412 | case 049: //Ctrl+N - create new window |
5591 | pavelyakov | 413 | if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD); |
414 | RunProgram("/sys/File Managers/Eolite", #path); |
||
415 | break; |
||
6157 | punk_joker | 416 | case 050: //Ctrl+M |
417 | Open_Dir(#inactive_path,WITH_REDRAW); |
||
418 | break; |
||
6278 | leency | 419 | case SCAN_CODE_ENTER: //Ctrl+Enter |
5702 | punk_joker | 420 | if (!itdir) ShowOpenWithDialog(); |
421 | else Open(1); |
||
422 | break; |
||
5697 | punk_joker | 423 | case 030: //Ctrl+A - select all files |
5591 | pavelyakov | 424 | for (i=0; i |
3363 | leency | 425 | { |
5591 | pavelyakov | 426 | selected_offset = file_mas[i]*304 + buf+32 + 7; |
5661 | leency | 427 | if (!i) if (!strncmp(selected_offset+33, "..", 2)) continue; //do not selec ".." directory |
5591 | pavelyakov | 428 | ESBYTE[selected_offset] = 1; |
429 | selected_count++; |
||
3363 | leency | 430 | } |
5591 | pavelyakov | 431 | List_ReDraw(); |
6564 | leency | 432 | DrawStatusBar(); |
5591 | pavelyakov | 433 | break; |
5697 | punk_joker | 434 | case 022: //Ctrl+U - unselect all files |
5591 | pavelyakov | 435 | for (i=0; i |
436 | { |
||
437 | selected_offset = file_mas[i]*304 + buf+32 + 7; |
||
438 | ESBYTE[selected_offset] = 0; |
||
439 | } |
||
440 | selected_count = 0; |
||
441 | List_ReDraw(); |
||
6564 | leency | 442 | DrawStatusBar(); |
5591 | pavelyakov | 443 | break; |
5697 | punk_joker | 444 | } |
445 | break; |
||
446 | } |
||
5698 | leency | 447 | |
5706 | leency | 448 | switch (key_scancode) |
5697 | punk_joker | 449 | { |
5702 | punk_joker | 450 | case SCAN_CODE_BS: |
5697 | punk_joker | 451 | //GoBack(); |
452 | Dir_Up(); |
||
453 | break; |
||
5702 | punk_joker | 454 | case SCAN_CODE_ENTER: |
5591 | pavelyakov | 455 | Open(0); |
456 | break; |
||
5738 | leency | 457 | case SCAN_CODE_TAB: |
458 | if (!two_panels) break; |
||
459 | if (active_panel==1) active_panel=2; else active_panel=1; |
||
460 | ChangeActivePanel(); |
||
6564 | leency | 461 | DrawStatusBar(); |
5738 | leency | 462 | break; |
5702 | punk_joker | 463 | case 093: //menu |
5591 | pavelyakov | 464 | menu_call_mouse=0; |
465 | menu_stak = malloc(4096); |
||
466 | CreateThread(#FileMenu,menu_stak+4092); |
||
467 | break; |
||
5702 | punk_joker | 468 | case SCAN_CODE_DEL: |
5591 | pavelyakov | 469 | Del_Form(); |
470 | break; |
||
5702 | punk_joker | 471 | case SCAN_CODE_INS: |
5825 | leency | 472 | selected_offset = file_mas[files.cur_y]*304 + buf+32 + 7; |
473 | if (files.cur_y==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory |
||
5591 | pavelyakov | 474 | if (ESBYTE[selected_offset]) |
475 | { |
||
476 | ESBYTE[selected_offset]=0; |
||
477 | selected_count--; |
||
478 | } |
||
479 | else |
||
480 | { |
||
481 | ESBYTE[selected_offset] = 1; |
||
482 | selected_count++; |
||
483 | } |
||
5661 | leency | 484 | _INSERT_END: |
5955 | leency | 485 | files.KeyDown(); |
486 | List_ReDraw(); |
||
6564 | leency | 487 | DrawStatusBar(); |
5591 | pavelyakov | 488 | break; |
5702 | punk_joker | 489 | case 059...068: //F1-F10 |
5706 | leency | 490 | FnProcess(key_scancode-58); |
5591 | pavelyakov | 491 | break; |
5974 | leency | 492 | default: |
5825 | leency | 493 | for (i=files.cur_y+1; i |
5591 | pavelyakov | 494 | { |
495 | strcpy(#temp, file_mas[i]*304+buf+72); |
||
5706 | leency | 496 | if (temp[0]==key_ascii) || (temp[0]==key_ascii-32) |
5591 | pavelyakov | 497 | { |
5825 | leency | 498 | files.cur_y = i - 1; |
5694 | leency | 499 | files.KeyDown(); |
500 | List_ReDraw(); |
||
5591 | pavelyakov | 501 | break; |
502 | } |
||
503 | } |
||
504 | } |
||
3363 | leency | 505 | break; |
5698 | leency | 506 | case evIPC: |
5591 | pavelyakov | 507 | case evReDraw: |
508 | draw_window(); |
||
509 | if (action_buf) |
||
510 | { |
||
5804 | punk_joker | 511 | if (action_buf==OPERATION_END) |
5698 | leency | 512 | { |
513 | FnProcess(5); |
||
5991 | leency | 514 | if (copy_stak) SelectFileByName(#copy_to+strrchr(#copy_to,'/')); |
5698 | leency | 515 | } |
516 | if (action_buf==100) Open(0); |
||
517 | if (action_buf==201) ShowOpenWithDialog(); |
||
518 | if (action_buf==202) FnProcess(3); //F3 |
||
519 | if (action_buf==203) FnProcess(4); //F4 |
||
520 | if (action_buf==104) Copy(#file_path, NOCUT); |
||
521 | if (action_buf==105) Copy(#file_path, CUT); |
||
522 | if (action_buf==106) Paste(); |
||
523 | if (action_buf==207) FnProcess(2); |
||
524 | if (action_buf==108) Del_Form(); |
||
525 | if (action_buf==109) FnProcess(5); |
||
526 | if (action_buf==110) FnProcess(8); |
||
5591 | pavelyakov | 527 | action_buf=0; |
528 | } |
||
529 | } |
||
530 | if(cmd_free) |
||
531 | { |
||
5991 | leency | 532 | if(cmd_free==1) menu_stak=free(menu_stak); |
533 | else if(cmd_free==2) about_stak=free(about_stak); |
||
534 | else if(cmd_free==3) properties_stak=free(properties_stak); |
||
535 | else if(cmd_free==4) settings_stak=free(settings_stak); |
||
536 | else if(cmd_free==5) copy_stak=free(copy_stak); |
||
537 | else if(cmd_free==6) delete_stak=free(delete_stak); |
||
5591 | pavelyakov | 538 | cmd_free = false; |
5576 | pavelyakov | 539 | } |
540 | } |
||
3363 | leency | 541 | } |
542 | |||
6291 | leency | 543 | void DrawFavButton(int x) |
544 | { |
||
545 | _PutImage(x,10,20,22,#fav); |
||
546 | DefineButton(x,11,20-2,22-2,61+BT_HIDE+BT_NOFRAME,0); |
||
547 | } |
||
548 | |||
3444 | leency | 549 | void draw_window() |
550 | { |
||
6564 | leency | 551 | if (show_status_bar) status_bar_h = STATUS_BAR_H; else status_bar_h = 0; |
6191 | leency | 552 | DefineAndDrawWindow(WinX+rand_n,WinY+rand_n,WinW,WinH,0x73,NULL,TITLE,0); |
3444 | leency | 553 | GetProcessInfo(#Form, SelfInfo); |
554 | if (Form.status_window>2) return; |
||
5811 | leency | 555 | if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; } |
556 | if (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; } |
||
3444 | leency | 557 | GetProcessInfo(#Form, SelfInfo); //if win_size changed |
6291 | leency | 558 | _PutImage(0,0,246,34,#toolbar); |
6191 | leency | 559 | DrawBar(127, 8, 1, 25, col_graph); |
560 | for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,NULL); |
||
561 | for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,NULL); |
||
6289 | leency | 562 | DrawBar(246,0, Form.cwidth - 246, 34, col_work); |
6291 | leency | 563 | _PutImage(Form.cwidth-17,11,6,18,#dots); |
564 | DefineButton(Form.cwidth-24,7,20,25,51+BT_HIDE+BT_NOFRAME,0); //dots |
||
3434 | leency | 565 | //main rectangles |
6564 | leency | 566 | DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,col_graph); |
5698 | leency | 567 | DrawRectangle(0,39,Form.cwidth-1,Form.cheight - 40,col_palette[4]); //bg |
5723 | leency | 568 | for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]); |
5733 | leency | 569 | llist_copy(#files_active, #files); |
5723 | leency | 570 | strcpy(#active_path, #path); |
6564 | leency | 571 | DrawStatusBar(); |
5723 | leency | 572 | DrawFilePanels(); |
573 | if (del_active) Del_Form(); |
||
574 | if (new_element_active) NewElement_Form(new_element_active, #new_element_name); |
||
575 | } |
||
576 | |||
577 | void DrawList() |
||
578 | { |
||
5733 | leency | 579 | word sorting_arrow_x; |
6050 | leency | 580 | DrawFlatButton(files.x, files.y-17, files.w - 141,16,31,T_FILE); |
581 | DrawFlatButton(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE); |
||
582 | DrawFlatButton(files.x + files.w - 68, files.y-17,68,16,33,T_SIZE); |
||
583 | DrawFlatButton(files.x + files.w, files.y-17,16,16, 0,"\x18"); |
||
584 | DrawFlatButton(files.x + files.w,files.y+files.h-16,16,16,0,"\x19"); |
||
5733 | leency | 585 | if (sort_num==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18; |
586 | if (sort_num==2) sorting_arrow_x = files.x + files.w - 90; |
||
587 | if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
||
6191 | leency | 588 | WriteText(sorting_arrow_x,files.y-12,0x80,col_graph,"\x19"); |
589 | DrawBar(files.x+files.w,files.y,1,files.h,col_graph); |
||
590 | if (two_panels) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,col_graph); |
||
5723 | leency | 591 | } |
592 | |||
6404 | punk_joker | 593 | void DrawStatusBar() |
594 | { |
||
6564 | leency | 595 | if (!show_status_bar) return; |
596 | DrawBar(1, Form.cheight - status_bar_h-1, Form.cwidth-2, status_bar_h, system.color.work); |
||
6406 | punk_joker | 597 | sprintf(#status_bar_str, STATUS_STR, files.count-1, count_dir-1, files.count-count_dir, selected_count); |
6404 | punk_joker | 598 | WriteText(6,Form.cheight - 13,0x80,0x000000,#status_bar_str); |
599 | } |
||
600 | |||
5723 | leency | 601 | void DrawFilePanels() |
602 | { |
||
6034 | leency | 603 | int files_y; |
5698 | leency | 604 | if (!two_panels) |
605 | { |
||
5723 | leency | 606 | DrawDeviceAndActionsLeftPanel(); |
6564 | leency | 607 | files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h); |
5719 | leency | 608 | DrawList(); |
5733 | leency | 609 | Open_Dir(#path,ONLY_SHOW); |
5698 | leency | 610 | } |
611 | else |
||
612 | { |
||
6158 | leency | 613 | SystemDiscs.Get(); |
5733 | leency | 614 | llist_copy(#files, #files_inactive); |
615 | strcpy(#path, #inactive_path); |
||
616 | col_selec = 0xCCCccc; |
||
6034 | leency | 617 | SystemDiscs.Draw(); |
618 | files_y = files.y; |
||
5733 | leency | 619 | |
5719 | leency | 620 | if (active_panel==1) |
621 | { |
||
5761 | leency | 622 | llist_copy(#files, #files_inactive); |
623 | strcpy(#path, #inactive_path); |
||
624 | col_selec = 0xCCCccc; |
||
6564 | leency | 625 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
5719 | leency | 626 | DrawList(); |
5733 | leency | 627 | Open_Dir(#path,WITH_REDRAW); |
628 | llist_copy(#files, #files_active); |
||
5719 | leency | 629 | strcpy(#path, #active_path); |
5733 | leency | 630 | col_selec = 0x94AECE; |
6564 | leency | 631 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
5719 | leency | 632 | DrawList(); |
5733 | leency | 633 | Open_Dir(#path,WITH_REDRAW); |
5719 | leency | 634 | } |
635 | if (active_panel==2) |
||
636 | { |
||
6564 | leency | 637 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
5719 | leency | 638 | DrawList(); |
5733 | leency | 639 | Open_Dir(#path,WITH_REDRAW); |
640 | llist_copy(#files, #files_active); |
||
5719 | leency | 641 | strcpy(#path, #active_path); |
5733 | leency | 642 | col_selec = 0x94AECE; |
6564 | leency | 643 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
5719 | leency | 644 | DrawList(); |
5733 | leency | 645 | Open_Dir(#path,WITH_REDRAW); |
5719 | leency | 646 | } |
5698 | leency | 647 | } |
3363 | leency | 648 | } |
649 | |||
650 | |||
5694 | leency | 651 | void List_ReDraw() |
3363 | leency | 652 | { |
5719 | leency | 653 | int all_lines_h; |
5825 | leency | 654 | static int old_cur_y, old_first; |
3363 | leency | 655 | |
5694 | leency | 656 | files.CheckDoesValuesOkey(); //prevent some shit |
3363 | leency | 657 | |
5694 | leency | 658 | if (list_full_redraw) || (old_first != files.first) |
3363 | leency | 659 | { |
5825 | leency | 660 | old_cur_y = files.cur_y; |
5694 | leency | 661 | old_first = files.first; |
662 | list_full_redraw = false; |
||
663 | goto _ALL_LIST_REDRAW; |
||
3363 | leency | 664 | } |
5825 | leency | 665 | if (old_cur_y != files.cur_y) |
3363 | leency | 666 | { |
5825 | leency | 667 | if (old_cur_y-files.first |
668 | Line_ReDraw(col_selec, files.cur_y-files.first); |
||
669 | old_cur_y = files.cur_y; |
||
5694 | leency | 670 | return; |
3363 | leency | 671 | } |
672 | |||
5694 | leency | 673 | _ALL_LIST_REDRAW: |
3363 | leency | 674 | |
5825 | leency | 675 | for (j=0; j |
3434 | leency | 676 | //in the bottom |
5825 | leency | 677 | all_lines_h = j * files.item_h; |
5719 | leency | 678 | DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h,0xFFFFFF); |
679 | DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work); |
||
680 | DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work); |
||
3434 | leency | 681 | Scroll(); |
3363 | leency | 682 | } |
683 | |||
3444 | leency | 684 | |
5761 | leency | 685 | void Line_ReDraw(dword bgcol, filenum){ |
3467 | leency | 686 | dword text_col=0, |
5991 | leency | 687 | ext1, attr, |
688 | file_offet, |
||
689 | file_name_off, |
||
6290 | leency | 690 | y=filenum*files.item_h+files.y, |
691 | icon_y = files.item_h/2-7+y; |
||
5991 | leency | 692 | BDVK file; |
5996 | leency | 693 | char label_file_name[4096]; |
4859 | leency | 694 | if (filenum==-1) return; |
6290 | leency | 695 | DrawBar(files.x,y,3,files.item_h,bgcol); |
5825 | leency | 696 | DrawBar(files.x+19,y,files.w-19,files.item_h,bgcol); |
6290 | leency | 697 | if (files.item_h>15) DrawBar(files.x+3,y,16,icon_y-y,bgcol); |
698 | if (files.item_h>16) DrawBar(files.x+3,icon_y+15,16,y+files.item_h-icon_y-15,bgcol); |
||
3363 | leency | 699 | |
4897 | leency | 700 | file_offet = file_mas[filenum+files.first]*304 + buf+32; |
5487 | leency | 701 | attr = ESDWORD[file_offet]; |
4897 | leency | 702 | file.selected = ESBYTE[file_offet+7]; |
703 | file.sizelo = ESDWORD[file_offet+32]; |
||
704 | file_name_off = file_offet+40; |
||
3363 | leency | 705 | |
5487 | leency | 706 | if (! TestBit(attr, 4) ) //file or folder? |
3363 | leency | 707 | { |
5698 | leency | 708 | ext1 = strrchr(file_name_off,'.') + file_name_off; |
6278 | leency | 709 | if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing |
710 | WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y+y+1, files.font_type, 0, ConvertSize(file.sizelo)); |
||
711 | if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1); |
||
3363 | leency | 712 | } |
713 | else |
||
4846 | leency | 714 | { |
6278 | leency | 715 | if (!strncmp(file_name_off,"..",3)) ext1=".."; else { |
716 | ext1=" |
||
717 | WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1); |
||
718 | } |
||
4846 | leency | 719 | } |
6290 | leency | 720 | DrawIconByExtension(ext1, files.x+3, icon_y, bgcol); |
4846 | leency | 721 | |
5487 | leency | 722 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden? |
5761 | leency | 723 | if (bgcol!=0xFFFfff) |
3363 | leency | 724 | { |
5487 | leency | 725 | itdir = TestBit(attr, 4); |
4897 | leency | 726 | strcpy(#file_name, file_name_off); |
5606 | pavelyakov | 727 | sprintf(#file_path,"%s%s",#path,file_name_off); |
3363 | leency | 728 | if (text_col==0xA6A6B7) text_col=0xFFFFFF; |
729 | } |
||
4897 | leency | 730 | if (file.selected) text_col=0xFF0000; |
5987 | leency | 731 | if (label.size.pt==9) || (!label.font) |
3434 | leency | 732 | { |
5745 | leency | 733 | if (Form.width>=480) |
734 | { |
||
735 | FileShow.start_x = files.x + 23; |
||
736 | FileShow.font_color = text_col; |
||
737 | FileShow.area_size_x = files.w - 164; |
||
738 | FileShow.text_pointer = file_name_off; |
||
5776 | leency | 739 | FileShow.start_y = files.text_y + y + 1; |
5745 | leency | 740 | PathShow_prepare stdcall(#FileShow); |
741 | PathShow_draw stdcall(#FileShow); |
||
742 | } |
||
3434 | leency | 743 | } |
5745 | leency | 744 | else |
745 | { |
||
5996 | leency | 746 | strcpy(#label_file_name, file_name_off); |
747 | if (label.getsize(#label_file_name) + 141 + 26 > files.w) |
||
748 | { |
||
749 | while (label.getsize(#label_file_name) + 141 + 26 > files.w) { |
||
750 | ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL; |
||
751 | } |
||
752 | strcpy(#label_file_name+strlen(#label_file_name)-2, "..."); |
||
753 | } |
||
754 | label.write(files.x + 23, files.item_h - label.height / 2 + y, bgcol, text_col, label.size.pt, #label_file_name); |
||
5745 | leency | 755 | } |
5825 | leency | 756 | DrawBar(files.x+files.w-141,y,1,files.item_h,system.color.work); //gray line 1 |
757 | DrawBar(files.x+files.w-68,y,1,files.item_h,system.color.work); //gray line 2 |
||
3363 | leency | 758 | } |
759 | |||
760 | |||
3444 | leency | 761 | void Open_Dir(dword dir_path, redraw){ |
6406 | punk_joker | 762 | int errornum, maxcount, i; |
763 | count_dir = 0; |
||
3444 | leency | 764 | if (redraw!=ONLY_SHOW) |
3363 | leency | 765 | { |
3444 | leency | 766 | if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0'; |
3363 | leency | 767 | if (buf) free(buf); |
3444 | leency | 768 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
769 | if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/'); |
||
770 | if (errornum) |
||
3363 | leency | 771 | { |
6021 | leency | 772 | history.add(#path); |
3363 | leency | 773 | GoBack(); |
774 | Write_Error(errornum); |
||
775 | return; |
||
776 | } |
||
3444 | leency | 777 | maxcount = sizeof(file_mas)/sizeof(dword)-1; |
4225 | punk_joker | 778 | if (files.count>maxcount) files.count = maxcount; |
5825 | leency | 779 | if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0; |
3363 | leency | 780 | } |
6406 | punk_joker | 781 | for (i=0; i |
782 | { |
||
783 | if (TestBit(ESDWORD[i*304+buf+32], 4) ) count_dir++; |
||
784 | } |
||
3444 | leency | 785 | if (files.count!=-1) |
3363 | leency | 786 | { |
6289 | leency | 787 | if(!_not_draw) if (show_breadcrumb) DrawBreadCrumbs(); else DrawPathBar(); |
6021 | leency | 788 | history.add(#path); |
6034 | leency | 789 | SystemDiscs.Draw(); |
5825 | leency | 790 | files.visible = files.h / files.item_h; |
5591 | pavelyakov | 791 | if (files.count < files.visible) files.visible = files.count; |
792 | if (redraw!=ONLY_SHOW) Sorting(); |
||
5694 | leency | 793 | list_full_redraw = true; |
6564 | leency | 794 | if (redraw!=ONLY_OPEN)&&(!_not_draw) {DrawStatusBar(); List_ReDraw();} |
3363 | leency | 795 | } |
5694 | leency | 796 | if (files.count==-1) && (redraw!=ONLY_OPEN) |
797 | { |
||
798 | files.KeyHome(); |
||
6564 | leency | 799 | if(!_not_draw) { list_full_redraw=true; DrawStatusBar(); List_ReDraw(); } |
5694 | leency | 800 | } |
6504 | punk_joker | 801 | SetCurDir(dir_path); |
3363 | leency | 802 | } |
803 | |||
804 | |||
805 | inline Sorting() |
||
806 | { |
||
807 | dword k=0, l=1; |
||
4897 | leency | 808 | dword file_off; |
5606 | pavelyakov | 809 | if (!strncmp(#path,"/",2)) //do not sort |
3363 | leency | 810 | { |
5591 | pavelyakov | 811 | for(k=1;k |
3363 | leency | 812 | return; |
813 | } |
||
5591 | pavelyakov | 814 | for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders |
3363 | leency | 815 | { |
4897 | leency | 816 | if (!real_files_names_case) strttl(file_off+40); |
817 | if (TestBit(ESDWORD[file_off],4)) //directory? |
||
3363 | leency | 818 | { |
819 | file_mas[k]=j; |
||
820 | k++; |
||
821 | } |
||
822 | else |
||
823 | { |
||
3434 | leency | 824 | file_mas[files.count-l]=j; |
3363 | leency | 825 | l++; |
826 | } |
||
827 | } |
||
3434 | leency | 828 | //sorting: files first, then folders |
3363 | leency | 829 | Sort_by_Name(0,k-1); |
5591 | pavelyakov | 830 | if (sort_num==1) Sort_by_Name(k,files.count-1); |
831 | if (sort_num==2) Sort_by_Type(k,files.count-1); |
||
832 | if (sort_num==3) Sort_by_Size(k,files.count-1); |
||
5581 | leency | 833 | //make ".." first item in list |
5733 | leency | 834 | if (k>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0) |
835 | for(k--; k>0; k--;) if (!strncmp(file_mas[k]*304+buf+72,"..",2)) {file_mas[k]> |
||
3363 | leency | 836 | } |
837 | |||
838 | |||
839 | void Del_Form() |
||
840 | { |
||
5512 | punk_joker | 841 | dword selected_offset2; |
6278 | leency | 842 | int selected_count = 0; |
5512 | punk_joker | 843 | byte f_count[128]; |
5581 | leency | 844 | int dform_x = files.w - 220 / 2 + files.x; |
5606 | pavelyakov | 845 | if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return; |
3991 | leency | 846 | else |
847 | { |
||
4002 | leency | 848 | if (!files.count) return; |
6008 | leency | 849 | DrawEolitePopup(T_YES, T_NO); |
5674 | pavelyakov | 850 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE); |
5512 | punk_joker | 851 | for (i=0; i |
4002 | leency | 852 | { |
5512 | punk_joker | 853 | selected_offset2 = file_mas[i]*304 + buf+32 + 7; |
6278 | leency | 854 | if (ESBYTE[selected_offset2]) selected_count++; |
4002 | leency | 855 | } |
6278 | leency | 856 | if (selected_count) |
5512 | punk_joker | 857 | { |
6278 | leency | 858 | sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2); |
5674 | pavelyakov | 859 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count); |
5512 | punk_joker | 860 | } |
4002 | leency | 861 | else |
862 | { |
||
5591 | pavelyakov | 863 | if (strlen(#file_name)<28) |
5512 | punk_joker | 864 | { |
5674 | pavelyakov | 865 | WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,system.color.work_text,"?"); |
866 | WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,system.color.work_text,#file_name); |
||
5512 | punk_joker | 867 | } |
868 | else |
||
869 | { |
||
870 | WriteText(164+dform_x,190,0x80,0,"...?"); |
||
871 | ESI = 24; |
||
872 | WriteText(dform_x+20,190,0,0,#file_name); |
||
873 | } |
||
6008 | leency | 874 | } |
4002 | leency | 875 | del_active=1; |
3991 | leency | 876 | } |
3363 | leency | 877 | } |
878 | |||
5694 | leency | 879 | void SelectFileByName(dword that_file) |
3363 | leency | 880 | { |
5694 | leency | 881 | int ind; |
882 | files.KeyHome(); |
||
5991 | leency | 883 | Open_Dir(#path,ONLY_OPEN); |
4225 | punk_joker | 884 | if (!real_files_names_case) strttl(that_file); |
5694 | leency | 885 | for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; } |
5825 | leency | 886 | files.cur_y = ind - 1; |
5694 | leency | 887 | files.KeyDown(); |
3363 | leency | 888 | List_ReDraw(); |
889 | } |
||
890 | |||
891 | |||
892 | void Dir_Up() |
||
893 | { |
||
894 | char cur_folder[4096]; |
||
895 | i=strlen(#path)-1; |
||
896 | if (i==0) return; |
||
897 | path[i]=0x00; |
||
898 | i = strrchr(#path, '/'); |
||
899 | strcpy(#cur_folder, #path+i); |
||
900 | path[i]=0x00; |
||
5694 | leency | 901 | SelectFileByName(#cur_folder); |
3363 | leency | 902 | } |
903 | |||
5444 | leency | 904 | void Open(byte rez) |
3434 | leency | 905 | { |
5443 | punk_joker | 906 | byte temp[4096]; |
5513 | punk_joker | 907 | selected_count = 0; |
5443 | punk_joker | 908 | if (rez) |
909 | { |
||
5606 | pavelyakov | 910 | if (!strncmp(#file_name,"..",3)) return; |
5443 | punk_joker | 911 | strcpy(#temp, #file_path); |
912 | if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end |
||
913 | RunProgram("/sys/File Managers/Eolite", #temp); |
||
914 | return; |
||
915 | } |
||
3444 | leency | 916 | if (!files.count) return; |
3441 | leency | 917 | if (!itdir) |
3434 | leency | 918 | { |
5401 | leency | 919 | if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path); |
3434 | leency | 920 | } |
921 | else |
||
922 | { |
||
5606 | pavelyakov | 923 | if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; } |
3434 | leency | 924 | strcpy(#path, #file_path); |
925 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end |
||
5825 | leency | 926 | files.first=files.cur_y=0; |
3444 | leency | 927 | Open_Dir(#path,WITH_REDRAW); |
3434 | leency | 928 | } |
929 | } |
||
3363 | leency | 930 | |
3434 | leency | 931 | inline fastcall void GoBack() |
3363 | leency | 932 | { |
933 | char cur_folder[4096]; |
||
5974 | leency | 934 | strcpy(#cur_folder, #path); |
935 | cur_folder[strlen(#cur_folder)-1]=0x00; //delete last '/' |
||
6021 | leency | 936 | if (history.back()) { |
937 | strcpy(#path, history.current()); |
||
5977 | leency | 938 | SelectFileByName(#cur_folder+strrchr(#cur_folder,'/')); |
939 | } |
||
3363 | leency | 940 | } |
941 | |||
5397 | punk_joker | 942 | void ShowOpenWithDialog() |
943 | { |
||
944 | byte param[4097]; |
||
5591 | pavelyakov | 945 | sprintf(#param,"~%s",#file_path); |
5397 | punk_joker | 946 | RunProgram("/sys/@open", #param); |
947 | } |
||
948 | |||
5555 | punk_joker | 949 | void NewElement(byte newf) |
950 | { |
||
5557 | punk_joker | 951 | BDVK element_info; |
5581 | leency | 952 | byte del_rezult, copy_rezult, info_result; |
5555 | punk_joker | 953 | if (newf) |
954 | { |
||
5591 | pavelyakov | 955 | sprintf(#temp,"%s%s",#path,new_file_ed.text); |
5581 | leency | 956 | info_result = GetFileInfo(#temp, #element_info); |
5571 | punk_joker | 957 | switch(new_element_active) |
5555 | punk_joker | 958 | { |
5581 | leency | 959 | case CREATE_FILE: |
960 | if (info_result==5) |
||
5557 | punk_joker | 961 | { |
5571 | punk_joker | 962 | WriteFile(0, 0, #temp); |
963 | if (EAX) |
||
964 | { |
||
6008 | leency | 965 | if (EAX==5) notify(NOT_CREATE_FILE); |
966 | else Write_Error(EAX); |
||
5571 | punk_joker | 967 | } |
5557 | punk_joker | 968 | } |
5571 | punk_joker | 969 | else |
5557 | punk_joker | 970 | { |
5620 | leency | 971 | notify(FS_ITEM_ALREADY_EXISTS); |
5557 | punk_joker | 972 | } |
5581 | leency | 973 | break; |
974 | case CREATE_FOLDER: |
||
975 | if (info_result==5) |
||
5571 | punk_joker | 976 | { |
977 | CreateDir(#temp); |
||
978 | if (EAX) |
||
979 | { |
||
6008 | leency | 980 | if (EAX==5) notify(NOT_CREATE_FOLDER); |
981 | else Write_Error(EAX); |
||
5571 | punk_joker | 982 | } |
983 | } |
||
984 | else |
||
985 | { |
||
5620 | leency | 986 | notify(FS_ITEM_ALREADY_EXISTS); |
5571 | punk_joker | 987 | } |
5581 | leency | 988 | break; |
989 | case RENAME_ITEM: |
||
990 | if (info_result==5) |
||
5571 | punk_joker | 991 | { |
992 | if (itdir) |
||
993 | { |
||
6038 | leency | 994 | //rename only empty folders |
5571 | punk_joker | 995 | if (del_rezult = DeleteFile(#file_path)) |
996 | { |
||
997 | Write_Error(del_rezult); |
||
998 | return; |
||
999 | } |
||
1000 | if (CreateDir(#temp)) CreateDir(#file_path); |
||
1001 | Open_Dir(#path,WITH_REDRAW); |
||
5694 | leency | 1002 | SelectFileByName(new_file_ed.text); |
5571 | punk_joker | 1003 | } |
1004 | else |
||
1005 | { |
||
1006 | if (copy_rezult = CopyFile(#file_path,#temp)) |
||
1007 | { |
||
1008 | Write_Error(copy_rezult); |
||
1009 | } |
||
1010 | else |
||
1011 | { |
||
6038 | leency | 1012 | DeleteFile(#file_path); |
5694 | leency | 1013 | SelectFileByName(new_file_ed.text); |
5571 | punk_joker | 1014 | } |
1015 | } |
||
1016 | } |
||
1017 | else |
||
1018 | { |
||
5620 | leency | 1019 | notify(FS_ITEM_ALREADY_EXISTS); |
5571 | punk_joker | 1020 | } |
5555 | punk_joker | 1021 | } |
5557 | punk_joker | 1022 | new_element_active = 0; |
1023 | Open_Dir(#path,WITH_REDRAW); |
||
5694 | leency | 1024 | SelectFileByName(new_file_ed.text); |
5555 | punk_joker | 1025 | } |
1026 | new_element_active = 0; |
||
5557 | punk_joker | 1027 | Open_Dir(#path,WITH_REDRAW); |
5555 | punk_joker | 1028 | } |
1029 | |||
5571 | punk_joker | 1030 | void NewElement_Form(byte crt, dword strng) |
5555 | punk_joker | 1031 | { |
1032 | int dform_x=files.w-220/2+files.x; |
||
5557 | punk_joker | 1033 | if (!new_element_active) |
5555 | punk_joker | 1034 | { |
5557 | punk_joker | 1035 | new_element_active = crt; |
5571 | punk_joker | 1036 | strcpy(#new_element_name, strng); |
1037 | new_file_ed.size = new_file_ed.pos = strlen(strng); |
||
5555 | punk_joker | 1038 | } |
6008 | leency | 1039 | if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL); |
1040 | else DrawEolitePopup(T_CREATE, T_CANCEL); |
||
5581 | leency | 1041 | new_file_ed.left = dform_x+24; |
6278 | leency | 1042 | DrawEditBox(#new_file_ed); |
5555 | punk_joker | 1043 | } |
1044 | |||
5576 | pavelyakov | 1045 | void FnProcess(byte N) |
3434 | leency | 1046 | { |
1047 | switch(N) |
||
1048 | { |
||
1049 | case 1: |
||
4395 | punk_joker | 1050 | if (!active_about) |
1051 | { |
||
5576 | pavelyakov | 1052 | about_stak = malloc(4096); |
1053 | about_window = CreateThread(#about_dialog,about_stak+4092); |
||
4395 | punk_joker | 1054 | break; |
1055 | } |
||
1056 | else |
||
1057 | { |
||
1058 | ActivateWindow(GetProcessSlot(about_window)); |
||
1059 | } |
||
3434 | leency | 1060 | break; |
1061 | case 2: |
||
1062 | if (!files.count) break; |
||
5581 | leency | 1063 | NewElement_Form(RENAME_ITEM, #file_name); |
3434 | leency | 1064 | break; |
1065 | case 3: |
||
5591 | pavelyakov | 1066 | if (!itdir) RunProgram("/sys/tinypad", #file_path); |
3434 | leency | 1067 | break; |
1068 | case 4: |
||
5591 | pavelyakov | 1069 | if (!itdir) RunProgram("/sys/develop/heed", #file_path); |
3434 | leency | 1070 | break; |
3440 | leency | 1071 | case 5: //refresh cur dir & devs |
5719 | leency | 1072 | if (two_panels) |
1073 | { |
||
5723 | leency | 1074 | DrawFilePanels(); |
5719 | leency | 1075 | } |
1076 | else |
||
1077 | { |
||
1078 | Tip(56, T_DEVICES, 55, "-"); |
||
1079 | Open_Dir(#path,WITH_REDRAW); |
||
1080 | pause(10); |
||
6034 | leency | 1081 | SystemDiscs.Get(); |
5719 | leency | 1082 | Open_Dir(#path,WITH_REDRAW); |
5723 | leency | 1083 | DrawDeviceAndActionsLeftPanel(); |
5719 | leency | 1084 | } |
3434 | leency | 1085 | break; |
1086 | case 6: |
||
5581 | leency | 1087 | NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER); |
3434 | leency | 1088 | break; |
1089 | case 7: |
||
5581 | leency | 1090 | NewElement_Form(CREATE_FILE, T_NEW_FILE); |
3434 | leency | 1091 | break; |
5447 | punk_joker | 1092 | case 8: |
5576 | pavelyakov | 1093 | properties_stak = malloc(8096); |
1094 | CreateThread(#properties_dialog, properties_stak+8092); |
||
5447 | punk_joker | 1095 | break; |
3434 | leency | 1096 | case 10: //F10 |
5753 | leency | 1097 | if (!active_settings) |
5416 | punk_joker | 1098 | { |
5576 | pavelyakov | 1099 | settings_stak = malloc(4096); |
1100 | settings_window = CreateThread(#settings_dialog, settings_stak+4092); |
||
5416 | punk_joker | 1101 | break; |
1102 | } |
||
1103 | else |
||
1104 | { |
||
1105 | ActivateWindow(GetProcessSlot(settings_window)); |
||
1106 | } |
||
3434 | leency | 1107 | break; |
1108 | } |
||
1109 | } |
||
1110 | |||
5738 | leency | 1111 | void ChangeActivePanel() |
1112 | { |
||
1113 | llist_copy(#files_active, #files_inactive); |
||
1114 | llist_copy(#files_inactive, #files); |
||
1115 | strcpy(#active_path, #inactive_path); |
||
1116 | strcpy(#inactive_path, #path); |
||
1117 | DrawFilePanels(); |
||
1118 | } |
||
1119 | |||
3434 | leency | 1120 | |
3363 | leency | 1121 | stop:28)>>9)>5)>5;>6;>3;>>>>><> |