Skip to content

Commit

Permalink
Remove remainders of DPI related code, and move TExtForm.AddSizeGrip …
Browse files Browse the repository at this point in the history
…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 88a9e53
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 40 deletions.
2 changes: 1 addition & 1 deletion source/bineditor.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ procedure TfrmBinEditor.SetFont(font: TFont);
procedure TfrmBinEditor.FormCreate(Sender: TObject); procedure TfrmBinEditor.FormCreate(Sender: TObject);
begin begin
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;
end; end;




Expand Down
2 changes: 1 addition & 1 deletion source/change_password.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ implementation
procedure TfrmPasswordChange.FormCreate(Sender: TObject); procedure TfrmPasswordChange.FormCreate(Sender: TObject);
begin begin
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;
end; end;




Expand Down
2 changes: 1 addition & 1 deletion source/column_selection.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ implementation
procedure TColumnSelectionForm.FormCreate(Sender: TObject); procedure TColumnSelectionForm.FormCreate(Sender: TObject);
begin begin
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;
Width := AppSettings.ReadInt(asColumnSelectorWidth); Width := AppSettings.ReadInt(asColumnSelectorWidth);
Height := AppSettings.ReadInt(asColumnSelectorHeight); Height := AppSettings.ReadInt(asColumnSelectorHeight);
FCheckedColumns := TStringList.Create; FCheckedColumns := TStringList.Create;
Expand Down
2 changes: 1 addition & 1 deletion source/connections.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ procedure Tconnform.FormCreate(Sender: TObject);
begin begin
// Fix GUI stuff // Fix GUI stuff
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;
FixDropDownButtons(Self); FixDropDownButtons(Self);
lblDownloadPlink.Font.Style := [fsUnderline]; lblDownloadPlink.Font.Style := [fsUnderline];
lblDownloadPlink.Font.Color := clBlue; lblDownloadPlink.Font.Color := clBlue;
Expand Down
2 changes: 1 addition & 1 deletion source/copytable.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ implementation
procedure TCopyTableForm.FormCreate(Sender: TObject); procedure TCopyTableForm.FormCreate(Sender: TObject);
begin begin
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;
FixDropDownButtons(Self); FixDropDownButtons(Self);
Width := AppSettings.ReadInt(asCopyTableWindowWidth); Width := AppSettings.ReadInt(asCopyTableWindowWidth);
Height := AppSettings.ReadInt(asCopyTableWindowHeight); Height := AppSettings.ReadInt(asCopyTableWindowHeight);
Expand Down
2 changes: 1 addition & 1 deletion source/editvar.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ implementation
procedure TfrmEditVariable.FormCreate(Sender: TObject); procedure TfrmEditVariable.FormCreate(Sender: TObject);
begin begin
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;
Width := AppSettings.ReadInt(asEditVarWindowWidth); Width := AppSettings.ReadInt(asEditVarWindowWidth);
Height := AppSettings.ReadInt(asEditVarWindowHeight); Height := AppSettings.ReadInt(asEditVarWindowHeight);
end; end;
Expand Down
2 changes: 1 addition & 1 deletion source/exportgrid.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ procedure TfrmExportGrid.FormCreate(Sender: TObject);
FormatDesc: String; FormatDesc: String;
begin begin
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;
Width := AppSettings.ReadInt(asGridExportWindowWidth); Width := AppSettings.ReadInt(asGridExportWindowWidth);
Height := AppSettings.ReadInt(asGridExportWindowHeight); Height := AppSettings.ReadInt(asGridExportWindowHeight);
editFilename.Text := AppSettings.ReadString(asGridExportFilename); editFilename.Text := AppSettings.ReadString(asGridExportFilename);
Expand Down
40 changes: 17 additions & 23 deletions source/extra_controls.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ interface


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


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


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




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




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




Expand Down
2 changes: 1 addition & 1 deletion source/insertfiles.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ implementation
procedure TfrmInsertFiles.FormCreate(Sender: TObject); procedure TfrmInsertFiles.FormCreate(Sender: TObject);
begin begin
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;
ListFiles.Images := GetSystemImageList; ListFiles.Images := GetSystemImageList;
DragAcceptFiles(Handle, True); DragAcceptFiles(Handle, True);
MainForm.RestoreListSetup(ListColumns); MainForm.RestoreListSetup(ListColumns);
Expand Down
2 changes: 1 addition & 1 deletion source/loaddata.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ implementation
procedure Tloaddataform.FormCreate(Sender: TObject); procedure Tloaddataform.FormCreate(Sender: TObject);
begin begin
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;
// Restore settings // Restore settings
Width := AppSettings.ReadInt(asCSVImportWindowWidth); Width := AppSettings.ReadInt(asCSVImportWindowWidth);
Height := AppSettings.ReadInt(asCSVImportWindowHeight); Height := AppSettings.ReadInt(asCSVImportWindowHeight);
Expand Down
2 changes: 1 addition & 1 deletion source/options.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ procedure Toptionsform.FormCreate(Sender: TObject);
IconPack: String; IconPack: String;
begin begin
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;


