Skip to content
Permalink
Browse files

Remove remainders of DPI related code, and move TExtForm.AddSizeGrip …

…procedure to property .HasSizeGrip. Uses TSizeGripXP instead of TSizeGripThemed, as this looks quite the same.
  • Loading branch information...
ansgarbecker committed Jul 21, 2019
1 parent cfe412e commit 88a9e53f0de4026227ed080e849ac0c3fcbde497
@@ -90,7 +90,7 @@ procedure TfrmBinEditor.SetFont(font: TFont);
procedure TfrmBinEditor.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;
end;


@@ -58,7 +58,7 @@ implementation
procedure TfrmPasswordChange.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;
end;


@@ -46,7 +46,7 @@ implementation
procedure TColumnSelectionForm.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;
Width := AppSettings.ReadInt(asColumnSelectorWidth);
Height := AppSettings.ReadInt(asColumnSelectorHeight);
FCheckedColumns := TStringList.Create;
@@ -240,7 +240,7 @@ procedure Tconnform.FormCreate(Sender: TObject);
begin
// Fix GUI stuff
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;
FixDropDownButtons(Self);
lblDownloadPlink.Font.Style := [fsUnderline];
lblDownloadPlink.Font.Color := clBlue;
@@ -68,7 +68,7 @@ implementation
procedure TCopyTableForm.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;
FixDropDownButtons(Self);
Width := AppSettings.ReadInt(asCopyTableWindowWidth);
Height := AppSettings.ReadInt(asCopyTableWindowHeight);
@@ -56,7 +56,7 @@ implementation
procedure TfrmEditVariable.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;
Width := AppSettings.ReadInt(asEditVarWindowWidth);
Height := AppSettings.ReadInt(asEditVarWindowHeight);
end;
@@ -104,7 +104,7 @@ procedure TfrmExportGrid.FormCreate(Sender: TObject);
FormatDesc: String;
begin
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;
Width := AppSettings.ReadInt(asGridExportWindowWidth);
Height := AppSettings.ReadInt(asGridExportWindowHeight);
editFilename.Text := AppSettings.ReadString(asGridExportFilename);
@@ -4,20 +4,19 @@ interface

uses
Classes, SysUtils, Forms, Windows, Messages, System.Types, StdCtrls, Clipbrd,
SizeGrip, SizeGripThemed, apphelpers, Vcl.Graphics, Vcl.Dialogs;
SizeGrip, apphelpers, Vcl.Graphics, Vcl.Dialogs;

type
// Form with a sizegrip in the lower right corner, without the need for a statusbar
TExtForm = class(TForm)
private
FFontSet: Boolean;
FPixelsPerInchOnDefaultMonitor: Integer;
FSizeGrip: TSizeGripXP;
function GetHasSizeGrip: Boolean;
procedure SetHasSizeGrip(Value: Boolean);
public
constructor Create(AOwner: TComponent); override;
procedure AddSizeGrip;
procedure InheritFont(AFont: TFont);
protected
procedure DoShow; override;
property HasSizeGrip: Boolean read GetHasSizeGrip write SetHasSizeGrip default False;
end;
// Memo replacement which accepts any line break format
TLineNormalizingMemo = class(TMemo)
@@ -34,32 +33,27 @@ implementation

constructor TExtForm.Create(AOwner: TComponent);
begin
FPixelsPerInchOnDefaultMonitor := Screen.Monitors[0].PixelsPerInch;
inherited;
FFontSet := False;
InheritFont(Font);
HasSizeGrip := False;
end;


procedure TExtForm.DoShow;
function TExtForm.GetHasSizeGrip: Boolean;
begin
// Expect the window to be on the wanted monitor now, so we can scale fonts according
// to the screen's DPI setting
if not FFontSet then begin
InheritFont(Font);
FFontSet := True;
end;
inherited;
Result := FSizeGrip <> nil;
end;


procedure TExtForm.AddSizeGrip;
var
FGripper: TSizeGripThemed;
procedure TExtForm.SetHasSizeGrip(Value: Boolean);
begin
FGripper := TSizeGripThemed.Create(Self);
FGripper.Themed := True;
FGripper.Enabled := True;
FGripper.Style := sgsWinXP;
if Value then begin
FSizeGrip := TSizeGripXP.Create(Self);
FSizeGrip.Enabled := True;
end else begin
if FSizeGrip <> nil then
FreeAndNil(FSizeGrip);
end;
end;


