Subversion Repositories Kolibri OS

Rev

Rev 5981 | Rev 5987 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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