uSettings.pas 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // uSettings for GLSViewer
  3. //
  4. unit uSettings;
  5. interface
  6. uses
  7. Winapi.Windows,
  8. Winapi.Messages,
  9. System.Win.Registry,
  10. System.IniFiles,
  11. System.SysUtils,
  12. Vcl.Forms,
  13. Vcl.Graphics,
  14. Vcl.ActnList,
  15. //
  16. GnuGettext;
  17. procedure InitGeneralRegistry;
  18. //-------------------------------------------------------------------------
  19. implementation
  20. // ------------------------------------------------------------------------
  21. uses
  22. uGlobals;
  23. procedure InitGeneralRegistry;
  24. var
  25. RegIni: TRegistryIniFile;
  26. FileVersion: cardinal;
  27. begin
  28. GeneralSection := RegGLSViewer + 'General';
  29. FileVersion := GetFileVersion(ParamStr(0));
  30. ExePath := ExtractFilePath(ParamStr(0));
  31. RegIni := TRegistryIniFile.Create(GeneralSection);
  32. try
  33. with RegIni do
  34. begin
  35. if not RegIni.SectionExists(GeneralSection) then
  36. begin
  37. WriteString(GeneralSection, 'ExePath', ExePath); //Don't translate the strings
  38. WriteInteger(GeneralSection, 'FileVersion', FileVersion);
  39. WriteString(GeneralSection, 'License', 'MPL');
  40. WriteInteger(GeneralSection, 'Language', LANG_ENGLISH); //9, Default installation
  41. Language := LANG_ENGLISH;
  42. end
  43. else
  44. begin
  45. ExePath := ReadString(GeneralSection, 'ExePath', ExePath);
  46. Language := ReadInteger(GeneralSection, 'Language', LANG_ENGLISH);
  47. //9, LANG_ENGLISH - Default
  48. end;
  49. end;
  50. finally
  51. RegIni.Free;
  52. end;
  53. {
  54. if RegIni.ValueExists(GeneralSection,'SplashStart') then
  55. SplashStart := RegIni.ReadBool(GeneralSection,'SplashStart',False)
  56. else
  57. SplashStart := True;
  58. if RegIni.ValueExists(GeneralSection,'TipOfTheDay') then
  59. TipOfTheDay := RegIni.ReadBool(GeneralSection,'TipOfTheDay', True)
  60. else
  61. TipOfTheDay := False;
  62. }
  63. end;
  64. initialization
  65. InitGeneralRegistry;
  66. end.