Subversion Repositories Kolibri OS

Rev

Rev 5554 | Rev 5556 | 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 0xD0000
  10. #include "..\lib\kolibri.h"
  11. #include "..\lib\clipboard.h"
  12. #include "..\lib\strings.h"
  13. #include "..\lib\mem.h"
  14. #include "..\lib\dll.h"
  15. #include "..\lib\file_system.h"
  16. #include "..\lib\gui.h"
  17. #include "..\lib\list_box.h"
  18. #include "..\lib\copyf.h"
  19. #include "..\lib\random.h"
  20. //obj
  21. #include "..\lib\obj\libini.h"
  22. #include "..\lib\obj\box_lib.h"
  23. //images
  24. #include "imgs\toolbar.txt"
  25. #include "imgs\left_p.txt"
  26. #include "imgs\icons.txt"
  27.  
  28. #ifdef LANG_RUS
  29.         ?define T_FILE "” ©«"
  30.         ?define T_TYPE "’¨¯"
  31.         ?define T_SIZE " §¬¥à"
  32.         ?define T_NEW_FOLDER "®¢ ï ¯ ¯ª "
  33.         ?define T_NEW_FILE "®¢ë© ä ©«"
  34.         ?define T_DELETE_FILE "‚ë ¤¥©á⢨⥫쭮 å®â¨â¥ 㤠«¨âì"
  35.         ?define T_YES "„ "
  36.         ?define T_NO "¥â"
  37.         ?define T_CANCEL "Žâ¬¥­ "
  38.         ?define T_CREATE "‘®§¤ âì"
  39.         ?define T_DEL_ERROR_1 "Žè¨¡ª .  ¯ª  ­¥ ¯ãáâ ï."
  40.         ?define WAIT_DELETING_FOLDER "“¤ «ï¥âáï ¯ ¯ª . ®¤®¦¨â¥..."
  41.         ?define NOT_CREATE_FOLDER "¥ 㤠«®áì ᮧ¤ âì ¯ ¯ªã."
  42.         ?define NOT_CREATE_FILE "¥ 㤠«®áì ᮧ¤ âì ä ©«."
  43.         ?define ERROR_1 "Žè¨¡ª  ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ /rd/1/lib/box_lib.obj"
  44.         ?define T_PASTE_WINDOW_TITLE "Š®¯¨àãî..."
  45.         ?define T_PASTE_WINDOW_TEXT "Š®¯¨àã¥âáï ä ©«:"
  46.         ?define T_PASTE_WINDOW_BUTTON "à¥à¢ âì"       
  47.         ?define INFO_AFTER_COPY "Š®¯¨à®¢ ­¨¥ § ¢¥à襭®"
  48.         ?define T_CANCEL_PASTE "Š®¯¨à®¢ ­¨¥ ¯à¥ªà é¥­®.  ¯ª  ᪮¯¨à®¢ ­  ­¥ ¯®«­®áâìî."
  49.         ?define T_SELECT_APP_TO_OPEN_WITH "‚ë¡¥à¨â¥ ¯à®£à ¬¬ã ¤«ï ®âªàëâ¨ï ä ©« "
  50.         ?define DEL_MORE_FILES_1 "¢ë¡à ­­ë¥ í«¥¬¥­âë ("
  51.         ?define DEL_MORE_FILES_2 " èâ.)?"
  52. #elif LANG_EST
  53.         ?define T_FILE "Fail"
  54.         ?define T_TYPE "Tüüp"
  55.         ?define T_SIZE "Suurus"
  56.         ?define T_NEW_FOLDER "Uus kataloog"
  57.         ?define T_NEW_FILE "Uus fail"
  58.         ?define T_DELETE_FILE "Kas sa tahad tõesti kustutada"
  59.         ?define T_YES "Jah"
  60.         ?define T_NO "Ei"
  61.         ?define T_DEL_ERROR_1 "Viga. Kataloog ei ole tühi."
  62.         ?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
  63.         ?define NOT_CREATE_FOLDER "Kataloogi ei saa luua."
  64.         ?define NOT_CREATE_FILE "Faili ei saa luua."
  65.         ?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj"
  66.         ?define T_PASTE_WINDOW_TITLE "Kopeerin..."
  67.         ?define T_PASTE_WINDOW_TEXT "Kopeerin faili:"
  68.         ?define T_PASTE_WINDOW_BUTTON "Abort"
  69.         ?define INFO_AFTER_COPY "Copy finished"
  70.         ?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
  71.         ?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file"
  72.         ?define DEL_MORE_FILES_1 "selected items("
  73.         ?define DEL_MORE_FILES_2 " pcs.)?"
  74. #else
  75.         ?define T_FILE "File"
  76.         ?define T_TYPE "Type"
  77.         ?define T_SIZE "Size"
  78.         ?define T_NEW_FOLDER "New folder"
  79.         ?define T_NEW_FILE "New file"
  80.         ?define T_DELETE_FILE "Do you really want to delete"
  81.         ?define T_YES "Yes"
  82.         ?define T_NO "No"
  83.         ?define T_DEL_ERROR_1 "Error. Folder isn't empty."
  84.         ?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
  85.         ?define NOT_CREATE_FOLDER "Folder can not be created."
  86.         ?define NOT_CREATE_FILE "File can not be created."
  87.         ?define ERROR_1 "Error while loading library /rd/1/lib/box_lib.obj"
  88.         ?define T_PASTE_WINDOW_TITLE "Copying..."
  89.         ?define T_PASTE_WINDOW_TEXT "Copying file:"
  90.         ?define T_PASTE_WINDOW_BUTTON "Abort"
  91.         ?define INFO_AFTER_COPY "Copy finished"
  92.         ?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
  93.         ?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file"
  94.         ?define DEL_MORE_FILES_1 "selected items("
  95.         ?define DEL_MORE_FILES_2 " pcs.)?"
  96. #endif
  97.  
  98. enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
  99.  
  100. #define TITLE "Eolite File Manager v2.77"
  101. #define ABOUT_TITLE "Eolite v2.77"
  102. dword col_padding, col_selec, col_lpanel;
  103.  
  104. int toolbar_buttons_x[7]={9,46,85,134,167,203};
  105. struct path_string { char Item[4096]; };
  106.  
  107. byte active_about=0;
  108. word about_window;
  109. byte active_settings=0;
  110. word settings_window;
  111.  
  112. byte menu_call_mouse=0;
  113.  
  114. llist files;
  115.  
  116. byte
  117.         path[4096],
  118.         file_path[4096],
  119.         file_name[256],
  120.         new_element_name[256],
  121.         temp[4096];      
  122. byte
  123.         rename_active=0,
  124.         del_active=0,
  125.         new_element_active=0,
  126.         show_dev_name=1,
  127.         real_files_names_case=0,
  128.         use_big_fonts=0,
  129.         font_type,
  130.         info_after_copy=0,
  131.         sort_num=2,
  132.         itdir;
  133.  
  134. dword eolite_ini_path;
  135.  
  136. proc_info Form;
  137. system_colors sc;
  138. mouse m;
  139. int mouse_dd, scroll_used, sc_slider_h, sorting_arrow_x, kolibrios_drive;
  140. dword buf;
  141. dword file_mas[6898];
  142. int j, i;
  143. int action_buf;
  144. int rand_n;
  145. int selected_count;
  146.  
  147. mouse gestures;
  148. signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
  149. byte stats;
  150.  
  151. edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6};
  152. edit_box new_file_ed = {150,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#new_element_name,#mouse_dd,64,6,6};
  153. PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
  154. PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
  155.  
  156. #include "include\copy.h"
  157. #include "include\gui.h"
  158. #include "include\sorting.h"
  159. #include "include\icons.h"
  160. #include "include\left_panel.h"
  161. #include "include\history.h"
  162. #include "include\menu.h"
  163. #include "include\about.h"
  164. #include "include\settings.h"
  165. #include "include\properties.h"
  166.  
  167. void main()
  168. {
  169.         word key, id, can_show, can_select, m_selected;
  170.         dword selected_offset;
  171.         rand_n = random(40);
  172.         gestures.get();
  173.         mem_Init();
  174.         if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_1);
  175.     if (load_dll2(libini, #lib_init,1)!=0) notify("Error: library doesn't exists - libini");
  176.         eolite_ini_path = abspath("Eolite.ini");
  177.         LoadIniSettings();
  178.         GetSystemDiscs();
  179.         SetAppColors();
  180.         strcpy(#new_element_name, T_NEW_FILE);
  181.         new_file_ed.size = strlen(T_NEW_FILE);
  182.         if (param)
  183.         {
  184.                 strcpy(#path, #param);
  185.                 if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string
  186.         }
  187.         else
  188.         {
  189.                 strcpy(#path, "/rd/1/");               
  190.         }
  191.         Open_Dir(#path,ONLY_OPEN);
  192.         SetEventMask(0x27);
  193.         loop() switch(WaitEvent())
  194.         {
  195.                 case evMouse:
  196.                         if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break;
  197.                         if (new_element_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2)
  198.                         {
  199.                                 edit_box_mouse stdcall(#new_file_ed);
  200.                                 break;
  201.                         }                              
  202.                         if (rename_active) { edit_box_mouse stdcall(#edit2); break; }
  203.                        
  204.                         m.get();
  205.                        
  206.                        
  207.                         gestures.get();
  208.                         if (!gestures.mkm) && (stats>0) stats = 0;
  209.                         if (gestures.mkm) && (stats==0)
  210.                         {
  211.                                 x_old = gestures.x;
  212.                                 y_old = gestures.y;
  213.                                 stats = 1;
  214.                         }
  215.                         if (gestures.mkm) && (stats==1)
  216.                         {
  217.                                 dif_x = gestures.x-x_old;
  218.                                 dif_y = gestures.y-y_old;
  219.                                 adif_x = fabs(dif_x);
  220.                                 adif_y = fabs(dif_y);
  221.                                
  222.                                 if (adif_x>adif_y)
  223.                                 {
  224.                                         if (dif_x > 150)
  225.                                         {
  226.                                                 if (HistoryPath(GO_FORWARD))
  227.                                                         {
  228.                                                                 files.first=files.current=NULL;
  229.                                                                 Open_Dir(#path,WITH_REDRAW);
  230.                                                         }
  231.                                                 stats = 0;
  232.                                         }
  233.                                         if (dif_x < -150)
  234.                                         {
  235.                                                 GoBack();
  236.                                                 stats = 0;
  237.                                         }
  238.                                 }
  239.                                 else
  240.                                 {
  241.                                         if (dif_y < -100)
  242.                                         {
  243.                                                 Dir_Up();
  244.                                                 stats = 0;
  245.                                         }
  246.                                 }
  247.                         }
  248.                        
  249.  
  250.                         if (files.MouseOver(m.x, m.y)) && (!can_select)
  251.                         {
  252.                                 m_selected = m.y - files.y / files.line_h;
  253.                                 if (m.lkm) can_select = 1;
  254.                                 if (m.pkm)
  255.                                 {
  256.                                         can_show = 1;
  257.                                         if (m.y - files.y / files.line_h != files.current) can_select = 1;
  258.                                 }
  259.                         }
  260.  
  261.                         //select/open file {
  262.                         if (!m.lkm) && (!m.pkm) && (can_select)
  263.                         {
  264.                                 can_select = 0;
  265.                                 if (m.y>=files.y)
  266.                                 {
  267.                                         id = m.y - files.y / files.line_h;
  268.                                         if (id!=m_selected)
  269.                                         {
  270.                                                 can_show=0;
  271.                                                 break;
  272.                                         }
  273.                                         if (files.current!=id)
  274.                                         {
  275.                                                 if (id<files.visible) List_Current(id-files.current);
  276.                                         }
  277.                                         else
  278.                                                 Open(0);
  279.                                 }
  280.                         };
  281.                         // } select/open file
  282.  
  283.                         //file menu {
  284.                         if (!m.pkm) && (!m.lkm) && (can_show)
  285.                         {
  286.                                 can_show = 0;
  287.                                 menu_call_mouse = 1;
  288.                                 if (m.y>=files.y)
  289.                                 {
  290.                                         SwitchToAnotherThread();
  291.                                         CreateThread(#FileMenu,#menu_stak+4092);
  292.                                 }
  293.                                 break;
  294.                         }
  295.                         // } file menu
  296.  
  297.                         if (m.vert)
  298.                         {
  299.                                 if (files.MouseScroll(m.vert)) List_ReDraw();
  300.                                 break;
  301.                         }
  302.  
  303.                         if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<files.y)
  304.                         {
  305.                                 IF (m.lkm==1) DrawRectangle3D(Form.cwidth - 17,41,14,14,0xC7C7C7,0xFFFFFF);
  306.                                 WHILE (m.lkm==1) && (files.first>0)
  307.                                 {
  308.                                         pause(8);
  309.                                         files.first--;
  310.                                         List_ReDraw();
  311.                                         m.get();
  312.                                 }
  313.                                 DrawRectangle3D(Form.cwidth - 17,41,14,14,0xFFFFFF,0xC7C7C7);
  314.                         }
  315.  
  316.                         if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>onTop(22,0)+1) && (m.y<onTop(22,0)+16)
  317.                         {
  318.                                 IF (m.lkm==1) DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xC7C7C7,0xFFFFFF);
  319.                                 while (m.lkm==1) && (files.first<files.count-files.visible)
  320.                                 {
  321.                                         pause(8);
  322.                                         files.first++;
  323.                                         List_ReDraw();
  324.                                         m.get();
  325.                                 }
  326.                                 DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xFFFFFF,0xC7C7C7);
  327.                         }
  328.  
  329.                         //Scrooll
  330.                         if (!m.lkm) && (scroll_used) { scroll_used=NULL; Scroll(); }
  331.                         if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.y<Form.height) && (m.lkm) && (!scroll_used) {scroll_used=1;Scroll();}
  332.                        
  333.                         if (scroll_used)
  334.                         {
  335.                                 IF (sc_slider_h/2+files.y>m.y) || (m.y<0) || (m.y>4000) m.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii
  336.                                 id=files.first;
  337.                                 j= sc_slider_h/2;
  338.                                 files.first = m.y -j -files.y * files.count;
  339.                                 files.first /= onTop(22,files.y);
  340.                                 IF (files.visible+files.first>files.count) files.first=files.count-files.visible;
  341.                                 IF (id!=files.first) List_ReDraw();
  342.                         }
  343.                         break;  
  344. //Button pressed-----------------------------------------------------------------------------
  345.                 case evButton:
  346.                         id=GetButtonID();
  347.                         if (id==1)
  348.                         {
  349.                                 KillProcess(about_window);
  350.                                 ExitProcess();
  351.                         }
  352.                         if (rename_active) break;
  353.                         if (del_active)
  354.                         {
  355.                                 IF (id==301) || (id==302) Del_File(302-id);
  356.                                 break;
  357.                         }
  358.                         if (new_element_active)
  359.                         {
  360.                                 IF (id==301) || (id==302) NewElement(302-id);
  361.                                 break;
  362.                         }
  363.                        
  364.                         switch(id)
  365.                         {
  366.                                 case 21: //Back
  367.                                                 GoBack();
  368.                                                 break;
  369.                                 case 22: //Forward
  370.                                                 if (HistoryPath(GO_FORWARD))
  371.                                                 {
  372.                                                         files.first=files.current=NULL; //aaa?o nienea
  373.                                                         Open_Dir(#path,WITH_REDRAW);
  374.                                                 }
  375.                                                 break;
  376.                                 case 23: //up!
  377.                                                 Dir_Up();
  378.                                                 break;
  379.                                 case 24: //cut
  380.                                                 Copy(#file_path, CUT);
  381.                                                 break;
  382.                                 case 25: //copy
  383.                                                 Copy(#file_path, NOCUT);
  384.                                                 break;
  385.                                 case 26: //paste
  386.                                                 CreateThread(#Paste,#copy_stak+4092);
  387.                                                 break;
  388.                                 case 31...33: //sort
  389.                                                 IF(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10);
  390.                                                 IF(sort_num==2) DrawFilledBar(sorting_arrow_x,42,6,10);
  391.                                                 IF(sort_num==3) DrawFilledBar(sorting_arrow_x,42,6,10);
  392.                                                 sort_num=id-30;
  393.                                                 Open_Dir(#path,WITH_REDRAW);
  394.                                                 break;
  395.                                 case 50...60: //Actions
  396.                                                 FnProcess(id-50);
  397.                                                 break;
  398.                                 case 100...120:
  399.                                         DEVICE_MARK:
  400.                                                 DrawRectangle(17,id-100*16+74,159,16, 0); //auaaeaiea
  401.                                                 strcpy(#path, #disk_list[id-100].Item);
  402.                                                 files.first=files.current=0;
  403.                                                 Open_Dir(#path,WITH_REDRAW);
  404.                                                 pause(5);
  405.                                                 DrawRectangle(17,id-100*16+74,159,16, 0xFFFFFF);
  406.                                                 break;
  407.                         }
  408.                         break;
  409. //Key pressed-----------------------------------------------------------------------------
  410.                 case evKey:
  411.                         key = GetKey();
  412.                         if (Form.status_window>2) break;
  413.                         IF (del_active)
  414.                         {
  415.                                 IF (key==013) Del_File(true);
  416.                                 IF (key==027) Del_File(false);
  417.                                 break;
  418.                         }
  419.                         IF (new_element_active)
  420.                         {
  421.                                 IF (key==027) NewElement(0);
  422.                                 EAX=key<<8;
  423.                                 edit_box_key stdcall (#new_file_ed);
  424.                                 break;
  425.                         }
  426.                         IF (edit2.flags!=64) && (key!=13) && (key!=27)
  427.                         {
  428.                                 EAX=key<<8;
  429.                                 edit_box_key stdcall (#edit2);
  430.                                 break;
  431.                         }
  432.                         switch (key)
  433.                         {
  434.                                         case 209...217:
  435.                                                         id=key-110;
  436.                                                         IF (id-100>=disc_num) break;
  437.                                                         GOTO DEVICE_MARK;
  438.                                         case ASCII_KEY_BS:
  439.                                                         //GoBack();
  440.                                                         Dir_Up();
  441.                                                         break;
  442.                                         case 004: //Ctrl+D set as bg
  443.                                                         strcpy(#temp, "\\S__");
  444.                                                         strcat(#temp, #file_path);
  445.                                                         RunProgram("/sys/media/kiv", #temp);
  446.                                                         break;
  447.                                         case 014: //Ctrl+N new window
  448.                                                         IF (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD);
  449.                                                         RunProgram("/sys/File Managers/Eolite", #path);
  450.                                                         break;
  451.                                         case 024: //Ctrl+X
  452.                                                         Copy(#file_path, CUT);
  453.                                                         break;
  454.                                         case 003: //Ctrl+C
  455.                                                         Copy(#file_path, NOCUT);
  456.                                                         break;
  457.                                         case 022: //Ctrl+V
  458.                                                         CreateThread(#Paste,#copy_stak+4092);
  459.                                                         break;
  460.                                         case 001: //Ctrl+A
  461.                                                         debugln("press Ctrl+A");
  462.                                                         for (i=0; i<files.count; i++)
  463.                                                         {
  464.                                                                 selected_offset = file_mas[i]*304 + buf+32 + 7;
  465.                                                                 ESBYTE[selected_offset] = 1;
  466.                                                                 selected_count++;
  467.                                                         }
  468.                                                         List_ReDraw();
  469.                                                         break;
  470.                                         case 021: //Ctrl+U
  471.                                                         debugln("press Ctrl+A");
  472.                                                         for (i=0; i<files.count; i++)
  473.                                                         {
  474.                                                                 selected_offset = file_mas[i]*304 + buf+32 + 7;
  475.                                                                 ESBYTE[selected_offset] = 0;
  476.                                                         }
  477.                                                         selected_count = 0;
  478.                                                         List_ReDraw();
  479.                                                         break;
  480.                                         case ASCII_KEY_ESC:
  481.                                                         IF (rename_active==1) ReName(false);
  482.                                                         break;
  483.                                         case ASCII_KEY_ENTER:
  484.                                                         IF (rename_active==1) {ReName(true); break;}
  485.                                                         Open(0);
  486.                                                         break;
  487.                                         case 074: //menu
  488.                                                         menu_call_mouse=0;
  489.                                                         SwitchToAnotherThread();
  490.                                                         CreateThread(#FileMenu,#menu_stak+4092);
  491.                                                         break;
  492.                                         case 173: //Ctrl+Enter
  493.                                                         if (!itdir) ShowOpenWithDialog();
  494.                                                         else Open(1);
  495.                                                         break;
  496.                                         case ASCII_KEY_UP:
  497.                                                         List_Current(-1);
  498.                                                         break;
  499.                                         case ASCII_KEY_DOWN:
  500.                                                         List_Current(1);
  501.                                                         break;
  502.                                         case ASCII_KEY_HOME:
  503.                                                         if (files.KeyHome()) List_ReDraw();
  504.                                                         break;
  505.                                         case ASCII_KEY_END:
  506.                                                         if (files.KeyEnd()) List_ReDraw();
  507.                                                         break;
  508.                                         case ASCII_KEY_PGDN:
  509.                                                         List_Current(files.visible-1);
  510.                                                         break;
  511.                                         case ASCII_KEY_PGUP:
  512.                                                         List_Current(-files.visible+1);
  513.                                                         break;
  514.                                         case ASCII_KEY_DEL:
  515.                                                         Del_Form();
  516.                                                         break;
  517.                                         case ASCII_KEY_INS:
  518.                                                         selected_offset = file_mas[files.current+files.first]*304 + buf+32 + 7;
  519.                                                         if (ESBYTE[selected_offset])
  520.                                                         {
  521.                                                                 ESBYTE[selected_offset]=0;
  522.                                                                 selected_count--;
  523.                                                         }
  524.                                                         else
  525.                                                         {
  526.                                                                 ESBYTE[selected_offset] = 1;
  527.                                                                 selected_count++;
  528.                                                         }
  529.                                                         List_Current(1);
  530.                                                         break;
  531.                                         case 048...059: //F1-F10
  532.                                                         FnProcess(key-49);
  533.                                                         break;
  534.                                         default:    
  535.                                                         for (i=files.current+files.first+1; i<files.count; i++)
  536.                                                         {
  537.                                                                 strcpy(#temp, file_mas[i]*304+buf+72);
  538.                                                                 IF (temp[0]==key) || (temp[0]==key-32)
  539.                                                                 {
  540.                                                                         List_Current(i-files.current-files.first);
  541.                                                                         break;
  542.                                                                 }
  543.                                                         }
  544.                         }                        
  545.                         break;
  546.                 case evReDraw:
  547.                         draw_window();
  548.                         if (action_buf) { menu_action(action_buf); action_buf=0;}
  549.         }
  550. }
  551.  
  552.  
  553. inline fastcall signed int _strrchr( ESI,BL)
  554. {
  555.         int jj=0, last=strlen(ESI);
  556.         do{
  557.                 jj++;
  558.                 $lodsb
  559.                 IF(AL==BL) last=jj;
  560.         } while(AL!=0);
  561.         return last;
  562. }
  563.  
  564.  
  565. void menu_action(dword id)
  566. {
  567.         if (id==COPY_PASTE_END)
  568.         {
  569.                 FnProcess(5);
  570.                 SelectFile(#copy_to+strrchr(#copy_to,'/'));
  571.         }
  572.         if (id==100) Open(0);
  573.         if (id==201) ShowOpenWithDialog();
  574.         if (id==202) FnProcess(3); //F3
  575.         if (id==203) FnProcess(4); //F4
  576.         if (id==104) Copy(#file_path, NOCUT);
  577.         if (id==105) Copy(#file_path, CUT);
  578.         if (id==106) CreateThread(#Paste,#copy_stak+4092);
  579.         if (id==207) FnProcess(2);
  580.         if (id==108) Del_Form();
  581.         if (id==109) FnProcess(5);
  582.         if (id==110) FnProcess(8);
  583.         if (id==300) { FnProcess(5); List_ReDraw(); }
  584. }
  585.  
  586.  
  587. void draw_window()
  588. {
  589.         DefineAndDrawWindow(GetScreenWidth()-550/4+rand_n,rand_n+30,550,500,0x73,sc.work,TITLE,0);
  590.         GetProcessInfo(#Form, SelfInfo);
  591.         if (Form.status_window>2) return;
  592.         files.SetSizes(192, 57, Form.cwidth - 210, onTop(57,6), disc_num*16+195,files.line_h);
  593.         if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h);
  594.         if (Form.width<480) MoveSize(OLD,OLD,480,OLD);
  595.         GetProcessInfo(#Form, SelfInfo); //if win_size changed
  596.  
  597.         PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
  598.         DrawBar(127, 8, 1, 25, sc.work_graph);
  599.         for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,sc.work);
  600.         for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,sc.work);
  601.         DrawBar(246,0,Form.cwidth - 297,12, sc.work); //upper editbox
  602.         DrawBar(246,29,Form.cwidth - 297,5,sc.work);  //under editbox
  603.         DrawRectangle(246,12,Form.cwidth - 303,16,sc.work_graph);
  604.         DefineButton(Form.cwidth - 25,6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about
  605.         PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal);
  606.         //main rectangles
  607.         DrawRectangle(1,40,Form.cwidth-3,onTop(46,0),sc.work_graph);
  608.         DrawRectangle(0,39,Form.cwidth-1,onTop(44,0),col_palette[4]); //bg
  609.         for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);
  610.         DrawLeftPanel();
  611.         //ListBox
  612.         DrawFlatButton(files.x,40,Form.cwidth - files.x - 159,16,31,sc.work,T_FILE);
  613.         DrawFlatButton(Form.cwidth - 159,40,73,16,32,sc.work,T_TYPE);
  614.         DrawFlatButton(Form.cwidth - 86,40,68,16,33,sc.work,T_SIZE);
  615.         DrawBar(files.x+files.w,files.y,1,onTop(22,files.y),sc.work_graph); //line to the left from the scroll
  616.         DrawFlatButton(files.x+files.w,40,16,16,0,sc.work,"\x18");
  617.         DrawFlatButton(files.x+files.w,onTop(22,0),16,16,0,sc.work,"\x19");
  618.         Open_Dir(#path,ONLY_SHOW);
  619.         if (del_active) Del_Form();
  620.         if (new_element_active) NewElement_Form();
  621.         if (rename_active) FnProcess(2);
  622. }
  623.  
  624.  
  625. void KEdit()
  626. {
  627.         if (Form.width<480) return;
  628.         PathShow.area_size_x = Form.cwidth-306;
  629.         DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff);
  630.         PathShow_prepare stdcall(#PathShow);
  631.         PathShow_draw stdcall(#PathShow);
  632. }
  633.  
  634.  
  635. void List_Current(signed int cur)
  636. {
  637.         if (cur<=0) //up
  638.         {
  639.                 IF (files.first==0) && (files.current<=0) return;
  640.                 IF (-cur-1<files.current)
  641.                 {
  642.                         Line_ReDraw(0xFFFFFF, files.current);
  643.                         files.current+=cur;
  644.                         Line_ReDraw(col_selec, files.current);
  645.                         return;
  646.                 }
  647.                 ELSE
  648.                 {
  649.                         IF (-cur<files.first) files.first+=cur; ELSE files.first=0;
  650.                         files.current=0;
  651.                         List_ReDraw();
  652.                         return;
  653.                 }
  654.         }
  655.         else  //down
  656.         {
  657.                 IF (files.first==files.count-files.visible) && (files.current==files.visible-1)
  658.                 {
  659.                         Line_ReDraw(col_selec, files.current);
  660.                         return;
  661.                 }
  662.                 IF (files.visible-files.current>cur)
  663.                 {
  664.                         Line_ReDraw(0xFFFFFF, files.current);
  665.                         files.current+=cur;
  666.                         Line_ReDraw(col_selec, files.current);
  667.                         return;
  668.                 }
  669.                 else
  670.                 {
  671.                         IF(files.first+files.current+cur>=files.count)
  672.                         {
  673.                                 files.first=files.count-files.visible;
  674.                                 files.current=cur-files.first+files.current;
  675.                                 }
  676.                         ELSE
  677.                         {
  678.                                 files.first+=cur+files.current-files.visible+1;
  679.                                 files.current=files.visible-1;
  680.                         }
  681.                        
  682.                         IF (files.current<0) || (files.current>files.visible)
  683.                         {
  684.                                 files.current=files.visible-1;
  685.                         }
  686.                         List_ReDraw();
  687.                 }
  688.         }
  689. }
  690.  
  691.  
  692. void List_ReDraw()
  693. {
  694.         int paint_y;
  695.         //we are in the end of the list => maximize window => there will be white lines after the last element
  696.         if (files.count-files.first<files.visible) || (files.current>files.visible-1)
  697.         { files.first=files.count-files.visible; files.current=files.visible-1; }
  698.         for (j=0; j<files.visible; j++) if (files.current!=j) Line_ReDraw(0xFFFFFF, j); else Line_ReDraw(col_selec, files.current);
  699.         //in the bottom
  700.         paint_y = j * files.line_h + files.y;
  701.         DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF);
  702.         DrawBar(Form.cwidth-159,paint_y,1,onTop(paint_y,6),sc.work);
  703.         DrawBar(Form.cwidth-86,paint_y,1,onTop(paint_y,6),sc.work);
  704.         Scroll();
  705. }
  706.  
  707.  
  708. void Line_ReDraw(dword color, filenum){
  709.         dword text_col=0,
  710.               ext1, attr,
  711.               file_offet,
  712.               file_name_off,
  713.               y=filenum*files.line_h+files.y;
  714.               BDVK file;
  715.         if (filenum==-1) return;
  716.         DrawBar(files.x,y,3,files.line_h,color);
  717.         DrawBar(files.x+19,y,files.w-19,files.line_h,color);
  718.         DrawBar(files.x+3,y+17,16,1,color);
  719.         if (files.line_h>18) DrawBar(files.x+3,y+18,16,files.line_h-18,color);
  720.         if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,color);
  721.  
  722.         file_offet = file_mas[filenum+files.first]*304 + buf+32;
  723.         attr = ESDWORD[file_offet];
  724.         file.selected = ESBYTE[file_offet+7];
  725.         file.sizelo   = ESDWORD[file_offet+32];
  726.         file_name_off = file_offet+40;
  727.  
  728.         if (! TestBit(attr, 4) ) //file or folder?
  729.         {      
  730.                 Put_icon(file_name_off+_strrchr(file_name_off,'.'), files.x+3, files.line_h/2-7+y, color, 0);
  731.                 WriteText(7-strlen(ConvertSize(file.sizelo))*6+Form.cwidth - 76,files.line_h-6/2+y,font_type,0,ConvertSize(file.sizelo));
  732.         }
  733.         else
  734.         {
  735.                 if (strcmp("..",file_name_off)==0) ext1=".."; else ext1="<DIR>";
  736.                 Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0);               
  737.         }
  738.  
  739.         if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
  740.         if (color!=0xFFFfff)
  741.         {
  742.                 itdir = TestBit(attr, 4);
  743.                 strcpy(#file_name, file_name_off);
  744.                 strcpy(#file_path, #path);
  745.                 strcat(#file_path, #file_name);
  746.                 if (text_col==0xA6A6B7) text_col=0xFFFFFF;
  747.         }
  748.         if (file.selected) text_col=0xFF0000;
  749.         if (Form.width>=480)
  750.         {
  751.                 FileShow.start_x = files.x + 23;
  752.                 FileShow.font_color = text_col;
  753.                 FileShow.area_size_x = Form.width - 380;
  754.                 FileShow.text_pointer = file_name_off;
  755.                 FileShow.start_y = files.text_y+y;
  756.                 PathShow_prepare stdcall(#FileShow);
  757.                 PathShow_draw stdcall(#FileShow);
  758.         }
  759.         DrawBar(Form.cwidth-159,y,1,files.line_h,sc.work); //gray line 1
  760.         DrawBar(Form.cwidth-86,y,1,files.line_h,sc.work); //gray line 2
  761. }
  762.  
  763.  
  764. void Open_Dir(dword dir_path, redraw){
  765.         int errornum, maxcount;
  766.  
  767.         if (redraw!=ONLY_SHOW)
  768.         {
  769.                 if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0';
  770.                 if (buf) free(buf);
  771.                 errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
  772.                 if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/');
  773.                 if (errornum)
  774.                 {
  775.                         HistoryPath(ADD_NEW_PATH);
  776.                         GoBack();
  777.                         Write_Error(errornum);
  778.                         return;
  779.                 }
  780.                 maxcount = sizeof(file_mas)/sizeof(dword)-1;
  781.                 if (files.count>maxcount) files.count = maxcount;
  782.                 if (files.count>0) && (files.current==-1) files.current=0;
  783.         }
  784.         if (files.count!=-1)
  785.         {
  786.                 KEdit();
  787.                 HistoryPath(ADD_NEW_PATH);
  788.                 files.visible = files.h / files.line_h;
  789.                 IF (files.count < files.visible) files.visible = files.count;
  790.                 IF (sort_num==1) sorting_arrow_x = Form.width+60/2;
  791.                 IF (sort_num==2) sorting_arrow_x = Form.width-115;
  792.                 IF (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
  793.                 WriteText(sorting_arrow_x,45,0x80,sc.work_graph,"\x19");
  794.                 IF (redraw!=ONLY_SHOW) Sorting();
  795.                 IF (redraw!=ONLY_OPEN) List_ReDraw();
  796.         }
  797.         IF (files.count==-1) && (redraw!=ONLY_OPEN) {files.visible=files.count=0; List_ReDraw();}
  798. }
  799.  
  800.  
  801. inline Sorting()
  802. {
  803.         dword k=0, l=1;
  804.         dword file_off;
  805.         int i;
  806.         if (!strcmp(#path,"/")) //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.         //".." should be first
  831.         IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")!=0)
  832.                 FOR(k--; k>0; k--;) IF (!strcmp(file_mas[k]*304+buf+72,"..")) {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 (strcmp(#file_name,".")==0) || (strcmp(#file_name,"..")==0) return;
  843.         if (del_active==2)
  844.         {
  845.                 if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
  846.         }
  847.         else
  848.         {
  849.                 if (!files.count) return;
  850.                 DrawPopup(dform_x,160,220,80,1,sc.work,sc.work_graph);
  851.                 WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,sc.work_text,T_DELETE_FILE);
  852.                 for (i=0; i<files.count; i++)
  853.                 {
  854.                         selected_offset2 = file_mas[i]*304 + buf+32 + 7;
  855.                         if (ESBYTE[selected_offset2]) cont++;
  856.                 }
  857.                 if (cont)
  858.                 {
  859.                         strcpy(#f_count, DEL_MORE_FILES_1);
  860.                         strcat(#f_count, itoa(cont));
  861.                         strcat(#f_count, DEL_MORE_FILES_2);
  862.                         WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count);
  863.                 }
  864.                 else
  865.                 {
  866.                         IF (strlen(#file_name)<28)
  867.                         {
  868.                                 WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?");
  869.                                 WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name);
  870.                         }
  871.                         else
  872.                         {
  873.                                 WriteText(164+dform_x,190,0x80,0,"...?");
  874.                                 ESI = 24;
  875.                                 WriteText(dform_x+20,190,0,0,#file_name);
  876.                         }
  877.                 }
  878.                 DrawFlatButton(dform_x+27,208,70,20,301,0xFFB6B5,T_YES);
  879.                 DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_NO);               
  880.                 del_active=1;
  881.         }
  882. }
  883.  
  884. int del_error;
  885. int Del_File2(dword way)
  886. {    
  887.         dword dirbuf, fcount, i, filename;
  888.         int error;
  889.         char del_from[4096];
  890.         if (isdir(way))
  891.         {
  892.                 if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error;
  893.                 for (i=0; i<fcount; i++)
  894.                 {
  895.                         if (CheckEvent()==evReDraw) draw_window();
  896.                         filename = i*304+dirbuf+72;
  897.                         strcpy(#del_from, way);
  898.                         chrcat(#del_from, '/');
  899.                         strcat(#del_from, filename);
  900.                         if ( TestBit(ESDWORD[filename-40], 4) )
  901.                                 Del_File2(#del_from);
  902.                         else
  903.                         {
  904.                                 if (error = DeleteFile(#del_from)) del_error = error;
  905.                         }
  906.                 }
  907.         }
  908.         if (error = DeleteFile(way)) del_error = error;
  909. }
  910.  
  911.  
  912. void Del_File(byte dodel)
  913. {  
  914.         byte del_from[4096];
  915.         dword selected_offset2;
  916.         int tst, count, i;
  917.        
  918.         if (dodel==true)
  919.         {
  920.                 del_active=2;
  921.                 if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
  922.                 del_error = 0;
  923.                
  924.                 if (selected_count)
  925.                 {
  926.                    for (i=0; i<files.count; i++)
  927.            {
  928.                 selected_offset2 = file_mas[i]*304 + buf+32 + 7;
  929.                 if (ESBYTE[selected_offset2]) {
  930.                     strcpy(#del_from, #path);
  931.                     strcat(#del_from, file_mas[i]*304+buf+72);
  932.                     Del_File2(#del_from);
  933.                 }
  934.             }
  935.                 }
  936.                 else
  937.                 {
  938.                    Del_File2(#file_path);                      
  939.                 }
  940.                 if (del_error) Write_Error(del_error);
  941.         }
  942.         del_active=0;
  943.         DeleteButton(301);
  944.         DeleteButton(302);
  945.         Open_Dir(#path,WITH_REDRAW);
  946. }
  947.  
  948.  
  949. void ReName(byte rename)
  950. {
  951.         int del_rezult, copy_rezult;
  952.         char edit_name[256];
  953.         rename_active=0;
  954.         edit2.flags=64;
  955.         if (rename==true)
  956.         {
  957.                 strcpy(#temp, #path);
  958.                 strcpy(#edit_name, #file_name); //save edit name to select it later
  959.                 strcat(#temp, #file_name);
  960.                 if (strcmpi(#file_path,#temp)!=0) && (file_name)
  961.                 if (itdir)
  962.                 {
  963.                         if (del_rezult = DeleteFile(#file_path))
  964.                         {
  965.                                 Write_Error(del_rezult);
  966.                                 ShowMessage(T_DEL_ERROR_1, 150);
  967.                                 return;
  968.                         }
  969.                         if (CreateDir(#temp)) CreateDir(#file_path);
  970.                         Open_Dir(#path,WITH_REDRAW);
  971.                         SelectFile(#edit_name);
  972.                 }
  973.                 else
  974.                 {
  975.                         if (copy_rezult = CopyFile(#file_path,#temp))
  976.                         {
  977.                                 Write_Error(copy_rezult);
  978.                         }
  979.                         else
  980.                         {
  981.                                 Del_File(true);
  982.                                 SelectFile(#edit_name);
  983.                         }
  984.                 }
  985.         }
  986.         Line_ReDraw(col_selec,files.current);
  987. }
  988.  
  989.  
  990. void SelectFile(dword that_file)
  991. {
  992.         files.first=files.current=0;
  993.         Open_Dir(#path,ONLY_OPEN);
  994.         if (!real_files_names_case) strttl(that_file);
  995.         for (i=files.count-1; i>=0; i--;)
  996.                 if (!strcmp(file_mas[i]*304+buf+72,that_file)) break;
  997.         List_Current(i);
  998.         List_ReDraw();
  999. }
  1000.  
  1001.  
  1002. void Dir_Up()
  1003. {
  1004.         char cur_folder[4096];
  1005.         i=strlen(#path)-1;
  1006.         if (i==0) return;
  1007.         path[i]=0x00;
  1008.         i = strrchr(#path, '/');
  1009.         strcpy(#cur_folder, #path+i);
  1010.         path[i]=0x00;
  1011.         SelectFile(#cur_folder);
  1012. }
  1013.  
  1014. void Open(byte rez)
  1015. {
  1016.         byte temp[4096];
  1017.         selected_count = 0;
  1018.         if (rez)
  1019.         {
  1020.                 if (!strcmp(#file_name,"..")) return;
  1021.                 strcpy(#temp, #file_path);
  1022.                 if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end
  1023.                 RunProgram("/sys/File Managers/Eolite", #temp);
  1024.                 return;
  1025.         }
  1026.         if (!files.count) return;
  1027.         if (!itdir)
  1028.         {
  1029.                 if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path);
  1030.         }
  1031.         else
  1032.         {
  1033.                 if (!strcmp(#file_name,"..")) { Dir_Up(); return; }
  1034.                 strcpy(#path, #file_path);
  1035.                 if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
  1036.                 files.first=files.current=0;
  1037.                 Open_Dir(#path,WITH_REDRAW);
  1038.         }
  1039. }
  1040.  
  1041.  
  1042. inline fastcall void GoBack()
  1043. {
  1044.         char cur_folder[4096];
  1045.         strcpy(#cur_folder, GetCurrentFolder());
  1046.         if (HistoryPath(GO_BACK)) SelectFile(#cur_folder);
  1047. }
  1048.  
  1049. void ShowOpenWithDialog()
  1050. {
  1051.         byte param[4097];
  1052.         param[0] = '~';
  1053.         param[1] = '\0';
  1054.         strcat(#param, #file_path);
  1055.         RunProgram("/sys/@open", #param);
  1056. }
  1057.  
  1058. void NewElement(byte newf)
  1059. {
  1060.         if (newf)
  1061.         {
  1062.                 strcpy(#temp, #path);
  1063.                 strcat(#temp, new_file_ed.text);
  1064.                 if (new_element_active==1)
  1065.                 {
  1066.                         WriteFile(0, 0, #temp);
  1067.                         if (EAX)
  1068.                         {
  1069.                                 Write_Error(EAX);
  1070.                                 ShowMessage(NOT_CREATE_FILE, 150);
  1071.                         }
  1072.                 }
  1073.                 else
  1074.                 {
  1075.                         CreateDir(#temp);
  1076.                         if (EAX)
  1077.                         {
  1078.                                 Write_Error(EAX);
  1079.                                 ShowMessage(NOT_CREATE_FOLDER, 150);
  1080.                         }
  1081.                 }
  1082.         }
  1083.         new_element_active = 0;
  1084.         SelectFile(new_file_ed.text);
  1085. }
  1086.  
  1087. void NewElement_Form(byte crt)
  1088. {
  1089.         int dform_x=files.w-220/2+files.x;
  1090.         new_element_active = crt;
  1091.         if (new_element_active==1)
  1092.         {
  1093.                 strcpy(#new_element_name, T_NEW_FILE);
  1094.                 new_file_ed.size = strlen(T_NEW_FILE);
  1095.         }
  1096.         else
  1097.         {
  1098.                 strcpy(#new_element_name, T_NEW_FOLDER);
  1099.                 new_file_ed.size = strlen(T_NEW_FOLDER);
  1100.         }
  1101.         DrawPopup(dform_x,160,220,80,1,sc.work,sc.work_graph);
  1102.         new_file_ed.left = dform_x+27;
  1103.         new_file_ed.top = 180;
  1104.         edit_box_draw  stdcall (#new_file_ed);
  1105.         DrawFlatButton(dform_x+27,208,70,20,301,0xFFB6B5,T_CREATE);
  1106.         DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_CANCEL);
  1107. }
  1108.  
  1109. void FnProcess(char N)
  1110. {
  1111.         switch(N)
  1112.         {
  1113.                 case 1:
  1114.                         if (!active_about)
  1115.                         {
  1116.                                 SwitchToAnotherThread();
  1117.                                 about_window=CreateThread(#about_dialog,#about_stak+4092);
  1118.                                 break;
  1119.                         }
  1120.                         else
  1121.                         {
  1122.                                 ActivateWindow(GetProcessSlot(about_window));
  1123.                         }
  1124.                         break;
  1125.                 case 2:
  1126.                         if (!files.count) break;
  1127.                         edit2.flags = 100000000000010b; //set active
  1128.                         edit2.left = files.x + 21;
  1129.                         edit2.width = files.w - 26;
  1130.                         edit2.top=files.current*files.line_h+59;
  1131.                         edit2.size=edit2.pos=strlen(#file_name);
  1132.                         edit_box_draw  stdcall (#edit2);
  1133.                         DrawBar(edit2.left,files.current*files.line_h+58,edit2.width+1,1,0xFFFFCC); //bg
  1134.                         rename_active=1;
  1135.                         break;
  1136.                 case 3:
  1137.                         IF (!itdir) RunProgram("/sys/tinypad", #file_path);
  1138.                         break;
  1139.                 case 4:
  1140.                         IF (!itdir) RunProgram("/sys/develop/heed", #file_path);
  1141.                         break;
  1142.                 case 5: //refresh cur dir & devs
  1143.                         Tip(56, T_DEVICES, 55, "-");
  1144.                         Open_Dir(#path,WITH_REDRAW);
  1145.                         pause(10);
  1146.                         LoadIniSettings();
  1147.                         GetSystemDiscs();
  1148.                         Open_Dir(#path,WITH_REDRAW);
  1149.                         DrawLeftPanel();
  1150.                         break;
  1151.                 case 6:
  1152.                         /*strcpy(#temp, #path);
  1153.                         strcat(#temp, T_NEW_FOLDER);
  1154.                         CreateDir(#temp);
  1155.                         if (!EAX){
  1156.                                 SelectFile(T_NEW_FOLDER);
  1157.                                 FnProcess(2);
  1158.                         }
  1159.                         else
  1160.                         {
  1161.                                 Write_Error(EAX);
  1162.                                 ShowMessage(NOT_CREATE_FOLDER, 150);
  1163.                         }*/
  1164.                         NewElement_Form(2);
  1165.                         break;
  1166.                 case 7:
  1167.                         /*strcpy(#temp, #path);
  1168.                         strcat(#temp, T_NEW_FILE);
  1169.                         WriteFile(0, 0, #temp);
  1170.                         if (!EAX){
  1171.                                 SelectFile(T_NEW_FILE);
  1172.                                 FnProcess(2);
  1173.                         }
  1174.                         else
  1175.                         {
  1176.                                 Write_Error(EAX);
  1177.                                 ShowMessage(NOT_CREATE_FILE, 150);
  1178.                         }*/
  1179.                         NewElement_Form(1);
  1180.                         break;
  1181.                 case 8:
  1182.                         SwitchToAnotherThread();
  1183.                         CreateThread(#properties_dialog, #properties_stak+4092);
  1184.                         break;
  1185.                 case 10: //F10
  1186.                         if (!active_settings)
  1187.                         {
  1188.                                 SwitchToAnotherThread();
  1189.                                 settings_window=CreateThread(#settings_dialog, #settings_stak+4092);
  1190.                                 break;
  1191.                         }
  1192.                         else
  1193.                         {
  1194.                                 ActivateWindow(GetProcessSlot(settings_window));
  1195.                         }
  1196.                         break;
  1197.         }
  1198. }
  1199.  
  1200. //need to remove these functiones, they are a very old shit :)
  1201. dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;}
  1202.  
  1203.  
  1204. stop:
  1205.  
  1206. char menu_stak[4096];
  1207. char copy_stak[4096];
  1208. char open_with_stak[4096];
  1209. char about_stak[4096];
  1210. char properties_stak[4096];
  1211. char settings_stak[4096];