]> O.S.I.I.S - jp/crow.git/commitdiff
* Tests.csproj:
authorjpbruyere <jp.bruyere@hotmail.com>
Thu, 4 Aug 2016 11:12:30 +0000 (13:12 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Thu, 4 Aug 2016 12:29:18 +0000 (14:29 +0200)
* BasicTests.cs:
* TreeView.crow:
* welcome.crow:
* test4.crow:
* testWindow2.goml:
* testTreeView.crow:
* testDirViewer.crow: update tests

* Interface.cs:
* OpenTKGameWindow.cs: perf measures

* IMLStream.cs: datas prop

* TemplatedControl.cs: ItemTemplate

* ListBox.cs: thread sync

nouveau fichier : Tests/test.style

14 files changed:
Templates/TreeView.crow
Tests/BasicTests.cs
Tests/Interfaces/Divers/testWindow2.goml
Tests/Interfaces/Divers/welcome.crow
Tests/Interfaces/Unsorted/test4.crow [deleted file]
Tests/Interfaces/Unsorted/testDirViewer.crow
Tests/Interfaces/Unsorted/testTreeView.crow
Tests/OpenTKGameWindow.cs
Tests/Tests.csproj
Tests/test.style [new file with mode: 0644]
src/GraphicObjects/ListBox.cs
src/GraphicObjects/TemplatedControl.cs
src/IMLStream.cs
src/Interface.cs

index 82d2c3e9da92e9946d3dd464646819981b6ff7d8..8915e15484dd04d258ae416e20b264b2a1812fdc 100644 (file)
@@ -1,6 +1,6 @@
 <Border Background="DimGray" BorderWidth="1" Margin="1" MinimumSize="100,100"
                Width="{../WidthPolicy}" Height="{../HeightPolicy}">
-       <VerticalStack Width="{../WidthPolicy}" Height="{../HeightPolicy}"
+       <VerticalStack Width="{../../WidthPolicy}" Height="{../../HeightPolicy}"
                         Name="List" Margin="0" VerticalAlignment="Top"/>
 
 </Border>
index 0733f1893cb3e8046020e697151b3f30e3be55f5..0c515aa6f0961092045c653dcdbcc55e31cb28e6 100644 (file)
@@ -3,6 +3,7 @@ using Crow;
 using System.Collections.Generic;
 using System.Linq;
 using System.IO;
+using System.Reflection;
 
 
 namespace Tests
@@ -19,7 +20,10 @@ namespace Tests
 
                #region Test values for Binding
                public int intValue = 25;
-
+               DirectoryInfo curDir = new DirectoryInfo (Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
+               public FileSystemInfo[] CurDirectory {
+                       get { return curDir.GetFileSystemInfos (); }
+               }
                public int IntValue {
                        get {
                                return intValue;
@@ -105,6 +109,10 @@ namespace Tests
                                GraphicObject w = CrowInterface.LoadInterface ("Interfaces/Divers/testWindow.goml");
                                w.DataSource = this;
                                return;
+                       } else if (e.Key == OpenTK.Input.Key.F5) {
+                               GraphicObject w = CrowInterface.LoadInterface ("Interfaces/Divers/testWindow2.goml");
+                               w.DataSource = this;
+                               return;
                        } else if (e.Key == OpenTK.Input.Key.F2)
                                idx--;
                        else if (e.Key == OpenTK.Input.Key.F3)
index 6fb61db0bf9acac97deeb28f6798b40b434cc849..7f0caf31d5b5324b329c01ae62953efb0ee8da24 100755 (executable)
@@ -1,26 +1,33 @@
 <?xml version="1.0"?>
-<Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0.5,0.5,0.5,0.8" 
-       Focusable="True"  CornerRadius="20" MinimumSize="100,100" MaximumSize="500,500">
-       <Template>
-               <Border BorderWidth="1" Foreground="White" CornerRadius="20" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
-                       <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
-                               <Border BorderWidth="1" Foreground="White" Width="{../../../WidthPolicy}" Height="Fit" 
-                                               Background="0.1,0.5;1,0,0.5">
-                                       <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../WidthPolicy}" Height="Fit" >
-                                               <GraphicObject Width="5"/>
-                                               <Image Margin="1" Width="12" Height="12" Path="{../../../../../Icon}"/>
-                                               <Label Foreground="White" Width="{../../../../../WidthPolicy}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
-                                               <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"
-                                                       MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
-                                                       <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg"
-                                                                MouseClick="../../../../../../butQuitPress"/>
-                                               </Border>
-                                               <GraphicObject Width="5"/>
-                                       </HorizontalStack>
-                               </Border>
-                               <Container Name="Content" Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}" Background="0.5,0.5,0.5,0.5"/>
-                       </VerticalStack>
-               </Border>
-       </Template>
-       <GraphicObject Height="50" Width="50" Background="Green"/>
+<Window Focusable="true" Title="Measures" Width="30%" Height="Fit" MinimumSize="100,100">
+       <VerticalStack Width="90%" Height="Fit" Spacing="1" Margin="10">
+               <HorizontalStack Height="Fit">
+                       <Label Text="Fps:" Style="FpsLabel"/>
+                       <Label Text="{fps}" Style="FpsDisp"/>
+               </HorizontalStack>
+               <HorizontalStack Height="Fit">
+                       <Label Text="Min:" Style="FpsLabel"/>
+                       <Label Text="{fpsMin}" Style="FpsDisp"/>
+               </HorizontalStack>
+               <HorizontalStack Height="Fit">
+                       <Label Text="Max:" Style="FpsLabel"/>
+                       <Label Text="{fpsMax}" Style="FpsDisp"/>
+               </HorizontalStack>
+               <HorizontalStack Height="Fit">
+                       <Label Text="Update:" Style="FpsLabel"/>
+                       <Label Text="{update}" Style="FpsDisp"/>
+               </HorizontalStack>
+               <HorizontalStack Height="Fit">
+                       <Label Text="Layouting:" Style="FpsLabel"/>
+                       <Label Text="{layouting}" Style="FpsDisp"/>
+               </HorizontalStack>
+               <HorizontalStack Height="Fit">
+                       <Label Text="Clipping:" Style="FpsLabel"/>
+                       <Label Text="{clipping}" Style="FpsDisp"/>
+               </HorizontalStack>
+               <HorizontalStack Height="Fit">
+                       <Label Text="Drawing:" Style="FpsLabel"/>
+                       <Label Text="{drawing}" Style="FpsDisp"/>
+               </HorizontalStack>
+       </VerticalStack>
 </Window>
index 8a98b380c296a9feb9a22b95426454ec3c474c8c..65fc3577b0fa2860374c2165bfd773f6be77f452 100644 (file)
@@ -1,5 +1,6 @@
 <?xml version="1.0"?>
-<VerticalStack>
-       <Label Text="Press &lt;F3&gt; to cycle into the examples"/>
-       <Label Text="Those are basic tests used to validate changes"/>
+<VerticalStack Fit="true" VerticalAlignment="Top" Background="0.7,0.7,0.7,0.5"
+       Margin="10" CornerRadius="10">
+       <Label Font="20" Text="Press &lt;F3&gt; to cycle into the examples"/>
+       <Label Font="20" Text="Those are basic tests used to validate changes"/>
 </VerticalStack>
\ No newline at end of file
diff --git a/Tests/Interfaces/Unsorted/test4.crow b/Tests/Interfaces/Unsorted/test4.crow
deleted file mode 100755 (executable)
index 06476f3..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-<?xml version="1.0"?>
-<Group Name="MainGrp"
-       Width="800" Height="500"
-       Background="0.5,0.5,0.5,0.5" Foreground="White"
-       Margin="10" >
-       <Border Margin="10" CornerRadius="10"
-               Name="mainBorder"
-               BorderWidth="2" Foreground="Transparent"
-               Focusable="True"
-               MouseEnter="{Foreground = White}"
-               MouseLeave="{Foreground = Transparent}">
-               <HorizontalStack WidgetSpacing="1">
-                       <VerticalStack Width="Fit">
-                               <HorizontalStack WidgetSpacing="1" Fit="true">
-                                       <VerticalStack Fit="true">
-                                               <Label Text="{MousePosition}"/>
-                                               <HorizontalStack  Name="hsFocus" Fit="true">
-                                                       <Label Text="Focused:"/>
-                                                       <Label Name="labFocus"/>
-                                               </HorizontalStack>
-                                               <HorizontalStack Fit="true">
-                                                       <Label Text="Active:"  Name="hsActive"/>
-                                                       <Label Name="labActive"/>
-                                               </HorizontalStack>
-                                               <HorizontalStack Fit="true">
-                                                       <Label Text="Hover:"  Name="hsHover"/>
-                                                       <Label Name="labHover"/>
-                                               </HorizontalStack>
-                                       </VerticalStack>
-                                       <VerticalStack Fit="true">                                      
-                                               <CheckBox Name="chk1"/>
-                                               <CheckBox Name="chk2" IsChecked="true"/>
-
-                                       </VerticalStack>
-                                       <VerticalStack Fit="true">
-                                               <RadioButton IsChecked="true"/>
-                                               <RadioButton/>
-                                               <Button MouseClick="onButClick"/>
-                                       </VerticalStack>
-                               </HorizontalStack>
-                               <TextBox Name="textbox1" TextAlignment="Left" Font="droid,14"                                           
-                                                               Width="200" Height="Fit" Margin="2" Background="White"
-                                                               Forground="Black"
-                                                               Foreground="DimGray" BorderWidth="1"
-                                                               Text="editable text"/>
-                               <Popper Width="100">
-                                       <Border Fit="True" Background="ArmyGreen">
-                                               <Image Margin="10" Fit="true" Path="#Crow.Images.Icons.tetra.png"/>
-                                       </Border>
-                               </Popper>
-
-                       </VerticalStack>
-                       <VerticalStack Fit="true"  Margin="0" WidgetSpacing="1">
-                               <Button  Margin="1" Width="150" Height="100">
-                                       <Image Path="#Tests.image.tetra.png"/>
-                               </Button>
-                               <Popper Width="100">
-                                       <Border Fit="True" Background="ArmyGreen">
-                                               <Image Margin="10" Fit="true" Path="#Crow.Images.Icons.tetra.png"/>
-                                       </Border>
-                               </Popper>
-                               <Expandable Name="expander" Width="150" Height="Fit">
-                                       <VerticalStack Name="vsExpanded" Width="100">
-                                               <CheckBox Name="chk1"/>
-                                               <CheckBox Name="chk2" IsChecked="true"/>
-                                               <CheckBox Name="chk3"/>
-                                               <CheckBox Name="chk4"/>
-                                       </VerticalStack>                
-                               </Expandable>
-                               <Expandable Name="expander2" Width="150" Height="Fit">
-                                       <VerticalStack Name="vsExpanded" Width="100">
-                                               <CheckBox Name="chk1"/>
-                                               <CheckBox Name="chk2" IsChecked="true"/>
-                                       </VerticalStack>                
-                               </Expandable>
-                               <Expandable Name="expander3" Width="150" Height="Fit">
-                                       <VerticalStack Name="vsExpanded" Width="100">
-                                               <CheckBox Name="chk1" IsChecked="true"/>
-                                               <CheckBox Name="chk2"/>
-                                       </VerticalStack>                
-                               </Expandable>
-                               <HorizontalStack>
-                                       <Label Text="Update" FontColor="White"/>
-                                       <Label Name="labUpdate" Text="{update}" FontSize="16" Width="60" TextAlignment="Center" Background="DarkGreen"/>
-                               </HorizontalStack>
-                               <HorizontalStack>
-                                       <Label Text="Fps:" Width = "30"/>
-                                       <Label Name="labFps" Text="{fps}" Font="droid bold, 14"
-                                               TextAlignment="Center" Background="AoEnglish"/>
-                               </HorizontalStack>
-                               <HorizontalStack>
-                                       <Label Text="Min:" Width = "30"/>
-                                       <Label Name="labFpsMin" Text="{fpsMin}" Font="droid bold, 14"
-                                               TextAlignment="Center" Background="AoEnglish"/>
-                               </HorizontalStack>
-                               <HorizontalStack>
-                                       <Label Text="Max:" Width = "30"/>
-                                       <Label Name="labFpsMax" Text="{fpsMax}" Font="droid bold, 14"
-                                               TextAlignment="Center" Background="AoEnglish"/>
-                               </HorizontalStack>
-                       </VerticalStack>
-                       <HorizontalStack Width="Fit">
-                               <Scroller Name="scroller1" Background="DimGray" Width="Fit"  
-                                        Margin="5" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">
-                                       <VerticalStack Name="colors" VerticalAlignment="Top" Margin="1" Fit="true">
-<!--                                           <ProgressBar Name="pbBar2" Width="100" Height="20" Value="50"
-                                                                       BorderWidth="2" Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>
-                                               <ProgressBar Width="100" Height="20" Value="{fps}" BorderWidth="2"
-                                                       Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>                                                                                             -->
-                                       </VerticalStack>
-                               </Scroller>
-                               <ScrollBar Name="scrollbar1" Scroll="{../scroller1.ScrollY}" MaximumScroll="{../scroller1.MaximumScroll}"
-                                       Orientation="Vertical" Width="10" Height="Stretched"/>
-                       </HorizontalStack>
-               </HorizontalStack>
-<!--           <HorizontalStack Name="hs0"
-                       WidgetSpacing="1" 
-                       VerticalAlignment="Top">
-                       <Slider Orientation="Vertical" Height="300" Width="10" Background="Transparent" />
-                       <VerticalStack Name="vs1" Spacing="5">
-                               <Slider Height="10" Width="300" BorderWidth="1" Background="Transparent" />
-                               <HorizontalStack WidgetSpacing="10">
-                                       
-
-                                       <Spinner Width="50" Value="5"></Spinner>
-                               </HorizontalStack>
-                               <HorizontalStack Name="hsPbar" Margin="5">
-                                       <ProgressBar Name="pbBar" 
-                                               Width="200" Height="20"
-                                               Minimum="0"
-                                               Maximum="200"
-                                               Value="{fps}"
-                                               Foreground="BlueCrayola" Background="DarkGray"
-                                               BorderWidth="2" Foreground="White"/>
-                               </HorizontalStack>
-
-                               <Button  Margin="5" BorderWidth="Stretched" Width="Fit" Height="Fit"  HorizontalAlignment="Center">
-                                       <Label FontSize="18" Text="This is a test" Margin="5" Foreground="Black" />
-                               </Button>
-
-                               <GroupBox Title="Group Box" Width="300" Height="100" 
-                                       Foreground="White" BorderWidth="2" Margin="3">
-                                       <Label Name="labValue" FontSize="14" Text="{../../slider.Value}" TextAlignment="Center"/>
-                               </GroupBox>
-                               <Slider Height="10" Width="300" BorderWidth="1" Background="Transparent" />
-                               <GraduatedSlider Name="slider" Height="30" Width="300" Foreground="BlueBell"/>
-                       </VerticalStack>
-       
-                       <HorizontalStack Height="350" Width="Fit">
-                               <Scroller Name="scroller1" Background="DimGray" Height="Stretched" Width="Fit"  
-                                        Margin="5" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">
-                                       <VerticalStack Name="colors" VerticalAlignment="Top" Margin="1">
-                                               <ProgressBar Name="pbBar2" Width="100" Height="20" Value="50"
-                                                                       BorderWidth="2" Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>
-                                               <ProgressBar Width="100" Height="20" Value="{fps}" BorderWidth="2"
-                                                       Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>                                                                                             
-                                       </VerticalStack>
-                               </Scroller>
-                               <Scrollbar Name="scrollbar1" Scroll="{../scroller1.ScrollY}" MaximumScroll="{../scroller1.MaximumScroll}"
-                                       Orientation="Vertical" Width="16" />
-                       </HorizontalStack>
-               </HorizontalStack>
--->
-<!--           <Slider 
-                       Height="20" Width="100" 
-                       Background="Transparent"
-                       VerticalAlignment="Bottom" />-->
-               </Border>
-</Group>
\ No newline at end of file
index af170947ffd22a7bb6209b795da4dcea10c180a3..bc25428e66edaec688165898948805ab7506d3f9 100755 (executable)
@@ -1,17 +1,17 @@
 <?xml version="1.0"?>
 
        <VerticalStack Height="Fit" Width="Fit" Name="hstack" Margin="0" Spacing="0">
-               <Border Height="Fit" Width="200" BorderWidth="2" CornerRadius="10">
+               <Border Height="100%" Width="50%" BorderWidth="2" CornerRadius="10">
                        <Label Name="labName" Text="{Name}" Width="Stretched" Height="Fit"/>
                </Border>
                <ListBox Data="{GetFileSystemInfos}" Width="Fit" Height="400"
                        Background="0.5,0.5,0.5,0.5"
-                       SelectedItemChanged="OnSelectedItemChanged" 
+                       SelectedItemChanged="OnSelectedItemChanged"
                        ItemTemplate="Interfaces/tmpDirItem.goml" >
                        <Template>
                                <Border BorderWidth="1" MinimumSize="20,20" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
                                        <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
-                                               <Scroller  Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}" 
+                                               <Scroller  Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
                                                 Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">
                                                        <VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" Name="List" Margin="0" VerticalAlignment="Top"/>
                                                </Scroller>
