Exemple #1
0
		public EditorView(ViewContent content)
		{
			try {
				this.content = content;
				
				var editorWidget = content.Control.GetNativeWidget<Gtk.Widget> ();
				editorWidget.ShowAll ();
				MonoDevelop.Components.Control previewNative;
				if (Platform.Instance.IsMac)
				{
					var editor = new GtkEmbed2(editorWidget);
					var editorEto = editor.ToEto();
					preview = new PreviewEditorView(editorEto, null, null, () => content?.WorkbenchWindow?.Document?.Editor?.Text);
					var nspreview = XamMac2Helpers.ToNative(preview, true);
					var nsviewContainer = new NSViewContainer2(nspreview);
					previewNative = nsviewContainer;
				}
				else
				{
					preview = new PreviewEditorView(editorWidget.ToEto(), null, null, () => content?.WorkbenchWindow?.Document?.Editor?.Text);
					previewNative = Gtk2Helpers.ToNative(preview, true);
				}

				var commandRouterContainer = new CommandRouterContainer (previewNative, content, true);
				commandRouterContainer.ShowAll ();
				control = commandRouterContainer;

				content.DirtyChanged += content_DirtyChanged;
				IdeApp.Workbench.ActiveDocumentChanged += Workbench_ActiveDocumentChanged;
				ContentName = content.ContentName;

			} catch (Exception ex) {
				Debug.WriteLine ($"{ex}");
			}
		}
Exemple #2
0
		public EditorView(IViewContent content)
		{
			this.content = content;
			preview = new PreviewEditorView(content.Control.ToEto(), () => content?.WorkbenchWindow?.Document?.Editor?.Text);
			content.ContentChanged += content_ContentChanged;
			content.DirtyChanged += content_DirtyChanged;
			var commandRouterContainer = new CommandRouterContainer(preview.ToNative(true), content, true);
			commandRouterContainer.Show();
			control = commandRouterContainer;
			IdeApp.Workbench.ActiveDocumentChanged += Workbench_ActiveDocumentChanged;

			base.ContentName = content.ContentName;
		}
		public CombinedDesignView (IViewContent content)
		{
			this.content = content;
			if (content is IEditableTextBuffer) {
				((IEditableTextBuffer)content).CaretPositionSet += delegate {
					ShowPage (0);
				};
			}
			content.ContentChanged += new EventHandler (OnTextContentChanged);
			content.DirtyChanged += new EventHandler (OnTextDirtyChanged);
			
			notebook = new Gtk.Notebook ();
			
			// Main notebook
			
			notebook.TabPos = Gtk.PositionType.Bottom;
			notebook.ShowTabs = false;
			notebook.ShowBorder = false;
			notebook.Show ();
			box = new VBox ();
			
			// Bottom toolbar
			
			toolbar = new Toolbar ();
			toolbar.IconSize = IconSize.SmallToolbar;
			toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
			toolbar.ShowArrow = false;
			
			CommandRouterContainer crc = new CommandRouterContainer (content.Control, content, true);
			crc.Show ();
			AddButton (GettextCatalog.GetString ("Source Code"), crc).Active = true;
			
			toolbar.ShowAll ();
			
			box.PackStart (notebook, true, true, 0);
			box.PackStart (toolbar, false, false, 0);
			
			box.Show ();
			
			IdeApp.Workbench.ActiveDocumentChanged += new EventHandler (OnActiveDocumentChanged);
			content.Control.Realized += delegate {
				if (content != null && content.WorkbenchWindow != null) 
					content.WorkbenchWindow.ActiveViewContent = notebook.CurrentPageWidget == content.Control ? content : this;
			};
			notebook.SwitchPage += delegate {
				if (content != null && content.WorkbenchWindow != null) 
					content.WorkbenchWindow.ActiveViewContent = notebook.CurrentPageWidget == content.Control ? content : this;
			};
		}
		public CombinedDesignView (ViewContent content)
		{
			this.content = content;
	/* This code causes that chagnes in a version control view always select the source code view.
				if (content is IEditableTextBuffer) {
				((IEditableTextBuffer)content).CaretPositionSet += delegate {
					ShowPage (0);
				};
			}*/
			content.DirtyChanged += new EventHandler (OnTextDirtyChanged);
			
			CommandRouterContainer crc = new CommandRouterContainer (content.Control, content, true);
			crc.Show ();
			control = crc;
			
			IdeApp.Workbench.ActiveDocumentChanged += new EventHandler (OnActiveDocumentChanged);
		}