public virtual void ShowView (IViewContent content, bool bringToFront)
		{
			viewContentCollection.Add (content);
			
			if (PropertyService.Get ("SharpDevelop.LoadDocumentProperties", true) && content is IMementoCapable) {
				try {
					Properties memento = GetStoredMemento(content);
					if (memento != null) {
						((IMementoCapable)content).Memento = memento;
					}
				} catch (Exception e) {
					LoggingService.LogError ("Can't get/set memento : " + e.ToString());
				}
			}
			
			Gtk.Image mimeimage = null;
			
			if (content.StockIconId != null ) {
				mimeimage = new Gtk.Image ((IconId) content.StockIconId, IconSize.Menu );
			}
			else if (content.IsUntitled && content.UntitledName == null) {
				mimeimage = new Gtk.Image (DesktopService.GetPixbufForType ("gnome-fs-regular", Gtk.IconSize.Menu));
			} else {
				mimeimage = new Gtk.Image (DesktopService.GetPixbufForFile (content.ContentName ?? content.UntitledName, Gtk.IconSize.Menu));
			}			

			TabLabel tabLabel = new TabLabel (new Label (), mimeimage != null ? mimeimage : new Gtk.Image (""));
			tabLabel.CloseClicked += new EventHandler (closeClicked);			
			tabLabel.ClearFlag (WidgetFlags.CanFocus);
			SdiWorkspaceWindow sdiWorkspaceWindow = new SdiWorkspaceWindow (this, content, tabControl, tabLabel);
			sdiWorkspaceWindow.TitleChanged += delegate { SetWorkbenchTitle (); };
			sdiWorkspaceWindow.Closed += CloseWindowEvent;
			tabControl.InsertPage (sdiWorkspaceWindow, tabLabel, -1);
			tabLabel.Show ();
			
			if (bringToFront)
				content.WorkbenchWindow.SelectWindow();
		}
Esempio n. 2
0
        public virtual void ShowView(IViewContent content, bool bringToFront, DockNotebook notebook = null)
        {
            var mimeimage = PrepareShowView (content);
            var addToControl = notebook ?? DockNotebook.ActiveNotebook ?? tabControl;
            var tab = addToControl.AddTab ();

            SdiWorkspaceWindow sdiWorkspaceWindow = new SdiWorkspaceWindow (this, content, addToControl, tab);
            sdiWorkspaceWindow.TitleChanged += delegate { SetWorkbenchTitle (); };
            sdiWorkspaceWindow.Closed += CloseWindowEvent;
            sdiWorkspaceWindow.Show ();

            tab.Content = sdiWorkspaceWindow;
            if (mimeimage != null)
                tab.Icon = mimeimage;

            if (content.Project != null)
                content.Project.NameChanged += HandleProjectNameChanged;
            if (bringToFront)
                content.WorkbenchWindow.SelectWindow();

            // The insertion of the tab may have changed the active view (or maybe not, this is checked in OnActiveWindowChanged)
            OnActiveWindowChanged (null, null);
        }
Esempio n. 3
0
		public virtual void ShowView (ViewContent content, bool bringToFront, IViewDisplayBinding binding = null, DockNotebook notebook = null)
		{
			bool isFile = content.IsFile;
			if (!isFile) {
				try {
					isFile = File.Exists (content.ContentName);
				} catch { /*Ignore*/ }
			}

			string type;
			if (isFile) {
				type = System.IO.Path.GetExtension (content.ContentName);
				var mt = DesktopService.GetMimeTypeForUri (content.ContentName);
				if (!string.IsNullOrEmpty (mt))
					type += " (" + mt + ")";
			} else
				type = "(not a file)";

			var metadata = new Dictionary<string,string> () {
				{ "FileType", type },
				{ "DisplayBinding", content.GetType ().FullName },
			};

			if (isFile)
				metadata ["DisplayBindingAndType"] = type + " | " + content.GetType ().FullName;

			Counters.DocumentOpened.Inc (metadata);

			var mimeimage = PrepareShowView (content);
			var addToControl = notebook ?? DockNotebook.ActiveNotebook ?? tabControl;
			var tab = addToControl.AddTab ();

			SdiWorkspaceWindow sdiWorkspaceWindow = new SdiWorkspaceWindow (this, content, addToControl, tab);
			sdiWorkspaceWindow.TitleChanged += delegate { SetWorkbenchTitle (); };
			sdiWorkspaceWindow.Closed += CloseWindowEvent;
			sdiWorkspaceWindow.Show ();
			if (binding != null)
				DisplayBindingService.AttachSubWindows (sdiWorkspaceWindow, binding);

			sdiWorkspaceWindow.CreateCommandHandler ();

			tab.Content = sdiWorkspaceWindow;
			if (mimeimage != null)
				tab.Icon = mimeimage;

			if (content.Project != null)
				content.Project.NameChanged += HandleProjectNameChanged;
			if (bringToFront)
				content.WorkbenchWindow.SelectWindow();

			// The insertion of the tab may have changed the active view (or maybe not, this is checked in OnActiveWindowChanged)
			OnActiveWindowChanged (null, null);
		}
