[Monodevelop-patches-list] r2319 - trunk/MonoDevelop/Unused/Gdl
John Luke <jluke@cfl.rr.com>
jluke at mono-cvs.ximian.com
Tue Mar 8 22:16:42 EST 2005
Author: jluke
Date: 2005-03-08 22:16:41 -0500 (Tue, 08 Mar 2005)
New Revision: 2319
Modified:
trunk/MonoDevelop/Unused/Gdl/DockItem.cs
trunk/MonoDevelop/Unused/Gdl/DockLayout.cs
trunk/MonoDevelop/Unused/Gdl/DockObject.cs
trunk/MonoDevelop/Unused/Gdl/DockPlaceholder.cs
trunk/MonoDevelop/Unused/Gdl/TODO
Log:
move serialization to DockObject
Modified: trunk/MonoDevelop/Unused/Gdl/DockItem.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockItem.cs 2005-03-09 00:37:08 UTC (rev 2318)
+++ trunk/MonoDevelop/Unused/Gdl/DockItem.cs 2005-03-09 03:16:41 UTC (rev 2319)
@@ -203,7 +203,6 @@
}
set {
SetOrientation (value);
- EmitPropertyEvent ("Orientation");
}
}
Modified: trunk/MonoDevelop/Unused/Gdl/DockLayout.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockLayout.cs 2005-03-09 00:37:08 UTC (rev 2318)
+++ trunk/MonoDevelop/Unused/Gdl/DockLayout.cs 2005-03-09 03:16:41 UTC (rev 2319)
@@ -1,7 +1,6 @@
using System;
using System.Collections;
using System.IO;
-using System.Reflection;
using System.Xml;
using Gtk;
@@ -527,49 +526,15 @@
RecursiveBuild (node, null);
}
- string GetXmlName (Type t)
- {
- switch (t.ToString ()) {
- case "Gdl.Dock":
- return "dock";
- case "Gdl.DockItem":
- return "item";
- case "Gdl.DockNotebook":
- return "notebook";
- case "Gdl.DockPaned":
- return "paned";
- default:
- return "object";
- }
- }
-
void ForeachObjectSave (DockObject obj, XmlNode parent)
{
if (obj == null)
return;
- XmlElement element = doc.CreateElement (GetXmlName (obj.GetType ()));
-
- // get object exported attributes
- ArrayList exported = new ArrayList ();
- PropertyInfo[] props = obj.GetType ().GetProperties (BindingFlags.Public | BindingFlags.Instance);
- foreach (PropertyInfo p in props) {
- if (p.IsDefined (typeof (ExportLayoutAttribute), true))
- exported.Add (p);
- }
-
- foreach (PropertyInfo p in exported) {
- if (p.PropertyType.IsSubclassOf (typeof (System.Enum)))
- element.SetAttribute (p.Name.ToLower (), p.GetValue (obj, null).ToString ().ToLower ());
- else if (p.PropertyType == typeof (bool))
- element.SetAttribute (p.Name.ToLower (), ((bool) p.GetValue (obj, null)) ? "yes" : "no");
- else
- element.SetAttribute (p.Name.ToLower (), p.GetValue (obj, null).ToString ());
- }
-
+ XmlElement element = obj.ToXml (doc);
parent.AppendChild (element);
- // save placeholders for the object
+ // FIXME: save placeholders for the object
if (!(obj is DockPlaceholder)) {
//object list = this.Placeholders[obj];
//foreach (DockObject child in list)
Modified: trunk/MonoDevelop/Unused/Gdl/DockObject.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockObject.cs 2005-03-09 00:37:08 UTC (rev 2318)
+++ trunk/MonoDevelop/Unused/Gdl/DockObject.cs 2005-03-09 03:16:41 UTC (rev 2319)
@@ -1,5 +1,7 @@
// project created on 04/06/2004 at 6:37 P
using System;
+using System.Collections;
+using System.Reflection;
using System.Xml;
using Gtk;
@@ -138,6 +140,46 @@
{
}
+ string GetXmlName (Type t)
+ {
+ switch (t.ToString ()) {
+ case "Gdl.Dock":
+ return "dock";
+ case "Gdl.DockItem":
+ return "item";
+ case "Gdl.DockNotebook":
+ return "notebook";
+ case "Gdl.DockPaned":
+ return "paned";
+ default:
+ return "object";
+ }
+ }
+
+ public XmlElement ToXml (XmlDocument doc)
+ {
+ Type t = this.GetType ();
+ XmlElement element = doc.CreateElement (GetXmlName (t));
+
+ // get object exported attributes
+ ArrayList exported = new ArrayList ();
+ PropertyInfo[] props = t.GetProperties (BindingFlags.Public | BindingFlags.Instance);
+ foreach (PropertyInfo p in props) {
+ if (p.IsDefined (typeof (ExportLayoutAttribute), true))
+ exported.Add (p);
+ }
+
+ foreach (PropertyInfo p in exported) {
+ if (p.PropertyType.IsSubclassOf (typeof (System.Enum)))
+ element.SetAttribute (p.Name.ToLower (), p.GetValue (this, null).ToString ().ToLower ());
+ else if (p.PropertyType == typeof (bool))
+ element.SetAttribute (p.Name.ToLower (), ((bool) p.GetValue (this, null)) ? "yes" : "no");
+ else
+ element.SetAttribute (p.Name.ToLower (), p.GetValue (this, null).ToString ());
+ }
+ return element;
+ }
+
protected override void OnDestroyed ()
{
if (IsCompound) {
Modified: trunk/MonoDevelop/Unused/Gdl/DockPlaceholder.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockPlaceholder.cs 2005-03-09 00:37:08 UTC (rev 2318)
+++ trunk/MonoDevelop/Unused/Gdl/DockPlaceholder.cs 2005-03-09 03:16:41 UTC (rev 2319)
@@ -2,6 +2,7 @@
using System;
using System.Collections;
+using System.Xml;
using Gtk;
namespace Gdl
@@ -52,6 +53,7 @@
}
}
+ [ExportLayout]
public DockPlacement NextPlacement {
get {
if (placementStack != null && placementStack.Count != 0)
@@ -74,13 +76,19 @@
EmitPropertyEvent ("Sticky");
}
}
+
+ public override void FromXmlAfter (XmlNode node)
+ {
+ throw new NotImplementedException ();
+ // NextPlacement
+ }
- /*protected override void OnDestroyed ()
+ protected override void OnDestroyed ()
{
if (host != null)
OnDetached (false);
base.OnDestroyed ();
- }*/
+ }
protected override void OnAdded (Widget widget)
{
Modified: trunk/MonoDevelop/Unused/Gdl/TODO
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/TODO 2005-03-09 00:37:08 UTC (rev 2318)
+++ trunk/MonoDevelop/Unused/Gdl/TODO 2005-03-09 03:16:41 UTC (rev 2319)
@@ -1,7 +1,8 @@
- - restore size/position on de-iconify?
- proper license headers
- improve de-serialization (also use ExportLayoutAttribute?)
- fix notebook.Position after
- placeholders in layout store/restore
- - occasional redraw issues:
- http://www.xs4all.nl/~jeroen/screenshots/Screenshot-test.png
+ - docs
+
+potential new features
+ - restore size/position on de-iconify?
More information about the Monodevelop-patches-list
mailing list