DEADSOFTWARE

system: add option --config
[d2df-editor.git] / src / editor / f_options.pas
index 8a77b180abf987c647abd3e97d36d7b7b9ae0c2c..feffc4b02ee4064d0366689e4828cad70d01cae5 100644 (file)
@@ -7,7 +7,7 @@ interface
 uses
   LCLIntf, LCLType, SysUtils, Variants, Classes,
   Graphics, Controls, Forms, Dialogs, StdCtrls,
-  ExtCtrls, ComCtrls, Registry;
+  ExtCtrls, ComCtrls, Registry, Math;
 
 type
 
@@ -77,7 +77,7 @@ procedure RegisterFileType(ext: String; FileName: String);
 implementation
 
 uses
-  f_main, StdConvs, CONFIG, g_language, g_resources;
+  f_main, StdConvs, CONFIG, g_language, g_resources, g_options;
 
 {$R *.lfm}
 
@@ -182,8 +182,8 @@ begin
     d1 := True
   else
     d1 := False;
-  DotStepOne := StrToIntDef(eDotStepOne.Text, 16);
-  DotStepTwo := StrToIntDef(eDotStepTwo.Text, 8);
+  DotStepOne := EnsureRange(StrToIntDef(eDotStepOne.Text, 16), 4, 2048);
+  DotStepTwo := EnsureRange(StrToIntDef(eDotStepTwo.Text, 8), 4, 2048);
   if d1 then
     DotStep := DotStepOne
   else
@@ -207,7 +207,7 @@ begin
   else
     DotSize := 1;
 
-  config := TConfig.CreateFile(EditorDir+'Editor.cfg');
+  config := TConfig.CreateFile(CfgFileName);
 
   config.WriteInt('Editor', 'DotColor', DotColor);
   config.WriteBool('Editor', 'DotEnable', DotEnable);
@@ -232,7 +232,7 @@ begin
     MainForm.RefreshRecentMenu();
   end;
 
-  config.SaveFile(EditorDir+'Editor.cfg');
+  config.SaveFile(CfgFileName);
   config.Free();
   Close();
 end;