Subversion Repositories Kolibri OS

Rev

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

  1. //Leency 2008-2015
  2.  
  3. #define EDITOR_PATH     "/sys/tinypad"
  4.  
  5. #ifdef LANG_RUS
  6.         ?define EDIT_FILE_ASSOCIATIONS "¥¤ ªâ¨à®¢ âì  áá®æ¨ æ¨¨ ä ©«®¢"
  7.         ?define TITLE_SETT " áâனª¨"
  8.         ?define SHOW_DEVICE_CLASS "‚뢮¤¨âì ­ §¢ ­¨ï ª« áá  ãáâனáâ¢"
  9.         ?define SHOW_REAL_NAMES "®ª §ë¢ âì ¨¬¥­  ä ©«®¢ ­¥ ¬¥­ïï ॣ¨áâà"
  10.         ?define USE_BIG_FONTS "®«ì让 èà¨äâ (⮫쪮  ­£«¨©áª¨¥ ᨬ¢®«ë!)"
  11.         ?define LIST_LINE_HEIGHT "‚ëá®â  áâப¨ ¢ ᯨ᪥"
  12.         ?define NOTIFY_COPY_END "“¢¥¤®¬«ïâì ® § ¢¥à襭¨¨ ª®¯¨à®¢ ­¨ï"
  13.         ?define CANCEL_T "Žâ¬¥­ "
  14.         ?define APPLY_T "à¨¬¥­¨âì"
  15.         ?define T_DOUBLE_CLICK "‚à¥¬ï ¤¢®©­®£® ª«¨ª  (¢ á®âëå)"
  16. #else
  17.         ?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
  18.         ?define TITLE_SETT "Settings"
  19.         ?define SHOW_DEVICE_CLASS "Show device class name"
  20.         ?define SHOW_REAL_NAMES "Show real file names without changing case"
  21.         ?define USE_BIG_FONTS "Use big fonts (English characters only!)"
  22.         ?define LIST_LINE_HEIGHT "List line height"
  23.         ?define NOTIFY_COPY_END "Notify when copying finished"
  24.         ?define CANCEL_T "Cancel"
  25.         ?define APPLY_T "Apply"
  26.         ?define T_DOUBLE_CLICK "Double click time (in hundredths)"
  27. #endif
  28.  
  29. char confir_section = "Config";
  30.  
  31.  
  32. void settings_dialog()
  33. {  
  34.         byte id;
  35.         unsigned int key, key2;
  36.         proc_info settings_form;
  37.        
  38.         dword save_show_dev_name,save_real_files_names_case, save_info_after_copy, save_use_big_fonts, save_files_h, save_DBLTime;
  39.        
  40.         if (active_settings){
  41.                 EXIT_SETTING:
  42.                
  43.                 show_dev_name         = save_show_dev_name;
  44.                 real_files_names_case = save_real_files_names_case;
  45.                 info_after_copy       = save_info_after_copy;
  46.                 use_big_fonts         = save_use_big_fonts;
  47.                 files.line_h          = save_files_h;
  48.                 MOUSE_TIME            = save_DBLTime;
  49.                
  50.                 cmd_free = 4;
  51.                
  52.                 ExitProcess();
  53.         }
  54.         active_settings=1;
  55.        
  56.         save_show_dev_name         = show_dev_name;
  57.         save_real_files_names_case = real_files_names_case;
  58.         save_info_after_copy       = info_after_copy;
  59.         save_use_big_fonts         = use_big_fonts;
  60.         save_files_h               = files.line_h;
  61.         save_DBLTime               = MOUSE_TIME;
  62.        
  63.         loop(){
  64.                 switch(WaitEvent())
  65.                 {
  66.                         case evButton:
  67.                                 id=GetButtonID();
  68.                                 if (id==10)
  69.                                 {
  70.                                         SaveIniSettings();
  71.                                         active_settings=0;
  72.                                         action_buf = 300;
  73.                                         cmd_free = 4;
  74.                                         ExitProcess();
  75.                                 }                                      
  76.                                 else if (id==1) || (id==11)
  77.                                 {
  78.                                         active_settings=0;
  79.                                         goto EXIT_SETTING;
  80.                                 }
  81.                                 else if (id==5)
  82.                                 {
  83.                                         RunProgram("tinypad", "/sys/settings/assoc.ini");
  84.                                         break;
  85.                                 }
  86.                                 else if (id==20) show_dev_name ^= 1;
  87.                                 else if (id==21) real_files_names_case ^= 1;
  88.                                 else if (id==22) info_after_copy ^= 1;
  89.                                 else if (id==23) { use_big_fonts ^= 1; BigFontsChange(); }
  90.                                 else if (id==25) files.line_h++;
  91.                                 else if (id==26) && (files.line_h>14) files.line_h--;
  92.                                 else if (id==27) MOUSE_TIME++;
  93.                                 else if (id==28) && (MOUSE_TIME>29) MOUSE_TIME--;
  94.                                 EventRedrawWindow(Form.left,Form.top);
  95.                                 DrawSettingsCheckBoxes();
  96.                         break;
  97.                                        
  98.                         case evKey:
  99.                                 GetFullKey();
  100.                                 key = AH;
  101.                                 $shr  eax,16
  102.                                 key2 = AL;
  103.                                 if (key2==SCAN_CODE_ESC)
  104.                                 {
  105.                                         active_settings = 0;
  106.                                         action_buf = 300;
  107.                                         goto EXIT_SETTING;
  108.                                 }
  109.                                 break;
  110.                                
  111.                         case evReDraw:
  112.                                 DefineAndDrawWindow(Form.left + Form.width/2, Form.top + Form.height/2 - 75, 300, 234+GetSkinHeight(),0x34,system.color.work,TITLE_SETT);
  113.                                 GetProcessInfo(#settings_form, SelfInfo);
  114.                                 DrawSettingsCheckBoxes();
  115.                                 DrawFlatButton(9, 166, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
  116.                                 DrawFlatButton(128, settings_form.cheight - 30, 70, 22, 10, 0xE4DFE1, APPLY_T);
  117.                                 DrawFlatButton(208, settings_form.cheight - 30, 70, 22, 11, 0xE4DFE1, CANCEL_T);
  118.                 }
  119.         }
  120. }
  121.  
  122. void DrawSettingsCheckBoxes()
  123. {
  124.         CheckBox2(10, 11, 20, SHOW_DEVICE_CLASS,  show_dev_name);
  125.         CheckBox2(10, 33, 21, SHOW_REAL_NAMES,  real_files_names_case);
  126.         CheckBox2(10, 55, 22, NOTIFY_COPY_END,  info_after_copy);
  127.         CheckBox2(10, 77, 23, USE_BIG_FONTS,  use_big_fonts);
  128.         MoreLessBox(10, 104, 18, 25, 26, #system.color, files.line_h, LIST_LINE_HEIGHT);
  129.         MoreLessBox(10, 134, 18, 27, 28, #system.color, MOUSE_TIME, T_DOUBLE_CLICK);
  130. }
  131.  
  132.  
  133. void LoadIniSettings()
  134. {
  135.         ini_get_color stdcall (eolite_ini_path, #confir_section, "SelectionColor",   0x94AECE); col_selec = EAX;
  136.         ini_get_int stdcall   (eolite_ini_path, #confir_section, "ShowDeviceName",    1); show_dev_name = EAX;
  137.         ini_get_int stdcall   (eolite_ini_path, #confir_section, "RealFileNamesCase", 0); real_files_names_case = EAX;
  138.         ini_get_int stdcall   (eolite_ini_path, #confir_section, "InfoAfterCopy",     0); info_after_copy = EAX;
  139.         ini_get_int stdcall   (eolite_ini_path, #confir_section, "UseBigFonts",       0); use_big_fonts = EAX;
  140.         ini_get_int stdcall   (eolite_ini_path, #confir_section, "LineHeight",       18); files.line_h = EAX;
  141.         ini_get_int stdcall   (eolite_ini_path, #confir_section, "TimeDoubleClick",  50); MOUSE_TIME = EAX;
  142.         BigFontsChange();
  143. }
  144.  
  145.  
  146. void SaveIniSettings()
  147. {
  148.         ini_set_int stdcall (eolite_ini_path, #confir_section, "ShowDeviceName", show_dev_name);
  149.         ini_set_int stdcall (eolite_ini_path, #confir_section, "RealFileNamesCase", real_files_names_case);
  150.         ini_set_int stdcall (eolite_ini_path, #confir_section, "InfoAfterCopy", info_after_copy);
  151.         ini_set_int stdcall (eolite_ini_path, #confir_section, "UseBigFonts", use_big_fonts);
  152.         ini_set_int stdcall (eolite_ini_path, #confir_section, "LineHeight", files.line_h);
  153.         ini_set_int stdcall (eolite_ini_path, #confir_section, "TimeDoubleClick", MOUSE_TIME);
  154. }
  155.  
  156.  
  157.  
  158. void Write_Error(int error_number)
  159. {
  160.         char error_message[500];
  161.         dword ii;
  162.         if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
  163.         pause(5);
  164.         sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE");
  165.         notify(#error_message);
  166. }
  167.  
  168.  
  169. void SetAppColors()
  170. {
  171.         system.color.work = 0xE4DFE1;
  172.         system.color.work_text = 0;
  173.         system.color.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
  174.         system.color.work_button = 0xD2D3D3;
  175.         system.color.work_button_text = 0x000000;
  176.         col_padding = 0xC8C9C9;
  177.         //col_selec   = 0x94AECE;
  178.         col_lpanel  = 0x00699C;
  179. }
  180.  
  181.  
  182. void BigFontsChange()
  183. {
  184.         if (use_big_fonts)
  185.         {
  186.                 font_type = 10110000b;
  187.                 font_h = 14;
  188.                 FileShow.font_size_x = 8;
  189.                 FileShow.font_number = 3;
  190.         }
  191.         else
  192.         {
  193.                 font_type=10000000b;
  194.                 font_h = 6;
  195.                 FileShow.font_size_x = 6;
  196.                 FileShow.font_number = 0;
  197.         }
  198. }
  199.  
  200.  
  201. void CheckBox2(dword x, y, id, text, byte value) {
  202.         CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
  203. }