Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVsevolod Kukol <sevoku@xamarin.com>2016-06-02 17:20:17 +0300
committerVsevolod Kukol <sevoku@xamarin.com>2016-06-03 09:28:39 +0300
commitde18ebae82bc95845ba56ef0d8d8cc1806919069 (patch)
tree4a653298b5fed39d14f5b3e92495095c6d82c464 /main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking
parent29457dbef06f53a95205adfdf6726c1fc714d81a (diff)
[Ide] Optimize Dock Tab sizing
Introduce a minimal width for dock tabs which can be smaller than the size request required to fit the whole tab title content, but still large enough to draw a part of the title label. If a dock has a single child, always use its title size request without overlapping. (fixes bug #38011)
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroup.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroupItem.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs17
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs14
4 files changed, 25 insertions, 12 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroup.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroup.cs
index 324c62f945..3733a8b4a4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroup.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroup.cs
@@ -813,6 +813,11 @@ namespace MonoDevelop.Components.Docking
if (dh > height)
height = dh;
}
+ if (boundTabStrip != null) {
+ var tr = boundTabStrip.SizeRequest ();
+ if (width < tr.Width)
+ width = tr.Width;
+ }
}
else if (type == DockGroupType.Vertical) {
height = VisibleObjects.Count > 1 ? (VisibleObjects.Count - 1) * Frame.TotalHandleSize : 0;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroupItem.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroupItem.cs
index 00108eb7d8..bf6953a9d7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroupItem.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroupItem.cs
@@ -82,6 +82,7 @@ namespace MonoDevelop.Components.Docking
if (ParentGroup.Type != DockGroupType.Tabbed || ParentGroup.VisibleObjects.Count == 1) {
var tr = item.TitleTab.SizeRequest ();
req.Height += tr.Height;
+ req.Width = Math.Max (req.Width, tr.Width);
return req;
} else
return req;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs
index b2c08ec19b..602df87d3f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs
@@ -47,6 +47,7 @@ namespace MonoDevelop.Components.Docking
Gtk.Widget page;
ExtendedLabel labelWidget;
int labelWidth;
+ int minWidth;
DockVisualStyle visualStyle;
ImageView tabIcon;
DockFrame frame;
@@ -156,10 +157,7 @@ namespace MonoDevelop.Components.Docking
labelWidget.ModifyText (StateType.Normal, (active ? visualStyle.PadTitleLabelColor.Value : visualStyle.InactivePadTitleLabelColor.Value).ToGdkColor ());
}
- var r = WidthRequest;
- WidthRequest = -1;
labelWidth = SizeRequest ().Width + 1;
- WidthRequest = r;
if (visualStyle != null)
HeightRequest = visualStyle.PadTitleHeight != null ? (int)(visualStyle.PadTitleHeight.Value) : -1;
@@ -234,6 +232,8 @@ namespace MonoDevelop.Components.Docking
box.ShowAll ();
Show ();
+ minWidth = tabIcon.SizeRequest ().Width + al.SizeRequest ().Width + 10;
+
UpdateBehavior ();
UpdateVisualStyle ();
}
@@ -249,6 +249,10 @@ namespace MonoDevelop.Components.Docking
public int LabelWidth {
get { return labelWidth; }
}
+
+ public int MinWidth {
+ get { return minWidth; }
+ }
public bool Active {
get {
@@ -413,13 +417,6 @@ namespace MonoDevelop.Components.Docking
int leftPadding = (int)TabPadding.Left;
int rightPadding = (int)TabPadding.Right;
- if (rect.Width < labelWidth) {
- int red = (labelWidth - rect.Width) / 2;
- leftPadding -= red;
- rightPadding -= red;
- if (leftPadding < 2) leftPadding = 2;
- if (rightPadding < 2) rightPadding = 2;
- }
rect.X += leftPadding;
rect.Width -= leftPadding + rightPadding;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs
index e2d758f363..8b4df81630 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs
@@ -80,9 +80,8 @@ namespace MonoDevelop.Components.Docking
if (tab.Parent != null)
((Gtk.Container)tab.Parent).Remove (tab);
- //box.PackStart (tab, true, true, 0);
box.PackStart (tab, false, false, 0);
- tab.WidthRequest = tab.LabelWidth;
+
if (currentTab == -1)
CurrentTab = box.Children.Length - 1;
else {
@@ -192,6 +191,17 @@ namespace MonoDevelop.Components.Docking
UpdateEllipsize (allocation);
base.OnSizeAllocated (allocation);
}
+
+ protected override void OnSizeRequested (ref Requisition requisition)
+ {
+ base.OnSizeRequested (ref requisition);
+
+ int minWidth = 0;
+ foreach (var tab in box.Children.Cast<DockItemTitleTab> ())
+ minWidth += tab.MinWidth;
+
+ requisition.Width = minWidth;
+ }
void UpdateEllipsize (Gdk.Rectangle allocation)
{