[Monodevelop-patches-list] r1700 - trunk/MonoDevelop/src/Libraries/Gdl

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sun Jun 6 22:08:56 EDT 2004


Author: tberman
Date: 2004-06-06 22:08:56 -0400 (Sun, 06 Jun 2004)
New Revision: 1700

Added:
   trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs
Modified:
   trunk/MonoDevelop/src/Libraries/Gdl/DockMaster.cs
   trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs
   trunk/MonoDevelop/src/Libraries/Gdl/Gdl.prjx
   trunk/MonoDevelop/src/Libraries/Gdl/Makefile.Gdl
Log:
checking in more code that wont compile


Added: trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs	2004-06-06 23:01:28 UTC (rev 1699)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs	2004-06-07 02:08:56 UTC (rev 1700)
@@ -0,0 +1,101 @@
+// created on 06/06/2004 at 10:09 P
+using System;
+using Gtk;
+
+namespace Gdl
+{
+	public class DockItem : DockObject
+	{
+
+		private static bool has_grip;
+		
+		private Gtk.Widget child;
+		private DockItemBehavior behavior;
+		private Gtk.Orientation orientation;
+		private uint resize = 1;
+		private int dragoff_x;
+		private int dragoff_y;
+		private Gtk.Menu menu;
+		private bool grip_shown;
+		private Gtk.Widget grip;
+		private uint grip_size;
+		private Gtk.Widget tab_label;
+		private int preferred_width;
+		private int preferred_height;
+		private DockPlaceholder ph;
+		private int start_x;
+		private int start_y;
+		
+		static DockItem ()
+		{
+			Gtk.Rc.ParseString ("style \"gdl-dock-item-default\" {\n" +
+			                    "xthickness = 0\n" +
+			                    "ythickness = 0\n" + 
+			                    "}\n" + 
+			                    "class \"Gdl_DockItem\" " +
+			                    "style : gtk \"gdl-dock-item-default\"\n");
+		}
+		
+		public override bool IsCompound {
+			get { return false; }
+		}
+		
+		public Gtk.Orientation Orientation {
+			get { return orientation; }
+			set { orientation = value; }
+		}
+		
+		public bool Resize {
+			get { return this.resize; }
+			set {
+				this.resize = value;
+				this.QueueResize ();
+			}
+		}
+		
+		public DockItemBehavior Behavior {
+			get { return behavior; }
+			set {
+				DockItemBehavior old_beh = this.behavior;
+				this.behavior = value;
+				if (((old_beh ^ this.behavior) & DockItemBehavior.Locked) != 0) {
+					/* PORT THIS:
+					                if (GDL_DOCK_OBJECT_GET_MASTER (item))
+                    g_signal_emit_by_name (GDL_DOCK_OBJECT_GET_MASTER (item),
+                                           "layout_changed");
+                g_object_notify (g_object, "locked");
+                gdl_dock_item_showhide_grip (item);
+                */
+                }
+			}
+		}
+		
+		public bool Locked {
+			get { return !((this.behavior & DockItemBehavior.Locked) != 0); }
+			set {
+				DockItemBehavior old_beh = this.behavior;
+				if (value)
+					this.behavior |= DockItemBehavior.Locked;
+				else
+					this.behavior &= ~(DockItemBehavior.Locked);
+				if ((old_beh ^ this.behavior) != 0) {
+					//PORT THIS:
+					//gdl_dock_item_showhide_grip (item /*this*/);
+					//g_object_notify (g_object, "behavior");
+					//if (GDL_DOCK_OBJECT_GET_MASTER (item))
+					//    g_signal_emit_by_name (GDL_DOCK_OBJECT_GET_MASTER (item)), "layout_changed");
+				}
+			}
+		}
+		
+		public int PreferredWidth {
+			get { return this.preferred_width; }
+			set { this.preferred_width = value; }
+		}
+		
+		public int PreferredHeight {
+			get { return this.preferred_height; }
+			set { this.preferred_height = value; }
+		}
+	}
+}
\ No newline at end of file

Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockMaster.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockMaster.cs	2004-06-06 23:01:28 UTC (rev 1699)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockMaster.cs	2004-06-07 02:08:56 UTC (rev 1700)
@@ -135,7 +135,207 @@
 				y = root_y - win_y;
 				may_dock = dock.DockRequest (x, y, my_request);
 			} else {
-				foreach (Dock top_dock in toplevel_docks)
+				foreach (Dock top_dock in toplevel_docks) {
+					top_dock.GdkWindow.GetOrigin (out win_x, out win_y);
+					x = root_x - win_x;
+					y = root_y - win_y;
+					may_dock = top_dock.DockRequest (x, y, my_request);
+					if (may_dock)
+						break;
+				}
+			}
+			if (!may_dock) {
+				dock = null;
+				Gtk.Requisition req;
+				my_request.Target = Dock.GetTopLevel (request.Applicant);
+				my_request.Position = DockPlacement.Floating;
+				((DockItem)request.Applicant).PreferredSize (out req);
+				Gdk.Rectangle rect = new Gdk.Rectangle ();
+				rect.Width = req.Width;
+				rect.Height = req.Height;
+				rect.X = root_x - ((DockItem)request.Applicant).DragOffX;
+				rect.Y = root_y - ((DockItem)request.Applicant).DragOffY;
+				my_request.Rect = rect;
+				my_request.Extra = my_request.Rect;
+			}
+			
+			if (!(my_request.Rect.X == request.Rect.X &&
+			      my_request.Rect.Y == request.Rect.Y &&
+			      my_request.Rect.Width == request.Rect.Width &&
+			      my_request.Rect.Height == request.Rect.Height &&
+			      dock == this.rect_owner)) {
+				if (this.rect_drawn) {
+					XorRect ();
+				}
+			}
+			
+			request = my_request;
+			this.rect_owner = dock;
+			
+			if (!this.rect_drawn) {
+				XorRect ();
+			}
 		}