Esempio n. 4
0
		public virtual void ShowView (IViewContent content, bool bringToFront)
		{
			viewContentCollection.Add (content);
			
			if (PropertyService.Get ("SharpDevelop.LoadDocumentProperties", true) && content is IMementoCapable) {
				try {
					Properties memento = GetStoredMemento(content);
					if (memento != null) {
						((IMementoCapable)content).Memento = memento;
					}
				} catch (Exception e) {
					LoggingService.LogError ("Can't get/set memento : " + e.ToString());
				}
			}
			
			Gdk.Pixbuf mimeimage = null;
			
			if (content.StockIconId != null ) {
				mimeimage = ImageService.GetPixbuf (content.StockIconId, IconSize.Menu);
			}
			else if (content.IsUntitled && content.UntitledName == null) {
				mimeimage = DesktopService.GetPixbufForType ("gnome-fs-regular", Gtk.IconSize.Menu);
			} else {
				mimeimage = DesktopService.GetPixbufForFile (content.ContentName ?? content.UntitledName, Gtk.IconSize.Menu);
			}			

			var tab = tabControl.InsertTab (-1);

			SdiWorkspaceWindow sdiWorkspaceWindow = new SdiWorkspaceWindow (this, content, tabControl, tab);
			sdiWorkspaceWindow.TitleChanged += delegate { SetWorkbenchTitle (); };
			sdiWorkspaceWindow.Closed += CloseWindowEvent;
			sdiWorkspaceWindow.Show ();

			tab.Content = sdiWorkspaceWindow;
			if (mimeimage != null)
				tab.Icon = mimeimage;

			if (content.Project != null)
				content.Project.NameChanged += HandleProjectNameChanged;
			
			if (bringToFront)
				content.WorkbenchWindow.SelectWindow();

			// The insertion of the tab may have changed the active view (or maybe not, this is checked in OnActiveWindowChanged)
			OnActiveWindowChanged (null, null);
		}
		public DockNotebook InsertRight (SdiWorkspaceWindow window)
		{
			return Insert (window, container => {
				var box = new HPanedThin () { GrabAreaSize = 6 };
				var new_container = new DockNotebookContainer (tabControl);

				box.Pack1 (new_container, true, true);
				box.Pack2 (container, true, true);
				box.Position = Allocation.Width / 2;
				Child = box;
			});
		}
		public DockNotebook InsertLeft (SdiWorkspaceWindow window)
		{
			return Insert (window, container => {
				var box = new HPanedThin { GrabAreaSize = 6 };
				var new_container = new DockNotebookContainer (tabControl);

				box.Pack1 (container, true, true);
				box.Pack2 (new_container, true, true);
				Child = box;
			});
		}
		DockNotebook Insert (SdiWorkspaceWindow window, Action<DockNotebookContainer> callback)
		{
			var newNotebook = new SdiDragNotebook ((DefaultWorkbench)IdeApp.Workbench.RootWindow);

			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;
		}
		public static DockWindow MoveToFloatingWindow (SdiWorkspaceWindow workspaceWindow, int x, int y, int width, int height)
		{
			var window = new DockWindow ();
			var notebook = window.Container.GetFirstNotebook ();
			var tab = notebook.AddTab ();
			tab.Content = workspaceWindow;

			window.Title = DefaultWorkbench.GetTitle (workspaceWindow);

			workspaceWindow.SetDockNotebook (notebook, tab);

			window.Move (x, y);
			window.Resize (width, height);
			window.ShowAll ();

			return window;
		}
		public static DockWindow MoveToFloatingWindow (SdiWorkspaceWindow workspaceWindow)
		{
			return MoveToFloatingWindow (workspaceWindow, 0, 0, 640, 480);
		}