Subversion Repositories Kolibri OS

Rev

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