Subversion Repositories Kolibri OS

Rev

Rev 5833 | Rev 5846 | 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.         #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 LIST_LINE_HEIGHT "List line height"
  21.         ?define NOTIFY_COPY_END "Notify when copying finished"
  22.         ?define T_DOUBLE_CLICK "Double click time (in hundredths)"
  23.         #define SAVE_PATH_AS_DEFAULT "Save the current default path"
  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 ^= 1;
  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==27) MOUSE_TIME++;
  57.                                 else if (id==28) && (MOUSE_TIME>29) MOUSE_TIME--;
  58.                                 else if (id==30) { font.size.text++; IF(!font.changeSIZE()) font.size.text--; BigFontsChange(); }
  59.                                 else if (id==31) { font.size.text--; IF(!font.changeSIZE()) font.size.text++; BigFontsChange(); }
  60.                                 EventRedrawWindow(Form.left,Form.top);
  61.                                 DrawSettingsCheckBoxes();
  62.                         break;
  63.                                        
  64.                         case evKey:
  65.                                 GetKeys();
  66.                                 if (key_scancode==SCAN_CODE_ESC) ExitSettings();
  67.                                 break;
  68.                                
  69.                         case evReDraw:
  70.                                 DefineAndDrawWindow(Form.left + Form.width/2-10, Form.top + Form.height/2 - 75, 300, 246+GetSkinHeight(),0x34,system.color.work,TITLE_SETT);
  71.                                 DrawSettingsCheckBoxes();
  72.                                 DrawFlatButton(9, 186, strlen(SAVE_PATH_AS_DEFAULT)+4*6, 22, 6, 0xE4DFE1, SAVE_PATH_AS_DEFAULT);
  73.                                 DrawFlatButton(9, 216, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
  74.                 }
  75.         }
  76. }
  77.  
  78. void ExitSettings()
  79. {
  80.         active_settings = 0;
  81.         settings_window = 0;
  82.         cmd_free = 4;
  83.         ExitProcess();
  84. }
  85.  
  86. void DrawSettingsCheckBoxes()
  87. {
  88.         CheckBox2(10, 11, 20, SHOW_DEVICE_CLASS,  show_dev_name);
  89.         CheckBox2(10, 33, 21, SHOW_REAL_NAMES,  real_files_names_case);
  90.         CheckBox2(10, 55, 22, NOTIFY_COPY_END,  info_after_copy);
  91.         CheckBox2(10, 77, 24, USE_TWO_PANELS,  two_panels);
  92.         MoreLessBox(10, 103, 18, 27, 28, #system.color, MOUSE_TIME, T_DOUBLE_CLICK);
  93.         MoreLessBox(10, 130, 18, 25, 26, #system.color, files.item_h, LIST_LINE_HEIGHT);
  94.         if (font.data) MoreLessBox(10, 157, 18, 30, 31, #system.color, font.size.text, FONT_SIZE_LABEL);
  95. }
  96.  
  97.  
  98. void LoadIniSettings()
  99. {
  100.         files.SetFont(6, 9, 10000000b);
  101.         FileShow.font_size_x = files.font_w;
  102.         FileShow.font_number = 0;
  103.         ini_get_int stdcall   (eolite_ini_path, #config_section, "ShowDeviceName",    1); show_dev_name = EAX;
  104.         ini_get_int stdcall   (eolite_ini_path, #config_section, "RealFileNamesCase", 0); real_files_names_case = EAX;
  105.         ini_get_int stdcall   (eolite_ini_path, #config_section, "InfoAfterCopy",     0); info_after_copy = EAX;
  106.         ini_get_int stdcall   (eolite_ini_path, #config_section, "FontSize",          9); font.size.text = EAX;
  107.         ini_get_int stdcall   (eolite_ini_path, #config_section, "TwoPanels",         0); two_panels = EAX;
  108.         ini_get_int stdcall   (eolite_ini_path, #config_section, "LineHeight",       18); files.item_h = EAX;
  109.         ini_get_int stdcall   (eolite_ini_path, #config_section, "TimeDoubleClick",  50); MOUSE_TIME = EAX;
  110.         ini_get_int stdcall   (eolite_ini_path, #config_section, "WinX", 200); WinX = EAX;
  111.         ini_get_int stdcall   (eolite_ini_path, #config_section, "WinY", 50); WinY = EAX;
  112.         ini_get_int stdcall   (eolite_ini_path, #config_section, "WinW", 550); WinW = EAX;
  113.         ini_get_int stdcall   (eolite_ini_path, #config_section, "WinH", 500); WinH = EAX;
  114.         ini_get_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path,4096,"/rd/1/");
  115. }
  116.  
  117.  
  118. void SaveIniSettings()
  119. {
  120.        
  121.         ini_set_int stdcall (eolite_ini_path, #config_section, "ShowDeviceName", show_dev_name);
  122.         ini_set_int stdcall (eolite_ini_path, #config_section, "RealFileNamesCase", real_files_names_case);
  123.         ini_set_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", info_after_copy);
  124.         ini_set_int stdcall (eolite_ini_path, #config_section, "FontSize", font.size.text);
  125.         ini_set_int stdcall (eolite_ini_path, #config_section, "TwoPanels", two_panels);
  126.         ini_set_int stdcall (eolite_ini_path, #config_section, "LineHeight", files.item_h);
  127.         ini_set_int stdcall (eolite_ini_path, #config_section, "TimeDoubleClick", MOUSE_TIME);
  128.         ini_set_int stdcall (eolite_ini_path, #config_section, "WinX", Form.left);
  129.         ini_set_int stdcall (eolite_ini_path, #config_section, "WinY", Form.top);
  130.         ini_set_int stdcall (eolite_ini_path, #config_section, "WinW", Form.width);
  131.         ini_set_int stdcall (eolite_ini_path, #config_section, "WinH", Form.height);
  132.        
  133.         if(CMD_ENABLE_SAVE_IMG)
  134.         {
  135.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "ShowDeviceName", show_dev_name);
  136.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "RealFileNamesCase", real_files_names_case);
  137.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "InfoAfterCopy", info_after_copy);
  138.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "FontSize", font.size.text);
  139.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "TwoPanels", two_panels);
  140.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "LineHeight", files.item_h);
  141.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "TimeDoubleClick", MOUSE_TIME);
  142.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "WinX", Form.left);
  143.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "WinY", Form.top);
  144.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "WinW", Form.width);
  145.                 ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "WinH", Form.height);
  146.         }
  147. }
  148.  
  149.  
  150.  
  151. void Write_Error(int error_number)
  152. {
  153.         char error_message[500];
  154.         dword ii;
  155.         if (files.cur_y>=0) Line_ReDraw(0xFF0000, files.cur_y);
  156.         pause(5);
  157.         sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE");
  158.         notify(#error_message);
  159. }
  160.  
  161.  
  162. void SetAppColors()
  163. {
  164.         system.color.work = 0xE4DFE1;
  165.         system.color.work_text = 0;
  166.         system.color.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
  167.         system.color.work_button = 0xD2D3D3;
  168.         system.color.work_button_text = 0x000000;
  169.         col_padding = 0xC8C9C9;
  170.         col_selec   = 0x94AECE;
  171.         col_lpanel  = 0x00699C;
  172. }
  173.  
  174.  
  175. void BigFontsChange()
  176. {
  177.         files.item_h = font.size.text + 4;
  178.         if (files.item_h<18) files.item_h = 18;
  179.         files_active.item_h = files_inactive.item_h = files.item_h;
  180. }
  181.  
  182.  
  183. void CheckBox2(dword x, y, id, text, byte value) {
  184.         CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
  185. }