Issue #213: Assign system or custom font once, to the application, and let all forms inherit that font, so there is no need to call InheritFont() for each form.

This commit is contained in:
Ansgar Becker
2018-10-25 19:24:45 +02:00
parent 0d7e459979
commit 9cdcd63145
49 changed files with 34 additions and 189 deletions

View File

@ -73,6 +73,7 @@ begin
Application.Initialize;
Application.Title := APPNAME;
Application.UpdateFormatSettings := False;
AppHelpers.InheritFont(Application.DefaultFont);
Application.CreateForm(TMainForm, MainForm);
MainForm.AfterFormCreate;
Application.OnDeactivate := MainForm.ApplicationDeActivate;

View File

@ -6,11 +6,7 @@ object AboutBox: TAboutBox
ClientHeight = 315
ClientWidth = 481
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
FormStyle = fsStayOnTop
OldCreateOrder = True
Position = poOwnerFormCenter

View File

@ -124,7 +124,6 @@ end;
procedure TAboutBox.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
InheritFont(Font);
lblAppName.Font.Size := Round(lblAppName.Font.Size * 1.5);
lblAppName.Font.Style := [fsBold];
lblAppWebpage.Font.Color := clBlue;

View File

@ -7,11 +7,7 @@ object frmBinEditor: TfrmBinEditor
Color = clBtnFace
Constraints.MinHeight = 100
Constraints.MinWidth = 130
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poMainFormCenter
OnClose = FormClose

View File

@ -79,7 +79,6 @@ end;
procedure TfrmBinEditor.FormCreate(Sender: TObject);
begin
InheritFont(Font);
TranslateComponent(Self);
end;

View File

@ -10,11 +10,7 @@ object frmPasswordChange: TfrmPasswordChange
Constraints.MaxWidth = 600
Constraints.MinHeight = 185
Constraints.MinWidth = 400
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poMainFormCenter
OnCreate = FormCreate

View File

@ -58,7 +58,6 @@ uses main, apphelpers;
procedure TfrmPasswordChange.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
InheritFont(Font);
end;

View File

@ -8,11 +8,7 @@ object ColumnSelectionForm: TColumnSelectionForm
Color = clBtnFace
Constraints.MinHeight = 150
Constraints.MinWidth = 200
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
OnClose = FormClose
OnCreate = FormCreate

View File

@ -45,7 +45,6 @@ uses main;
procedure TColumnSelectionForm.FormCreate(Sender: TObject);
begin
InheritFont(Font);
TranslateComponent(Self);
Width := AppSettings.ReadInt(asColumnSelectorWidth);
Height := AppSettings.ReadInt(asColumnSelectorHeight);

View File

@ -8,11 +8,7 @@ object connform: Tconnform
Color = clBtnFace
Constraints.MinHeight = 400
Constraints.MinWidth = 665
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
ShowHint = True
OnClose = FormClose

View File

@ -223,7 +223,6 @@ var
begin
// Fix GUI stuff
TranslateComponent(Self);
InheritFont(Font);
FixDropDownButtons(Self);
lblDownloadPlink.Font.Style := [fsUnderline];
lblDownloadPlink.Font.Color := clBlue;

View File

@ -7,11 +7,7 @@ object CopyTableForm: TCopyTableForm
Color = clBtnFace
Constraints.MinHeight = 340
Constraints.MinWidth = 380
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poMainFormCenter
OnClose = FormClose
@ -92,12 +88,8 @@ object CopyTableForm: TCopyTableForm
Height = 88
Anchors = [akLeft, akTop, akRight, akBottom]
Header.AutoSizeIndex = 0
Header.Font.Charset = DEFAULT_CHARSET
Header.Font.Color = clWindowText
Header.Font.Height = -11
Header.Font.Name = 'Tahoma'
Header.Font.Style = []
Header.MainColumn = -1
Header.ParentFont = True
Images = MainForm.ImageListMain
TabOrder = 2
TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScroll, toAutoScrollOnExpand, toAutoTristateTracking, toAutoDeleteMovedNodes]

View File

@ -69,7 +69,6 @@ procedure TCopyTableForm.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
FixDropDownButtons(Self);
InheritFont(Font);
Width := AppSettings.ReadInt(asCopyTableWindowWidth);
Height := AppSettings.ReadInt(asCopyTableWindowHeight);
MainForm.SetupSynEditors;

View File

@ -6,11 +6,7 @@ object CreateDatabaseForm: TCreateDatabaseForm
ClientHeight = 227
ClientWidth = 317
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poOwnerFormCenter
OnClose = FormClose

View File

@ -41,7 +41,6 @@ uses main, apphelpers;
procedure TCreateDatabaseForm.FormCreate(Sender: TObject);
begin
InheritFont(Font);
TranslateComponent(Self);
lblCreateCode.Caption := lblCreateCode.Caption + ':';
// Setup SynMemoPreview

