diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2015-12-23 18:24:28 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2015-12-23 18:24:28 +0100 |
| commit | b6fccb76291456485af671082b58e18fe37d395e (patch) | |
| tree | 5f28a86d4a66df545e5c1e82eb75fa091d60ae86 /src | |
| parent | 8678a1351e90c94741661a83efefdce8e7493b01 (diff) | |
Prevent multiple template loading
debug group and stack layouting , onLayoutChanged
divers debug
Diffstat (limited to 'src')
| -rw-r--r-- | src/GraphicObjects/Expandable.cs | 8 | ||||
| -rw-r--r-- | src/GraphicObjects/GenericStack.cs | 1 | ||||
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 19 | ||||
| -rw-r--r-- | src/GraphicObjects/Group.cs | 39 | ||||
| -rw-r--r-- | src/GraphicObjects/TemplatedControl.cs | 15 |
5 files changed, 51 insertions, 31 deletions
diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs index 3d4ef229..d4dd315f 100644 --- a/src/GraphicObjects/Expandable.cs +++ b/src/GraphicObjects/Expandable.cs @@ -102,12 +102,16 @@ namespace go public virtual void onExpand(object sender, EventArgs e)
{
- _contentContainer.Visible = true;
+ if (_contentContainer != null)
+ _contentContainer.Visible = true;
+
Expand.Raise (this, e);
}
public virtual void onCollapse(object sender, EventArgs e)
{
- _contentContainer.Visible = false;
+ if (_contentContainer != null)
+ _contentContainer.Visible = false;
+
Collapse.Raise (this, e);
}
diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs index f50a4427..b5af394d 100644 --- a/src/GraphicObjects/GenericStack.cs +++ b/src/GraphicObjects/GenericStack.cs @@ -102,6 +102,7 @@ namespace go {
if (Parent == null)
return;
+
base.RegisterForLayouting (layoutType);
if ((layoutType & (int)LayoutingType.PositionChildren) > 0)
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 0374527d..4c68236d 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -493,6 +493,9 @@ namespace go {
if (Parent == null)
return;
+ #if DEBUG_LAYOUTING
+ Debug.WriteLine ("RegisterForLayouting => {1}->{0}", layoutType, this.ToString());
+ #endif
lock (Interface.LayoutingQueue) {
Interface.LayoutingQueue.RemoveAll (lq => lq.GraphicObject == this && (layoutType & (int)lq.LayoutType) > 0);
@@ -504,9 +507,9 @@ namespace go Width = -1;
if (Bounds.Width == 0) //stretch in parent
- Interface.LayoutingQueue.EnqueueAfterParentSizing (LayoutingType.Width, this);
+ Interface.LayoutingQueue.EnqueueAfterParentSizing (LayoutingType.Width, this);
else if (Bounds.Width < 0) //fit
- Interface.LayoutingQueue.EnqueueBeforeParentSizing (LayoutingType.Width, this);
+ Interface.LayoutingQueue.EnqueueBeforeParentSizing (LayoutingType.Width, this);
else
Interface.LayoutingQueue.Insert (0, new LayoutingQueueItem (LayoutingType.Width, this));
}
@@ -518,20 +521,20 @@ namespace go Height = -1;
if (Bounds.Height == 0) //stretch in parent
- Interface.LayoutingQueue.EnqueueAfterParentSizing (LayoutingType.Height, this);
+ Interface.LayoutingQueue.EnqueueAfterParentSizing (LayoutingType.Height, this);
else if (Bounds.Height < 0) //fit
- Interface.LayoutingQueue.EnqueueBeforeParentSizing (LayoutingType.Height, this);
+ Interface.LayoutingQueue.EnqueueBeforeParentSizing (LayoutingType.Height, this);
else
Interface.LayoutingQueue.Insert (0, new LayoutingQueueItem (LayoutingType.Height, this));
}
if ((layoutType & (int)LayoutingType.X) > 0)
- //for x positionning, sizing of parent and this have to be done
- Interface.LayoutingQueue.EnqueueAfterThisAndParentSizing (LayoutingType.X, this);
+ //for x positionning, sizing of parent and this have to be done
+ Interface.LayoutingQueue.EnqueueAfterThisAndParentSizing (LayoutingType.X, this);
if ((layoutType & (int)LayoutingType.Y) > 0)
- //for x positionning, sizing of parent and this have to be done
- Interface.LayoutingQueue.EnqueueAfterThisAndParentSizing (LayoutingType.Y, this);
+ //for x positionning, sizing of parent and this have to be done
+ Interface.LayoutingQueue.EnqueueAfterThisAndParentSizing (LayoutingType.Y, this);
}
}
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index b2e341da..89afa5f2 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -147,26 +147,35 @@ namespace go {
base.OnLayoutChanges (layoutType);
+ GenericStack gs = this as GenericStack;
//position smaller objects in group when group size is fit
switch (layoutType) {
- case LayoutingType.Width:
- if (Width < 0) {
- int crw = ClientRectangle.Width;
- foreach (GraphicObject c in Children.Where(ch => ch.Visible))
- c.RegisterForLayouting ((int)LayoutingType.X);
- } else {
- foreach (GraphicObject c in Children.Where(ch => ch.Width == 0 && ch.Visible))
- c.RegisterForLayouting ((int)LayoutingType.Width);
+ case LayoutingType.Width:
+ if (gs != null) {
+ if (gs.Orientation == Orientation.Horizontal) {
+ this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
+ break;
+ }
+ }
+ foreach (GraphicObject c in Children.Where(ch => ch.Visible)) {
+ if (c.getBounds ().Width == 0)
+ c.RegisterForLayouting ((int)LayoutingType.Width);
+ else
+ c.RegisterForLayouting ((int)LayoutingType.X);
}
break;
case LayoutingType.Height:
- if (Height < 0) {
- int crh = ClientRectangle.Height;
- foreach (GraphicObject c in Children.Where(ch => ch.Visible))
- c.RegisterForLayouting ((int)LayoutingType.Y);
- } else {
- foreach (GraphicObject c in Children.Where(ch => ch.Height == 0 && ch.Visible))
- c.RegisterForLayouting ((int)LayoutingType.Height);
+ if (gs != null) {
+ if (gs.Orientation == Orientation.Vertical) {
+ this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
+ break;
+ }
+ }
+ foreach (GraphicObject c in Children.Where(ch => ch.Visible)) {
+ if (c.getBounds ().Height == 0)
+ c.RegisterForLayouting ((int)LayoutingType.Height);
+ else
+ c.RegisterForLayouting ((int)LayoutingType.Y);
}
break;
}
diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs index 4ab3a362..fc1a61f2 100644 --- a/src/GraphicObjects/TemplatedControl.cs +++ b/src/GraphicObjects/TemplatedControl.cs @@ -96,8 +96,8 @@ namespace go protected override void loadDefaultValues () { - if (child == null)//trigger loading of default template if child is empty - loadTemplate (); +// if (child == null)//trigger loading of default template if child is empty +// loadTemplate (); base.loadDefaultValues (); } public override GraphicObject FindByName (string nameToFind) @@ -159,15 +159,18 @@ namespace go xr.Read ();//go close tag xr.Read ();//Template close tag break; - } else { - xr.ReadInnerXml (); - } + } else + xr.ReadInnerXml (); } } } else loadTemplate (Interface.Load (template, this)); - + if (this.child == null) { + loadTemplate (); + loadDefaultValues (); + } + //normal xml read using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) { xr.Read (); |