Skip to content
Permalink
Browse files

Move workaround for broken split buttons after translation into TExtF…

…orm.Create, so we have it once and the caller does not need to care about it. See https://sourceforge.net/p/dxgettext/bugs/80/
  • Loading branch information...
ansgarbecker committed Jul 23, 2019
1 parent 28763ea commit 63fdc3e08ccf24744fd086ffee7ceda6da6948c1
Showing with 16 additions and 29 deletions.
  1. +0 −22 source/apphelpers.pas
  2. +0 −1 source/connections.pas
  3. +0 −1 source/copytable.pas
  4. +16 −1 source/extra_controls.pas
  5. +0 −2 source/main.pas
  6. +0 −1 source/tabletools.pas
  7. +0 −1 source/texteditor.pas
@@ -303,7 +303,6 @@ TAppSettings = class(TObject)
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 @@ procedure FixVT(VT: TVirtualStringTree; MultiLineCount: Word=1);
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;
@@ -240,7 +240,6 @@ procedure Tconnform.FormCreate(Sender: TObject);
begin
// Fix GUI stuff
HasSizeGrip := True;
FixDropDownButtons(Self);
lblDownloadPlink.Font.Style := [fsUnderline];
lblDownloadPlink.Font.Color := clBlue;

@@ -68,7 +68,6 @@ implementation
procedure TCopyTableForm.FormCreate(Sender: TObject);
begin
HasSizeGrip := True;
FixDropDownButtons(Self);
Width := AppSettings.ReadInt(asCopyTableWindowWidth);
Height := AppSettings.ReadInt(asCopyTableWindowHeight);
MainForm.SetupSynEditors;
@@ -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 @@ constructor TExtForm.Create(AOwner: TComponent);
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;


@@ -1677,8 +1677,6 @@ procedure TMainForm.FormCreate(Sender: TObject);
begin
caption := APPNAME;

FixDropDownButtons(Self);

// Load preferred ImageCollection into VirtualImageList
PrepareImageList;

@@ -226,7 +226,6 @@ procedure TfrmTableTools.FormCreate(Sender: TObject);
Obj: TDBObject;
begin
HasSizeGrip := True;
FixDropDownButtons(Self);
OUTPUT_FILE := _('Single .sql file');
OUTPUT_FILE_COMPRESSED := _('ZIP compressed .sql file');
OUTPUT_CLIPBOARD := _('Clipboard');
@@ -202,7 +202,6 @@ procedure TfrmTextEditor.FormCreate(Sender: TObject);
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);

0 comments on commit 63fdc3e

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