mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 06:38:06 +02:00
PoChecker:
- Save mainform location and size - Create configpath if it does not exist (stand-alone version only) git-svn-id: trunk@46296 -
This commit is contained in:
parent
ab557befa8
commit
7fecc7228c
@ -451,10 +451,23 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TPoCheckerForm.LoadConfig;
|
||||
function IsSaneRect(ARect: TRect): Boolean;
|
||||
const
|
||||
MinWH = 50; //arbitrary
|
||||
begin
|
||||
Result := (ARect.Right > ARect.Left + MinWH) and
|
||||
(ARect.Bottom > ARect.Bottom + MinWH);
|
||||
end;
|
||||
var
|
||||
ARect: TRect;
|
||||
begin
|
||||
FPoCheckerSettings := TPoCheckerSettings.Create;
|
||||
FPoCheckerSettings.LoadConfig;
|
||||
ARect := FPoCheckerSettings.MainFormGeometry;
|
||||
if IsSaneRect(ARect) then BoundsRect := ARect;
|
||||
|
||||
//DebugLn(' TestOptions after loading = ');
|
||||
//DebugLn(' ',DbgS(FPoCheckerSettings.TestOptions));
|
||||
//debugln(' TPoCheckerForm.FormCreate: TestTypes after loading = ');
|
||||
@ -477,6 +490,7 @@ begin
|
||||
FPoCheckerSettings.LastSelectedFile := FSelectedPoName;
|
||||
FPoCheckerSettings.TestTypes := GetTestTypesFromListBox;
|
||||
FPoCheckerSettings.TestOptions := GetTestOptions;
|
||||
FPoCheckerSettings.MainFormGeometry := BoundsRect;
|
||||
FPoCheckerSettings.SaveConfig;
|
||||
end;
|
||||
|
||||
|
@ -28,6 +28,7 @@ type
|
||||
FMasterPoList: TStrings;
|
||||
FChildrenPoList: TStrings;
|
||||
FLastSelectedFile: String;
|
||||
FMainFormGeometry: TRect;
|
||||
function LoadLastSelectedFile: String;
|
||||
function LoadTestTypes: TPoTestTypes;
|
||||
function LoadTestOptions: TPoTestOptions;
|
||||
@ -36,6 +37,7 @@ type
|
||||
procedure SaveLastSelectedFile;
|
||||
procedure SaveTestTypes;
|
||||
procedure SaveTestOptions;
|
||||
procedure SaveWindowsGeometry;
|
||||
procedure SaveMasterPoList;
|
||||
procedure SaveChildrenPoList;
|
||||
|
||||
@ -53,6 +55,7 @@ type
|
||||
property MasterPoList: TStrings read FMasterPoList write FMasterPoList;
|
||||
property ChildrenPoList: TStrings read FChildrenPoList write FChildrenPoList;
|
||||
property LastSelectedFile: String read FLastSelectedFile write FLastSelectedFile;
|
||||
property MainFormGeometry: TRect read FMainFormGeometry write FMainFormGeometry;
|
||||
end;
|
||||
|
||||
function DbgS(PoTestTypes: TPoTestTypes): String; overload;
|
||||
@ -72,7 +75,7 @@ begin
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
function GetConfigPath: String;
|
||||
function GetAndCreateConfigPath: String;
|
||||
var
|
||||
OldOnGetApplicationName: TGetAppNameEvent;
|
||||
OldOnGetVendorName: TGetVendorNameEvent;
|
||||
@ -92,6 +95,8 @@ begin
|
||||
OnGetVendorName := OldOnGetVendorName;
|
||||
Result := GetAppConfigDirUtf8(False);
|
||||
end;
|
||||
if not ForceDirectoriesUTF8(Result) then
|
||||
Debugln('GetAndCreateConfigPath: unable to create "',Result,'"');
|
||||
end;
|
||||
|
||||
{$endif}
|
||||
@ -114,6 +119,7 @@ const
|
||||
pLastSelected = 'LastSelected/';
|
||||
pTestTypes = 'TestTypes/';
|
||||
pTestOptions = 'TestOptions/';
|
||||
pWindowsGeometry = 'General/WindowsGeometry/';
|
||||
pMasterPoFiles = 'MasterPoFiles/';
|
||||
pChildrenPoFiles = 'ChildrenPoFiles/';
|
||||
|
||||
@ -219,6 +225,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPoCheckerSettings.SaveWindowsGeometry;
|
||||
begin
|
||||
FConfig.SetDeleteValue(pWindowsGeometry+'MainForm/Value',FMainFormGeometry,Rect(-1,-1,-1,-1));
|
||||
end;
|
||||
|
||||
procedure TPoCheckerSettings.SaveMasterPoList;
|
||||
begin
|
||||
FConfig.DeletePath(pMasterPoFiles);
|
||||
@ -234,8 +245,9 @@ begin
|
||||
try
|
||||
FTestTypes := [];
|
||||
FTestOptions := [];
|
||||
FMainFormGeometry := Rect(-1,-1,-1,-1);
|
||||
{$ifdef POCHECKERSTANDALONE}
|
||||
FFilename := GetConfigPath;
|
||||
FFilename := GetAndCreateConfigPath;
|
||||
if (FFilename <> '') then FFilename := AppendPathDelim(FFilename);
|
||||
FFilename := FFilename + 'pochecker.xml';
|
||||
debugln('TPoCheckerSettings.Create: Filename = ');
|
||||
@ -291,6 +303,7 @@ begin
|
||||
SaveLastSelectedFile;
|
||||
SaveTestTypes;
|
||||
SaveTestOptions;
|
||||
SaveWindowsGeometry;
|
||||
SaveMasterPoList;
|
||||
SaveChildrenPoList;
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user