Subversion Repositories Kolibri OS

Rev

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