Subversion Repositories Kolibri OS

Rev

Rev 5532 | Rev 5575 | 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. #else
  16.         ?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
  17.         ?define TITLE_SETT "Settings"
  18.         ?define SHOW_DEVICE_CLASS "Show device class name"
  19.         ?define SHOW_REAL_NAMES "Show real file names without changing case"
  20.         ?define USE_BIG_FONTS "Use big fonts"
  21.         ?define LIST_LINE_HEIGHT "List line height"
  22.         ?define NOTIFY_COPY_END "Notify when copying finished"
  23.         ?define CANCEL_T "Cancel"
  24.         ?define APPLY_T "Apply"
  25. #endif
  26.  
  27. char confir_section = "Config";
  28.  
  29.  
  30. void settings_dialog()
  31. {  
  32.         byte id;
  33.         unsigned int key;
  34.         proc_info settings_form;
  35.        
  36.         if (active_settings) ExitProcess();
  37.         active_settings=1;
  38.  
  39.         loop() switch(WaitEvent())
  40.         {
  41.                 case evButton:
  42.                                 id=GetButtonID();
  43.                                 if (id==10)
  44.                                 {
  45.                                         SaveIniSettings();
  46.                                         active_settings=0;
  47.                                         action_buf = 300;
  48.                                         ExitProcess();
  49.                                 }                                      
  50.                                 if (id==1) || (id==11)
  51.                                 {
  52.                                         active_settings=0;
  53.                                         ExitProcess();
  54.                                 }
  55.                                 if (id==5)
  56.                                 {
  57.                                         RunProgram("tinypad", "/sys/settings/assoc.ini");
  58.                                         break;
  59.                                 }
  60.                                 if (id==20) show_dev_name ^= 1;
  61.                                 if (id==21) real_files_names_case ^= 1;
  62.                                 if (id==22) info_after_copy ^= 1;
  63.                                 if (id==23) use_big_fonts ^= 1;
  64.                                 if (id==25) files.line_h++;
  65.                                 if (id==26) && (files.line_h>8) files.line_h--;
  66.                                 DrawSettingsCheckBoxes();
  67.                                 break;
  68.                                
  69.                 case evKey:
  70.                                 key = GetKey();
  71.                                 if (key==27)
  72.                                 {
  73.                                         active_settings = 0;
  74.                                         action_buf = 300;
  75.                                         ExitProcess();
  76.                                 }
  77.                                 break;
  78.                        
  79.                 case evReDraw:
  80.                                 DefineAndDrawWindow(Form.left + 100, 150, 300, 232+GetSkinHeight(),0x34,sc.work,TITLE_SETT);
  81.                                 GetProcessInfo(#settings_form, SelfInfo);
  82.                                 DrawSettingsCheckBoxes();
  83.                                 DrawFlatButton(9, 138, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
  84.                                 DrawFlatButton(128, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, APPLY_T);
  85.                                 DrawFlatButton(208, settings_form.cheight - 34, 70, 22, 11, 0xE4DFE1, CANCEL_T);
  86.         }
  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, 23, USE_BIG_FONTS,  use_big_fonts);
  95.         MoreLessBox(10, 104, 18, 25, 26, #sc, files.line_h, LIST_LINE_HEIGHT);
  96. }
  97.  
  98.  
  99. void LoadIniSettings()
  100. {
  101.         ini_get_color stdcall (eolite_ini_path, #confir_section, "SelectionColor",   0x94AECE); edit2.shift_color = col_selec = EAX;
  102.         ini_get_int stdcall   (eolite_ini_path, #confir_section, "ShowDeviceName",    1); show_dev_name = EAX;
  103.         ini_get_int stdcall   (eolite_ini_path, #confir_section, "RealFileNamesCase", 0); real_files_names_case = EAX;
  104.         ini_get_int stdcall   (eolite_ini_path, #confir_section, "InfoAfterCopy",     0); info_after_copy = EAX;
  105.         ini_get_int stdcall   (eolite_ini_path, #confir_section, "UseBigFonts",       0); use_big_fonts = EAX;
  106.         ini_get_int stdcall   (eolite_ini_path, #confir_section, "LineHeight",       18); files.line_h = EAX;
  107.  
  108.         if (use_big_fonts)
  109.         {
  110.                 font_type = 0x90;
  111.                 PathShow.font_size_x = FileShow.font_size_x = 8;
  112.                 PathShow.font_number = FileShow.font_number = 1;
  113.         }
  114.         else
  115.         {
  116.                 font_type=0x80;
  117.                 PathShow.font_size_x = FileShow.font_size_x = 8;
  118.                 PathShow.font_number = FileShow.font_number = 0;
  119.         }
  120. }
  121.  
  122. void SaveIniSettings()
  123. {
  124.         ini_set_int stdcall (eolite_ini_path, #confir_section, "ShowDeviceName", show_dev_name);
  125.         ini_set_int stdcall (eolite_ini_path, #confir_section, "RealFileNamesCase", real_files_names_case);
  126.         ini_set_int stdcall (eolite_ini_path, #confir_section, "InfoAfterCopy", info_after_copy);
  127.         ini_set_int stdcall (eolite_ini_path, #confir_section, "UseBigFonts", use_big_fonts);
  128.         ini_set_int stdcall (eolite_ini_path, #confir_section, "LineHeight", files.line_h);
  129. }
  130.  
  131.  
  132.  
  133. void Write_Error(int error_number)
  134. {
  135.         char error_message[500];
  136.         dword ii;
  137.         if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
  138.         pause(5);
  139.         strcpy(#error_message, "\"Eolite\n");
  140.         ii = get_error(error_number);
  141.         strcat(#error_message, ii);
  142.         strcat(#error_message, "\" -tE");
  143.         notify(#error_message);
  144. }
  145.  
  146.  
  147. void SetAppColors()
  148. {
  149.         sc.work = 0xE4DFE1;
  150.         sc.work_text = 0;
  151.         sc.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
  152.         sc.work_button = 0xD2D3D3;
  153.         sc.work_button_text = 0x000000;
  154.         col_padding = 0xC8C9C9;
  155.         //col_selec   = 0x94AECE;
  156.         col_lpanel  = 0x00699C;
  157. }
  158.  
  159.  
  160. void CheckBox2(dword x, y, id, text, byte value) {
  161.         CheckBox(x, y, 14, 14, id, text, sc.work_graph, sc.work_text, value);
  162. }