Subversion Repositories Kolibri OS

Rev

Rev 7243 | Rev 7245 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. #ifdef LANG_RUS
  3.         ?define TITLE_SETT " áâனª¨"
  4.         ?define SHOW_DEVICE_CLASS "‚뢮¤¨âì ­ §¢ ­¨ï ª« áá  ãáâனáâ¢"
  5.         ?define SHOW_REAL_NAMES "®ª §ë¢ âì ¨¬¥­  ä ©«®¢ ­¥ ¬¥­ïï ॣ¨áâà"
  6.         ?define SHOW_STATUS_BAR "®ª §ë¢ âì áâ âãá ¡ à"
  7.         ?define NOTIFY_COPY_END "“¢¥¤®¬«ïâì ® § ¢¥à襭¨¨ ª®¯¨à®¢ ­¨ï"
  8.         ?define SHOW_BREADCRUMBS "ˆá¯®«ì§®¢ âì 'å«¥¡­ë¥ ªà®èª¨'"
  9.         ?define BIG_ICONS "ˆá¯®«ì§®¢ âì ¡®«ì訥 ¨ª®­ª¨"
  10.         ?define USE_TWO_PANELS "„¢¥ ¯ ­¥«¨"
  11.         ?define FONT_SIZE_LABEL " §¬¥à èà¨äâ "
  12.         ?define LIST_LINE_HEIGHT "‚ëá®â  áâப¨ ¢ ᯨ᪥"
  13.         ?define SAVE_PATH_AS_DEFAULT "’¥ªã騩 ¯ãâì"
  14.         ?define SAVE_START_PATH_AS_DEFAULT "‚¢¥¤¥­­ë© ¯ãâì"
  15.         ?define EDIT_FILE_ASSOCIATIONS "¥¤ ªâ¨à®¢ âì  áá®æ¨ æ¨¨ ä ©«®¢"
  16.         ?define START_PATH " ‘â àâ®¢ë© ¯ãâì: "
  17. #else
  18.         ?define TITLE_SETT "Settings"
  19.         ?define SHOW_DEVICE_CLASS "Show device class name"
  20.         ?define SHOW_REAL_NAMES "Show file names in original case"
  21.         ?define SHOW_STATUS_BAR "Show status bar"
  22.         ?define NOTIFY_COPY_END "Notify when copying finished"
  23.         ?define SHOW_BREADCRUMBS "Show breadcrumbs"
  24.         ?define BIG_ICONS "Big icons in list"
  25.         ?define USE_TWO_PANELS "Two panels"
  26.         ?define FONT_SIZE_LABEL "Font size"
  27.         ?define LIST_LINE_HEIGHT "List line height"
  28.         ?define SAVE_PATH_AS_DEFAULT "‘urrent path"
  29.         ?define SAVE_START_PATH_AS_DEFAULT "Typed path"
  30.         ?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
  31.         ?define START_PATH " Start path: "
  32. #endif
  33.  
  34. int WinX, WinY, WinW, WinH;
  35.  
  36. dword set_mouse_dd;
  37. char path_start[4096]="\0";
  38. edit_box path_start_ed = {290,50,57,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,4098,
  39.                               #path_start,#set_mouse_dd, 100000000000010b,0,0};
  40.  
  41. more_less_box font_size   = { NULL, 9, 22, FONT_SIZE_LABEL };
  42. more_less_box line_height = { NULL, 16, 64, LIST_LINE_HEIGHT };
  43. checkbox show_dev_name    = { SHOW_DEVICE_CLASS };
  44. checkbox show_real_names  = { SHOW_REAL_NAMES };
  45. checkbox show_status_bar  = { SHOW_STATUS_BAR };
  46. checkbox info_after_copy  = { NOTIFY_COPY_END };
  47. checkbox show_breadcrumb  = { SHOW_BREADCRUMBS };
  48. checkbox big_icons        = { BIG_ICONS };
  49. checkbox two_panels       = { USE_TWO_PANELS };
  50.  
  51.  
  52. void settings_dialog()
  53. {  
  54.         int id;
  55.         active_settings=1;
  56.         font_size.value = kfont.size.pt;
  57.         line_height.value = files.item_h;
  58.         SetEventMask(0x27);
  59.         loop(){
  60.                 switch(WaitEvent())
  61.                 {
  62.                         case evMouse:
  63.                                 edit_box_mouse stdcall (#path_start_ed);
  64.                                 break;
  65.                                
  66.                         case evButton:
  67.                                 id=GetButtonID();
  68.                                 if (1==id) { ExitSettings(); break; }
  69.                                 else if (id==5)
  70.                                 {
  71.                                         RunProgram("tinypad", "/sys/settings/assoc.ini");
  72.                                         break;
  73.                                 }
  74.                                 else if (id==6)
  75.                                 {
  76.                                         strcpy(#path_start,#path);
  77.                                         path_start_ed.size = strlen(#path_start);
  78.                                         path_start_ed.pos = strlen(#path_start);
  79.                                         ini.SetString("DefaultPath", #path, strlen(#path));
  80.                                         edit_box_draw stdcall (#path_start_ed);
  81.                                         break;
  82.                                 }
  83.                                 else if (id==7)
  84.                                 {
  85.                                         ini.SetString("DefaultPath", #path_start,strlen(#path_start));
  86.                                         break;
  87.                                 }
  88.                                 show_dev_name.click(id);
  89.                                 if (show_real_names.click(id)) action_buf=109;
  90.                                 info_after_copy.click(id);
  91.                                 two_panels.click(id);
  92.                                 show_breadcrumb.click(id);
  93.                                 show_status_bar.click(id);
  94.                                 if (font_size.click(id)) {
  95.                                         kfont.size.pt = font_size.value;
  96.                                         kfont.changeSIZE();
  97.                                         BigFontsChange();
  98.                                 }
  99.                                 if (line_height.click(id)) files.item_h = line_height.value;
  100.                                 if (big_icons.click(id)) BigIconsSwitch();
  101.                                 EventRedrawWindow(Form.left,Form.top);
  102.                                 break;
  103.                                        
  104.                         case evKey:
  105.                                 GetKeys();
  106.                                 if (key_scancode==SCAN_CODE_ESC) ExitSettings();
  107.                                 EAX= key_ascii << 8;
  108.                                 edit_box_key stdcall (#path_start_ed); 
  109.                                 break;
  110.                                
  111.                         case evReDraw:
  112.                                 DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 400,
  113.                                         410+skin_height,0x34,system.color.work,TITLE_SETT,0);
  114.                                 DrawSettingsCheckBoxes();
  115.                 }
  116.         }
  117. }
  118.  
  119. void ExitSettings()
  120. {
  121.         active_settings = 0;
  122.         settings_window = 0;
  123.         cmd_free = 4;
  124.         ExitProcess();
  125. }
  126.  
  127. void DrawSettingsCheckBoxes()
  128. {
  129.         incn y;
  130.         int x=11, frx=26, but_x;
  131.         y.n = 0;
  132.         show_dev_name.draw(x, y.inc(14));
  133.         show_real_names.draw(x, y.inc(25));
  134.         show_status_bar.draw(x, y.inc(25));
  135.         info_after_copy.draw(x, y.inc(25));
  136.         show_breadcrumb.draw(x, y.inc(25));
  137.         big_icons.draw(x, y.inc(25));
  138.         two_panels.draw(x, y.inc(25));
  139.         font_size.draw(x, y.inc(31));
  140.         line_height.draw(x, y.inc(31));
  141.        
  142.         DrawFrame(x, y.inc(37), 340, 95, START_PATH);
  143.         // START_PATH {
  144.         path_start_ed.top = y.inc(21);
  145.         path_start_ed.left = frx;
  146.         DrawEditBox(#path_start_ed);
  147.         but_x = DrawStandartCaptButton(frx, y.inc(34), 6, SAVE_PATH_AS_DEFAULT);
  148.         DrawStandartCaptButton(frx+but_x, y.inc(0), 7, SAVE_START_PATH_AS_DEFAULT);
  149.         // } START_PATH
  150.  
  151.         DrawStandartCaptButton(x, y.inc(52), 5, EDIT_FILE_ASSOCIATIONS);
  152. }
  153.  
  154.  
  155. void LoadIniSettings()
  156. {
  157.         ini.path = GetIni(#eolite_ini_path, "EOLITE.INI");
  158.         ini.section = "Config";
  159.  
  160.         files.SetFont(6, 9, 10000000b);
  161.         show_real_names.checked = ini.GetInt("RealFileNamesCase", true);
  162.         show_dev_name.checked   = ini.GetInt("ShowDeviceName", true);
  163.         show_status_bar.checked = ini.GetInt("ShowStatusBar", true);
  164.         info_after_copy.checked = ini.GetInt("InfoAfterCopy", false);
  165.         two_panels.checked      = ini.GetInt("TwoPanels", false);
  166.         kfont.size.pt   = ini.GetInt("FontSize", 13);
  167.         files.item_h    = ini.GetInt("LineHeight", 19);
  168.         WinX = ini.GetInt("WinX", 200);
  169.         WinY = ini.GetInt("WinY", 50);
  170.         WinW = ini.GetInt("WinW", 550);
  171.         WinH = ini.GetInt("WinH", 506);
  172.         ini.GetString("DefaultPath", #path, 4096, "/rd/1");
  173.         ini.GetString("DefaultPath", #path_start, 4096, "/rd/1");
  174.         path_start_ed.size = strlen(#path_start);
  175.         path_start_ed.pos = strlen(#path_start);
  176.  
  177.         ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font file",#temp,4096,DEFAULT_FONT);
  178.         kfont.init(#temp);
  179.         ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on");
  180.         if(!strcmp(#temp,"off")) kfont.smooth = false; else kfont.smooth = true;
  181. }
  182.  
  183.  
  184. void SaveIniSettings()
  185. {
  186.         ini.SetInt("ShowDeviceName", show_dev_name.checked);
  187.         ini.SetInt("ShowStatusBar", show_status_bar.checked);
  188.         ini.SetInt("RealFileNamesCase", show_real_names.checked);
  189.         ini.SetInt("InfoAfterCopy", info_after_copy.checked);
  190.         ini.SetInt("FontSize", kfont.size.pt);
  191.         ini.SetInt("TwoPanels", two_panels.checked);
  192.         ini.SetInt("LineHeight", files.item_h);
  193.         ini.SetInt("WinX", Form.left);
  194.         ini.SetInt("WinY", Form.top);
  195.         ini.SetInt("WinW", Form.width);
  196.         ini.SetInt("WinH", Form.height);
  197. }
  198.  
  199.  
  200.  
  201. void Write_Error(int error_number)
  202. {
  203.         char error_message[500];
  204.         dword ii;
  205.         if (files.cur_y>=0) Line_ReDraw(0xFF0000, files.cur_y);
  206.         pause(5);
  207.         sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE");
  208.         notify(#error_message);
  209. }
  210.  
  211.  
  212. void SetAppColors()
  213. {
  214.         system.color.get();
  215.         //system.color.work = 0xE4DFE1;
  216.         //system.color.work_text = 0;
  217.         //system.color.work_graph  = 0x7E87A3; //A0A0B8;
  218.         //system.color.work_button = 0x7E87A3;
  219.         //system.color.work_button_text = 0x000000
  220.         col_work    = 0xE4DFE1;
  221.         col_padding = 0xC8C9C9;
  222.         col_selec   = 0x94AECE;
  223.         col_lpanel  = 0x00699C;
  224.         col_graph   = 0x7E87A3;
  225. }
  226.  
  227.  
  228. void BigFontsChange()
  229. {
  230.         files.item_h = kfont.size.pt + 4;
  231.         if (files.item_h<18) files.item_h = 18;
  232.         files_active.item_h = files_inactive.item_h = files.item_h;
  233. }
  234.  
  235. void BigIconsSwitch()
  236. {
  237.         if (big_icons.checked)
  238.         {
  239.                 icon_size=32;
  240.                 files.item_h = line_height.value = 34;
  241.                 if (!icons32_default.image)
  242.                 {
  243.                         Libimg_LoadImage(#icons32_default, "/sys/icons32.png");
  244.                         Libimg_LoadImage(#icons32_selected, "/sys/icons32.png");
  245.                         Libimg_ReplaceColor(icons32_default.image, icons32_selected.w,
  246.                                 icons32_selected.h, 0x00000000, 0xffFFFfff);
  247.                         Libimg_ReplaceColor(icons32_selected.image, icons32_selected.w,
  248.                                 icons32_selected.h, 0x00000000, col_selec);                                                            
  249.                 }
  250.         }
  251.         else {
  252.                 icon_size=16;
  253.                 files.item_h = line_height.value = 18;
  254.         }      
  255. }
  256.