Subversion Repositories Kolibri OS

Rev

Rev 7242 | Rev 7244 | 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.  
  44.  
  45. void settings_dialog()
  46. {  
  47.         byte id;
  48.         active_settings=1;
  49.         font_size.value = kfont.size.pt;
  50.         line_height.value = files.item_h;
  51.         SetEventMask(0x27);
  52.         loop(){
  53.                 switch(WaitEvent())
  54.                 {
  55.                         case evMouse:
  56.                                 edit_box_mouse stdcall (#path_start_ed);
  57.                                 break;
  58.                                
  59.                         case evButton:
  60.                                 id=GetButtonID();
  61.                                 if (id==1) { ExitSettings(); break; }
  62.                                 else if (id==5)
  63.                                 {
  64.                                         RunProgram("tinypad", "/sys/settings/assoc.ini");
  65.                                         break;
  66.                                 }
  67.                                 else if (id==6)
  68.                                 {
  69.                                         strcpy(#path_start,#path);
  70.                                         path_start_ed.size = strlen(#path_start);
  71.                                         path_start_ed.pos = strlen(#path_start);
  72.                                         ini.SetString("DefaultPath", #path, strlen(#path));
  73.                                         edit_box_draw stdcall (#path_start_ed);
  74.                                         break;
  75.                                 }
  76.                                 else if (id==7)
  77.                                 {
  78.                                         ini.SetString("DefaultPath", #path_start,strlen(#path_start));
  79.                                         break;
  80.                                 }
  81.                                 else if (id==20) show_dev_name ^= 1;
  82.                                 else if (id==21) { action_buf=109; real_files_names_case ^= 1; }
  83.                                 else if (id==22) info_after_copy ^= 1;
  84.                                 else if (id==24) two_panels ^= true;
  85.                                 else if (id==32) show_breadcrumb ^= true;
  86.                                 else if (id==27) show_status_bar ^= 1;
  87.                                 else if (font_size.click(id)) {
  88.                                         kfont.size.pt = font_size.value;
  89.                                         kfont.changeSIZE();
  90.                                         BigFontsChange();
  91.                                 }
  92.                                 else if (line_height.click(id)) {
  93.                                         files.item_h = line_height.value;
  94.                                 }
  95.                                 else if (id==33) {
  96.                                         big_icons ^= 1;
  97.                                         if (big_icons) {
  98.                                                         icon_size=32;
  99.                                                         files.item_h = line_height.value = 34;
  100.                                                         if (!icons32_default.image)
  101.                                                         {
  102.                                                                 Libimg_LoadImage(#icons32_default, "/sys/icons32.png");
  103.                                                                 Libimg_LoadImage(#icons32_selected, "/sys/icons32.png");
  104.                                                                 Libimg_ReplaceColor(icons32_default.image, icons32_selected.w,
  105.                                                                         icons32_selected.h, 0x00000000, 0xffFFFfff);
  106.                                                                 Libimg_ReplaceColor(icons32_selected.image, icons32_selected.w,
  107.                                                                         icons32_selected.h, 0x00000000, col_selec);                                                            
  108.                                                         }
  109.                                                 }
  110.                                         else {
  111.                                                         icon_size=16;
  112.                                                         files.item_h = line_height.value = 18;
  113.                                         }
  114.                                 }
  115.                                 EventRedrawWindow(Form.left,Form.top);
  116.                                 break;
  117.                                        
  118.                         case evKey:
  119.                                 GetKeys();
  120.                                 if (key_scancode==SCAN_CODE_ESC) ExitSettings();
  121.                                 EAX= key_ascii << 8;
  122.                                 edit_box_key stdcall (#path_start_ed); 
  123.                                 break;
  124.                                
  125.                         case evReDraw:
  126.                                 DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 400,
  127.                                         410+skin_height,0x34,system.color.work,TITLE_SETT,0);
  128.                                 DrawSettingsCheckBoxes();
  129.                 }
  130.         }
  131. }
  132.  
  133. void ExitSettings()
  134. {
  135.         active_settings = 0;
  136.         settings_window = 0;
  137.         cmd_free = 4;
  138.         ExitProcess();
  139. }
  140.  
  141. void DrawSettingsCheckBoxes()
  142. {
  143.         incn y;
  144.         int x=11, frx=26, but_x;
  145.         y.n = 0;
  146.         CheckBox(x, y.inc(14), 20, SHOW_DEVICE_CLASS,  show_dev_name);
  147.         CheckBox(x, y.inc(25), 21, SHOW_REAL_NAMES,  real_files_names_case);
  148.         CheckBox(x, y.inc(25), 27, SHOW_STATUS_BAR,  show_status_bar);
  149.         CheckBox(x, y.inc(25), 22, NOTIFY_COPY_END,  info_after_copy);
  150.         CheckBox(x, y.inc(25), 32, SHOW_BREADCRUMBS,  show_breadcrumb);
  151.         CheckBox(x, y.inc(25), 33, BIG_ICONS,  big_icons);
  152.         CheckBox(x, y.inc(25), 24, USE_TWO_PANELS,  two_panels);
  153.         font_size.draw(x, y.inc(31));
  154.         line_height.draw(x, y.inc(31));
  155.        
  156.         DrawFrame(x, y.inc(37), 340, 95, START_PATH);
  157.         // START_PATH {
  158.         path_start_ed.top = y.inc(21);
  159.         path_start_ed.left = frx;
  160.         DrawEditBox(#path_start_ed);
  161.         but_x = DrawStandartCaptButton(frx, y.inc(34), 6, SAVE_PATH_AS_DEFAULT);
  162.         DrawStandartCaptButton(frx+but_x, y.inc(0), 7, SAVE_START_PATH_AS_DEFAULT);
  163.         // } START_PATH
  164.  
  165.         DrawStandartCaptButton(x, y.inc(52), 5, EDIT_FILE_ASSOCIATIONS);
  166. }
  167.  
  168.  
  169. void LoadIniSettings()
  170. {
  171.         ini.path = GetIni(#eolite_ini_path, "EOLITE.INI");
  172.         ini.section = "Config";
  173.  
  174.         files.SetFont(6, 9, 10000000b);
  175.         real_files_names_case = ini.GetInt("RealFileNamesCase", 1);
  176.         show_dev_name   = ini.GetInt("ShowDeviceName", 1);
  177.         show_status_bar = ini.GetInt("ShowStatusBar", 1);
  178.         info_after_copy = ini.GetInt("InfoAfterCopy", 0);
  179.         kfont.size.pt   = ini.GetInt("FontSize", 13);
  180.         two_panels      = ini.GetInt("TwoPanels", 0);
  181.         files.item_h    = ini.GetInt("LineHeight", 19);
  182.         WinX = ini.GetInt("WinX", 200);
  183.         WinY = ini.GetInt("WinY", 50);
  184.         WinW = ini.GetInt("WinW", 550);
  185.         WinH = ini.GetInt("WinH", 506);
  186.         ini.GetString("DefaultPath", #path, 4096, "/rd/1");
  187.         ini.GetString("DefaultPath", #path_start, 4096, "/rd/1");
  188.         path_start_ed.size = strlen(#path_start);
  189.         path_start_ed.pos = strlen(#path_start);
  190.  
  191.         ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font file",#temp,4096,DEFAULT_FONT);
  192.         kfont.init(#temp);
  193.         ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on");
  194.         if(!strcmp(#temp,"off")) kfont.smooth = false; else kfont.smooth = true;
  195. }
  196.  
  197.  
  198. void SaveIniSettings()
  199. {
  200.         ini.SetInt("ShowDeviceName", show_dev_name);
  201.         ini.SetInt("ShowStatusBar", show_status_bar);
  202.         ini.SetInt("RealFileNamesCase", real_files_names_case);
  203.         ini.SetInt("InfoAfterCopy", info_after_copy);
  204.         ini.SetInt("FontSize", kfont.size.pt);
  205.         ini.SetInt("TwoPanels", two_panels);
  206.         ini.SetInt("LineHeight", files.item_h);
  207.         ini.SetInt("WinX", Form.left);
  208.         ini.SetInt("WinY", Form.top);
  209.         ini.SetInt("WinW", Form.width);
  210.         ini.SetInt("WinH", Form.height);
  211. }
  212.  
  213.  
  214.  
  215. void Write_Error(int error_number)
  216. {
  217.         char error_message[500];
  218.         dword ii;
  219.         if (files.cur_y>=0) Line_ReDraw(0xFF0000, files.cur_y);
  220.         pause(5);
  221.         sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE");
  222.         notify(#error_message);
  223. }
  224.  
  225.  
  226. void SetAppColors()
  227. {
  228.         system.color.get();
  229.         //system.color.work = 0xE4DFE1;
  230.         //system.color.work_text = 0;
  231.         //system.color.work_graph  = 0x7E87A3; //A0A0B8;
  232.         //system.color.work_button = 0x7E87A3;
  233.         //system.color.work_button_text = 0x000000
  234.         col_work    = 0xE4DFE1;
  235.         col_padding = 0xC8C9C9;
  236.         col_selec   = 0x94AECE;
  237.         col_lpanel  = 0x00699C;
  238.         col_graph   = 0x7E87A3;
  239. }
  240.  
  241.  
  242. void BigFontsChange()
  243. {
  244.         files.item_h = kfont.size.pt + 4;
  245.         if (files.item_h<18) files.item_h = 18;
  246.         files_active.item_h = files_inactive.item_h = files.item_h;
  247. }
  248.