void SetCurrentView(int newIndex)
        {
            IAttachableViewContent subViewContent;

            int oldIndex = subViewNotebook.CurrentPage;

            subViewNotebook.CurrentPage = newIndex;

            if (oldIndex != -1)
            {
                subViewContent = viewContents[oldIndex] as IAttachableViewContent;
                if (subViewContent != null)
                {
                    subViewContent.Deselected();
                }
            }

            subViewContent = viewContents[newIndex] as IAttachableViewContent;
            if (subViewContent != null)
            {
                subViewContent.Selected();
            }

            DetachFromPathedDocument();

            MonoDevelop.Ide.Gui.Content.IPathedDocument pathedDocument;
            if (newIndex < 0 || newIndex == viewContents.IndexOf(ViewContent))
            {
                pathedDocument = Document != null?Document.GetContent <IPathedDocument> () : (IPathedDocument)ViewContent.GetContent(typeof(IPathedDocument));
            }
            else
            {
                pathedDocument = (IPathedDocument)viewContents[newIndex].GetContent(typeof(IPathedDocument));
            }

            if (pathedDocument != null)
            {
                AttachToPathedDocument(pathedDocument);
            }

            foreach (var t in documentToolbars)
            {
                t.Value.Container.Visible = ActiveViewContent == t.Key;
            }

            OnActiveViewContentChanged(new ActiveViewContentEventArgs(this.ActiveViewContent));
        }
Пример #2
0
        void SetCurrentView(int newIndex)
        {
            BaseViewContent subViewContent;

            int oldIndex = subViewNotebook.CurrentPage;

            subViewNotebook.CurrentPage = newIndex;

            if (oldIndex != -1)
            {
                subViewContent = viewContents[oldIndex] as BaseViewContent;
                if (subViewContent != null)
                {
                    subViewContent.OnDeselected();
                }
            }

            subViewContent = viewContents[newIndex] as BaseViewContent;

            DetachFromPathedDocument();

            MonoDevelop.Ide.Gui.Content.IPathedDocument pathedDocument;
            if (newIndex < 0 || newIndex == viewContents.IndexOf((BaseViewContent)ViewContent))
            {
                pathedDocument = Document != null?Document.GetContent <IPathedDocument> () : (IPathedDocument)ViewContent.GetContent(typeof(IPathedDocument));
            }
            else
            {
                pathedDocument = (IPathedDocument)viewContents[newIndex].GetContent(typeof(IPathedDocument));
            }

            var toolbarVisible = false;

            foreach (var t in documentToolbars)
            {
                toolbarVisible = ActiveViewContent == t.Key;
                t.Value.Container.GetNativeWidget <Gtk.Widget> ().Visible = toolbarVisible;
            }

            if (pathedDocument != null && !toolbarVisible)
            {
                AttachToPathedDocument(pathedDocument);
            }

            if (subViewContent != null)
            {
                subViewContent.OnSelected();
            }

            OnActiveViewContentChanged(new ActiveViewContentEventArgs(this.ActiveViewContent));
        }
Пример #3
0
        void SetCurrentView(int newIndex)
        {
            subViewNotebook.CurrentPage = newIndex;

            if (oldIndex > 0)
            {
                IAttachableViewContent secondaryViewContent = subViewContents[oldIndex - 1] as IAttachableViewContent;
                if (secondaryViewContent != null)
                {
                    secondaryViewContent.Deselected();
                }
            }

            if (subViewNotebook.CurrentPage > 0)
            {
                IAttachableViewContent secondaryViewContent = subViewContents[subViewNotebook.CurrentPage - 1] as IAttachableViewContent;
                if (secondaryViewContent != null)
                {
                    secondaryViewContent.Selected();
                }
            }
            oldIndex = subViewNotebook.CurrentPage;
            DetachFromPathedDocument();

            MonoDevelop.Ide.Gui.Content.IPathedDocument pathedDocument;
            if (oldIndex <= 0)
            {
                pathedDocument = Document != null?Document.GetContent <MonoDevelop.Ide.Gui.Content.IPathedDocument> () : ViewContent.GetContent <MonoDevelop.Ide.Gui.Content.IPathedDocument> ();
            }
            else
            {
                pathedDocument = subViewContents[oldIndex - 1].GetContent <MonoDevelop.Ide.Gui.Content.IPathedDocument> ();
            }

            if (pathedDocument != null)
            {
                AttachToPathedDocument(pathedDocument);
            }
            OnActiveViewContentChanged(new ActiveViewContentEventArgs(this.ActiveViewContent));
        }