Subversion Repositories Kolibri OS

Rev

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