Пример #1
0
        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);
        }
Пример #2
0
 internal void SetDockNotebook(DockNotebook tabControl, DockNotebookTab tabLabel)
 {
     this.tabControl = tabControl;
     this.tab        = tabLabel;
     SetTitleEvent(false);
     SetDockNotebookTabTitle();
 }
Пример #3
0
        async Task <bool> OpenDocumentsInContainer(ProgressMonitor pm, FilePath baseDir, List <Tuple <Document, string> > docViews, List <DocumentUserPrefs> list, DockNotebookContainer container)
        {
            int          currentNotebook = -1;
            DockNotebook nb = container.GetFirstNotebook();

            foreach (var doc in list)
            {
                string fileName = baseDir.Combine(doc.FileName).FullPath;
                if (GetDocument(fileName) == null && File.Exists(fileName))
                {
                    if (doc.NotebookId != currentNotebook)
                    {
                        if (currentNotebook != -1 || nb == null)
                        {
                            nb = container.InsertRight(null);
                        }
                        currentNotebook = doc.NotebookId;
                    }
                    // TODO: Get the correct project.
                    var document = await documentManager.BatchOpenDocument(pm, fileName, null, doc.Line, doc.Column, nb);

                    if (document != null)
                    {
                        var t = new Tuple <Document, string> (document, fileName);
                        docViews.Add(t);
                    }
                }
            }
            return(true);
        }
Пример #4
0
 internal void SetDockNotebook(DockNotebook tabControl, DockNotebookTab tabLabel)
 {
     this.tabControl = tabControl;
     this.tab        = tabLabel;
     this.tabPage    = content.Control;
     SetTitleEvent(null, null);
     SetDockNotebookTabTitle();
 }
Пример #5
0
        public TabStrip(DockNotebook notebook)
        {
            TabWidth    = 125;
            TargetWidth = 125;
            tracker     = new MouseTracker(this);
            GtkWorkarounds.FixContainerLeak(this);

            this.notebook = notebook;
            WidgetFlags  |= Gtk.WidgetFlags.AppPaintable;
            Events       |= Gdk.EventMask.PointerMotionMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonPressMask;

            var arr = new Gtk.Image(Gdk.Pixbuf.LoadFromResource("tabbar-prev.png"));

            arr.HeightRequest         = arr.WidthRequest = 10;
            PreviousButton            = new Button(arr);
            PreviousButton.Relief     = ReliefStyle.None;
            PreviousButton.CanDefault = PreviousButton.CanFocus = false;

            arr = new Gtk.Image(Gdk.Pixbuf.LoadFromResource("tabbar-next.png"));
            arr.HeightRequest     = arr.WidthRequest = 10;
            NextButton            = new Button(arr);
            NextButton.Relief     = ReliefStyle.None;
            NextButton.CanDefault = NextButton.CanFocus = false;

            DropDownButton            = new MenuButton();
            DropDownButton.Relief     = ReliefStyle.None;
            DropDownButton.CanDefault = DropDownButton.CanFocus = false;

            PreviousButton.ShowAll();
            NextButton.ShowAll();
            DropDownButton.ShowAll();

            PreviousButton.Name = "MonoDevelop.DockNotebook.BarButton";
            NextButton.Name     = "MonoDevelop.DockNotebook.BarButton";
            DropDownButton.Name = "MonoDevelop.DockNotebook.BarButton";

            PreviousButton.Parent = this;
            NextButton.Parent     = this;
            DropDownButton.Parent = this;

            children.Add(PreviousButton);
            children.Add(NextButton);
            children.Add(DropDownButton);

            tracker.HoveredChanged += (sender, e) => {
                if (!tracker.Hovered)
                {
                    SetHighlightedTab(null);
                    UpdateTabWidth(tabEndX - tabStartX);
                    QueueDraw();
                }
            };

            notebook.PageAdded   += (object sender, EventArgs e) => QueueResize();
            notebook.PageRemoved += (object sender, EventArgs e) => QueueResize();

            closingTabs = new Dictionary <int, DockNotebookTab> ();
        }
