diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2025-07-16 19:59:45 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2025-07-16 19:59:45 +0200 |
| commit | e96fecb4bb512ee47e9df0224e779b24d686bc30 (patch) | |
| tree | 14f43f1e1f3ab809291e1bb237e55fbbe8f017a7 | |
| parent | aca564c44af54cd3b7fbfb9552aa1d74fab67df6 (diff) | |
debug & templates
| -rw-r--r-- | Crow/Default.style | 3 | ||||
| -rw-r--r-- | Crow/Templates/CheckBox2.template | 2 | ||||
| -rw-r--r-- | Crow/Templates/ColorSlider.template | 9 | ||||
| -rw-r--r-- | Crow/Templates/DefaultTableHeaderCell.template | 2 | ||||
| -rw-r--r-- | Crow/Templates/GroupBox.template | 2 | ||||
| -rw-r--r-- | Crow/src/ExtensionsMethods.cs | 6 | ||||
| -rw-r--r-- | Crow/src/IML/CompilerServices.cs | 6 | ||||
| -rw-r--r-- | Crow/src/IML/Instantiator.cs | 9 | ||||
| -rw-r--r-- | Crow/src/Widgets/Wrapper.cs | 3 | ||||
| -rw-r--r-- | Drawing2D/Drawing2D.csproj | 2 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Divers/color3.crow | 7 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Divers/colorPicker.crow | 2 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Divers/colorSlider3.crow | 82 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Divers/colorSlider4.crow | 24 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Divers/colorSlider5.crow | 8 | ||||
| -rw-r--r-- | Samples/common/ui/templates/ColorPicker2.template | 33 |
16 files changed, 115 insertions, 85 deletions
diff --git a/Crow/Default.style b/Crow/Default.style index 6b0a718f..df1c75d1 100644 --- a/Crow/Default.style +++ b/Crow/Default.style @@ -342,9 +342,10 @@ labColorV { Width="50"; TextAlignment="Right"; } + ColorSlider { Focusable="true"; - Height="36"; + Height="18"; Margin="0"; Maximum="255"; Decimals="0"; diff --git a/Crow/Templates/CheckBox2.template b/Crow/Templates/CheckBox2.template index 4f692335..40ba9148 100644 --- a/Crow/Templates/CheckBox2.template +++ b/Crow/Templates/CheckBox2.template @@ -1,4 +1,4 @@ -<Label Font="{./Font}" Text="{./Caption}" CornerRadius="{./CornerRadius}" Width="Stretched" Focusable="{./Focusable}" +<Label Font="{./Font}" Text="{./Caption}" CornerRadius="{./CornerRadius}" Width="Stretched" Focusable="false" Margin="3" Background="{./Background}" Foreground="{./Foreground}" diff --git a/Crow/Templates/ColorSlider.template b/Crow/Templates/ColorSlider.template index 2d05e7d6..4a9d6fc8 100644 --- a/Crow/Templates/ColorSlider.template +++ b/Crow/Templates/ColorSlider.template @@ -1,10 +1,5 @@ <?xml version="1.0"?> <Group Background="{./Background}" > - <ColorGauge Component="{./Component}" CurrentColor="{./CurrentColor}" Orientation="{./Orientation}" Margin="10" Height="Stretched" CornerRadius="10"/> - <Border Name="Cursor" Foreground="White" CornerRadius="15" BorderWidth="2"> - <Group Fit="true"> - <Label Left="2" Top="2" Text="{./Value}" Foreground="Black" Font="mono bold, 10"/> - <Label Text="{./Value}" Foreground="WhiteSmoke" Font="mono bold, 10"/> - </Group> - </Border> + <ColorGauge Component="{./Component}" CurrentColor="{./CurrentColor}" Orientation="{./Orientation}" Margin="5" Height="Stretched" CornerRadius="10"/> + <Shape Name="Cursor" Foreground="White" Size="10,20" Path="M 5.5,11.5 L 9.5,15.5 L 9.5,19.5 L 1.5,19.5 L 1.5,15.5 F G" Scaled="false" KeepProportions="true" StrokeWidth="0" Margin="0" /> </Group>
\ No newline at end of file diff --git a/Crow/Templates/DefaultTableHeaderCell.template b/Crow/Templates/DefaultTableHeaderCell.template index 0bb5368b..ccfbefd1 100644 --- a/Crow/Templates/DefaultTableHeaderCell.template +++ b/Crow/Templates/DefaultTableHeaderCell.template @@ -1,2 +1,2 @@ <?xml version="1.0"?> -<Label RootDataLevel="true" Style="TableHeaderLabel" Text="{Caption}" Width="{Width}"/>
\ No newline at end of file +<Label RootDataLevel="true" Style="TableHeaderLabel" Text="{Caption}" Width="{Width}" Margin="2" Background="DarkGrey"/>
\ No newline at end of file diff --git a/Crow/Templates/GroupBox.template b/Crow/Templates/GroupBox.template index 4931b87c..840abc17 100644 --- a/Crow/Templates/GroupBox.template +++ b/Crow/Templates/GroupBox.template @@ -2,7 +2,7 @@ <Container Background="{./Background}"> <Group CacheEnabled="true"> <VerticalStack Spacing="0"> - <Widget Height="6"/> + <Widget Height="10"/> <Border Style="ControlBorder" CornerRadius="{./CornerRadius}" Margin="10" > <Container Name="Content" Margin="0" MinimumSize="70,10"/> </Border> diff --git a/Crow/src/ExtensionsMethods.cs b/Crow/src/ExtensionsMethods.cs index 99d4d4bb..444519d8 100644 --- a/Crow/src/ExtensionsMethods.cs +++ b/Crow/src/ExtensionsMethods.cs @@ -1,17 +1,13 @@ -// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com> +// Copyright (c) 2013-2025 Jean-Philippe Bruyère <jp_bruyere@hotmail.com> // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) -using Crow.Text; using System; using System.IO; using System.Linq; -using System.Linq.Expressions; using System.Reflection; using Drawing2D; -using System.Reflection.PortableExecutable; -using Glfw; namespace Crow { diff --git a/Crow/src/IML/CompilerServices.cs b/Crow/src/IML/CompilerServices.cs index 9ddc43be..da5c1f86 100644 --- a/Crow/src/IML/CompilerServices.cs +++ b/Crow/src/IML/CompilerServices.cs @@ -911,6 +911,12 @@ namespace Crow.IML //get value from member of object internal static object getDataTypeAndFetch (object data, string fetchMethod){ + #if DEBUG + if (data == null) { + Debug.WriteLine($"getDataTypeAndFetch({fetchMethod}) error: data is null"); + return null; + } + #endif Type dataType = data.GetType(); //Console.WriteLine ($"get data type and fetch {data}.{fetchMethod}"); MethodInfo miGetDatas = dataType.GetMethod (fetchMethod, new Type[] {}); diff --git a/Crow/src/IML/Instantiator.cs b/Crow/src/IML/Instantiator.cs index 8d3fe059..be46d20a 100644 --- a/Crow/src/IML/Instantiator.cs +++ b/Crow/src/IML/Instantiator.cs @@ -824,17 +824,16 @@ namespace Crow.IML { il.Emit (OpCodes.Callvirt, sourceEvent.AddMethod);//call add event System.Reflection.Emit.Label finish = il.DefineLabel (); +#if DEBUG_BINDING il.Emit (OpCodes.Br, finish); il.MarkLabel (cancel); - //#if DEBUG_BINDING //TODO: try to print datasource type in the error message il.EmitWriteLine ($"[{dm.Name}] Handler method '{bindingDef.TargetMember}' for '{sourceEvent.Name}' NOT FOUND in new dataSource"); - //#endif il.MarkLabel (finish); - #if DEBUG_BINDING il.EmitWriteLine ($"[{dm.Name}] Handler method '{bindingDef.TargetMember}' for '{sourceEvent.Name}' FOUND in new dataSource"); - #endif - +#else + il.MarkLabel (cancel); +#endif il.Emit (OpCodes.Ret); //store dschange delegate in instatiator instance for access while instancing graphic object diff --git a/Crow/src/Widgets/Wrapper.cs b/Crow/src/Widgets/Wrapper.cs index 734227b7..b4a7484c 100644 --- a/Crow/src/Widgets/Wrapper.cs +++ b/Crow/src/Widgets/Wrapper.cs @@ -1,7 +1,6 @@ -// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com> +// Copyright (c) 2013-2025 Jean-Philippe Bruyère <jp_bruyere@hotmail.com> // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) -using static Crow.Logger; namespace Crow { diff --git a/Drawing2D/Drawing2D.csproj b/Drawing2D/Drawing2D.csproj index 9af041b5..14afcc2e 100644 --- a/Drawing2D/Drawing2D.csproj +++ b/Drawing2D/Drawing2D.csproj @@ -4,7 +4,7 @@ <TargetFramework>netstandard2.1</TargetFramework> <EnableDefaultCompileItems>false</EnableDefaultCompileItems> - <AssemblyVersion>1.2.3</AssemblyVersion> + <AssemblyVersion>1.2.4</AssemblyVersion> <PackageVersion>$(AssemblyVersion)-beta</PackageVersion> <Title>Drawing 2D Library</Title> diff --git a/Samples/common/ui/Interfaces/Divers/color3.crow b/Samples/common/ui/Interfaces/Divers/color3.crow deleted file mode 100644 index 1788004c..00000000 --- a/Samples/common/ui/Interfaces/Divers/color3.crow +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0"?> -<VerticalStack> - <Widget Name="go" Width="100" Height="60" Background="DarkBlue"/> - <Widget Width="100" Height="60" Background="{../colorPicker.CurrentColor}"/> - <Label Text="{../colorPicker.CurrentColor}"/> - <ColorPicker CurrentColor="{²../go.Background}" Name="colorPicker" Background="DimGrey" MinimumSize="0,0" Width="300" Template="/mnt/devel/CrowIDE/Crow/Samples/common/ui/templates/ColorPicker.template" /> -</VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Divers/colorPicker.crow b/Samples/common/ui/Interfaces/Divers/colorPicker.crow index c1912be6..e38957eb 100644 --- a/Samples/common/ui/Interfaces/Divers/colorPicker.crow +++ b/Samples/common/ui/Interfaces/Divers/colorPicker.crow @@ -1,6 +1,6 @@ <?xml version="1.0"?> <VerticalStack> - <ColorPicker CurrentColor="{²../go.Background}" Name="colorPicker" Background="DimGrey" Width="400" /> + <ColorPicker CurrentColor="{²../go.Background}" Name="colorPicker" Background="Jet" Width="220" /> <Widget Name="go" Width="100" Height="60" Background="DarkBlue"/> <Widget Width="100" Height="60" Background="{../colorPicker.CurrentColor}"/> <Label Text="{../colorPicker.CurrentColor}"/> diff --git a/Samples/common/ui/Interfaces/Divers/colorSlider3.crow b/Samples/common/ui/Interfaces/Divers/colorSlider3.crow index 4236b929..a8e5257b 100644 --- a/Samples/common/ui/Interfaces/Divers/colorSlider3.crow +++ b/Samples/common/ui/Interfaces/Divers/colorSlider3.crow @@ -1,47 +1,47 @@ <VerticalStack Margin="50" Spacing="20" Background="Black"> <ColorPicker> <Template> -<Border Background="{./Background}" Foreground="{./Foreground}" Width="Stretched" - CornerRadius="{./CornerRadius}" BorderWidth="1"> - <VerticalStack Margin="2"> - <Widget Width="30" Height="16" Background="{./CurrentColor}"/> - <HorizontalStack Height="Fit"> - <Label Style="labColor" Text="R:"/> - <ColorSlider Name="cs" Component="Red" CurrentColor="{./CurrentColor}" Value="{²./Red}"/> - <Label Style="labColorV" Text="{../cs.Value}" /> - </HorizontalStack> - <HorizontalStack Height="Fit"> - <Label Style="labColor" Text="G:"/> - <ColorSlider Name="cs" Component="Green" CurrentColor="{./CurrentColor}" Value="{²./Green}"/> - <Label Style="labColorV" Text="{../cs.Value}" /> - </HorizontalStack> - <HorizontalStack Height="Fit"> - <Label Style="labColor" Text="B:"/> - <ColorSlider Name="cs" Component="Blue" CurrentColor="{./CurrentColor}" Value="{²./Blue}"/> - <Label Style="labColorV" Text="{../cs.Value}" /> - </HorizontalStack> - <HorizontalStack Height="Fit"> - <Label Style="labColor" Text="A:"/> - <ColorSlider Name="cs" Component="Alpha" CurrentColor="{./CurrentColor}" Value="{²./Alpha}"/> - <Label Style="labColorV" Text="{../cs.Value}" /> - </HorizontalStack> - <HorizontalStack Height="Fit"> - <Label Style="labColor" Text="H:"/> - <ColorSlider Name="cs" Component="Hue" CurrentColor="{./CurrentColor}" Value="{²./Hue}"/> - <Label Style="labColorV" Text="{../cs.Value}" /> - </HorizontalStack> - <HorizontalStack Height="Fit"> - <Label Style="labColor" Text="S:"/> - <ColorSlider Name="cs" Component="Saturation" CurrentColor="{./CurrentColor}" Value="{²./Saturation}"/> - <Label Style="labColorV" Text="{../cs.Value}" /> - </HorizontalStack> - <HorizontalStack Height="Fit"> - <Label Style="labColor" Text="V:"/> - <ColorSlider Name="cs" Component="Value" CurrentColor="{./CurrentColor}" Value="{²./Value}"/> - <Label Style="labColorV" Text="{../cs.Value}" /> - </HorizontalStack> - </VerticalStack> -</Border> + <Border Background="{./Background}" Foreground="{./Foreground}" Width="Stretched" + CornerRadius="{./CornerRadius}" BorderWidth="1"> + <VerticalStack Margin="2"> + <Widget Width="30" Height="16" Background="{./CurrentColor}"/> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="R:"/> + <ColorSlider Name="cs" Component="Red" CurrentColor="{./CurrentColor}" Value="{²./Red}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="G:"/> + <ColorSlider Name="cs" Component="Green" CurrentColor="{./CurrentColor}" Value="{²./Green}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="B:"/> + <ColorSlider Name="cs" Component="Blue" CurrentColor="{./CurrentColor}" Value="{²./Blue}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="A:"/> + <ColorSlider Name="cs" Component="Alpha" CurrentColor="{./CurrentColor}" Value="{²./Alpha}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="H:"/> + <ColorSlider Name="cs" Component="Hue" CurrentColor="{./CurrentColor}" Value="{²./Hue}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="S:"/> + <ColorSlider Name="cs" Component="Saturation" CurrentColor="{./CurrentColor}" Value="{²./Saturation}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="V:"/> + <ColorSlider Name="cs" Component="Value" CurrentColor="{./CurrentColor}" Value="{²./Value}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + </VerticalStack> + </Border> </Template> </ColorPicker> </VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Divers/colorSlider4.crow b/Samples/common/ui/Interfaces/Divers/colorSlider4.crow index 95463636..c24194ab 100644 --- a/Samples/common/ui/Interfaces/Divers/colorSlider4.crow +++ b/Samples/common/ui/Interfaces/Divers/colorSlider4.crow @@ -1,13 +1,13 @@ -<ColorSlider Width="400" Component="Red" Background="Grey" Height="34" CursorSize="24" > -<Template> - <Group Background="{./Background}" > - <ColorGauge Component="{./Component}" CurrentColor="{./CurrentColor}" Orientation="{./Orientation}" Margin="10" Height="Stretched" CornerRadius="10"/> - <Border Name="Cursor" Foreground="White" CornerRadius="15" BorderWidth="2"> - <Group Fit="true"> - <Label Left="2" Top="2" Text="{./Value}" Foreground="Black" Font="mono bold, 10"/> - <Label Text="{./Value}" Foreground="WhiteSmoke" Font="mono bold, 10"/> - </Group> - </Border> - </Group> -</Template> +<ColorSlider Width="400" Component="Red" Background="Grey" Height="20" CursorSize="20" > + <Template> + <Group Background="{./Background}" > + <ColorGauge Component="{./Component}" CurrentColor="{./CurrentColor}" Orientation="{./Orientation}" Margin="3" Height="Stretched" CornerRadius="10"/> + <Border Name="Cursor" Foreground="White" CornerRadius="0" BorderWidth="1"> + <Group Fit="true"> + <Label Left="2" Top="2" Text="{./Value}" Foreground="Black" Font="mono bold, 10"/> + <Label Text="{./Value}" Foreground="WhiteSmoke" Font="mono bold, 10"/> + </Group> + </Border> + </Group> + </Template> </ColorSlider>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Divers/colorSlider5.crow b/Samples/common/ui/Interfaces/Divers/colorSlider5.crow new file mode 100644 index 00000000..4fe37994 --- /dev/null +++ b/Samples/common/ui/Interfaces/Divers/colorSlider5.crow @@ -0,0 +1,8 @@ +<ColorSlider Width="400" Component="Red" Background="Transparent" Height="16" CursorSize="10" > + <Template> + <Group Background="{./Background}" > + <ColorGauge Component="{./Component}" CurrentColor="{./CurrentColor}" Orientation="{./Orientation}" Margin="5" Height="Stretched" CornerRadius="10"/> + <Shape Name="Cursor" Foreground="White" Size="10,20" Path="M 5.5,11.5 L 9.5,15.5 L 9.5,19.5 L 1.5,19.5 L 1.5,15.5 F G" Scaled="false" KeepProportions="true" StrokeWidth="0" Margin="0" /> + </Group> + </Template> +</ColorSlider> diff --git a/Samples/common/ui/templates/ColorPicker2.template b/Samples/common/ui/templates/ColorPicker2.template new file mode 100644 index 00000000..91ec1d12 --- /dev/null +++ b/Samples/common/ui/templates/ColorPicker2.template @@ -0,0 +1,33 @@ +<ColorPicker> +<Template> +<Popper Margin="0" Caption="{./CurrentColor}" Background="{./Background}" > + <Template> + <HorizontalStack Margin="1" Spacing="3" Background="{./Background}"> + <Border Width="18" Height="12" CornerRadius="3" + Background="{../../../CurrentColor}"> + </Border> + <Label Width="Stretched" Text="{./Caption}" Foreground="{./Foreground}" /> + </HorizontalStack> + </Template>/> + <TabView MinimumSize="{../MinimumPopupSize}" Width="200" Height="200" > + <ColorPicker Name="HSV" CurrentColor="{²../../../CurrentColor}" Background="Onyx" BubbleEvents="None"/> + <ColorPicker IsVisible="false" Name="Names" CurrentColor="{²../../../CurrentColor}" Height="Stretched" Background="Onyx"> + <Template> + <ListBox Width="Stretched" Data="{./AvailableColors}" SelectedItemChanged="./onSelectedItemChanged"> + <Template> + <Scroller Name="scroller1" Margin="5" ClipToClientRect="true" Background="Onyx"> + <Wrapper Name="ItemsContainer" Height="Fit" VerticalAlignment="Top"/> + </Scroller> + </Template> + <ItemTemplate> + <Border Width="16" Height="16" Background="{}" Foreground="Transparent" Tooltip="{}" + MouseEnter="{Foreground=Black}" + MouseLeave="{Foreground=Transparent}"/> + </ItemTemplate> + </ListBox> + </Template> + </ColorPicker> + </TabView> +</Popper> +</Template> +</ColorPicker>
\ No newline at end of file |