Subversion Repositories Kolibri OS

Rev

Rev 5877 | Rev 5955 | 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.                                                                 if (files.KeyDown()) List_ReDraw();
  511.                                                                 break;
  512.                                                 case 059...068: //F1-F10
  513.                                                                 FnProcess(key_scancode-58);
  514.                                                                 break;
  515.                                                 default:    
  516.                                                                 for (i=files.cur_y+1; i<files.count; i++)
  517.                                                                 {
  518.                                                                         strcpy(#temp, file_mas[i]*304+buf+72);
  519.                                                                         if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
  520.                                                                         {
  521.                                                                                 files.cur_y = i - 1;
  522.                                                                                 files.KeyDown();
  523.                                                                                 List_ReDraw();
  524.                                                                                 break;
  525.                                                                         }
  526.                                                                 }
  527.                                 }                        
  528.                         break;
  529.                         case evIPC:
  530.                         case evReDraw:
  531.                                 draw_window();
  532.                                 if (action_buf)
  533.                                 {
  534.                                         if (action_buf==OPERATION_END)
  535.                                         {
  536.                                                 FnProcess(5);
  537.                                                 SelectFileByName(#copy_to+strrchr(#copy_to,'/'));
  538.                                         }
  539.                                         if (action_buf==100) Open(0);
  540.                                         if (action_buf==201) ShowOpenWithDialog();
  541.                                         if (action_buf==202) FnProcess(3); //F3
  542.                                         if (action_buf==203) FnProcess(4); //F4
  543.                                         if (action_buf==104) Copy(#file_path, NOCUT);
  544.                                         if (action_buf==105) Copy(#file_path, CUT);
  545.                                         if (action_buf==106) Paste();
  546.                                         if (action_buf==207) FnProcess(2);
  547.                                         if (action_buf==108) Del_Form();
  548.                                         if (action_buf==109) FnProcess(5);
  549.                                         if (action_buf==110) FnProcess(8);
  550.                                         action_buf=0;
  551.                                 }
  552.                 }
  553.                
  554.                 if(cmd_free)
  555.                 {
  556.                         if(cmd_free==1)     free(menu_stak);
  557.                         else if(cmd_free==2)free(about_stak);
  558.                         else if(cmd_free==3)free(properties_stak);
  559.                         else if(cmd_free==4)free(settings_stak);
  560.                         else if(cmd_free==5)free(copy_stak);
  561.                         cmd_free = false;
  562.                 }
  563.         }
  564. }
  565.  
  566. void draw_window()
  567. {
  568.         DefineAndDrawWindow(WinX+rand_n,WinY+rand_n,WinW,WinH,0x73,system.color.work,TITLE,0);
  569.         GetProcessInfo(#Form, SelfInfo);
  570.         if (Form.status_window>2) return;
  571.         if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; }
  572.         if (Form.width  < 480) { MoveSize(OLD,OLD,480,OLD); return; }
  573.         GetProcessInfo(#Form, SelfInfo); //if win_size changed
  574.         PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
  575.         DrawBar(127, 8, 1, 25, system.color.work_graph);
  576.         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);
  577.         for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,system.color.work);
  578.         DrawBar(246,0,Form.cwidth - 297,12, system.color.work); //upper editbox
  579.         DrawBar(246,29,Form.cwidth - 297,5,system.color.work);  //under editbox
  580.         DrawRectangle(246,12,Form.cwidth - 303,16,system.color.work_graph);
  581.         DefineButton(Form.cwidth - 32,6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about
  582.         PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal);
  583.         //main rectangles
  584.         DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42,system.color.work_graph);
  585.         DrawRectangle(0,39,Form.cwidth-1,Form.cheight - 40,col_palette[4]); //bg
  586.         for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);
  587.         llist_copy(#files_active, #files);
  588.         strcpy(#active_path, #path);
  589.         DrawFilePanels();
  590.         if (del_active) Del_Form();
  591.         if (new_element_active) NewElement_Form(new_element_active, #new_element_name);
  592. }
  593.  
  594. void DrawList()
  595. {
  596.         word sorting_arrow_x;
  597.         DrawFlatButton(files.x, files.y-17, files.w - 141,16,31,system.color.work,T_FILE);
  598.         DrawFlatButton(files.x + files.w - 141, files.y-17,73,16,32,system.color.work,T_TYPE);
  599.         DrawFlatButton(files.x + files.w -  68, files.y-17,68,16,33,system.color.work,T_SIZE);
  600.         DrawFlatButton(files.x + files.w,       files.y-17,16,16, 0,system.color.work,"\x18");
  601.         DrawFlatButton(files.x + files.w,files.y+files.h-16,16,16,0,system.color.work,"\x19");
  602.         if (sort_num==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18;
  603.         if (sort_num==2) sorting_arrow_x = files.x + files.w - 90;
  604.         if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
  605.         WriteText(sorting_arrow_x,files.y-12,0x80,system.color.work_graph,"\x19");
  606.         DrawBar(files.x+files.w,files.y,1,files.h,system.color.work_graph);
  607.         if (two_panels) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,system.color.work_graph);  
  608. }
  609.  
  610. void DrawFilePanels()
  611. {
  612.         if (!two_panels)
  613.         {
  614.                 DrawDeviceAndActionsLeftPanel();
  615.                 files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59, files.item_h);
  616.                 DrawList();
  617.                 Open_Dir(#path,ONLY_SHOW);
  618.         }
  619.         else
  620.         {
  621.                 llist_copy(#files, #files_inactive);
  622.                 strcpy(#path, #inactive_path);
  623.                 col_selec = 0xCCCccc;
  624.  
  625.                 if (active_panel==1)
  626.                 {
  627.                         llist_copy(#files, #files_inactive);
  628.                         strcpy(#path, #inactive_path);
  629.                         col_selec = 0xCCCccc;
  630.                         files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.item_h);
  631.                         DrawList();
  632.                         Open_Dir(#path,WITH_REDRAW);
  633.                         llist_copy(#files, #files_active);
  634.                         strcpy(#path, #active_path);
  635.                         col_selec = 0x94AECE;
  636.                         files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.item_h);
  637.                         DrawList();
  638.                         Open_Dir(#path,WITH_REDRAW);
  639.                 }
  640.                 if (active_panel==2)
  641.                 {
  642.                         files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.item_h);
  643.                         DrawList();
  644.                         Open_Dir(#path,WITH_REDRAW);
  645.                         llist_copy(#files, #files_active);
  646.                         strcpy(#path, #active_path);
  647.                         col_selec = 0x94AECE;
  648.                         files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.item_h);
  649.                         DrawList();
  650.                         Open_Dir(#path,WITH_REDRAW);
  651.                 }
  652.         }
  653. }
  654.  
  655.  
  656. void List_ReDraw()
  657. {
  658.         int all_lines_h;
  659.         static int old_cur_y, old_first;
  660.  
  661.         files.CheckDoesValuesOkey(); //prevent some shit
  662.  
  663.         if (list_full_redraw) || (old_first != files.first)
  664.         {
  665.                 old_cur_y = files.cur_y;
  666.                 old_first = files.first;
  667.                 list_full_redraw = false;
  668.                 goto _ALL_LIST_REDRAW;
  669.         }
  670.         if (old_cur_y != files.cur_y)
  671.         {
  672.                 if (old_cur_y-files.first<files.visible) Line_ReDraw(0xFFFFFF, old_cur_y-files.first);
  673.                 Line_ReDraw(col_selec, files.cur_y-files.first);
  674.                 old_cur_y = files.cur_y;
  675.                 return;
  676.         }
  677.  
  678.         _ALL_LIST_REDRAW:
  679.  
  680.         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);
  681.         //in the bottom
  682.         all_lines_h = j * files.item_h;
  683.         DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h,0xFFFFFF);
  684.         DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work);
  685.         DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work);
  686.         Scroll();
  687. }
  688.  
  689.  
  690. void Line_ReDraw(dword bgcol, filenum){
  691.         dword text_col=0,
  692.               ext1, attr,
  693.               file_offet,
  694.               file_name_off,
  695.               y=filenum*files.item_h+files.y;
  696.               BDVK file;
  697.         if (filenum==-1) return;
  698.         DrawBar(files.x,y,3,files.item_h,bgcol);
  699.         DrawBar(files.x+19,y,files.w-19,files.item_h,bgcol);
  700.         DrawBar(files.x+3,y+17,16,1,bgcol);
  701.         if (files.item_h>18) DrawBar(files.x+3,y+18,16,files.item_h-18,bgcol);
  702.         if (files.item_h>15) DrawBar(files.x+3,y,16,files.item_h-15,bgcol);
  703.  
  704.         file_offet = file_mas[filenum+files.first]*304 + buf+32;
  705.         attr = ESDWORD[file_offet];
  706.         file.selected = ESBYTE[file_offet+7];
  707.         file.sizelo   = ESDWORD[file_offet+32];
  708.         file_name_off = file_offet+40;
  709.  
  710.         if (! TestBit(attr, 4) ) //file or folder?
  711.         {      
  712.                 ext1 = strrchr(file_name_off,'.') + file_name_off;
  713.                 if (ext1==file_name_off) ext1 = " \0"; //if no extension then show nothing
  714.                 Put_icon(ext1, files.x+3, files.item_h/2-7+y, bgcol, 0);
  715.                 WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y + y +1,files.font_type,0,ConvertSize(file.sizelo));
  716.         }
  717.         else
  718.         {
  719.                 if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1="<DIR>";
  720.                 Put_icon(ext1, files.x+3, files.item_h/2-7+y, bgcol, 0);               
  721.         }
  722.  
  723.         if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
  724.         if (bgcol!=0xFFFfff)
  725.         {
  726.                 itdir = TestBit(attr, 4);
  727.                 strcpy(#file_name, file_name_off);
  728.                 sprintf(#file_path,"%s%s",#path,file_name_off);
  729.                 if (text_col==0xA6A6B7) text_col=0xFFFFFF;
  730.         }
  731.         if (file.selected) text_col=0xFF0000;
  732.         if (font.size.text==9) || (!font.data)
  733.         {
  734.                 if (Form.width>=480)
  735.                 {
  736.                         FileShow.start_x = files.x + 23;
  737.                         FileShow.font_color = text_col;
  738.                         FileShow.area_size_x = files.w - 164;
  739.                         FileShow.text_pointer = file_name_off;
  740.                         FileShow.start_y = files.text_y + y + 1;
  741.                         PathShow_prepare stdcall(#FileShow);
  742.                         PathShow_draw stdcall(#FileShow);
  743.                 }              
  744.         }
  745.         else
  746.         {
  747.                 font.bg_color = bgcol;
  748.                 font.use_smooth = smooth_font;
  749.                 font.prepare(files.x + 23, files.item_h - font.height / 2 + y, file_name_off);
  750.                 font.show();
  751.         }
  752.         DrawBar(files.x+files.w-141,y,1,files.item_h,system.color.work); //gray line 1
  753.         DrawBar(files.x+files.w-68,y,1,files.item_h,system.color.work); //gray line 2
  754. }
  755.  
  756.  
  757. void Open_Dir(dword dir_path, redraw){
  758.         int errornum, maxcount;
  759.  
  760.         if (redraw!=ONLY_SHOW)
  761.         {
  762.                 if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0';
  763.                 if (buf) free(buf);
  764.                 errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
  765.                 if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/');
  766.                 if (errornum)
  767.                 {
  768.                         HistoryPath(ADD_NEW_PATH);
  769.                         GoBack();
  770.                         Write_Error(errornum);
  771.                         return;
  772.                 }
  773.                 maxcount = sizeof(file_mas)/sizeof(dword)-1;
  774.                 if (files.count>maxcount) files.count = maxcount;
  775.                 if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
  776.         }
  777.         if (files.count!=-1)
  778.         {
  779.                 if(!_not_draw)
  780.                 {
  781.                         PathShow.area_size_x = Form.cwidth-306;
  782.                         DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff);
  783.                         PathShow_prepare stdcall(#PathShow);
  784.                         PathShow_draw stdcall(#PathShow);
  785.                 }
  786.                 HistoryPath(ADD_NEW_PATH);
  787.                 files.visible = files.h / files.item_h;
  788.                 if (files.count < files.visible) files.visible = files.count;
  789.                 if (redraw!=ONLY_SHOW) Sorting();
  790.                 list_full_redraw = true;
  791.                 if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw();
  792.                 DrawSystemDiscs();
  793.         }
  794.         if (files.count==-1) && (redraw!=ONLY_OPEN)
  795.         {
  796.                 files.KeyHome();
  797.                 if(!_not_draw) { list_full_redraw=true; List_ReDraw(); }
  798.         }
  799. }
  800.  
  801.  
  802. inline Sorting()
  803. {
  804.         dword k=0, l=1;
  805.         dword file_off;
  806.         if (!strncmp(#path,"/",2)) //do not sort
  807.         {
  808.                 for(k=1;k<files.count;k++;) file_mas[k]=k;
  809.                 return;
  810.         }
  811.         for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;)  //files | folders
  812.         {
  813.                 if (!real_files_names_case) strttl(file_off+40);
  814.                 if (TestBit(ESDWORD[file_off],4)) //directory?
  815.                 {
  816.                         file_mas[k]=j;
  817.                         k++;
  818.                 }
  819.                 else
  820.                 {
  821.                         file_mas[files.count-l]=j;
  822.                         l++;
  823.                 }
  824.         }
  825.         //sorting: files first, then folders
  826.         Sort_by_Name(0,k-1);
  827.         if (sort_num==1) Sort_by_Name(k,files.count-1);
  828.         if (sort_num==2) Sort_by_Type(k,files.count-1);
  829.         if (sort_num==3) Sort_by_Size(k,files.count-1);
  830.         //make ".." first item in list
  831.         if (k>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0)
  832.                 for(k--; k>0; k--;) if (!strncmp(file_mas[k]*304+buf+72,"..",2)) {file_mas[k]><file_mas[0]; break;}
  833. }
  834.  
  835.  
  836. void Del_Form()
  837. {
  838.         dword selected_offset2;
  839.         int cont = 0;
  840.         byte f_count[128];
  841.         int dform_x = files.w - 220 / 2 + files.x;
  842.         if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return;
  843.         else
  844.         {
  845.                 if (!files.count) return;
  846.                 DrawPopup(dform_x,160,220,85,1,system.color.work,system.color.work_graph);
  847.                 WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE);
  848.                 for (i=0; i<files.count; i++)
  849.                 {
  850.                         selected_offset2 = file_mas[i]*304 + buf+32 + 7;
  851.                         if (ESBYTE[selected_offset2]) cont++;
  852.                 }
  853.                 if (cont)
  854.                 {
  855.                         sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,cont,DEL_MORE_FILES_2);
  856.                         WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count);
  857.                 }
  858.                 else
  859.                 {
  860.                         if (strlen(#file_name)<28)
  861.                         {
  862.                                 WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,system.color.work_text,"?");
  863.                                 WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,system.color.work_text,#file_name);
  864.                         }
  865.                         else
  866.                         {
  867.                                 WriteText(164+dform_x,190,0x80,0,"...?");
  868.                                 ESI = 24;
  869.                                 WriteText(dform_x+20,190,0,0,#file_name);
  870.                         }
  871.                 }
  872.                 DrawFlatButton(dform_x+27,208,70,20,301,0xFFB6B5,T_YES);
  873.                 DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_NO);               
  874.                 del_active=1;
  875.         }
  876. }
  877.  
  878. int del_error;
  879. int Del_File2(dword way, sh_progr)
  880. {    
  881.         /*dword dirbuf, fcount, i, filename;
  882.         int error;
  883.         char del_from[4096];
  884.         if (isdir(way))
  885.         {
  886.                 if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error;
  887.                 for (i=0; i<fcount; i++)
  888.                 {
  889.                         if (CheckEvent()==evReDraw) draw_window();
  890.                         filename = i*304+dirbuf+72;
  891.                         sprintf(#del_from,"%s/%s",way,filename);
  892.                         if ( TestBit(ESDWORD[filename-40], 4) )
  893.                         {
  894.                                 Del_File2(#del_from, 1);
  895.                         }
  896.                         else
  897.                         {
  898.                                 if (sh_progr) Operation_Draw_Progress(#del_from);
  899.                                 if (error = DeleteFile(#del_from)) del_error = error;
  900.                         }
  901.                 }
  902.         }
  903.         if (error = DeleteFile(way)) del_error = error;*/
  904.         fs.remove(way);
  905. }
  906.  
  907. void Del_File_Thread()
  908. {  
  909.         byte del_from[4096];
  910.         dword selected_offset2;
  911.         int tst, count, i;
  912.        
  913.         file_count_copy = 0;
  914.         copy_bar.value = 0;
  915.         operation_flag = DELETE_FLAG;
  916.        
  917.         if (selected_count)
  918.         {
  919.            for (i=0; i<files.count; i++)
  920.           {
  921.                selected_offset2 = file_mas[i]*304 + buf+32 + 7;
  922.                             if (ESBYTE[selected_offset2]) {
  923.                                         sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
  924.                                         GetFileInfo(#del_from, #file_info_count);
  925.                                         if ( file_info_count.isfolder ) DirFileCount(#del_from);
  926.                                         else file_count_copy++;
  927.                                 }
  928.            }
  929.         }
  930.         else
  931.         {
  932.                 if (itdir) DirFileCount(#file_path);
  933.                 else file_count_copy++;
  934.         }
  935.        
  936.         copy_bar.max = file_count_copy;
  937.        
  938.         //if (dodel==true)
  939.         //{
  940.                 //del_active=2;
  941.                 //if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
  942.                 del_error = 0;
  943.                 DisplayOperationForm();
  944.                 if (selected_count)
  945.                 {
  946.                    for (i=0; i<files.count; i++)
  947.            {
  948.                 selected_offset2 = file_mas[i]*304 + buf+32 + 7;
  949.                 if (ESBYTE[selected_offset2]) {
  950.                                         sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
  951.                     Del_File2(#del_from, 1);
  952.                 }
  953.             }
  954.                 }
  955.                 else
  956.                 {
  957.                    Del_File2(#file_path, 1);                   
  958.                 }
  959.                 if (del_error) Write_Error(del_error);
  960.         DialogExit();
  961.         //}
  962.         //del_active=0;
  963.         //DeleteButton(301);
  964.         //DeleteButton(302);
  965.         //Open_Dir(#path,WITH_REDRAW);
  966. }
  967.  
  968. void Del_File(byte dodel) {
  969.         del_active=0;
  970.         if (dodel)
  971.         {
  972.                 delete_stak = malloc(20000);
  973.                 CreateThread(#Del_File_Thread,delete_stak+20000-4);
  974.         }
  975.         else draw_window();
  976. }
  977.  
  978. void SelectFileByName(dword that_file)
  979. {
  980.         int ind;
  981.         files.KeyHome();
  982.         Open_Dir(#path,ONLY_OPEN);
  983.         if (!real_files_names_case) strttl(that_file);
  984.         for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
  985.         files.cur_y = ind - 1;
  986.         files.KeyDown();
  987.         List_ReDraw();
  988. }
  989.  
  990.  
  991. void Dir_Up()
  992. {
  993.         char cur_folder[4096];
  994.         i=strlen(#path)-1;
  995.         if (i==0) return;
  996.         path[i]=0x00;
  997.         i = strrchr(#path, '/');
  998.         strcpy(#cur_folder, #path+i);
  999.         path[i]=0x00;
  1000.         SelectFileByName(#cur_folder);
  1001. }
  1002.  
  1003. void Open(byte rez)
  1004. {
  1005.         byte temp[4096];
  1006.         selected_count = 0;
  1007.         if (rez)
  1008.         {
  1009.                 if (!strncmp(#file_name,"..",3)) return;
  1010.                 strcpy(#temp, #file_path);
  1011.                 if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end
  1012.                 RunProgram("/sys/File Managers/Eolite", #temp);
  1013.                 return;
  1014.         }
  1015.         if (!files.count) return;
  1016.         if (!itdir)
  1017.         {
  1018.                 if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path);
  1019.         }
  1020.         else
  1021.         {
  1022.                 if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
  1023.                 strcpy(#path, #file_path);
  1024.                 if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
  1025.                 files.first=files.cur_y=0;
  1026.                 Open_Dir(#path,WITH_REDRAW);
  1027.         }
  1028. }
  1029.  
  1030.  
  1031. inline fastcall void GoBack()
  1032. {
  1033.         char cur_folder[4096];
  1034.         strcpy(#cur_folder, GetCurrentFolder());
  1035.         if (HistoryPath(GO_BACK)) SelectFileByName(#cur_folder);
  1036. }
  1037.  
  1038. void ShowOpenWithDialog()
  1039. {
  1040.         byte param[4097];
  1041.         sprintf(#param,"~%s",#file_path);
  1042.         RunProgram("/sys/@open", #param);
  1043. }
  1044.  
  1045. void NewElement(byte newf)
  1046. {
  1047.         BDVK element_info;
  1048.         byte del_rezult, copy_rezult, info_result;
  1049.         if (newf)
  1050.         {
  1051.                 sprintf(#temp,"%s%s",#path,new_file_ed.text);
  1052.                 info_result = GetFileInfo(#temp, #element_info);
  1053.                 switch(new_element_active)
  1054.                 {
  1055.                         case CREATE_FILE:
  1056.                                 if (info_result==5)
  1057.                                 {
  1058.                                         WriteFile(0, 0, #temp);
  1059.                                         if (EAX)
  1060.                                         {
  1061.                                                 Write_Error(EAX);
  1062.                                                 ShowMessage(NOT_CREATE_FILE, 150);
  1063.                                         }
  1064.                                 }
  1065.                                 else
  1066.                                 {
  1067.                                         notify(FS_ITEM_ALREADY_EXISTS);
  1068.                                 }
  1069.                                 break;
  1070.                         case CREATE_FOLDER:
  1071.                                 if (info_result==5)
  1072.                                 {
  1073.                                         CreateDir(#temp);
  1074.                                         if (EAX)
  1075.                                         {
  1076.                                                 Write_Error(EAX);
  1077.                                                 ShowMessage(NOT_CREATE_FOLDER, 150);
  1078.                                         }
  1079.                                 }
  1080.                                 else
  1081.                                 {
  1082.                                         notify(FS_ITEM_ALREADY_EXISTS);
  1083.                                 }
  1084.                                 break;
  1085.                         case RENAME_ITEM:
  1086.                                 if (info_result==5)
  1087.                                 {
  1088.                                         if (itdir)
  1089.                                         {
  1090.                                                 if (del_rezult = DeleteFile(#file_path))
  1091.                                                 {
  1092.                                                         Write_Error(del_rezult);
  1093.                                                         ShowMessage(T_DEL_ERROR_1, 150);
  1094.                                                         return;
  1095.                                                 }
  1096.                                                 if (CreateDir(#temp)) CreateDir(#file_path);
  1097.                                                 Open_Dir(#path,WITH_REDRAW);
  1098.                                                 SelectFileByName(new_file_ed.text);
  1099.                                         }
  1100.                                         else
  1101.                                         {
  1102.                                                 if (copy_rezult = CopyFile(#file_path,#temp))
  1103.                                                 {
  1104.                                                         Write_Error(copy_rezult);
  1105.                                                 }
  1106.                                                 else
  1107.                                                 {
  1108.                                                         Del_File(true);
  1109.                                                         SelectFileByName(new_file_ed.text);
  1110.                                                 }
  1111.                                         }
  1112.                                 }
  1113.                                 else
  1114.                                 {
  1115.                                         notify(FS_ITEM_ALREADY_EXISTS);
  1116.                                 }
  1117.                 }
  1118.                 new_element_active = 0;
  1119.                 Open_Dir(#path,WITH_REDRAW);
  1120.                 SelectFileByName(new_file_ed.text);
  1121.         }
  1122.         new_element_active = 0;
  1123.         Open_Dir(#path,WITH_REDRAW);
  1124. }
  1125.  
  1126. void NewElement_Form(byte crt, dword strng)
  1127. {
  1128.         int dform_x=files.w-220/2+files.x;
  1129.         if (!new_element_active)
  1130.         {
  1131.                 new_element_active = crt;
  1132.                 strcpy(#new_element_name, strng);
  1133.                 new_file_ed.size = new_file_ed.pos = strlen(strng);
  1134.         }
  1135.         DrawPopup(dform_x,160,220,85,1,system.color.work,system.color.work_graph);
  1136.         new_file_ed.left = dform_x+24;
  1137.         edit_box_draw  stdcall (#new_file_ed);
  1138.         DrawRectangle(new_file_ed.left-1, new_file_ed.top-1, new_file_ed.width+2, 16, 0xFFFfff);
  1139.         DrawRectangle(new_file_ed.left-2, new_file_ed.top-2, new_file_ed.width+4, 18, system.color.work_graph);
  1140.         if (new_element_active==3) DrawFlatButton(dform_x+22,208,85,22,301,0xFFB6B5,T_RENAME);
  1141.         else DrawFlatButton(dform_x+27,208,70,22,301,0xFFB6B5,T_CREATE);
  1142.         DrawFlatButton(dform_x+120,208,70,22,302,0xC6DFC6,T_CANCEL);
  1143. }
  1144.  
  1145. void FnProcess(byte N)
  1146. {
  1147.         switch(N)
  1148.         {
  1149.                 case 1:
  1150.                         if (!active_about)
  1151.                         {
  1152.                                 about_stak = malloc(4096);
  1153.                                 about_window = CreateThread(#about_dialog,about_stak+4092);
  1154.                                 break;
  1155.                         }
  1156.                         else
  1157.                         {
  1158.                                 ActivateWindow(GetProcessSlot(about_window));
  1159.                         }
  1160.                         break;
  1161.                 case 2:
  1162.                         if (!files.count) break;
  1163.                         NewElement_Form(RENAME_ITEM, #file_name);
  1164.                         break;
  1165.                 case 3:
  1166.                         if (!itdir) RunProgram("/sys/tinypad", #file_path);
  1167.                         break;
  1168.                 case 4:
  1169.                         if (!itdir) RunProgram("/sys/develop/heed", #file_path);
  1170.                         break;
  1171.                 case 5: //refresh cur dir & devs
  1172.                         if (two_panels)
  1173.                         {
  1174.                                 DrawFilePanels();
  1175.                         }
  1176.                         else
  1177.                         {
  1178.                                 Tip(56, T_DEVICES, 55, "-");
  1179.                                 Open_Dir(#path,WITH_REDRAW);
  1180.                                 pause(10);
  1181.                                 GetSystemDiscs();
  1182.                                 Open_Dir(#path,WITH_REDRAW);
  1183.                                 DrawDeviceAndActionsLeftPanel();                               
  1184.                         }
  1185.                         break;
  1186.                 case 6:
  1187.                         NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER);
  1188.                         break;
  1189.                 case 7:
  1190.                         NewElement_Form(CREATE_FILE, T_NEW_FILE);
  1191.                         break;
  1192.                 case 8:
  1193.                         properties_stak = malloc(8096);
  1194.                         CreateThread(#properties_dialog, properties_stak+8092);
  1195.                         break;
  1196.                 case 10: //F10
  1197.                         if (!active_settings)
  1198.                         {
  1199.                                 settings_stak = malloc(4096);
  1200.                                 settings_window = CreateThread(#settings_dialog, settings_stak+4092);
  1201.                                 break;
  1202.                         }
  1203.                         else
  1204.                         {
  1205.                                 ActivateWindow(GetProcessSlot(settings_window));
  1206.                         }
  1207.                         break;
  1208.         }
  1209. }
  1210.  
  1211. void ChangeActivePanel()
  1212. {
  1213.         llist_copy(#files_active, #files_inactive);
  1214.         llist_copy(#files_inactive, #files);
  1215.         strcpy(#active_path, #inactive_path);
  1216.         strcpy(#inactive_path, #path);
  1217.         DrawFilePanels();
  1218. }
  1219.  
  1220.  
  1221. stop:
  1222.