static void OnProjectReloaded(object sender, EventArgs a) { if (WidgetNotebook.Page == -1) { return; } // Get the opened components int active = WidgetNotebook.Page; ArrayList pages = new ArrayList(); while (WidgetNotebook.NPages > 0) { DesignerView view = (DesignerView)WidgetNotebook.GetNthPage(0); pages.Add(view.Component.Name); WidgetNotebook.Remove(view); view.Dispose(); } openWindows.Clear(); // Reopen the components foreach (string s in pages) { WidgetInfo w = Project.GetWidget(s); if (w != null) { OpenWindow(w); } } WidgetNotebook.Page = active; }
public override void Dispose() { content.ContentChanged -= new EventHandler(OnTextContentChanged); content.DirtyChanged -= new EventHandler(OnTextDirtyChanged); IdeApp.Workbench.ActiveDocumentChanged -= new EventHandler(OnActiveDocumentChanged); content.Dispose(); // Remove and destroy the contents of the Notebook, since the destroy event is // not propagated to pages in some gtk versions. foreach (Gtk.Widget cw in notebook.Children) { Gtk.Widget lw = notebook.GetTabLabel(cw); notebook.Remove(cw); cw.Destroy(); if (lw != null) { lw.Destroy(); } } content = null; box = null; base.Dispose(); }
public static CloserTabLabel InsertTabPage (Notebook book, Widget page, string label) { var tab = new CloserTabLabel () { Text = label }; tab.Closer.Pressed += (sender, e) => { MainWindow.OnCloseSourceFile (tab.CloseKeyData); book.Remove (page); }; book.InsertPage (page, tab, book.NPages); tab.ShowAll (); return tab; }
/// <summary> /// Save the specified nb, Index and Filename. /// </summary> /// <param name='_nb'> /// Nb. /// </param> /// <param name='_Index'> /// Index. /// </param> /// <param name='_Filename'> /// Filename. /// </param> public static void Save(Notebook _nb, int _Index, string _Filename) { try { if (_Filename != "" && disable != true) { ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).Save (_Filename); int current = _nb.Page; string data = ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).GetDataSourceBuffer (); ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).Saved = true; ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).setDataBuffer (data); g_tmp = ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)); _nb.Remove (_nb.GetNthPage (_nb.Page)); AddTabFromFile (_nb, _Filename, current); _nb.Page = current; } } catch (Exception ex) { MessageBox.Show (ex.Message, cTerminus.g_programName, ButtonsType.Close, MessageType.Error); } }
Notebook CreateNewWindow(Notebook source, Widget page, int x, int y) { Helpers.ExternalWindow window; EventBox box; Notebook notebook; window = new Helpers.ExternalWindow (); if (page == timeline) { window.Title = Catalog.GetString ("Timeline"); } else if (page == dashboardhpaned) { window.Title = Catalog.GetString ("Analysis dashboard"); } else if (page == playspositionviewer1) { window.Title = Catalog.GetString ("Zonal tags viewer"); } notebook = new Notebook (); notebook.ShowTabs = false; notebook.CanFocus = false; //notebook.Group = source.Group; window.Add (notebook); window.SetDefaultSize (page.Allocation.Width, page.Allocation.Height); window.Move (x, y); window.ShowAll (); activeWindows.Add (window); window.DeleteEvent += (o, args) => { Widget pa = notebook.CurrentPageWidget; activeWindows.Remove (window); notebook.Remove (pa); Visible = true; source.AppendPage (pa, null); notebookHelper.UpdateTabs (); notebook.Destroy (); }; /* If we are remove the last visible page, hide the widget to * free the empty space for the rest of widgets */ int visiblePages = 0; for (int i = 0; i < source.NPages; i++) { if (source.GetNthPage (i).Visible) { visiblePages++; } } if (visiblePages == 1) { Visible = false; } return notebook; }