index 9504c958b2ff8877d90b88a20bede8a46689ab20..c998af3930bcd68a8c971c237d27151cc11fdc9a 100755 (executable)
@@ -1,2 +1,37 @@
 <?xml version="1.0"?>
-<TreeView Height="400" Width="200" Data="{List2}" ItemTemplate="#Crow.Templates.TreeItem.crow"/>
\ No newline at end of file
+<TreeView Height="90%" Width="90%" Data="{CurDirectory}">
+       <ItemTemplate DataType="System.IO.FileInfo">
+               <Label Background="Mantis" Text="{}" Width="Stretched"/>
+<!--           <Expandable Caption="{}">
+                       <Template>
+                               <Border BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}" 
+                                       MouseClick="../onMouseClick">
+                                       <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+                                               <HorizontalStack Spacing="1" Height="Fit" Width="{../../../WidthPolicy}">
+                                                       <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>
+                                                       <Label Text="{../../../../Caption}" Width="{../../../../WidthPolicy}"/>
+                                               </HorizontalStack>
+                                               <Container Name="Content" Visible="false" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
+                                       </VerticalStack>
+                               </Border>
+                       </Template>
+               </Expandable>-->
+       </ItemTemplate>
+       <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">             
+               <Expandable Caption="{Name}" >
+                       <Template>
+                               <VerticalStack Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+                                       <HorizontalStack Spacing="1" Height="-1" Width="{../../WidthPolicy}">
+                                               <Image Margin="2" Width="12" Height="12"
+                                                       Visible="{../../../HasContent}"
+                                                       Path="{../../../Image}" 
+                                                       SvgSub="{../../../IsExpanded}"/>
+                                               <Label Text="{../../../Caption}" Width="{../../../WidthPolicy}"/>
+                                       </HorizontalStack>
+                                       <Container Name="Content" Visible="false"
+                                               Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
+                               </VerticalStack>
+                       </Template>
+               </Expandable>
+       </ItemTemplate>
+</TreeView>
\ No newline at end of file
index 2b3bdb245937f995c553ddc0cdd26e9f34ce7e7a..9b4d0a0657f863b505ab7e47f2568645d8462b1c 100644 (file)
@@ -61,11 +61,13 @@ namespace Crow
                                ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps));
                                #if MEASURE_TIME
                                ValueChanged.Raise (this, new ValueChangeEventArgs ("update",
-                                       this.CrowInterface.clippingTime.ElapsedTicks.ToString () + " ticks"));
+                                       this.CrowInterface.updateTime.ElapsedTicks.ToString () + " ticks"));
                                ValueChanged.Raise (this, new ValueChangeEventArgs ("layouting",
                                        this.CrowInterface.layoutTime.ElapsedTicks.ToString () + " ticks"));
                                ValueChanged.Raise (this, new ValueChangeEventArgs ("drawing",
                                        this.CrowInterface.drawingTime.ElapsedTicks.ToString () + " ticks"));
