Subversion Repositories Kolibri OS

Rev

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