mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 23:58:06 +02:00
MenuEditor: Better visibility of AddButtons, especially on GTK2.
git-svn-id: trunk@55390 -
This commit is contained in:
parent
9b325e675c
commit
a408181660
@ -10,7 +10,8 @@ uses
|
||||
ActnList, Controls, Dialogs, StdCtrls, ExtCtrls, Menus,
|
||||
Forms, Graphics, ImgList, Themes, LCLType, LCLIntf, LCLProc,
|
||||
// IdeIntf
|
||||
FormEditingIntf, IDEWindowIntf, ComponentEditors, IDEDialogs, PropEdits,
|
||||
FormEditingIntf, IDEWindowIntf, IDEImagesIntf, ComponentEditors, IDEDialogs,
|
||||
PropEdits,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, LazIDEIntf, MenuDesignerBase, MenuEditorForm, MenuShortcutDisplay,
|
||||
MenuTemplates, MenuResolveConflicts;
|
||||
@ -545,7 +546,7 @@ begin
|
||||
selShadow.ShowingBottomFake:=False;
|
||||
end
|
||||
else begin
|
||||
w:=selShadow.ParentBox.Width - Gutter_X;
|
||||
w:=selShadow.ParentBox.Width - Gutter_X - 1;
|
||||
if (FMinWidth > w) then
|
||||
w:=FMinWidth;
|
||||
SetBounds(selShadow.ParentBox.Left + selShadow.Left + Gutter_X,
|
||||
@ -569,9 +570,9 @@ begin
|
||||
SetInitialBounds(0, 0, cx, cy);
|
||||
BorderStyle:=bsNone;
|
||||
Visible:=False;
|
||||
Canvas.Pen.Color:=clBtnShadow;
|
||||
Canvas.Pen.Color:=clBtnText;
|
||||
Canvas.Pen.Style:=psDot;
|
||||
Canvas.Font.Color:=clBtnShadow;
|
||||
Canvas.Font.Color:=clBtnText;
|
||||
Canvas.Brush.Color:=clBtnFace;
|
||||
Parent:=anOwner;
|
||||
end;
|
||||
@ -584,18 +585,31 @@ end;
|
||||
|
||||
procedure TFake.Paint;
|
||||
var
|
||||
r: TRect;
|
||||
sz: TSize;
|
||||
y: integer;
|
||||
r, TextRect: TRect;
|
||||
TextSize: TSize;
|
||||
TextPoint, AddBmpPoint: TPoint;
|
||||
AddBmp: TCustomBitmap;
|
||||
begin
|
||||
r:=ClientRect;
|
||||
Canvas.FillRect(r);
|
||||
Canvas.RoundRect(r, 3, 3);
|
||||
sz:=Canvas.TextExtent(Caption);
|
||||
y:=(r.Bottom - r.Top - sz.cy) div 2;
|
||||
if (y < 2) then
|
||||
y:=2;
|
||||
Canvas.TextOut((r.Right - r.Left - sz.cx) div 2, y, Caption);
|
||||
try
|
||||
AddBmp:=TIDEImages.CreateImage('laz_add');
|
||||
TextSize:=Canvas.TextExtent(Caption);
|
||||
TextPoint.y:=(r.Bottom - r.Top - TextSize.cy) div 2;
|
||||
if (TextPoint.y < 1) then
|
||||
TextPoint.y:=1;
|
||||
TextPoint.x:=(r.Right - r.Left - TextSize.cx + AddBmp.Width) div 2;
|
||||
TextRect := ClientRect;
|
||||
InflateRect(TextRect, 1, 1);
|
||||
Canvas.TextRect(TextRect, TextPoint.x, TextPoint.y, Caption);
|
||||
|
||||
AddBmpPoint.x:=(TextPoint.x - AddBmp.Width) div 2;
|
||||
AddBmpPoint.y:=(r.Bottom - r.Top - AddBmp.Height) div 2;
|
||||
Canvas.Draw(AddBmpPoint.x, AddBmpPoint.y, AddBmp);
|
||||
finally
|
||||
AddBmp.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFake.Refresh;
|
||||
@ -606,7 +620,9 @@ end;
|
||||
procedure TFake.TextChanged;
|
||||
begin
|
||||
inherited TextChanged;
|
||||
FMinWidth:=FShadowMenu.GetStringWidth(Caption, False) + Double_MenuBar_Text_Offset;
|
||||
FMinWidth:=FShadowMenu.GetStringWidth(Caption, False) +
|
||||
Double_MenuBar_Text_Offset +
|
||||
Add_Icon_Width;
|
||||
end;
|
||||
|
||||
{ TShadowMenu }
|
||||
@ -2088,7 +2104,7 @@ begin
|
||||
if FRealItem.IsInMenuBar then
|
||||
Result:=w + Double_MenuBar_Text_Offset + FShadowMenu.GetMenuBarIconWidth(FRealItem)
|
||||
else
|
||||
Result:=w + Double_DropDown_Text_Offset + GetShortcutWidth;
|
||||
Result:=w + Double_DropDown_Text_Offset + GetShortcutWidth + Add_Icon_Width;
|
||||
end;
|
||||
|
||||
function TShadowItem.HasChildBox(out aChildBox: TShadowBoxBase): boolean;
|
||||
|
@ -161,6 +161,7 @@ var
|
||||
Double_DropDown_Text_Offset: Integer = 70;
|
||||
Gutter_Offset: Integer = 6;
|
||||
Gutter_X: Integer = 29;
|
||||
Add_Icon_Width: Integer = 16;
|
||||
|
||||
implementation
|
||||
|
||||
@ -284,6 +285,7 @@ begin
|
||||
Double_DropDown_Text_Offset := DropDown_Text_Offset shl 1;
|
||||
Gutter_Offset := ScaleX(6, 96);
|
||||
Gutter_X := DropDown_Text_Offset - Gutter_Offset;
|
||||
Add_Icon_Width := ScaleX(16, 96);
|
||||
end;
|
||||
|
||||
{ TMenuTemplate }
|
||||
|
Loading…
Reference in New Issue
Block a user