]> O.S.I.I.S - jp/crow.git/commitdiff
testing with requestedLayouting field RequestedLayoutings
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Thu, 15 Mar 2018 16:56:20 +0000 (17:56 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 18 Mar 2018 14:38:21 +0000 (15:38 +0100)
28 files changed:
CrowIDE/src/Editors/Editor.cs
CrowIDE/src/Editors/ImlVisualEditor.cs
CrowIDE/src/Editors/SvgEditor.cs
Templates/ScrollingListBox.template
Templates/TreeView.template
Tests/BasicTests.cs
Tests/GraphicObjects/TechBorder.cs
Tests/Interfaces/Divers/welcome.crow
Tests/Interfaces/TemplatedContainer/0.crow
Tests/Interfaces/TemplatedContainer/6.crow [deleted file]
Tests/Interfaces/TemplatedContainer/7.crow [deleted file]
Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow
Tests/Showcase.cs
Tests/Tests.csproj
Tests/ui/showcase.crow
src/GraphicObjects/Border.cs
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Grid.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/PrivateContainer.cs
src/GraphicObjects/Shape.cs
src/GraphicObjects/TabView.cs
src/GraphicObjects/TemplatedGroup.cs
src/GraphicObjects/TextRun.cs
src/GraphicObjects/Wrapper.cs
src/Interface.cs
src/LayoutingQueueItem.cs

index 2cd34412594c32ffb84c80c650028c25a9316629..7b95bb556a3e6d414929593e33f6e7fe71245b79 100644 (file)
@@ -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 () {
index b1759fbc93dec010d30279727ffd890623bbedc8..11f94c173cfbf0472625e69a2e1f4856898cef98 100644 (file)
@@ -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;
index 219eea67f263b46c241452feb0faa23c66d4b99a..fce3d1aae4967fbd94e7524bac5179171031125a 100644 (file)
@@ -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;
index 3b098df28c63a30bf653a7cf22113a9647610c65..67300ae9ed1d0bbd5a07306513c45f76803e6d26 100644 (file)
@@ -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>
index 9c18120ec65940de55a899f88f4af7aea211dcbc..0ac770b15944d610066fc3c2cf5f2aee8e445a05 100644 (file)
@@ -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>
index 149ff4a9ebc0c6f0a32b2e4707c76ffe5b591474..9691f9ec9a2d6cb052c2782589b5edce1bce9660 100644 (file)
@@ -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);
 
 
                }
index 4f818e51e7ccaa44fb4ba8416afc16359da3d5d8..d1f73324f260c5552b60655b4e2b8b2242e34992 100644 (file)
@@ -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;
                }
index 3445ef1c657ac2c536bdf4260176429abed480c0..74018ebea4b9e3c96be153cce456b55878dfa7c2 100644 (file)
@@ -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
index 195b981b1679d1cd91f867e3eaf67072c880cdb5..b53fa4ec4101a9f65f6224ff8e94859faffc9c95 100755 (executable)
@@ -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 (executable)
index 041bdf5..0000000
+++ /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 (executable)
index 0c94b6c..0000000
+++ /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>
index 90c475a5b518e7ff4cfa41c2e8b15895e5054cb9..7ddaf863a5845bb0720ba0c0610c30f2e340f899 100755 (executable)
@@ -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>
index da9b99dc89b5f4cec7ec40e8c0fcfe3c7092fc1c..215930222ada06044e0955da13ddca625227e6dc 100644 (file)
@@ -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 ();
                }
 
index c86ff9cb203835ef88bdc57effb1bf92cb111a43..ab976241bd1b2152c1a976ab9f2e4fd1dad9e693 100644 (file)
     <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>
index 61df4443bd8aeb0d9c521a317be9c8737107a268..9e273326b2f49ff3f6011eff90e3fddd9b7f1759 100755 (executable)
@@ -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/>
                        <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>
index adeb32e70a9903abbc784cfce03af5b9cfe6a435..a02c6a3c8f2dc4fdacba9eecceb143e9b491b15d 100644 (file)
@@ -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;
index 64841d4b79415dac9f5f9eff1da73b851390b6a3..7f452cb00d3115021b434f8bd788661846059d5b 100644 (file)
@@ -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;
                        }
index f404b5f1b71e8abf77b29802220f37014452c4b9..6903b9f978b64720193de9264a827571c3760f48 100644 (file)
@@ -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)
index 4ae906a783457b409f77ab3347d2f92450fd27df..12a19dd7fd5b273a5da8cf4930252e8360b4d94e 100644 (file)
@@ -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;
                        }
index a90947a56cedcce61bca0d052d24cd39c9fbd7b3..ebf75d641c12fbc5eb418330a174cc1ada4a5287 100644 (file)
@@ -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 ();
                }
 
 
index d66372475240fbacfb659e84be0946d95178e8be..f3f6dbf1f923c8c4a2a4b135f58ac5d52263d6f3 100644 (file)
@@ -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;
index a4b3193e8eb54f8e1048740dd2cdf197e805e56f..3bc465907e0bf56719d7826ba1c910674055d72d 100644 (file)
@@ -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)) {
index 304e820d8065224048978e9f422a58ed6cfea4a4..af3d4af2700c65d44663fe4f992853b441895b47 100644 (file)
@@ -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;
                        }
index f7c937638bb2c2e4ea6259625d6d41e6c0bdaa98..6067f0ac68204f8886f923dd2aed628d682f4281 100644 (file)
@@ -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;
index 17e3b7701f871e3e30cf552d086a545300bef08a..50e4f47fce6713de5d5064ca7e06c11a0d6cc79d 100644 (file)
@@ -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;
index a7f5f73b8965d50d46285605c37206ddb6c65beb..9efb989cab7b04db253ec8fbec29e8ac3dcfe376 100644 (file)
@@ -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;
                        }
index cc62a1aa82f02518d51d010d22c2c672802e58e6..4716ec4e4b0e690d4e15ffb610fc6d3c83ec5671 100644 (file)
@@ -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 ();
                                }
index 7efdf1bc0feef668e594800875c1a241927c690a..91385c3ef80504234cc6c37d6532e531eecdfa60 100644 (file)
@@ -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 ());