Subversion Repositories Kolibri OS

Rev

Rev 5459 | Rev 5464 | 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. int     mouse_ddd;
  26. char lineh_s[30]="18\0";
  27. edit_box LineHeight_ed = {52,10,97,0xffffff,0x94AECE,0xffc90E,0xffffff,2,4,#lineh_s,#mouse_ddd, 1000000000000000b,2,2};
  28.  
  29. void settings_dialog()
  30. {  
  31.         byte id;
  32.         unsigned int key;
  33.         proc_info settings_form;
  34.        
  35.         if (active_settings) ExitProcess();
  36.         active_settings=1;
  37.  
  38.         SetEventMask(0x27);
  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.                                 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.                                 EAX=key<<8;
  75.                                 edit_box_key stdcall(#LineHeight_ed);
  76.                                 break;
  77.                                
  78.                 case evMouse:
  79.                                 edit_box_mouse stdcall (#LineHeight_ed);
  80.                                 break;
  81.                        
  82.                 case evReDraw:
  83.                                 DefineAndDrawWindow(Form.left + 100, 150, 300, 210+GetSkinHeight(),0x34,sc.work,TITLE_SETT);
  84.                                 GetProcessInfo(#settings_form, SelfInfo);
  85.  
  86.                                 DrawSettingsCheckBoxes();
  87.  
  88.                                 WriteText(10, 84, 0x80, 0x000000, SET_3);
  89.                                 key = itoa(files.line_h);
  90.                                 strcpy(#lineh_s, key);
  91.                                 edit_box_draw stdcall (#LineHeight_ed);
  92.                                 DrawRectangle(LineHeight_ed.left-1, LineHeight_ed.top-1, LineHeight_ed.width+2, 16, sc.work_graph);
  93.  
  94.                                 DrawFlatButton(9, 127, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
  95.  
  96.                                 DrawFlatButton(128, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, APPLY_T);
  97.                                 DrawFlatButton(208, settings_form.cheight - 34, 70, 22, 11, 0xE4DFE1, CANCEL_T);
  98.         }
  99. }
  100.  
  101. void DrawSettingsCheckBoxes()
  102. {
  103.         CheckBox2(10, 11, 20, SET_1,  show_dev_name);
  104.         CheckBox2(10, 33, 21, SET_2,  real_files_names_case);
  105.         CheckBox2(10, 55, 22, SET_3,  info_after_copy);
  106. }
  107.  
  108.  
  109. void LoadIniSettings()
  110. {
  111.         ini_get_color stdcall (eolite_ini_path, "Config", "SelectionColor", 0x94AECE);
  112.         edit2.shift_color = EAX;
  113.         col_selec = EAX;
  114.         ini_get_int stdcall (eolite_ini_path, "Config", "LineHeight", 18);
  115.         files.line_h = EAX;
  116.         ini_get_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", 1);
  117.         show_dev_name = EAX;
  118.         ini_get_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", 0);
  119.         real_files_names_case = EAX;
  120.         ini_get_int stdcall (eolite_ini_path, "Config", "InfoAfterCopy", 0);
  121.         info_after_copy = EAX;
  122. }
  123.  
  124. void SaveIniSettings()
  125. {
  126.         ini_set_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", show_dev_name);
  127.         ini_set_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", real_files_names_case);
  128.         ini_set_int stdcall (eolite_ini_path, "Config", "InfoAfterCopy", info_after_copy);
  129.         ini_set_int stdcall (eolite_ini_path, "Config", "LineHeight", atoi(#lineh_s));
  130. }
  131.  
  132.  
  133.  
  134. void Write_Error(int error_number)
  135. {
  136.         char error_message[500];
  137.         dword ii;
  138.         if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
  139.         pause(5);
  140.         strcpy(#error_message, "\"Eolite\n");
  141.         ii = get_error(error_number);
  142.         strcat(#error_message, ii);
  143.         strcat(#error_message, "\" -tE");
  144.         notify(#error_message);
  145. }
  146.  
  147.  
  148. void SetAppColors()
  149. {
  150.         sc.work = 0xE4DFE1;
  151.         sc.work_text = 0;
  152.         sc.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
  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. }