Move workaround for broken split buttons after translation into TExtForm.Create, so we have it once and the caller does not need to care about it. See https://sourceforge.net/p/dxgettext/bugs/80/

This commit is contained in:
Ansgar Becker
2019-07-23 13:36:56 +02:00
parent 28763eaf8b
commit 63fdc3e08c
7 changed files with 16 additions and 29 deletions

View File

@@ -303,7 +303,6 @@ type
function WideHexToBin(text: String): AnsiString;
function BinToWideHex(bin: AnsiString): String;
procedure FixVT(VT: TVirtualStringTree; MultiLineCount: Word=1);
procedure FixDropDownButtons(Form: TForm);
function GetTextHeight(Font: TFont): Integer;
function ColorAdjustBrightness(Col: TColor; Shift: SmallInt): TColor;
function ComposeOrderClause(Cols: TOrderColArray): String;
@@ -1466,27 +1465,6 @@ begin
end;
procedure FixDropDownButtons(Form: TForm);
var
i: Integer;
Comp: TComponent;
begin
// Work around broken dropdown (tool)button on Wine after translation:
// https://sourceforge.net/p/dxgettext/bugs/80/
for i:=0 to Form.ComponentCount-1 do begin
Comp := Form.Components[i];
if (Comp is TButton) and (TButton(Comp).Style = bsSplitButton) then begin
TButton(Comp).Style := bsPushButton;
TButton(Comp).Style := bsSplitButton;
end;
if (Comp is TToolButton) and (TToolButton(Comp).Style = tbsDropDown) then begin
TToolButton(Comp).Style := tbsButton;
TToolButton(Comp).Style := tbsDropDown;
end;
end;
end;
function GetTextHeight(Font: TFont): Integer;
var
DC: HDC;

View File

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

View File

@@ -68,7 +68,6 @@ const
procedure TCopyTableForm.FormCreate(Sender: TObject);
begin
HasSizeGrip := True;
FixDropDownButtons(Self);
Width := AppSettings.ReadInt(asCopyTableWindowWidth);
Height := AppSettings.ReadInt(asCopyTableWindowHeight);
MainForm.SetupSynEditors;

View File

@@ -4,7 +4,7 @@ interface
uses
Classes, SysUtils, Forms, Windows, Messages, System.Types, StdCtrls, Clipbrd,
SizeGrip, apphelpers, Vcl.Graphics, Vcl.Dialogs, gnugettext, Vcl.ImgList;
SizeGrip, apphelpers, Vcl.Graphics, Vcl.Dialogs, gnugettext, Vcl.ImgList, Vcl.ComCtrls;
type
// Form with a sizegrip in the lower right corner, without the need for a statusbar
@@ -34,6 +34,8 @@ implementation
constructor TExtForm.Create(AOwner: TComponent);
var
OldImageList: TCustomImageList;
i: Integer;
Cmp: TComponent;
begin
inherited;
@@ -51,6 +53,19 @@ begin
end else begin
TranslateComponent(Self);
end;
// Work around broken dropdown (tool)button on Wine after translation:
// https://sourceforge.net/p/dxgettext/bugs/80/
for i:=0 to ComponentCount-1 do begin
Cmp := Components[i];
if (Cmp is TButton) and (TButton(Cmp).Style = bsSplitButton) then begin
TButton(Cmp).Style := bsPushButton;
TButton(Cmp).Style := bsSplitButton;
end;
if (Cmp is TToolButton) and (TToolButton(Cmp).Style = tbsDropDown) then begin
TToolButton(Cmp).Style := tbsButton;
TToolButton(Cmp).Style := tbsDropDown;
end;
end;
end;

View File

@@ -1677,8 +1677,6 @@ var
begin
caption := APPNAME;
FixDropDownButtons(Self);
// Load preferred ImageCollection into VirtualImageList
PrepareImageList;

View File

@@ -226,7 +226,6 @@ var
Obj: TDBObject;
begin
HasSizeGrip := True;
FixDropDownButtons(Self);
OUTPUT_FILE := _('Single .sql file');
OUTPUT_FILE_COMPRESSED := _('ZIP compressed .sql file');
OUTPUT_CLIPBOARD := _('Clipboard');

View File

@@ -202,7 +202,6 @@ begin
actSearchFindNext.Hint := MainForm.actQueryFindAgain.Hint;
actSearchReplace.Caption := MainForm.actQueryReplace.Caption;
actSearchReplace.Hint := MainForm.actQueryReplace.Hint;
FixDropDownButtons(Self);
// Assign linebreak values to their menu item tags, to write less code later
menuWindowsLB.Tag := Integer(lbsWindows);
menuUnixLB.Tag := Integer(lbsUnix);