+                               ValueChanged.Raise (this, new ValueChangeEventArgs ("clipping",
+                                       this.CrowInterface.clippingTime.ElapsedTicks.ToString () + " ticks"));
                                #endif
                        }
                }
@@ -82,6 +84,7 @@ namespace Crow
                public string update = "";
                public string drawing = "";
                public string layouting = "";
+               public string clipping = "";
                #endregion
 
                #region ctor
index d365c0600e6f18998b754c2fa8cf6a1882a46c93..56e6a1ec2cf9fa907143a8e757b26ff8e2ef10cd 100644 (file)
     <None Include="Interfaces\Unsorted\testColorList.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
-    <None Include="Interfaces\Unsorted\test4.crow">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
     <None Include="Interfaces\Unsorted\test6.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <EmbeddedResource Include="ui\LabelButton.style" />
     <EmbeddedResource Include="ui\Popper.template" />
     <EmbeddedResource Include="ui\MenuItem.style" />
+    <EmbeddedResource Include="test.style" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\Crow.csproj">
diff --git a/Tests/test.style b/Tests/test.style
new file mode 100644 (file)
index 0000000..a05c930
--- /dev/null
@@ -0,0 +1,13 @@
+FpsLabel {
+       Width = 50%;
+       Font = droid, 10;
+       Margin = 1;
+       TextAlignment = Center;
+       Background = Jet;
+}
+FpsDisp {
+       Font = droid , 12;
+       Width = 50%;
+       TextAlignment = Center;
+       Background = Teal;
+}
index c315d81d34c7bfd160418d9dbd62504d4210af55..826eb38876f8fad7873c1995bb74f559f7164c64 100644 (file)
@@ -112,11 +112,11 @@ namespace Crow
                }
                #endregion
                void loading(){
-                       if (itemTemplates == null) {
+                       if (itemTemplates == null)
                                itemTemplates = new Dictionary<string, IMLStream> ();
-                               //TODO:check encoding
+                       if (!itemTemplates.ContainsKey ("default"))
                                itemTemplates["default"] = new IMLStream (ItemTemplate);
-                       }
+
                        for (int i = 1; i <= (data.Count / itemPerPage) + 1; i++) {
                                if (cancelLoading)
                                        return;
@@ -160,23 +160,30 @@ namespace Crow
                                        return;
                                
                                GraphicObject g = null;
+                               IMLStream itemStream = null;
                                Type dataType = data [i].GetType ();
-                               if (itemTemplates.ContainsKey (dataType.FullName))
-                                       g = Interface.Load (itemTemplates [dataType.FullName]);
-                               else if (itemTemplates.ContainsKey ("default"))
-                                       g = Interface.Load (itemTemplates ["default"]);                         
 
-                               g.MouseClick += itemClick;
+                               if (itemTemplates.ContainsKey (dataType.FullName)) {
+                                       itemStream = itemTemplates [dataType.FullName];
+                               } else {
+                                       itemStream = itemTemplates ["default"];
+                               }
 
-                               lock (Interface.CurrentInterface.UpdateMutex)
+                               lock (Interface.CurrentInterface.UpdateMutex) {
+                                       g = Interface.Load (itemStream);
                                        page.AddChild (g);
-                               g.DataSource = data [i];
+                                       g.DataSource = data [i];
+                               }
+                               g.MouseClick += itemClick;
+                               if (!string.IsNullOrEmpty (itemStream.Datas)) {
+
+                               }
                                //g.LogicalParent = this;
                        }
 
                        lock (Interface.CurrentInterface.UpdateMutex)
                                _list.AddChild (page);
-                               
+
                        #if DEBUG_LOAD
                        loadingTime.Stop ();
                        Debug.WriteLine("Listbox {2} Loading: {0} ticks \t, {1} ms",
@@ -216,66 +223,6 @@ namespace Crow
                void itemClick(object sender, MouseButtonEventArgs e){
                        SelectedIndex = data.IndexOf((sender as GraphicObject).DataSource);
                }
-
-               #region IXmlSerializable
-//             public override System.Xml.Schema.XmlSchema GetSchema(){ return null; }
-//             public override void ReadXml(System.Xml.XmlReader reader)
-//             {
-//                     //Template could be either an attribute containing path or expressed inlined
-//                     //as a Template Element
-//                     using (System.Xml.XmlReader subTree = reader.ReadSubtree())
-//                     {
-//                             subTree.Read ();
-//
-//                             string template = reader.GetAttribute ("Template");
-//                             string tmp = subTree.ReadOuterXml ();
-//
-//                             //Load template from path set as attribute in templated control
-//                             if (string.IsNullOrEmpty (template)) {                                  
-//                                     //seek for template tag first
-//                                     using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
-//                                             //load template first if inlined
-//
-//                                             xr.Read (); //skip current node
-//
-//                                             while (!xr.EOF) {
-//                                                     xr.Read (); //read first child
-//                                                     if (!xr.IsStartElement ())
-//                                                             continue;
-//                                                     if (xr.Name == "Template") {
-//                                                             xr.Read ();
-//
-//                                                             Type t = Type.GetType ("Crow." + xr.Name);
-//                                                             GraphicObject go = (GraphicObject)Activator.CreateInstance (t);                                
-//                                                             (go as IXmlSerializable).ReadXml (xr);
-//
-//                                                             loadTemplate (go);
-//
-//                                                             xr.Read ();//go close tag
-//                                                             xr.Read ();//Template close tag
-//                                                             break;
-//                                                     } else {
-//                                                             xr.ReadInnerXml ();
-//                                                     }
-//                                             }
-//                                     }                               
-//                             } else
-//                                     loadTemplate (Interface.Load (template, this));
-//
-//
-//                             //normal xml read
-//                             using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
-//                                     xr.Read ();
-//                                     base.ReadXml(xr);
-//                             }
-//                     }
-//             }
-//             public override void WriteXml(System.Xml.XmlWriter writer)
-//             {
-//                     //TODO:
-//                     throw new NotImplementedException();
-//             }
-               #endregion
        }
 }
 
