コード例 #1
0
ファイル: SdiWorkspaceWindow.cs プロジェクト: ywscr/Pinta
        public SdiWorkspaceWindow(IViewContent content, Pinta.Docking.DockNotebook.DockNotebook tabControl, DockNotebookTab tabLabel) : base()
        {
            this.tabControl = tabControl;
            this.content    = content;
            this.tab        = tabLabel;
            this.tabPage    = content.Control;

            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;
            content.BeforeSave         += new EventHandler(BeforeSave);
            content.ContentChanged     += new EventHandler(OnContentChanged);
            box.Show();
            Add(box);

            SetTitleEvent(null, null);
        }
コード例 #2
0
ファイル: SdiWorkspaceWindow.cs プロジェクト: ywscr/Pinta
 internal void SetDockNotebook(Pinta.Docking.DockNotebook.DockNotebook tabControl, DockNotebookTab tabLabel)
 {
     this.tabControl = tabControl;
     this.tab        = tabLabel;
     this.tabPage    = content.Control;
     SetTitleEvent(null, null);
     SetDockNotebookTabTitle();
 }
コード例 #3
0
ファイル: PlaceholderWindow.cs プロジェクト: ywscr/Pinta
        void PlaceInHoverNotebook(DockNotebook notebook, DockNotebookTab tab, Rectangle allocation, int ox, int oy)
        {
            var window = (SdiWorkspaceWindow)tab.Content;
            var newTab = hoverNotebook.AddTab(window);

            window.SetDockNotebook(hoverNotebook, newTab);
            window.SelectWindow();
        }
コード例 #4
0
ファイル: DockWindow.cs プロジェクト: msiyer/Pinta
		public DockWindow () : base (Gtk.WindowType.Toplevel)
		{
			allWindows.Add (this);

			notebook = new DockNotebook ();
			notebook.NavigationButtonsVisible = false;
			Child = new DockNotebookContainer (notebook);
			notebook.InitSize ();
		}
コード例 #5
0
ファイル: DockWindow.cs プロジェクト: ywscr/Pinta
        public DockWindow() : base(Gtk.WindowType.Toplevel)
        {
            allWindows.Add(this);

            notebook = new DockNotebook();
            notebook.NavigationButtonsVisible = false;
            Child = new DockNotebookContainer(notebook);
            notebook.InitSize();
        }
コード例 #6
0
ファイル: DockNotebookContainer.cs プロジェクト: msiyer/Pinta
		public DockNotebookContainer (DockNotebook tabControl, bool isMasterTab = false)
		{
			this.isMasterTab = isMasterTab;
			this.tabControl = tabControl;
			Child = tabControl;
			
            DockNotebookManager.AddContainer (this);

			if (!isMasterTab)
				tabControl.PageRemoved += HandlePageRemoved;
		}
コード例 #7
0
        public DockNotebookContainer(DockNotebook tabControl, bool isMasterTab = false)
        {
            this.isMasterTab = isMasterTab;
            this.tabControl  = tabControl;
            Child            = tabControl;

            DockNotebookManager.AddContainer(this);

            if (!isMasterTab)
            {
                tabControl.PageRemoved += HandlePageRemoved;
            }
        }
コード例 #8
0
ファイル: PlaceholderWindow.cs プロジェクト: ywscr/Pinta
        static void PlaceInFloatingFrame(DockNotebook notebook, DockNotebookTab tab, Rectangle allocation, int ox, int oy)
        {
            var newWindow   = new DockWindow();
            var newNotebook = newWindow.Container.GetFirstNotebook();
            var newTab      = newNotebook.AddTab();

            var workspaceWindow = (SdiWorkspaceWindow)tab.Content;

            newTab.Content = workspaceWindow;
            // JONTODO
            //newWindow.Title = DefaultWorkbench.GetTitle (workspaceWindow);

            workspaceWindow.SetDockNotebook(newNotebook, newTab);
            newWindow.Move(ox - w / 2, oy - h / 2);
            newWindow.Resize(w, h);
            newWindow.ShowAll();
            DockNotebook.ActiveNotebook = newNotebook;
        }
コード例 #9
0
ファイル: CanvasPad.cs プロジェクト: msiyer/Pinta
		public void Initialize (DockFrame workspace, Menu padMenu)
		{
            var tab = new DockNotebook () {
                NavigationButtonsVisible = false
            };

            NotebookContainer = new DockNotebookContainer (tab, true);

            tab.InitSize ();

            var canvas_dock = workspace.AddItem ("Canvas");
            canvas_dock.Behavior = DockItemBehavior.Locked;
            canvas_dock.Expand = true;

            canvas_dock.DrawFrame = false;
            canvas_dock.Label = Catalog.GetString ("Canvas");
            canvas_dock.Content = NotebookContainer;
        }