+		
+		public void XorRect ()
+		{
+			if (this.drag_request == null)
+				return;
+			this.rect_drawn = !(this.rect_drawn);
+			if (this.rect_owner != null) {
+				this.rect_owner.XorRect (this.drag_request.Rect);
+				return;
+			}
+			
+			Gdk.Rectangle rect = this.drag_request.Rect;
+			Gdk.Window window = Gdk.Global.DefaultRootWindow;
+			if (this.root_xor_gc == null) {
+				Gdk.GCValues values = new Gdk.GCValues ();
+				values.Function = Gdk.Function.Invert;
+				values.SubwindowMode = Gdk.SubwindowMode.IncludeInferiors;
+				this.root_xor_gc = new Gdk.GC (window);
+				this.root_xor_gc.SetValues (values, Gdk.GCValuesMask.Function | Gdk.GCValuesMask.Subwindow);
+			}
+			this.root_xor_gc.SetLineAttributes (1, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Bevel);
+			this.root_xor_gc.SetDashes (1, new sbyte[] {1, 1}, 2);
+			window.DrawRectangle (this.root_xor_gc, false, rect.X, rect.Y, rect.Width, rect.Height);
+			this.root_xor_gc.SetDashes (0, new sbyte[] {1, 1}, 2);
+			window.DrawRectangle (this.root_xor_gc, false, rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
+		}
+		
+		public void Add (DockObject objekt)
+		{
+			if (objekt == null)
+				return;
+			if (!objekt.IsAutomatic) {
+				if (objekt.Name == null)
+					objekt.Name = "__dock_" + this.number++;
+				DockObject found_object = this.dock_objects[objekt.Name];
+				if (found_object != null) {
+					Console.WriteLine ("Unable to add object, name taken");
+				} else {
+					this.dock_objects[objekt.Name] = objekt;
+				}
+			}
+			
+			if (objekt is Dock) {
+				if (this.toplevel_docks == null) {
+					this.controller = objekt;
+					this.toplevel_docks = new ArrayList ();
+				}
+				if (((Dock)objekt).Floating) {
+					this.toplevel_docks.Insert (0, objekt);
+				} else {
+					this.toplevel_docks.Add (objekt);
+				}
+				/* PORT THIS:
+				        g_signal_connect (object, "dock",
+                          G_CALLBACK (item_dock_cb), master);
+				*/
+			} else if (objekt is DockItem) {
+				/* PORT THIS:
+				        g_signal_connect (object, "dock_drag_begin",
+                          G_CALLBACK (gdl_dock_master_drag_begin), master);
+        g_signal_connect (object, "dock_drag_motion",
+                          G_CALLBACK (gdl_dock_master_drag_motion), master);
+        g_signal_connect (object, "dock_drag_end",
+                          G_CALLBACK (gdl_dock_master_drag_end), master);
+        g_signal_connect (object, "dock",
+                          G_CALLBACK (item_dock_cb), master);
+        g_signal_connect (object, "detach",
+                          G_CALLBACK (item_detach_cb), master);
+                          
+                                  if (GDL_DOCK_ITEM_HAS_GRIP (object)) {
+            g_signal_connect (object, "notify::locked",
+                              G_CALLBACK (item_notify_cb), master);
+            item_notify_cb (object, NULL, master);
+        }
+        
+        if (!GDL_DOCK_OBJECT_AUTOMATIC (object)) {
+            if (!master->_priv->idle_layout_changed_id)
+                master->_priv->idle_layout_changed_id =
+                    g_idle_add (idle_emit_layout_changed, master);
+        }
+				*/
+				
+			}
+		}
+		
+		public void Remove (DockObject objekt)
+		{
+			if (objekt == null)
+				return;
+			if (objekt is DockItem && objekt.HasGrip) {
+				int locked = this.Locked;
+				if (this.locked_items.Contains (objekt)) {
+					this.locked_items.Remove (objekt);
+					if (this.Locked != locked) {
+						//g_object_notify (G_OBJECT (master /*this*/), "locked");
+					}
+				}
+				if (this.unlocked_items.Contains (objekt)) {
+					this.locked_items.Remove (objekt);
+					if (this.Locked != locked) {
+						//g_object_notify (G_OBJECT( master /*this*/), "locked");
+					}
+				}
+			}
+			
+			if (objekt is Dock) {
+				if (this.toplevel_docks.Contains (objekt)
+					this.toplevel_docks.Remove (objekt);
+				if (objekt == this.controller) {
+					DockObject new_controller = null;
+					foreach (DockObject item in this.toplevel_docks.Reverse ()) {
+						if (!item.IsAutomatic) {
+							new_controller = item;
+							break;
+						}
+					}
+					if (new_controller != null) {
+						this.controller = new_controller;
+					} else {
+						this.controller = null;
+					}
+				}
+			}
+			
+			/*PORT THIS:
+    g_signal_handlers_disconnect_matched (object, G_SIGNAL_MATCH_DATA, 
+                                          0, 0, NULL, NULL, master);*/
+			if (objekt.Name != null) {
+				if (this.dock_objects.Contains (objekt.Name)) {
+					this.dock_objects.Remove (objekt.Name);
+				}
+			}
+			
+			if (!objekt.IsAutomatic) {
+				if (this.idle_layout_changed_id == 0) {
+					this.idle_layout_changed_id = 0; //g_idle_add (idle_emit_layout_changed);
+				}
+			}
+		}
+		
+		public DockObject GetObject (string name)
+		{
+			if (name == null)
+				return null;
+			return (DockObject)this.dock_objects[name];
+		}
+		
+		public DockObject Controller {
+			get { return this.controller; }
+			set {
+				if (value != null) {
+					if (value.IsAutomatic)
+						Console.WriteLine ("New controller is automatic, only manual dock objects should be named controller");
+					if (!this.toplevel_docks.Contains (value))
+						this.Add (value);
+					this.controller = value;
+				} else {
+					this.controller = null;
+				}
+			}
+		}
 	}
 }
