diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-07-30 15:32:52 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-07-30 15:32:52 +0200 |
| commit | be8a4c2923ee9a62646590576cdf2fcdbf0d39a3 (patch) | |
| tree | 502c57dbb061065e252701ada79f06ef183cb841 | |
| parent | 6c6fb760bfb6a956a3413abfb56571a11113acd3 (diff) | |
basic styling ok, need handler and expression now.
45 files changed, 264 insertions, 250 deletions
diff --git a/Styles/Label.style b/Styles/Label.style index 8a165c2a..1f000247 100644 --- a/Styles/Label.style +++ b/Styles/Label.style @@ -1 +1,2 @@ Fit = true; +Margin = 2; diff --git a/Templates/Button.crow b/Templates/Button.crow index a9e45dc3..8919f7dc 100755 --- a/Templates/Button.crow +++ b/Templates/Button.crow @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<Border Background="{../Background}" MinimumSize="50;20" Height="{../HeightPolicy}" Width="{../WidthPolicy}" +<Border Background="{../Background}" MinimumSize="50,20" Height="{../HeightPolicy}" Width="{../WidthPolicy}" Foreground="Transparent" CornerRadius="{../CornerRadius}" BorderWidth="1" MouseEnter="{Foreground=vgradient|0:White|0.2:Gray|0.9:Gray|1:Black;caption.Foreground=White}" MouseLeave="{Foreground=Transparent;caption.Foreground=LightGray}" diff --git a/Templates/ComboBox.goml b/Templates/ComboBox.goml index 9a5addaf..9688721a 100755 --- a/Templates/ComboBox.goml +++ b/Templates/ComboBox.goml @@ -1,10 +1,10 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <Popper Name="popper" PopDirection="Bottom" Height="{../HeightPolicy}" Width="{../WidthPolicy}"> <Template> <Border CornerRadius="0" Foreground="LightGray" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"> <HorizontalStack Margin="0 " Spacing="1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"> - <TextBox MinimumSize="80;10" Margin="1" Foreground="Black" Background="White" + <TextBox MinimumSize="80,10" Margin="1" Foreground="Black" Background="White" Text="{../../../../SelectedItem}" Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}"/> <Button Width="14" Height="14" Focusable="false" @@ -17,7 +17,7 @@ <Border Background="DimGray" BorderWidth="1" Margin="1" MinimumSize="{../../MinimumPopupSize}" Fit="true"> <Scroller Name="scroller1" Margin="2" VerticalScrolling="true" - MaximumSize="0;200" + MaximumSize="0,200" Height="{../HeightPolicy}" Width="{../WidthPolicy}" HorizontalAlignment="Left" ValueChanged="../../../_scroller_ValueChanged"> diff --git a/Templates/GroupBox.goml b/Templates/GroupBox.goml index b00af82d..d3a16613 100755 --- a/Templates/GroupBox.goml +++ b/Templates/GroupBox.goml @@ -1,8 +1,8 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <Group Height="{../HeightPolicy}" Width="{../WidthPolicy}"> <Border CornerRadius="5" BorderWidth="1" Margin="6" Foreground="{../../Foreground}" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"> - <Container Name="Content" Margin="10" MinimumSize="70;10" + <Container Name="Content" Margin="10" MinimumSize="70,10" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/> </Border> <Label Text="{../../Caption}" VerticalAlignment="Top" Left="15" diff --git a/Templates/ListBox.goml b/Templates/ListBox.goml index 8a8ec0d7..7ea306a9 100755 --- a/Templates/ListBox.goml +++ b/Templates/ListBox.goml @@ -1,5 +1,5 @@ -<?xml version="1.0"?> -<Border BorderWidth="1" Margin="1" MinimumSize="10;10" Height="{../HeightPolicy}" Width="{../WidthPolicy}" > +<?xml version="1.0"?> +<Border BorderWidth="1" Margin="1" MinimumSize="10,10" Height="{../HeightPolicy}" Width="{../WidthPolicy}" > <Scroller Name="scroller1" Margin="1" VerticalScrolling="true" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" ValueChanged="../../_scroller_ValueChanged"> diff --git a/Templates/ScrollingListBox.goml b/Templates/ScrollingListBox.goml index 7976e3d7..5d9a572d 100644 --- a/Templates/ScrollingListBox.goml +++ b/Templates/ScrollingListBox.goml @@ -1,10 +1,10 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}"> <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" > <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}" Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}" ValueChanged="../../../_scroller_ValueChanged"> - <VerticalStack Width="{../../../../WidthPolicy}" Height="-1" MinimumSize="10;10" + <VerticalStack Width="{../../../../WidthPolicy}" Height="-1" MinimumSize="10,10" Name="List" Margin="0" VerticalAlignment="Top" LayoutChanged="../../../../_list_LayoutChanged"/> </Scroller> diff --git a/Templates/Spinner.goml b/Templates/Spinner.goml index 03986175..0669b228 100755 --- a/Templates/Spinner.goml +++ b/Templates/Spinner.goml @@ -1,5 +1,5 @@ -<?xml version="1.0"?> -<HorizontalStack MinimumSize="40;10" Name="hstack" Margin="0" Spacing="0" Height="{../HeightPolicy}" Width="{../WidthPolicy}"> +<?xml version="1.0"?> +<HorizontalStack MinimumSize="40,10" Name="hstack" Margin="0" Spacing="0" Height="{../HeightPolicy}" Width="{../WidthPolicy}"> <Border BorderWidth="1" Height="{../../HeightPolicy}" Width="80%" Background="White" Foreground="DimGray" Margin="0"> <Label Foreground="DimGray" Height="{../../../HeightPolicy}" Width="Stretched" diff --git a/Templates/TreeView.crow b/Templates/TreeView.crow index 165cea1c..32e3db21 100644 --- a/Templates/TreeView.crow +++ b/Templates/TreeView.crow @@ -1,4 +1,4 @@ -<Border Background="DimGray" BorderWidth="1" Margin="1" MinimumSize="100;100" +<Border Background="DimGray" BorderWidth="1" Margin="1" MinimumSize="100,100" Width="{../WidthPolicy}" Height="{../HeightPolicy}"> <VerticalStack Height="0" Width="0" Name="List" Margin="0" VerticalAlignment="Top"/> diff --git a/Templates/Window.goml b/Templates/Window.goml index 01f88a22..42bc2976 100755 --- a/Templates/Window.goml +++ b/Templates/Window.goml @@ -18,6 +18,6 @@ <GraphicObject Width="5"/> </HorizontalStack> </Border> - <Container Name="Content" MinimumSize="50;50" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}" Background="0.5,0.5,0.5,0.5"/> + <Container Name="Content" MinimumSize="50,50" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}" Background="0.5,0.5,0.5,0.5"/> </VerticalStack> </Border>
\ No newline at end of file diff --git a/Templates/imgItemTemplate.goml b/Templates/imgItemTemplate.goml index 792d2758..c08f390e 100755 --- a/Templates/imgItemTemplate.goml +++ b/Templates/imgItemTemplate.goml @@ -2,7 +2,7 @@ <VerticalStack Width="0" Height="-1" Focusable="true" MouseEnter="{Background=BlueCrayola}" MouseLeave="{Background=Transparent}"> - <Image Width="-1" Height="-1" Path="{FullName}" MaximumSize="80;80"/> + <Image Width="-1" Height="-1" Path="{FullName}" MaximumSize="80,80"/> <Label Text="{Name}" Width="-1" Height="-1" Margin="0" MaximumSize="100,0"/> </VerticalStack> diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs index 0cc2c555..b081b00c 100644 --- a/Tests/BasicTests.cs +++ b/Tests/BasicTests.cs @@ -78,8 +78,8 @@ namespace Tests KeyboardKeyDown += GOLIBTests_KeyboardKeyDown1; - - testFiles = new string [] { @"Interfaces/Divers/welcome.crow" }; + testFiles = new string [] { @"Interfaces/Divers/5.crow" }; + //testFiles = new string [] { @"Interfaces/Divers/welcome.crow" }; testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray (); //testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/basicTests", "*.crow")).ToArray (); diff --git a/Tests/Interfaces/Container/0.crow b/Tests/Interfaces/Container/0.crow index eec3a76f..a69e6f69 100755 --- a/Tests/Interfaces/Container/0.crow +++ b/Tests/Interfaces/Container/0.crow @@ -1,5 +1,5 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <Container Background="Onyx" Margin="10" Width="90%" Height="90%"> <GraphicObject Margin="10" Width="Stretched" Height="Stretched" Background="Mantis" - MinimumSize="50;50"/> + MinimumSize="50,50"/> </Container>
\ No newline at end of file diff --git a/Tests/Interfaces/Container/1.crow b/Tests/Interfaces/Container/1.crow index 081c8715..c75ad4f7 100755 --- a/Tests/Interfaces/Container/1.crow +++ b/Tests/Interfaces/Container/1.crow @@ -1,5 +1,5 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <Container Background="Lust" Margin="10" Width="90%" Height="90%"> <GraphicObject Margin="10" Width="50%" Height="50%" Background="Maize" - MinimumSize="50;50"/> + MinimumSize="50,50"/> </Container>
\ No newline at end of file diff --git a/Tests/Interfaces/Container/2.crow b/Tests/Interfaces/Container/2.crow index 839a0fee..a8425272 100755 --- a/Tests/Interfaces/Container/2.crow +++ b/Tests/Interfaces/Container/2.crow @@ -1,5 +1,5 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <Container Background="Teal" Margin="10" Fit="true"> <GraphicObject Margin="10" Width="50%" Height="50%" Background="Malachite" - MinimumSize="50;50"/> + MinimumSize="50,50"/> </Container>
\ No newline at end of file diff --git a/Tests/Interfaces/Divers/5.crow b/Tests/Interfaces/Divers/5.crow index 305639d6..34ee42c3 100755 --- a/Tests/Interfaces/Divers/5.crow +++ b/Tests/Interfaces/Divers/5.crow @@ -2,9 +2,9 @@ <HorizontalStack Fit="true" Margin="5"> <VerticalStack Fit="true" Margin="2" Spacing="2"> <TextRun Text="text run test"/> - <Label Text="label test"/> +<!-- <Label Text="label test"/> <TextBox Text="text box test"/> - <Button Caption="test button"/> + <Button Caption="test button"/>--> <!-- <CheckBox Caption="test checkbox"/> <RadioButton Caption="test radiobutton"/> <ComboBox/> diff --git a/Tests/Interfaces/Divers/fps.crow b/Tests/Interfaces/Divers/fps.crow index b6962302..6747bbd2 100755 --- a/Tests/Interfaces/Divers/fps.crow +++ b/Tests/Interfaces/Divers/fps.crow @@ -5,20 +5,20 @@ <VerticalStack Fit="true" Name="vsFps" Spacing="10" > <HorizontalStack Fit="true"> <Label Text="Update:" Width="50" TextAlignment="Right"/> - <Label Name="labUpdate" Text="{update}" Font="droid,12" Background="AoEnglish" Width="50" TextAlignment="Center"/> + <Label Margin="5" Name="labUpdate" Text="{update}" Font="droid,12" Background="AoEnglish" Width="50" TextAlignment="Center"/> </HorizontalStack> <HorizontalStack Fit="true"> <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/> - <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center" Background="AoEnglish"/> + <Label Margin="5" Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center" Background="AoEnglish"/> </HorizontalStack> <HorizontalStack Fit="true"> <Label Text="Min:" Width="50" TextAlignment="Right"/> - <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center" Background="AoEnglish"/> + <Label Margin="5" Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center" Background="AoEnglish"/> </HorizontalStack> <HorizontalStack Fit="true"> <Label Text="Max:" Width="50" TextAlignment="Right"/> - <Label Text="{fpsMax}" Font="droid , 12" Background="AoEnglish" Width="50" TextAlignment="Center"/> + <Label Margin="5" Text="{fpsMax}" Font="droid , 12" Background="AoEnglish" Width="50" TextAlignment="Center"/> </HorizontalStack> - </VerticalStack> + </VerticalStack> </Container> </Border>
\ No newline at end of file diff --git a/Tests/Interfaces/Divers/testGrid.crow b/Tests/Interfaces/Divers/testGrid.crow index 327d7716..0342f9a2 100755 --- a/Tests/Interfaces/Divers/testGrid.crow +++ b/Tests/Interfaces/Divers/testGrid.crow @@ -1,7 +1,7 @@ <?xml version="1.0"?> <Grid RowCount="2" ColumnCount="2"> - <GraphicObject Background="0.0,0.0,0.0;1,0"/> - <GraphicObject Background="0.0,0.0,0.5;1,0"/> - <GraphicObject Background="0.0,0.5,0.0;1,0"/> - <GraphicObject Background="0.5,0.0,0.0;1,0"/> + <GraphicObject Background="0.0,0.0,0.0,1.0"/> + <GraphicObject Background="0.0,0.0,0.5,1.0"/> + <GraphicObject Background="0.0,0.5,0.0,1.0"/> + <GraphicObject Background="0.5,0.0,0.0,1.0"/> </Grid>
\ No newline at end of file diff --git a/Tests/Interfaces/Divers/testStacks.crow b/Tests/Interfaces/Divers/testStacks.crow index 44c7c7f9..ac2cccc6 100755 --- a/Tests/Interfaces/Divers/testStacks.crow +++ b/Tests/Interfaces/Divers/testStacks.crow @@ -1,5 +1,5 @@ -<?xml version="1.0"?> -<Window Width="500" Height="300" MinimumSize="50;50"> +<?xml version="1.0"?> +<Window Width="500" Height="300" MinimumSize="50,50"> <HorizontalStack Margin="5" Background="DimGray"> <VerticalStack Width="200" Margin="5" Background="Gray"> <VerticalStack Fit="true" Background="DimGray" Margin="5"> diff --git a/Tests/Interfaces/Divers/testWindow.goml b/Tests/Interfaces/Divers/testWindow.goml index 154577fb..9e184dff 100755 --- a/Tests/Interfaces/Divers/testWindow.goml +++ b/Tests/Interfaces/Divers/testWindow.goml @@ -16,7 +16,7 @@ <GraphicObject Width="Stretched"/> <RadioButton Width="80" Height="Fit" Caption="Radio 3" /> </HorizontalStack> - <HorizontalStack Width="Stretched" Height="Stretched" MinimumSize="10;10" Margin="10" CornerRadius="5" + <HorizontalStack Width="Stretched" Height="Stretched" MinimumSize="10,10" Margin="10" CornerRadius="5" Background="vgradient|0:White|0.1:SteelBlue|0.9:SteelBlue|1:Transparent"> <CheckBox Height="Fit" Width="80"/> <GraphicObject Width="Stretched"/> diff --git a/Tests/Interfaces/Divers/testWindow2.goml b/Tests/Interfaces/Divers/testWindow2.goml index e67061c6..6fb61db0 100755 --- a/Tests/Interfaces/Divers/testWindow2.goml +++ b/Tests/Interfaces/Divers/testWindow2.goml @@ -1,6 +1,6 @@ <?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"> + 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}"> diff --git a/Tests/Interfaces/Divers/testWindow3.goml b/Tests/Interfaces/Divers/testWindow3.goml index 54b573d8..42459bd5 100755 --- a/Tests/Interfaces/Divers/testWindow3.goml +++ b/Tests/Interfaces/Divers/testWindow3.goml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <Window 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"> + Focusable="True" CornerRadius="20" MinimumSize="100,100" MaximumSize="500,500"> <Template> <Container Margin="20" Name="Content" Height="{../HeightPolicy}" Width="{../WidthPolicy}" Background="0.5,0.5,0.5,0.5"/> </Template> diff --git a/Tests/Interfaces/Divers/test_Listbox.crow b/Tests/Interfaces/Divers/test_Listbox.crow index 61b673aa..321ea58c 100755 --- a/Tests/Interfaces/Divers/test_Listbox.crow +++ b/Tests/Interfaces/Divers/test_Listbox.crow @@ -15,7 +15,7 @@ <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}" Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}" ValueChanged="../../../_scroller_ValueChanged"> - <VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" MinimumSize="100;100" + <VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" MinimumSize="100,100" Name="List" Margin="0" VerticalAlignment="Top" LayoutChanged="../../../../_list_LayoutChanged"/> </Scroller> diff --git a/Tests/Interfaces/GraphicObject/0.crow b/Tests/Interfaces/GraphicObject/0.crow index 6185bd71..6a01cb63 100755 --- a/Tests/Interfaces/GraphicObject/0.crow +++ b/Tests/Interfaces/GraphicObject/0.crow @@ -1,3 +1,3 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <GraphicObject Margin="10" Width="Stretched" Height="Stretched" Background="Mantis" - MinimumSize="50;50"/>
\ No newline at end of file + MinimumSize="50,50"/>
\ No newline at end of file diff --git a/Tests/Interfaces/GraphicObject/1.crow b/Tests/Interfaces/GraphicObject/1.crow index 262fc24e..14ca7961 100755 --- a/Tests/Interfaces/GraphicObject/1.crow +++ b/Tests/Interfaces/GraphicObject/1.crow @@ -1,3 +1,3 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <GraphicObject Margin="10" Width="150" Height="150" Background="Mantis" - MinimumSize="50;50"/>
\ No newline at end of file + MinimumSize="50,50"/>
\ No newline at end of file diff --git a/Tests/Interfaces/GraphicObject/2.crow b/Tests/Interfaces/GraphicObject/2.crow index dfd10ab7..74075b28 100755 --- a/Tests/Interfaces/GraphicObject/2.crow +++ b/Tests/Interfaces/GraphicObject/2.crow @@ -1,3 +1,3 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <GraphicObject Margin="10" Width="50%" Height="50%" Background="Mantis" - MinimumSize="50;50"/>
\ No newline at end of file + MinimumSize="50,50"/>
\ No newline at end of file diff --git a/Tests/Interfaces/Group/0.crow b/Tests/Interfaces/Group/0.crow index c3cf308f..7eb5a0a6 100755 --- a/Tests/Interfaces/Group/0.crow +++ b/Tests/Interfaces/Group/0.crow @@ -1,11 +1,11 @@ -<?xml version="1.0"?> -<Group MinimumSize="50;50" Background="Onyx" Margin="10" Width="90%" Height="90%"> +<?xml version="1.0"?> +<Group MinimumSize="50,50" Background="Onyx" Margin="10" Width="90%" Height="90%"> <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis" VerticalAlignment="Top" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis" VerticalAlignment="Bottom" - MinimumSize="10;10"/> + MinimumSize="10,10"/> </Group>
\ No newline at end of file diff --git a/Tests/Interfaces/Group/1.crow b/Tests/Interfaces/Group/1.crow index 6950a8d8..6f07c3f3 100755 --- a/Tests/Interfaces/Group/1.crow +++ b/Tests/Interfaces/Group/1.crow @@ -1,33 +1,33 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <Group Background="Onyx" Margin="10" Width="90%" Height="90%"> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Top" HorizontalAlignment="Left" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Top" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Top" HorizontalAlignment="Right" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" HorizontalAlignment="Left" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" HorizontalAlignment="Right" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Bottom" HorizontalAlignment="Left" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Bottom" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Bottom" HorizontalAlignment="Right" - MinimumSize="10;10"/> + MinimumSize="10,10"/> </Group>
\ No newline at end of file diff --git a/Tests/Interfaces/Group/2.crow b/Tests/Interfaces/Group/2.crow index 693e1b05..a7cc91ab 100755 --- a/Tests/Interfaces/Group/2.crow +++ b/Tests/Interfaces/Group/2.crow @@ -1,33 +1,33 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <Group Background="Onyx" Margin="10" Fit="true"> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Top" HorizontalAlignment="Left" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Top" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Top" HorizontalAlignment="Right" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" HorizontalAlignment="Left" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" HorizontalAlignment="Right" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Bottom" HorizontalAlignment="Left" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Bottom" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Bottom" HorizontalAlignment="Right" - MinimumSize="10;10"/> + MinimumSize="10,10"/> </Group>
\ No newline at end of file diff --git a/Tests/Interfaces/Group/3.crow b/Tests/Interfaces/Group/3.crow index 321e219d..7c038551 100755 --- a/Tests/Interfaces/Group/3.crow +++ b/Tests/Interfaces/Group/3.crow @@ -1,33 +1,33 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <Group Background="Onyx" Margin="10" Width="70%" Height="50%"> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Top" HorizontalAlignment="Left" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Top" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Top" HorizontalAlignment="Right" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="100%" Height="20%" Background="Mantis" HorizontalAlignment="Left" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" HorizontalAlignment="Right" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Bottom" HorizontalAlignment="Left" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Bottom" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Bottom" HorizontalAlignment="Right" - MinimumSize="10;10"/> + MinimumSize="10,10"/> </Group>
\ No newline at end of file diff --git a/Tests/Interfaces/Group/4.crow b/Tests/Interfaces/Group/4.crow index 25e03bd8..02c01b29 100755 --- a/Tests/Interfaces/Group/4.crow +++ b/Tests/Interfaces/Group/4.crow @@ -1,7 +1,7 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <Group Background="Onyx" Margin="10" Fit="true"> <Label Font="droid bold,40" Text="{fps}" Margin="10" Fit="true"/> <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis" VerticalAlignment="Top" - MinimumSize="10;10"/> + MinimumSize="10,10"/> </Group>
\ No newline at end of file diff --git a/Tests/Interfaces/Nouveau dossier/testColorList.crow b/Tests/Interfaces/Nouveau dossier/testColorList.crow index 8a5c592f..d9b67410 100755 --- a/Tests/Interfaces/Nouveau dossier/testColorList.crow +++ b/Tests/Interfaces/Nouveau dossier/testColorList.crow @@ -10,7 +10,7 @@ <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}" Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}" ValueChanged="../../../_scroller_ValueChanged"> - <VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" MinimumSize="10;10" + <VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" MinimumSize="10,10" Name="List" Margin="0" VerticalAlignment="Top" HorizontalAlignment="Left" diff --git a/Tests/Interfaces/Nouveau dossier/testDirViewer.crow b/Tests/Interfaces/Nouveau dossier/testDirViewer.crow index c63e5483..dd6f9b8a 100755 --- a/Tests/Interfaces/Nouveau dossier/testDirViewer.crow +++ b/Tests/Interfaces/Nouveau dossier/testDirViewer.crow @@ -9,7 +9,7 @@ SelectedItemChanged="OnSelectedItemChanged" ItemTemplate="Interfaces/tmpDirItem.goml" > <Template> - <Border BorderWidth="1" MinimumSize="20;20" Height="{../HeightPolicy}" Width="{../WidthPolicy}"> + <Border BorderWidth="1" MinimumSize="20,20" Height="{../HeightPolicy}" Width="{../WidthPolicy}"> <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"> <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}" Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}"> diff --git a/Tests/Interfaces/Stack/0.crow b/Tests/Interfaces/Stack/0.crow index a178d8cc..63290f9e 100755 --- a/Tests/Interfaces/Stack/0.crow +++ b/Tests/Interfaces/Stack/0.crow @@ -1,9 +1,9 @@ -<?xml version="1.0"?> -<VerticalStack MinimumSize="50;50" Background="Onyx" Margin="10" Width="90%" Height="90%"> +<?xml version="1.0"?> +<VerticalStack MinimumSize="50,50" Background="Onyx" Margin="10" Width="90%" Height="90%"> <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> </VerticalStack>
\ No newline at end of file diff --git a/Tests/Interfaces/Stack/0h.crow b/Tests/Interfaces/Stack/0h.crow index 9e31f04a..170bbed4 100755 --- a/Tests/Interfaces/Stack/0h.crow +++ b/Tests/Interfaces/Stack/0h.crow @@ -1,9 +1,9 @@ -<?xml version="1.0"?> -<HorizontalStack MinimumSize="50;50" Background="Onyx" Margin="10" Width="90%" Height="90%"> +<?xml version="1.0"?> +<HorizontalStack MinimumSize="50,50" Background="Onyx" Margin="10" Width="90%" Height="90%"> <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> </HorizontalStack>
\ No newline at end of file diff --git a/Tests/Interfaces/Stack/1.crow b/Tests/Interfaces/Stack/1.crow index f8b28779..a0ac28c9 100755 --- a/Tests/Interfaces/Stack/1.crow +++ b/Tests/Interfaces/Stack/1.crow @@ -1,9 +1,9 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <VerticalStack Background="Onyx" Margin="10" Width="90%" Height="90%"> <GraphicObject Margin="10" Width="Stretched" Height="20%" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="60%" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="20%" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> </VerticalStack>
\ No newline at end of file diff --git a/Tests/Interfaces/Stack/1h.crow b/Tests/Interfaces/Stack/1h.crow index b86b77ac..7d97bd2c 100755 --- a/Tests/Interfaces/Stack/1h.crow +++ b/Tests/Interfaces/Stack/1h.crow @@ -1,9 +1,9 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <HorizontalStack Background="Onyx" Margin="10" Width="90%" Height="90%"> <GraphicObject Margin="10" Width="Stretched" Height="20%" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="60%" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="20%" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> </HorizontalStack>
\ No newline at end of file diff --git a/Tests/Interfaces/Stack/2.crow b/Tests/Interfaces/Stack/2.crow index ebf1d1e9..6d8c9ad6 100755 --- a/Tests/Interfaces/Stack/2.crow +++ b/Tests/Interfaces/Stack/2.crow @@ -1,9 +1,9 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <VerticalStack Background="Onyx" Margin="10" Width="90%" Height="100%"> <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="Stretched" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> </VerticalStack>
\ No newline at end of file diff --git a/Tests/Interfaces/Stack/2h.crow b/Tests/Interfaces/Stack/2h.crow index dc05fc0c..de1c36fe 100755 --- a/Tests/Interfaces/Stack/2h.crow +++ b/Tests/Interfaces/Stack/2h.crow @@ -1,9 +1,9 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <HorizontalStack Background="Onyx" Margin="10" Width="90%" Height="100%"> <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="Stretched" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="10;10"/> + MinimumSize="10,10"/> </HorizontalStack>
\ No newline at end of file diff --git a/Tests/Interfaces/Stack/3.crow b/Tests/Interfaces/Stack/3.crow index a5ec06ad..e46a5fff 100755 --- a/Tests/Interfaces/Stack/3.crow +++ b/Tests/Interfaces/Stack/3.crow @@ -1,45 +1,45 @@ <?xml version="1.0"?> <VerticalStack Background="Onyx" Margin="10" Width="90%" Height="90%"> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Stretched" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Stretched" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> </VerticalStack>
\ No newline at end of file diff --git a/Tests/Interfaces/Stack/3h.crow b/Tests/Interfaces/Stack/3h.crow index a675876e..3a1d77dc 100755 --- a/Tests/Interfaces/Stack/3h.crow +++ b/Tests/Interfaces/Stack/3h.crow @@ -1,45 +1,45 @@ <?xml version="1.0"?> <HorizontalStack Background="Onyx" Margin="10" Width="90%" Height="90%"> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Stretched" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Stretched" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> <GraphicObject Margin="1" Width="Stretched" Height="Fit" Background="Mantis" - MinimumSize="2;2"/> + MinimumSize="2,2"/> </HorizontalStack>
\ No newline at end of file diff --git a/Tests/Interfaces/basicTests/0.crow b/Tests/Interfaces/basicTests/0.crow index 486399b8..b5c153ef 100755 --- a/Tests/Interfaces/basicTests/0.crow +++ b/Tests/Interfaces/basicTests/0.crow @@ -1,6 +1,6 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <Label Margin="50" Width="50%" Height="50%" TextAlignment="BottomRight" Background="Mantis"/> <!--<Container Background="Green" Margin="10" Width="Fit" Height="Fit"> <GraphicObject Margin="10" Width="{../WidthPolicy}" Height="{../HeightPolicy}" Background="Red" - MinimumSize="50;50"/> + MinimumSize="50,50"/> </Container>-->
\ No newline at end of file diff --git a/src/Colors.cs b/src/Colors.cs index 751fb252..e928f377 100644 --- a/src/Colors.cs +++ b/src/Colors.cs @@ -53,7 +53,7 @@ namespace Crow if (string.IsNullOrEmpty(s)) return White; - string[] c = s.Split(new char[] { ';' }); + string[] c = s.Split(new char[] { ',' }); if (c.Length == 1) { diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 3eaa91f1..26a7a59d 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -485,6 +485,17 @@ namespace Crow } #endregion + + /// <summary> + /// Add 'Styles' to full class name between assembly name and the rest of the full name space + /// </summary> + string getDefaultStyleResId (Type t) { + string [] tmp = t.FullName.Split ('.'); + string res = tmp [0] + ".Styles"; + for (int i = 1; i < tmp.Length; i++) + res += "." + tmp [i]; + return res; + } /// <summary> Loads the default values from XML attributes default </summary> protected virtual void loadDefaultValues() { @@ -500,8 +511,21 @@ namespace Crow Dictionary<string, string> styling = null; - if (Interface.CurrentInterface.Styling.ContainsKey (thisType.Name)) - styling = Interface.CurrentInterface.Styling[thisType.Name]; + //Search for a style mathing : + //1: Full class name, with full namespace + //2: class name + //3: style may have been registered with their ressource ID minus .style extention + // those files being placed in a Styles folder + + if (Interface.CurrentInterface.Styling.ContainsKey (thisType.FullName)) + styling = Interface.CurrentInterface.Styling [thisType.FullName]; + else if (Interface.CurrentInterface.Styling.ContainsKey (thisType.Name)) + styling = Interface.CurrentInterface.Styling [thisType.Name]; + else { + string styleFullName = getDefaultStyleResId (thisType); + if (Interface.CurrentInterface.Styling.ContainsKey (styleFullName)) + styling = Interface.CurrentInterface.Styling [styleFullName]; + } //Reflexion being very slow compared to dyn method or delegates, //I compile the initial values coded in the CustomAttribs of the class, @@ -546,7 +570,7 @@ namespace Crow memberHasStyle = true; } if (memberHasStyle){ - + defaultValue = styling [name]; }else { if (name == "Style") { //retrieve default value from class attribute @@ -635,10 +659,12 @@ namespace Crow //surely a class or struct if (dvType != typeof(string)) throw new Exception ("Expecting String in default values for: " + pi.Name); - if (pi.PropertyType == typeof(string)) + if (pi.PropertyType == typeof (string)) il.Emit (OpCodes.Ldstr, Convert.ToString (defaultValue)); else { - MethodInfo miParse = pi.PropertyType.GetMethod ("Parse", BindingFlags.Static | BindingFlags.Public); + MethodInfo miParse = pi.PropertyType.GetMethod + ("Parse", BindingFlags.Static | BindingFlags.Public, + Type.DefaultBinder, new Type [] {typeof (string)},null); if (miParse == null) throw new Exception ("no Parse method found for: " + pi.PropertyType.FullName); diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs index e1bf02a7..9af86266 100644 --- a/src/GraphicObjects/Label.cs +++ b/src/GraphicObjects/Label.cs @@ -383,11 +383,8 @@ namespace Crow foreach (string s in lines) { string l = s.Replace("\t", new String (' ', Interface.TabSize)); -#if _WIN32 || _WIN64 - TextExtents tmp = gr.TextExtents(str.ToUtf8()); -#elif __linux__ TextExtents tmp = gr.TextExtents (l); -#endif + if (tmp.XAdvance > te.XAdvance) te = tmp; } @@ -582,11 +579,8 @@ namespace Crow Foreground.SetAsSource (gr); gr.MoveTo (lineRect.X, rText.Y + fe.Ascent + fe.Height * i); - #if _WIN32 || _WIN64 - gr.ShowText(l.ToUtf8()); - #elif __linux__ gr.ShowText (l); - #endif + gr.Fill (); } } @@ -675,12 +669,8 @@ namespace Crow if (c == "\t") c = new string (' ', Interface.TabSize); - #if _WIN32 || _WIN64 - byte[] c = System.Text.UTF8Encoding.UTF8.GetBytes(Text.Substring(i, 1)); te = gr.TextExtents(c); - #elif __linux__ - te = gr.TextExtents(c); - #endif + double halfWidth = te.XAdvance / 2; if (mouseLocalPos.X <= cPos + halfWidth) diff --git a/src/GraphicObjects/TextRun.cs b/src/GraphicObjects/TextRun.cs index c644767c..cc882f40 100644 --- a/src/GraphicObjects/TextRun.cs +++ b/src/GraphicObjects/TextRun.cs @@ -10,30 +10,30 @@ using System.ComponentModel; namespace Crow { - public class TextRun : GraphicObject - { + public class TextRun : GraphicObject + { #region CTOR - public TextRun() - { + public TextRun () + { } - public TextRun(string _text) - : base() + public TextRun (string _text) + : base () { Text = _text; } #endregion - //TODO:change protected to private - + //TODO:change protected to private + #region private and protected fields protected string _text = "label"; - Alignment _textAlignment = Alignment.Left; + Alignment _textAlignment = Alignment.Left; bool horizontalStretch = false; bool verticalStretch = false; bool _multiline; bool wordWrap; - protected Rectangle rText; + protected Rectangle rText; protected float widthRatio = 1f; protected float heightRatio = 1f; protected FontExtents fe; @@ -41,69 +41,70 @@ namespace Crow #endregion - [XmlAttributeAttribute()][DefaultValue(Alignment.Left)] - public Alignment TextAlignment - { - get { return _textAlignment; } - set { _textAlignment = value; } - } - [XmlAttributeAttribute()][DefaultValue(false)] + [XmlAttributeAttribute ()] + [DefaultValue (Alignment.Left)] + public Alignment TextAlignment { + get { return _textAlignment; } + set { _textAlignment = value; } + } + [XmlAttributeAttribute ()] + [DefaultValue (false)] public virtual bool HorizontalStretch { get { return horizontalStretch; } set { if (horizontalStretch == value) return; - horizontalStretch = value; + horizontalStretch = value; RegisterForGraphicUpdate (); NotifyValueChanged ("HorizontalStretch", horizontalStretch); } } - [XmlAttributeAttribute()][DefaultValue(false)] + [XmlAttributeAttribute ()] + [DefaultValue (false)] public virtual bool VerticalStretch { get { return verticalStretch; } set { if (verticalStretch == value) return; - verticalStretch = value; + verticalStretch = value; NotifyValueChanged ("VerticalStretch", verticalStretch); } - } - [XmlAttributeAttribute()][DefaultValue("label")] - public string Text - { - get { - return lines == null ? - _text : lines.Aggregate((i, j) => i + Interface.LineBreak + j); + } + [XmlAttributeAttribute ()] + [DefaultValue ("label")] + public string Text { + get { + return lines == null ? + _text : lines.Aggregate ((i, j) => i + Interface.LineBreak + j); } - set - { - if (_text == value) - return; - - RegisterForGraphicUpdate(); + set { + if (_text == value) + return; + + RegisterForGraphicUpdate (); this.RegisterForLayouting (LayoutingType.Sizing); - _text = value; + _text = value; - if (string.IsNullOrEmpty(_text)) + if (string.IsNullOrEmpty (_text)) _text = ""; lines = getLines; - } - } - [XmlAttributeAttribute()][DefaultValue(false)] - public bool Multiline - { + } + } + [XmlAttributeAttribute ()] + [DefaultValue (false)] + public bool Multiline { get { return _multiline; } - set - { + set { _multiline = value; - RegisterForGraphicUpdate(); + RegisterForGraphicUpdate (); } } - [XmlAttributeAttribute()][DefaultValue(false)] + [XmlAttributeAttribute ()] + [DefaultValue (false)] public bool WordWrap { get { return wordWrap; @@ -112,22 +113,22 @@ namespace Crow if (wordWrap == value) return; wordWrap = value; - RegisterForGraphicUpdate(); + RegisterForGraphicUpdate (); } } List<string> lines; List<string> getLines { - get { + get { return _multiline ? - Regex.Split (_text, "\r\n|\r|\n").ToList() : - new List<string>(new string[] { _text }); + Regex.Split (_text, "\r\n|\r|\n").ToList () : + new List<string> (new string [] { _text }); } } #region GraphicObject overrides - protected override int measureRawSize(LayoutingType lt) - { + protected override int measureRawSize (LayoutingType lt) + { if (lines == null) lines = getLines; @@ -140,25 +141,22 @@ namespace Crow fe = gr.FontExtents; - te = new TextExtents(); + te = new TextExtents (); - if (lt == LayoutingType.Height){ + if (lt == LayoutingType.Height) { int lc = lines.Count; //ensure minimal height = text line height if (lc == 0) - lc = 1; + lc = 1; return (int)(fe.Height * lc) + Margin * 2; } foreach (string s in lines) { - string l = s.Replace("\t", new String (' ', Interface.TabSize)); + string l = s.Replace ("\t", new String (' ', Interface.TabSize)); - #if _WIN32 || _WIN64 - TextExtents tmp = gr.TextExtents(str.ToUtf8()); - #elif __linux__ TextExtents tmp = gr.TextExtents (l); - #endif + if (tmp.XAdvance > te.XAdvance) te = tmp; } @@ -176,8 +174,8 @@ namespace Crow gr.Antialias = Antialias.Subpixel; - rText = new Rectangle(new Size( - measureRawSize(LayoutingType.Width), measureRawSize(LayoutingType.Height))); + rText = new Rectangle (new Size ( + measureRawSize (LayoutingType.Width), measureRawSize (LayoutingType.Height))); rText.Width -= 2 * Margin; rText.Height -= 2 * Margin; @@ -188,16 +186,16 @@ namespace Crow //ignore text alignment if size to content = true //or if text size is larger than client bounds - if (Width < 0 || Height < 0 || rText.Width > cb.Width) - { + if (Width < 0 || Height < 0 || rText.Width > cb.Width) { rText.X = cb.X; rText.Y = cb.Y; - }else { + } else { if (horizontalStretch) { widthRatio = (float)cb.Width / rText.Width; if (!verticalStretch) heightRatio = widthRatio; - }if (verticalStretch) { + } + if (verticalStretch) { heightRatio = (float)cb.Height / rText.Height; if (!horizontalStretch) widthRatio = heightRatio; @@ -206,8 +204,7 @@ namespace Crow rText.Width = (int)(widthRatio * cb.Width); rText.Height = (int)(heightRatio * cb.Height); - switch (TextAlignment) - { + switch (TextAlignment) { case Alignment.TopLeft: //ok rText.X = cb.X; rText.Y = cb.Y; @@ -247,11 +244,11 @@ namespace Crow } } - gr.FontMatrix = new Matrix(widthRatio * Font.Size, 0, 0, heightRatio * Font.Size, 0, 0); + gr.FontMatrix = new Matrix (widthRatio * Font.Size, 0, 0, heightRatio * Font.Size, 0, 0); int curLineCount = 0; - for (int i = 0;i < lines.Count;i++) { + for (int i = 0; i < lines.Count; i++) { string l = lines [i].Replace ("\t", new String (' ', Interface.TabSize)); List<string> wl = new List<string> (); int lineLength = (int)gr.TextExtents (l).XAdvance; @@ -275,28 +272,28 @@ namespace Crow foreach (string ll in wl) { lineLength = (int)gr.TextExtents (ll).XAdvance; - + if (string.IsNullOrWhiteSpace (ll)) { curLineCount++; continue; } - Foreground.SetAsSource (gr); + Foreground.SetAsSource (gr); gr.MoveTo (rText.X, rText.Y + fe.Ascent + fe.Height * curLineCount); - #if _WIN32 || _WIN64 +#if _WIN32 || _WIN64 gr.ShowText(ll.ToUtf8()); - #elif __linux__ +#elif __linux__ gr.ShowText (ll); - #endif +#endif gr.Fill (); curLineCount++; - + } - } + } } #endregion - } + } } |