コード例 #10
0
ファイル: PlaceholderWindow.cs プロジェクト: ywscr/Pinta
        public void PlaceWindow(DockNotebook notebook)
        {
            try {
                //IdeApp.Workbench.LockActiveWindowChangeEvent ();
                var allocation = Allocation;
                Destroy();

                if (placementDelegate != null)
                {
                    var tab = notebook.CurrentTab;
                    notebook.RemoveTab(tab.Index, true);
                    placementDelegate(notebook, tab, allocation, curX, curY);
                }
                else
                {
                    ((SdiWorkspaceWindow)frame.Content).SelectWindow();
                }
            } finally {
                //IdeApp.Workbench.UnlockActiveWindowChangeEvent ();
            }
        }
コード例 #11
0
        DockNotebook Insert(SdiWorkspaceWindow window, Action <DockNotebookContainer> callback)
        {
            var newNotebook = new DockNotebook();

            newNotebook.NavigationButtonsVisible = false;
            newNotebook.InitSize();
            var newContainer = new DockNotebookContainer(newNotebook);

            newNotebook.PageRemoved += HandlePageRemoved;

            if (window != null)
            {
                var newTab = newNotebook.AddTab(window);
                window.SetDockNotebook(newNotebook, newTab);
            }
            Remove(Child);

            callback(newContainer);

            tabControl.InitSize();
            ShowAll();
            return(newNotebook);
        }
コード例 #12
0
        /// <summary>
        /// Returns the previous notebook in the same window
        /// </summary>
        public DockNotebook GetPreviousNotebook(DockNotebook current)
        {
            var container     = (DockNotebookContainer)current.Parent;
            var rootContainer = current.Container;

            if (container == rootContainer)
            {
                return(null);
            }

            Widget curChild = container;
            var    paned    = (Paned)container.Parent;

            do
            {
                if (paned.Child2 == curChild)
                {
                    return(((DockNotebookContainer)paned.Child1).GetLastNotebook());
                }
                curChild = paned;
                paned    = paned.Parent as Paned;
            }while (paned != null);
            return(null);
        }
コード例 #13
0
ファイル: DockNotebookContainer.cs プロジェクト: msiyer/Pinta
		/// <summary>
		/// Returns the previous notebook in the same window
		/// </summary>
		public DockNotebook GetPreviousNotebook (DockNotebook current)
		{
			var container = (DockNotebookContainer)current.Parent;
			var rootContainer = current.Container;
			if (container == rootContainer)
				return null;

			Widget curChild = container;
			var paned = (Paned)container.Parent;
			do {
				if (paned.Child2 == curChild)
					return ((DockNotebookContainer)paned.Child1).GetLastNotebook ();
				curChild = paned;
				paned = paned.Parent as Paned;
			}
			while (paned != null);
			return null;
		}
コード例 #14
0
ファイル: PlaceholderWindow.cs プロジェクト: msiyer/Pinta
		public void ShowPlaceholder (int x, int y)
		{
			hoverNotebook = null;

			// TODO: Handle z-ordering of floating windows.
			int ox = 0, oy = 0;
			foreach (var notebook in allNotebooks) {
				if (notebook.GdkWindow == null)
					continue;

				int ox2, oy2;
				notebook.ParentWindow.GetOrigin (out ox2, out oy2);
				var alloc = notebook.Allocation;
				ox2 += alloc.X;
				ox2 += alloc.Y;
				if (ox2 <= x && x <= ox2 + alloc.Width && oy2 <= y && y <= oy2 + alloc.Height) {
					hoverNotebook = notebook;
					TransientFor = (Gtk.Window) hoverNotebook.Toplevel;
					ox = ox2;
					oy = oy2;
					break;
				}
			}

			if (CanPlaceInHoverNotebook ()) {
				var container = hoverNotebook.Container;
				var alloc = hoverNotebook.Allocation;
				var targetTabCount = hoverNotebook.TabCount;
				var overTabStrip = y <= oy + hoverNotebook.BarHeight;

				if (hoverNotebook.Tabs.Contains (frame))
					targetTabCount--; // Current is going to be removed, so it doesn't count

				if (targetTabCount > 0 && x <= ox + alloc.Width / 3 && !overTabStrip) {
					if (container.AllowLeftInsert) {
						Relocate (
							ox,
							oy,
							alloc.Width / 2,
							alloc.Height,
							false
						);
						placementDelegate = delegate(DockNotebook arg1, DockNotebookTab tab, Rectangle allocation2, int x2, int y2) {
							var window = (SdiWorkspaceWindow)tab.Content;
							container.InsertLeft (window);
							window.SelectWindow ();
						};
						return;
					}
				}

				if (targetTabCount > 0 && x >= ox + alloc.Width - alloc.Width / 3 && !overTabStrip) {
					if (container.AllowRightInsert) {
						Relocate (
							ox + alloc.Width / 2,
							oy,
							alloc.Width / 2,
							alloc.Height,
							false
						);
						placementDelegate = delegate(DockNotebook arg1, DockNotebookTab tab, Rectangle allocation2, int x2, int y2) {
							var window = (SdiWorkspaceWindow)tab.Content;
							container.InsertRight (window);
							window.SelectWindow ();
						};
						return;
					}
				}

				Relocate (
					ox, 
					oy, 
					alloc.Width, 
					alloc.Height, 
					false
				); 
				if (!hoverNotebook.Tabs.Contains (frame))
					placementDelegate = PlaceInHoverNotebook;
				else
					placementDelegate = null;
				return;
			}

			Hide ();
			placementDelegate = PlaceInFloatingFrame;
			titleWindow.SetDectorated (true);
		}