@@ -117,7 +117,7 @@ implementation
procedure TfrmInsertFiles.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;
ListFiles.Images := GetSystemImageList;
DragAcceptFiles(Handle, True);
MainForm.RestoreListSetup(ListColumns);
@@ -94,7 +94,7 @@ implementation
procedure Tloaddataform.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;
// Restore settings
Width := AppSettings.ReadInt(asCSVImportWindowWidth);
Height := AppSettings.ReadInt(asCSVImportWindowHeight);
@@ -484,7 +484,7 @@ procedure Toptionsform.FormCreate(Sender: TObject);
IconPack: String;
begin
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;

Width := AppSettings.ReadInt(asPreferencesWindowWidth);
Height := AppSettings.ReadInt(asPreferencesWindowHeight);
@@ -60,7 +60,7 @@ implementation
procedure TfrmSearchReplace.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;
comboSearch.Items.Text := AppSettings.ReadString(asFindDialogSearchHistory);
comboReplace.Items.Text := AppSettings.ReadString(asFindDialogReplaceHistory);
comboSearch.Text := '';
@@ -63,7 +63,7 @@ function SelectDBObjects: TDBObjectList;
procedure TfrmSelectDBObject.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;
Width := AppSettings.ReadInt(asSelectDBOWindowWidth);
Height := AppSettings.ReadInt(asSelectDBOWindowHeight);
TreeDBO.TreeOptions := MainForm.DBtree.TreeOptions;
@@ -94,7 +94,7 @@ procedure TfrmSQLhelp.FormCreate(Sender: TObject);
Caption := DEFAULT_WINDOW_CAPTION;
FixVT(treeTopics);
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;

treeTopics.Clear;
FreeAndNil(FRootTopics);
@@ -108,7 +108,7 @@ procedure TfrmSyncDB.FormCreate(Sender: TObject);
begin
Caption := MainForm.actSynchronizeDatabase.Caption;
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;
FixVT(treeSource);
FixVT(treeDifferences);

@@ -226,7 +226,7 @@ procedure TfrmTableTools.FormCreate(Sender: TObject);
Obj: TDBObject;
begin
TranslateComponent(Self);
AddSizeGrip;
HasSizeGrip := True;
FixDropDownButtons(Self);
OUTPUT_FILE := _('Single .sql file');
OUTPUT_FILE_COMPRESSED := _('ZIP compressed .sql file');
@@ -185,7 +185,7 @@ procedure TfrmTextEditor.SetFont(font: TFont);

procedure TfrmTextEditor.FormCreate(Sender: TObject);
begin
AddSizeGrip;
HasSizeGrip := True;
FmemoText := TLineNormalizingMemo.Create(Self);
FmemoText.Parent := Self;
FmemoText.Align := alClient;
@@ -207,6 +207,7 @@ function ComparePrivs(List: TStringList; Index1, Index2: Integer): Integer;
procedure TUserManagerForm.FormCreate(Sender: TObject);
begin
// Restore GUI setup
HasSizeGrip := True;
lblWarning.Font.Color := clRed;
Width := AppSettings.ReadInt(asUsermanagerWindowWidth);
Height := AppSettings.ReadInt(asUsermanagerWindowHeight);
@@ -215,7 +216,6 @@ procedure TUserManagerForm.FormCreate(Sender: TObject);
FixVT(treePrivs);
Mainform.RestoreListSetup(listUsers);
TranslateComponent(Self);
AddSizeGrip;
PrivsRead := Explode(',', 'SELECT,SHOW VIEW,SHOW DATABASES,PROCESS,EXECUTE');
PrivsWrite := Explode(',', 'ALTER,CREATE,DROP,DELETE,UPDATE,INSERT,ALTER ROUTINE,CREATE ROUTINE,CREATE TEMPORARY TABLES,CREATE VIEW,INDEX,TRIGGER,EVENT,REFERENCES,CREATE TABLESPACE');
PrivsAdmin := Explode(',', 'RELOAD,SHUTDOWN,REPLICATION CLIENT,REPLICATION SLAVE,SUPER,LOCK TABLES,GRANT,FILE,CREATE USER');

0 comments on commit 88a9e53

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