Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit 545fb1e

Browse files
committed
Fixes pin tab separation on smaller tabs
Fixes VSTS #984216 - [Tabs] Pin button is really close from Close button when there are many tabs in the TabStrip
1 parent c1e35b5 commit 545fb1e

File tree

1 file changed

+9
-8
lines changed
  • main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockNotebook

1 file changed

+9
-8
lines changed

main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockNotebook/TabStrip.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,9 @@ class TabStrip: EventBox, IAnimatable
8787
static readonly int VerticalTextSize = 11;
8888
const int TabSpacing = 0;
8989
const int LeanWidth = 12;
90-
const int ButtonSize = 14;
91-
const double CloseButtonMarginRight = 0;
90+
const double CloseButtonMarginRight = 1;
9291
const double CloseButtonMarginBottom = -1.0;
93-
const double PinButtonMarginRight = 0;
94-
const double PinButtonMarginBottom = -1.0;
95-
96-
const int TextOffset = 1;
92+
const double PinButtonMarginRight = 10.5;
9793

9894
int TabWidth { get; set; }
9995

@@ -1185,7 +1181,8 @@ void DrawTab (Context ctx, DockNotebookTab tab, Gdk.Rectangle allocation, Gdk.Re
11851181

11861182
tab.CloseButtonActiveArea = closeButtonAlloation.Inflate (2, 2);
11871183

1188-
var spinButtonAllocation = new Cairo.Rectangle (closeButtonAlloation.X - rightPadding - PinButtonMarginRight,
1184+
var spinButtonX = closeButtonAlloation.X - Math.Max (tabPinnedImage.Width + CloseButtonMarginRight, rightPadding);
1185+
var spinButtonAllocation = new Cairo.Rectangle (spinButtonX,
11891186
closeButtonAlloation.Y,
11901187
tabPinnedImage.Width, tabPinnedImage.Height);
11911188

@@ -1230,8 +1227,9 @@ void DrawTab (Context ctx, DockNotebookTab tab, Gdk.Rectangle allocation, Gdk.Re
12301227
ctx.SetSourceColor ((tab.Notify ? Styles.TabBarNotifyTextColor : (active ? Styles.TabBarActiveTextColor : Styles.TabBarInactiveTextColor)).ToCairoColor ());
12311228
Pango.CairoHelper.ShowLayout (ctx, la.GetLine (0).Layout);
12321229
} else {
1230+
12331231
// ellipses are for space wasting ..., we cant afford that
1234-
using (var lg = new LinearGradient (tx + tw - 10, 0, tx + tw, 0)) {
1232+
using (var lg = new LinearGradient (tx + tw - (drawPinButton ? DefaultGradientWidth : DefaultGradientPinWidth), 0, tx + tw, 0)) {
12351233
var color = (tab.Notify ? Styles.TabBarNotifyTextColor : (active ? Styles.TabBarActiveTextColor : Styles.TabBarInactiveTextColor)).ToCairoColor ();
12361234
color = color.MultiplyAlpha (tab.Opacity);
12371235
lg.AddColorStop (0, color);
@@ -1244,6 +1242,9 @@ void DrawTab (Context ctx, DockNotebookTab tab, Gdk.Rectangle allocation, Gdk.Re
12441242
la.Dispose ();
12451243
}
12461244

1245+
const double DefaultGradientWidth = 10;
1246+
const double DefaultGradientPinWidth = 13;
1247+
12471248
static void DrawTabBackground (Widget widget, Context ctx, Gdk.Rectangle allocation, int contentWidth, int px, bool active = true, bool isPinned = false)
12481249
{
12491250
int lean = Math.Min (LeanWidth, contentWidth / 2);

0 commit comments

Comments
 (0)