Subversion Repositories Kolibri OS

Rev

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