Subversion Repositories Kolibri OS

Rev

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