Subversion Repositories Kolibri OS

Rev

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

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