コード例 #15
0
 internal DockNotebookTab(DockNotebook notebook, TabStrip strip)
 {
     this.notebook = notebook;
     this.strip    = strip;
 }
コード例 #16
0
ファイル: DockNotebookContainer.cs プロジェクト: msiyer/Pinta
		DockNotebook Insert (SdiWorkspaceWindow window, Action<DockNotebookContainer> callback)
		{
			var newNotebook = new DockNotebook ();

			newNotebook.NavigationButtonsVisible = false;
			newNotebook.InitSize ();
			var newContainer = new DockNotebookContainer (newNotebook);
			newNotebook.PageRemoved += HandlePageRemoved;

			if (window != null) {
				var newTab = newNotebook.AddTab (window);
				window.SetDockNotebook (newNotebook, newTab);
			}
			Remove (Child);

			callback (newContainer);

			tabControl.InitSize ();
			ShowAll ();
			return newNotebook;
		}
コード例 #17
0
ファイル: PlaceholderWindow.cs プロジェクト: msiyer/Pinta
		void PlaceInHoverNotebook (DockNotebook notebook, DockNotebookTab tab, Rectangle allocation, int ox, int oy)
		{
			var window = (SdiWorkspaceWindow)tab.Content;
			var newTab = hoverNotebook.AddTab (window); 
			window.SetDockNotebook (hoverNotebook, newTab); 
			window.SelectWindow ();
		}
コード例 #18
0
        public TabStrip(DockNotebook notebook)
        {
            if (notebook == null)
            {
                throw new ArgumentNullException("notebook");
            }
            TabWidth    = 125;
            TargetWidth = 125;
            tracker     = new MouseTracker(this);
            GtkWorkarounds.FixContainerLeak(this);

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

            var arr = new ImageView(tabbarPrevImage);

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

            arr = new ImageView(tabbarNextImage);
            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   += (sender, e) => QueueResize();
            notebook.PageRemoved += (sender, e) => QueueResize();

            closingTabs = new Dictionary <int, DockNotebookTab> ();
        }
コード例 #19
0
ファイル: PlaceholderWindow.cs プロジェクト: msiyer/Pinta
		public void PlaceWindow (DockNotebook notebook)
		{
			try {
                //IdeApp.Workbench.LockActiveWindowChangeEvent ();
				var allocation = Allocation;
				Destroy ();

				if (placementDelegate != null) {
					var tab = notebook.CurrentTab;
					notebook.RemoveTab (tab.Index, true); 
					placementDelegate (notebook, tab, allocation, curX, curY);
				} else {
					((SdiWorkspaceWindow)frame.Content).SelectWindow ();
				}
			} finally {
                //IdeApp.Workbench.UnlockActiveWindowChangeEvent ();
			}
		}
コード例 #20
0
ファイル: DockNotebookTab.cs プロジェクト: msiyer/Pinta
		internal DockNotebookTab (DockNotebook notebook, TabStrip strip)
		{
			this.notebook = notebook;
			this.strip = strip;
		}
