diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-20 14:17:56 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-20 14:22:24 +0100 |
| commit | d8367a33368e783c15f2072daa9237b2643526d3 (patch) | |
| tree | b770c2b8d3d6f0b6f6f69676f0e42194af2c053a | |
| parent | 0ce668c6c13521ebfcb9ed02365556a31a65b6b2 (diff) | |
debug threading with new TemplatedGroup arch, review examples.singleLeveledTemplatedGroup
33 files changed, 457 insertions, 217 deletions
diff --git a/Crow.csproj b/Crow.csproj index f9c42c85..228f21aa 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -379,6 +379,7 @@ </EmbeddedResource> <EmbeddedResource Include="Icons\compiler_error.svg" /> <EmbeddedResource Include="Icons\project.svg" /> + <EmbeddedResource Include="Icons\crowproj.svg" /> <EmbeddedResource Include="Icons\projectRef.svg" /> <EmbeddedResource Include="Templates\DockWindow.template"> <LogicalName>Crow.DockWindow.template</LogicalName> diff --git a/CrowIDE/ui/ProjectTree.template b/CrowIDE/ui/ProjectTree.template index eadb733c..34a5cc84 100644 --- a/CrowIDE/ui/ProjectTree.template +++ b/CrowIDE/ui/ProjectTree.template @@ -11,14 +11,14 @@ MouseEnter="{Foreground=DimGray}" MouseLeave="{Foreground=Transparent}"> <HorizontalStack Spacing="1"> - <Image Margin="1" Width="9" Height="9" Focusable="true" MouseClick="./onClickForExpand" + <Image Margin="1" Width="9" Height="9" Focusable="true" MouseDown="./onClickForExpand" Path="{./Image}" Visible="{./IsExpandable}" SvgSub="{./IsExpanded}" MouseEnter="{Background=LightGray}" MouseLeave="{Background=Transparent}"/> <Image Margin="1" Width="14" Height="14" - Path="#Crow.Icons.project.svg"/> + Path="#Crow.Icons.crowproj.svg"/> <GraphicObject Width="2" Height="9" Background="Green" Visible="{IsStartupProject}"/> <Label Text="{./Caption}"/> </HorizontalStack> diff --git a/CrowIDE/ui/TreeExpandable.template b/CrowIDE/ui/TreeExpandable.template index 08093e4c..a2d14acd 100644 --- a/CrowIDE/ui/TreeExpandable.template +++ b/CrowIDE/ui/TreeExpandable.template @@ -5,7 +5,7 @@ MouseEnter="{Foreground=DimGray}" MouseLeave="{Foreground=Transparent}"> <HorizontalStack Spacing="1"> - <Image Margin="1" Width="9" Height="9" Focusable="true" MouseClick="./onClickForExpand" + <Image Margin="1" Width="9" Height="9" Focusable="true" MouseDown="./onClickForExpand" Path="{./Image}" Visible="{./IsExpandable}" SvgSub="{./IsExpanded}" diff --git a/Icons/crowproj.svg b/Icons/crowproj.svg new file mode 100644 index 00000000..b0f6b860 --- /dev/null +++ b/Icons/crowproj.svg @@ -0,0 +1,8 @@ +<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg"> + <!-- Created with Method Draw - http://github.com/duopixel/Method-Draw/ --> + <g> + <rect opacity="1.0" rx="5" id="svg_1" height="59" width="59" y="2.5" x="2.5" stroke-width="6" stroke="#111111" fill="#bbbbcc"/> + <rect opacity="1.0" rx="5" id="svg_1" height="22" width="59" y="2.5" x="2.5" stroke-width="6" stroke="#111111" fill="#4455aa"/> +<!-- <line stroke-linecap="undefined" stroke-linejoin="undefined" id="svg_2" y2="24.5" x2="61.5" y1="24.5" x1="2.5" stroke-width="6" stroke="#bbbbbb" fill="none"/>--> + </g> +</svg>
\ No newline at end of file diff --git a/Icons/project.svg b/Icons/project.svg index 1f9a1f1b..7522605c 100644 --- a/Icons/project.svg +++ b/Icons/project.svg @@ -4,6 +4,6 @@ height="64" width="64"> <g> - <path fill="#007fff" stroke="#111111" stroke-width="2" d="m1.655043,19.482317l17.905939,-17.913175l25.323143,0l17.905937,17.913175l0,25.333551l-17.905937,17.913147l-25.323143,0l-17.905939,-17.913147l0,-25.333551z" id="svg_2"/> + <path fill="#3333dd" stroke="#bbbbff" stroke-width="10" d="m1.655043,19.482317l17.905939,-17.913175l25.323143,0l17.905937,17.913175l0,25.333551l-17.905937,17.913147l-25.323143,0l-17.905939,-17.913147l0,-25.333551z" id="svg_2"/> </g> </svg> diff --git a/Microsoft.Build.cs b/Microsoft.Build.cs deleted file mode 100644 index eadbfe1e..00000000 --- a/Microsoft.Build.cs +++ /dev/null @@ -1,16 +0,0 @@ -// ------------------------------------------------------------------------------ -// <autogenerated> -// This code was generated by a tool. -// Mono Runtime Version: 4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// </autogenerated> -// ------------------------------------------------------------------------------ - -// -//This source code was auto-generated by MonoXSD -// -namespace Schemas { - -} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index b83b6e28..3e2b7331 100755 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -43,7 +43,7 @@ using System.Runtime.CompilerServices; // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion ("0.5.*")] +[assembly: AssemblyVersion ("0.7.1.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. diff --git a/Templates/DirectoryView.template b/Templates/DirectoryView.template index 826dd3f8..2e42ae91 100755 --- a/Templates/DirectoryView.template +++ b/Templates/DirectoryView.template @@ -21,7 +21,7 @@ MouseEnter="{Foreground=DimGray}" MouseLeave="{Foreground=Transparent}"> <HorizontalStack Spacing="1"> - <Image Margin="1" Width="9" Height="9" Focusable="true" MouseClick="./onClickForExpand" + <Image Margin="1" Width="9" Height="9" Focusable="true" MouseDown="./onClickForExpand" Path="{./Image}" Visible="{./IsExpandable}" SvgSub="{./IsExpanded}" diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs index 97469591..5e988c81 100644 --- a/Tests/BasicTests.cs +++ b/Tests/BasicTests.cs @@ -39,13 +39,19 @@ namespace Tests class BasicTests : CrowWindow { public BasicTests () - : base(1280, 800,"test: press <F3> to toogle test files") + : base(800, 600,"test: press <F3> to toogle test files") { } int idx = 0; string[] testFiles; + public Version CrowVersion { + get { + return System.Reflection.Assembly.GetAssembly(typeof(GraphicObject)).GetName().Version; + } + } + #region Test values for Binding public List<Crow.Command> Commands; public int intValue = 500; @@ -162,31 +168,26 @@ namespace Tests this.KeyDown += KeyboardKeyDown1; - //testFiles = new string [] { @"Interfaces/Unsorted/testFileDialog.crow" }; - //testFiles = new string [] { @"Interfaces/Divers/colorPicker.crow" }; testFiles = new string [] { @"Interfaces/Divers/welcome.crow" }; - //testFiles = new string [] { @"Interfaces/TemplatedContainer/testTabView.crow" }; - //testFiles = new string [] { @"Interfaces/TemplatedControl/testSpinner.crow" }; - //testFiles = new string [] { @"Interfaces/DragAndDrop/0.crow" }; - //testFiles = new string [] { @"Interfaces/TemplatedControl/testItemTemplateTag.crow" }; - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedControl", "*.crow")).ToArray (); - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.crow")).ToArray (); 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 (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Stack", "*.crow")).ToArray (); - + testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedControl", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedContainer", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedGroup", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Splitter", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Wrapper", "*.crow")).ToArray (); + testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/DragAndDrop", "*.crow")).ToArray (); - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Unsorted", "*.crow")).ToArray (); + //testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Experimental", "*.crow")).ToArray (); Load(testFiles[idx]).DataSource = this; } void KeyboardKeyDown1 (object sender, OpenTK.Input.KeyboardKeyEventArgs e) { + try { + if (e.Key == OpenTK.Input.Key.Escape) { Quit (null, null); return; @@ -217,7 +218,6 @@ namespace Tests else return; - try { ClearInterface (); if (idx == testFiles.Length) @@ -230,7 +230,7 @@ namespace Tests GraphicObject obj = Load (testFiles[idx]); obj.DataSource = this; } catch (Exception ex) { - MessageBox.Show (CurrentInterface, MessageBox.Type.Error, ex.Message + "\n" + ex.InnerException); + MessageBox.Show (CurrentInterface, MessageBox.Type.Error, ex.Message + "\n" + ex.InnerException.Message); } } // void Tv_SelectedItemChanged (object sender, SelectionChangeEventArgs e) @@ -264,13 +264,17 @@ namespace Tests { Console.WriteLine ("button clicked:" + send.ToString()); } -// void onAddTabButClick(object sender, MouseButtonEventArgs e){ -// -// TabView tv = ifaceControl.CrowInterface.FindByName("tabview1") as TabView; -// if (tv == null) -// return; -// tv.AddChild (new TabItem () { Caption = "NewTab" }); -// } + void onAddTabButClick(object sender, MouseButtonEventArgs e){ + + TabView tv = FindByName("tabview1") as TabView; + if (tv == null) + return; + //tv.AddChild (new TabItem (CurrentInterface) { Caption = "NewTab" }); + lock (CurrentInterface.UpdateMutex) { + tv.AddChild (Crow.IML.Instantiator.CreateFromImlFragment + (@"<TabItem Caption='New tab' Background='Blue'><Label/></TabItem>").CreateInstance (CurrentInterface)); + } + } [STAThread] static void Main () { diff --git a/Tests/Interfaces/Divers/0.crow b/Tests/Interfaces/Divers/0.crow index 055b037e..47f36af5 100755 --- a/Tests/Interfaces/Divers/0.crow +++ b/Tests/Interfaces/Divers/0.crow @@ -148,8 +148,8 @@ <VerticalStack Width="30%" Margin="5"> <!-- <Border Margin="5" Height="Fit"> <Label Width="Stretched" Margin="1" Text="{../../dv.SelectedItem}"/> - </Border>--> -<!-- <Border Margin="5" Height="30%"> + </Border> + <Border Margin="5" Height="30%"> <DirectoryView Name="dv" CurrentDirectory="/" Margin="1"/> </Border> <Splitter/>--> diff --git a/Tests/Interfaces/GraphicObject/testCtxMenu.crow b/Tests/Interfaces/Divers/testCtxMenu.crow index 86ebcf2f..edffc70a 100755 --- a/Tests/Interfaces/GraphicObject/testCtxMenu.crow +++ b/Tests/Interfaces/Divers/testCtxMenu.crow @@ -1,4 +1,4 @@ <?xml version="1.0"?> -<GraphicObject MouseEnter="{Background=Red}" MouseLeave="{Background=Green}" Margin="10" Width="50%" Height="50%" Focusable="true" +<GraphicObject Margin="10" Width="50%" Height="50%" Focusable="true" Background="hgradient|0:Red|0.25:Blue|0.5:Green|0.75:Yellow|1:Red" MinimumSize="50,50" ContextCommands="{Commands}"/>
\ No newline at end of file diff --git a/Tests/Interfaces/Divers/testDock.crow b/Tests/Interfaces/Divers/testDock.crow deleted file mode 100644 index 3dc9a6eb..00000000 --- a/Tests/Interfaces/Divers/testDock.crow +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0"?> -<Docker Background="Jet" Margin = "0" Focusable="true" > - <DockWindow Focusable="true" Caption="View 1" Width="100" Height="100"><GraphicObject Background="Green"/></DockWindow> - <DockWindow Focusable="true" Caption="View 2" Resizable = "true" Width="100" Height="100"><GraphicObject Background="Blue"/></DockWindow> - <DockWindow Focusable="true" Caption="View 3" Resizable = "true" Width="100" Height="100"><GraphicObject Background="Yellow"/></DockWindow> - <DockWindow Focusable="true" Caption="View 4" Resizable = "true" Width="100" Height="100"><GraphicObject Background="Black"/></DockWindow> -</Docker>
\ No newline at end of file diff --git a/Tests/Interfaces/Unsorted/testFileDialog.crow b/Tests/Interfaces/Divers/testFileDialog.crow index 868baf63..868baf63 100644 --- a/Tests/Interfaces/Unsorted/testFileDialog.crow +++ b/Tests/Interfaces/Divers/testFileDialog.crow diff --git a/Tests/Interfaces/Divers/testIMLContainer.crow b/Tests/Interfaces/Divers/testIMLContainer.crow new file mode 100644 index 00000000..2ba5f2cd --- /dev/null +++ b/Tests/Interfaces/Divers/testIMLContainer.crow @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<IMLContainer Path="Interfaces/Divers/colorPicker.crow"/>
\ No newline at end of file diff --git a/Tests/Interfaces/Divers/testImage.crow b/Tests/Interfaces/Divers/testImage.crow index cfa0f113..eddea8aa 100755 --- a/Tests/Interfaces/Divers/testImage.crow +++ b/Tests/Interfaces/Divers/testImage.crow @@ -2,7 +2,7 @@ <VerticalStack Fit="true"> <HorizontalStack Fit="true" Background="hgradient|0:DarkRed|1:Transparent" Margin="5"> <Label Text="SCALED PROPORTIONNAL" Width="150"/> - <Image Width="50%" Height="Fit" Background="vgradient|0:SkyBlue|1:White" Path="#Tests.image.crow0.svg"/> + <Image Width="10%" Height="Fit" Background="vgradient|0:SkyBlue|1:White" Path="#Tests.image.crow0.svg"/> <Image Margin="10" Background="vgradient|0:SkyBlue|1:White" Path="#Tests.image.crow0.svg" /> <Image Background="vgradient|0:SkyBlue|1:White" Width="20" Height="20" Path="#Tests.image.crow0.svg" /> <Image Margin="2" Background="vgradient|0:SkyBlue|1:White" Width="20" Height="20" Path="#Tests.image.crow0.svg" /> diff --git a/Tests/Interfaces/Divers/welcome.crow b/Tests/Interfaces/Divers/welcome.crow index c4ec889f..3a08829c 100644 --- a/Tests/Interfaces/Divers/welcome.crow +++ b/Tests/Interfaces/Divers/welcome.crow @@ -1,7 +1,21 @@ <?xml version="1.0"?> -<VerticalStack Fit="true" VerticalAlignment="Top" Background="0.7,0.7,0.7,0.5" - Margin="10" CornerRadius="10"> - <Label Font="20" Text="Press <F3> to cycle into the examples"/> - <Label Font="20" Text="Those are basic tests used to validate changes"/> - <Label Font="20" Text="{fps}"/> -</VerticalStack>
\ No newline at end of file +<Border BorderStyle="Sunken" Fit="true" Background="0.7,0.7,0.7,0.5" CornerRadius="10"> + <VerticalStack Margin="20"> + <Image Path="#Crow.Images.Icons.crow.svg"/> +<!-- <Label Font="Times bold, 60" Text="C.R.O.W"/>--> + <HorizontalStack Fit="true" DataSource="{CrowVersion}" Spacing="0"> + <Label Foreground="Black" Font="mono, 12" Text="version: "/> + <Label Foreground="Black" Font="mono, 12" Text="{Major}"/> + <Label Foreground="Black" Font="mono, 12" Text="."/> + <Label Foreground="Black" Font="mono, 12" Text="{Minor}"/> + <Label Foreground="Black" Font="mono, 12" Text="."/> + <Label Foreground="Jet" Font="mono, 12" Text="{Build}"/> + </HorizontalStack> + <GraphicObject Height="30"/> + <Label Font="20" Text="Press <F2> and <F3> to cycle into the examples"/> + <Label Font="20" Text="Those are basic tests used to validate changes,"/> + <GraphicObject Height="30"/> + <Label Foreground="Jet" Font="20" Text="<F5> => File dialog example"/> + <Label Foreground="Jet" Font="20" Text="<F6> => Window example"/> + </VerticalStack> +</Border>
\ No newline at end of file diff --git a/Tests/Interfaces/Experimental/testDock.crow b/Tests/Interfaces/Experimental/testDock.crow new file mode 100644 index 00000000..8a9df9c5 --- /dev/null +++ b/Tests/Interfaces/Experimental/testDock.crow @@ -0,0 +1,19 @@ +<?xml version="1.0"?> +<!--<Docker Background="Jet" Margin = "0" Focusable="true" > + <DockWindow Focusable="true" Caption="View 1" Width="100" Height="100"><GraphicObject Background="Green"/></DockWindow> + <DockWindow Focusable="true" Caption="View 2" Resizable = "true" Width="100" Height="100"><GraphicObject Background="Blue"/></DockWindow> + <DockWindow Focusable="true" Caption="View 3" Resizable = "true" Width="100" Height="100"><GraphicObject Background="Yellow"/></DockWindow> + <DockWindow Focusable="true" Caption="View 4" Resizable = "true" Width="100" Height="100"><GraphicObject Background="Black"/></DockWindow> +</Docker>--> +<!--<Group Background="Jet" Margin = "0" Focusable="true" > + <Window Top="100" Left="100" Focusable="true" Caption="View 1" Width="300" Height="300"><GraphicObject Background="Green" Focusable="true" MouseEnter="{Background=Gray}" MouseLeave="{Background=Green}"/></Window> + <Window Top="200" Left="200" Focusable="true" Caption="View 2" Resizable = "true" Width="300" Height="300"><GraphicObject Focusable="true" Background="Blue" MouseEnter="{Background=Gray}" MouseLeave="{Background=Blue}"/></Window> + <Window Top="300" Left="300" Focusable="true" Caption="View 3" Resizable = "true" Width="300" Height="300"><GraphicObject Focusable="true" Background="Yellow" MouseEnter="{Background=Gray}" MouseLeave="{Background=Yellow}"/></Window> + <Window Top="400" Left="400" Focusable="true" Caption="View 4" Resizable = "true" Width="300" Height="300"><GraphicObject Focusable="true" Background="Black" MouseEnter="{Background=Gray}" MouseLeave="{Background=Black}"/></Window> +</Group>--> +<Docker Background="Jet" Margin = "0" Focusable="true" > + <DockWindow Top="100" Left="100" Focusable="true" Caption="View 1" Width="300" Height="300"><GraphicObject Background="Green" Focusable="true" MouseEnter="{Background=Gray}" MouseLeave="{Background=Green}"/></DockWindow> + <DockWindow Top="200" Left="200" Focusable="true" Caption="View 2" Resizable = "true" Width="300" Height="300"><GraphicObject Focusable="true" Background="Blue" MouseEnter="{Background=Gray}" MouseLeave="{Background=Blue}"/></DockWindow> + <DockWindow Top="300" Left="300" Focusable="true" Caption="View 3" Resizable = "true" Width="300" Height="300"><GraphicObject Focusable="true" Background="Yellow" MouseEnter="{Background=Gray}" MouseLeave="{Background=Yellow}"/></DockWindow> + <DockWindow Top="400" Left="400" Focusable="true" Caption="View 4" Resizable = "true" Width="300" Height="300"><GraphicObject Focusable="true" Background="Black" MouseEnter="{Background=Gray}" MouseLeave="{Background=Black}"/></DockWindow> +</Docker>
\ No newline at end of file diff --git a/Tests/Interfaces/Unsorted/testTypeViewer.goml b/Tests/Interfaces/Experimental/testTypeViewer.goml index caa454fc..caa454fc 100755 --- a/Tests/Interfaces/Unsorted/testTypeViewer.goml +++ b/Tests/Interfaces/Experimental/testTypeViewer.goml diff --git a/Tests/Interfaces/TemplatedContainer/testTabView.crow b/Tests/Interfaces/TemplatedContainer/testTabView.crow index f9934007..c6cc043b 100644 --- a/Tests/Interfaces/TemplatedContainer/testTabView.crow +++ b/Tests/Interfaces/TemplatedContainer/testTabView.crow @@ -31,5 +31,5 @@ </TabItem> </TabView> <Button Background="vgradient|0:DimGray|1:Black" HorizontalAlignment="Right" - Caption="Add new tab" Width="Fit" Height="30" MouseClick="onAddTabButClick"/> + Caption="Add new tab" Width="Fit" Height="30" MouseDown="onAddTabButClick"/> </VerticalStack> diff --git a/Tests/Interfaces/TemplatedContainer/testTreeView.crow b/Tests/Interfaces/TemplatedContainer/testTreeView.crow index 9d58cda6..099ce66d 100755 --- a/Tests/Interfaces/TemplatedContainer/testTreeView.crow +++ b/Tests/Interfaces/TemplatedContainer/testTreeView.crow @@ -1,40 +1,4 @@ <?xml version="1.0"?> -<TreeView IsRoot="true" Name="treeView" Data="{CurDirectory}" Background="DimGray"> - <ItemTemplate DataType="System.IO.FileInfo"> - <HorizontalStack Focusable="true" Height="Fit" Width="Stretched" > - <Image Margin="2" Width="14" Height="14" - Path="#Crow.Images.Icons.file.svg"/> - <Label Text="{Name}" Width="Stretched" - MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}" - MouseLeave="{Background=Transparent}"/> - </HorizontalStack> - </ItemTemplate> - <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos"> - <Expandable Caption="{Name}" > - <Template> - <VerticalStack> - <HorizontalStack Spacing="1" Height="Fit" - MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}" - MouseLeave="{Background=Transparent}"> - <Image Margin="2" Width="12" Height="12" - Visible="{./HasContent}" - Path="{./Image}" - SvgSub="{./IsExpanded}"/> - <Image Margin="2" Width="14" Height="14" - Path="#Crow.Images.Icons.folder.svg"/> - <Label Text="{./Caption}"/> - </HorizontalStack> - <Container Name="Content" Visible="false"/> - </VerticalStack> - </Template> - <HorizontalStack Height="Fit"> - <GraphicObject Width="12" Height="10"/> - <TreeView Name="List" Height="Fit"> - <Template> - <VerticalStack Height="Fit" Name="ItemsContainer"/> - </Template> - </TreeView> - </HorizontalStack> - </Expandable> - </ItemTemplate> -</TreeView> +<Border Margin="5" Height="90%" Width="50%"> + <DirectoryView Name="dv" CurrentDirectory="/" Margin="1"/> +</Border>
\ No newline at end of file diff --git a/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow b/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow index 65b77d79..54ccde15 100755 --- a/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow +++ b/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow @@ -6,16 +6,15 @@ <Template> <Border BorderWidth="1"> <HorizontalStack Margin="1"> - <Scroller Name="scroller1" + <Scroller Name="scroller1" Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"> <VerticalStack Height="Fit" MinimumSize="10,10" - Name="ItemsContainer" Margin="0" - VerticalAlignment="Top" - HorizontalAlignment="Left"/> + Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/> </Scroller> - <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}" - Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical" - Width="14"/> + <ScrollBar Name="scrollbar1" Value="{²../scroller1.ScrollY}" + LargeIncrement="{../scroller1.PageHeight}" SmallIncrement="30" CursorSize="{../scroller1.ChildHeightRatio}" + Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical" + Width="14" /> </HorizontalStack> </Border> </Template> @@ -31,8 +30,8 @@ </ItemTemplate> </ListBox> <HorizontalStack Fit="true" HorizontalAlignment="Right"> - <Button Caption="Load list" MouseClick="OnLoadList"/> - <Button Caption="Clear" MouseClick="OnClear"/> + <Button Caption="Load list" MouseDown="OnLoadList"/> + <Button Caption="Clear" MouseDown="OnClear"/> </HorizontalStack> </VerticalStack> </Border> diff --git a/Tests/Interfaces/TemplatedControl/testSpinner.crow b/Tests/Interfaces/TemplatedControl/testSpinner.crow index 09f618be..07d62e65 100755 --- a/Tests/Interfaces/TemplatedControl/testSpinner.crow +++ b/Tests/Interfaces/TemplatedControl/testSpinner.crow @@ -3,10 +3,8 @@ Margin="20" Background="DarkGray"> <HorizontalStack Fit="true" Margin="5" Background="SkyBlue"> - <Spinner Value="{IntValue}" ValueChanged="onSpinnerValueChange"/> + <Spinner Name="sp1" Value="5" ValueChanged="onSpinnerValueChange"/> <Spinner Value="5"/> <Spinner Value="5"/> - <Button/> </HorizontalStack> - <IMLContainer Path="Interfaces/Divers/colorPicker.crow"/> </VerticalStack>
\ No newline at end of file diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 9a63b7d0..62a2cbf7 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -8,7 +8,7 @@ <OutputType>Exe</OutputType> <RootNamespace>Tests</RootNamespace> <AssemblyName>Tests</AssemblyName> - <StartupObject>Tests.BasicTests</StartupObject> + <StartupObject>Tests.Showcase</StartupObject> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ReleaseVersion>0.5</ReleaseVersion> @@ -243,9 +243,6 @@ <None Include="Interfaces\Divers\welcome.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="Interfaces\Unsorted\testTypeViewer.goml"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> <None Include="Interfaces\Divers\testPropLess.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> @@ -270,9 +267,6 @@ <None Include="Interfaces\Divers\3.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="Interfaces\Divers\testDock.crow"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> <None Include="Interfaces\TemplatedContainer\0.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> @@ -345,9 +339,6 @@ <None Include="Interfaces\Divers\test2WayBinding.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="Interfaces\Unsorted\testFileDialog.crow"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> <None Include="Interfaces\Divers\perfMeasures.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> @@ -365,10 +356,22 @@ <None Include="Interfaces\Divers\testShape.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="Interfaces\GraphicObject\testCtxMenu.crow"> + <None Include="Interfaces\DragAndDrop\0.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="Interfaces\DragAndDrop\0.crow"> + <None Include="Interfaces\Divers\testIMLContainer.crow"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="Interfaces\Divers\testCtxMenu.crow"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="Interfaces\Divers\testFileDialog.crow"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="Interfaces\Experimental\testTypeViewer.goml"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="Interfaces\Experimental\testDock.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> </ItemGroup> @@ -379,7 +382,6 @@ <Folder Include="Interfaces\Group\" /> <Folder Include="Interfaces\Divers\" /> <Folder Include="Interfaces\Splitter\" /> - <Folder Include="Interfaces\Unsorted\" /> <Folder Include="Interfaces\Wrapper\" /> <Folder Include="Interfaces\TemplatedControl\" /> <Folder Include="Interfaces\TemplatedContainer\" /> @@ -387,6 +389,7 @@ <Folder Include="GraphicObjects\" /> <Folder Include="Tutorials\" /> <Folder Include="Interfaces\DragAndDrop\" /> + <Folder Include="Interfaces\Experimental\" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="image\tetra.png"> diff --git a/src/GraphicObjects/DockWindow.cs b/src/GraphicObjects/DockWindow.cs index 5e066f39..b68a3085 100644 --- a/src/GraphicObjects/DockWindow.cs +++ b/src/GraphicObjects/DockWindow.cs @@ -52,63 +52,98 @@ namespace Crow NotifyValueChanged ("IsDocked", isDocked); } } - public override void OnLayoutChanges (LayoutingType layoutType) - { - base.OnLayoutChanges (layoutType); - - if (isDocked) - return; - - Docker dv = Parent as Docker; - if (dv == null) - return; - - Rectangle dvCliRect = dv.ClientRectangle; - - if (layoutType == LayoutingType.X) { - if (Slot.X < dv.DockingThreshold) - dock (Alignment.Left); - else if (Slot.Right > dvCliRect.Width - dv.DockingThreshold) - dock (Alignment.Right); - }else if (layoutType == LayoutingType.Y) { - if (Slot.Y < dv.DockingThreshold) - dock (Alignment.Top); - else if (Slot.Bottom > dvCliRect.Height - dv.DockingThreshold) - dock (Alignment.Bottom); + public Alignment DockingPosition { + get { return docking; } + set { + if (docking == value) + return; + docking = value; + NotifyValueChanged ("DockingPosition", DockingPosition); } } - - public override void onMouseMove (object sender, MouseMoveEventArgs e) + protected override void onDrop (object sender, DragDropEventArgs e) { - lastMousePos = e.Position; + base.onDrop (sender, e); + Docker dv = Parent as Docker; + dv.Dock (this); + } + public override bool PointIsIn (ref Point m) + { + if (!base.PointIsIn(ref m)) + return false; - if (this.HasFocus && e.Mouse.IsButtonDown (MouseButton.Left) && IsDocked) { - Docker dv = Parent as Docker; - if (docking == Alignment.Left) { - if (lastMousePos.X - undockingMousePosOrig.X > dv.DockingThreshold) - undock (); - } else if (docking == Alignment.Right) { - if (undockingMousePosOrig.X - lastMousePos.X > dv.DockingThreshold) - undock (); - } else if (docking == Alignment.Top) { - if (lastMousePos.Y - undockingMousePosOrig.Y > dv.DockingThreshold) - undock (); - } else if (docking == Alignment.Bottom) { - if (undockingMousePosOrig.Y - lastMousePos.Y > dv.DockingThreshold) - undock (); + Group p = Parent as Group; + if (p != null) { + lock (p.Children) { + for (int i = p.Children.Count - 1; i >= 0; i--) { + if (p.Children [i] == this) + break; + if (p.Children [i].Slot.ContainsOrIsEqual (m)) { + return false; + } + } } - return; } - - base.onMouseMove (sender, e); + return Slot.ContainsOrIsEqual(m); } - public override void onMouseDown (object sender, MouseButtonEventArgs e) - { - base.onMouseDown (sender, e); - if (this.HasFocus && IsDocked && e.Button == MouseButton.Left) - undockingMousePosOrig = lastMousePos; - } +// public override void OnLayoutChanges (LayoutingType layoutType) +// { +// base.OnLayoutChanges (layoutType); +// +// if (isDocked) +// return; + +// Docker dv = Parent as Docker; +// if (dv == null) +// return; +// +// Rectangle dvCliRect = dv.ClientRectangle; +// +// if (layoutType == LayoutingType.X) { +// if (Slot.X < dv.DockingThreshold) +// dock (Alignment.Left); +// else if (Slot.Right > dvCliRect.Width - dv.DockingThreshold) +// dock (Alignment.Right); +// }else if (layoutType == LayoutingType.Y) { +// if (Slot.Y < dv.DockingThreshold) +// dock (Alignment.Top); +// else if (Slot.Bottom > dvCliRect.Height - dv.DockingThreshold) +// dock (Alignment.Bottom); +// } +// } +// +// public override void onMouseMove (object sender, MouseMoveEventArgs e) +// { +// lastMousePos = e.Position; +// +// if (this.HasFocus && e.Mouse.IsButtonDown (MouseButton.Left) && IsDocked) { +// Docker dv = Parent as Docker; +// if (docking == Alignment.Left) { +// if (lastMousePos.X - undockingMousePosOrig.X > dv.DockingThreshold) +// undock (); +// } else if (docking == Alignment.Right) { +// if (undockingMousePosOrig.X - lastMousePos.X > dv.DockingThreshold) +// undock (); +// } else if (docking == Alignment.Top) { +// if (lastMousePos.Y - undockingMousePosOrig.Y > dv.DockingThreshold) +// undock (); +// } else if (docking == Alignment.Bottom) { +// if (undockingMousePosOrig.Y - lastMousePos.Y > dv.DockingThreshold) +// undock (); +// } +// return; +// } +// +// base.onMouseMove (sender, e); +// } +// public override void onMouseDown (object sender, MouseButtonEventArgs e) +// { +// base.onMouseDown (sender, e); +// +// if (this.HasFocus && IsDocked && e.Button == MouseButton.Left) +// undockingMousePosOrig = lastMousePos; +// } // protected override void onBorderMouseEnter (object sender, MouseMoveEventArgs e) // { diff --git a/src/GraphicObjects/Docker.cs b/src/GraphicObjects/Docker.cs index 57b49390..3b66eb7e 100644 --- a/src/GraphicObjects/Docker.cs +++ b/src/GraphicObjects/Docker.cs @@ -26,17 +26,45 @@ using System; using System.Xml.Serialization; using System.ComponentModel; +using Crow.IML; namespace Crow { public class Docker : Group { + static Instantiator instStack, instSplit, instSpacer; #region CTOR + static Docker () { + instStack = Instantiator.CreateFromImlFragment(@"<GenericStack Background='Blue' AllowDrop='true' DragEnter='onStackDragEnter'/>"); + instSplit = Instantiator.CreateFromImlFragment(@"<Splitter/>"); + instSpacer = Instantiator.CreateFromImlFragment(@"<GraphicObject Background='Red' IsEnabled='false'/>"); + } public Docker () : base () { } #endregion + GenericStack rootStack = null; + + public override void AddChild (GraphicObject g) + { + DockWindow dw = g as DockWindow; + if (dw == null) + throw new Exception ("Docker accept only DockWindow as child"); + + base.AddChild (g); + + dw.LogicalParent = this; + } + public override void RemoveChild (GraphicObject child) + { + child.LogicalParent = null; + + + base.RemoveChild (child); + } + + GenericStack mainStack = null; int dockingThreshold; [XmlAttributeAttribute][DefaultValue(10)] @@ -51,17 +79,176 @@ namespace Crow } } + bool showDockingTarget = false; + Alignment dockingDirection = Alignment.Center; + int dockingDiv = 5; + public override void onMouseMove (object sender, MouseMoveEventArgs e) { if (CurrentInterface.DragAndDropOperation?.DragSource as DockWindow != null) { DockWindow dw = CurrentInterface.DragAndDropOperation?.DragSource as DockWindow; - if (CurrentInterface.DragAndDropOperation.DragSource.Parent == this && !dw.IsDocked) - dw.MoveAndResize (e.XDelta, e.YDelta); - } + if (CurrentInterface.DragAndDropOperation.DragSource.Parent == this && !dw.IsDocked) + dw.MoveAndResize (e.XDelta, e.YDelta); + Rectangle r = ClientRectangle; + int vTreshold = r.Height / dockingDiv; + int hTreshold = r.Width / dockingDiv; + + + bool showDock = true; + + if (dw.Slot.Left < hTreshold) + dockingDirection = Alignment.Left; + else if (dw.Slot.Right > r.Right - hTreshold) + dockingDirection = Alignment.Right; + else if (dw.Slot.Top < vTreshold) + dockingDirection = Alignment.Top; + else if (dw.Slot.Bottom > r.Bottom - vTreshold) + dockingDirection = Alignment.Bottom; + else { + dockingDirection = Alignment.Center; + showDock = false; + } + + showDockingTarget = showDock; + + RegisterForGraphicUpdate (); + + //System.Diagnostics.Debug.WriteLine ("Dock: {0}", dockingDirection); + } else + showDockingTarget = false; base.onMouseMove (sender, e); } + protected override void onDragEnter (object sender, DragDropEventArgs e) + { + base.onDragEnter (sender, e); + } + void onStackDragEnter (object sender, DragDropEventArgs e) + { + base.onDragEnter (sender, e); + + mainStack = sender as GenericStack; + } + protected override void onDraw (Cairo.Context gr) + { + gr.Save (); + + Rectangle rBack = new Rectangle (Slot.Size); + + Background.SetAsSource (gr, rBack); + CairoHelpers.CairoRectangle (gr, rBack, CornerRadius); + gr.Fill (); + + if (ClipToClientRect) { + //clip to client zone + CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius); + gr.Clip (); + } + + lock (Children) { + foreach (GraphicObject g in Children) { + if (CurrentInterface.DragAndDropOperation?.DragSource == g) + continue; + g.Paint (ref gr); + } + } + + if (showDockingTarget) { + Rectangle r; + if (mainStack == null) + r = ClientRectangle; + else + r = mainStack.ClientRectangle; + + switch (dockingDirection) { + case Alignment.Top: + gr.Rectangle (r.Left, r.Top, r.Width, r.Height / dockingDiv); + break; + case Alignment.Bottom: + gr.Rectangle (r.Left, r.Bottom - r.Height / dockingDiv, r.Width, r.Height / dockingDiv); + break; + case Alignment.Left: + gr.Rectangle (r.Left, r.Top, r.Width / dockingDiv, r.Height); + break; + case Alignment.Right: + gr.Rectangle (r.Right - r.Width / dockingDiv, r.Top, r.Width / dockingDiv, r.Height); + break; + } + gr.LineWidth = 1; + gr.SetSourceRGBA (0.4, 0.4, 0.9, 0.4); + gr.FillPreserve (); + gr.SetSourceRGBA (0.9, 0.9, 1.0, 0.8); + gr.Stroke (); + } + + if (CurrentInterface.DragAndDropOperation != null) + CurrentInterface.DragAndDropOperation.DragSource.Paint (ref gr); + + + gr.Restore (); + } + + public void Dock(DockWindow dw){ + if (dockingDirection == Alignment.Center) + return; + lock (CurrentInterface.UpdateMutex) { + + Splitter splitter = instSplit.CreateInstance<Splitter> (CurrentInterface); + + dw.Resizable = false; + dw.Left = dw.Top = 0; + this.RemoveChild (dw); + + Rectangle r; + if (mainStack == null) { + mainStack = instStack.CreateInstance<GenericStack> (CurrentInterface); + this.AddChild (mainStack); + this.putWidgetOnBottom (mainStack); + r = ClientRectangle; + } else + r = mainStack.ClientRectangle; + + int vTreshold = r.Height / dockingDiv; + int hTreshold = r.Width / dockingDiv; + + switch (dockingDirection) { + case Alignment.Top: + dw.Width = Measure.Stretched; + mainStack.Orientation = Orientation.Vertical; + mainStack.AddChild (dw); + mainStack.AddChild (splitter); + //mainStack.AddChild (instSpacer.CreateInstance (CurrentInterface)); + break; + case Alignment.Bottom: + dw.Width = Measure.Stretched; + mainStack.Orientation = Orientation.Vertical; + //mainStack.AddChild (instSpacer.CreateInstance (CurrentInterface)); + mainStack.AddChild (splitter); + mainStack.AddChild (dw); + break; + case Alignment.Left: + dw.Height = Measure.Stretched; + mainStack.Orientation = Orientation.Horizontal; + mainStack.AddChild (dw); + mainStack.AddChild (splitter); + //mainStack.AddChild (instSpacer.CreateInstance (CurrentInterface)); + break; + case Alignment.Right: + dw.Height = Measure.Stretched; + mainStack.Orientation = Orientation.Horizontal; + //mainStack.AddChild (instSpacer.CreateInstance (CurrentInterface)); + mainStack.AddChild (splitter); + mainStack.AddChild (dw); + break; + } + + } + } + protected override void onDrop (object sender, DragDropEventArgs e) + { + base.onDrop (sender, e); + } } } diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 9857d198..d49cbe8f 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -243,10 +243,11 @@ namespace Crow if (parent == value) return; DataSourceChangeEventArgs e = new DataSourceChangeEventArgs (parent, value); - lock (this) + lock (CurrentInterface.LayoutMutex) { parent = value; - - onParentChanged (this, e); + } + onParentChanged (this, e); + } } [XmlIgnore]public ILayoutable LogicalParent { @@ -786,8 +787,9 @@ namespace Crow //prevent setting null causing stack overflow in specific case if (dse.NewDataSource == dse.OldDataSource) return; - - OnDataSourceChanged (this, dse); + lock (CurrentInterface.LayoutMutex) { + OnDataSourceChanged (this, dse); + } NotifyValueChanged ("DataSource", DataSource); } @@ -1097,7 +1099,7 @@ namespace Crow /// fired when drag and drop operation start /// </summary> protected virtual void onStartDrag (object sender, DragDropEventArgs e){ - CurrentInterface.HoverWidget = this.focusParent; + CurrentInterface.HoverWidget = null; IsDragged = true; StartDrag.Raise (this, e); Debug.WriteLine(this.ToString() + " : START DRAG => " + e.ToString()); @@ -1136,11 +1138,13 @@ namespace Crow #if DEBUG_UPDATE Debug.WriteLine (string.Format("ClippingRegistration -> {0}", this.ToString ())); #endif - IsQueueForRedraw = false; - if (Parent == null) - return; - Parent.RegisterClip (LastPaintedSlot); - Parent.RegisterClip (Slot); + lock(CurrentInterface.LayoutMutex){ + IsQueueForRedraw = false; + if (Parent == null) + return; + Parent.RegisterClip (LastPaintedSlot); + Parent.RegisterClip (Slot); + } } /// <summary> /// Add clip rectangle to this.clipping and propagate up to root diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index 10d87ab6..1b5847d4 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -62,7 +62,7 @@ namespace Crow set { _multiSelect = value; } } public virtual void AddChild(GraphicObject g){ - lock (children) { + lock (Children) { g.Parent = this; Children.Add (g); } @@ -79,9 +79,8 @@ namespace Crow CurrentInterface.HoverWidget = null; } - lock (children) + lock (Children) Children.Remove(child); - child.Dispose (); if (child == largestChild && Width == Measure.Fit) searchLargestChild (); @@ -89,9 +88,15 @@ namespace Crow searchTallestChild (); this.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren); + + } + public virtual void DeleteChild(GraphicObject child) + { + RemoveChild (child); + child.Dispose (); } public virtual void InsertChild (int idx, GraphicObject g) { - lock (children) { + lock (Children) { g.Parent = this; Children.Insert (idx, g); } @@ -99,12 +104,12 @@ namespace Crow g.LayoutChanged += OnChildLayoutChanges; g.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren); } - public virtual void RemoveChild (int idx) { - RemoveChild (children[idx]); + public virtual void DeleteChild (int idx) { + DeleteChild (children[idx]); } public virtual void ClearChildren() { - lock (children) { + lock (Children) { while (Children.Count > 0) { GraphicObject g = Children [Children.Count - 1]; g.LayoutChanged -= OnChildLayoutChanges; @@ -123,7 +128,7 @@ namespace Crow { if (Children.Contains(w)) { - lock (children) { + lock (Children) { Children.Remove (w); Children.Add (w); } @@ -133,7 +138,7 @@ namespace Crow { if (Children.Contains(w)) { - lock (children) { + lock (Children) { Children.Remove (w); Children.Insert (0, w); } @@ -144,7 +149,7 @@ namespace Crow public override void OnDataSourceChanged (object sender, DataSourceChangeEventArgs e) { base.OnDataSourceChanged (this, e); - lock (children) { + lock (Children) { foreach (GraphicObject g in children) if (g.localDataSourceIsNull & g.localLogicalParentIsNull) g.OnDataSourceChanged (g, e); @@ -155,7 +160,7 @@ namespace Crow if (Name == nameToFind) return this; GraphicObject tmp = null; - lock (children) { + lock (Children) { foreach (GraphicObject w in Children) { tmp = w.FindByName (nameToFind); if (tmp != null) @@ -234,7 +239,7 @@ namespace Crow gr.Clip (); } - lock (children) { + lock (Children) { foreach (GraphicObject g in Children) { g.Paint (ref gr); } @@ -263,7 +268,7 @@ namespace Crow gr.Clip (); } - lock (children) { + lock (Children) { foreach (GraphicObject c in Children) { if (!c.Visible) continue; @@ -374,6 +379,21 @@ namespace Crow } base.checkHoverWidget (e); } +// public override bool PointIsIn (ref Point m) +// { +// if (!base.PointIsIn (ref m)) +// return false; +// if (CurrentInterface.HoverWidget == this) +// return true; +// lock (Children) { +// for (int i = Children.Count - 1; i >= 0; i--) { +// if (Children [i].Slot.ContainsOrIsEqual (m) && !(bool)CurrentInterface.HoverWidget?.IsOrIsInside(Children[i])) { +// return false; +// } +// } +// } +// return true; +// } #endregion protected override void Dispose (bool disposing) diff --git a/src/GraphicObjects/MessageBox.cs b/src/GraphicObjects/MessageBox.cs index e1c8cc87..c0754eaa 100644 --- a/src/GraphicObjects/MessageBox.cs +++ b/src/GraphicObjects/MessageBox.cs @@ -135,7 +135,7 @@ namespace Crow close (); } public static MessageBox Show (Interface iface, Type msgBoxType, string message, string okMsg = "", string cancelMsg = ""){ - //lock (Interface.CurrentInterface.UpdateMutex) { + lock (iface.UpdateMutex) { MessageBox mb = new MessageBox (iface); mb.CurrentInterface.AddWidget (mb); mb.MsgType = msgBoxType; @@ -145,7 +145,7 @@ namespace Crow if (!string.IsNullOrEmpty(cancelMsg)) mb.CancelMessage = cancelMsg; return mb; - //} + } } } } diff --git a/src/GraphicObjects/TabItem.cs b/src/GraphicObjects/TabItem.cs index 8364aace..eab0cb0d 100644 --- a/src/GraphicObjects/TabItem.cs +++ b/src/GraphicObjects/TabItem.cs @@ -159,13 +159,13 @@ namespace Crow public bool HoldCursor = false; public override bool PointIsIn (ref Point m) { - TabView tv = Parent as TabView; - bool tmp = base.PointIsIn (ref m); + if (!base.PointIsIn (ref m)) + return false; if (m.Y < tabThickness) return TabTitle.Slot.ContainsOrIsEqual (m); else - return this.isSelected && tmp; + return this.isSelected; } public override void onMouseDown (object sender, MouseButtonEventArgs e) { @@ -214,6 +214,10 @@ namespace Crow } public void butCloseTabClick (object sender, MouseButtonEventArgs e){ QueryClose.Raise (this, null); + //if tab is used as a templated item root in a templatedGroup, local datasource + //is not null, in this case, removing the data entries will delete automatically the item + if (localDataSourceIsNull) + (Parent as TabView).DeleteChild (this); } #endregion diff --git a/src/GraphicObjects/TabView.cs b/src/GraphicObjects/TabView.cs index 3e776d3a..c5292da7 100644 --- a/src/GraphicObjects/TabView.cs +++ b/src/GraphicObjects/TabView.cs @@ -112,7 +112,7 @@ namespace Crow SelectedTab = ti.ViewIndex = Children.Count - 1; } - public override void RemoveChild (GraphicObject child) + public override void DeleteChild (GraphicObject child) { TabItem ti = child as TabItem; if (ti == null) @@ -124,7 +124,7 @@ namespace Crow if (selectedTab > Children.Count - 2) SelectedTab--; - base.RemoveChild (child); + base.DeleteChild (child); } public override bool ArrangeChildren { get { return true; } } diff --git a/src/GraphicObjects/TemplatedGroup.cs b/src/GraphicObjects/TemplatedGroup.cs index f2c097a2..8025435d 100644 --- a/src/GraphicObjects/TemplatedGroup.cs +++ b/src/GraphicObjects/TemplatedGroup.cs @@ -216,9 +216,9 @@ namespace Crow if (this.isPaged) { int p = e.Index / itemPerPage; int i = e.Index % itemPerPage; - (items.Children [p] as Group).RemoveChild (i); + (items.Children [p] as Group).DeleteChild (i); } else - items.RemoveChild (e.Index); + items.DeleteChild (e.Index); } void Ol_ListAdd (object sender, ListChangedEventArg e) @@ -268,7 +268,7 @@ namespace Crow public virtual void RemoveItem(GraphicObject g) { g.LogicalParent = null; - items.RemoveChild (g); + items.DeleteChild (g); if (items.Children.Count == 0) NotifyValueChanged ("HasChildren", false); } @@ -375,8 +375,10 @@ namespace Crow // isPaged = true; // } - for (int i = 0; i < _data.Count; i++) { + for (int i = 0; i < _data.Count; i++) { loadItem (_data[i], page, _dataTest); + if (loadingThread.cancelRequested) + break; } // if (page == items) @@ -425,13 +427,13 @@ namespace Crow iTemp = ItemTemplates ["default"]; } - lock (CurrentInterface.LayoutMutex) { + //lock (CurrentInterface.LayoutMutex) { g = iTemp.CreateInstance(CurrentInterface); page.AddChild (g); // if (isPaged) g.LogicalParent = this; g.MouseDown += itemClick; - } + //} if (iTemp.Expand != null && g is Expandable) { (g as Expandable).Expand += iTemp.Expand; diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs index b4a5f4c4..bbfb196d 100644 --- a/src/GraphicObjects/Window.cs +++ b/src/GraphicObjects/Window.cs @@ -424,7 +424,7 @@ namespace Crow if (Parent is Interface) (Parent as Interface).DeleteWidget (this); else if (Parent is Group) - (Parent as Group).RemoveChild (this); + (Parent as Group).DeleteChild (this); else if (Parent is PrivateContainer) (Parent as Container).Child = null; } diff --git a/src/Interface.cs b/src/Interface.cs index becd37ce..ecc78de5 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -590,9 +590,8 @@ namespace Crow GraphicObject g = null; while (DrawingQueue.Count > 0) { lock (DrawingQueue) - g = DrawingQueue.Dequeue (); - lock (g) - g.ClippingRegistration (); + g = DrawingQueue.Dequeue (); + g.ClippingRegistration (); } #if MEASURE_TIME |