\ No newline at end of file

Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs	2004-06-06 23:01:28 UTC (rev 1699)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs	2004-06-07 02:08:56 UTC (rev 1700)
@@ -9,10 +9,7 @@
 namespace Gdl
 {
 	public class DockObject : Gtk.Container
-	{
-	
-		private static bool is_compound = true;
-	
+	{	
 		private Gtk.Container container;
 		private Gdl.DockObjectFlags flags;
 		private int freeze_count;
@@ -161,9 +158,9 @@
 		
 		public abstract bool ChildPlacement (DockObject child, DockPlacement placement);
 		
-		public bool IsCompound {
+		public virtual bool IsCompound {
 			get {
-				return is_compound;
+				return true;
 			}
 		}
 		

Modified: trunk/MonoDevelop/src/Libraries/Gdl/Gdl.prjx
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/Gdl.prjx	2004-06-06 23:01:28 UTC (rev 1699)
+++ trunk/MonoDevelop/src/Libraries/Gdl/Gdl.prjx	2004-06-07 02:08:56 UTC (rev 1700)
@@ -11,6 +11,7 @@
     <File name="./DockRequest.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
     <File name="./DockMaster.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
     <File name="./Dock.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+    <File name="./DockItem.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
   </Contents>
   <References>
     <Reference type="Gac" refto="gtk-sharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" localcopy="True" />

Modified: trunk/MonoDevelop/src/Libraries/Gdl/Makefile.Gdl
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/Makefile.Gdl	2004-06-06 23:01:28 UTC (rev 1699)
+++ trunk/MonoDevelop/src/Libraries/Gdl/Makefile.Gdl	2004-06-07 02:08:56 UTC (rev 1700)
@@ -12,7 +12,8 @@
 ./DockPlacement.cs \
 ./DockRequest.cs \
 ./DockMaster.cs \
-./Dock.cs
+./Dock.cs \
+./DockItem.cs
 
 PKG_REFERENCES = \
 gtk-sharp




More information about the Monodevelop-patches-list mailing list