Width := AppSettings.ReadInt(asPreferencesWindowWidth); Width := AppSettings.ReadInt(asPreferencesWindowWidth);
Height := AppSettings.ReadInt(asPreferencesWindowHeight); Height := AppSettings.ReadInt(asPreferencesWindowHeight);
Expand Down
2 changes: 1 addition & 1 deletion source/searchreplace.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ implementation
procedure TfrmSearchReplace.FormCreate(Sender: TObject); procedure TfrmSearchReplace.FormCreate(Sender: TObject);
begin begin
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;
comboSearch.Items.Text := AppSettings.ReadString(asFindDialogSearchHistory); comboSearch.Items.Text := AppSettings.ReadString(asFindDialogSearchHistory);
comboReplace.Items.Text := AppSettings.ReadString(asFindDialogReplaceHistory); comboReplace.Items.Text := AppSettings.ReadString(asFindDialogReplaceHistory);
comboSearch.Text := ''; comboSearch.Text := '';
Expand Down
2 changes: 1 addition & 1 deletion source/selectdbobject.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function SelectDBObjects: TDBObjectList;
procedure TfrmSelectDBObject.FormCreate(Sender: TObject); procedure TfrmSelectDBObject.FormCreate(Sender: TObject);
begin begin
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;
Width := AppSettings.ReadInt(asSelectDBOWindowWidth); Width := AppSettings.ReadInt(asSelectDBOWindowWidth);
Height := AppSettings.ReadInt(asSelectDBOWindowHeight); Height := AppSettings.ReadInt(asSelectDBOWindowHeight);
TreeDBO.TreeOptions := MainForm.DBtree.TreeOptions; TreeDBO.TreeOptions := MainForm.DBtree.TreeOptions;
Expand Down
2 changes: 1 addition & 1 deletion source/sqlhelp.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ procedure TfrmSQLhelp.FormCreate(Sender: TObject);
Caption := DEFAULT_WINDOW_CAPTION; Caption := DEFAULT_WINDOW_CAPTION;
FixVT(treeTopics); FixVT(treeTopics);
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;


treeTopics.Clear; treeTopics.Clear;
FreeAndNil(FRootTopics); FreeAndNil(FRootTopics);
Expand Down
2 changes: 1 addition & 1 deletion source/syncdb.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ procedure TfrmSyncDB.FormCreate(Sender: TObject);
begin begin
Caption := MainForm.actSynchronizeDatabase.Caption; Caption := MainForm.actSynchronizeDatabase.Caption;
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;
FixVT(treeSource); FixVT(treeSource);
FixVT(treeDifferences); FixVT(treeDifferences);


Expand Down
2 changes: 1 addition & 1 deletion source/tabletools.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ procedure TfrmTableTools.FormCreate(Sender: TObject);
Obj: TDBObject; Obj: TDBObject;
begin begin
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip; HasSizeGrip := True;
FixDropDownButtons(Self); FixDropDownButtons(Self);
OUTPUT_FILE := _('Single .sql file'); OUTPUT_FILE := _('Single .sql file');
OUTPUT_FILE_COMPRESSED := _('ZIP compressed .sql file'); OUTPUT_FILE_COMPRESSED := _('ZIP compressed .sql file');
Expand Down
2 changes: 1 addition & 1 deletion source/texteditor.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ procedure TfrmTextEditor.SetFont(font: TFont);


procedure TfrmTextEditor.FormCreate(Sender: TObject); procedure TfrmTextEditor.FormCreate(Sender: TObject);
begin begin
AddSizeGrip; HasSizeGrip := True;
FmemoText := TLineNormalizingMemo.Create(Self); FmemoText := TLineNormalizingMemo.Create(Self);
FmemoText.Parent := Self; FmemoText.Parent := Self;
FmemoText.Align := alClient; FmemoText.Align := alClient;
Expand Down
2 changes: 1 addition & 1 deletion source/usermanager.pas
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ function ComparePrivs(List: TStringList; Index1, Index2: Integer): Integer;
procedure TUserManagerForm.FormCreate(Sender: TObject); procedure TUserManagerForm.FormCreate(Sender: TObject);
begin begin
// Restore GUI setup // Restore GUI setup
HasSizeGrip := True;
lblWarning.Font.Color := clRed; lblWarning.Font.Color := clRed;
Width := AppSettings.ReadInt(asUsermanagerWindowWidth); Width := AppSettings.ReadInt(asUsermanagerWindowWidth);
Height := AppSettings.ReadInt(asUsermanagerWindowHeight); Height := AppSettings.ReadInt(asUsermanagerWindowHeight);
Expand All @@ -215,7 +216,6 @@ procedure TUserManagerForm.FormCreate(Sender: TObject);
FixVT(treePrivs); FixVT(treePrivs);
Mainform.RestoreListSetup(listUsers); Mainform.RestoreListSetup(listUsers);
TranslateComponent(Self); TranslateComponent(Self);
AddSizeGrip;
PrivsRead := Explode(',', 'SELECT,SHOW VIEW,SHOW DATABASES,PROCESS,EXECUTE'); 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'); 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'); PrivsAdmin := Explode(',', 'RELOAD,SHUTDOWN,REPLICATION CLIENT,REPLICATION SLAVE,SUPER,LOCK TABLES,GRANT,FILE,CREATE USER');
Expand Down

0 comments on commit 88a9e53

Please sign in to comment.