Skip to content
Permalink
Browse files

High DPI: fix growing window dimensions on each opening. Related to #378

  • Loading branch information...
ansgarbecker committed Jul 7, 2019
1 parent 5353368 commit 4f9613b05c63b9048d0d90908826af6db478c31a
@@ -95,8 +95,8 @@ procedure TfrmBinEditor.FormCreate(Sender: TObject);

procedure TfrmBinEditor.FormDestroy(Sender: TObject);
begin
AppSettings.WriteInt(asMemoEditorWidth, Width);
AppSettings.WriteInt(asMemoEditorHeight, Height);
AppSettings.WriteInt(asMemoEditorWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asMemoEditorHeight, Round(Height / DpiScaleFactor(Self)));
AppSettings.WriteBool(asMemoEditorWrap, btnWrap.Down);
end;

@@ -54,8 +54,8 @@ procedure TColumnSelectionForm.FormCreate(Sender: TObject);

procedure TColumnSelectionForm.FormDestroy(Sender: TObject);
begin
AppSettings.WriteInt(asColumnSelectorWidth, Width );
AppSettings.WriteInt(asColumnSelectorHeight, Height );
AppSettings.WriteInt(asColumnSelectorWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asColumnSelectorHeight, Round(Height / DpiScaleFactor(Self)));
FCheckedColumns.Free;
end;