View File

@ -6,11 +6,7 @@ object DataSortingForm: TDataSortingForm
ClientHeight = 97
ClientWidth = 204
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
OnClose = FormClose
OnCreate = FormCreate

View File

@ -53,7 +53,6 @@ uses main;
procedure TDataSortingForm.FormCreate(Sender: TObject);
begin
InheritFont(Font);
TranslateComponent(Self);
ColumnNames := TStringList.Create;
end;

View File

@ -7,11 +7,7 @@ object frmEditVariable: TfrmEditVariable
Color = clBtnFace
Constraints.MinHeight = 260
Constraints.MinWidth = 200
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poMainFormCenter
OnCreate = FormCreate

View File

@ -55,7 +55,6 @@ uses main, apphelpers;
procedure TfrmEditVariable.FormCreate(Sender: TObject);
begin
InheritFont(Font);
TranslateComponent(Self);
Width := AppSettings.ReadInt(asEditVarWindowWidth);
Height := AppSettings.ReadInt(asEditVarWindowHeight);

View File

@ -6,11 +6,7 @@ object frmExportGrid: TfrmExportGrid
ClientHeight = 432
ClientWidth = 383
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poMainFormCenter
OnClose = FormClose

View File

@ -102,7 +102,6 @@ var
FormatDesc: String;
begin
TranslateComponent(Self);
InheritFont(Font);
editFilename.Text := AppSettings.ReadString(asGridExportFilename);
radioOutputCopyToClipboard.Checked := AppSettings.ReadBool(asGridExportOutputCopy);
radioOutputFile.Checked := AppSettings.ReadBool(asGridExportOutputFile);

View File

@ -8,11 +8,7 @@ object frmInsertFiles: TfrmInsertFiles
Color = clBtnFace
Constraints.MinHeight = 353
Constraints.MinWidth = 475
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poOwnerFormCenter
OnClose = FormClose

View File

@ -119,7 +119,6 @@ begin
TranslateComponent(Self);
ListFiles.Images := GetSystemImageList;
DragAcceptFiles(Handle, True);
InheritFont(Font);
MainForm.RestoreListSetup(ListColumns);
MainForm.RestoreListSetup(ListFiles);
FixVT(ListFiles);

View File

@ -7,11 +7,7 @@ object loaddataform: Tloaddataform
Color = clBtnFace
Constraints.MinHeight = 530
Constraints.MinWidth = 525
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poMainFormCenter
OnClose = FormClose

View File

@ -96,7 +96,6 @@ const
procedure Tloaddataform.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
InheritFont(Font);
// Restore settings
Width := AppSettings.ReadInt(asCSVImportWindowWidth);
Height := AppSettings.ReadInt(asCSVImportWindowHeight);

View File

@ -6,11 +6,7 @@ object frmLogin: TfrmLogin
ClientHeight = 176
ClientWidth = 270
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate

View File

@ -37,7 +37,6 @@ uses apphelpers, main;
procedure TfrmLogin.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
InheritFont(Font);
Caption := APPNAME + ' - Login';
MainForm.ImageListMain.GetBitmap(144, imgIcon.Picture.Bitmap);
lblPrompt.Font.Size := 10;

View File

@ -4,11 +4,7 @@ object MainForm: TMainForm
ClientHeight = 486
ClientWidth = 824
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Default'
Font.Style = []
ParentFont = True
OldCreateOrder = True
Position = poDesigned
ShowHint = True
@ -155,12 +151,8 @@ object MainForm: TMainForm
DragMode = dmAutomatic
DragType = dtVCL
Header.AutoSizeIndex = 0
Header.Font.Charset = DEFAULT_CHARSET
Header.Font.Color = clWindowText
Header.Font.Height = -11
Header.Font.Name = 'Tahoma'
Header.Font.Style = []
Header.Options = [hoAutoResize, hoColumnResize, hoDrag]
Header.ParentFont = True
HintMode = hmTooltip
HotCursor = crHandPoint
Images = ImageListMain
@ -1372,12 +1364,8 @@ object MainForm: TMainForm
DragMode = dmAutomatic
DragType = dtVCL
Header.AutoSizeIndex = 0
Header.Font.Charset = DEFAULT_CHARSET
Header.Font.Color = clWindowText
Header.Font.Height = -11
Header.Font.Name = 'Tahoma'
Header.Font.Style = []
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs]
Header.ParentFont = True
Images = ImageListMain
IncrementalSearch = isAll
PopupMenu = popupQueryHelpers

View File

@ -1745,7 +1745,6 @@ begin
Delimiter := AppSettings.ReadString(asDelimiter);
InheritFont(Font);
InheritFont(SynCompletionProposal.Font);
// Simulated link label, has non inherited blue font color
lblExplainProcess.Font.Color := clBlue;

