[Monodevelop-patches-list] r2592 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Commands Gui Gui/Workbench Gui/Workbench/Layouts Internal/Codons/Commands
Lluis Sanchez <lluis@ximian.com>
lluis at mono-cvs.ximian.com
Thu Jun 9 11:59:06 EDT 2005
Author: lluis
Date: 2005-06-09 11:59:06 -0400 (Thu, 09 Jun 2005)
New Revision: 2592
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/AutostartCommands.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/CommandService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbenchLayout.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/WorkbenchMemento.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandCodon.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml
Log:
2005-06-09 Lluis Sanchez Gual <lluis at novell.com>
* Commands/AutostartCommands.cs: Use IWorkbench.CreateMemento to create
the default memento.
* Gui/Workbench/WorkbenchMemento.cs:
* Gui/Workbench/DefaultWorkbench.cs:
* Gui/IWorkbenchLayout.cs:
* Gui/Workbench/Layouts/SdiWorkspaceLayout.cs: Use dockable toolbars.
Load/Save the toolbar layout when starting/exiting. Added support for
IMementoCapable to IWorkbenchLayout.
* Gui/CommandService.cs: Added CommandManager property.
* Internal/Codons/Commands/CommandCodon.cs: Make sure that configuration
commands defined by the command system can be found.
* MonoDevelopCore.addin.xml: Added names to the toolbars. Added the
ToolbarList command.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-06-09 15:58:16 UTC (rev 2591)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-06-09 15:59:06 UTC (rev 2592)
@@ -1,3 +1,22 @@
+2005-06-09 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Commands/AutostartCommands.cs: Use IWorkbench.CreateMemento to create
+ the default memento.
+ * Gui/Workbench/WorkbenchMemento.cs:
+ * Gui/Workbench/DefaultWorkbench.cs:
+ * Gui/IWorkbenchLayout.cs:
+ * Gui/Workbench/Layouts/SdiWorkspaceLayout.cs: Use dockable toolbars.
+ Load/Save the toolbar layout when starting/exiting. Added support for
+ IMementoCapable to IWorkbenchLayout.
+
+ * Gui/CommandService.cs: Added CommandManager property.
+
+ * Internal/Codons/Commands/CommandCodon.cs: Make sure that configuration
+ commands defined by the command system can be found.
+
+ * MonoDevelopCore.addin.xml: Added names to the toolbars. Added the
+ ToolbarList command.
+
2005-06-07 Jacob Ilsø Christensen <jacobilsoe at gmail.com>
* Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs:
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/AutostartCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/AutostartCommands.cs 2005-06-09 15:58:16 UTC (rev 2591)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/AutostartCommands.cs 2005-06-09 15:59:06 UTC (rev 2592)
@@ -79,7 +79,7 @@
}
((Gtk.Window)WorkbenchSingleton.Workbench).ShowAll ();
- WorkbenchSingleton.Workbench.SetMemento ((IXmlConvertable)Runtime.Properties.GetProperty (workbenchMemento, new WorkbenchMemento ()));
+ WorkbenchSingleton.Workbench.SetMemento ((IXmlConvertable)Runtime.Properties.GetProperty (workbenchMemento, WorkbenchSingleton.Workbench.CreateMemento()));
((Gtk.Window)WorkbenchSingleton.Workbench).Visible = true;
WorkbenchSingleton.Workbench.RedrawAllComponents ();
((Gtk.Window)WorkbenchSingleton.Workbench).Present ();
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/CommandService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/CommandService.cs 2005-06-09 15:58:16 UTC (rev 2591)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/CommandService.cs 2005-06-09 15:59:06 UTC (rev 2592)
@@ -52,6 +52,10 @@
manager.CommandError += new CommandErrorHandler (OnCommandError);
}
+ public CommandManager CommandManager {
+ get { return manager; }
+ }
+
public void SetRootWindow (Gtk.Window root)
{
manager.SetRootWindow (root);
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbenchLayout.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbenchLayout.cs 2005-06-09 15:58:16 UTC (rev 2591)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbenchLayout.cs 2005-06-09 15:59:06 UTC (rev 2592)
@@ -15,7 +15,7 @@
/// implementation etc. it could be attached/detached at the runtime
/// to a workbench.
/// </summary>
- public interface IWorkbenchLayout
+ public interface IWorkbenchLayout: IMementoCapable
{
/// <summary>
/// The active workbench window.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs 2005-06-09 15:58:16 UTC (rev 2591)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs 2005-06-09 15:59:06 UTC (rev 2592)
@@ -43,8 +43,8 @@
bool closeAll = false;
- bool fullscreen;
- Rectangle normalBounds = new Rectangle(0, 0, 640, 480);
+ bool fullscreen;
+ Rectangle normalBounds = new Rectangle(0, 0, 640, 480);
private IWorkbenchLayout layout = null;
@@ -344,13 +344,15 @@
GetPosition (out x, out y);
GetSize (out width, out height);
if (GdkWindow.State == 0) {
- memento.Bounds = new Rectangle (x, y, width, height);
+ memento.Bounds = new Rectangle (x, y, width, height);
} else {
memento.Bounds = normalBounds;
}
memento.WindowState = GdkWindow.State;
- memento.FullScreen = fullscreen;
+ memento.FullScreen = fullscreen;
+ if (layout != null)
+ memento.LayoutMemento = layout.CreateMemento ();
return memento;
}
@@ -369,6 +371,9 @@
}
//GdkWindow.State = memento.WindowState;
FullScreen = memento.FullScreen;
+
+ if (layout != null && memento.LayoutMemento != null)
+ layout.SetMemento (memento.LayoutMemento);
}
Decorated = true;
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2005-06-09 15:58:16 UTC (rev 2591)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2005-06-09 15:59:06 UTC (rev 2592)
@@ -9,6 +9,8 @@
using System.IO;
using System.Collections;
using System.Drawing;
+using System.Xml;
+using System.Xml.Serialization;
using MonoDevelop.Core.Properties;
using MonoDevelop.Core.Services;
@@ -20,6 +22,7 @@
using MonoDevelop.Gui.Utils;
using MonoDevelop.Core.AddIns.Codons;
using MonoDevelop.Core.AddIns;
+using MonoDevelop.Commands;
namespace MonoDevelop.Gui
{
@@ -42,12 +45,14 @@
Window wbWindow;
Container rootWidget;
+ DockToolbarFrame toolbarFrame;
Dock dock;
DockLayout dockLayout;
DragNotebook tabControl;
EventHandler contextChangedHandler;
WorkbenchContextCodon[] contextCodons;
+ bool initialized;
public SdiWorkbenchLayout () {
contextChangedHandler = new EventHandler (OnContextChanged);
@@ -73,12 +78,13 @@
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++) {
- Gtk.HandleBox toolHandleBox = new Gtk.HandleBox ();
- toolHandleBox.Shadow = Gtk.ShadowType.None;
- toolHandleBox.Add (workbench.ToolBars[i]);
- vbox.PackStart (toolHandleBox, false, false, 0);
+ toolbarFrame.AddBar ((DockToolbar)workbench.ToolBars[i]);
}
}
@@ -88,7 +94,7 @@
Gtk.HBox dockBox = new HBox (false, 5);
dockBox.PackStart (dockBar, false, true, 0);
dockBox.PackStart (dock, true, true, 0);
- vbox.PackStart (dockBox, true, true, 0);
+ toolbarFrame.AddContent (dockBox);
// Create the notebook for the various documents.
tabControl = new DragNotebook ();
@@ -131,6 +137,21 @@
workbench.ContextChanged += contextChangedHandler;
}
+ public IXmlConvertable CreateMemento()
+ {
+ if (initialized)
+ return new SdiWorkbenchLayoutMemento (toolbarFrame.GetStatus ());
+ else
+ return new SdiWorkbenchLayoutMemento (new DockToolbarFrameStatus ());
+ }
+
+ public void SetMemento(IXmlConvertable memento)
+ {
+ initialized = true;
+ SdiWorkbenchLayoutMemento m = (SdiWorkbenchLayoutMemento) memento;
+ toolbarFrame.SetStatus (m.Status);
+ }
+
void OnTabsReordered (Widget widget, int oldPlacement, int newPlacement)
{
lock (workbench.ViewContentCollection) {
@@ -219,6 +240,7 @@
layouts.Add (value);
}
currentLayout = newLayout;
+ toolbarFrame.CurrentLayout = newLayout;
// persist the selected layout for the current context
Runtime.Properties.SetProperty ("MonoDevelop.Gui.SdiWorkbenchLayout." +
@@ -553,5 +575,41 @@
}
public event EventHandler ActiveWorkbenchWindowChanged;
+
+
+ internal class SdiWorkbenchLayoutMemento: IXmlConvertable
+ {
+ public DockToolbarFrameStatus Status;
+
+ public SdiWorkbenchLayoutMemento (DockToolbarFrameStatus status)
+ {
+ Status = status;
+ }
+
+ public object FromXmlElement (XmlElement element)
+ {
+ try {
+ StringReader r = new StringReader (element.OuterXml);
+ XmlSerializer s = new XmlSerializer (typeof(DockToolbarFrameStatus));
+ Status = (DockToolbarFrameStatus) s.Deserialize (r);
+ } catch {
+ Status = new DockToolbarFrameStatus ();
+ }
+ return this;
+ }
+
+ public XmlElement ToXmlElement (XmlDocument doc)
+ {
+ StringWriter w = new StringWriter ();
+ XmlSerializer s = new XmlSerializer (typeof(DockToolbarFrameStatus));
+ s.Serialize (w, Status);
+ w.Close ();
+
+ XmlDocumentFragment docFrag = doc.CreateDocumentFragment();
+ docFrag.InnerXml = w.ToString ();
+ return docFrag ["DockToolbarFrameStatus"];
+ }
+ }
}
+
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/WorkbenchMemento.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/WorkbenchMemento.cs 2005-06-09 15:58:16 UTC (rev 2591)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/WorkbenchMemento.cs 2005-06-09 15:59:06 UTC (rev 2592)
@@ -21,8 +21,9 @@
{
Gdk.WindowState windowstate = 0;
//FormWindowState defaultwindowstate = FormWindowState.Normal;
- Rectangle bounds = new Rectangle(0, 0, 640, 480);
- bool fullscreen = false;
+ Rectangle bounds = new Rectangle(0, 0, 640, 480);
+ bool fullscreen = false;
+ IXmlConvertable layoutMemento;
/*public FormWindowState DefaultWindowState {
get {
@@ -60,6 +61,15 @@
}
}
+ public IXmlConvertable LayoutMemento {
+ get {
+ return layoutMemento;
+ }
+ set {
+ layoutMemento = value;
+ }
+ }
+
/// <summary>
/// Creates a new instance of the <code>MdiWorkspaceMemento</code>.
/// </summary>
@@ -70,7 +80,7 @@
fullscreen = false;
}
- WorkbenchMemento(XmlElement element) : base ()
+ WorkbenchMemento(XmlElement element, IXmlConvertable defaultLayoutMemento) : base ()
{
try {
string[] boundstr = element.Attributes["bounds"].InnerText.Split(new char [] { ',' });
@@ -93,11 +103,18 @@
fullscreen = Boolean.Parse(element.Attributes["fullscreen"].InnerText);
} catch {
}
+
+ if (element.FirstChild is XmlElement && defaultLayoutMemento != null) {
+ XmlElement e = (XmlElement) element.FirstChild;
+ this.layoutMemento = (IXmlConvertable) defaultLayoutMemento.FromXmlElement (e);
+ } else {
+ this.layoutMemento = defaultLayoutMemento;
+ }
}
public object FromXmlElement(XmlElement element)
{
- return new WorkbenchMemento(element);
+ return new WorkbenchMemento(element, layoutMemento);
}
public XmlElement ToXmlElement(XmlDocument doc)
@@ -121,6 +138,11 @@
attr.InnerText = fullscreen.ToString();
element.Attributes.Append(attr);
+ if (LayoutMemento != null) {
+ XmlElement elayout = LayoutMemento.ToXmlElement (doc);
+ element.AppendChild (elayout);
+ }
+
return element;
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandCodon.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandCodon.cs 2005-06-09 15:58:16 UTC (rev 2591)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandCodon.cs 2005-06-09 15:59:06 UTC (rev 2592)
@@ -156,13 +156,20 @@
{
string id = codon.ID;
Type enumType = null;
+ string typeName = id;
+
int i = id.LastIndexOf (".");
if (i != -1)
- enumType = codon.AddIn.GetType (id.Substring (0,i));
+ typeName = id.Substring (0,i);
+ enumType = codon.AddIn.GetType (typeName);
+
if (enumType == null)
- enumType = Type.GetType (id.Substring (0,i));
+ enumType = Type.GetType (typeName);
+ if (enumType == null)
+ enumType = typeof(Command).Assembly.GetType (typeName);
+
if (enumType == null || !enumType.IsEnum)
throw new InvalidOperationException ("Could not find an enum type for the command '" + id + "'.");
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml 2005-06-09 15:58:16 UTC (rev 2591)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml 2005-06-09 15:59:06 UTC (rev 2592)
@@ -779,7 +779,7 @@
<!-- Main Toolbar -->
<Extension path = "/SharpDevelop/Workbench/ToolBar">
- <ItemSet id = "Standard">
+ <ItemSet id = "Standard" _label = "Standard">
<CommandItem id = "MonoDevelop.Commands.FileCommands.NewFile" />
<CommandItem id = "MonoDevelop.Commands.FileCommands.OpenFile" />
<CommandItem id = "MonoDevelop.Commands.FileCommands.Save" />
@@ -789,9 +789,9 @@
<CommandItem id = "MonoDevelop.Commands.EditCommands.Copy" />
<CommandItem id = "MonoDevelop.Commands.EditCommands.Paste" />
<CommandItem id = "MonoDevelop.Commands.EditCommands.Delete" />
- <SeparatorItem id = "CutSeparator" />
- <SeparatorItem id = "CompileSeparator" />
<!-- <CommandItem id = "MonoDevelop.Commands.ProjectCommands.ConfigurationSelector" />-->
+ </ItemSet>
+ <ItemSet id = "Build" _label = "Build">
<CommandItem id = "MonoDevelop.Commands.ProjectCommands.Build" />
<CommandItem id = "MonoDevelop.Commands.ProjectCommands.BuildSolution" />
<CommandItem id = "MonoDevelop.Commands.ProjectCommands.Run" />
@@ -861,6 +861,10 @@
</ItemSet>
<ItemSet id = "View" _label = "_View">
+ <ItemSet id = "ViewToolbars" _label = "Toolbars">
+ <CommandItem id = "MonoDevelop.Commands.CommandSystemCommands.ToolbarList" />
+ </ItemSet>
+ <SeparatorItem id = "ViewItemsSeparator0" />
<CommandItem id = "MonoDevelop.Commands.ViewCommands.ViewList" />
<SeparatorItem id = "ViewItemsSeparator" />
<ItemSet id = "ViewLayouts" _label = "_Layouts">
More information about the Monodevelop-patches-list
mailing list