@@ -37,6 +37,23 @@ interface
37
37
IPreferences = interface (IInterface)
38
38
[' {381B9A92-B528-47E1-AC04-90E1FFFDADA7}' ]
39
39
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
+
40
57
// / <summary>Gets style of commenting used to describe snippets in
41
58
// / generated code.</summary>
42
59
function GetSourceCommentStyle : TCommentStyle;
@@ -283,6 +300,7 @@ TPreferences = class(TInterfacedObject,
283
300
)
284
301
strict protected
285
302
var
303
+ fLastTab: string;
286
304
// / <summary>Default file extension / type used when writing code
287
305
// / snippets file.</summary>
288
306
fSourceDefaultFileType: TSourceFileType;
@@ -344,6 +362,24 @@ TPreferences = class(TInterfacedObject,
344
362
// / <summary>Destroys object instance.</summary>
345
363
destructor Destroy; override;
346
364
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
+
347
383
// / <summary>Gets style of commenting used to describe snippets in
348
384
// / generated code.</summary>
349
385
// / <remarks>Method of IPreferences.</remarks>
@@ -608,6 +644,7 @@ procedure TPreferences.Assign(const Src: IInterface);
608
644
if not Supports(Src, IPreferences, SrcPref) then
609
645
raise EBug.Create(ClassName + ' .Assign: Src is wrong type' );
610
646
// Copy the data
647
+ Self.fLastTab := SrcPref.LastTab;
611
648
Self.fSourceDefaultFileType := SrcPref.SourceDefaultFileType;
612
649
Self.fSourceCommentStyle := SrcPref.SourceCommentStyle;
613
650
Self.fTruncateSourceComments := SrcPref.TruncateSourceComments;
@@ -671,6 +708,11 @@ function TPreferences.GetHiliteAttrs: IHiliteAttrs;
671
708
Result := fHiliteAttrs;
672
709
end ;
673
710
711
+ function TPreferences.GetLastTab : string;
712
+ begin
713
+ Result := fLastTab;
714
+ end ;
715
+
674
716
function TPreferences.GetMeasurementUnits : TMeasurementUnits;
675
717
begin
676
718
Result := fMeasurementUnits;
@@ -768,6 +810,11 @@ procedure TPreferences.SetHiliteAttrs(const Attrs: IHiliteAttrs);
768
810
(fHiliteAttrs as IAssignable).Assign(Attrs);
769
811
end ;
770
812
813
+ procedure TPreferences.SetLastTab (const Value : string);
814
+ begin
815
+ fLastTab := Value ;
816
+ end ;
817
+
771
818
procedure TPreferences.SetMeasurementUnits (const Value : TMeasurementUnits);
772
819
begin
773
820
fMeasurementUnits := Value ;
@@ -854,6 +901,7 @@ function TPreferencesPersist.Clone: IInterface;
854
901
Result := TPreferences.Create;
855
902
// Copy properties to it
856
903
NewPref := Result as IPreferences;
904
+ NewPref.LastTab := Self.fLastTab;
857
905
NewPref.SourceDefaultFileType := Self.fSourceDefaultFileType;
858
906
NewPref.SourceCommentStyle := Self.fSourceCommentStyle;
859
907
NewPref.TruncateSourceComments := Self.fTruncateSourceComments;
@@ -886,6 +934,10 @@ constructor TPreferencesPersist.Create;
886
934
begin
887
935
inherited Create;
888
936
937
+ // Read meta data section (no sub-section name)
938
+ Storage := Settings.ReadSection(ssPreferences);
939
+ fLastTab := Storage.GetString(' LastTab' );
940
+
889
941
// Read general section
890
942
Storage := Settings.ReadSection(ssPreferences, cGeneral);
891
943
fMeasurementUnits := TMeasurementUnits(
@@ -969,6 +1021,11 @@ destructor TPreferencesPersist.Destroy;
969
1021
var
970
1022
Storage: ISettingsSection; // object used to access persistent storage
971
1023
begin
1024
+ // Wreite meta section (no sub-section name)
1025
+ Storage := Settings.EmptySection(ssPreferences);
1026
+ Storage.SetString(' LastTab' , fLastTab);
1027
+ Storage.Save;
1028
+
972
1029
// Write general section
973
1030
Storage := Settings.EmptySection(ssPreferences, cGeneral);
974
1031
Storage.SetInteger(' Units' , Ord(fMeasurementUnits));
0 commit comments