public SdiWorkspaceWindow (DefaultWorkbench workbench, IViewContent content, Notebook tabControl, TabLabel tabLabel) : base () { this.workbench = workbench; this.tabControl = tabControl; this.content = content; this.tabLabel = tabLabel; this.tabPage = content.Control; content.WorkbenchWindow = this; content.ContentNameChanged += new EventHandler(SetTitleEvent); content.DirtyChanged += new EventHandler(SetTitleEvent); content.BeforeSave += new EventHandler(BeforeSave); content.ContentChanged += new EventHandler (OnContentChanged); ShadowType = ShadowType.None; box = new VBox (); box.PackStart (content.Control); Add (box); box.Show (); SetTitleEvent(null, null); commandHandler = new ViewCommandHandlers (this); Show (); }
public SdiWorkspaceWindow (DefaultWorkbench workbench, IViewContent content, Notebook tabControl, TabLabel tabLabel) : base () { this.workbench = workbench; this.tabControl = tabControl; this.content = content; this.tabLabel = tabLabel; this.tabPage = content.Control; ShadowType = ShadowType.None; box = new VBox (); Add (box); box.PackStart (content.Control); fileTypeCondition.SetFileName (content.ContentName ?? content.UntitledName); extensionContext = AddinManager.CreateExtensionContext (); extensionContext.RegisterCondition ("FileType", fileTypeCondition); content.WorkbenchWindow = this; content.ContentNameChanged += new EventHandler(SetTitleEvent); content.DirtyChanged += new EventHandler(SetTitleEvent); content.BeforeSave += new EventHandler(BeforeSave); content.ContentChanged += new EventHandler (OnContentChanged); box.Show (); SetTitleEvent(null, null); commandHandler = new ViewCommandHandlers (this); Show (); }
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(); }
public bool CloseWindow (bool force, bool fromMenu, int pageNum) { bool wasActive = workbench.ActiveWorkbenchWindow == this; WorkbenchWindowEventArgs args = new WorkbenchWindowEventArgs (force, wasActive); args.Cancel = false; OnClosing (args); if (args.Cancel) return false; if (fromMenu == true) { workbench.RemoveTab (tabControl.PageNum(this)); } else { workbench.RemoveTab (pageNum); } OnClosed (args); content.ContentNameChanged -= new EventHandler(SetTitleEvent); content.DirtyChanged -= new EventHandler(SetTitleEvent); content.BeforeSave -= new EventHandler(BeforeSave); content.ContentChanged -= new EventHandler (OnContentChanged); content.WorkbenchWindow = null; if (subViewContents != null) { foreach (IAttachableViewContent sv in subViewContents) { subViewNotebook.Remove (sv.Control); sv.Dispose (); } this.subViewContents = null; subViewNotebook.Remove (content.Control); } DetachFromPathedDocument (); content.Dispose (); box.Destroy (); this.subViewToolbar = null; this.separatorItem = null; this.content = null; this.subViewNotebook = null; this.tabControl = null; tabLabel.Destroy (); this.tabLabel = null; this.tabPage = null; Destroy (); return true; }
private void ExecuteQueryThreaded (IPooledDbConnection connection, DataSet result, object state) { connection.Release (); TimeSpan duration = DateTime.Now.Subtract (queryStart); DispatchService.GuiDispatch (delegate () { notebook.ShowAll (); string msg = String.Concat ( AddinCatalog.GetPluralString ("Query executed ({0} result table)", "Query executed ({0} result tables)", result.Tables.Count), Environment.NewLine, AddinCatalog.GetString ("Query duration: {0}", duration.ToString ()) ); SetQueryState (false, String.Format (msg, result.Tables.Count)); }); if (stoppedQueries.Contains (state)) { stoppedQueries.Remove (state); return; } if (result != null) { foreach (DataTable table in result.Tables) { DispatchService.GuiDispatch (delegate () { MonoDevelop.Database.Components.DataGrid grid = new MonoDevelop.Database.Components.DataGrid (); grid.DataSource = table; grid.DataBind (); string msg = String.Concat (Environment.NewLine, AddinCatalog.GetString ("Table"), ": ",table.TableName, Environment.NewLine, "\t", AddinCatalog.GetString ("Affected Rows"), ": ", table.Rows.Count); status.Buffer.Text += msg; TabLabel label = new TabLabel (new Label (table.TableName), ImageService.GetImage ("md-db-table", IconSize.Menu)); label.CloseClicked += new EventHandler (OnResultTabClose); notebook.AppendPage (grid, label); notebook.ShowAll (); this.Document.ReadOnly = false; notebook.Page = notebook.NPages -1; }); } } if (result == null || result.Tables.Count == 0) { DispatchService.GuiDispatch (delegate () { status.Buffer.Text += AddinCatalog.GetString ("No Results"); this.Document.ReadOnly = false; }); } }
private ReplView AddRepl(string title = "REPL") { var repl = new ReplView (); repl.PromptString = "csharp> "; repl.PromptMultiLineString = "+ "; repl.ConsoleInput += OnViewConsoleInput; repl.SetFont (customFont); repl.ShadowType = Gtk.ShadowType.None; var tabLabel = new MDComponents.TabLabel (new Label (title), emptyImage); notebook.AppendPage (repl, tabLabel); if (notebook.NPages < 2) notebook.ShowTabs = false; else notebook.ShowTabs = true; tabLabel.CloseClicked += (object sender, EventArgs e) => { Stop (repl); }; notebook.ShowAll (); return repl; }