Subversion Repositories Kolibri OS

Rev

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