index 5b7df01d80d38352daa5f61057ad895d3c6b2110..590ca84ba858c88444d06a2b1eb207d29b960840 100644 (file)
@@ -131,14 +131,16 @@ namespace Crow
                                        using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
                                                //load template first if inlined
 
-                                               xr.Read (); //skip current node
+                                               xr.Read (); //read first child
+                                               xr.Read (); //skip root node
 
-                                               while (!xr.EOF) {
-                                                       xr.Read (); //read first child
-                                                       if (!xr.IsStartElement ())
+                                               while (!xr.EOF) {                                                       
+                                                       if (!xr.IsStartElement ()) {
+                                                               xr.Read ();
                                                                continue;
+                                                       }
                                                        if (xr.Name == "ItemTemplate") {
-                                                               string dataType = "default", datas, itemTmp;
+                                                               string dataType = "default", datas = "", itemTmp;
                                                                while (xr.MoveToNextAttribute ()) {
                                                                        if (xr.Name == "DataType")
                                                                                dataType = xr.Value;
@@ -147,13 +149,16 @@ namespace Crow
                                                                }
                                                                xr.MoveToElement ();
                                                                itemTmp = xr.ReadInnerXml ();
-                                                               xr.Read ();//itemTemplate close tag
+
                                                                if (itemTemplates == null)
                                                                        itemTemplates = new Dictionary<string, IMLStream> ();
                                                                //TODO:check encoding
                                                                itemTemplates[dataType] = new IMLStream (Encoding.UTF8.GetBytes(itemTmp));
+                                                               itemTemplates [dataType].Datas = datas;
 
-                                                       }else if (xr.Name == "Template") {
+                                                               continue;
+                                                       }
+                                                       if (xr.Name == "Template") {
                                                                xr.Read ();
 
                                                                Type t = Type.GetType ("Crow." + xr.Name);
@@ -161,11 +166,9 @@ namespace Crow
                                                                (go as IXmlSerializable).ReadXml (xr);
 
                                                                loadTemplate (go);
-
-                                                               xr.Read ();//go close tag
-                                                               //xr.Read ();//Template close tag
-                                                       } else
-                                                               xr.ReadInnerXml ();
+                                                               continue;
+                                                       }
+                                                       xr.ReadInnerXml ();
                                                }
                                        }
                                } else
