Subversion Repositories Kolibri OS

Rev

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