mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-11-04 10:39:53 +01:00 
			
		
		
		
	PoChecker:
- save and restore WindowaSate of individual forms. - better anchoring of controls on PoCheckerMainForm - removed some debugln statements git-svn-id: trunk@46435 -
This commit is contained in:
		
							parent
							
								
									3ebbc96fd0
								
							
						
					
					
						commit
						192f1c46b5
					
				@ -95,6 +95,7 @@ begin
 | 
			
		||||
  FOldHintHidePause := Application.HintHidePause;
 | 
			
		||||
  Application.HintHidePause := 5000;
 | 
			
		||||
  LoadConfig;
 | 
			
		||||
  WindowState := Settings.GraphFormWindowState;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
procedure TGraphStatForm.ListViewMouseMove(Sender: TObject; Shift: TShiftState;
 | 
			
		||||
@ -164,7 +165,11 @@ procedure TGraphStatForm.SaveConfig;
 | 
			
		||||
begin
 | 
			
		||||
  //debugln('TGraphStatForm.SaveConfig: BoundsRect = ',dbgs(BoundsRect));
 | 
			
		||||
  if not Assigned(FSettings) then Exit;
 | 
			
		||||
  Settings.GraphFormGeometry := BoundsRect;
 | 
			
		||||
  Settings.GraphFormWindowState := WindowState;
 | 
			
		||||
  if (WindowState = wsNormal) then
 | 
			
		||||
    Settings.GraphFormGeometry := BoundsRect
 | 
			
		||||
  else
 | 
			
		||||
    Settings.GraphFormGeometry := Rect(RestoredLeft, RestoredTop, RestoredLeft + RestoredWidth, RestoredTop + RestoredHeight);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
procedure TGraphStatForm.FormCreate(Sender: TObject);
 | 
			
		||||
 | 
			
		||||
@ -11,6 +11,7 @@ object PoCheckerForm: TPoCheckerForm
 | 
			
		||||
  Constraints.MinWidth = 600
 | 
			
		||||
  OnCreate = FormCreate
 | 
			
		||||
  OnDestroy = FormDestroy
 | 
			
		||||
  OnShow = FormShow
 | 
			
		||||
  ShowInTaskBar = stAlways
 | 
			
		||||
  LCLVersion = '1.3'
 | 
			
		||||
  Visible = True
 | 
			
		||||
@ -18,10 +19,10 @@ object PoCheckerForm: TPoCheckerForm
 | 
			
		||||
    AnchorSideLeft.Control = SelectTestLabel
 | 
			
		||||
    AnchorSideTop.Control = SelectTestLabel
 | 
			
		||||
    AnchorSideTop.Side = asrBottom
 | 
			
		||||
    Left = 212
 | 
			
		||||
    Left = 201
 | 
			
		||||
    Height = 118
 | 
			
		||||
    Top = 29
 | 
			
		||||
    Width = 425
 | 
			
		||||
    Width = 436
 | 
			
		||||
    Anchors = [akTop, akLeft, akRight]
 | 
			
		||||
    BorderSpacing.Top = 6
 | 
			
		||||
    Enabled = False
 | 
			
		||||
@ -42,7 +43,7 @@ object PoCheckerForm: TPoCheckerForm
 | 
			
		||||
  object SelectTestLabel: TLabel
 | 
			
		||||
    AnchorSideLeft.Control = OpenBtn
 | 
			
		||||
    AnchorSideLeft.Side = asrBottom
 | 
			
		||||
    Left = 212
 | 
			
		||||
    Left = 201
 | 
			
		||||
    Height = 15
 | 
			
		||||
    Top = 8
 | 
			
		||||
    Width = 93
 | 
			
		||||
@ -53,16 +54,15 @@ object PoCheckerForm: TPoCheckerForm
 | 
			
		||||
    ParentFont = False
 | 
			
		||||
  end
 | 
			
		||||
  object OpenBtn: TBitBtn
 | 
			
		||||
    AnchorSideLeft.Control = RunBtn
 | 
			
		||||
    AnchorSideLeft.Control = MasterPoListBox
 | 
			
		||||
    AnchorSideTop.Control = TestListBox
 | 
			
		||||
    AnchorSideRight.Control = RunBtn
 | 
			
		||||
    AnchorSideRight.Side = asrBottom
 | 
			
		||||
    AnchorSideBottom.Control = ScanDirBtn
 | 
			
		||||
    Left = 19
 | 
			
		||||
    Left = 8
 | 
			
		||||
    Height = 50
 | 
			
		||||
    Top = 29
 | 
			
		||||
    Width = 184
 | 
			
		||||
    Anchors = [akTop]
 | 
			
		||||
    BorderSpacing.Bottom = 10
 | 
			
		||||
    Caption = '&Open a po-file'
 | 
			
		||||
    Glyph.Data = {
 | 
			
		||||
@ -105,14 +105,14 @@ object PoCheckerForm: TPoCheckerForm
 | 
			
		||||
    TabOrder = 1
 | 
			
		||||
  end
 | 
			
		||||
  object RunBtn: TBitBtn
 | 
			
		||||
    AnchorSideLeft.Control = OpenBtn
 | 
			
		||||
    AnchorSideTop.Control = ScanDirBtn
 | 
			
		||||
    AnchorSideTop.Side = asrBottom
 | 
			
		||||
    AnchorSideRight.Side = asrBottom
 | 
			
		||||
    Left = 19
 | 
			
		||||
    Left = 8
 | 
			
		||||
    Height = 50
 | 
			
		||||
    Top = 149
 | 
			
		||||
    Width = 184
 | 
			
		||||
    Anchors = [akTop]
 | 
			
		||||
    BorderSpacing.Top = 5
 | 
			
		||||
    Caption = '&Run Selected Tests'
 | 
			
		||||
    Enabled = False
 | 
			
		||||
@ -137,7 +137,7 @@ object PoCheckerForm: TPoCheckerForm
 | 
			
		||||
    AnchorSideLeft.Control = TestListBox
 | 
			
		||||
    AnchorSideTop.Control = SelectBasicBtn
 | 
			
		||||
    AnchorSideTop.Side = asrBottom
 | 
			
		||||
    Left = 212
 | 
			
		||||
    Left = 201
 | 
			
		||||
    Height = 19
 | 
			
		||||
    Top = 184
 | 
			
		||||
    Width = 156
 | 
			
		||||
@ -149,7 +149,7 @@ object PoCheckerForm: TPoCheckerForm
 | 
			
		||||
    AnchorSideLeft.Control = TestListBox
 | 
			
		||||
    AnchorSideTop.Control = TestListBox
 | 
			
		||||
    AnchorSideTop.Side = asrBottom
 | 
			
		||||
    Left = 212
 | 
			
		||||
    Left = 201
 | 
			
		||||
    Height = 25
 | 
			
		||||
    Top = 153
 | 
			
		||||
    Width = 115
 | 
			
		||||
@ -163,7 +163,7 @@ object PoCheckerForm: TPoCheckerForm
 | 
			
		||||
    AnchorSideLeft.Control = SelectBasicBtn
 | 
			
		||||
    AnchorSideLeft.Side = asrBottom
 | 
			
		||||
    AnchorSideTop.Control = SelectBasicBtn
 | 
			
		||||
    Left = 331
 | 
			
		||||
    Left = 320
 | 
			
		||||
    Height = 25
 | 
			
		||||
    Top = 153
 | 
			
		||||
    Width = 115
 | 
			
		||||
@ -177,7 +177,7 @@ object PoCheckerForm: TPoCheckerForm
 | 
			
		||||
    AnchorSideLeft.Control = SelectAllBtn
 | 
			
		||||
    AnchorSideLeft.Side = asrBottom
 | 
			
		||||
    AnchorSideTop.Control = SelectAllBtn
 | 
			
		||||
    Left = 450
 | 
			
		||||
    Left = 439
 | 
			
		||||
    Height = 25
 | 
			
		||||
    Top = 153
 | 
			
		||||
    Width = 115
 | 
			
		||||
@ -191,7 +191,7 @@ object PoCheckerForm: TPoCheckerForm
 | 
			
		||||
    AnchorSideLeft.Control = TestListBox
 | 
			
		||||
    AnchorSideTop.Control = FindAllPOsCheckBox
 | 
			
		||||
    AnchorSideTop.Side = asrBottom
 | 
			
		||||
    Left = 212
 | 
			
		||||
    Left = 201
 | 
			
		||||
    Height = 19
 | 
			
		||||
    Top = 209
 | 
			
		||||
    Width = 152
 | 
			
		||||
@ -213,11 +213,10 @@ object PoCheckerForm: TPoCheckerForm
 | 
			
		||||
    AnchorSideRight.Control = RunBtn
 | 
			
		||||
    AnchorSideRight.Side = asrBottom
 | 
			
		||||
    AnchorSideBottom.Control = RunBtn
 | 
			
		||||
    Left = 19
 | 
			
		||||
    Left = 8
 | 
			
		||||
    Height = 50
 | 
			
		||||
    Top = 89
 | 
			
		||||
    Width = 184
 | 
			
		||||
    Anchors = [akTop]
 | 
			
		||||
    BorderSpacing.Top = 5
 | 
			
		||||
    BorderSpacing.Bottom = 10
 | 
			
		||||
    Caption = 'Scan a folder'
 | 
			
		||||
 | 
			
		||||
@ -53,6 +53,7 @@ type
 | 
			
		||||
    procedure ChildPoListBoxSelectionChange(Sender: TObject; User: boolean);
 | 
			
		||||
    procedure ClearChildBtnClick(Sender: TObject);
 | 
			
		||||
    procedure ClearMasterBtnClick(Sender: TObject);
 | 
			
		||||
    procedure FormShow(Sender: TObject);
 | 
			
		||||
    procedure LangFilterChange(Sender: TObject);
 | 
			
		||||
    procedure MasterPoListBoxDrawItem(Control: TWinControl; Index: Integer;
 | 
			
		||||
      ARect: TRect; State: TOwnerDrawState);
 | 
			
		||||
@ -316,6 +317,11 @@ begin
 | 
			
		||||
    SetSelectedPoName('');
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
procedure TPoCheckerForm.FormShow(Sender: TObject);
 | 
			
		||||
begin
 | 
			
		||||
  WindowState := FPoCheckerSettings.MainFormWindowState;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
procedure TPoCheckerForm.MasterPoListBoxDrawItem(Control: TWinControl;
 | 
			
		||||
  Index: Integer; ARect: TRect; State: TOwnerDrawState);
 | 
			
		||||
var
 | 
			
		||||
@ -749,11 +755,6 @@ begin
 | 
			
		||||
    ARect := FitToRect(ARect, Screen.WorkAreaRect);
 | 
			
		||||
    BoundsRect := ARect;
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
  //DebugLn('  TestOptions after loading = ');
 | 
			
		||||
  //DebugLn('  ',DbgS(FPoCheckerSettings.TestOptions));
 | 
			
		||||
  //debugln('  TPoCheckerForm.FormCreate: TestTypes   after loading = ');
 | 
			
		||||
  //DebugLn('  ',DbgS(FPoCheckerSettings.TestTypes));
 | 
			
		||||
  SetTestTypeCheckBoxes(FPoCheckerSettings.TestTypes);
 | 
			
		||||
  SetTestOptionCheckBoxes(FPoCheckerSettings.TestOptions);
 | 
			
		||||
  SelectDirectoryDialog.Filename := FPoCheckerSettings.SelectDirectoryFilename;
 | 
			
		||||
@ -780,7 +781,11 @@ begin
 | 
			
		||||
  FPoCheckerSettings.OpenDialogFilename := OpenDialog.FileName;
 | 
			
		||||
  FPoCheckerSettings.TestTypes := GetTestTypesFromListBox;
 | 
			
		||||
  FPoCheckerSettings.TestOptions := GetTestOptions;
 | 
			
		||||
  FPoCheckerSettings.MainFormGeometry := BoundsRect;
 | 
			
		||||
  FPoCheckerSettings.MainFormWindowState := WindowState;
 | 
			
		||||
  if (WindowState = wsNormal) then
 | 
			
		||||
    FPoCheckerSettings.MainFormGeometry := BoundsRect
 | 
			
		||||
  else
 | 
			
		||||
    FPoCheckerSettings.MainFormGeometry := Rect(RestoredLeft, RestoredTop, RestoredLeft + RestoredWidth, RestoredTop + RestoredHeight);
 | 
			
		||||
  FPoCheckerSettings.MasterPoList := MasterPoListBox.Items;
 | 
			
		||||
  FPoCheckerSettings.ChildPoList := FChildPoList;
 | 
			
		||||
  FPoCheckerSettings.SaveConfig;
 | 
			
		||||
 | 
			
		||||
@ -5,9 +5,9 @@ unit PoCheckerSettings;
 | 
			
		||||
interface
 | 
			
		||||
 | 
			
		||||
uses
 | 
			
		||||
  Classes, SysUtils, LazConfigStorage,
 | 
			
		||||
  Classes, SysUtils, LazConfigStorage, Forms,
 | 
			
		||||
  {$ifdef POCHECKERSTANDALONE}
 | 
			
		||||
  PoCheckerXMLConfig, Forms,
 | 
			
		||||
  PoCheckerXMLConfig,
 | 
			
		||||
  {$else}
 | 
			
		||||
  BaseIDEIntf,
 | 
			
		||||
  {$endif}
 | 
			
		||||
@ -22,7 +22,10 @@ type
 | 
			
		||||
    FConfig: TConfigStorage;
 | 
			
		||||
    FExternalEditorName: String;
 | 
			
		||||
    FFilename: String;
 | 
			
		||||
    FGraphFormWindowState: TWindowState;
 | 
			
		||||
    FMainFormWindowState: TWindowState;
 | 
			
		||||
    FOpenDialogFilename: String;
 | 
			
		||||
    FResultsFormWindowState: TWindowState;
 | 
			
		||||
    FSelectDirectoryFilename: String;
 | 
			
		||||
    FTestTypes: TPoTestTypes;
 | 
			
		||||
    FTestOptions: TPoTestOptions;
 | 
			
		||||
@ -77,6 +80,9 @@ type
 | 
			
		||||
    property MainFormGeometry: TRect read FMainFormGeometry write FMainFormGeometry;
 | 
			
		||||
    property ResultsFormGeometry: TRect read FResultsFormGeometry write FResultsFormGeometry;
 | 
			
		||||
    property GraphFormGeometry: TRect read FGraphFormGeometry write FGraphFormGeometry;
 | 
			
		||||
    property MainFormWindowState: TWindowState read FMainFormWindowState write FMainFormWindowState;
 | 
			
		||||
    property ResultsFormWindowState: TWindowState read FResultsFormWindowState write FResultsFormWindowState;
 | 
			
		||||
    property GraphFormWindowState: TWindowState read FGraphFormWindowState write FGraphFormWindowState;
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
function DbgS(PoTestTypes: TPoTestTypes): String; overload;
 | 
			
		||||
@ -273,10 +279,20 @@ begin
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
procedure TPoCheckerSettings.LoadWindowsGeometry;
 | 
			
		||||
function IntToWindowState(WSInt: Integer): TWindowState;
 | 
			
		||||
begin
 | 
			
		||||
  if (WSInt in [Ord(Low(TWindowState))..Ord(High(TWindowState))]) then
 | 
			
		||||
    Result := TWindowState(WSInt)
 | 
			
		||||
  else
 | 
			
		||||
    Result := wsNormal;
 | 
			
		||||
end;
 | 
			
		||||
begin
 | 
			
		||||
  FConfig.GetValue(pWindowsGeometry+'MainForm/Value',FMainFormGeometry,DefaultRect);
 | 
			
		||||
  FMainFormWindowState := IntToWindowState(FConfig.GetValue(pWindowsGeometry+'MainForm/WindowState/Value', Ord(wsNormal)));
 | 
			
		||||
  FConfig.GetValue(pWindowsGeometry+'ResultsForm/Value',FResultsFormGeometry,DefaultRect);
 | 
			
		||||
  FResultsFormWindowState := IntToWindowState(FConfig.GetValue(pWindowsGeometry+'MainForm/WindowState/Value', Ord(wsNormal)));
 | 
			
		||||
  FConfig.GetValue(pWindowsGeometry+'GraphForm/Value',FGraphFormGeometry,DefaultRect);
 | 
			
		||||
  FGraphFormWindowState := IntToWindowState(FConfig.GetValue(pWindowsGeometry+'MainForm/WindowState/Value', Ord(wsNormal)));
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
function TPoCheckerSettings.LoadExternalEditorName: String;
 | 
			
		||||
@ -365,8 +381,11 @@ end;
 | 
			
		||||
procedure TPoCheckerSettings.SaveWindowsGeometry;
 | 
			
		||||
begin
 | 
			
		||||
  FConfig.SetDeleteValue(pWindowsGeometry+'MainForm/Value',FMainFormGeometry,DefaultRect);
 | 
			
		||||
  FConfig.SetDeleteValue(pWindowsGeometry+'MainForm/WindowState/Value',Ord(FMainFormWindowState), Ord(wsNormal));
 | 
			
		||||
  FConfig.SetDeleteValue(pWindowsGeometry+'ResultsForm/Value',FResultsFormGeometry,DefaultRect);
 | 
			
		||||
  FConfig.SetDeleteValue(pWindowsGeometry+'ResultsForm/WindowState/Value',Ord(FResultsFormWindowState), Ord(wsNormal));
 | 
			
		||||
  FConfig.SetDeleteValue(pWindowsGeometry+'GraphForm/Value',FGraphFormGeometry,DefaultRect);
 | 
			
		||||
  FConfig.SetDeleteValue(pWindowsGeometry+'GraphForm/WindowState/Value',Ord(FGraphFormWindowState), Ord(wsNormal));
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
procedure TPoCheckerSettings.SaveExternalEditorName;
 | 
			
		||||
 | 
			
		||||
@ -96,6 +96,7 @@ begin
 | 
			
		||||
  LogMemo.Lines.Assign(FLog);
 | 
			
		||||
  GraphStatBtn.Visible := (PoFamilyStats <> nil) and (PoFamilyStats.Count > 0);
 | 
			
		||||
  LoadConfig;
 | 
			
		||||
  WindowState := Settings.ResultsFormWindowState;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
procedure TResultDlgForm.GraphStatBtnClick(Sender: TObject);
 | 
			
		||||
@ -155,7 +156,11 @@ procedure TResultDlgForm.SaveConfig;
 | 
			
		||||
begin
 | 
			
		||||
  //debugln('TResultDlgForm.SaveConfig: BoundsRect = ',dbgs(BoundsRect));
 | 
			
		||||
  if not Assigned(FSettings) then Exit;
 | 
			
		||||
  Settings.ResultsFormGeometry := BoundsRect;
 | 
			
		||||
  Settings.ResultsFormWindowState := WindowState;
 | 
			
		||||
  if (WindowState = wsNormal) then
 | 
			
		||||
    Settings.ResultsFormGeometry := BoundsRect
 | 
			
		||||
  else
 | 
			
		||||
    Settings.ResultsFormGeometry := Rect(RestoredLeft, RestoredTop, RestoredLeft + RestoredWidth, RestoredTop + RestoredHeight);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
end.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user