Subversion Repositories Kolibri OS

Rev

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