Subversion Repositories Kolibri OS

Rev

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