aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
-rw-r--r--CrowIDE/src/Editors/Editor.cs2
-rw-r--r--CrowIDE/src/Editors/ImlVisualEditor.cs2
-rw-r--r--CrowIDE/src/Editors/SvgEditor.cs2
-rw-r--r--Templates/ScrollingListBox.template5
-rw-r--r--Templates/TreeView.template4
-rw-r--r--Tests/BasicTests.cs14
-rw-r--r--Tests/GraphicObjects/TechBorder.cs2
-rw-r--r--Tests/Interfaces/Divers/welcome.crow2
-rwxr-xr-xTests/Interfaces/TemplatedContainer/0.crow2
-rwxr-xr-xTests/Interfaces/TemplatedContainer/6.crow21
-rwxr-xr-xTests/Interfaces/TemplatedContainer/7.crow25
-rwxr-xr-xTests/Interfaces/TemplatedControl/testItemTemplateTag.crow68
-rw-r--r--Tests/Showcase.cs2
-rw-r--r--Tests/Tests.csproj6
-rwxr-xr-xTests/ui/showcase.crow10
-rw-r--r--src/GraphicObjects/Border.cs2
-rw-r--r--src/GraphicObjects/GenericStack.cs10
-rw-r--r--src/GraphicObjects/GraphicObject.cs136
-rw-r--r--src/GraphicObjects/Grid.cs4
-rw-r--r--src/GraphicObjects/Group.cs8
-rw-r--r--src/GraphicObjects/PrivateContainer.cs8
-rw-r--r--src/GraphicObjects/Shape.cs2
-rw-r--r--src/GraphicObjects/TabView.cs4
-rw-r--r--src/GraphicObjects/TemplatedGroup.cs17
-rw-r--r--src/GraphicObjects/TextRun.cs2
-rw-r--r--src/GraphicObjects/Wrapper.cs7
-rw-r--r--src/Interface.cs5
-rw-r--r--src/LayoutingQueueItem.cs12
28 files changed, 178 insertions, 206 deletions
diff --git a/CrowIDE/src/Editors/Editor.cs b/CrowIDE/src/Editors/Editor.cs
index 2cd34412..7b95bb55 100644
--- a/CrowIDE/src/Editors/Editor.cs
+++ b/CrowIDE/src/Editors/Editor.cs
@@ -79,7 +79,7 @@ namespace Crow.Coding
protected abstract void updateEditorFromProjFile ();
protected abstract void updateProjFileFromEditor ();
protected abstract bool EditorIsDirty { get; set; }
- protected virtual bool IsReady { get { return true; }}
+ protected virtual bool IsReady { get { return projFile != null; }}
protected virtual void updateCheckPostProcess () {}
protected void backgroundThreadFunc () {
diff --git a/CrowIDE/src/Editors/ImlVisualEditor.cs b/CrowIDE/src/Editors/ImlVisualEditor.cs
index b1759fbc..11f94c17 100644
--- a/CrowIDE/src/Editors/ImlVisualEditor.cs
+++ b/CrowIDE/src/Editors/ImlVisualEditor.cs
@@ -434,7 +434,7 @@ namespace Crow.Coding
gr.Rectangle (cb, 2.0 / z);
string[] lerrs = Error.ToString ().Split ('\n');
Point p = cb.Center;
- p.Y -= lerrs.Length * 20;
+ p.Y = 20;
foreach (string le in lerrs) {
drawCenteredTextLine(gr, p, le);
p.Y += 20;
diff --git a/CrowIDE/src/Editors/SvgEditor.cs b/CrowIDE/src/Editors/SvgEditor.cs
index 219eea67..fce3d1aa 100644
--- a/CrowIDE/src/Editors/SvgEditor.cs
+++ b/CrowIDE/src/Editors/SvgEditor.cs
@@ -91,7 +91,7 @@ namespace Crow.Coding
#endregion
#region GraphicObject overrides
- protected override int measureRawSize (LayoutingType lt)
+ protected override int measureRawSize(LayoutingType lt)
{
if (_pic == null)
return 2 * Margin;
diff --git a/Templates/ScrollingListBox.template b/Templates/ScrollingListBox.template
index 3b098df2..67300ae9 100644
--- a/Templates/ScrollingListBox.template
+++ b/Templates/ScrollingListBox.template
@@ -1,14 +1,13 @@
<?xml version="1.0"?>
<Border BorderWidth="1" Background="{./Background}">
<HorizontalStack Margin="1">
- <Scroller Name="scroller1"
- Margin="2" ScrollY="{../scrollbar1.Value}">
+ <Scroller Name="scroller1" Margin="2">
<VerticalStack Height="Fit" MinimumSize="10,10"
Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
</Scroller>
<ScrollBar Name="scrollbar1" Value="{²../scroller1.ScrollY}"
LargeIncrement="{../scroller1.PageHeight}" SmallIncrement="30" CursorSize="{../scroller1.ChildHeightRatio}"
- Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
+ Maximum="{../scroller1.MaxScrollY}" Orientation="Vertical"
Width="14" />
</HorizontalStack>
</Border>
diff --git a/Templates/TreeView.template b/Templates/TreeView.template
index 9c18120e..0ac770b1 100644
--- a/Templates/TreeView.template
+++ b/Templates/TreeView.template
@@ -1,8 +1,6 @@
<?xml version="1.0"?>
<HorizontalStack>
- <Scroller Name="scroller1" Margin="1"
- Background="{./Background}"
- ScrollY="{../scrollbar1.Value}">
+ <Scroller Name="scroller1" Margin="1" Background="{./Background}">
<VerticalStack
Height="Fit" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
</Scroller>
diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs
index 149ff4a9..9691f9ec 100644
--- a/Tests/BasicTests.cs
+++ b/Tests/BasicTests.cs
@@ -177,9 +177,13 @@ namespace Tests
this.KeyDown += KeyboardKeyDown1;
- testFiles = new string [] { @"Interfaces/Experimental/testDock.crow" };
+ //testFiles = new string [] { @"Interfaces/Experimental/testDock.crow" };
//testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
+ //testFiles = new string [] { @"Interfaces/Divers/0.crow" };
+ testFiles = new string [] { @"Interfaces/TemplatedContainer/testTreeView.crow" };
//testFiles = new string [] { @"Interfaces/Divers/colorPicker.crow" };
+// testFiles = new string[] { @"Interfaces/TemplatedControl/testItemTemplateTag.crow" };
+
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray ();
@@ -195,10 +199,10 @@ namespace Tests
Load(testFiles[idx]).DataSource = this;
- LoadIMLFragment (@"<DockWindow Width=""150"" Height=""150"" Background=""DarkRed"" />", 0);
- LoadIMLFragment (@"<DockWindow Width=""200"" Height=""150"" Background=""DarkGreen"" />", 0);
- LoadIMLFragment (@"<DockWindow Width=""250"" Height=""150"" Background=""Brown"" />", 0);
- LoadIMLFragment (@"<DockWindow Width=""300"" Height=""150"" Background=""DarkBlue"" />", 0);
+// LoadIMLFragment (@"<DockWindow Width=""150"" Height=""150"" Background=""DarkRed"" />", 0);
+// LoadIMLFragment (@"<DockWindow Width=""200"" Height=""150"" Background=""DarkGreen"" />", 0);
+// LoadIMLFragment (@"<DockWindow Width=""250"" Height=""150"" Background=""Brown"" />", 0);
+// LoadIMLFragment (@"<DockWindow Width=""300"" Height=""150"" Background=""DarkBlue"" />", 0);
}
diff --git a/Tests/GraphicObjects/TechBorder.cs b/Tests/GraphicObjects/TechBorder.cs
index 4f818e51..d1f73324 100644
--- a/Tests/GraphicObjects/TechBorder.cs
+++ b/Tests/GraphicObjects/TechBorder.cs
@@ -33,7 +33,7 @@ namespace Tests
public TechBorder () : base() {}
public TechBorder (Interface iface): base (iface){}
- protected override int measureRawSize (LayoutingType lt)
+ protected override int measureRawSize(LayoutingType lt)
{
return base.measureRawSize (lt) + 6;
}
diff --git a/Tests/Interfaces/Divers/welcome.crow b/Tests/Interfaces/Divers/welcome.crow
index 3445ef1c..74018ebe 100644
--- a/Tests/Interfaces/Divers/welcome.crow
+++ b/Tests/Interfaces/Divers/welcome.crow
@@ -1,2 +1,2 @@
<?xml version="1.0"?>
-<GraphicObject Height="30" Width="30" Background="#500000"/> \ No newline at end of file
+<ColorCircleSelector /> \ No newline at end of file
diff --git a/Tests/Interfaces/TemplatedContainer/0.crow b/Tests/Interfaces/TemplatedContainer/0.crow
index 195b981b..b53fa4ec 100755
--- a/Tests/Interfaces/TemplatedContainer/0.crow
+++ b/Tests/Interfaces/TemplatedContainer/0.crow
@@ -7,7 +7,7 @@
<CheckBox Name="chk4" />
<HorizontalStack Fit="true" Margin="2" Background="SeaGreen">
<Label Name="captionFps" Text="Fps:" Width="30" TextAlignment="Right"/>
- <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="Fit" TextAlignment="Center" Background="AoEnglish"/>
+ <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="Fit" TextAlignment="Center" Background="Teal"/>
</HorizontalStack>
</VerticalStack>
</Expandable>
diff --git a/Tests/Interfaces/TemplatedContainer/6.crow b/Tests/Interfaces/TemplatedContainer/6.crow
deleted file mode 100755
index 041bdf52..00000000
--- a/Tests/Interfaces/TemplatedContainer/6.crow
+++ /dev/null
@@ -1,21 +0,0 @@
-<Expandable Width="Stretched" Background="Gray">
- <Expandable Width="Stretched" Background="LightBlue">
- <Expandable Width="Stretched" Background="Green">
- <Expandable Width="Stretched" Background="LimeGreen">
- <Expandable Width="Stretched" Background="DimGray">
- <Expandable Width="Stretched" Background="Yellow">
- <Expandable Width="Stretched" Background="NavyBlue">
- <Expandable Width="Stretched" Background="Blue">
- <Expandable Width="Stretched" Background="BlueCrayola">
- <Expandable Width="Stretched" Background="Green">
- <Label Background="Red" Text="{fps}"/>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable> \ No newline at end of file
diff --git a/Tests/Interfaces/TemplatedContainer/7.crow b/Tests/Interfaces/TemplatedContainer/7.crow
deleted file mode 100755
index 0c94b6c4..00000000
--- a/Tests/Interfaces/TemplatedContainer/7.crow
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<VerticalStack Height="Fit" Width="Fit">
- <Label Width="Stretched"/>
- <Expandable Width="Fit" Background="Gray">
- <Expandable Background="LightBlue">
- <Expandable Background="Green">
- <Expandable Background="LimeGreen">
- <Expandable Background="DimGray">
- <Expandable Width="Stretched" Background="Yellow">
- <Expandable Background="NavyBlue">
- <Expandable Width="Stretched" Background="Blue">
- <Expandable Width="Stretched" Background="BlueCrayola">
- <Expandable Width="Stretched" Background="Green">
- <Label Background="Red" Text="{fps}"/>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable>
- </Expandable>
-</VerticalStack>
diff --git a/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow b/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow
index 90c475a5..7ddaf863 100755
--- a/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow
+++ b/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow
@@ -1,37 +1,33 @@
<?xml version="1.0"?>
-<Border BorderWidth="2" Fit="true">
- <VerticalStack Fit="true" Margin="5">
- <ListBox Data="{TestList}" Background="0.5,0.5,0.5,0.7"
- HorizontalAlignment="Center" Width="200" Height="200" Margin="5">
- <Template>
- <Border BorderWidth="1">
- <HorizontalStack Margin="1">
- <Scroller Name="scroller1"
- Margin="2" ScrollY="{../scrollbar1.Value}">
- <VerticalStack Height="Fit" MinimumSize="10,10"
- Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
- </Scroller>
- <ScrollBar Name="scrollbar1" Value="{²../scroller1.ScrollY}"
- LargeIncrement="{../scroller1.PageHeight}" SmallIncrement="30" CursorSize="{../scroller1.ChildHeightRatio}"
- Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
- Width="14" />
- </HorizontalStack>
- </Border>
- </Template>
- <ItemTemplate DataType="Crow.Color">
- <HorizontalStack
- HorizontalAlignment="Left"
- Height="Fit" Width="200" Margin="1" Focusable="true"
- MouseEnter="{Background=hgradient|0:DarkRed|1:Transparent}"
- MouseLeave="{Background=Transparent}">
- <GraphicObject Height="12" Width="20" Background="{}" Margin="0" CornerRadius="3"/>
- <Label Text="{}" Margin="0" Width="Stretched"/>
- </HorizontalStack>
- </ItemTemplate>
- </ListBox>
- <HorizontalStack Fit="true" HorizontalAlignment="Right">
- <Button Caption="Load list" MouseDown="OnLoadList"/>
- <Button Caption="Clear" MouseDown="OnClear"/>
- </HorizontalStack>
- </VerticalStack>
-</Border>
+<VerticalStack Fit="true" Margin="5">
+ <ListBox Data="{TestList}"
+ HorizontalAlignment="Center" Width="200" Height="200" Margin="5">
+ <Template>
+ <HorizontalStack Margin="1">
+ <Scroller Name="scroller1" Margin="2" >
+ <VerticalStack Height="Fit" MinimumSize="10,10" Width="Stretched"
+ Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
+ </Scroller>
+ <ScrollBar Name="scrollbar1" Value="{²../scroller1.ScrollY}"
+ LargeIncrement="{../scroller1.PageHeight}" SmallIncrement="30"
+ CursorSize="{../scroller1.ChildHeightRatio}"
+ Maximum="{../scroller1.MaxScrollY}" Orientation="Vertical"
+ Width="14" />
+ </HorizontalStack>
+ </Template>
+ <ItemTemplate DataType="Crow.Color">
+ <HorizontalStack
+ HorizontalAlignment="Left"
+ Height="Fit" Width="200" Margin="1" Focusable="true"
+ MouseEnter="{Background=hgradient|0:DarkRed|1:Transparent}"
+ MouseLeave="{Background=Transparent}">
+ <GraphicObject Name="colIco" Height="12" Width="20" Background="{}" Margin="0" CornerRadius="3"/>
+ <Label Text="{}" Margin="0" Width="Stretched"/>
+ </HorizontalStack>
+ </ItemTemplate>
+ </ListBox>
+ <HorizontalStack Fit="true" HorizontalAlignment="Right">
+ <Button Caption="Load list" MouseDown="OnLoadList"/>
+ <Button Caption="Clear" MouseDown="OnClear"/>
+ </HorizontalStack>
+</VerticalStack>
diff --git a/Tests/Showcase.cs b/Tests/Showcase.cs
index da9b99dc..21593022 100644
--- a/Tests/Showcase.cs
+++ b/Tests/Showcase.cs
@@ -63,7 +63,7 @@ namespace Tests
crowContainer = g.FindByName ("CrowContainer") as Container;
//I set an empty object as datasource at this level to force update when new
//widgets are added to the interface
- crowContainer.DataSource = new object ();
+ //crowContainer.DataSource = new object ();
hideError ();
}
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index c86ff9cb..ab976241 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -269,12 +269,6 @@
<None Include="Interfaces\TemplatedContainer\0.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\TemplatedContainer\6.crow">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Interfaces\TemplatedContainer\7.crow">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
<None Include="Interfaces\TemplatedControl\testButton.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
diff --git a/Tests/ui/showcase.crow b/Tests/ui/showcase.crow
index 61df4443..9e273326 100755
--- a/Tests/ui/showcase.crow
+++ b/Tests/ui/showcase.crow
@@ -1,7 +1,8 @@
<?xml version="1.0"?>
+<Border Margin="5" Height="90%" Width="20%">
<HorizontalStack Background="Jet" Margin="5">
- <DirectoryView Name="dv" CurrentDirectory="Interfaces" Width="25%" SelectedItemChanged="Dv_SelectedItemChanged"/>
- <Splitter Width="6"/>
+ <DirectoryView Name="dv" CurrentDirectory="Interfaces" SelectedItemChanged="Dv_SelectedItemChanged"/>
+<!-- <Splitter Width="6"/>
<VerticalStack>
<Container Name="CrowContainer" Height="60%" Background="DimGray"/>
<Splitter/>
@@ -16,10 +17,11 @@
<ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
LargeIncrement="{../scroller1.PageHeight}" SmallIncrement="30"
CursorSize="{../scroller1.ChildHeightRatio}"
- Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
+ Maximum="{../scroller1.MaxScrollY}" Orientation="Vertical"
Width="14" />
</HorizontalStack>
<Label Visible="{ShowError}" Text="{ErrorMessage}" Background="Red" Foreground="White" Width="Stretched" Margin="2"
Multiline="true"/>
- </VerticalStack>
+ </VerticalStack>-->
</HorizontalStack>
+</Border>
diff --git a/src/GraphicObjects/Border.cs b/src/GraphicObjects/Border.cs
index adeb32e7..a02c6a3c 100644
--- a/src/GraphicObjects/Border.cs
+++ b/src/GraphicObjects/Border.cs
@@ -122,7 +122,7 @@ namespace Crow
}
}
- protected override int measureRawSize (LayoutingType lt)
+ protected override int measureRawSize(LayoutingType lt)
{
int tmp = base.measureRawSize (lt);
return tmp < 0 ? tmp : tmp + 2 * BorderWidth;
diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs
index 64841d4b..7f452cb0 100644
--- a/src/GraphicObjects/GenericStack.cs
+++ b/src/GraphicObjects/GenericStack.cs
@@ -78,9 +78,11 @@ namespace Crow
else
layoutType &= (~LayoutingType.Y);
}
- protected override int measureRawSize (LayoutingType lt)
+ protected override int measureRawSize(LayoutingType lt)
{
+ childrenRWLock.EnterReadLock ();
int totSpace = Math.Max(0, Spacing * (Children.Count (c => c.Visible) - 1));
+ childrenRWLock.ExitReadLock ();
if (lt == LayoutingType.Width) {
if (Orientation == Orientation.Horizontal)
return contentSize.Width + totSpace + 2 * Margin;
@@ -92,6 +94,7 @@ namespace Crow
public virtual void ComputeChildrenPositions()
{
int d = 0;
+ childrenRWLock.EnterReadLock ();
if (Orientation == Orientation.Horizontal) {
foreach (GraphicObject c in Children) {
if (!c.Visible)
@@ -107,6 +110,7 @@ namespace Crow
d += c.Slot.Height + Spacing;
}
}
+ childrenRWLock.ExitReadLock ();
IsDirty = true;
}
GraphicObject stretchedGO = null;
@@ -121,9 +125,7 @@ namespace Crow
//in the direction of stacking.
ComputeChildrenPositions ();
- //if no layouting remains in queue for item, registre for redraw
- if (RegisteredLayoutings == LayoutingType.None && IsDirty)
- IFace.EnqueueForRepaint (this);
+ EnqueueForRepaint();
return true;
}
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index f404b5f1..6903b9f9 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -273,7 +273,8 @@ namespace Crow
//initialized = true;
}
#region private fields
- LayoutingType registeredLayoutings = LayoutingType.All;
+ public LayoutingType registeredLayoutings = LayoutingType.None;
+ public LayoutingType requestedLayoutings = LayoutingType.All;
ILayoutable logicalParent;
ILayoutable parent;
string name;
@@ -949,10 +950,10 @@ namespace Crow
if (value != null)
rootDataLevel = true;
- lock (IFace.LayoutMutex) {
+ //lock (IFace.LayoutMutex) {
OnDataSourceChanged (this, dse);
NotifyValueChanged ("DataSource", DataSource);
- }
+ //}
}
get {
return rootDataLevel ? dataSource : dataSource == null ?
@@ -961,20 +962,20 @@ namespace Crow
dataSource;
}
}
- /// <summary>
- /// If true, rendering of GraphicObject is clipped inside client rectangle
- /// </summary>
- [DesignCategory ("Data")][DefaultValue(false)]
- public virtual bool RootDataLevel {
- get { return rootDataLevel; }
- set {
- if (rootDataLevel == value)
- return;
- rootDataLevel = value;
- NotifyValueChanged ("RootDataLevel", rootDataLevel);
- this.RegisterForRedraw ();
- }
- }
+// /// <summary>
+// /// If true, rendering of GraphicObject is clipped inside client rectangle
+// /// </summary>
+// [DesignCategory ("Data")][DefaultValue(false)]
+// public virtual bool RootDataLevel {
+// get { return rootDataLevel; }
+// set {
+// if (rootDataLevel == value)
+// return;
+// rootDataLevel = value;
+// NotifyValueChanged ("RootDataLevel", rootDataLevel);
+// this.RegisterForRedraw ();
+// }
+// }
protected virtual void onLogicalParentDataSourceChanged(object sender, DataSourceChangeEventArgs e){
if (localDataSourceIsNull)
OnDataSourceChanged (this, e);
@@ -1370,19 +1371,24 @@ namespace Crow
IsDirty = true;
if (Width.IsFit || Height.IsFit)
RegisterForLayouting (LayoutingType.Sizing);
- else if (RegisteredLayoutings == LayoutingType.None)
- IFace.EnqueueForRepaint (this);
+ else
+ EnqueueForRepaint ();
}
/// <summary> query an update of the content, a redraw </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void RegisterForRedraw ()
{
#if DEBUG_UPDATE
Debug.WriteLine (string.Format("RegisterForRedraw (IsDirty set)-> {0}", this.ToString ()));
#endif
IsDirty = true;
- if (RegisteredLayoutings == LayoutingType.None)
- IFace.EnqueueForRepaint (this);
+ EnqueueForRepaint ();
+ }
+ protected void EnqueueForRepaint (){
+ //if no layouting remains in queue for item, registre for redraw
+ if (requestedLayoutings != LayoutingType.None)
+ RegisterForLayouting (LayoutingType.None);
+ else if (RegisteredLayoutings == LayoutingType.None && IsDirty)
+ IFace.EnqueueForRepaint (this);
}
#endregion
@@ -1398,47 +1404,57 @@ namespace Crow
}
public virtual bool ArrangeChildren { get { return false; } }
public virtual void RegisterForLayouting(LayoutingType layoutType){
- if (Parent == null)
+ if (Parent == null || !Monitor.TryEnter(IFace.LayoutMutex)) {
+ requestedLayoutings |= layoutType;
+// if (registeredLayoutings != LayoutingType.None)
+// Debugger.Break ();
return;
- lock (IFace.LayoutMutex) {
- //prevent queueing same LayoutingType for this
- layoutType &= (~RegisteredLayoutings);
+ }
+ layoutType |= requestedLayoutings;
+ requestedLayoutings = LayoutingType.None;
+ layoutType &= (~RegisteredLayoutings);//prevent queueing same LayoutingType for this
- if (layoutType == LayoutingType.None)
- return;
- //dont set position for stretched item
- if (Width == Measure.Stretched)
- layoutType &= (~LayoutingType.X);
- if (Height == Measure.Stretched)
- layoutType &= (~LayoutingType.Y);
+ if (layoutType == LayoutingType.None) {
+ Monitor.Exit (IFace.LayoutMutex);
+ return;
+ }
+ //dont set position for stretched item
+ if (Width == Measure.Stretched)
+ layoutType &= (~LayoutingType.X);
+ if (Height == Measure.Stretched)
+ layoutType &= (~LayoutingType.Y);
- if (!ArrangeChildren)
- layoutType &= (~LayoutingType.ArrangeChildren);
+ if (!ArrangeChildren)
+ layoutType &= (~LayoutingType.ArrangeChildren);
- //apply constraints depending on parent type
- if (Parent is GraphicObject)
- (Parent as GraphicObject).ChildrenLayoutingConstraints (ref layoutType);
+ //apply constraints depending on parent type
+ if (Parent is GraphicObject)
+ (Parent as GraphicObject).ChildrenLayoutingConstraints (ref layoutType);
// //prevent queueing same LayoutingType for this
// layoutType &= (~RegisteredLayoutings);
- if (layoutType == LayoutingType.None)
- return;
-
- //enqueue LQI LayoutingTypes separately
- if (layoutType.HasFlag (LayoutingType.Width))
- IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Width, this));
- if (layoutType.HasFlag (LayoutingType.Height))
- IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Height, this));
- if (layoutType.HasFlag (LayoutingType.X))
- IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.X, this));
- if (layoutType.HasFlag (LayoutingType.Y))
- IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Y, this));
- if (layoutType.HasFlag (LayoutingType.ArrangeChildren))
- IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.ArrangeChildren, this));
+ if (layoutType == LayoutingType.None) {
+ Monitor.Exit (IFace.LayoutMutex);
+ return;
}
+
+ //enqueue LQI LayoutingTypes separately
+ if (layoutType.HasFlag (LayoutingType.Width))
+ IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Width, this));
+ if (layoutType.HasFlag (LayoutingType.Height))
+ IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Height, this));
+ if (layoutType.HasFlag (LayoutingType.X))
+ IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.X, this));
+ if (layoutType.HasFlag (LayoutingType.Y))
+ IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Y, this));
+ if (layoutType.HasFlag (LayoutingType.ArrangeChildren))
+ IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.ArrangeChildren, this));
+
+ Monitor.Exit (IFace.LayoutMutex);
}
+
/// <summary> trigger dependant sizing component update </summary>
public virtual void OnLayoutChanges(LayoutingType layoutType)
{
@@ -1608,15 +1624,16 @@ namespace Crow
IsDirty = true;
+// if (Name == "colIco" && Slot.Height < 5)
+// Debugger.Break ();
+
OnLayoutChanges (layoutType);
LastSlots.Height = Slot.Height;
break;
}
- //if no layouting remains in queue for item, registre for redraw
- if (this.registeredLayoutings == LayoutingType.None && IsDirty)
- IFace.EnqueueForRepaint (this);
+ EnqueueForRepaint ();
return true;
}
@@ -1913,13 +1930,8 @@ namespace Crow
public virtual void onDisable(object sender, EventArgs e){
Disabled.Raise (this, e);
}
- protected virtual void onParentChanged(object sender, DataSourceChangeEventArgs e) {
-// if (e.NewDataSource != null) {
-// if (width == Measure.Inherit)
-// RegisterForLayouting (LayoutingType.Width);
-// if (height == Measure.Inherit)
-// RegisterForLayouting (LayoutingType.Height);
-// }
+ protected virtual void onParentChanged(object sender, DataSourceChangeEventArgs e) {
+ RegisterForLayouting (LayoutingType.None);
ParentChanged.Raise (this, e);
if (logicalParent == null)
diff --git a/src/GraphicObjects/Grid.cs b/src/GraphicObjects/Grid.cs
index 4ae906a7..12a19dd7 100644
--- a/src/GraphicObjects/Grid.cs
+++ b/src/GraphicObjects/Grid.cs
@@ -155,9 +155,7 @@ namespace Crow
ComputeChildrenPositions ();
- //if no layouting remains in queue for item, registre for redraw
- if (RegisteredLayoutings == LayoutingType.None && IsDirty)
- IFace.EnqueueForRepaint (this);
+ EnqueueForRepaint ();
return true;
}
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs
index a90947a5..ebf75d64 100644
--- a/src/GraphicObjects/Group.cs
+++ b/src/GraphicObjects/Group.cs
@@ -243,14 +243,14 @@ namespace Crow
if (largestChild == null) {
//if still null, not possible to determine a width
//because all children are stretched, force first one to fit
- Children [0].Width = Measure.Fit;
+ //Children [0].Width = Measure.Fit;
return -1;//cancel actual sizing to let child computation take place
}
} else {
if (tallestChild == null)
searchTallestChild ();
if (tallestChild == null) {
- Children [0].Height = Measure.Fit;
+ //Children [0].Height = Measure.Fit;
return -1;
}
}
@@ -394,6 +394,7 @@ namespace Crow
#endif
largestChild = null;
contentSize.Width = 0;
+ childrenRWLock.EnterReadLock ();
for (int i = 0; i < Children.Count; i++) {
if (!Children [i].Visible)
continue;
@@ -404,6 +405,7 @@ namespace Crow
largestChild = Children [i];
}
}
+ childrenRWLock.ExitReadLock ();
}
void searchTallestChild(){
#if DEBUG_LAYOUTING
@@ -411,6 +413,7 @@ namespace Crow
#endif
tallestChild = null;
contentSize.Height = 0;
+ childrenRWLock.EnterReadLock ();
for (int i = 0; i < Children.Count; i++) {
if (!Children [i].Visible)
continue;
@@ -421,6 +424,7 @@ namespace Crow
tallestChild = Children [i];
}
}
+ childrenRWLock.ExitReadLock ();
}
diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs
index d6637247..f3f6dbf1 100644
--- a/src/GraphicObjects/PrivateContainer.cs
+++ b/src/GraphicObjects/PrivateContainer.cs
@@ -68,9 +68,13 @@ namespace Crow
contentSize = default(Size);
child.LayoutChanged -= OnChildLayoutChanges;
this.RegisterForGraphicUpdate ();
- }
- child = _child as GraphicObject;
+ GraphicObject tmp = child;
+ child = null;
+ tmp.Parent = null;
+ }
+
+ child = _child;
if (child != null) {
child.Parent = this;
diff --git a/src/GraphicObjects/Shape.cs b/src/GraphicObjects/Shape.cs
index a4b3193e..3bc46590 100644
--- a/src/GraphicObjects/Shape.cs
+++ b/src/GraphicObjects/Shape.cs
@@ -145,7 +145,7 @@ namespace Crow
}
}
}
- protected override int measureRawSize (LayoutingType lt)
+ protected override int measureRawSize(LayoutingType lt)
{
if ((lt == LayoutingType.Width && contentSize.Width == 0) || (lt == LayoutingType.Height && contentSize.Height == 0)) {
using (Surface drawing = new ImageSurface (Format.A1, 1,1)) {
diff --git a/src/GraphicObjects/TabView.cs b/src/GraphicObjects/TabView.cs
index 304e820d..af3d4af2 100644
--- a/src/GraphicObjects/TabView.cs
+++ b/src/GraphicObjects/TabView.cs
@@ -237,9 +237,7 @@ namespace Crow
curOffset += tabSpace;
}
- //if no layouting remains in queue for item, registre for redraw
- if (RegisteredLayoutings == LayoutingType.None && IsDirty)
- IFace.EnqueueForRepaint (this);
+ EnqueueForRepaint ();
return true;
}
diff --git a/src/GraphicObjects/TemplatedGroup.cs b/src/GraphicObjects/TemplatedGroup.cs
index f7c93763..6067f0ac 100644
--- a/src/GraphicObjects/TemplatedGroup.cs
+++ b/src/GraphicObjects/TemplatedGroup.cs
@@ -242,12 +242,14 @@ namespace Crow
void Ol_ListAdd (object sender, ListChangedEventArg e)
{
if (this.isPaged) {
- throw new NotImplementedException();
+ throw new NotImplementedException ();
// int p = e.Index / itemPerPage;
// int i = e.Index % itemPerPage;
// (items.Children [p] as Group).InsertChild (i, e.Element);
- } else
- loadItem (e.Element, items, dataTest);
+ } else {
+ lock(IFace.UpdateMutex)
+ loadItem (e.Element, items, dataTest);
+ }
}
[XmlAttributeAttribute][DefaultValue("SteelBlue")]
@@ -445,16 +447,19 @@ namespace Crow
iTemp = ItemTemplates ["default"];
}
- lock (IFace.LayoutMutex) {
- g = iTemp.CreateInstance();
+ //lock (IFace.LayoutMutex) {
+ g = iTemp.CreateInstance ();
+
#if DESIGN_MODE
g.design_isTGItem = true;
#endif
+
+
page.AddChild (g);
// if (isPaged)
g.LogicalParent = this;
g.MouseDown += itemClick;
- }
+ //}
if (iTemp.Expand != null && g is Expandable) {
Expandable e = g as Expandable;
diff --git a/src/GraphicObjects/TextRun.cs b/src/GraphicObjects/TextRun.cs
index 17e3b770..50e4f47f 100644
--- a/src/GraphicObjects/TextRun.cs
+++ b/src/GraphicObjects/TextRun.cs
@@ -145,7 +145,7 @@ namespace Crow
}
#region GraphicObject overrides
- protected override int measureRawSize (LayoutingType lt)
+ protected override int measureRawSize(LayoutingType lt)
{
if (lines == null)
lines = getLines;
diff --git a/src/GraphicObjects/Wrapper.cs b/src/GraphicObjects/Wrapper.cs
index a7f5f73b..9efb989c 100644
--- a/src/GraphicObjects/Wrapper.cs
+++ b/src/GraphicObjects/Wrapper.cs
@@ -118,7 +118,7 @@ namespace Crow
#endregion
#region GraphicObject Overrides
- protected override int measureRawSize (LayoutingType lt)
+ protected override int measureRawSize(LayoutingType lt)
{
int tmp = 0;
//Wrapper can't fit in the opposite direction of the wrapper, this func is called only if Fit
@@ -194,7 +194,6 @@ namespace Crow
return tmp + tallestChild + 2 * Margin;
}
}
-
public override bool UpdateLayout (LayoutingType layoutType)
{
RegisteredLayoutings &= (~layoutType);
@@ -205,9 +204,7 @@ namespace Crow
ComputeChildrenPositions ();
- //if no layouting remains in queue for item, registre for redraw
- if (RegisteredLayoutings == LayoutingType.None && IsDirty)
- IFace.EnqueueForRepaint (this);
+ EnqueueForRepaint ();
return true;
}
diff --git a/src/Interface.cs b/src/Interface.cs
index cc62a1aa..4716ec4e 100644
--- a/src/Interface.cs
+++ b/src/Interface.cs
@@ -587,6 +587,9 @@ namespace Crow
Monitor.Exit (UpdateMutex);
}
+ #if DEBUG_LAYOUTING
+ public string BreakingName;
+ #endif
/// <summary>Layouting loop, this is the first step of the udpate and process registered
/// Layouting queue items. Failing LQI's are requeued in this cycle until MaxTry is reached which
/// trigger an enqueue for the next Update Cycle</summary>
@@ -604,6 +607,8 @@ namespace Crow
#if DEBUG_LAYOUTING
currentLQI = lqi;
curLQIsTries.Add(currentLQI);
+ if (lqi.graphicObject.Name == BreakingName)
+ Debugger.Break();
#endif
lqi.ProcessLayouting ();
}
diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs
index 7efdf1bc..91385c3e 100644
--- a/src/LayoutingQueueItem.cs
+++ b/src/LayoutingQueueItem.cs
@@ -98,14 +98,12 @@ namespace Crow
public void ProcessLayouting()
{
GraphicObject go = Layoutable as GraphicObject;
-// if (go == null) {
-// Debug.WriteLine ("ERROR: processLayouting on something else than a graphic object: " + this.ToString ());
-// return;
-// }
go.parentRWLock.EnterReadLock ();
if (go.Parent == null) {//TODO:improve this
+ go.registeredLayoutings &= (~LayoutType);
+ go.requestedLayoutings |= LayoutType;
//cancel layouting for object without parent, maybe some were in queue when
//removed from a listbox
#if DEBUG_UPDATE || DEBUG_LAYOUTING
@@ -114,6 +112,7 @@ namespace Crow
go.parentRWLock.ExitReadLock ();
return;
}
+
#if DEBUG_LAYOUTING
LQITime.Start();
Debug.WriteLine ("=> " + this.ToString ());
@@ -135,11 +134,12 @@ namespace Crow
Layoutable.RegisteredLayoutings |= LayoutType;
(Layoutable as GraphicObject).IFace.DiscardQueue.Enqueue (this);
}
-// #if DEBUG_LAYOUTING
+ //#if DEBUG_LAYOUTING
else
Debug.WriteLine ("\tDELETED => " + this.ToString ());
-// #endif
+ //#endif
}
+
else{
if (LayoutingTries > 2 || DiscardCount > 0)
Debug.WriteLine (this.ToString ());