Пример #6
0
        async Task <bool> OpenDocumentsInContainer(ProgressMonitor pm, FilePath baseDir, List <Tuple <Document, string> > docViews, List <DocumentUserPrefs> list, DockNotebookContainer container)
        {
            int          currentNotebook = -1;
            DockNotebook nb = container.GetFirstNotebook();

            foreach (var doc in list)
            {
                string fileName = baseDir.Combine(doc.FileName).FullPath;
                if (GetDocument(fileName) == null && File.Exists(fileName))
                {
                    if (doc.NotebookId != currentNotebook)
                    {
                        if (currentNotebook != -1 || nb == null)
                        {
                            nb = container.InsertRight(null);
                        }
                        currentNotebook = doc.NotebookId;
                    }
                    // TODO: Get the correct project.
                    var document = await documentManager.BatchOpenDocument(pm, fileName, null, doc.Line, doc.Column, nb);

                    if (document != null)
                    {
                        try {
                            var tab = ((SdiWorkspaceWindow)document.Window).DockNotebookTab;
                            if (tab != null)
                            {
                                tab.IsPinned = doc.IsPinned;
                            }
                        } catch (Exception ex) {
                            LoggingService.LogInternalError(ex);
                        }

                        var t = new Tuple <Document, string> (document, fileName);
                        docViews.Add(t);
                    }
                }
            }
            return(true);
        }
Пример #7
0
		public TabStrip (DockNotebook notebook)
		{
			TabWidth = 125;
			TargetWidth = 125;
			tracker = new MouseTracker (this);
			GtkWorkarounds.FixContainerLeak (this);

			this.notebook = notebook;
			WidgetFlags |= Gtk.WidgetFlags.AppPaintable;
			Events |= Gdk.EventMask.PointerMotionMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonPressMask;

			var arr = new Xwt.ImageView (tabbarPrevImage);
			arr.HeightRequest = arr.WidthRequest = 10;
			PreviousButton = new Button (arr.ToGtkWidget ());
			PreviousButton.Relief = ReliefStyle.None;
			PreviousButton.CanDefault = PreviousButton.CanFocus = false;

			arr = new Xwt.ImageView (tabbarNextImage);
			arr.HeightRequest = arr.WidthRequest = 10;
			NextButton = new Button (arr.ToGtkWidget ());
			NextButton.Relief = ReliefStyle.None;
			NextButton.CanDefault = NextButton.CanFocus = false;

			DropDownButton = new MenuButton ();
			DropDownButton.Relief = ReliefStyle.None;
			DropDownButton.CanDefault = DropDownButton.CanFocus = false;

			PreviousButton.ShowAll ();
			NextButton.ShowAll ();
			DropDownButton.ShowAll ();

			PreviousButton.Name = "MonoDevelop.DockNotebook.BarButton";
			NextButton.Name = "MonoDevelop.DockNotebook.BarButton";
			DropDownButton.Name = "MonoDevelop.DockNotebook.BarButton";

			PreviousButton.Parent = this;
			NextButton.Parent = this;
			DropDownButton.Parent = this;

			children.Add (PreviousButton);
			children.Add (NextButton);
			children.Add (DropDownButton);

			tracker.HoveredChanged += (sender, e) => {
				if (!tracker.Hovered) {
					SetHighlightedTab (null);
					UpdateTabWidth (tabEndX - tabStartX);
					QueueDraw ();
				}
			};

			notebook.PageAdded += (object sender, EventArgs e) => QueueResize ();
			notebook.PageRemoved += (object sender, EventArgs e) => QueueResize ();

			closingTabs = new Dictionary<int, DockNotebookTab> ();
		}
Пример #8
0
		internal DockNotebookTab (DockNotebook notebook, TabStrip strip)
		{
			this.notebook = notebook;
			this.strip = strip;
		}
Пример #9
0
 static void AddNotebookDocuments(UserPreferencesEventArgs args, List <DocumentUserPrefs> files, DockNotebook notebook, int notebookId)
 {
     foreach (var tab in notebook.Tabs)
     {
         var sdiwindow = (SdiWorkspaceWindow)tab.Content;
         var document  = sdiwindow.Document;
         if (!String.IsNullOrEmpty(document.FileName))
         {
             var dp = CreateDocumentPrefs(args, document);
             dp.NotebookId = notebookId;
             files.Add(dp);
         }
     }
 }
Пример #10
0
 internal DockNotebookTab(DockNotebook notebook, TabStrip strip)
 {
     this.notebook = notebook;
     this.strip    = strip;
 }