[Monodevelop-patches-list] r2292 - trunk/MonoDevelop/Unused/Gdl

John Luke <jluke@cfl.rr.com> jluke at mono-cvs.ximian.com
Fri Mar 4 15:17:02 EST 2005


Author: jluke
Date: 2005-03-04 15:17:01 -0500 (Fri, 04 Mar 2005)
New Revision: 2292

Modified:
   trunk/MonoDevelop/Unused/Gdl/Dock.cs
   trunk/MonoDevelop/Unused/Gdl/DockItem.cs
   trunk/MonoDevelop/Unused/Gdl/DockLayout.cs
   trunk/MonoDevelop/Unused/Gdl/DockNotebook.cs
   trunk/MonoDevelop/Unused/Gdl/DockObject.cs
   trunk/MonoDevelop/Unused/Gdl/DockPaned.cs
   trunk/MonoDevelop/Unused/Gdl/DockPlaceholder.cs
   trunk/MonoDevelop/Unused/Gdl/GdlDockTest.cs
   trunk/MonoDevelop/Unused/Gdl/Makefile
   trunk/MonoDevelop/Unused/Gdl/TODO
Log:
lame reading of the layout.xml


Modified: trunk/MonoDevelop/Unused/Gdl/Dock.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/Dock.cs	2005-03-04 03:35:48 UTC (rev 2291)
+++ trunk/MonoDevelop/Unused/Gdl/Dock.cs	2005-03-04 20:17:01 UTC (rev 2292)
@@ -2,6 +2,7 @@
 
 using System;
 using System.Collections;
+using System.Xml;
 using Gtk;
 
 namespace Gdl
@@ -167,6 +168,21 @@
 					((Window)window).Resize (width, height);
 			}
 		}
+
+		// <dock name="__dock_1" floating="no" width="-1" height="-1" floatx="0" floaty="0">
+		public override void FromXml (XmlNode node)
+		{
+			string floating = node.Attributes["floating"].Value;
+			this.Floating = floating == "no" ? false : true;
+			string width = node.Attributes["width"].Value;
+			this.Width = int.Parse (width);
+			string height = node.Attributes["height"].Value;
+			this.Height = int.Parse (height);
+			string floatx = node.Attributes["floatx"].Value;
+			this.FloatX = int.Parse (floatx);
+			string floaty = node.Attributes["floaty"].Value;
+			this.FloatY = int.Parse (floaty);
+		}
 		
 		protected override void OnSizeRequested (ref Requisition requisition)
 		{

Modified: trunk/MonoDevelop/Unused/Gdl/DockItem.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockItem.cs	2005-03-04 03:35:48 UTC (rev 2291)
+++ trunk/MonoDevelop/Unused/Gdl/DockItem.cs	2005-03-04 20:17:01 UTC (rev 2292)
@@ -1,5 +1,6 @@
 // created on 06/06/2004 at 10:09 P
 using System;
+using System.Xml;
 using Gtk;
 
 namespace Gdl
@@ -305,6 +306,15 @@
 			if (Child != null)
 				invoker.Invoke (Child);
 		}
+
+		// <item name="Item1" orientation="vertical" locked="no"/>
+		public override void FromXml (XmlNode node)
+		{
+			string orientation = node.Attributes["orientation"].Value;
+			this.Orientation = orientation == "vertical" ? Orientation.Vertical : Orientation.Horizontal;
+			string locked = node.Attributes["locked"].Value;
+			this.Locked = locked == "no" ? false : true;
+		}
 		
 		protected override void OnSizeRequested (ref Requisition requisition)
 		{

Modified: trunk/MonoDevelop/Unused/Gdl/DockLayout.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockLayout.cs	2005-03-04 03:35:48 UTC (rev 2291)
+++ trunk/MonoDevelop/Unused/Gdl/DockLayout.cs	2005-03-04 20:17:01 UTC (rev 2292)
@@ -129,7 +129,9 @@
 							layouts.Add (n.Attributes["name"].Value);
 					}
 					UpdateLayoutsModel ();