コード例 #21
0
ファイル: PlaceholderWindow.cs プロジェクト: ywscr/Pinta
        public void ShowPlaceholder(int x, int y)
        {
            hoverNotebook = null;

            // TODO: Handle z-ordering of floating windows.
            int ox = 0, oy = 0;

            foreach (var notebook in allNotebooks)
            {
                if (notebook.GdkWindow == null)
                {
                    continue;
                }

                int ox2, oy2;
                notebook.ParentWindow.GetOrigin(out ox2, out oy2);
                var alloc = notebook.Allocation;
                ox2 += alloc.X;
                ox2 += alloc.Y;
                if (ox2 <= x && x <= ox2 + alloc.Width && oy2 <= y && y <= oy2 + alloc.Height)
                {
                    hoverNotebook = notebook;
                    TransientFor  = (Gtk.Window)hoverNotebook.Toplevel;
                    ox            = ox2;
                    oy            = oy2;
                    break;
                }
            }

            if (CanPlaceInHoverNotebook())
            {
                var container      = hoverNotebook.Container;
                var alloc          = hoverNotebook.Allocation;
                var targetTabCount = hoverNotebook.TabCount;
                var overTabStrip   = y <= oy + hoverNotebook.BarHeight;

                if (hoverNotebook.Tabs.Contains(frame))
                {
                    targetTabCount--;                     // Current is going to be removed, so it doesn't count
                }
                if (targetTabCount > 0 && x <= ox + alloc.Width / 3 && !overTabStrip)
                {
                    if (container.AllowLeftInsert)
                    {
                        Relocate(
                            ox,
                            oy,
                            alloc.Width / 2,
                            alloc.Height,
                            false
                            );
                        placementDelegate = delegate(DockNotebook arg1, DockNotebookTab tab, Rectangle allocation2, int x2, int y2) {
                            var window = (SdiWorkspaceWindow)tab.Content;
                            container.InsertLeft(window);
                            window.SelectWindow();
                        };
                        return;
                    }
                }

                if (targetTabCount > 0 && x >= ox + alloc.Width - alloc.Width / 3 && !overTabStrip)
                {
                    if (container.AllowRightInsert)
                    {
                        Relocate(
                            ox + alloc.Width / 2,
                            oy,
                            alloc.Width / 2,
                            alloc.Height,
                            false
                            );
                        placementDelegate = delegate(DockNotebook arg1, DockNotebookTab tab, Rectangle allocation2, int x2, int y2) {
                            var window = (SdiWorkspaceWindow)tab.Content;
                            container.InsertRight(window);
                            window.SelectWindow();
                        };
                        return;
                    }
                }

                Relocate(
                    ox,
                    oy,
                    alloc.Width,
                    alloc.Height,
                    false
                    );
                if (!hoverNotebook.Tabs.Contains(frame))
                {
                    placementDelegate = PlaceInHoverNotebook;
                }
                else
                {
                    placementDelegate = null;
                }
                return;
            }

            Hide();
            placementDelegate = PlaceInFloatingFrame;
            titleWindow.SetDectorated(true);
        }
コード例 #22
0
ファイル: TabStrip.cs プロジェクト: msiyer/Pinta
		public TabStrip (DockNotebook notebook)
		{
			if (notebook == null)
				throw new ArgumentNullException ("notebook");
			TabWidth = 125;
			TargetWidth = 125;
			tracker = new MouseTracker (this);
			GtkWorkarounds.FixContainerLeak (this);

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

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

			arr = new ImageView (tabbarNextImage);
			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 += (sender, e) => QueueResize ();
			notebook.PageRemoved += (sender, e) => QueueResize ();

			closingTabs = new Dictionary<int, DockNotebookTab> ();
		}
コード例 #23
0
ファイル: PlaceholderWindow.cs プロジェクト: msiyer/Pinta
		static void PlaceInFloatingFrame (DockNotebook notebook, DockNotebookTab tab, Rectangle allocation, int ox, int oy)
		{
			var newWindow = new DockWindow ();
			var newNotebook = newWindow.Container.GetFirstNotebook ();
			var newTab = newNotebook.AddTab ();

			var workspaceWindow = (SdiWorkspaceWindow)tab.Content;
			newTab.Content = workspaceWindow;
			// JONTODO
            //newWindow.Title = DefaultWorkbench.GetTitle (workspaceWindow);

			workspaceWindow.SetDockNotebook (newNotebook, newTab);
			newWindow.Move (ox - w / 2, oy - h / 2);
			newWindow.Resize (w, h);
			newWindow.ShowAll ();
			DockNotebook.ActiveNotebook = newNotebook;
		}