Subversion Repositories Kolibri OS

Rev

Rev 5444 | Rev 5463 | 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,90,0xffffff,0x94AECE,0xffc90E,0xffffff,2,4,#lineh_s,#mouse_ddd, 1000000000000000b,2,2};
  28. checkbox2 ShowDeviceName_chb = {10*65536+15, 10*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, SET_1, CH_FLAG_MIDDLE, 0};
  29. checkbox2 RealFileNamesCase_chb = {10*65536+15, 30*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, SET_2, CH_FLAG_MIDDLE, 0};
  30. checkbox2 InfoAfterCopy_chb = {10*65536+15, 50*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, SET_4, CH_FLAG_MIDDLE, 0};
  31.  
  32. void settings_dialog()
  33. {  
  34.         byte id;
  35.         unsigned int key;
  36.         proc_info settings_form;
  37.        
  38.         if (active_settings) ExitProcess();
  39.         active_settings=1;
  40.  
  41.         ShowDeviceName_chb.size_of_str = strlen(SET_1) * 6;
  42.         RealFileNamesCase_chb.size_of_str = strlen(SET_2) * 6;
  43.         InfoAfterCopy_chb.size_of_str = strlen(SET_4) * 6;
  44.  
  45.         SetEventMask(0x27);
  46.         loop() switch(WaitEvent())
  47.         {
  48.                 case evButton:
  49.                                 id=GetButtonID();
  50.                                 if (id==10)
  51.                                 {
  52.                                         SaveIniSettings();
  53.                                         active_settings=0;
  54.                                         action_buf = 300;
  55.                                         ExitProcess();
  56.                                 }                                      
  57.                                 if (id==1) || (id==11)
  58.                                 {
  59.                                         active_settings=0;
  60.                                         ExitProcess();
  61.                                 }
  62.                                 if (id==5)
  63.                                 {
  64.                                         RunProgram("tinypad", "/sys/settings/assoc.ini");
  65.                                 }
  66.                                 break;
  67.                                
  68.                 case evKey:
  69.                                 key = GetKey();
  70.                                 if (key==27)
  71.                                 {
  72.                                         active_settings=0;
  73.                                         action_buf = 300;
  74.                                         ExitProcess();
  75.                                 }
  76.                                 EAX=key<<8;
  77.                                 edit_box_key stdcall(#LineHeight_ed);
  78.                                 break;
  79.                                
  80.                 case evMouse:
  81.                                 check_box_mouse stdcall (#ShowDeviceName_chb);
  82.                                 check_box_mouse stdcall (#RealFileNamesCase_chb);
  83.                                 check_box_mouse stdcall (#InfoAfterCopy_chb);
  84.                                 edit_box_mouse stdcall (#LineHeight_ed);
  85.                                 break;
  86.                        
  87.                 case evReDraw:
  88.                                 DefineAndDrawWindow(Form.left + 100, 150, 300, 200+GetSkinHeight(),0x34,sc.work,TITLE_SETT);
  89.                                 GetProcessInfo(#settings_form, SelfInfo);
  90.  
  91.                                 ShowDeviceName_chb.flags |= 1 << show_dev_name;
  92.                                 RealFileNamesCase_chb.flags |= 1 << real_files_names_case;
  93.                                 InfoAfterCopy_chb.flags |= 1 << info_after_copy;
  94.  
  95.                                 key = itoa(files.line_h);
  96.                                 strcpy(#lineh_s, key);
  97.                                
  98.                                 check_box_draw stdcall (#ShowDeviceName_chb);
  99.                                 check_box_draw stdcall (#RealFileNamesCase_chb);
  100.                                 check_box_draw stdcall (#InfoAfterCopy_chb);
  101.                                 edit_box_draw stdcall (#LineHeight_ed);
  102.                                 DrawRectangle(LineHeight_ed.left-1, LineHeight_ed.top-1, LineHeight_ed.width+2, 16, sc.work_graph);
  103.                                 WriteText(10, 77, 0x80, 0x000000, SET_3);
  104.                                 DrawFlatButton(9, 120, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
  105.                                 DrawFlatButton(128, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, APPLY_T);
  106.                                 DrawFlatButton(208, settings_form.cheight - 34, 70, 22, 11, 0xE4DFE1, CANCEL_T);
  107.         }
  108. }
  109.  
  110.  
  111. void LoadIniSettings()
  112. {
  113.         ini_get_color stdcall (eolite_ini_path, "Config", "SelectionColor", 0x94AECE);
  114.         edit2.shift_color = EAX;
  115.         col_selec = EAX;
  116.         ini_get_int stdcall (eolite_ini_path, "Config", "LineHeight", 18);
  117.         files.line_h = EAX;
  118.         ini_get_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", 1);
  119.         show_dev_name = EAX;
  120.         ini_get_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", 0);
  121.         real_files_names_case = EAX;
  122.         ini_get_int stdcall (eolite_ini_path, "Config", "InfoAfterCopy", 0);
  123.         info_after_copy = EAX;
  124. }
  125.  
  126. void SaveIniSettings()
  127. {
  128.         show_dev_name = TestBit(ShowDeviceName_chb.flags, 1);
  129.         real_files_names_case = TestBit(RealFileNamesCase_chb.flags, 1);
  130.         info_after_copy = TestBit(InfoAfterCopy_chb.flags, 1);
  131.         ini_set_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", show_dev_name);
  132.         ini_set_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", real_files_names_case);
  133.         ini_set_int stdcall (eolite_ini_path, "Config", "InfoAfterCopy", info_after_copy);
  134.         ini_set_int stdcall (eolite_ini_path, "Config", "LineHeight", atoi(#lineh_s));
  135. }
  136.  
  137.  
  138.  
  139. void Write_Error(int error_number)
  140. {
  141.         char error_message[500];
  142.         dword ii;
  143.         if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
  144.         pause(5);
  145.         strcpy(#error_message, "\"Eolite\n");
  146.         ii = get_error(error_number);
  147.         strcat(#error_message, ii);
  148.         strcat(#error_message, "\" -tE");
  149.         notify(#error_message);
  150. }
  151.  
  152.  
  153. void SetAppColors()
  154. {
  155.         sc.work = 0xE4DFE1;
  156.         sc.work_text = 0;
  157.         sc.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
  158.         sc.work_button_text = 0x000000;
  159.         col_padding = 0xC8C9C9;
  160.         //col_selec   = 0x94AECE;
  161.         col_lpanel  = 0x00699C;
  162. }