-					return true;
+					// FIXME: for testing load the default
+					return LoadLayout (null);
+					// return true;
 				}
 				else {
 					doc = null;	
@@ -395,19 +397,52 @@
 
 		DockObject SetupObject (XmlNode node)
 		{
+			DockObject obj = null;
+			// FIXME: notebooks don't get names ...
+			if (node.Name == "notebook") {
+				DockNotebook dn = new DockNotebook ();
+				//dn.Master = master;
+				dn.FromXml (node);
+				return dn;
+			}
+			// FIXME: paned don't get names ...
+			if (node.Name == "paned") {
+				DockPaned dp = new DockPaned ();
+				//dp.Master = master;
+				dp.FromXml (node);
+				return dp;
+			}
+
 			string name = node.Attributes["name"].Value;
-			Console.WriteLine (name);
-			return null;
+			Console.WriteLine ("node: {0} name: {1}", node.Name, name);
+
+			if (name != null && name.Length > 0) {
+				obj = master.GetObject (name);
+			}
+			else {
+				Console.WriteLine ("While loading layout: don't know how to create a dock object whose nick is '{0}'", name);
+			}
+
+			// FIXME: all sorts of unserialization stuff
+			if (obj != null)
+				obj.FromXml (node);
+
+			return obj;
 		}
 
+		// this appears to create objects from the xml
 		void RecursiveBuild (XmlNode parentNode, DockObject parent)
 		{
+			Console.WriteLine ("RecursiveBuild: {0}, {1}", parentNode.Name, parent);
 			if (master == null || parentNode == null)
 				return;
 
 			DockObject obj;
 
 			// if parent is null, we should build toplevels
+			//if (parent == null)
+			//	parent = master.TopLevelDocks[0] as DockObject;
+
 			foreach (XmlNode node in parentNode.ChildNodes)
 			{
 				obj = SetupObject (node);

Modified: trunk/MonoDevelop/Unused/Gdl/DockNotebook.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockNotebook.cs	2005-03-04 03:35:48 UTC (rev 2291)
+++ trunk/MonoDevelop/Unused/Gdl/DockNotebook.cs	2005-03-04 20:17:01 UTC (rev 2292)
@@ -1,6 +1,7 @@
 // created on 07/06/2004 at 5:44 P
 
 using System;
+using System.Xml;
 using Gtk;
 
 namespace Gdl
@@ -91,6 +92,17 @@
 			if (w is DockObject)
 				Dock ((DockObject)w, dockInfo.position, dockInfo.data);
 		}
+
+		public override void FromXml (XmlNode node)
+		{
+			string orientation = node.Attributes["orientation"].Value;
+			this.Orientation = orientation == "vertical" ? Orientation.Vertical : Orientation.Horizontal;
+			string locked = node.Attributes["locked"].Value;
+			this.Locked = locked == "no" ? false : true;
+			string page = node.Attributes["page"].Value;
+			// FIXME: after property?
+			this.Page = int.Parse (page);
+		}
 		
 		public override void OnDocked (DockObject requestor, DockPlacement position, object data)
 		{

Modified: trunk/MonoDevelop/Unused/Gdl/DockObject.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockObject.cs	2005-03-04 03:35:48 UTC (rev 2291)
+++ trunk/MonoDevelop/Unused/Gdl/DockObject.cs	2005-03-04 20:17:01 UTC (rev 2292)
@@ -1,5 +1,6 @@
 // project created on 04/06/2004 at 6:37 P
 using System;
+using System.Xml;
 using Gtk;
 
 namespace Gdl
@@ -128,6 +129,11 @@
 			}
 		}
 
+		public virtual void FromXml (XmlNode node)
+		{
+			Console.WriteLine ("override this: {0}", this.GetType ());
+		}
+
 		protected override void OnDestroyed ()
 		{
 			if (IsCompound) {
@@ -262,10 +268,8 @@
 			DockObjectFlags |= DockObjectFlags.InDetach;
 			OnDetached (recursive);
 			DetachedHandler handler = Detached;
-			if (handler != null) {
-				DetachedArgs args = new DetachedArgs (recursive);
-				handler (this, args);
-			}
+			if (handler != null)
+				handler (this, new DetachedArgs (recursive));
 			DockObjectFlags &= ~(DockObjectFlags.InDetach);
 
 			Thaw ();		
@@ -277,7 +281,7 @@
 				return;
 				
 			if (master == null) {
-				Console.WriteLine ("Dock operation requested in a non-bound object {}.", this);
+				Console.WriteLine ("Dock operation requested in a non-bound object {0}.", this);
 				Console.WriteLine ("This might break.");
 			}
 

Modified: trunk/MonoDevelop/Unused/Gdl/DockPaned.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockPaned.cs	2005-03-04 03:35:48 UTC (rev 2291)
+++ trunk/MonoDevelop/Unused/Gdl/DockPaned.cs	2005-03-04 20:17:01 UTC (rev 2292)
@@ -1,6 +1,7 @@
 // created on 07/06/2004 at 5:43 P
 
 using System;
+using System.Xml;
 using Gtk;
 
 namespace Gdl
@@ -12,6 +13,10 @@
 
 		protected DockPaned (IntPtr raw) : base (raw) { }
 
+		public DockPaned () : this (Orientation.Horizontal)
+		{
+		}
+
 		public DockPaned (Orientation orientation)
 		{
 			CreateChild (orientation);
@@ -61,6 +66,17 @@
 			Child.Parent = this;
 			Child.Show ();
 		}
+
+		// <paned orientation="horizontal" locked="no" position="226">
+		public override void FromXml (XmlNode node)
+		{
+			string orientation = node.Attributes["orientation"].Value;
+			this.Orientation = orientation == "horizontal" ? Orientation.Horizontal : Orientation.Vertical;
+			string locked = node.Attributes["locked"].Value;
+			this.Locked = locked == "no" ? false : true;
+			string position = node.Attributes["position"].Value;
+			this.Position = int.Parse (position);
+		}
 		
 		protected override void OnAdded (Widget widget)
 		{

Modified: trunk/MonoDevelop/Unused/Gdl/DockPlaceholder.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockPlaceholder.cs	2005-03-04 03:35:48 UTC (rev 2291)
+++ trunk/MonoDevelop/Unused/Gdl/DockPlaceholder.cs	2005-03-04 20:17:01 UTC (rev 2292)
@@ -120,7 +120,7 @@
 		
 		public void DoExcursion ()
 		{
-			if (host != null && !Sticky && placementStack != null && host.IsCompound) {
+			if (host != null && !Sticky && placementStack != null && placementStack.Count > 0 && host.IsCompound) {
 				DockPlacement pos;
 				DockPlacement stack_pos = NextPlacement;
 				foreach (Widget child in host.Children) {

Modified: trunk/MonoDevelop/Unused/Gdl/GdlDockTest.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/GdlDockTest.cs	2005-03-04 03:35:48 UTC (rev 2291)
+++ trunk/MonoDevelop/Unused/Gdl/GdlDockTest.cs	2005-03-04 20:17:01 UTC (rev 2292)
@@ -84,6 +84,13 @@
 		box.PackEnd (button, false, true, 0);
 
 		app.ShowAll ();
+
+		// placeholders
+		DockPlaceholder ph1 = new DockPlaceholder ("ph1", dock, DockPlacement.Top, false);
+		DockPlaceholder ph2 = new DockPlaceholder ("ph2", dock, DockPlacement.Bottom, false);
+		DockPlaceholder ph3 = new DockPlaceholder ("ph3", dock, DockPlacement.Left, false);
+		DockPlaceholder ph4 = new DockPlaceholder ("ph4", dock, DockPlacement.Right, false);
+
 		Application.Run ();
 	}
 	

Modified: trunk/MonoDevelop/Unused/Gdl/Makefile
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/Makefile	2005-03-04 03:35:48 UTC (rev 2291)
+++ trunk/MonoDevelop/Unused/Gdl/Makefile	2005-03-04 20:17:01 UTC (rev 2292)
@@ -1,4 +1,5 @@
 CSC = mcs
+RUNTIME = mono
 GDL = MonoDevelop.Dock.dll
 TEST = dock-test.exe
 
@@ -26,11 +27,9 @@
 	DockItem.cs \
 	DockPlaceholder.cs \
 	DockObject.cs \
-	DockParamFlags.cs \
 	Dock.cs \
 	DockPaned.cs \
-	DockItemBehavior.cs \
-	IPersistLayout.cs
+	DockItemBehavior.cs
 
 all: $(GDL) $(TEST)
 
@@ -45,5 +44,5 @@
 	$(CSC) -out:$@ -r:$(GDL) -pkg:gtk-sharp-2.0 GdlDockTest.cs -codepage:utf8
 
 run-test: $(TEST)
-	mono $(TEST)
+	$(RUNTIME) $(TEST)
 

Modified: trunk/MonoDevelop/Unused/Gdl/TODO
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/TODO	2005-03-04 03:35:48 UTC (rev 2291)
+++ trunk/MonoDevelop/Unused/Gdl/TODO	2005-03-04 20:17:01 UTC (rev 2292)
@@ -3,3 +3,4 @@
  - fix:
 (<unknown>:21016): Gtk-CRITICAL **: gtk_widget_send_expose: assertion `GTK_WIDGET_REALIZED (widget)' failed
  - proper license headers
+ - remove DockParamFlags? it looks useless




More information about the Monodevelop-patches-list mailing list