Subversion Repositories Kolibri OS

Rev

Rev 5985 | Rev 5996 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. #ifdef LANG_RUS
  3.         ?define EDIT_FILE_ASSOCIATIONS "¥¤ ªâ¨à®¢ âì  áá®æ¨ æ¨¨ ä ©«®¢"
  4.         ?define TITLE_SETT " áâனª¨"
  5.         ?define SHOW_DEVICE_CLASS "‚뢮¤¨âì ­ §¢ ­¨ï ª« áá  ãáâனáâ¢"
  6.         ?define SHOW_REAL_NAMES "®ª §ë¢ âì ¨¬¥­  ä ©«®¢ ­¥ ¬¥­ïï ॣ¨áâà"
  7.         ?define FONT_SIZE_LABEL " §¬¥à èà¨äâ "
  8.         ?define USE_TWO_PANELS "„¢¥ ¯ ­¥«¨"
  9.         ?define smooth_FONT "ˆá¯®«ì§®¢ âì ᣫ ¦¥­­ë© èà¨äâ"
  10.         ?define LIST_LINE_HEIGHT "‚ëá®â  áâப¨ ¢ ᯨ᪥"
  11.         ?define NOTIFY_COPY_END "“¢¥¤®¬«ïâì ® § ¢¥à襭¨¨ ª®¯¨à®¢ ­¨ï"
  12.         ?define T_DOUBLE_CLICK "‚à¥¬ï ¤¢®©­®£® ª«¨ª  (¢ á®âëå)"
  13.         #define SAVE_PATH_AS_DEFAULT "‘®åà ­¨âì ⥪ã騩 ¯ãâì ¯® 㬮«ç ­¨î"
  14. #else
  15.         ?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
  16.         ?define TITLE_SETT "Settings"
  17.         ?define SHOW_DEVICE_CLASS "Show device class name"
  18.         ?define SHOW_REAL_NAMES "Show real file names without changing case"
  19.         ?define FONT_SIZE_LABEL "Font size"
  20.         ?define USE_TWO_PANELS "Two panels"
  21.         ?define smooth_FONT "Use smooth font"
  22.         ?define LIST_LINE_HEIGHT "List line height"
  23.         ?define NOTIFY_COPY_END "Notify when copying finished"
  24.         ?define T_DOUBLE_CLICK "Double click time (in hundredths)"
  25.         #define SAVE_PATH_AS_DEFAULT "Save the current default path"
  26. #endif
  27.  
  28. char config_section[] = "Config";
  29. int WinX, WinY, WinW, WinH;
  30.  
  31. void settings_dialog()
  32. {  
  33.         byte id;
  34.         active_settings=1;
  35.         loop(){
  36.                 switch(WaitEvent())
  37.                 {
  38.                         case evButton:
  39.                                 id=GetButtonID();
  40.                                 if (id==1) { ExitSettings(); break; }
  41.                                 else if (id==5)
  42.                                 {
  43.                                         RunProgram("tinypad", "/sys/settings/assoc.ini");
  44.                                         break;
  45.                                 }
  46.                                 else if (id==6)
  47.                                 {
  48.                                         ini_set_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path,strlen(#path));
  49.                                         IF(CMD_ENABLE_SAVE_IMG)ini_set_str stdcall (fd_path_eolite_ini_path, #config_section, "DefaultPath", #path,strlen(#path));
  50.                                         break;
  51.                                 }
  52.                                 else if (id==20) show_dev_name ^= 1;
  53.                                 else if (id==21) { action_buf=109; real_files_names_case ^= 1; }
  54.                                 else if (id==22) info_after_copy ^= 1;
  55.                                 else if (id==24) two_panels ^= true;
  56.                                 else if (id==25) { files.item_h++; files_active.item_h = files_inactive.item_h = files.item_h; }
  57.                                 else if (id==26) && (files.item_h>18) files.item_h--;
  58.                                 else if (id==27) MOUSE_TIME++;
  59.                                 else if (id==28) && (MOUSE_TIME>29) MOUSE_TIME--;
  60.                                 //else if (id==29) smooth_font ^= true;
  61.                                 else if (id==30) { label.size.pt++; IF(!label.changeSIZE()) label.size.pt--; BigFontsChange(); }
  62.                                 else if (id==31) { label.size.pt--; IF(!label.changeSIZE()) label.size.pt++; BigFontsChange(); }
  63.                                 EventRedrawWindow(Form.left,Form.top);
  64.                                 DrawSettingsCheckBoxes();
  65.                         break;
  66.                                        
  67.                         case evKey:
  68.                                 GetKeys();
  69.                                 if (key_scancode==SCAN_CODE_ESC) ExitSettings();
  70.                                 break;
  71.                                
  72.                         case evReDraw:
  73.                                 DefineAndDrawWindow(Form.left + Form.width/2-10, Form.top + Form.height/2 - 75, 300, 260+GetSkinHeight(),0x34,system.color.work,TITLE_SETT);
  74.                                 DrawSettingsCheckBoxes();
  75.                                 DrawFlatButton(9, 183, strlen(SAVE_PATH_AS_DEFAULT)+4*6, 22, 6, 0xE4DFE1, SAVE_PATH_AS_DEFAULT);
  76.                                 DrawFlatButton(9, 215, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
  77.                 }
  78.         }
  79. }
  80.  
  81. void ExitSettings()
  82. {
  83.         active_settings = 0;
  84.         settings_window = 0;
  85.         cmd_free = 4;
  86.         ExitProcess();
  87. }
  88.  
  89. void DrawSettingsCheckBoxes()
  90. {
  91.         CheckBox2(10, 11, 20, SHOW_DEVICE_CLASS,  show_dev_name);
  92.         CheckBox2(10, 33, 21, SHOW_REAL_NAMES,  real_files_names_case);
  93.         CheckBox2(10, 55, 22, NOTIFY_COPY_END,  info_after_copy);
  94.         CheckBox2(10, 77, 24, USE_TWO_PANELS,  two_panels);
  95.         //CheckBox2(10, 99, 29, smooth_FONT,  smooth_font);
  96.         MoreLessBox(10, 99, 18, 27, 28, #system.color, MOUSE_TIME, T_DOUBLE_CLICK);
  97.         MoreLessBox(10, 125, 18, 25, 26, #system.color, files.item_h, LIST_LINE_HEIGHT);
  98.         if (label.font) MoreLessBox(10, 152, 18, 30, 31, #system.color, label.size.pt, FONT_SIZE_LABEL);
  99. }
  100.  
  101.  
  102. void LoadIniSettings()
  103. {
  104.         files.SetFont(6, 9, 10000000b);
  105.         FileShow.font_size_x = files.font_w;
  106.         FileShow.font_number = 0;
  107.         ini_get_int stdcall   (eolite_ini_path, #config_section, "ShowDeviceName",    1); show_dev_name = EAX;
  108.         ini_get_int stdcall   (eolite_ini_path, #config_section, "RealFileNamesCase", 0); real_files_names_case = EAX;
  109.         ini_get_int stdcall   (eolite_ini_path, #config_section, "InfoAfterCopy",     0); info_after_copy = EAX;
  110.         ini_get_int stdcall   (eolite_ini_path, #config_section, "FontSize",          9); label.size.pt = EAX;
  111.         ini_get_int stdcall   (eolite_ini_path, #config_section, "TwoPanels",         0); two_panels = EAX;
  112.         //ini_get_int stdcall   (eolite_ini_path, #config_section, "UseSmoothFont",     true);smooth_font = EAX;
  113.         ini_get_int stdcall   (eolite_ini_path, #config_section, "LineHeight",       18); files.item_h = EAX;
  114.         ini_get_int stdcall   (eolite_ini_path, #config_section, "TimeDoubleClick",  50); MOUSE_TIME = EAX;
  115.         ini_get_int stdcall   (eolite_ini_path, #config_section, "WinX", 200); WinX = EAX;
  116.         ini_get_int stdcall   (eolite_ini_path, #config_section, "WinY", 50); WinY = EAX;
  117.         ini_get_int stdcall   (eolite_ini_path, #config_section, "WinW", 550); WinW = EAX;
  118.         ini_get_int stdcall   (eolite_ini_path, #config_section, "WinH", 500); WinH = EAX;
  119.         ini_get_str stdcall   (eolite_ini_path, #config_section, "DefaultPath", #path,4096,"/rd/1/");
  120.  
  121.         ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font file",#temp,4096,DEFAULT_FONT);
  122.         label.init(#temp);
  123.         ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on");
  124.         if(!strcmp(#temp,"off"))smooth_font = false;
  125.         else smooth_font = true;
  126. }
  127.  
  128.  
  129. void SaveIniSettings()
  130. {
  131.        
  132.         ini_set_int stdcall (eolite_ini_path, #config_section, "ShowDeviceName", show_dev_name);
  133.         ini_set_int stdcall (eolite_ini_path, #config_section, "RealFileNamesCase", real_files_names_case);
  134.         ini_set_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", info_after_copy);
  135.         ini_set_int stdcall (eolite_ini_path, #config_section, "FontSize", label.size.pt);
  136.         ini_set_int stdcall (eolite_ini_path, #config_section, "TwoPanels", two_panels);
  137.         //ini_set_int stdcall (eolite_ini_path, #config_section, "UseSmoothFont", smooth_font);
  138.         ini_set_int stdcall (eolite_ini_path, #config_section, "LineHeight", files.item_h);
  139.         ini_set_int stdcall (eolite_ini_path, #config_section, "TimeDoubleClick", MOUSE_TIME);
  140.         ini_set_int stdcall (eolite_ini_path, #config_section, "WinX", Form.left);
  141.         ini_set_int stdcall (eolite_ini_path, #config_section, "WinY", Form.top);
  142.         ini_set_int stdcall (eolite_ini_path, #config_section, "WinW", Form.width);
  143.         ini_set_int stdcall (eolite_ini_path, #config_section, "WinH", Form.height);
  144.        
  145.         if(CMD_ENABLE_SAVE_IMG)
  146.         {
  147.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "ShowDeviceName", show_dev_name);
  148.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "RealFileNamesCase", real_files_names_case);
  149.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "InfoAfterCopy", info_after_copy);
  150.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "FontSize", label.size.pt);
  151.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "TwoPanels", two_panels);
  152.                 //ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "UseSmoothFont", smooth_font);
  153.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "LineHeight", files.item_h);
  154.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "TimeDoubleClick", MOUSE_TIME);
  155.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "WinX", Form.left);
  156.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "WinY", Form.top);
  157.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "WinW", Form.width);
  158.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "WinH", Form.height);
  159.         }
  160. }
  161.  
  162.  
  163.  
  164. void Write_Error(int error_number)
  165. {
  166.         char error_message[500];
  167.         dword ii;
  168.         if (files.cur_y>=0) Line_ReDraw(0xFF0000, files.cur_y);
  169.         pause(5);
  170.         sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE");
  171.         notify(#error_message);
  172. }
  173.  
  174.  
  175. void SetAppColors()
  176. {
  177.         system.color.work = 0xE4DFE1;
  178.         system.color.work_text = 0;
  179.         system.color.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
  180.         system.color.work_button = 0xD2D3D3;
  181.         system.color.work_button_text = 0x000000;
  182.         col_padding = 0xC8C9C9;
  183.         col_selec   = 0x94AECE;
  184.         col_lpanel  = 0x00699C;
  185. }
  186.  
  187.  
  188. void BigFontsChange()
  189. {
  190.         files.item_h = label.size.pt + 4;
  191.         if (files.item_h<18) files.item_h = 18;
  192.         files_active.item_h = files_inactive.item_h = files.item_h;
  193. }
  194.  
  195.  
  196. void CheckBox2(dword x, y, id, text, byte value) {
  197.         CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
  198. }