Rev 5710 | Rev 5723 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5710 | Rev 5719 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | #ifndef AUTOBUILD |
4 | #ifndef AUTOBUILD |
5 | #include "lang.h--" |
5 | #include "lang.h--" |
6 | #endif |
6 | #endif |
Line 7... | Line 7... | ||
7 | 7 | ||
8 | //libraries |
8 | //libraries |
9 | #define MEMSIZE 500000 |
9 | #define MEMSIZE 510000 |
10 | #include "..\lib\clipboard.h" |
10 | #include "..\lib\clipboard.h" |
11 | #include "..\lib\strings.h" |
11 | #include "..\lib\strings.h" |
12 | #include "..\lib\mem.h" |
12 | #include "..\lib\mem.h" |
13 | #include "..\lib\file_system.h" |
13 | #include "..\lib\file_system.h" |
Line 62... | Line 62... | ||
62 | byte use_big_fonts=false, |
62 | byte use_big_fonts=false, |
63 | sort_num=2, |
63 | sort_num=2, |
64 | show_dev_name=true, |
64 | show_dev_name=true, |
65 | real_files_names_case=false, |
65 | real_files_names_case=false, |
66 | info_after_copy=false, |
66 | info_after_copy=false, |
67 | two_panels=false; |
67 | two_panels=false, |
- | 68 | active_panel=1; |
|
68 | //} settings; |
69 | //} settings; |
Line -... | Line 70... | ||
- | 70 | ||
- | 71 | int active_current, inactive_current, active_first, inactive_first; |
|
- | 72 | char active_path[4096], inactive_path[4096]; |
|
Line 69... | Line 73... | ||
69 | 73 | ||
Line 70... | Line 74... | ||
70 | 74 | ||
Line 126... | Line 130... | ||
126 | } |
130 | } |
127 | else |
131 | else |
128 | { |
132 | { |
129 | strlcpy(#path, "/rd/1/", 6); |
133 | strlcpy(#path, "/rd/1/", 6); |
130 | } |
134 | } |
- | 135 | strcpy(#active_path, #path); |
|
- | 136 | strcpy(#inactive_path, #path); |
|
131 | Open_Dir(#path,ONLY_OPEN); |
137 | Open_Dir(#path,ONLY_OPEN); |
132 | SetEventMask(1100111b); |
138 | SetEventMask(1100111b); |
133 | loop(){ |
139 | loop(){ |
134 | switch(WaitEvent()) |
140 | switch(WaitEvent()) |
135 | { |
141 | { |
Line 253... | Line 259... | ||
253 | DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xFFFFFF,0xC7C7C7); |
259 | DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xFFFFFF,0xC7C7C7); |
254 | } |
260 | } |
Line 255... | Line 261... | ||
255 | 261 | ||
256 | //Scrooll |
262 | //Scrooll |
257 | if (!mouse.lkm) && (scroll_used) { scroll_used=false; Scroll(); } |
263 | if (!mouse.lkm) && (scroll_used) { scroll_used=false; Scroll(); } |
Line 258... | Line 264... | ||
258 | if (mouse.x>=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>56) && (mouse.y |
264 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) && (mouse.y |
259 | 265 | ||
260 | if (scroll_used) |
266 | if (scroll_used) |
261 | { |
267 | { |
262 | 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 |
268 | 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 |
263 | id=files.first; |
269 | id=files.first; |
264 | j= sc_slider_h/2; |
270 | j= sc_slider_h/2; |
265 | files.first = mouse.y -j -files.y * files.count; |
271 | files.first = mouse.y -j -files.y * files.count; |
266 | files.first /= onTop(22,files.y); |
272 | files.first /= onTop(22,files.y); |
- | 273 | if (files.visible+files.first>files.count) files.first=files.count-files.visible; |
|
- | 274 | if (id!=files.first) List_ReDraw(); |
|
- | 275 | break; |
|
- | 276 | } |
|
- | 277 | ||
- | 278 | if (two_panels) && (mouse.y > files.y) { |
|
- | 279 | if (mouse.x |
|
- | 280 | { |
|
- | 281 | if (active_panel!=1) |
|
- | 282 | { |
|
- | 283 | active_panel = 1; |
|
- | 284 | active_current = inactive_current; |
|
- | 285 | inactive_current = files.current; |
|
- | 286 | active_first = inactive_first; |
|
- | 287 | inactive_first = files.first; |
|
- | 288 | strcpy(#active_path, #inactive_path); |
|
- | 289 | strcpy(#inactive_path, #path); |
|
- | 290 | draw_window(); |
|
- | 291 | } |
|
- | 292 | } |
|
- | 293 | else |
|
- | 294 | { |
|
- | 295 | if (active_panel!=2) |
|
- | 296 | { |
|
- | 297 | active_panel = 2; |
|
- | 298 | active_current = inactive_current; |
|
- | 299 | inactive_current = files.current; |
|
- | 300 | active_first = inactive_first; |
|
- | 301 | inactive_first = files.first; |
|
- | 302 | strcpy(#active_path, #inactive_path); |
|
- | 303 | strcpy(#inactive_path, #path); |
|
- | 304 | draw_window(); |
|
267 | if (files.visible+files.first>files.count) files.first=files.count-files.visible; |
305 | } |
268 | if (id!=files.first) List_ReDraw(); |
306 | } |
269 | } |
307 | } |
270 | break; |
308 | break; |
271 | //Button pressed----------------------------------------------------------------------------- |
309 | //Button pressed----------------------------------------------------------------------------- |
Line 310... | Line 348... | ||
310 | break; |
348 | break; |
311 | case 26: |
349 | case 26: |
312 | Paste(); |
350 | Paste(); |
313 | break; |
351 | break; |
314 | case 31...33: //sort |
352 | case 31...33: //sort |
315 | if(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10); |
353 | if(sort_num==1) DrawFilledBar(sorting_arrow_x,files.y-12,6,10); |
316 | if(sort_num==2) DrawFilledBar(sorting_arrow_x,42,6,10); |
354 | if(sort_num==2) DrawFilledBar(sorting_arrow_x,files.y-12,6,10); |
317 | if(sort_num==3) DrawFilledBar(sorting_arrow_x,42,6,10); |
355 | if(sort_num==3) DrawFilledBar(sorting_arrow_x,files.y-12,6,10); |
318 | sort_num=id-30; |
356 | sort_num=id-30; |
319 | Open_Dir(#path,WITH_REDRAW); |
357 | Open_Dir(#path,WITH_REDRAW); |
320 | break; |
358 | break; |
321 | case 50...60: //Actions |
359 | case 50...60: //Actions |
322 | FnProcess(id-50); |
360 | FnProcess(id-50); |
Line 409... | Line 447... | ||
409 | break; |
447 | break; |
410 | } |
448 | } |
Line 411... | Line 449... | ||
411 | 449 | ||
412 | switch (key_scancode) |
450 | switch (key_scancode) |
413 | { |
- | |
414 | case 198: |
- | |
415 | two_panels ^= 1; |
- | |
416 | draw_window(); |
- | |
417 | break; |
451 | { |
418 | case SCAN_CODE_BS: |
452 | case SCAN_CODE_BS: |
419 | //GoBack(); |
453 | //GoBack(); |
420 | Dir_Up(); |
454 | Dir_Up(); |
421 | break; |
455 | break; |
Line 499... | Line 533... | ||
499 | cmd_free = false; |
533 | cmd_free = false; |
500 | } |
534 | } |
501 | } |
535 | } |
502 | } |
536 | } |
Line 503... | Line -... | ||
503 | - | ||
504 | 537 | ||
505 | void draw_window() |
538 | void draw_window() |
506 | { |
539 | { |
507 | DefineAndDrawWindow(GetScreenWidth()-550/4+rand_n,rand_n+30,550,500,0x73,system.color.work,TITLE,0); |
540 | DefineAndDrawWindow(GetScreenWidth()-550/4+rand_n,rand_n+30,550,500,0x73,system.color.work,TITLE,0); |
508 | GetProcessInfo(#Form, SelfInfo); |
541 | GetProcessInfo(#Form, SelfInfo); |
Line 525... | Line 558... | ||
525 | for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]); |
558 | for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]); |
526 | if (!two_panels) |
559 | if (!two_panels) |
527 | { |
560 | { |
528 | DrawLeftPanel(); |
561 | DrawLeftPanel(); |
529 | files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59, files.line_h); |
562 | files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59, files.line_h); |
530 | DrawListColumns(); |
563 | DrawList(); |
531 | Open_Dir(#path,ONLY_SHOW); |
- | |
532 | } |
564 | } |
533 | else |
565 | else |
534 | { |
566 | { |
- | 567 | if (active_panel==1) |
|
- | 568 | { |
|
- | 569 | files.current = inactive_current; |
|
- | 570 | files.first = inactive_first; |
|
- | 571 | strcpy(#path, #inactive_path); |
|
- | 572 | files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.line_h); |
|
- | 573 | DrawList(); |
|
- | 574 | files.current = active_current; |
|
- | 575 | files.first = active_first; |
|
- | 576 | strcpy(#path, #active_path); |
|
- | 577 | files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.line_h); |
|
- | 578 | DrawList(); |
|
- | 579 | } |
|
- | 580 | if (active_panel==2) |
|
- | 581 | { |
|
- | 582 | files.current = inactive_current; |
|
- | 583 | files.first = inactive_first; |
|
- | 584 | strcpy(#path, #inactive_path); |
|
535 | files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.line_h); |
585 | files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.line_h); |
536 | DrawListColumns(); |
586 | DrawList(); |
- | 587 | files.current = active_current; |
|
- | 588 | files.first = active_first; |
|
537 | Open_Dir(#path,ONLY_SHOW); |
589 | strcpy(#path, #active_path); |
538 | files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.line_h); |
590 | files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.line_h); |
539 | DrawListColumns(); |
591 | DrawList(); |
540 | Open_Dir(#path,ONLY_SHOW); |
592 | } |
541 | } |
593 | } |
542 | if (del_active) Del_Form(); |
594 | if (del_active) Del_Form(); |
543 | if (new_element_active) NewElement_Form(new_element_active, #new_element_name); |
595 | if (new_element_active) NewElement_Form(new_element_active, #new_element_name); |
544 | } |
596 | } |
Line 545... | Line 597... | ||
545 | 597 | ||
546 | void DrawListColumns() |
598 | void DrawList() |
547 | { |
599 | { |
548 | DrawFlatButton(files.x,files.y - 17, files.w - 141,16,31,system.color.work,T_FILE); |
600 | DrawFlatButton(files.x,files.y - 17, files.w - 141,16,31,system.color.work,T_FILE); |
549 | DrawFlatButton(files.x + files.w - 141, files.y-17,73,16,32,system.color.work,T_TYPE); |
601 | DrawFlatButton(files.x + files.w - 141, files.y-17,73,16,32,system.color.work,T_TYPE); |
550 | DrawFlatButton(files.x + files.w - 68, files.y-17,68,16,33,system.color.work,T_SIZE); |
602 | DrawFlatButton(files.x + files.w - 68, files.y-17,68,16,33,system.color.work,T_SIZE); |
551 | DrawFlatButton(files.x + files.w, files.y-17,16,16, 0,system.color.work,"\x18"); |
603 | DrawFlatButton(files.x + files.w, files.y-17,16,16, 0,system.color.work,"\x18"); |
552 | DrawFlatButton(files.x + files.w,files.y+files.h-16,16,16, 0,system.color.work,"\x19"); |
604 | DrawFlatButton(files.x + files.w,files.y+files.h-16,16,16, 0,system.color.work,"\x19"); |
- | 605 | DrawBar(files.x+files.w,files.y,1,files.h,system.color.work_graph); |
|
553 | DrawBar(files.x+files.w,files.y,1,files.h,system.color.work_graph); |
606 | Open_Dir(#path,WITH_REDRAW); |
Line 554... | Line 607... | ||
554 | } |
607 | } |
555 | 608 | ||
556 | 609 | ||
557 | void List_ReDraw() |
610 | void List_ReDraw() |
Line 558... | Line 611... | ||
558 | { |
611 | { |
Line 559... | Line 612... | ||
559 | int paint_y; |
612 | int all_lines_h; |
Line 578... | Line 631... | ||
578 | 631 | ||
Line 579... | Line 632... | ||
579 | _ALL_LIST_REDRAW: |
632 | _ALL_LIST_REDRAW: |
580 | 633 | ||
581 | for (j=0; j |
634 | for (j=0; j |
582 | //in the bottom |
635 | //in the bottom |
583 | paint_y = j * files.line_h + files.y; |
636 | all_lines_h = j * files.line_h; |
584 | DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF); |
637 | DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h,0xFFFFFF); |
585 | DrawBar(Form.cwidth-159,paint_y,1,onTop(paint_y,6),system.color.work); |
638 | DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work); |
586 | DrawBar(Form.cwidth-86,paint_y,1,onTop(paint_y,6),system.color.work); |
639 | DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work); |
Line 587... | Line 640... | ||
587 | Scroll(); |
640 | Scroll(); |
Line 611... | Line 664... | ||
611 | if (! TestBit(attr, 4) ) //file or folder? |
664 | if (! TestBit(attr, 4) ) //file or folder? |
612 | { |
665 | { |
613 | ext1 = strrchr(file_name_off,'.') + file_name_off; |
666 | ext1 = strrchr(file_name_off,'.') + file_name_off; |
614 | if (ext1==file_name_off) ext1 = " \0"; //if no extension then show nothing |
667 | if (ext1==file_name_off) ext1 = " \0"; //if no extension then show nothing |
615 | Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0); |
668 | Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0); |
616 | WriteText(7-strlen(ConvertSize(file.sizelo))*6+Form.cwidth - 76, files.text_y + y,files.font_type,0,ConvertSize(file.sizelo)); |
669 | WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y + y,files.font_type,0,ConvertSize(file.sizelo)); |
617 | } |
670 | } |
618 | else |
671 | else |
619 | { |
672 | { |
620 | if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1=" |
673 | if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1=" |
621 | Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0); |
674 | Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0); |
Line 638... | Line 691... | ||
638 | FileShow.text_pointer = file_name_off; |
691 | FileShow.text_pointer = file_name_off; |
639 | FileShow.start_y = files.text_y + y; |
692 | FileShow.start_y = files.text_y + y; |
640 | PathShow_prepare stdcall(#FileShow); |
693 | PathShow_prepare stdcall(#FileShow); |
641 | PathShow_draw stdcall(#FileShow); |
694 | PathShow_draw stdcall(#FileShow); |
642 | } |
695 | } |
643 | DrawBar(Form.cwidth-159,y,1,files.line_h,system.color.work); //gray line 1 |
696 | DrawBar(files.x+files.w-141,y,1,files.line_h,system.color.work); //gray line 1 |
644 | DrawBar(Form.cwidth-86,y,1,files.line_h,system.color.work); //gray line 2 |
697 | DrawBar(files.x+files.w-68,y,1,files.line_h,system.color.work); //gray line 2 |
645 | } |
698 | } |
Line 646... | Line 699... | ||
646 | 699 | ||
647 | 700 | ||
Line 678... | Line 731... | ||
678 | files.visible = files.h / files.line_h; |
731 | files.visible = files.h / files.line_h; |
679 | if (files.count < files.visible) files.visible = files.count; |
732 | if (files.count < files.visible) files.visible = files.count; |
680 | if (sort_num==1) sorting_arrow_x = Form.width+60/2; |
733 | if (sort_num==1) sorting_arrow_x = Form.width+60/2; |
681 | if (sort_num==2) sorting_arrow_x = Form.width-115; |
734 | if (sort_num==2) sorting_arrow_x = Form.width-115; |
682 | if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
735 | if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
683 | WriteText(sorting_arrow_x,45,0x80,system.color.work_graph,"\x19"); |
736 | WriteText(sorting_arrow_x,files.y-12,0x80,system.color.work_graph,"\x19"); |
684 | if (redraw!=ONLY_SHOW) Sorting(); |
737 | if (redraw!=ONLY_SHOW) Sorting(); |
685 | list_full_redraw = true; |
738 | list_full_redraw = true; |
686 | if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw(); |
739 | if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw(); |
687 | DrawSystemDiscs(); |
740 | DrawSystemDiscs(); |
688 | } |
741 | } |
Line 1031... | Line 1084... | ||
1031 | break; |
1084 | break; |
1032 | case 4: |
1085 | case 4: |
1033 | if (!itdir) RunProgram("/sys/develop/heed", #file_path); |
1086 | if (!itdir) RunProgram("/sys/develop/heed", #file_path); |
1034 | break; |
1087 | break; |
1035 | case 5: //refresh cur dir & devs |
1088 | case 5: //refresh cur dir & devs |
- | 1089 | if (two_panels) |
|
- | 1090 | { |
|
- | 1091 | draw_window(); |
|
- | 1092 | } |
|
- | 1093 | else |
|
- | 1094 | { |
|
1036 | Tip(56, T_DEVICES, 55, "-"); |
1095 | Tip(56, T_DEVICES, 55, "-"); |
1037 | Open_Dir(#path,WITH_REDRAW); |
1096 | Open_Dir(#path,WITH_REDRAW); |
1038 | pause(10); |
1097 | pause(10); |
1039 | LoadIniSettings(); |
1098 | LoadIniSettings(); |
1040 | GetSystemDiscs(); |
1099 | GetSystemDiscs(); |
1041 | Open_Dir(#path,WITH_REDRAW); |
1100 | Open_Dir(#path,WITH_REDRAW); |
1042 | DrawLeftPanel(); |
1101 | DrawLeftPanel(); |
- | 1102 | } |
|
1043 | break; |
1103 | break; |
1044 | case 6: |
1104 | case 6: |
1045 | NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER); |
1105 | NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER); |
1046 | break; |
1106 | break; |
1047 | case 7: |
1107 | case 7: |