Menu

Commit [r3565]  Maximize  Restore  History

Removed any print options from Preferences object.

(Print options are now stored directly in Settings).

delphidabbler 2013-09-18

changed /branches/parsnip/Src/UPreferences.pas
/branches/parsnip/Src/UPreferences.pas Diff Switch to side-by-side view
--- a/branches/parsnip/Src/UPreferences.pas
+++ b/branches/parsnip/Src/UPreferences.pas
@@ -23,8 +23,13 @@
   Graphics,
   // Project
   CS.SourceCode.Hiliter.Themes,
-  Hiliter.UGlobals, UIStringList, UMeasurement, UPrintInfo,
-  USnippetPageStructure, USourceFileInfo, USourceGen, UWarnings;
+  Hiliter.UGlobals,
+  UIStringList,
+  UMeasurement,
+  USnippetPageStructure,
+  USourceFileInfo,
+  USourceGen,
+  UWarnings;
 
 
 type
@@ -188,22 +193,6 @@
     ///  of source code in main display as a string list.</summary>
     property SourceCodeBGCustomColours: IStringList
       read GetSourceCodeBGCustomColours write SetSourceCodeBGCustomColours;
-
-    ///  <summary>Gets default print options.</summary>
-    function GetPrinterOptions: TPrintOptions;
-    ///  <summary>Sets default print options.</summary>
-    procedure SetPrinterOptions(const Options: TPrintOptions);
-    ///  <summary>Default print options.</summary>
-    property PrinterOptions: TPrintOptions
-      read GetPrinterOptions write SetPrinterOptions;
-
-    ///  <summary>Gets default printer page margins.</summary>
-    function GetPrinterPageMargins: TPageMargins;
-    ///  <summary>Sets new default printer page margins.</summary>
-    procedure SetPrinterPageMargins(const Margins: TPageMargins);
-    ///  <summary>Default printer page margins.</summary>
-    property PrinterPageMargins: TPageMargins
-      read GetPrinterPageMargins write SetPrinterPageMargins;
 
     ///  <summary>Gets current user defined syntax highlighter.</summary>
     function GetHiliteAttrs: IHiliteAttrs;
@@ -372,10 +361,6 @@
       ///  <summary>Records custom colours available for use as background
       ///  colour of source code in main display.</summary>
       fSourceCodeBGCustomColours: IStringList;
-      ///  <summary>Default print options.</summary>
-      fPrinterOptions: TPrintOptions;
-      ///  <summary>Default printer page margins.</summary>
-      fPrinterPageMargins: TPageMargins;
       ///  <summary>Attributes of current user defined syntax highlighter.
       ///  </summary>
       fHiliteAttrs: IHiliteAttrs;
@@ -543,22 +528,6 @@
     ///  <remarks>Method of IPreferences.</remarks>
     procedure SetSourceCodeBGCustomColours(Value: IStringList);
 
-    ///  <summary>Gets default print options.</summary>
-    ///  <remarks>Method of IPreferences.</remarks>
-    function GetPrinterOptions: TPrintOptions;
-
-    ///  <summary>Sets default print options.</summary>
-    ///  <remarks>Method of IPreferences.</remarks>
-    procedure SetPrinterOptions(const Options: TPrintOptions);
-
-    ///  <summary>Gets default printer page margins.</summary>
-    ///  <remarks>Method of IPreferences.</remarks>
-    function GetPrinterPageMargins: TPageMargins;
-
-    ///  <summary>Sets new default printer page margins.</summary>
-    ///  <remarks>Method of IPreferences.</remarks>
-    procedure SetPrinterPageMargins(const Margins: TPageMargins);
-
     ///  <summary>Gets current user defined syntax highlighter.</summary>
     ///  <remarks>Method of IPreferences.</remarks>
     function GetHiliteAttrs: IHiliteAttrs;
@@ -666,7 +635,6 @@
       // Sub-sections of ssPreferences ini file section
       cGeneral = 'General';
       cSourceCode = 'SourceCode';
-      cPrinting = 'Printing';
       cHiliter = 'Hiliter';
       cCodeGenerator = 'CodeGen';
       cNews = 'News';
@@ -729,8 +697,6 @@
   Self.fDBHeadingCustomColours[True] := SrcPref.DBHeadingCustomColours[True];
   Self.fSourceCodeBGColour := SrcPref.SourceCodeBGColour;
   Self.fSourceCodeBGCustomColours := SrcPref.SourceCodeBGCustomColours;
