[Monodevelop-patches-list] r2331 - trunk/MonoDevelop/Unused/Gdl
John Luke <jluke@cfl.rr.com>
jluke at mono-cvs.ximian.com
Fri Mar 11 17:56:50 EST 2005
Author: jluke
Date: 2005-03-11 17:56:50 -0500 (Fri, 11 Mar 2005)
New Revision: 2331
Modified:
trunk/MonoDevelop/Unused/Gdl/Dock.cs
trunk/MonoDevelop/Unused/Gdl/DockItem.cs
trunk/MonoDevelop/Unused/Gdl/DockMaster.cs
trunk/MonoDevelop/Unused/Gdl/DockPaned.cs
Log:
flush
Modified: trunk/MonoDevelop/Unused/Gdl/Dock.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/Dock.cs 2005-03-11 19:07:30 UTC (rev 2330)
+++ trunk/MonoDevelop/Unused/Gdl/Dock.cs 2005-03-11 22:56:50 UTC (rev 2331)
@@ -179,6 +179,7 @@
requisition.Width = 2 * (int)BorderWidth;
requisition.Height = 2 * (int)BorderWidth;
+ // make request to root
if (root != null && root.Visible) {
Requisition rootReq = root.SizeRequest ();
requisition.Width += rootReq.Width;
@@ -194,6 +195,7 @@
int bw = (int)BorderWidth;
Gdk.Rectangle childAlloc;
+ // reduce allocation by border width
childAlloc.X = allocation.X + bw;
childAlloc.Y = allocation.Y + bw;
childAlloc.Width = Math.Max (1, allocation.Width - 2 * bw);
@@ -264,6 +266,7 @@
window = null;
}
+ // destroy the xor gc
if (xorGC != null)
xorGC = null;
Modified: trunk/MonoDevelop/Unused/Gdl/DockItem.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockItem.cs 2005-03-11 19:07:30 UTC (rev 2330)
+++ trunk/MonoDevelop/Unused/Gdl/DockItem.cs 2005-03-11 22:56:50 UTC (rev 2331)
@@ -11,7 +11,7 @@
public class DockItem : DockObject
{
- private readonly float SplitRatio = 0.4f;
+ private const float SplitRatio = 0.4f;
private Widget child = null;
private DockItemBehavior behavior = DockItemBehavior.Normal;
private Orientation orientation = Orientation.Vertical;
@@ -88,24 +88,16 @@
}
public bool CantClose {
- get {
- return ((Behavior & DockItemBehavior.CantClose) != 0);
- }
+ get { return ((Behavior & DockItemBehavior.CantClose) != 0); }
}
public bool CantIconify {
- get {
- return ((Behavior & DockItemBehavior.CantIconify) != 0);
- }
+ get { return ((Behavior & DockItemBehavior.CantIconify) != 0); }
}
public new Widget Child {
- get {
- return child;
- }
- set {
- child = value;
- }
+ get { return child; }
+ set { child = value; }
}
public DockBar DockBar {
@@ -114,66 +106,42 @@
}
public DockBarButton DockBarButton {
- get {
- return dockButton;
- }
- set {
- dockButton = value;
- }
+ get { return dockButton; }
+ set { dockButton = value; }
}
public int DragOffX {
- get {
- return dragoffX;
- }
- set {
- dragoffX = value;
- }
+ get { return dragoffX; }
+ set { dragoffX = value; }
}
public int DragOffY {
- get {
- return dragoffY;
- }
- set {
- dragoffY = value;
- }
+ get { return dragoffY; }
+ set { dragoffY = value; }
}
public bool GripShown {
- get {
- return (HasGrip && !Locked && grip.Visible);
- }
+ get { return (HasGrip && !Locked && grip.Visible); }
}
public virtual bool HasGrip {
- get {
- return true;
- }
+ get { return true; }
}
public bool Iconified {
- get {
- return ((DockObjectFlags & DockObjectFlags.Iconified) != 0);
- }
+ get { return ((DockObjectFlags & DockObjectFlags.Iconified) != 0); }
}
public bool InDrag {
- get {
- return ((DockObjectFlags & DockObjectFlags.InDrag) != 0);
- }
+ get { return ((DockObjectFlags & DockObjectFlags.InDrag) != 0); }
}
public bool InPreDrag {
- get {
- return ((DockObjectFlags & DockObjectFlags.InPreDrag) != 0);
- }
+ get { return ((DockObjectFlags & DockObjectFlags.InPreDrag) != 0); }
}
public override bool IsCompound {
- get {
- return false;
- }
+ get { return false; }
}
[Export]
@@ -189,6 +157,7 @@
behavior &= ~(DockItemBehavior.Locked);
if ((oldBehavior ^ behavior) != 0) {
+ ShowHideGrip ();
if (Master != null)
Master.EmitLayoutChangedEvent ();
EmitPropertyEvent ("Locked");
@@ -198,30 +167,18 @@
[Export]
public Orientation Orientation {
- get {
- return orientation;
- }
- set {
- SetOrientation (value);
- }
+ get { return orientation; }
+ set { SetOrientation (value); }
}
public int PreferredHeight {
- get {
- return preferredHeight;
- }
- set {
- preferredHeight = value;
- }
+ get { return preferredHeight; }
+ set { preferredHeight = value; }
}
public int PreferredWidth {
- get {
- return preferredWidth;
- }
- set {
- preferredWidth = value;
- }
+ get { return preferredWidth; }
+ set { preferredWidth = value; }
}
public Requisition PreferredSize {
@@ -234,9 +191,7 @@
}
public bool Resize {
- get {
- return resize;
- }
+ get { return resize; }
set {
resize = value;
QueueResize ();
@@ -250,15 +205,11 @@
tabLabel = new Label ();
return tabLabel;
}
- set {
- tabLabel = value;
- }
+ set { tabLabel = value; }
}
public bool UserAction {
- get {
- return ((DockObjectFlags & DockObjectFlags.UserAction) != 0);
- }
+ get { return ((DockObjectFlags & DockObjectFlags.UserAction) != 0); }
}
protected override void OnAdded (Widget widget)
@@ -765,12 +716,19 @@
public void DockPopupMenu (uint button, uint time)
{
if (menu == null) {
+ // Create popup menu and attach it to the dock item
menu = new Menu ();
menu.AttachToWidget (this, new MenuDetachFunc (DetachMenu));
+ // Hide menuitem
MenuItem mitem = new MenuItem ("Hide");
mitem.Activated += new EventHandler (ItemHideCb);
menu.Append (mitem);
+
+ // Lock menuitem -- need to be able to unlock
+ //mitem = new MenuItem ("Lock");
+ //mitem.Activated += new EventHandler (ItemLockCb);
+ //menu.Append (mitem);
}
menu.ShowAll ();
menu.Popup (null, null, null, IntPtr.Zero, button, time);
@@ -781,6 +739,11 @@
{
HideItem ();
}
+
+ private void ItemLockCb (object o, EventArgs e)
+ {
+ this.Locked = true;
+ }
private void StartDrag ()
{
@@ -908,10 +871,9 @@
{
DockObjectFlags |= DockObjectFlags.Iconified;
HideItem ();
- //Master.DockBar.AddItem (this);
Master.EmitLayoutChangedEvent ();
}
-
+
public void ShowItem ()
{
DockObjectFlags &= ~(DockObjectFlags.Iconified);
Modified: trunk/MonoDevelop/Unused/Gdl/DockMaster.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockMaster.cs 2005-03-11 19:07:30 UTC (rev 2330)
+++ trunk/MonoDevelop/Unused/Gdl/DockMaster.cs 2005-03-11 22:56:50 UTC (rev 2331)
@@ -12,13 +12,21 @@
private ArrayList toplevelDocks = new ArrayList ();
private DockObject controller = null;
private int dockNumber = 1;
+
+ // for naming nameless manual objects
private int number = 1;
private string defaultTitle;
+
private Gdk.GC rootXorGC;
private bool rectDrawn;
private Dock rectOwner;
+
private DockRequest request;
- private uint idle_layout_changed_id;
+
+ // hashes to quickly calculate the overall locked status:
+ // if size(unlocked_items) == 0 then locked = 1
+ // else if size(locked_items) == 0 then locked = 0
+ // else locked = -1
private Hashtable lockedItems = new Hashtable ();
private Hashtable unlockedItems = new Hashtable ();
@@ -53,6 +61,9 @@
}
}
+ // 1 = all the dock items bound to the master are locked
+ // 0 = all the dock items bound to the master are unlocked
+ // -1 = inconsistent
public int Locked {
get {
return ComputeLocked ();
@@ -157,6 +168,7 @@
if (obj == null)
return;
+ // remove from locked/unlocked hashes and property change if that's the case
if (obj is DockItem && ((DockItem)obj).HasGrip) {
int locked = Locked;
if (lockedItems.Contains (obj)) {
@@ -176,22 +188,30 @@
if (obj == controller) {
DockObject newController = null;
+
+ // now find some other non-automatic toplevel to use as a
+ // new controller. start from the last dock, since it's
+ // probably a non-floating and manual
ArrayList reversed = toplevelDocks;
reversed.Reverse ();
+
foreach (DockObject item in reversed) {
if (!item.IsAutomatic) {
newController = item;
break;
}
}
+
if (newController != null) {
controller = newController;
} else {
+ // no controller, no master
controller = null;
}
}
}
+ // disconnect the signals
if (obj is DockItem) {
DockItem item = obj as DockItem;
item.Detached -= OnItemDetached;
@@ -201,6 +221,7 @@
item.DockItemDragEnd -= OnDragEnd;
}
+ // remove the object from the hash if it is there
if (obj.Name != null && dockObjects.Contains (obj.Name))
dockObjects.Remove (obj.Name);
@@ -223,10 +244,12 @@
if (value != null) {
if (value.IsAutomatic)
Console.WriteLine ("New controller is automatic, only manual dock objects should be named controller");
+ // check that the controller is in the toplevel list
if (!toplevelDocks.Contains (value))
Add (value);
controller = value;
} else {
+ // no controller, no master
controller = null;
}
}
@@ -317,6 +340,7 @@
if (cancelled || request.Applicant == request.Target)
return;
+ // dock object to the requested position
request.Target.Dock (request.Applicant,
request.Position,
request.Extra);
@@ -400,6 +424,8 @@
myRequest.Y,
myRequest.Width,
myRequest.Height);
+
+ // setup extra docking information
myRequest.Extra = rect;
}
@@ -414,6 +440,7 @@
XorRect ();
}
+ // set the new values
request = myRequest;
rectOwner = dock;
Modified: trunk/MonoDevelop/Unused/Gdl/DockPaned.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockPaned.cs 2005-03-11 19:07:30 UTC (rev 2330)
+++ trunk/MonoDevelop/Unused/Gdl/DockPaned.cs 2005-03-11 22:56:50 UTC (rev 2331)
@@ -8,7 +8,7 @@
{
public class DockPaned : DockItem
{
- private readonly float SplitRatio = 0.3f;
+ private const float SplitRatio = 0.3f;
protected DockPaned (IntPtr raw) : base (raw) { }
@@ -18,19 +18,16 @@
public DockPaned (Orientation orientation)
{
+ DockObjectFlags &= ~(DockObjectFlags.Automatic);
CreateChild (orientation);
}
public override bool HasGrip {
- get {
- return false;
- }
+ get { return false; }
}
public override bool IsCompound {
- get {
- return true;
- }
+ get { return true; }
}
[After]
@@ -97,7 +94,10 @@
protected override void OnDestroyed ()
{
+ // this first
base.OnDestroyed ();
+
+ // after that we can remove the Paned child
if (Child != null) {
Child.Unparent ();
Child = null;
@@ -170,7 +170,7 @@
int relX = x - alloc.X;
int relY = y - alloc.Y;
- /* Location is inside. */
+ /* Check if coordinates are inside the widget. */
if (relX > 0 && relX < alloc.Width &&
relY > 0 && relY < alloc.Height) {
int divider = -1;
More information about the Monodevelop-patches-list
mailing list