Subversion Repositories Kolibri OS

Rev

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