View File

@ -6,11 +6,7 @@ object optionsform: Toptionsform
ClientHeight = 424
ClientWidth = 732
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poMainFormCenter
OnCreate = FormCreate
@ -1124,12 +1120,8 @@ object optionsform: Toptionsform
Height = 349
Align = alLeft
Header.AutoSizeIndex = 0
Header.Font.Charset = DEFAULT_CHARSET
Header.Font.Color = clWindowText
Header.Font.Height = -11
Header.Font.Name = 'Tahoma'
Header.Font.Style = []
Header.MainColumn = -1
Header.ParentFont = True
Images = MainForm.ImageListMain
TabOrder = 0
OnFocusChanged = TreeShortcutItemsFocusChanged

View File

@ -410,7 +410,6 @@ var
dtc: TDBDatatypeCategoryIndex;
begin
TranslateComponent(Self);
InheritFont(Font);
// Misecllaneous
// Hide browse button on Wine, as the browse dialog returns Windows-style paths, while we need a Unix path

View File

@ -6,11 +6,7 @@ object printlistForm: TprintlistForm
ClientHeight = 92
ClientWidth = 377
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poMainFormCenter
OnCreate = FormCreate

View File

@ -41,7 +41,6 @@ uses main, apphelpers, table_editor, dbconnection;
procedure TprintlistForm.FormCreate(Sender: TObject);
begin
InheritFont(Font);
TranslateComponent(Self);
end;

View File

@ -8,11 +8,7 @@ object frmSearchReplace: TfrmSearchReplace
Color = clBtnFace
Constraints.MinHeight = 320
Constraints.MinWidth = 400
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poOwnerFormCenter
OnCreate = FormCreate

View File

@ -60,7 +60,6 @@ uses apphelpers, main;
procedure TfrmSearchReplace.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
InheritFont(Font);
comboSearch.Items.Text := AppSettings.ReadString(asFindDialogSearchHistory);
comboReplace.Items.Text := AppSettings.ReadString(asFindDialogReplaceHistory);
comboSearch.Text := '';

View File

@ -7,11 +7,7 @@ object frmSelectDBObject: TfrmSelectDBObject
Color = clBtnFace
Constraints.MinHeight = 343
Constraints.MinWidth = 240
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poOwnerFormCenter
OnCreate = FormCreate
@ -44,12 +40,8 @@ object frmSelectDBObject: TfrmSelectDBObject
Height = 206
Anchors = [akLeft, akTop, akRight, akBottom]
Header.AutoSizeIndex = 0
Header.Font.Charset = DEFAULT_CHARSET
Header.Font.Color = clWindowText
Header.Font.Height = -11
Header.Font.Name = 'Tahoma'
Header.Font.Style = []
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs]
Header.ParentFont = True
Images = MainForm.ImageListMain
Indent = 16
Margin = 2

View File

@ -65,7 +65,6 @@ begin
TranslateComponent(Self);
Width := AppSettings.ReadInt(asSelectDBOWindowWidth);
Height := AppSettings.ReadInt(asSelectDBOWindowHeight);
InheritFont(Font);
TreeDBO.TreeOptions := MainForm.DBtree.TreeOptions;
TreeDBO.TreeOptions.SelectionOptions := TreeDBO.TreeOptions.SelectionOptions + [toMultiSelect];
FixVT(TreeDBO);

View File

@ -5,11 +5,7 @@ object frmSQLhelp: TfrmSQLhelp
ClientHeight = 355
ClientWidth = 582
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
FormStyle = fsStayOnTop
OldCreateOrder = False
OnClose = FormClose
@ -103,12 +99,8 @@ object frmSQLhelp: TfrmSQLhelp
Margins.Bottom = 0
Align = alClient
Header.AutoSizeIndex = 0
Header.Font.Charset = DEFAULT_CHARSET
Header.Font.Color = clWindowText
Header.Font.Height = -11
Header.Font.Name = 'Tahoma'
Header.Font.Style = []
Header.MainColumn = -1
Header.ParentFont = True
Images = MainForm.ImageListMain
TabOrder = 1
TreeOptions.PaintOptions = [toHotTrack, toShowButtons, toShowDropmark, toShowRoot, toShowTreeLines, toThemeAware, toUseBlendedImages, toUseExplorerTheme, toHideTreeLinesIfThemed]

View File

@ -81,7 +81,6 @@ uses apphelpers, main;
procedure TfrmSQLhelp.FormCreate(Sender: TObject);
begin
// Set window-layout
InheritFont(Font);
lblKeyword.Font.Style := [fsBold];
Top := AppSettings.ReadInt(asSQLHelpWindowTop);
Left := AppSettings.ReadInt(asSQLHelpWindowLeft);

