Subversion Repositories Kolibri OS

Rev

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