Try the same workaround for invisible or black dropdown buttons on Wine as previously only for dropdown toolbuttons (becd4bdd0e3845f9ad7845fe7637460914878afa and 61202be058cc135f938a131207f47f9546efff26). Probably fixes issue #94. May also not fix it, as the toolbutton issue was not only on Wine.

This commit is contained in:
Ansgar Becker
2018-02-03 22:47:29 +01:00
parent f5c254ff77
commit f7b4d0c0b8
6 changed files with 29 additions and 16 deletions

View File

@ -13,7 +13,7 @@ uses
Windows, ShlObj, ActiveX, VirtualTrees, SynRegExpr, Messages, Math,
Registry, DateUtils, Generics.Collections, StrUtils, AnsiStrings, TlHelp32, Types,
dbconnection, mysql_structures, SynMemo, Menus, WinInet, gnugettext, Themes,
Character, ImgList, System.UITypes, ActnList, WinSock, IOUtils;
Character, ImgList, System.UITypes, ActnList, WinSock, IOUtils, StdCtrls, ComCtrls;
type
@ -292,6 +292,7 @@ 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;
@ -1446,13 +1447,34 @@ begin
VT.ShowHint := True;
VT.HintMode := hmToolTip;
// Apply case insensitive incremental search event
if VT.IncrementalSearch <> isNone then
if VT.IncrementalSearch <> VirtualTrees.isNone then
VT.OnIncrementalSearch := Mainform.AnyGridIncrementalSearch;
VT.OnStartOperation := Mainform.AnyGridStartOperation;
VT.OnEndOperation := Mainform.AnyGridEndOperation;
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

@ -224,6 +224,7 @@ begin
// Fix GUI stuff
TranslateComponent(Self);
InheritFont(Font);
FixDropDownButtons(Self);
Width := AppSettings.ReadInt(asSessionManagerWindowWidth);
Height := AppSettings.ReadInt(asSessionManagerWindowHeight);

View File

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

View File

@ -1606,6 +1606,7 @@ begin
// space left besides them.
TP_GlobalIgnoreClass(TFont);
TranslateComponent(Self);
FixDropDownButtons(Self);
MainMenu1.Images := ImageListMain;
// Translate menu items
menuQueryHelpersGenerateSelect.Caption := f_('Generate %s ...', ['SELECT']);
@ -1613,16 +1614,6 @@ begin
menuQueryHelpersGenerateUpdate.Caption := f_('Generate %s ...', ['UPDATE']);
menuQueryHelpersGenerateDelete.Caption := f_('Generate %s ...', ['DELETE']);
// Fix drop down buttons on main toolbar. Same as r4304.
// Caused by missing Application.MainFormOnTaskBar
for i:=0 to ToolBarMainButtons.ButtonCount-1 do begin
ToolButton := ToolBarMainButtons.Buttons[i];
if ToolButton.Style = tbsDropDown then begin
ToolButton.Style := tbsButton;
ToolButton.Style := tbsDropDown;
end;
end;
// Detect version
dwInfoSize := GetFileVersionInfoSize(PChar(Application.ExeName), dwWnd);
GetMem(ptrVerBuf, dwInfoSize);

View File

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

View File

@ -160,10 +160,7 @@ begin
actSearchReplace.Caption := MainForm.actQueryReplace.Caption;
actSearchReplace.Hint := MainForm.actQueryReplace.Hint;
TranslateComponent(Self);
// Work around broken dropdown toolbutton after translation:
// https://sourceforge.net/tracker/index.php?func=detail&aid=902470&group_id=74086&atid=539908
btnLinebreaks.Style := tbsButton;
btnLinebreaks.Style := tbsDropDown;
FixDropDownButtons(Self);
// Assign linebreak values to their menu item tags, to write less code later
menuWindowsLB.Tag := Integer(lbsWindows);
menuUnixLB.Tag := Integer(lbsUnix);