View File

@ -7,11 +7,7 @@ object frmSyncDB: TfrmSyncDB
Color = clBtnFace
Constraints.MinHeight = 400
Constraints.MinWidth = 550
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poMainFormCenter
OnClose = FormClose
@ -43,12 +39,8 @@ object frmSyncDB: TfrmSyncDB
AccessibleName = 'tree'
Anchors = [akLeft, akTop, akBottom]
Header.AutoSizeIndex = 0
Header.Font.Charset = DEFAULT_CHARSET
Header.Font.Color = clWindowText
Header.Font.Height = -11
Header.Font.Name = 'Tahoma'
Header.Font.Style = []
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs]
Header.ParentFont = True
Images = MainForm.ImageListMain
TabOrder = 0
TreeOptions.MiscOptions = [toAcceptOLEDrop, toCheckSupport, toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning, toEditOnClick]
@ -205,12 +197,8 @@ object frmSyncDB: TfrmSyncDB
Height = 115
Anchors = [akLeft, akTop, akRight, akBottom]
Header.AutoSizeIndex = 0
Header.Font.Charset = DEFAULT_CHARSET
Header.Font.Color = clWindowText
Header.Font.Height = -11
Header.Font.Name = 'Tahoma'
Header.Font.Style = []
Header.MainColumn = -1
Header.ParentFont = True
Images = MainForm.ImageListMain
TabOrder = 6
TreeOptions.MiscOptions = [toAcceptOLEDrop, toCheckSupport, toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning, toEditOnClick]

View File

@ -108,7 +108,6 @@ var
begin
Caption := MainForm.actSynchronizeDatabase.Caption;
TranslateComponent(Self);
InheritFont(Font);
FixVT(treeSource);
FixVT(treeDifferences);

View File

@ -5,11 +5,7 @@ object frmTableTools: TfrmTableTools
ClientHeight = 383
ClientWidth = 764
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poMainFormCenter
OnClose = FormClose
@ -70,12 +66,8 @@ object frmTableTools: TfrmTableTools
Height = 336
Align = alLeft
Header.AutoSizeIndex = 0
Header.Font.Charset = DEFAULT_CHARSET
Header.Font.Color = clWindowText
Header.Font.Height = -11
Header.Font.Name = 'Tahoma'
Header.Font.Style = []
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs]
Header.ParentFont = True
Images = MainForm.ImageListMain
IncrementalSearch = isInitializedOnly
PopupMenu = popupTree

View File

@ -214,7 +214,6 @@ begin
DATA_UPDATE := _('Replace existing data');
// Restore GUI setup
InheritFont(Font);
Width := AppSettings.ReadInt(asTableToolsWindowWidth);
Height := AppSettings.ReadInt(asTableToolsWindowHeight);
TreeObjects.Width := AppSettings.ReadInt(asTableToolsTreeWidth);

View File

@ -7,11 +7,7 @@ object frmTextEditor: TfrmTextEditor
Color = clBtnFace
Constraints.MinHeight = 100
Constraints.MinWidth = 130
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poMainFormCenter
OnClose = FormClose

View File

@ -153,7 +153,6 @@ begin
FmemoText.WantTabs := True;
FmemoText.OnChange := memoTextChange;
FmemoText.OnKeyDown := memoTextKeyDown;
InheritFont(Font);
// Use same text properties as in query/find/replace actions
actSearchFind.Caption := MainForm.actQueryFind.Caption;
actSearchFind.Hint := MainForm.actQueryFind.Hint;

View File

@ -6,11 +6,7 @@ object frmUpdateCheck: TfrmUpdateCheck
ClientHeight = 425
ClientWidth = 384
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
OldCreateOrder = False
Position = poMainFormCenter
OnCreate = FormCreate

View File

@ -51,7 +51,6 @@ uses main;
procedure TfrmUpdateCheck.FormCreate(Sender: TObject);
begin
// Should be false by default. Callers can set this to True after Create()
InheritFont(Font);
TranslateComponent(Self);
imgDonate.OnClick := MainForm.DonateClick;
imgDonate.Visible := MainForm.HasDonated(False) = nbFalse;

View File

@ -8,11 +8,7 @@ object UserManagerForm: TUserManagerForm
Color = clBtnFace
Constraints.MinHeight = 400
Constraints.MinWidth = 500
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = True
Padding.Left = 8
Padding.Top = 8
Padding.Right = 8

View File

@ -207,7 +207,6 @@ end;
procedure TUserManagerForm.FormCreate(Sender: TObject);
begin
// Restore GUI setup
InheritFont(Font);
lblWarning.Font.Color := clRed;
Width := AppSettings.ReadInt(asUsermanagerWindowWidth);
Height := AppSettings.ReadInt(asUsermanagerWindowHeight);