Subversion Repositories Kolibri OS

Rev

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