-  Self.fPrinterOptions := SrcPref.PrinterOptions;
-  Self.fPrinterPageMargins := SrcPref.PrinterPageMargins;
   Self.SetHiliteAttrs(SrcPref.HiliteAttrs);
   for HiliteThemeKind := Low(TCurrentHiliteThemeKind) to
     High(TCurrentHiliteThemeKind) do
@@ -828,16 +794,6 @@
   Result := fPageStructures;
 end;
 
-function TPreferences.GetPrinterOptions: TPrintOptions;
-begin
-  Result := fPrinterOptions;
-end;
-
-function TPreferences.GetPrinterPageMargins: TPageMargins;
-begin
-  Result := fPrinterPageMargins;
-end;
-
 function TPreferences.GetShowEmptySections: Boolean;
 begin
   Result := fShowEmptySections;
@@ -945,16 +901,6 @@
   PageStructures: TSnippetPageStructures);
 begin
   fPageStructures.Assign(PageStructures);
-end;
-
-procedure TPreferences.SetPrinterOptions(const Options: TPrintOptions);
-begin
-  fPrinterOptions := Options;
-end;
-
-procedure TPreferences.SetPrinterPageMargins(const Margins: TPageMargins);
-begin
-  fPrinterPageMargins := Margins;
 end;
 
 procedure TPreferences.SetShowEmptySections(const Value: Boolean);
@@ -1034,8 +980,6 @@
   NewPref.DBHeadingCustomColours[True] := Self.fDBHeadingCustomColours[True];
   NewPref.SourceCodeBGColour := Self.fSourceCodeBGColour;
   NewPref.SourceCodeBGCustomColours := Self.fSourceCodeBGCustomColours;
-  NewPref.PrinterOptions := Self.fPrinterOptions;
-  NewPref.PrinterPageMargins := Self.fPrinterPageMargins;
   NewPref.HiliteAttrs := Self.GetHiliteAttrs;
   for HiliteThemeKind := Low(TCurrentHiliteThemeKind) to
     High(TCurrentHiliteThemeKind) do
@@ -1106,20 +1050,6 @@
   );
   fTruncateSourceComments := Storage.GetBoolean('TruncateComments', False);
   fSourceSyntaxHilited := Storage.GetBoolean('UseSyntaxHiliting', False);
-
-  // Read printing section
-  Storage := Settings.ReadSection(ssPreferences, cPrinting);
-  fPrinterOptions := [];
-  if Storage.GetBoolean('UseColor', True) then
-    Include(fPrinterOptions, poUseColor);
-  if Storage.GetBoolean('SyntaxPrint', True) then
-    Include(fPrinterOptions, poSyntaxPrint);
-  fPrinterPageMargins := TPageMargins.Create(
-    Storage.GetFloat('LeftMargin', cPrintPageMarginSizeMM),
-    Storage.GetFloat('TopMargin', cPrintPageMarginSizeMM),
-    Storage.GetFloat('RightMargin', cPrintPageMarginSizeMM),
-    Storage.GetFloat('BottomMargin', cPrintPageMarginSizeMM)
-  );
 
   // Read syntax highlighter section
   Storage := Settings.ReadSection(ssPreferences, cHiliter);
@@ -1206,16 +1136,6 @@
   Storage.SetBoolean('UseSyntaxHiliting', fSourceSyntaxHilited);
   Storage.Save;
 
-  // Write printing section
-  Storage := Settings.EmptySection(ssPreferences, cPrinting);
-  Storage.SetBoolean('UseColor', poUseColor in fPrinterOptions);
-  Storage.SetBoolean('SyntaxPrint', poSyntaxPrint in fPrinterOptions);
-  Storage.SetFloat('LeftMargin', fPrinterPageMargins.Left);
-  Storage.SetFloat('TopMargin', fPrinterPageMargins.Top);
-  Storage.SetFloat('RightMargin', fPrinterPageMargins.Right);
-  Storage.SetFloat('BottomMargin', fPrinterPageMargins.Bottom);
-  Storage.Save;
-
   // Write syntax highlighter section
   Storage := Settings.EmptySection(ssPreferences, cHiliter);
   // syntax highlighter attributes
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.