index 776a70e7d2c489b05a5329b4604697996ca5f64e..7207327d5393cff24a2f6d95384eaa7652d5e6fc 100644 (file)
@@ -25,7 +25,9 @@ namespace Crow
 {
        public class IMLStream : MemoryStream {
                public Type RootType;
-               public IMLStream(string path) : base (){                        
+               //TODO:this has nothing to do in there, I should derive IMLStream
+               public string Datas;
+               public IMLStream(string path) : base (){
                        using (Stream stream = Interface.GetStreamFromPath (path))
                                stream.CopyTo (this);
                        RootType = Interface.GetTopContainerOfXMLStream (this);
index 208bd2a4adb3165613c3e6db08d726870874f6df..3cfed98167fc5b9ce93ba5394b0ca408798994a8 100644 (file)
@@ -284,7 +284,7 @@ namespace Crow
                #if MEASURE_TIME
                public Stopwatch clippingTime = new Stopwatch ();
                public Stopwatch layoutTime = new Stopwatch ();
-               public Stopwatch guTime = new Stopwatch ();
+               public Stopwatch updateTime = new Stopwatch ();
                public Stopwatch drawingTime = new Stopwatch ();
                #endif
 
@@ -377,12 +377,20 @@ namespace Crow
                        if (!Monitor.TryEnter (UpdateMutex))
                                return;
 
+                       #if MEASURE_TIME
+                       updateTime.Restart();
+                       #endif
+
                        processLayouting ();
 
                        clippingRegistration ();
 
                        processDrawing ();
 
+                       #if MEASURE_TIME
+                       updateTime.Stop ();
+                       #endif
+
                        Monitor.Exit (UpdateMutex);
                }
                void processLayouting(){