@@ -326,9 +326,9 @@ procedure Tconnform.RefreshSessions(ParentNode: PVirtualNode);
procedure Tconnform.FormDestroy(Sender: TObject);
begin
// Save GUI stuff
AppSettings.WriteInt(asSessionManagerListWidth, ListSessions.Width);
AppSettings.WriteInt(asSessionManagerWindowWidth, Width);
AppSettings.WriteInt(asSessionManagerWindowHeight, Height);
AppSettings.WriteInt(asSessionManagerListWidth, Round(ListSessions.Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asSessionManagerWindowWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asSessionManagerWindowHeight, Round(Height / DpiScaleFactor(Self)));
AppSettings.WriteInt(asSessionManagerWindowLeft, Left);
AppSettings.WriteInt(asSessionManagerWindowTop, Top);
MainForm.SaveListSetup(ListSessions);
@@ -82,8 +82,8 @@ procedure TCopyTableForm.FormCreate(Sender: TObject);
procedure TCopyTableForm.FormDestroy(Sender: TObject);
begin
// Save GUI stuff
AppSettings.WriteInt(asCopyTableWindowWidth, Width);
AppSettings.WriteInt(asCopyTableWindowHeight, Height);
AppSettings.WriteInt(asCopyTableWindowWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asCopyTableWindowHeight, Round(Height / DpiScaleFactor(Self)));
end;


@@ -63,8 +63,8 @@ procedure TfrmEditVariable.FormCreate(Sender: TObject);

procedure TfrmEditVariable.FormDestroy(Sender: TObject);
begin
AppSettings.WriteInt(asEditVarWindowWidth, Width);
AppSettings.WriteInt(asEditVarWindowHeight, Height);
AppSettings.WriteInt(asEditVarWindowWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asEditVarWindowHeight, Round(Height / DpiScaleFactor(Self)));
end;


@@ -148,8 +148,8 @@ procedure TfrmExportGrid.FormDestroy(Sender: TObject);
begin
// Store settings
if not FHiddenCopyMode then begin
AppSettings.WriteInt(asGridExportWindowWidth, Width);
AppSettings.WriteInt(asGridExportWindowHeight, Height);
AppSettings.WriteInt(asGridExportWindowWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asGridExportWindowHeight, Round(Height / DpiScaleFactor(Self)));
if ModalResult = mrOK then begin
AppSettings.WriteBool(asGridExportOutputCopy, radioOutputCopyToClipboard.Checked);
AppSettings.WriteBool(asGridExportOutputFile, radioOutputFile.Checked);
@@ -128,8 +128,8 @@ procedure TfrmInsertFiles.FormCreate(Sender: TObject);

procedure TfrmInsertFiles.FormDestroy(Sender: TObject);
begin
AppSettings.WriteInt(asFileImportWindowWidth, Width);
AppSettings.WriteInt(asFileImportWindowHeight, Height);
AppSettings.WriteInt(asFileImportWindowWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asFileImportWindowHeight, Round(Height / DpiScaleFactor(Self)));
MainForm.SaveListSetup(ListColumns);
MainForm.SaveListSetup(listFiles);
end;
@@ -116,8 +116,8 @@ procedure Tloaddataform.FormCreate(Sender: TObject);
procedure Tloaddataform.FormDestroy(Sender: TObject);
begin
// Save settings
AppSettings.WriteInt(asCSVImportWindowWidth, Width);
AppSettings.WriteInt(asCSVImportWindowHeight, Height);
AppSettings.WriteInt(asCSVImportWindowWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asCSVImportWindowHeight, Round(Height / DpiScaleFactor(Self)));
AppSettings.WriteString(asCSVImportFilename, editFilename.Text);
AppSettings.WriteString(asCSVImportSeparator, editFieldTerminator.Text);
AppSettings.WriteString(asCSVImportEncloser, editFieldEncloser.Text);
@@ -606,8 +606,8 @@ procedure Toptionsform.FormCreate(Sender: TObject);

procedure Toptionsform.FormDestroy(Sender: TObject);
begin
AppSettings.WriteInt(asPreferencesWindowWidth, Width);
AppSettings.WriteInt(asPreferencesWindowHeight, Height);
AppSettings.WriteInt(asPreferencesWindowWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asPreferencesWindowHeight, Round(Height / DpiScaleFactor(Self)));
end;

procedure Toptionsform.FormShow(Sender: TObject);
@@ -73,8 +73,8 @@ procedure TfrmSelectDBObject.FormCreate(Sender: TObject);

procedure TfrmSelectDBObject.FormDestroy(Sender: TObject);
begin
AppSettings.WriteInt(asSelectDBOWindowWidth, Width);
AppSettings.WriteInt(asSelectDBOWindowHeight, Height);
AppSettings.WriteInt(asSelectDBOWindowWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asSelectDBOWindowHeight, Round(Height / DpiScaleFactor(Self)));
end;


@@ -264,10 +264,10 @@ procedure TfrmSQLhelp.FormDestroy(Sender: TObject);
begin
AppSettings.WriteInt(asSQLHelpWindowLeft, Left );
AppSettings.WriteInt(asSQLHelpWindowTop, Top );
AppSettings.WriteInt(asSQLHelpWindowWidth, Width );
AppSettings.WriteInt(asSQLHelpWindowHeight, Height );
AppSettings.WriteInt(asSQLHelpPnlLeftWidth, pnlLeft.Width );
AppSettings.WriteInt(asSQLHelpPnlRightTopHeight, memoDescription.Height );
AppSettings.WriteInt(asSQLHelpWindowWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asSQLHelpWindowHeight, Round(Height / DpiScaleFactor(Self)));
AppSettings.WriteInt(asSQLHelpPnlLeftWidth, Round(pnlLeft.Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asSQLHelpPnlRightTopHeight, Round(memoDescription.Height / DpiScaleFactor(Self)));
SqlHelpDialog := nil;
end;

@@ -303,9 +303,9 @@ procedure TfrmTableTools.FormCreate(Sender: TObject);
procedure TfrmTableTools.FormDestroy(Sender: TObject);
begin
// Save GUI setup
AppSettings.WriteInt(asTableToolsWindowWidth, Width );
AppSettings.WriteInt(asTableToolsWindowHeight, Height );
AppSettings.WriteInt(asTableToolsTreeWidth, TreeObjects.Width);
AppSettings.WriteInt(asTableToolsWindowWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asTableToolsWindowHeight, Round(Height / DpiScaleFactor(Self)));
AppSettings.WriteInt(asTableToolsTreeWidth, Round(TreeObjects.Width / DpiScaleFactor(Self)));
end;


@@ -224,8 +224,8 @@ procedure TfrmTextEditor.FormCreate(Sender: TObject);
procedure TfrmTextEditor.FormDestroy(Sender: TObject);
begin
if WindowState <> wsMaximized then begin
AppSettings.WriteInt(asMemoEditorWidth, Width);
AppSettings.WriteInt(asMemoEditorHeight, Height);
AppSettings.WriteInt(asMemoEditorWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asMemoEditorHeight, Round(Height / DpiScaleFactor(Self)));
end;
AppSettings.WriteBool(asMemoEditorMaximized, WindowState=wsMaximized);
AppSettings.WriteBool(asMemoEditorWrap, btnWrap.Down);
@@ -224,9 +224,9 @@ procedure TUserManagerForm.FormCreate(Sender: TObject);
procedure TUserManagerForm.FormDestroy(Sender: TObject);
begin
// FormDestroy: Save GUI setup
AppSettings.WriteInt(asUsermanagerWindowWidth, Width);
AppSettings.WriteInt(asUsermanagerWindowHeight, Height);
AppSettings.WriteInt(asUsermanagerListWidth, pnlLeft.Width);
AppSettings.WriteInt(asUsermanagerWindowWidth, Round(Width / DpiScaleFactor(Self)));
AppSettings.WriteInt(asUsermanagerWindowHeight, Round(Height / DpiScaleFactor(Self)));
AppSettings.WriteInt(asUsermanagerListWidth, Round(pnlLeft.Width / DpiScaleFactor(Self)));
Mainform.SaveListSetup(listUsers);
end;

0 comments on commit 4f9613b

Please sign in to comment.
You can’t perform that action at this time.