void CreateDefaultLayout() { contextCodons = (WorkbenchContextCodon[])(AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/Contexts").BuildChildItems(this)).ToArray(typeof(WorkbenchContextCodon)); PadContentCollection collection; // Set the pads specific of each context foreach (WorkbenchContextCodon codon in contextCodons) { collection = new PadContentCollection (); WorkbenchContext ctx = WorkbenchContext.GetContext (codon.ID); padCollections [ctx] = collection; foreach (ContextPadCodon padCodon in codon.Pads) { IPadContent pad = workbench.PadContentCollection [padCodon.ID]; if (pad != null) collection.Add (pad); } } //Runtime.LoggingService.Info(" Default Layout created."); dockLayout = new DockLayout (dock); if (System.IO.File.Exists (configFile)) { dockLayout.LoadFromFile (configFile); } else { dockLayout.LoadFromFile ("../data/options/DefaultEditingLayout.xml"); } SwitchContext (workbench.Context); }
void SwitchContext(WorkbenchContext ctxt) { PadContentCollection old = activePadCollection; // switch pad collections if (padCollections [ctxt] != null) activePadCollection = (PadContentCollection) padCollections [ctxt]; else // this is so, for unkwown contexts, we get the full set of pads activePadCollection = workbench.PadContentCollection; workbenchContext = ctxt; // get the list of layouts string ctxtPrefix = ctxt.Id + "."; string[] list = dockLayout.GetLayouts (false); layouts.Clear (); foreach (string name in list) { if (name.StartsWith (ctxtPrefix)) { layouts.Add (name.Substring (ctxtPrefix.Length)); } } // get the default layout for the new context from the property service CurrentLayout = Runtime.Properties.GetProperty ("MonoDevelop.Gui.SdiWorkbenchLayout." + ctxt.ToString (), "Default"); // make sure invalid pads for the new context are not visible foreach (IPadContent content in old) { if (!activePadCollection.Contains (content)) { DockItem item = dock.GetItemByName (content.Id); if (item != null) item.HideItem (); } } }
public void Detach() { workbench.ContextChanged -= contextChangedHandler; //Runtime.LoggingService.Info("Call to SdiWorkSpaceLayout.Detach"); dockLayout.SaveLayout (currentLayout); dockLayout.SaveToFile (configFile); rootWidget.Remove(((DefaultWorkbench)workbench).TopMenu); wbWindow.Remove(rootWidget); activePadCollection = null; }
public void Attach(IWorkbench wb) { DefaultWorkbench workbench = (DefaultWorkbench) wb; this.workbench = workbench; wbWindow = (Window) workbench; Gtk.VBox vbox = new VBox (false, 0); rootWidget = vbox; vbox.PackStart (workbench.TopMenu, false, false, 0); toolbarFrame = new CommandFrame (Runtime.Gui.CommandService.CommandManager); vbox.PackStart (toolbarFrame, true, true, 0); if (workbench.ToolBars != null) { for (int i = 0; i < workbench.ToolBars.Length; i++) { toolbarFrame.AddBar ((DockToolbar)workbench.ToolBars[i]); } } // Create the docking widget and add it to the window. dock = new Dock (); DockBar dockBar = new DockBar (dock); Gtk.HBox dockBox = new HBox (false, 5); dockBox.PackStart (dockBar, false, true, 0); dockBox.PackStart (dock, true, true, 0); toolbarFrame.AddContent (dockBox); // Create the notebook for the various documents. tabControl = new DragNotebook (); tabControl.Scrollable = true; tabControl.SwitchPage += new SwitchPageHandler (ActiveMdiChanged); tabControl.TabsReordered += new TabsReorderedHandler (OnTabsReordered); DockItem item = new DockItem ("Documents", "Documents", DockItemBehavior.Locked | DockItemBehavior.NoGrip); item.PreferredWidth = -2; item.PreferredHeight = -2; item.Add (tabControl); item.Show (); dock.AddItem (item, DockPlacement.Center); workbench.Add (vbox); vbox.PackEnd (Runtime.Gui.StatusBar.Control, false, true, 0); workbench.ShowAll (); foreach (IViewContent content in workbench.ViewContentCollection) ShowView (content); // by default, the active pad collection is the full set // will be overriden in CreateDefaultLayout() below activePadCollection = workbench.PadContentCollection; // create DockItems for all the pads foreach (IPadContent content in workbench.PadContentCollection) { AddPad (content, content.DefaultPlacement); } CreateDefaultLayout(); //RedrawAllComponents(); wbWindow.Show (); workbench.ContextChanged += contextChangedHandler; }
/// <summary> /// <para> /// Initializes a new instance of <see cref='.PadContentCollection'/> based on another <see cref='.PadContentCollection'/>. /// </para> /// </summary> /// <param name='value'> /// A <see cref='.PadContentCollection'/> from which the contents are copied /// </param> public PadContentCollection(PadContentCollection value) { this.AddRange(value); }
public IPadContentEnumerator(PadContentCollection mappings) { this.temp = ((IEnumerable)(mappings)); this.baseEnumerator = temp.GetEnumerator(); }
/// <summary> /// <para> /// Adds the contents of another <see cref='.PadContentCollection'/> to the end of the collection. /// </para> /// </summary> /// <param name='value'> /// A <see cref='.PadContentCollection'/> containing the objects to add to the collection. /// </param> /// <returns> /// <para>None.</para> /// </returns> /// <seealso cref='.PadContentCollection.Add'/> public void AddRange(PadContentCollection value) { for (int i = 0; (i < value.Count); i = (i + 1)) { this.Add(value[i]); } }