]> O.S.I.I.S - jp/crow.git/commitdiff
debug & templates
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 16 Jul 2025 17:59:45 +0000 (19:59 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 16 Jul 2025 17:59:45 +0000 (19:59 +0200)
16 files changed:
Crow/Default.style
Crow/Templates/CheckBox2.template
Crow/Templates/ColorSlider.template
Crow/Templates/DefaultTableHeaderCell.template
Crow/Templates/GroupBox.template
Crow/src/ExtensionsMethods.cs
Crow/src/IML/CompilerServices.cs
Crow/src/IML/Instantiator.cs
Crow/src/Widgets/Wrapper.cs
Drawing2D/Drawing2D.csproj
Samples/common/ui/Interfaces/Divers/color3.crow [deleted file]
Samples/common/ui/Interfaces/Divers/colorPicker.crow
Samples/common/ui/Interfaces/Divers/colorSlider3.crow
Samples/common/ui/Interfaces/Divers/colorSlider4.crow
Samples/common/ui/Interfaces/Divers/colorSlider5.crow [new file with mode: 0644]
Samples/common/ui/templates/ColorPicker2.template [new file with mode: 0644]

index 6b0a718fd35eeacae7075f6eaa0498838ee62a13..df1c75d111d5e7d6e4b2b4578865821a265d19b0 100644 (file)
@@ -342,9 +342,10 @@ labColorV {
        Width="50";
        TextAlignment="Right";
 }
+
 ColorSlider {
        Focusable="true";
-       Height="36";
+       Height="18";
        Margin="0";
        Maximum="255";
        Decimals="0";
index 4f692335a16184401b6e98bde6f2cc774322f97d..40ba91488d310b33293a0a984aeb54f11c9b56e9 100644 (file)
@@ -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}"
index 2d05e7d6ff608dfe02d7f492ab78c11811e36a18..4a9d6fc816227e28c4b8f8dbe020c8c674fafb44 100644 (file)
@@ -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
index 0bb5368b62078171577da4b16db6faaf2cdf9b3f..ccfbefd152dd2717a9bd7e7c93b0909e9583ecf4 100644 (file)
@@ -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
index 4931b87c99572b38ead4713b2ec25477caefdff4..840abc17418e221787443a457a5d325d73fd1cb0 100644 (file)
@@ -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>
index 99d4d4bb615d897181931648a17d91a855813a3d..444519d8f16e3d4d5333e90487564c02e20943b9 100644 (file)
@@ -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
 {
index 9ddc43be78c0485ae7a09cd0aee0e18ca9abc428..da5c1f866ee823cad82c8e4a6e923f3df0220a55 100644 (file)
@@ -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[] {});
index 8d3fe05935d5fdf40d9ef20633c9cd1631bfa4bf..be46d20a1de32462d477e6d5b9256e6fcd820ca0 100644 (file)
@@ -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
index 734227b70b8b5070f2973275de285fb7afc4406b..b4a7484cf46c7eaf0e5fb1db1fe66358a6e3245c 100644 (file)
@@ -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
 {
index 9af041b5ec62b0e11930cc6a83a2859d942ca7e5..14afcc2e048377e340352256f99a7403b9ff14a0 100644 (file)
@@ -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 (file)
index 1788004..0000000
+++ /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
index c1912be60a6ddf329a69de1930fee0acc7dbf651..e38957eb51c381105db1bbf500a34504b2ae98fa 100644 (file)
@@ -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}"/>
index 4236b9298f2baefba6961be8df5825fd2d803f53..a8e5257b85dd38e5fe4aa8aa750eeaef8a3cff49 100644 (file)
@@ -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
index 954636361f655abe8f5ae46f390d09d76c36eb4b..c24194ab77e6e5b3a48cd254a05b8e5798a17cd0 100644 (file)
@@ -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 (file)
index 0000000..4fe3799
--- /dev/null
@@ -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 (file)
index 0000000..91ec1d1
--- /dev/null
@@ -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