Subversion Repositories Kolibri OS

Rev

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