@@ -37,6 +37,23 @@ interface
3737 IPreferences = interface (IInterface)
3838 [' {381B9A92-B528-47E1-AC04-90E1FFFDADA7}' ]
3939
40+ // / <summary>Gets last tab displayed by Preferences dialogue box when it
41+ // / was last closed, or empty string if the tab is not known.
42+ // / </summary>
43+ // / <remarks>This is meta data about the dialogue box itself, not about
44+ // / user preferences.</remarks>
45+ function GetLastTab : string;
46+ // / <summary>Sets last tab displayed by Preferences dialogue box when it
47+ // / was last closed.</summary>
48+ // / <remarks>This is meta data about the dialogue box itself, not about
49+ // / user preferences.</remarks>
50+ procedure SetLastTab (const Value : string);
51+ // / <summary>Last tab displayed by Preferences dialogue box when it was
52+ // / last closed, or empty string if the tab is not known.</summary>
53+ // / <remarks>This is meta data about the dialogue box itself, not about
54+ // / user preferences.</remarks>
55+ property LastTab: string read GetLastTab write SetLastTab;
56+
4057 // / <summary>Gets style of commenting used to describe snippets in
4158 // / generated code.</summary>
4259 function GetSourceCommentStyle : TCommentStyle;
@@ -283,6 +300,7 @@ TPreferences = class(TInterfacedObject,
283300 )
284301 strict protected
285302 var
303+ fLastTab: string;
286304 // / <summary>Default file extension / type used when writing code
287305 // / snippets file.</summary>
288306 fSourceDefaultFileType: TSourceFileType;
@@ -344,6 +362,24 @@ TPreferences = class(TInterfacedObject,
344362 // / <summary>Destroys object instance.</summary>
345363 destructor Destroy; override;
346364
365+ // / <summary>Gets last tab displayed by Preferences dialogue box when it
366+ // / was last closed, or empty string if the tab is not known.
367+ // / </summary>
368+ // / <remarks>
369+ // / <para>This is meta data about the dialogue box itself, not about
370+ // / user preferences.</para>
371+ // / <para>Method of IPreferences.</para>
372+ // / </remarks>
373+ function GetLastTab : string;
374+ // / <summary>Sets last tab displayed by Preferences dialogue box when it
375+ // / was last closed.</summary>
376+ // / <remarks>
377+ // / <para>This is meta data about the dialogue box itself, not about user
378+ // / preferences.</para>
379+ // / <para>Method of IPreferences.</para>
380+ // / </remarks>
381+ procedure SetLastTab (const Value : string);
382+
347383 // / <summary>Gets style of commenting used to describe snippets in
348384 // / generated code.</summary>
349385 // / <remarks>Method of IPreferences.</remarks>
@@ -608,6 +644,7 @@ procedure TPreferences.Assign(const Src: IInterface);
608644 if not Supports(Src, IPreferences, SrcPref) then
609645 raise EBug.Create(ClassName + ' .Assign: Src is wrong type' );
610646 // Copy the data
647+ Self.fLastTab := SrcPref.LastTab;
611648 Self.fSourceDefaultFileType := SrcPref.SourceDefaultFileType;
612649 Self.fSourceCommentStyle := SrcPref.SourceCommentStyle;
613650 Self.fTruncateSourceComments := SrcPref.TruncateSourceComments;
@@ -671,6 +708,11 @@ function TPreferences.GetHiliteAttrs: IHiliteAttrs;
671708 Result := fHiliteAttrs;
672709end ;
673710
711+ function TPreferences.GetLastTab : string;
712+ begin
713+ Result := fLastTab;
714+ end ;
715+
674716function TPreferences.GetMeasurementUnits : TMeasurementUnits;
675717begin
676718 Result := fMeasurementUnits;
@@ -768,6 +810,11 @@ procedure TPreferences.SetHiliteAttrs(const Attrs: IHiliteAttrs);
768810 (fHiliteAttrs as IAssignable).Assign(Attrs);
769811end ;
770812
813+ procedure TPreferences.SetLastTab (const Value : string);
814+ begin
815+ fLastTab := Value ;
816+ end ;
817+
771818procedure TPreferences.SetMeasurementUnits (const Value : TMeasurementUnits);
772819begin
773820 fMeasurementUnits := Value ;
@@ -854,6 +901,7 @@ function TPreferencesPersist.Clone: IInterface;
854901 Result := TPreferences.Create;
855902 // Copy properties to it
856903 NewPref := Result as IPreferences;
904+ NewPref.LastTab := Self.fLastTab;
857905 NewPref.SourceDefaultFileType := Self.fSourceDefaultFileType;
858906 NewPref.SourceCommentStyle := Self.fSourceCommentStyle;
859907 NewPref.TruncateSourceComments := Self.fTruncateSourceComments;
@@ -886,6 +934,10 @@ constructor TPreferencesPersist.Create;
886934begin
887935 inherited Create;
888936
937+ // Read meta data section (no sub-section name)
938+ Storage := Settings.ReadSection(ssPreferences);
939+ fLastTab := Storage.GetString(' LastTab' );
940+
889941 // Read general section
890942 Storage := Settings.ReadSection(ssPreferences, cGeneral);
891943 fMeasurementUnits := TMeasurementUnits(
@@ -969,6 +1021,11 @@ destructor TPreferencesPersist.Destroy;
9691021var
9701022 Storage: ISettingsSection; // object used to access persistent storage
9711023begin
1024+ // Wreite meta section (no sub-section name)
1025+ Storage := Settings.EmptySection(ssPreferences);
1026+ Storage.SetString(' LastTab' , fLastTab);
1027+ Storage.Save;
1028+
9721029 // Write general section
9731030 Storage := Settings.EmptySection(ssPreferences, cGeneral);
9741031 Storage.SetInteger(' Units' , Ord(fMeasurementUnits));
0 commit comments