public void StartOpenAnimation(DockNotebookTab tab) { tab.WidthModifier = 0; new Animation(f => tab.WidthModifier = f) .AddConcurrent(new Animation(f => tab.Opacity = f), 0.0d, 0.2d) .Commit(tab, "Open", easing: Easing.CubicInOut); }
DockNotebookTab FindTab(int x, int y) { // we will not actually draw anything, just do bounds checking using (var context = Gdk.CairoHelper.Create(GdkWindow)) { DockNotebookTab current = notebook.CurrentTab as DockNotebookTab; if (current != null) { LayoutTabBorder(context, Allocation, current.Allocation.Width, current.Allocation.X, 0, false); if (context.InFill(x, y)) { return(current); } } context.NewPath(); for (int n = 0; n < notebook.Tabs.Count; n++) { DockNotebookTab tab = (DockNotebookTab)notebook.Tabs[n]; LayoutTabBorder(context, Allocation, tab.Allocation.Width, tab.Allocation.X, 0, false); if (context.InFill(x, y)) { return(tab); } context.NewPath(); } } return(null); }
public SdiWorkspaceWindow(DefaultWorkbench workbench, ViewContent content, DockNotebook tabControl, DockNotebookTab tabLabel) : base() { this.workbench = workbench; this.tabControl = tabControl; this.content = content; this.tab = tabLabel; this.tabPage = content.Control; fileTypeCondition.SetFileName(content.ContentName ?? content.UntitledName); extensionContext = AddinManager.CreateExtensionContext(); extensionContext.RegisterCondition("FileType", fileTypeCondition); box = new VBox(); viewContents.Add(content); //this fires an event that the content uses to access this object's ExtensionContext content.WorkbenchWindow = this; // The previous WorkbenchWindow property assignement may end with a call to AttachViewContent, // which will add the content control to the subview notebook. In that case, we don't need to add it to box if (subViewNotebook == null) { box.PackStart(content.Control); } content.ContentNameChanged += new EventHandler(SetTitleEvent); content.DirtyChanged += HandleDirtyChanged; box.Show(); Add(box); SetTitleEvent(null, null); }
void SetHighlightedTab(DockNotebookTab tab) { if (highlightedTab == tab) { return; } if (highlightedTab != null) { var tmp = highlightedTab; tmp.Animate("Glow", f => tmp.GlowStrength = f, start: tmp.GlowStrength, end: 0); } if (tab != null) { tab.Animate("Glow", f => tab.GlowStrength = f, start: tab.GlowStrength, end: 1); } highlightedTab = tab; QueueDraw(); }
public void StartOpenAnimation(DockNotebookTab tab) { tab.WidthModifier = 0; new Animation(f => tab.WidthModifier = f) .Insert(0.0f, 0.2f, new Animation(f => tab.Opacity = f)) .Commit(tab, "Open", easing: Easing.CubicInOut); }
public IDockNotebookTab InsertTab(int index) { var tab = new DockNotebookTab(this, tabStrip); if (index == -1) { pages.Add(tab); tab.Index = pages.Count - 1; } else { pages.Insert(index, tab); tab.Index = index; UpdateIndexes(index + 1); } pagesHistory.Add(tab); if (pages.Count == 1) { CurrentTab = tab; } tabStrip.StartOpenAnimation((DockNotebookTab)tab); tabStrip.Update(); tabStrip.DropDownButton.Sensitive = pages.Count > 0; if (PageAdded != null) { PageAdded(this, EventArgs.Empty); } return(tab); }
internal void ShowContent(DockNotebookTab tab) { if (tab == currentTab) { contentBox.Child = tab.Content; } }
internal void SetDockNotebook(DockNotebook tabControl, DockNotebookTab tabLabel) { this.tabControl = tabControl; this.tab = tabLabel; SetTitleEvent(false); SetDockNotebookTabTitle(); }
internal void SetDockNotebook(DockNotebook tabControl, DockNotebookTab tabLabel) { this.tabControl = tabControl; this.tab = tabLabel; this.tabPage = content.Control; SetTitleEvent(null, null); SetDockNotebookTabTitle(); }
internal void OnActivateTab(DockNotebookTab tab) { if (TabActivated != null) { TabActivated(this, new TabEventArgs() { Tab = tab }); } }
internal void OnCloseTab(DockNotebookTab tab) { if (TabClosed != null) { TabClosed(this, new TabEventArgs() { Tab = tab }); } }
Action <Cairo.Context> DrawClosingTab(int index, Gdk.Rectangle region, out int width) { width = 0; if (closingTabs.ContainsKey(index)) { DockNotebookTab closingTab = closingTabs[index]; width = (int)(closingTab.WidthModifier * TabWidth); int tmp = width; return((c) => DrawTab(c, closingTab, Allocation, new Gdk.Rectangle(region.X, region.Y, tmp, region.Height), false, false, false, CreateTabLayout(closingTab))); } return((c) => {}); }
public void StartCloseAnimation(DockNotebookTab tab) { closingTabs[tab.Index] = tab; new Animation(f => tab.WidthModifier = f, tab.WidthModifier, 0) .Insert(0.8f, 1.0f, new Animation(f => tab.Opacity = f, tab.Opacity, 0)) .Commit(tab, "Closing", easing: Easing.CubicOut, finished: (f, a) => { if (!a) { closingTabs.Remove(tab.Index); } }); }
internal void ReorderTab(DockNotebookTab tab, DockNotebookTab targetTabPosition) { if (tab == targetTabPosition) { return; } if (tab.Index > targetTabPosition.Index) { pages.RemoveAt(tab.Index); pages.Insert(targetTabPosition.Index, tab); } else { pages.Insert(targetTabPosition.Index + 1, tab); pages.RemoveAt(tab.Index); } UpdateIndexes(0); tabStrip.Update(); }
internal void ReorderTab(DockNotebookTab tab, DockNotebookTab targetTab) { if (tab == targetTab) { return; } int targetPos = targetTab.Index; if (tab.Index > targetTab.Index) { pages.RemoveAt(tab.Index); pages.Insert(targetPos, tab); } else { pages.Insert(targetPos + 1, tab); pages.RemoveAt(tab.Index); } IdeApp.Workbench.ReorderDocuments(tab.Index, targetPos); UpdateIndexes(Math.Min(tab.Index, targetPos)); tabStrip.Update(); }
public void StartCloseAnimation (DockNotebookTab tab) { closingTabs[tab.Index] = tab; new Animation (f => tab.WidthModifier = f, tab.WidthModifier, 0) .AddConcurrent (new Animation (f => tab.Opacity = f, tab.Opacity, 0), 0.8d, 1.0d) .Commit (tab, "Closing", easing: Easing.CubicOut, finished: (f, a) => { if (!a) closingTabs.Remove (tab.Index); }); }
internal void ShowContent (DockNotebookTab tab) { if (tab == currentTab) contentBox.Child = tab.Content; }
public void StartOpenAnimation (DockNotebookTab tab) { tab.WidthModifier = 0; new Animation (f => tab.WidthModifier = f) .AddConcurrent (new Animation (f => tab.Opacity = f), 0.0d, 0.2d) .Commit (tab, "Open", easing: Easing.CubicInOut); }
internal void OnCloseTab (DockNotebookTab tab) { if (TabClosed != null) TabClosed (this, new TabEventArgs () { Tab = tab }); }
internal void OnActivateTab (DockNotebookTab tab) { if (TabActivated != null) TabActivated (this, new TabEventArgs () { Tab = tab }); }
internal void ReorderTab (DockNotebookTab tab, DockNotebookTab targetTab) { if (tab == targetTab) return; int targetPos = targetTab.Index; if (tab.Index > targetTab.Index) { pages.RemoveAt (tab.Index); pages.Insert (targetPos, tab); } else { pages.Insert (targetPos + 1, tab); pages.RemoveAt (tab.Index); } IdeApp.Workbench.ReorderDocuments (tab.Index, targetPos); UpdateIndexes (Math.Min (tab.Index, targetPos)); tabStrip.Update (); }
public IDockNotebookTab InsertTab (int index) { var tab = new DockNotebookTab (this, tabStrip); if (index == -1) { pages.Add (tab); tab.Index = pages.Count - 1; } else { pages.Insert (index, tab); tab.Index = index; UpdateIndexes (index + 1); } pagesHistory.Add (tab); if (pages.Count == 1) CurrentTab = tab; tabStrip.StartOpenAnimation ((DockNotebookTab)tab); tabStrip.Update (); tabStrip.DropDownButton.Sensitive = pages.Count > 0; if (PageAdded != null) PageAdded (this, EventArgs.Empty); return tab; }
void DrawTab (Cairo.Context ctx, DockNotebookTab tab, Gdk.Rectangle allocation, Gdk.Rectangle tabBounds, bool highlight, bool active, bool dragging, Pango.Layout la) { // This logic is stupid to have here, should be in the caller! if (dragging) { tabBounds.X = (int) (tabBounds.X + (dragX - tabBounds.X) * dragXProgress); tabBounds.X = Clamp (tabBounds.X, tabStartX, tabEndX - tabBounds.Width); } int padding = LeftRightPadding; padding = (int) (padding * Math.Min (1.0, Math.Max (0.5, (tabBounds.Width - 30) / 70.0))); ctx.LineWidth = 1; LayoutTabBorder (ctx, allocation, tabBounds.Width, tabBounds.X, 0, active); ctx.ClosePath (); using (LinearGradient gr = new LinearGradient (tabBounds.X, TopBarPadding, tabBounds.X, allocation.Bottom)) { if (active) { gr.AddColorStop (0, Styles.BreadcrumbGradientStartColor.MultiplyAlpha (tab.Opacity)); gr.AddColorStop (1, Styles.BreadcrumbBackgroundColor.MultiplyAlpha (tab.Opacity)); } else { gr.AddColorStop (0, CairoExtensions.ParseColor ("f4f4f4").MultiplyAlpha (tab.Opacity)); gr.AddColorStop (1, CairoExtensions.ParseColor ("cecece").MultiplyAlpha (tab.Opacity)); } ctx.SetSource (gr); } ctx.Fill (); ctx.SetSourceColor (new Cairo.Color (1, 1, 1, .5).MultiplyAlpha (tab.Opacity)); LayoutTabBorder (ctx, allocation, tabBounds.Width, tabBounds.X, 1, active); ctx.Stroke (); ctx.SetSourceColor (Styles.BreadcrumbBorderColor.MultiplyAlpha (tab.Opacity)); LayoutTabBorder (ctx, allocation, tabBounds.Width, tabBounds.X, 0, active); ctx.StrokePreserve (); if (tab.GlowStrength > 0) { Gdk.Point mouse = tracker.MousePosition; using (var rg = new RadialGradient (mouse.X, tabBounds.Bottom, 0, mouse.X, tabBounds.Bottom, 100)) { rg.AddColorStop (0, new Cairo.Color (1, 1, 1, 0.4 * tab.Opacity * tab.GlowStrength)); rg.AddColorStop (1, new Cairo.Color (1, 1, 1, 0)); ctx.SetSource (rg); ctx.Fill (); } } else { ctx.NewPath (); } // Render Close Button (do this first so we can tell how much text to render) var ch = allocation.Height - TopBarPadding - BottomBarPadding + CloseImageTopOffset; var crect = new Gdk.Rectangle (tabBounds.Right - padding - CloseButtonSize + 3, tabBounds.Y + TopBarPadding + (ch - CloseButtonSize) / 2, CloseButtonSize, CloseButtonSize); tab.CloseButtonAllocation = crect; tab.CloseButtonAllocation.Inflate (2, 2); bool closeButtonHovered = tracker.Hovered && tab.CloseButtonAllocation.Contains (tracker.MousePosition) && tab.WidthModifier >= 1.0f; bool drawCloseButton = tabBounds.Width > 60 || highlight || closeButtonHovered; if (drawCloseButton) { DrawCloseButton (ctx, new Gdk.Point (crect.X + crect.Width / 2, crect.Y + crect.Height / 2), closeButtonHovered, tab.Opacity, tab.DirtyStrength); } // Render Text int w = tabBounds.Width - (padding * 2 + CloseButtonSize); if (!drawCloseButton) w += CloseButtonSize; int textStart = tabBounds.X + padding; ctx.MoveTo (textStart, tabBounds.Y + TopPadding + TextOffset + VerticalTextSize); if (!MonoDevelop.Core.Platform.IsMac && !MonoDevelop.Core.Platform.IsWindows) { // This is a work around for a linux specific problem. // A bug in the proprietary ATI driver caused TAB text not to draw. // If that bug get's fixed remove this HACK asap. la.Ellipsize = Pango.EllipsizeMode.End; la.Width = (int)(w * Pango.Scale.PangoScale); ctx.SetSourceColor (tab.Notify ? new Cairo.Color (0, 0, 1) : Styles.TabBarActiveTextColor); Pango.CairoHelper.ShowLayoutLine (ctx, la.GetLine (0)); } else { // ellipses are for space wasting ..., we cant afford that using (var lg = new LinearGradient (textStart + w - 5, 0, textStart + w + 3, 0)) { var color = tab.Notify ? new Cairo.Color (0, 0, 1) : Styles.TabBarActiveTextColor; color = color.MultiplyAlpha (tab.Opacity); lg.AddColorStop (0, color); color.A = 0; lg.AddColorStop (1, color); ctx.SetSource (lg); Pango.CairoHelper.ShowLayoutLine (ctx, la.GetLine (0)); } } la.Dispose (); }
void SetHighlightedTab (DockNotebookTab tab) { if (highlightedTab == tab) return; if (highlightedTab != null) { var tmp = highlightedTab; tmp.Animate ("Glow", f => tmp.GlowStrength = f, start: tmp.GlowStrength, end: 0); } if (tab != null) { tab.Animate ("Glow", f => tab.GlowStrength = f, start: tab.GlowStrength, end: 1); } highlightedTab = tab; QueueDraw (); }
void DrawTab(Cairo.Context ctx, DockNotebookTab tab, Gdk.Rectangle allocation, Gdk.Rectangle tabBounds, bool highlight, bool active, bool dragging, Pango.Layout la) { // This logic is stupid to have here, should be in the caller! if (dragging) { tabBounds.X = (int)(tabBounds.X + (dragX - tabBounds.X) * dragXProgress); tabBounds.X = Clamp(tabBounds.X, tabStartX, tabEndX - tabBounds.Width); } int padding = LeftRightPadding; padding = (int)(padding * Math.Min(1.0, Math.Max(0.5, (tabBounds.Width - 30) / 70.0))); ctx.LineWidth = 1; LayoutTabBorder(ctx, allocation, tabBounds.Width, tabBounds.X, 0, active); ctx.ClosePath(); using (LinearGradient gr = new LinearGradient(tabBounds.X, TopBarPadding, tabBounds.X, allocation.Bottom)) { if (active) { gr.AddColorStop(0, Styles.BreadcrumbGradientStartColor.MultiplyAlpha(tab.Opacity)); gr.AddColorStop(1, Styles.BreadcrumbBackgroundColor.MultiplyAlpha(tab.Opacity)); } else { gr.AddColorStop(0, CairoExtensions.ParseColor("f4f4f4").MultiplyAlpha(tab.Opacity)); gr.AddColorStop(1, CairoExtensions.ParseColor("cecece").MultiplyAlpha(tab.Opacity)); } ctx.Pattern = gr; } ctx.Fill(); ctx.Color = new Cairo.Color(1, 1, 1, .5).MultiplyAlpha(tab.Opacity); LayoutTabBorder(ctx, allocation, tabBounds.Width, tabBounds.X, 1, active); ctx.Stroke(); ctx.Color = Styles.BreadcrumbBorderColor.MultiplyAlpha(tab.Opacity); LayoutTabBorder(ctx, allocation, tabBounds.Width, tabBounds.X, 0, active); ctx.StrokePreserve(); if (tab.GlowStrength > 0) { Gdk.Point mouse = tracker.MousePosition; using (var rg = new RadialGradient(mouse.X, tabBounds.Bottom, 0, mouse.X, tabBounds.Bottom, 100)) { rg.AddColorStop(0, new Cairo.Color(1, 1, 1, 0.4 * tab.Opacity * tab.GlowStrength)); rg.AddColorStop(1, new Cairo.Color(1, 1, 1, 0)); ctx.Pattern = rg; ctx.Fill(); } } else { ctx.NewPath(); } // Render Close Button (do this first so we can tell how much text to render) var ch = allocation.Height - TopBarPadding - BottomBarPadding + CloseImageTopOffset; var crect = new Gdk.Rectangle(tabBounds.Right - padding - CloseButtonSize + 3, tabBounds.Y + TopBarPadding + (ch - CloseButtonSize) / 2, CloseButtonSize, CloseButtonSize); tab.CloseButtonAllocation = crect; tab.CloseButtonAllocation.Inflate(2, 2); bool closeButtonHovered = tracker.Hovered && tab.CloseButtonAllocation.Contains(tracker.MousePosition) && tab.WidthModifier >= 1.0f; bool drawCloseButton = tabBounds.Width > 60 || highlight || closeButtonHovered; if (drawCloseButton) { DrawCloseButton(ctx, new Gdk.Point(crect.X + crect.Width / 2, crect.Y + crect.Height / 2), closeButtonHovered, tab.Opacity, tab.DirtyStrength); } // Render Text int w = tabBounds.Width - (padding * 2 + CloseButtonSize); if (!drawCloseButton) { w += CloseButtonSize; } int textStart = tabBounds.X + padding; ctx.MoveTo(textStart, tabBounds.Y + TopPadding + TextOffset + VerticalTextSize); // ellipses are for space wasting ..., we cant afford that using (var lg = new LinearGradient(textStart + w - 5, 0, textStart + w + 3, 0)) { var color = tab.Notify ? new Cairo.Color(0, 0, 1) : Styles.TabBarActiveTextColor; color = color.MultiplyAlpha(tab.Opacity); lg.AddColorStop(0, color); color.A = 0; lg.AddColorStop(1, color); ctx.Pattern = lg; Pango.CairoHelper.ShowLayoutLine(ctx, la.GetLine(0)); } la.Dispose(); }
bool IsOverCloseButton (DockNotebookTab tab, int x, int y) { return tab != null && tab.CloseButtonAllocation.Contains (x, y); }
public void StartOpenAnimation (DockNotebookTab tab) { tab.WidthModifier = 0; new Animation (f => tab.WidthModifier = f) .Insert (0.0f, 0.2f, new Animation (f => tab.Opacity = f)) .Commit (tab, "Open", easing: Easing.CubicInOut); }
bool IsOverCloseButton(DockNotebookTab tab, int x, int y) { return(tab != null && tab.CloseButtonAllocation.Contains(x, y)); }
internal void ReorderTab (DockNotebookTab tab, DockNotebookTab targetTabPosition) { if (tab == targetTabPosition) return; if (tab.Index > targetTabPosition.Index) { pages.RemoveAt (tab.Index); pages.Insert (targetTabPosition.Index, tab); } else { pages.Insert (targetTabPosition.Index + 1, tab); pages.RemoveAt (tab.Index); } UpdateIndexes (0); tabStrip.Update (); }