diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-08-20 20:23:23 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-08-20 20:23:23 +0200 |
| commit | 5ded9101522573336813c88d49e2ed27d70429fb (patch) | |
| tree | c1882937d54dab93be02a084b05dfb23cae517a1 | |
| parent | 36f62cf1ca61cb10c6958787376ae76efb71a1ea (diff) | |
keep only HelloWorld, ShowCase and PerfTests samplesv0.9.5-beta
79 files changed, 14 insertions, 5266 deletions
diff --git a/Crow.ControlsLib/AnalogMeter.cs b/Crow.ControlsLib/AnalogMeter.cs deleted file mode 100644 index ff23bd6b..00000000 --- a/Crow.ControlsLib/AnalogMeter.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// AnalogMeter.cs -// -// Author: -// Jean-Philippe Bruyère <jp.bruyere@hotmail.com> -// -// Copyright (c) 2013-2017 Jean-Philippe Bruyère -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Xml.Serialization; -using System.ComponentModel; -using Cairo; - -namespace Crow -{ - public class AnalogMeter : NumericControl - { - #region CTOR - protected AnalogMeter () : base(){} - public AnalogMeter (Interface iface) : base(iface){} - #endregion - - #region GraphicObject Overrides - protected override void onDraw (Context gr) - { - base.onDraw (gr); - - Rectangle r = ClientRectangle; - Point m = r.Center; - - gr.Save (); - - - double aUnit = Math.PI*2.0 / (Maximum - Minimum); - gr.Translate (m.X, r.Height *1.1); - gr.Rotate (Value/4.0 * aUnit - Math.PI/4.0); - gr.Translate (-m.X, -m.Y); - - gr.LineWidth = 2; - Foreground.SetAsSource (gr); - gr.MoveTo (m.X,0.0); - gr.LineTo (m.X, -m.Y*0.5); - gr.Stroke (); - - gr.Restore (); - } - #endregion - } -} - diff --git a/Crow.ControlsLib/Crow.ControlsLib.csproj b/Crow.ControlsLib/Crow.ControlsLib.csproj deleted file mode 100644 index 75fd3f14..00000000 --- a/Crow.ControlsLib/Crow.ControlsLib.csproj +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>8.0.30703</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{6E48BD3D-7B33-4368-AA8A-D878427DAC83}</ProjectGuid> - <OutputType>Library</OutputType> - <RootNamespace>Crow.ControlsLib</RootNamespace> - <AssemblyName>Crow.ControlsLib</AssemblyName> - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> - <ReleaseVersion>0.5</ReleaseVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug</OutputPath> - <DefineConstants>DEBUG;</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <ConsolePause>false</ConsolePause> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>full</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release</OutputPath> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <ConsolePause>false</ConsolePause> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> -<!-- <Reference Include="System.Data" /> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="System.Drawing" />--> - <Reference Include="System.Xml" /> - </ItemGroup> - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> - <ItemGroup> - <EmbeddedResource Include="Default.style" /> - <EmbeddedResource Include="Templates\AnalogMeter0.goml" /> - <EmbeddedResource Include="Templates\Checkbox2.goml" /> - <EmbeddedResource Include="Templates\DockingView.template"> - <LogicalName>Crow.DockingView.template</LogicalName> - </EmbeddedResource> - </ItemGroup> - <ItemGroup> - <Folder Include="Templates\" /> - </ItemGroup> - <ItemGroup> - <Compile Include="AnalogMeter.cs" /> - <Compile Include="DockingView.cs" /> - <Compile Include="DocksView.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\Crow.csproj"> - <Project>{C2980F9B-4798-4C05-99E2-E174810F7C7B}</Project> - <Name>Crow</Name> - </ProjectReference> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/Crow.ControlsLib/Default.style b/Crow.ControlsLib/Default.style deleted file mode 100644 index 07689b50..00000000 --- a/Crow.ControlsLib/Default.style +++ /dev/null @@ -1,139 +0,0 @@ -Button, CheckBox, RadioButton, ComboBox, Expandable, -MessageBox, Popper, Slider, Spinner, TextBox { - Focusable = true; - Height = Fit; -} -Border { - Foreground = Gray; -} -CheckBox { Caption = CheckBox; } -RadioButton { Caption = RadioButton; } -Expandable { Caption = Expandable; } -Popper { Caption = Popper; } -GroupBox { Caption = Group Box; } -Wrapper { - Orientation = Vertical; -} -Button { - Caption = Button; - Width = Fit; -} -Label { - Height = Fit; - Width = Fit; - Margin = 0; -} -Menu { - Margin = 1; - Background = vgradient|0:DimGray|1:Onyx; - Height = Fit; - Width = Stretched; - VerticalAlignment = Top; -} -MenuItem { - Caption = MenuItem; - Width = Stretched; - Height = Fit; - Background = Transparent; - Foreground = LightGray; - MouseEnter = {Background = vgradient|0:UnitedNationsBlue|1:Onyx;Foreground=White;} - MouseLeave = {Foreground=LightGray;Background=Transparent;} -} -MessageBox { - Background = 0.3,0.3,0.3,0.3; - Width = Fit; - Title=MessageBox; - Font = serif, 12; - MinimumSize = 200,120; -} -Slider { - Background = vgradient|0:Black|0.1:Gray|0.9:Gray|1:LightGray; - Foreground = Gray; - Width = Fit; -} -Splitter { - Focusable = true; - Background = DimGray; -} -Spinner { - Foreground = DimGray; -} -TabView { - CacheEnabled = false; -} -TabItem { - Caption = TabItem; - Focusable = true; - CacheEnabled = false; -} -TextBox { - Background = White; - Foreground = Black; - Selectable = True; - Text = TextBox; - Margin = 1; -} -Window { - Caption = Window; - Focusable = true; - MinimumSize=5,5; - Width = 150; - Height = 150; -} -ToolWindow { - Caption = Window; - Template = #Crow.ToolWindow.template; - Focusable = true; - MinimumSize=50,50; - Width = 150; - Height = 150; -} -DocksView { - AllowDrop = true; -} -DockingView { - Focusable = true; - AllowDrag = true; -} -FileDialog { - Template = #Crow.FileDialog.template; - Focusable = true; - MinimumSize=50,50; - Width = 500; - Height = 300; -} -ProgressBar { - Foreground = vgradient|0:BlueCrayola|0.5:SkyBlue|1:BlueCrayola; -} -ScrollBar { - Maximum = 0; - Value = 0; -} -Scroller { - CacheEnabled = false; -} -Icon { - Margin=1; - Width=12; - Height=12; -} -Control { - Margin=0; - Spacing=3; -} -SaturationValueSelector { - Foreground=Red; -} -HueSelector { - ClipToClientRect=False; -} -ColorSpinner { - Minimum = 0; - Maximum = 255; - SmallIncrement = 1; -} -HSVSpinner { - Minimum = 0; - Maximum = 1; - SmallIncrement = 0.01; -}
\ No newline at end of file diff --git a/Crow.ControlsLib/DockingView.cs b/Crow.ControlsLib/DockingView.cs deleted file mode 100644 index 8d76d457..00000000 --- a/Crow.ControlsLib/DockingView.cs +++ /dev/null @@ -1,166 +0,0 @@ -// -// DockingView.cs -// -// Author: -// Jean-Philippe Bruyère <jp.bruyere@hotmail.com> -// -// Copyright (c) 2013-2017 Jean-Philippe Bruyère -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -using System; - -namespace Crow -{ - public class DockingView : Window - { - #region CTOR - protected DockingView() : base () - { - } - #endregion - - bool isDocked = false; - Alignment docking = Alignment.Center; - - Point lastMousePos; //last known mouse pos in this control - Point undockingMousePosOrig; //mouse pos when docking was donne, use for undocking on mouse move - Rectangle savedSlot; //last undocked slot recalled when view is undocked - bool wasResizable; - - public DocksView docker; - - public override void OnLayoutChanges (LayoutingType layoutType) - { - base.OnLayoutChanges (layoutType); - - if (isDocked) - return; - - if (docker == null) - return; - - Rectangle dvCliRect = docker.ClientRectangle; - - if (layoutType == LayoutingType.X) { - if (Slot.X < docker.DockingThreshold) - dock (Alignment.Left); - else if (Slot.Right > dvCliRect.Width - docker.DockingThreshold) - dock (Alignment.Right); - }else if (layoutType == LayoutingType.Y) { - if (Slot.Y < docker.DockingThreshold) - dock (Alignment.Top); - else if (Slot.Bottom > dvCliRect.Height - docker.DockingThreshold) - dock (Alignment.Bottom); - } - } - - public override void onMouseMove (object sender, MouseMoveEventArgs e) - { - lastMousePos = e.Position; - - if (this.HasFocus && e.Mouse.IsButtonDown (MouseButton.Left) && isDocked) { - if (docking == Alignment.Left) { - if (lastMousePos.X - undockingMousePosOrig.X > docker.DockingThreshold) - undock (); - } else if (docking == Alignment.Right) { - if (undockingMousePosOrig.X - lastMousePos.X > docker.DockingThreshold) - undock (); - } else if (docking == Alignment.Top) { - if (lastMousePos.Y - undockingMousePosOrig.Y > docker.DockingThreshold) - undock (); - } else if (docking == Alignment.Bottom) { - if (undockingMousePosOrig.Y - lastMousePos.Y > docker.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) -// { -// base.onBorderMouseEnter (sender, e); -// -// if (isDocked) { -// switch (docking) { -// case Alignment.Top: -// if (this.currentDirection != Window.Direction.S) -// onBorderMouseLeave (this, null); -// break; -// case Alignment.Left: -// if (this.currentDirection != Window.Direction.E) -// onBorderMouseLeave (this, null); -// break; -// case Alignment.TopLeft: -// break; -// case Alignment.Right: -// if (this.currentDirection != Window.Direction.W) -// onBorderMouseLeave (this, null); -// break; -// case Alignment.TopRight: -// break; -// case Alignment.Bottom: -// if (this.currentDirection != Window.Direction.N) -// onBorderMouseLeave (this, null); -// break; -// case Alignment.BottomLeft: -// break; -// case Alignment.BottomRight: -// break; -// case Alignment.Center: -// break; -// default: -// break; -// } -// } -// } - - void undock () { - docker.Undock(this); - - this.Left = savedSlot.Left; - this.Top = savedSlot.Top; - this.Width = savedSlot.Width; - this.Height = savedSlot.Height; - - isDocked = false; - Resizable = wasResizable; - } - void dock (Alignment align){ - this.Left = this.Top = 0; - isDocked = true; - docking = align; - undockingMousePosOrig = lastMousePos; - savedSlot = this.LastPaintedSlot; - wasResizable = Resizable; - Resizable = false; - - docker.Dock (this, align); - } - } -} - diff --git a/Crow.ControlsLib/DocksView.cs b/Crow.ControlsLib/DocksView.cs deleted file mode 100644 index a93bdc78..00000000 --- a/Crow.ControlsLib/DocksView.cs +++ /dev/null @@ -1,91 +0,0 @@ -// -// DocksView.cs -// -// Author: -// Jean-Philippe Bruyère <jp.bruyere@hotmail.com> -// -// Copyright (c) 2013-2017 Jean-Philippe Bruyère -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -using System; -using System.Xml.Serialization; -using System.ComponentModel; -using System.Collections.Generic; - -namespace Crow -{ - public class DocksView : Group - { - List<DockingView> childViews = new List<DockingView>(); - GenericStack rootStack = null; - - public override void AddChild (GraphicObject g) - { - DockingView dv = g as DockingView; - if (g == null) - throw new Exception ("DocksView accept only DockingView as child"); - base.AddChild (g); - childViews.Add (dv); - dv.docker = this; - } - public override void RemoveChild (GraphicObject child) - { - DockingView dv = child as DockingView; - if (child == null) - throw new Exception ("DocksView accept only DockingView as child"); - base.RemoveChild (child); - childViews.Remove (dv); - dv.docker = this; - } - public void Dock (DockingView dv, Alignment pos){ - switch (pos) { - case Alignment.Top: - if (rootStack?.Orientation != Orientation.Vertical) - this.Width = Measure.Stretched; - break; - case Alignment.Bottom: - this.Width = Measure.Stretched; - break; - case Alignment.Left: - this.Height = Measure.Stretched; - break; - case Alignment.Right: - this.Height = Measure.Stretched; - break; - } - } - public void Undock (DockingView dv){ - } - - int dockingThreshold; - - [XmlAttributeAttribute][DefaultValue(10)] - public virtual int DockingThreshold { - get { return dockingThreshold; } - set { - if (dockingThreshold == value) - return; - dockingThreshold = value; - NotifyValueChanged ("DockingThreshold", dockingThreshold); - - } - } - } -} - diff --git a/Crow.ControlsLib/Templates/AnalogMeter0.goml b/Crow.ControlsLib/Templates/AnalogMeter0.goml deleted file mode 100644 index 8187aac4..00000000 --- a/Crow.ControlsLib/Templates/AnalogMeter0.goml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0"?> -<Group Margin="0" Width="-1" Height="-1" Focusable="false"> - <Image Name="Image" Path="#go.Images.meter.svg" SvgSub="background"/> -<!-- <Image Name="Image" Path="#go.Images.meter.svg" SvgSub="gauge"/>--> -</Group>
\ No newline at end of file diff --git a/Crow.ControlsLib/Templates/Checkbox2.goml b/Crow.ControlsLib/Templates/Checkbox2.goml deleted file mode 100644 index 0a67fce7..00000000 --- a/Crow.ControlsLib/Templates/Checkbox2.goml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0"?> -<HorizontalStack Margin="0" Spacing="1" Focusable="false"> - <Image Name="Image" Width="16" Height="16" Path="#go.Images.Icons.checkbox.svg"/> - <Label Name="Caption" Background="Red"/> -</HorizontalStack>
\ No newline at end of file diff --git a/Crow.ControlsLib/Templates/DockingView.template b/Crow.ControlsLib/Templates/DockingView.template deleted file mode 100644 index 0a3b4e01..00000000 --- a/Crow.ControlsLib/Templates/DockingView.template +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0"?> -<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}" - Background="{./Background}" - MouseEnter="./onBorderMouseEnter" - MouseLeave="./onBorderMouseLeave"> - <VerticalStack Spacing="0"> -<!-- <Border Name="TitleBar" BorderWidth="1" Foreground="White" Width="{./WidthPolicy}" Height="Fit" - Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9">--> - <HorizontalStack Background="vgradient|0:0.5,0.6,0.5,0.5|1:0.2,0.3,0.3,0.7" - Name="hs" Margin="2" Spacing="0" Height="Fit"> - <GraphicObject Width="5"/> - <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/> - <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Caption}" /> - <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="12" Width="12" - MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}"> - <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg" - MouseClick="./butQuitPress"/> - </Border> - <GraphicObject Width="5"/> - </HorizontalStack> -<!-- </Border>--> - <Container Name="Content" MinimumSize="50,50" Background="0.5,0.5,0.5,0.5"/> - </VerticalStack> -</Border> diff --git a/Crow.ControlsLib/Templates/ListBox.template b/Crow.ControlsLib/Templates/ListBox.template deleted file mode 100644 index f6d6214d..00000000 --- a/Crow.ControlsLib/Templates/ListBox.template +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0"?> -<Border BorderWidth="1" Margin="1" MinimumSize="10,10"> - <Scroller Name="scroller1" Margin="1" VerticalScrolling="true"> - <VerticalStack - Height="Fit" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/> - </Scroller> -</Border> diff --git a/Crow.ControlsLib/Templates/Menu.template b/Crow.ControlsLib/Templates/Menu.template deleted file mode 100644 index c560043c..00000000 --- a/Crow.ControlsLib/Templates/Menu.template +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<HorizontalStack Name="ItemsContainer" Margin="0" Background="{./Background}"/> diff --git a/Crow.ControlsLib/Templates/MenuItem.template b/Crow.ControlsLib/Templates/MenuItem.template deleted file mode 100644 index 0f93b20c..00000000 --- a/Crow.ControlsLib/Templates/MenuItem.template +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0"?> -<Popper Font="{./Font}" Caption="{./Caption}" Background="{./Background}" PopDirection="{./PopDirection}" - Foreground = "{./Foreground}" CanPop="{./HasChildren}" MouseClick="./onMI_Click" - IsPopped="{²./IsOpened}" PopWidth="{./PopWidth}" PopHeight="{./PopHeight}"> - <Template> - <Border Name="border1" - MouseEnter="{Foreground=vgradient|0:White|0.2:Gray|0.9:Gray|1:Black}" - MouseLeave="{Foreground=Transparent}" - MouseDown="{Foreground=vgradient|0:Black|0.05:Gray|0.85:Gray|1:White}" - MouseUp="{Foreground=vgradient|0:White|0.2:Gray|0.9:Gray|1:Black}" - MinimumSize = "60,0" - Foreground="Transparent" - Background="{./Background}"> - <Label Text="{./Caption}" - Foreground="{./Foreground}" - Margin="1" HorizontalAlignment="Left" - Font="{./Font}" /> - </Border> - </Template> - <Border Foreground="DimGray" Width="{../PopWidth}" Height="{../PopHeight}" Background="Onyx"> - <VerticalStack Name="ItemsContainer"/> - </Border> -</Popper> diff --git a/Crow.ControlsLib/Templates/MessageBox.template b/Crow.ControlsLib/Templates/MessageBox.template deleted file mode 100644 index c33eb869..00000000 --- a/Crow.ControlsLib/Templates/MessageBox.template +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<Border CornerRadius="0" - MouseEnter="./onBorderMouseEnter" - MouseLeave="./onBorderMouseLeave"> - <VerticalStack Background="{./Background}"> - <Border BorderWidth="0" Foreground="White" Height="Fit" Width="Stretched" MinimumSize="200,0" - Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9"> - <HorizontalStack Name="hs" Margin="2" Spacing="1" Height="Fit" > - <GraphicObject Width="5" Height="5"/> - <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/> - <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Caption}" /> - <Border CornerRadius="3" BorderWidth="1" Foreground="Transparent" Height="12" Width="12" - MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}"> - <Image Focusable="true" Name="Image" Path="#Crow.Images.Icons.exit2.svg" - MouseClick="./butQuitPress"/> - </Border> - <GraphicObject Width="5" Height="5"/> - </HorizontalStack> - </Border> - <HorizontalStack Margin="5"> - <Image Name="Image" Width="20%" Height="30" Path="{./MsgIcon}" /> - <Label Margin="5" Font="{./Font}" Width="Fit" Text="{./Message}" - TextAlignment="Left" - Multiline="true" /> - </HorizontalStack> - <HorizontalStack Margin="1" Spacing="0" Height="Fit" Width="60%" HorizontalAlignment="Right"> - <Button Width="50%" Caption="{./OkMessage}" MouseClick="./onOkButtonClick" /> - <Button Width="50%" Caption="{./CancelMessage}" MouseClick="./onCancelButtonClick" /> - </HorizontalStack> - </VerticalStack> -</Border> diff --git a/Crow.ControlsLib/Templates/Popper.template b/Crow.ControlsLib/Templates/Popper.template deleted file mode 100644 index 0bc7c741..00000000 --- a/Crow.ControlsLib/Templates/Popper.template +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0"?> -<Border Background="{./Background}" BorderWidth="1" Foreground="{./Foreground}" Height="Fit"> - <HorizontalStack Spacing="1" Height="Fit"> - <Image Style="Icon" Margin="1" Width="9" Height="9" - Path="#Crow.Images.Icons.expandable.svg" SvgSub="{./IsPopped}"/> - <Label Text="{./Caption}" /> - </HorizontalStack> -</Border>
\ No newline at end of file diff --git a/Crow.ControlsLib/Templates/RadioButton.template b/Crow.ControlsLib/Templates/RadioButton.template deleted file mode 100644 index b96eec2c..00000000 --- a/Crow.ControlsLib/Templates/RadioButton.template +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<HorizontalStack Style="Control" Background="{./Background}"> - <Image Style="Icon" Path="#Crow.Images.Icons.radiobutton.svg" - SvgSub="{./IsChecked}"/> - <Label Text="{./Caption}"/> -</HorizontalStack>
\ No newline at end of file diff --git a/Crow.ControlsLib/Templates/ScrollBar.template b/Crow.ControlsLib/Templates/ScrollBar.template deleted file mode 100644 index 70dce93e..00000000 --- a/Crow.ControlsLib/Templates/ScrollBar.template +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0"?> -<Border BorderWidth="1" Foreground="LightGray"> - <GenericStack Orientation="{./Orientation}" Spacing="0"> - <Button MouseRepeat="true" Width="12" Height="12" MouseClick="./onScrollBack" - Template="#Crow.Templates.ArrowButTemplate.crow"> - <Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="up"/> - </Button> - <Slider Name="Slider" - Orientation="{./Orientation}" - Value="{²./Value}" - Maximum="{./Maximum}" - Height="{./HeightPolicy}" Width="{./WidthPolicy}" - LargeIncrement="{./LargeIncrement}" - SmallIncrement="{./SmallIncrement}" - Background="hgradient|0:DimGray|0.1:Gray|0.95:Gray|1:White"/> - <Button MouseRepeat="true" Width="12" Height="12" MouseClick="./onScrollForth" - Template="#Crow.Templates.ArrowButTemplate.crow"> - <Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/> - </Button> - </GenericStack> -</Border>
\ No newline at end of file diff --git a/Crow.ControlsLib/Templates/ScrollingListBox.goml b/Crow.ControlsLib/Templates/ScrollingListBox.goml deleted file mode 100644 index f294aea6..00000000 --- a/Crow.ControlsLib/Templates/ScrollingListBox.goml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0"?> -<Border BorderWidth="1" Background="{./Background}"> - <HorizontalStack Margin="1"> - <Scroller Name="scroller1" - Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"> - <VerticalStack Height="Fit" MinimumSize="10,10" - Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/> - </Scroller> - <ScrollBar Name="scrollbar1" Value="{²../scroller1.ScrollY}" - Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical" - Width="14" /> - </HorizontalStack> -</Border> diff --git a/Crow.ControlsLib/Templates/Slider.template b/Crow.ControlsLib/Templates/Slider.template deleted file mode 100644 index 9c7bb705..00000000 --- a/Crow.ControlsLib/Templates/Slider.template +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0"?> diff --git a/Crow.ControlsLib/Templates/Spinner (copier).goml b/Crow.ControlsLib/Templates/Spinner (copier).goml deleted file mode 100644 index fcb849c3..00000000 --- a/Crow.ControlsLib/Templates/Spinner (copier).goml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<Border CornerRadius="5" Margin="1" BorderWidth="1" Fit="True" Background="SteelBlue"> - <HorizontalStack Name="hstack" Margin="0" Spacing="5"> - <Label Name="labCpt" Text="55"/> - <VerticalStack Spacing="1" Name="vstack"> - <Button Width="10" Height="8" MouseClick="onUp"> - <Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="up"/> - </Button> - <Button Width="10" Height="8" MouseClick="onDown"> - <Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="down"/> - </Button> - </VerticalStack> - </HorizontalStack> -</Border>
\ No newline at end of file diff --git a/Crow.ControlsLib/Templates/Spinner.template b/Crow.ControlsLib/Templates/Spinner.template deleted file mode 100644 index 4d3569bf..00000000 --- a/Crow.ControlsLib/Templates/Spinner.template +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0"?> -<HorizontalStack MinimumSize="40,10" Name="hstack" Margin="0" Spacing="0"> - <Border BorderWidth="1" Width="80%" Background="White" - Foreground="{./Foreground}" Margin="0"> - <TextBox Foreground="{./Foreground}" Font="{./Font}" Width="Stretched" - Text="{²./Value}" TextAlignment="Right" Margin="0"/> - </Border> - <VerticalStack MinimumSize="8,10" Width="20%" Height="Stretched" Spacing="0" Margin="0" Background="Red"> - <Button MouseRepeat="true" Width="Stretched" Height="50%" Margin="0" MouseClick="./onUp" - Template="#Crow.Templates.ArrowButTemplate.crow"> - <Image Path="#Crow.Images.Icons.updown.svg" SvgSub="up" Margin="0"/> - </Button> - <Button MouseRepeat="true" Width="Stretched" Height="50%" Margin="0" MouseClick="./onDown" - Template="#Crow.Templates.ArrowButTemplate.crow"> - <Image Path="#Crow.Images.Icons.updown.svg" SvgSub="down" Margin="0"/> - </Button> - </VerticalStack> -</HorizontalStack> diff --git a/Crow.ControlsLib/Templates/TabItem.template b/Crow.ControlsLib/Templates/TabItem.template deleted file mode 100644 index f82b79c9..00000000 --- a/Crow.ControlsLib/Templates/TabItem.template +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<GenericStack Orientation="Vertical" Spacing="0" - Background="Onyx" - MouseEnter="{caption.Foreground=White}" - MouseLeave="{caption.Foreground=Gray}"> - <HorizontalStack Margin="2" Left="{./TabOffset}" - Name="TabTitle" - HorizontalAlignment="Left" - Height="{./TabThickness}" - Width="Fit"> - <Label Name="caption" Text="{./Caption}" Foreground="Gray"/> - <Border CornerRadius="5" BorderWidth="1" Foreground="Transparent" Height="12" Width="12" - MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}"> - <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg" - MouseClick="./butCloseTabClick"/> - </Border> - </HorizontalStack> - <Container Name="Content"/> -</GenericStack> - diff --git a/Crow.ControlsLib/Templates/ToolWindow.template b/Crow.ControlsLib/Templates/ToolWindow.template deleted file mode 100644 index f021f6ee..00000000 --- a/Crow.ControlsLib/Templates/ToolWindow.template +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0"?> -<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}" - Background="{./Background}" - MouseEnter="./onBorderMouseEnter" - MouseLeave="./onBorderMouseLeave"> - <VerticalStack Spacing="0"> -<!-- <Border Name="TitleBar" BorderWidth="1" Foreground="White" Width="{./WidthPolicy}" Height="Fit" - Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9">--> - <HorizontalStack Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9" - Name="hs" Margin="2" Spacing="0" Height="Fit"> - <GraphicObject Width="5"/> - <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/> - <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Caption}" /> - <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="12" Width="12" - MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}"> - <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg" - MouseClick="./butQuitPress"/> - </Border> - <GraphicObject Width="5"/> - </HorizontalStack> -<!-- </Border>--> - <Container Name="Content" MinimumSize="50,50" Background="0.5,0.5,0.5,0.5"/> - </VerticalStack> -</Border> diff --git a/Crow.ControlsLib/Templates/TreeView.template b/Crow.ControlsLib/Templates/TreeView.template deleted file mode 100644 index c29e34c5..00000000 --- a/Crow.ControlsLib/Templates/TreeView.template +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<HorizontalStack> - <Scroller Name="scroller1" Margin="1" VerticalScrolling="true" - Background="{./Background}" - ScrollY="{../scrollbar1.Value}"> - <VerticalStack - Height="Fit" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/> - </Scroller> - <ScrollBar - Name="scrollbar1" - Value="{../scroller1.ScrollY}" - Maximum="{../scroller1.MaximumScroll}" - Width="14" Orientation="Vertical"/> -</HorizontalStack> diff --git a/Crow.ControlsLib/Templates/Window.template b/Crow.ControlsLib/Templates/Window.template deleted file mode 100644 index 20b23147..00000000 --- a/Crow.ControlsLib/Templates/Window.template +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0"?> -<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}" - Background="{./Background}" - MouseEnter="./onBorderMouseEnter" - MouseLeave="./onBorderMouseLeave"> - <VerticalStack Spacing="0"> -<!-- <Border Name="TitleBar" BorderWidth="1" Foreground="White" Width="{./WidthPolicy}" Height="Fit" - Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9">--> - <HorizontalStack Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9" - Name="hs" Margin="2" Spacing="0" Height="Fit"> - <GraphicObject Width="5"/> - <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/> - <Label Width="Stretched" Foreground="White" Margin="2" TextAlignment="Center" Text="{./Caption}" /> - <Border Visible="{./ShowMinimize}" BorderWidth="1" Foreground="Transparent" Height="12" Width="12" - MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}"> - <Image Focusable="true" Path="#Crow.Images.Icons.minimize.svg" - MouseClick="./onMinimized"/> - </Border> - <Border Visible="{./ShowNormal}" BorderWidth="1" Foreground="Transparent" Height="12" Width="12" - MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}"> - <Image Focusable="true" Path="#Crow.Images.Icons.normalize.svg" - MouseClick="./onUnmaximized"/> - </Border> - <Border Visible="{./ShowMaximize}" BorderWidth="1" Foreground="Transparent" Height="12" Width="12" - MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}"> - <Image Focusable="true" Path="#Crow.Images.Icons.maximize.svg" - MouseClick="./onMaximized"/> - </Border> - <Border BorderWidth="1" Foreground="Transparent" Height="14" Width="14" - MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}"> - <Image Focusable="true" Path="#Crow.Images.Icons.exit2.svg" - MouseClick="./butQuitPress"/> - </Border> - <GraphicObject Width="5"/> - </HorizontalStack> -<!-- </Border>--> - <Container Name="Content" MinimumSize="0,0" Background="0.5,0.5,0.5,0.5"/> - </VerticalStack> -</Border> diff --git a/Crow.ControlsLib/Templates/imgItemTemplate.goml b/Crow.ControlsLib/Templates/imgItemTemplate.goml deleted file mode 100644 index c08f390e..00000000 --- a/Crow.ControlsLib/Templates/imgItemTemplate.goml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0"?> - <VerticalStack Width="0" Height="-1" Focusable="true" - MouseEnter="{Background=BlueCrayola}" - MouseLeave="{Background=Transparent}"> - <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/Crow.ControlsLib/Templates/tmpDirItem.goml b/Crow.ControlsLib/Templates/tmpDirItem.goml deleted file mode 100644 index 01aef1e6..00000000 --- a/Crow.ControlsLib/Templates/tmpDirItem.goml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> - <HorizontalStack Width="-1" Height="-1" Focusable="true" - HorizontalAlignment="Left" - MouseEnter="{Background=BlueCrayola}" - MouseLeave="{Background=Transparent}"> - <Image Width="16" Height="16" Path="#Tests.image.folder1.svg" SvgSub="{Attributes}"/> - <Label Text="{Name}" Width="-1" Height="-1" Margin="0"/> -<!-- <Label Text="{Attributes}" Width="-1" Height="-1" Margin="0"/> - <Label Text="{Extension}" Width="-1" Height="-1" Margin="0"/>--> - </HorizontalStack> - diff --git a/Crow.ControlsLib/Templates/treeList.crow b/Crow.ControlsLib/Templates/treeList.crow deleted file mode 100644 index d47621af..00000000 --- a/Crow.ControlsLib/Templates/treeList.crow +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0"?> -<VerticalStack - Height="Fit" Name="ItemsContainer"/> @@ -19,34 +19,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloWorld", "Samples\Hello EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShowCase", "Samples\ShowCase\ShowCase.csproj", "{56329D48-D382-4850-93DE-59C453894E8A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "unitTests", "unitTests\unitTests.csproj", "{0CC6DFAB-2E4A-4786-976C-89053D5EA6A2}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicTests", "Samples\BasicTests\BasicTests.csproj", "{7AEB6DD5-916E-4415-84E1-78EC6E5881CE}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerfTests", "Samples\PerfTests\PerfTests.csproj", "{18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DebugLogAnalyzer", "Samples\DebugLogAnalyzer\DebugLogAnalyzer.csproj", "{7915538F-B2B1-414C-95A3-1FC58E3286B9}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dragNdrop", "Samples\dragNdrop\dragNdrop.csproj", "{6E361E34-D266-4BEB-97F4-E209E01C6246}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dockableWindows", "Samples\dockableWindows\dockableWindows.csproj", "{E19FD3DB-902A-4C99-8BF0-5ACAFFE35608}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BindingTest", "Samples\BindingTest\BindingTest.csproj", "{242094B3-A1F1-44F8-B78D-D819B595DDBA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PathPainter", "Samples\PathPainter\PathPainter.csproj", "{4066FE1E-3508-4361-ABAA-21601F632ED8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrowDebugger", "Samples\CrowDebugger\CrowDebugger.csproj", "{F86711E7-CACE-4050-82BF-0229CCEFDBA3}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.Build.0 = Release|Any CPU {F535A8AB-CD93-49AB-B1B0-FFF9AE51ED6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F535A8AB-CD93-49AB-B1B0-FFF9AE51ED6A}.Debug|Any CPU.Build.0 = Debug|Any CPU {F535A8AB-CD93-49AB-B1B0-FFF9AE51ED6A}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -55,42 +35,10 @@ Global {56329D48-D382-4850-93DE-59C453894E8A}.Debug|Any CPU.Build.0 = Debug|Any CPU {56329D48-D382-4850-93DE-59C453894E8A}.Release|Any CPU.ActiveCfg = Release|Any CPU {56329D48-D382-4850-93DE-59C453894E8A}.Release|Any CPU.Build.0 = Release|Any CPU - {0CC6DFAB-2E4A-4786-976C-89053D5EA6A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0CC6DFAB-2E4A-4786-976C-89053D5EA6A2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0CC6DFAB-2E4A-4786-976C-89053D5EA6A2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0CC6DFAB-2E4A-4786-976C-89053D5EA6A2}.Release|Any CPU.Build.0 = Release|Any CPU - {7AEB6DD5-916E-4415-84E1-78EC6E5881CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7AEB6DD5-916E-4415-84E1-78EC6E5881CE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7AEB6DD5-916E-4415-84E1-78EC6E5881CE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7AEB6DD5-916E-4415-84E1-78EC6E5881CE}.Release|Any CPU.Build.0 = Release|Any CPU {18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Debug|Any CPU.Build.0 = Debug|Any CPU {18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Release|Any CPU.ActiveCfg = Release|Any CPU {18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Release|Any CPU.Build.0 = Release|Any CPU - {7915538F-B2B1-414C-95A3-1FC58E3286B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7915538F-B2B1-414C-95A3-1FC58E3286B9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7915538F-B2B1-414C-95A3-1FC58E3286B9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7915538F-B2B1-414C-95A3-1FC58E3286B9}.Release|Any CPU.Build.0 = Release|Any CPU - {6E361E34-D266-4BEB-97F4-E209E01C6246}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6E361E34-D266-4BEB-97F4-E209E01C6246}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6E361E34-D266-4BEB-97F4-E209E01C6246}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6E361E34-D266-4BEB-97F4-E209E01C6246}.Release|Any CPU.Build.0 = Release|Any CPU - {E19FD3DB-902A-4C99-8BF0-5ACAFFE35608}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E19FD3DB-902A-4C99-8BF0-5ACAFFE35608}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E19FD3DB-902A-4C99-8BF0-5ACAFFE35608}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E19FD3DB-902A-4C99-8BF0-5ACAFFE35608}.Release|Any CPU.Build.0 = Release|Any CPU - {242094B3-A1F1-44F8-B78D-D819B595DDBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {242094B3-A1F1-44F8-B78D-D819B595DDBA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {242094B3-A1F1-44F8-B78D-D819B595DDBA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {242094B3-A1F1-44F8-B78D-D819B595DDBA}.Release|Any CPU.Build.0 = Release|Any CPU - {4066FE1E-3508-4361-ABAA-21601F632ED8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4066FE1E-3508-4361-ABAA-21601F632ED8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4066FE1E-3508-4361-ABAA-21601F632ED8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4066FE1E-3508-4361-ABAA-21601F632ED8}.Release|Any CPU.Build.0 = Release|Any CPU - {F86711E7-CACE-4050-82BF-0229CCEFDBA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F86711E7-CACE-4050-82BF-0229CCEFDBA3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F86711E7-CACE-4050-82BF-0229CCEFDBA3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F86711E7-CACE-4050-82BF-0229CCEFDBA3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -98,14 +46,7 @@ Global GlobalSection(NestedProjects) = preSolution {F535A8AB-CD93-49AB-B1B0-FFF9AE51ED6A} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6} {56329D48-D382-4850-93DE-59C453894E8A} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6} - {7AEB6DD5-916E-4415-84E1-78EC6E5881CE} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6} {18EBB41F-815E-4BF5-B80F-C9E2FAB2993A} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6} - {7915538F-B2B1-414C-95A3-1FC58E3286B9} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6} - {6E361E34-D266-4BEB-97F4-E209E01C6246} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6} - {E19FD3DB-902A-4C99-8BF0-5ACAFFE35608} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6} - {242094B3-A1F1-44F8-B78D-D819B595DDBA} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6} - {4066FE1E-3508-4361-ABAA-21601F632ED8} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6} - {F86711E7-CACE-4050-82BF-0229CCEFDBA3} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {00D4E149-7131-49F4-BAAD-559AA961A78E} diff --git a/Samples/BindingTest/BindingTest.csproj b/Samples/BindingTest/BindingTest.csproj deleted file mode 100644 index ed05c677..00000000 --- a/Samples/BindingTest/BindingTest.csproj +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project Sdk="Microsoft.NET.Sdk"> - <ItemGroup> - <EmbeddedResource Include="ui\*.*"> - <LogicalName>ui.%(Filename)%(Extension)</LogicalName> - </EmbeddedResource> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/Samples/BindingTest/Program.cs b/Samples/BindingTest/Program.cs deleted file mode 100644 index 019e3ce6..00000000 --- a/Samples/BindingTest/Program.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com> -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) -using System; -using System.Runtime.CompilerServices; -using Crow; -using Samples; - -namespace BindingTest -{ - class Program : SampleBase - { - - static void Main () - { - using (Program app = new Program ()) { - app.Run (); - //DbgLogger.save (app); - } - } - - protected override void OnInitialized () - { - Load ("#ui.test.crow").DataSource = this; - TcVCInstance = new TestClassVC (); - } - - - void setDataSourceNull (object sender, MouseButtonEventArgs e) - { - TcVCInstance = null; - Console.WriteLine ("set data source null"); - } - void setDataSourceThis (object sender, MouseButtonEventArgs e) - { - TcVCInstance = new TestClassVC () { Prop1 = "instance 1 prop1 value", Prop2 = "instance 1 prop2 value" }; - Console.WriteLine ("set data source not null"); - } - - } -} diff --git a/Samples/BindingTest/ui/test.crow b/Samples/BindingTest/ui/test.crow deleted file mode 100644 index 305f6594..00000000 --- a/Samples/BindingTest/ui/test.crow +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0"?> -<VerticalStack Margin="5" Height="Fit" > - <VerticalStack RootDataLevel="true" Name="vsDS" Margin="5" Background="Onyx" DataSource="{TcVCInstance}" DataSourceType="SampleBase.TestClassVC"> - <Label Text="{}"/> - <Label Text="{Prop1}"/> - <Label Text="{Prop2}"/> - </VerticalStack> - <VerticalStack Name="vsDS" Margin="5" Background="Onyx" DataSource="{TcVCInstance}" DataSourceType="SampleBase.TestClassVC"> - <Label Text="{}"/> - <Label Text="{Prop1}"/> - <Label Text="{Prop2}"/> - </VerticalStack> - <HorizontalStack Margin="5" Background="DimGrey"> - <Button Background="Jet" Caption="Set DataSource Null" MouseClick="setDataSourceNull"/> - <Button Background="Jet" Caption="Set DataSource This" MouseClick="setDataSourceThis"/> - </HorizontalStack> -</VerticalStack> diff --git a/Samples/CrowDebugger/CrowDebugAssemblyLoadContext.cs b/Samples/CrowDebugger/CrowDebugAssemblyLoadContext.cs deleted file mode 100644 index 0c629fc7..00000000 --- a/Samples/CrowDebugger/CrowDebugAssemblyLoadContext.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Threading; -using System; -using System.Runtime.Loader; -using System.Reflection; - -namespace CrowDebugger -{ - public class CrowDebugAssemblyLoadContext : AssemblyLoadContext - { - protected override Assembly Load(AssemblyName assemblyName) - { - return base.Load(assemblyName); - } - } -}
\ No newline at end of file diff --git a/Samples/CrowDebugger/CrowDebugger.csproj b/Samples/CrowDebugger/CrowDebugger.csproj deleted file mode 100644 index c73e0d16..00000000 --- a/Samples/CrowDebugger/CrowDebugger.csproj +++ /dev/null @@ -1,8 +0,0 @@ -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <OutputType>Exe</OutputType> - <TargetFramework>netcoreapp3.1</TargetFramework> - </PropertyGroup> - -</Project> diff --git a/Samples/CrowDebugger/Program.cs b/Samples/CrowDebugger/Program.cs deleted file mode 100644 index b15e3b17..00000000 --- a/Samples/CrowDebugger/Program.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Threading; -using System; -using System.IO; -using System.Reflection; -using System.Runtime.Loader; - -namespace CrowDebugger -{ - class Program - { - const int BUFF_MAX = 1024; - static void Main(string[] args) - { - AssemblyLoadContext crowLoadCtx = new AssemblyLoadContext("CrowDebuggerLoadContext"); - Console.WriteLine("Crow Debugger started."); - char[] buffer = new char[1024]; - int buffPtr = 0; - while (true) - { - if (Console.KeyAvailable) - { - ConsoleKeyInfo key = Console.ReadKey(true); - if (key.Key == ConsoleKey.Enter) { - Span<char> cmd = buffer.AsSpan(0, buffPtr); - Console.WriteLine($"=> {cmd.ToString()}"); - if (cmd[0] == 'q' || cmd.SequenceEqual ("quit")) - break; - - if (cmd.StartsWith("load")) { - using(crowLoadCtx.EnterContextualReflection()) { - string str = cmd.Slice(5).ToString(); - Console.WriteLine($"[msg]:Trying to load crow dll from: '{str}'"); - if (!File.Exists (str)) { - Console.WriteLine ($"[error]:File not found: {str}"); - } else { - Assembly crowAssembly = crowLoadCtx.LoadFromAssemblyPath (str); - if (crowAssembly == null) { - Console.WriteLine($"[error]:Failed to load crow dll from: {str}"); - } else { - Console.WriteLine($"[ok]:Crow Assembly loaded:{crowAssembly.FullName}"); - - } - } - } - } else - Console.WriteLine($"=> {cmd.ToString()}"); - buffPtr = 0; - continue; - } - - buffer[buffPtr++] = key.KeyChar; - } - } - - Console.WriteLine("exited"); - } - } -} diff --git a/Samples/DebugLogAnalyzer/DebugLogAnalyzer.csproj b/Samples/DebugLogAnalyzer/DebugLogAnalyzer.csproj deleted file mode 100644 index 8259275b..00000000 --- a/Samples/DebugLogAnalyzer/DebugLogAnalyzer.csproj +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> - <EnableDefaultCompileItems>false</EnableDefaultCompileItems> - </PropertyGroup> - <ItemGroup> - <Compile Include="src\**\*.cs"/> - </ItemGroup> - <ItemGroup> - <EmbeddedResource Include="ui\**\*.*"> - <LogicalName>Dbg.%(Filename)%(Extension)</LogicalName> - </EmbeddedResource> - </ItemGroup> - -</Project>
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/Properties/AssemblyInfo.cs b/Samples/DebugLogAnalyzer/Properties/AssemblyInfo.cs deleted file mode 100644 index d8646524..00000000 --- a/Samples/DebugLogAnalyzer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com> -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) -[assembly: Crow.Crow ] - diff --git a/Samples/DebugLogAnalyzer/src/DbgEventWidget.cs b/Samples/DebugLogAnalyzer/src/DbgEventWidget.cs deleted file mode 100644 index 3e11aa3f..00000000 --- a/Samples/DebugLogAnalyzer/src/DbgEventWidget.cs +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com> -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) -using System; -using System.Collections.Generic; -using System.ComponentModel; -using Crow.Drawing; -using Crow.DebugLogger; -using DebugLogAnalyzer; - -namespace Crow -{ - public class DbgEventView : TemplatedContainer { - DbgEvent evt; - public DbgEvent Event { - get => evt; - set { - if (evt == value) - return; - evt = value; - NotifyValueChangedAuto (evt); - } - } - } - public class DbgEventWidget : Widget - { - public DbgEventWidget (){} - - DbgEvent evt, hoverEvt; - long ticksPerPixel; - double pixelPerTick; - - object dataMutex = new object(); - - public DbgEvent Event { - get => evt; - set { - if (evt == value) - return; - lock (dataMutex) - evt = value; - updatePixelPerTicks (); - NotifyValueChangedAuto (evt); - RegisterForRedraw (); - } - } - public DbgEvent HoverEvent { - get => hoverEvt; - private set { - if (hoverEvt == value) - return; - lock (dataMutex) - evt = value; - hoverEvt = value; - NotifyValueChangedAuto (hoverEvt); - } - } - - [DefaultValue ("1000")] - public long TicksPerPixel { - get => ticksPerPixel; - set { - if (ticksPerPixel == value) - return; - ticksPerPixel = value; - NotifyValueChangedAuto (ticksPerPixel); - if (Width == Measure.Fit) - RegisterForLayouting (LayoutingType.Width); - } - } - - public override int measureRawSize (LayoutingType lt) - { - updatePixelPerTicks (); - if (lt == LayoutingType.Width) - contentSize.Width = Event == null ? 0 : (int)Math.Max(pixelPerTick * Event.Duration, 2); - - return base.measureRawSize (lt); - } - - public override void OnLayoutChanges (LayoutingType layoutType) - { - if (layoutType == LayoutingType.Width) - updatePixelPerTicks (); - - base.OnLayoutChanges (layoutType); - } - - protected override void onDraw (Context gr) - { - lock (dataMutex) { - - if (Event == null) { - base.onDraw (gr); - return; - } - - gr.LineWidth = 1; - gr.SetDash (new double [] { 1.0, 3.0 }, 0); - - Rectangle cb = ClientRectangle; - - if (Event.Duration == 0) { - gr.SetSource (Event.Color); - gr.Rectangle (cb); - gr.Fill (); - return; - } - - drawEvent (gr, cb.Height, Event); - } - } - void drawEvent (Context ctx, int h, DbgEvent dbge) - { - double w = Math.Max(dbge.Duration * pixelPerTick, 2.0); - double x = (dbge.begin - Event.begin) * pixelPerTick; - - ctx.Rectangle (x, 0, w, h); - ctx.SetSource (dbge.Color); - /*if (dbge.IsSelected) { - ctx.FillPreserve (); - ctx.SetSource (1, 1, 1); - ctx.Stroke (); - }else*/ - ctx.Fill (); - - if (dbge.Events == null) - return; - foreach (DbgEvent e in dbge.Events) - drawEvent (ctx, h, e); - } - - public override void onMouseMove (object sender, MouseMoveEventArgs e) - { - if (Event != null) { - Point m = ScreenPointToLocal (e.Position); - long curTick = (long)(m.X / pixelPerTick) + Event.begin; - HoverEvent = hoverEvent (Event, curTick); - - e.Handled = true; - } - base.onMouseMove (sender, e); - } - - DbgEvent hoverEvent (DbgEvent hevt, long curTick){ - if (hevt.Events != null) { - foreach (DbgEvent e in hevt.Events) { - if (curTick >= e.begin && curTick <= e.end) - return hoverEvent (e, curTick); - } - } - return hevt; - } - void updatePixelPerTicks () - { - if (Width == Measure.Fit) - pixelPerTick = 1.0 / ticksPerPixel; - else - pixelPerTick = Event == null ? 0 : (double)ClientRectangle.Width / Event.Duration; - } - } -}
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs b/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs deleted file mode 100644 index 7b91f9f0..00000000 --- a/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs +++ /dev/null @@ -1,807 +0,0 @@ -// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com> -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Threading.Tasks; -using Crow.Drawing; -using Crow.DebugLogger; -using System.Diagnostics; - -namespace Crow -{ - public class DbgLogViewer : Widget - { - public static Dictionary<DbgEvtType, Color> colors; - - public static Configuration colorsConf = new Configuration ("dbgcolor.conf");//, Interface.GetStreamFromPath("#Crow.dbgcolor.conf")); - - public static void reloadColors () { - colors = new Dictionary<DbgEvtType, Color>(); - foreach (string n in colorsConf.Names) { - DbgEvtType t = (DbgEvtType)Enum.Parse (typeof(DbgEvtType), n); - Color c = colorsConf.Get<Color> (n); - colors.Add (t, c); - } - - } - #region CTOR - static DbgLogViewer() { - //reloadColors (); - - } - protected DbgLogViewer () : base(){} - public DbgLogViewer (Interface iface, string style = null) : base(iface, style){} - #endregion - - FontExtents fe; - - - double xScale = 1.0/1024.0, yScale = 1.0, leftMargin, topMargin = 0.0; - DbgWidgetRecord curWidget, hoverWidget; - DbgEvent curEvent, hoverEvent; - - IList<DbgEvent> events = new List<DbgEvent> (); - IList<DbgWidgetRecord> widgets = new List<DbgWidgetRecord> (); - - - public DbgEvtType Filter { - get => Configuration.Global.Get<DbgEvtType> ("DbgLogViewFilter"); - set { - if (Filter == value) - return; - Configuration.Global.Set ("DbgLogViewFilter", value); - NotifyValueChangedAuto(Filter); - RegisterForGraphicUpdate(); - } - } - public IList<DbgEvent> Events { - get => events; - set { - if (events == value) - return; - events = value; - NotifyValueChanged (nameof (Events), events); - - maxTicks = minTicks = 0; - if (events != null && events.Count > 0) { - minTicks = long.MaxValue; - foreach (DbgEvent e in events) { - if (e.begin < minTicks) - minTicks = e.begin; - if (e.end > maxTicks) - maxTicks = e.end; - } - visibleTicks = maxTicks - minTicks; - XScale = (ClientRectangle.Width - leftMargin)/visibleTicks; - ScrollX = 0; - ScrollY = 0; - } else { - maxTicks = 1; - XScale = 1.0/1024.0; - } - - - RegisterForGraphicUpdate (); - } - } - public IList<DbgWidgetRecord> Widgets { - get => widgets; - set { - if (widgets == value) - return; - widgets = value; - NotifyValueChanged (nameof (Widgets), widgets); - updateMargins (); - updateMaxScrollX (); - updateMaxScrollY (); - } - } - public DbgWidgetRecord CurrentWidget { - get => curWidget; - set { - if (curWidget == value) - return; - curWidget = value; - NotifyValueChanged (nameof (CurrentWidget), curWidget); - if (CurrentWidget == null) - return; - if (CurrentWidget.listIndex < scrollY || CurrentWidget.listIndex > scrollY + visibleLines) - ScrollY = CurrentWidget.listIndex - (visibleLines / 2); - - currentLine = CurrentWidget.listIndex; - RegisterForRedraw(); - } - } - public DbgEvent CurrentEvent { - get => curEvent; - set { - if (curEvent == value) - return; - /*if (curEvent != null) - curEvent.IsSelected = false;*/ - curEvent = value; - if (curEvent != null) { - //curEvent.IsSelected = true; - if (curEvent is DbgWidgetEvent we) { - //CurrentWidget = Widgets [we.InstanceIndex]; - hoverLine = we.InstanceIndex; - } - currentTick = curEvent.begin; - if (curEvent.begin > minTicks + ScrollX + visibleTicks || - curEvent.end < minTicks + ScrollX) - ScrollX = curEvent.begin - minTicks - visibleTicks / 2; - } - NotifyValueChanged (nameof (CurrentEvent), curEvent); - RegisterForRedraw (); - } - } - public DbgWidgetRecord HoverWidget { - get => hoverWidget; - internal set { - if (hoverWidget == value) - return; - hoverWidget = value; - NotifyValueChanged (nameof (HoverWidget), hoverWidget); - } - } - - public DbgEvent HoverEvent { - get => hoverEvent; - set { - if (hoverEvent == value) - return; - hoverEvent = value; - NotifyValueChanged (nameof (HoverEvent), hoverEvent); - RegisterForRepaint (); - } - } - - long hoverTick = 0, currentTick, selStart = -1, selEnd = -1, minTicks = 0, maxTicks = 0, visibleTicks = 0; - int hoverLine = -1, currentLine = -1; - int visibleLines = 1; - Point mousePos; - - public double XScale { - get => xScale; - set { - if (xScale == value) - return; - xScale = value; - NotifyValueChanged ("XScale", xScale); - updateVisibleTicks (); - RegisterForGraphicUpdate (); - } - } - public double YScale { - get => yScale; - set { - if (yScale == value) - return; - yScale = value; - NotifyValueChanged ("YScale", yScale); - RegisterForGraphicUpdate (); - } - } - public override Font Font { - get { return base.Font; } - set { - base.Font = value; - using (Context gr = new Context (IFace.surf)) { - setFontForContext (gr); - fe = gr.FontExtents; - } - updateMargins (); - } - } - RectangleD getWidgetEvtBounds (DbgEvent evt, ref Rectangle cb, double penY) { - double x = xScale * (evt.begin - minTicks - ScrollX); - double w = Math.Max (Math.Max (2.0, 2.0 * xScale), (double)(evt.end - evt.begin) * xScale); - if (x < 0.0) { - w += x; - x = 0.0; - } - x += leftMargin + cb.Left; - double rightDiff = x + w - cb.Right; - if (rightDiff > 0) - w -= rightDiff; - return new RectangleD(x, penY, w, fe.Height); - } - void drawEvents (Context ctx, IList<DbgEvent> evts) - { - if (evts == null || evts.Count == 0) - return; - Rectangle cb = ClientRectangle; - - foreach (DbgEvent evt in evts) { - if ((evt.Category & currentFilter) == currentFilter) { - if (evt.end - minTicks <= ScrollX) - continue; - if (evt.begin - minTicks > ScrollX + visibleTicks) - break; - double penY = topMargin + ClientRectangle.Top; - - if (evt.type.HasFlag (DbgEvtType.Widget)) { - DbgWidgetEvent eW = evt as DbgWidgetEvent; - int lIdx = eW.InstanceIndex - ScrollY; - if (lIdx >= 0 && lIdx <= visibleLines) { - - penY += (lIdx) * fe.Height; - - ctx.SetSource (evt.Color); - ctx.Rectangle (getWidgetEvtBounds (evt, ref cb, penY)); - ctx.Fill (); - } - } else if (evt.type.HasFlag (DbgEvtType.IFace)) { - double x = xScale * (evt.begin - minTicks - ScrollX); - double w = Math.Max (Math.Max (2.0, 2.0 * xScale), (double)(evt.end - evt.begin) * xScale); - if (x < 0.0) { - w += x; - x = 0.0; - } - x += leftMargin + cb.Left; - double rightDiff = x + w - cb.Right; - if (rightDiff > 0) - w -= rightDiff; - //ctx.SetSource (0.9,0.9,0.0,0.1); - ctx.SetSource (evt.Color.AdjustAlpha(0.15)); - ctx.Rectangle (x, cb.Top + topMargin, w, cb.Height); - ctx.Fill (); - } - } - drawEvents (ctx, evt.Events); - } - } - - DbgEvtType currentFilter; - protected override void onDraw (Context gr) - { - base.onDraw (gr); - - setFontForContext (gr); - - if (widgets == null) - return; - - gr.LineWidth = 1.0; - - Rectangle cb = ClientRectangle; - - double penY = topMargin + ClientRectangle.Top; - - for (int i = 0; i < visibleLines; i++) { - if (i + ScrollY >= widgets.Count) - break; - int gIdx = i + ScrollY; - DbgWidgetRecord g = widgets [gIdx]; - - penY += fe.Height; - - gr.SetSource (Crow.Colors.Jet); - gr.MoveTo (cb.X, penY - 0.5); - gr.LineTo (cb.Right, penY - 0.5); - gr.Stroke (); - - double penX = 5.0 * g.xLevel + cb.Left; - - if (g.xLevel == 0) - gr.SetSource (Crow.Colors.LightSalmon); - else if (currentLine == g.listIndex) - gr.SetSource(Colors.RoyalBlue); - else - Foreground.SetAsSource (IFace, gr); - - gr.MoveTo (penX, penY - gr.FontExtents.Descent); - gr.ShowText (g.name + gIdx); - } - - currentFilter = Filter; - drawEvents (gr, events); - - gr.MoveTo (cb.Left, topMargin - 0.5 + cb.Top); - gr.LineTo (cb.Right, topMargin - 0.5 + cb.Top); - - gr.MoveTo (leftMargin + cb.Left, cb.Top); - gr.LineTo (leftMargin + cb.Left, cb.Bottom); - gr.SetSource (Crow.Colors.Grey); - - penY = topMargin + ClientRectangle.Top; - - //graduation - long largeGrad = long.Parse ("1" + new string ('0', visibleTicks.ToString ().Length - 1)); - long smallGrad = Math.Max (1, largeGrad / 10); - - long firstVisibleTicks = minTicks + ScrollX; - long curGrad = firstVisibleTicks - firstVisibleTicks % smallGrad + smallGrad; - - long gg = curGrad - ScrollX - minTicks; - while (gg < visibleTicks ) { - double x = (double)gg * xScale + leftMargin + cb.Left; - - gr.MoveTo (x, penY - 0.5); - if (curGrad % largeGrad == 0) { - gr.LineTo (x, penY - 8.5); - string str = ticksToMS(curGrad); - TextExtents te = gr.TextExtents (str); - gr.RelMoveTo (-0.5 * te.Width, -2.0); - gr.ShowText (str); - }else - gr.LineTo (x, penY - 2.5); - - curGrad += smallGrad; - gg = curGrad - ScrollX - minTicks; - } - - gr.Stroke (); - - - - } - string ticksToMS(long ticks) => Math.Round ((double)ticks / Stopwatch.Frequency * 1000.0, 2).ToString(); - public override void Paint (Context ctx) - { - base.Paint (ctx); - - Rectangle r = new Rectangle(mousePos.X, 0, 1, Slot.Height); - Rectangle ctxR = ContextCoordinates (r); - Rectangle cb = ClientRectangle; - ctx.LineWidth = 1.0; - if (hoverTick >= 0) { - double x = xScale * (hoverTick - minTicks - ScrollX) + leftMargin; - if (x - Math.Truncate (x) > 0.5) - x = Math.Truncate (x) + 0.5; - else - x = Math.Truncate (x) - 0.5; - ctx.MoveTo (x, cb.Top + topMargin - 4.0); - ctx.LineTo (x, cb.Bottom); - ctx.SetSource (0.7,0.7,0.7,0.5); - ctx.Stroke(); - } - if (currentTick >= 0) { - double x = xScale * (currentTick - minTicks - ScrollX) + leftMargin; - if (x > leftMargin && x < cb.Right) { - if (x - Math.Truncate (x) > 0.5) - x = Math.Truncate (x) + 0.5; - else - x = Math.Truncate (x) - 0.5; - ctx.MoveTo (x, cb.Top); - ctx.LineTo (x, cb.Bottom); - ctx.SetSource (0.2,0.7,1.0,0.6); - ctx.Stroke(); - } - } - - setFontForContext (ctx); - - string str = ticksToMS(hoverTick); - - ctx.MoveTo (ctxR.X - ctx.TextExtents (str).Width / 2, ctxR.Y + fe.Height); - ctx.ShowText (str); - - ctx.Operator = Operator.Add; - - if (hoverLine >= 0) { - double y = fe.Height * (hoverLine - ScrollY) + topMargin + cb.Top; - r = new Rectangle (cb.Left, (int)y, cb.Width, (int)fe.Height); - - ctx.SetSource (0.1, 0.1, 0.1, 0.4); - ctx.Rectangle (ContextCoordinates (r)); - ctx.Fill (); - - if (hoverEvent is DbgWidgetEvent wevt) { - ctx.SetSource (1.0,1.0,1.0,0.7); - ctx.SetDash (new double[] {1, 2}); - ctx.Rectangle ((Rectangle)getWidgetEvtBounds (wevt, ref cb, y).Inflated (1), 1); - } - } - - if (currentLine >= ScrollY && currentLine < scrollY + visibleLines) { - double y = fe.Height * (currentLine - ScrollY) + topMargin + cb.Top; - r = new Rectangle (cb.Left, (int)y, cb.Width, (int)fe.Height); - - ctx.SetSource (0.1, 0.1, 0.7, 0.2); - ctx.Rectangle (ContextCoordinates (r)); - ctx.Fill (); - } - - if (selStart < 0 || selEnd < 0) { - ctx.Operator = Operator.Over; - return; - } - double selStartX = (double)(selStart - ScrollX - minTicks) * xScale + leftMargin + cb.Left; - double selEndX = (double)(selEnd - ScrollX - minTicks) * xScale + leftMargin + cb.Left; - - if (selStartX < selEndX) { - ctxR.X = (int)selStartX; - ctxR.Width = (int)(selEndX - selStartX); - } else { - ctxR.X = (int)selEndX; - ctxR.Width = (int)(selStartX - selEndX); - } - - ctxR.Width = Math.Max (1, ctxR.Width); - ctx.Rectangle (ctxR); - ctx.SetSource (0.0,0.2,0.8,0.15); - //ctx.SetSource (Colors.Jet); - ctx.Fill(); - ctx.Operator = Operator.Over; - - str = $"{ticksToMS(Math.Abs (selEnd - selStart))} (ms)"; - - ctx.MoveTo (ctxR.Center.X - ctx.TextExtents (str).Width / 2, ctxR.Y + fe.Height); - ctx.SetSource (Colors.Black); - ctx.ShowText (str); - - - - } - public override void OnLayoutChanges (LayoutingType layoutType) - { - base.OnLayoutChanges (layoutType); - switch (layoutType) { - case LayoutingType.Width: - if (xScale < 0) { - visibleTicks = maxTicks - minTicks; - XScale = (ClientRectangle.Width - leftMargin) / visibleTicks; - } - updateVisibleTicks (); - break; - case LayoutingType.Height: - updateVisibleLines (); - break; - } - } - - public override void onMouseLeave (object sender, MouseMoveEventArgs e) - { - base.onMouseLeave (sender, e); - hoverLine = -1; - hoverTick = 0; - } - public override void onMouseMove (object sender, MouseMoveEventArgs e) - { - long lastTick = hoverTick; - int lastLine = hoverLine; - updateMouseLocalPos (e.Position); - - if ((IFace.IsDown (Glfw.MouseButton.Left) || IFace.IsDown (Glfw.MouseButton.Middle)) && selStart >= 0) - selEnd = hoverTick; - else if (IFace.IsDown(Glfw.MouseButton.Right)) { - if (lastTick >= 0 && hoverTick >= 0) - ScrollX += lastTick - hoverTick; - if (lastLine >= 0 && hoverLine >= 0) - ScrollY += lastLine - hoverLine; - updateMouseLocalPos (e.Position); - } else if (widgets != null) { - HoverWidget = (hoverLine < 0 || hoverLine >= widgets.Count) ? null : widgets [hoverLine]; - //HoverEvent = hoverWidget?.Events.FirstOrDefault (ev => ev.begin <= hoverTick && ev.end >= hoverTick); - double tickPerPixel = (double)visibleTicks / ClientRectangle.Width; - //Console.WriteLine ($"ticks per pixel: {tickPerPixel}"); - Task.Run (() => findHoverEvent (hoverWidget, hoverTick, (int)tickPerPixel)); - } - - RegisterForRepaint(); - - e.Handled = true; - base.onMouseMove (sender, e); - } - void findHoverEvent (DbgWidgetRecord widget, long tick, long precision = 0) { - DbgEvent tmp = widget?.Events.FirstOrDefault (ev => ev.begin - precision <= tick && ev.end + precision >= tick); - if (tmp == null) { - tmp = Events.Where(e=>e.type.HasFlag(DbgEvtType.IFace)).Where (ev => ev.begin - precision <= tick && ev.end + precision >= tick).FirstOrDefault(); - while(tmp != null) { - DbgEvent che = tmp.Events?.Where(e=>e.type.HasFlag(DbgEvtType.IFace)).Where (ev => ev.begin - precision <= tick && ev.end + precision >= tick).FirstOrDefault(); - if (che == null) - break; - tmp = che; - } - } else { - while(tmp != null) { - DbgEvent che = tmp.Events?.OfType<DbgWidgetEvent>()?.Where(ev=>ev.InstanceIndex == widget.listIndex && ev.begin - precision <= tick && ev.end + precision >= tick).FirstOrDefault(); - if (che == null) - break; - tmp = che; - } - } - HoverEvent = tmp; - } - public override void onMouseClick(object sender, MouseButtonEventArgs e) - { - if (e.Button == Glfw.MouseButton.Left) { - if (selEnd < 0) { - currentTick = hoverTick; - currentLine = hoverLine; - CurrentWidget = hoverWidget; - CurrentEvent = hoverEvent; - } - selStart = -1; - selEnd = -1; - } - - e.Handled = true; - base.onMouseClick(sender, e); - } - public override void onMouseDown (object sender, MouseButtonEventArgs e) - { - if (e.Button == Glfw.MouseButton.Left || e.Button == Glfw.MouseButton.Middle) { - selStart = hoverTick; - selEnd = -1; - } - - RegisterForRedraw (); - e.Handled = true; - base.onMouseDown (sender, e); - } - public override void onMouseUp (object sender, MouseButtonEventArgs e) - { - - if (e.Button == Glfw.MouseButton.Left && selEnd > 0 && selEnd != selStart) { - long scrX = 0; - if (selStart < selEnd) { - visibleTicks = selEnd - selStart; - scrX = selStart - minTicks; - } else { - visibleTicks = selStart - selEnd; - scrX = selEnd - minTicks; - } - XScale = (ClientRectangle.Width - leftMargin) / visibleTicks; - ScrollX = scrX; - } - - RegisterForRedraw (); - e.Handled = true; - base.onMouseUp (sender, e); - } - - /// <summary> Process scrolling vertically, or if shift is down, vertically </summary> - public override void onMouseWheel (object sender, MouseWheelEventArgs e) - { - //base.onMouseWheel (sender, e); - - if (IFace.Shift) - ScrollX -= (int)((double)(e.Delta * MouseWheelSpeed) / xScale); - else if (IFace.Ctrl) - ScrollY -= e.Delta * MouseWheelSpeed; - else { - if (e.Delta > 0) { - XScale *= 2.0; - } else { - if (MaxScrollX > 0) - XScale *= 0.5; - } - ScrollX = (long)(hoverTick - (long)((double)Math.Max(0, mousePos.X - (long)leftMargin) / xScale) - minTicks); - } - } - - public override void onKeyDown (object sender, KeyEventArgs e) - { - base.onKeyDown (sender, e); - - if (e.Key == Glfw.Key.F3) { - if (selEnd < 0) - return; - if (selEnd < selStart) - zoom (selEnd, selStart); - else - zoom (selStart, selEnd); - selEnd = selStart = -1; - } - } - - void updateMargins () - { - leftMargin = topMargin = 0.0; - - if (widgets == null) - return; - - using (Context gr = new Context (IFace.surf)) { - double maxNameWidth = 0.0; - - setFontForContext (gr); - - foreach (DbgWidgetRecord o in widgets) { - double nameWidth = gr.TextExtents (o.name).Width + 5.0 * o.xLevel; - if (nameWidth > maxNameWidth) - maxNameWidth = nameWidth; - } - - leftMargin = 10.5 + maxNameWidth; - topMargin = 2.0 * fe.Height; - - RegisterForGraphicUpdate (); - } - } - - void updateVisibleLines () - { - visibleLines = fe.Height < 1 ? 1 : (int)Math.Ceiling (((double)ClientRectangle.Height - topMargin) / fe.Height); - NotifyValueChanged ("VisibleLines", visibleLines); - updateMaxScrollY (); - } - void updateVisibleTicks () - { - visibleTicks = Math.Max (0, (long)((double)(ClientRectangle.Width - leftMargin) / XScale)); - NotifyValueChanged ("VisibleTicks", visibleTicks); - updateMaxScrollX (); - } - - void updateMaxScrollX () - { - if (widgets == null) { - MaxScrollX = 0; - } else { - long tot = maxTicks - minTicks; - MaxScrollX = Math.Max (0L, tot - visibleTicks); - NotifyValueChanged ("ChildWidthRatio", (double)visibleTicks / tot); - } - } - void updateMaxScrollY () - { - if (widgets == null) - MaxScrollY = 0; - else { - MaxScrollY = Math.Max (0, widgets.Count + 1 - visibleLines); - NotifyValueChanged ("ChildHeightRatio", (double)visibleLines / (widgets.Count + 1)); - } - } - - void updateMouseLocalPos (Point mPos) - { - Rectangle r = ScreenCoordinates (Slot); - Rectangle cb = ClientRectangle; - cb.Left += (int)leftMargin; - cb.Width -= (int)leftMargin; - cb.Y += (int)topMargin; - cb.Height -= (int)topMargin; - - mousePos = mPos - r.Position; - - mousePos.X = Math.Max (cb.X, mousePos.X); - mousePos.X = Math.Min (cb.Right, mousePos.X); - - if (mousePos.Y < cb.Top || mousePos.Y > cb.Bottom) - hoverLine = -1; - else - hoverLine = (int)((double)(mousePos.Y - cb.Top) / fe.Height) + ScrollY; - - NotifyValueChanged ("CurrentLine", hoverLine); - - mousePos.Y = Math.Max (cb.Y, mousePos.Y); - mousePos.Y = Math.Min (cb.Bottom, mousePos.Y); - - hoverTick = (long)((double)(mousePos.X - cb.X) / xScale) + minTicks + ScrollX; - RegisterForRedraw (); - } - void zoom (long start, long end) { - //Rectangle cb = ClientRectangle; - //cb.X += (int)leftMargin; - XScale = ((double)ClientRectangle.Width - leftMargin)/(end - start); - ScrollX = (int)(start - minTicks); - } - - - long scrollX, maxScrollX; - int scrollY, maxScrollY, mouseWheelSpeed; - - /// <summary> - /// if true, key stroke are handled in derrived class - /// </summary> - protected bool KeyEventsOverrides = false; - - /// <summary> Horizontal Scrolling Position </summary> - [DefaultValue(0)] - public virtual long ScrollX { - get => scrollX; - set { - if (scrollX == value) - return; - - long newS = value; - if (newS < 0) - newS = 0; - else if (newS > maxScrollX) - newS = maxScrollX; - - if (newS == scrollX) - return; - - scrollX = newS; - - NotifyValueChangedAuto (scrollX); - RegisterForGraphicUpdate (); - } - } - /// <summary> Vertical Scrolling Position </summary> - [DefaultValue(0)] - public virtual int ScrollY { - get => scrollY; - set { - if (scrollY == value) - return; - - int newS = value; - if (newS < 0) - newS = 0; - else if (newS > maxScrollY) - newS = maxScrollY; - - if (newS == scrollY) - return; - - scrollY = newS; - - NotifyValueChangedAuto (scrollY); - RegisterForGraphicUpdate (); - - if (widgets == null) - return; - - Rectangle cb = ClientRectangle; - cb.Left += (int)leftMargin; - cb.Width -= (int)leftMargin; - cb.Y += (int)topMargin; - cb.Height -= (int)topMargin; - - if (mousePos.Y < cb.Top || mousePos.Y > cb.Bottom) - hoverLine = -1; - else - hoverLine = (int)((double)(mousePos.Y - cb.Top) / fe.Height) + ScrollY; - - NotifyValueChanged ("CurrentLine", hoverLine); - } - } - /// <summary> Horizontal Scrolling maximum value </summary> - [DefaultValue(0)] - public virtual long MaxScrollX { - get => maxScrollX; - set { - if (maxScrollX == value) - return; - - maxScrollX = Math.Max(0, value); - - if (scrollX > maxScrollX) - ScrollX = maxScrollX; - - NotifyValueChangedAuto (maxScrollX); - RegisterForGraphicUpdate (); - } - } - /// <summary> Vertical Scrolling maximum value </summary> - [DefaultValue(0)] - public virtual int MaxScrollY { - get => maxScrollY; - set { - if (maxScrollY == value) - return; - - maxScrollY = Math.Max (0, value); - - if (scrollY > maxScrollY) - ScrollY = maxScrollY; - - NotifyValueChangedAuto (maxScrollY); - RegisterForGraphicUpdate (); - } - } - /// <summary> Mouse Wheel Scrolling multiplier </summary> - [DefaultValue(1)] - public virtual int MouseWheelSpeed { - get => mouseWheelSpeed; - set { - if (mouseWheelSpeed == value) - return; - - mouseWheelSpeed = value; - - NotifyValueChangedAuto (mouseWheelSpeed); - } - } - } -} - - diff --git a/Samples/DebugLogAnalyzer/src/DebugInterface.cs b/Samples/DebugLogAnalyzer/src/DebugInterface.cs deleted file mode 100644 index 40656bfe..00000000 --- a/Samples/DebugLogAnalyzer/src/DebugInterface.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com> -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) - -using System; -using Crow.Drawing; -using System.Threading; -using Samples; -using System.Runtime.InteropServices; - -namespace Crow -{ - public class DebugInterface : SampleBase { - static DebugInterface() { - DbgLogger.IncludeEvents = DbgEvtType.None; - DbgLogger.DiscardEvents = DbgEvtType.None; - DbgLogger.ConsoleOutput = false; - } - public DebugInterface (IntPtr hWin) : base (hWin) - { - SolidBackground = false; - initBackend (true); - - clientRectangle = new Rectangle (0, 0, 100, 100); - CreateMainSurface (ref clientRectangle); - - } - - public override void Run() - { - Init(); - - Thread t = new Thread (interfaceThread) { - IsBackground = true - }; - t.Start (); - } - public bool ShutDown; - string source; - Action delRegisterForRepaint;//call RegisterForRepaint in the container widget (DebugInterfaceWidget) - Action<Exception> delSetCurrentException; - Func<object> delGetScreenCoordinate; - - void interfaceThread () { - while (!ShutDown) { - try - { - Update(); - } - catch (System.Exception ex) - { - while (Monitor.IsEntered(LayoutMutex)) { - Console.WriteLine ($"[DebugIFace] trying to exit LayoutMutex on error"); - Monitor.Exit (LayoutMutex); - } - while (Monitor.IsEntered(UpdateMutex)) { - Console.WriteLine ($"[DebugIFace] trying to exit UpdateMutex on error"); - Monitor.Exit (UpdateMutex); - } - while (Monitor.IsEntered(ClippingMutex)) { - Console.WriteLine ($"[DebugIFace] trying to exit ClippingMutex on error"); - Monitor.Exit (ClippingMutex); - } - - - /*while (Monitor.IsEntered(LayoutMutex)) - Monitor.Exit (LayoutMutex); - while (Monitor.IsEntered(UpdateMutex)) - Monitor.Exit (UpdateMutex); - while (Monitor.IsEntered(ClippingMutex)) - Monitor.Exit (ClippingMutex);*/ - delSetCurrentException (ex); - Console.WriteLine ($"[DbgIFace] {ex}"); - ClearInterface(); - Thread.Sleep(1000); - } - - if (IsDirty) - delRegisterForRepaint(); - - Thread.Sleep (UPDATE_INTERVAL); - } - } - public void RegisterDebugInterfaceCallback (object w){ - Type t = w.GetType(); - delRegisterForRepaint = (Action)Delegate.CreateDelegate(typeof(Action), w, t.GetMethod("RegisterForRepaint")); - delSetCurrentException = (Action<Exception>)Delegate.CreateDelegate(typeof(Action<Exception>), w, t.GetProperty("CurrentException").GetSetMethod()); - delGetScreenCoordinate = (Func<object>)Delegate.CreateDelegate(typeof(Func<object>), w, t.GetMethod("GetScreenCoordinates")); - } - public void ResetDirtyState () { - IsDirty = false; - } - public string Source { - set { - if (source == value) - return; - source = value; - if (string.IsNullOrEmpty(source)) - return; - delSetCurrentException(null); - try - { - lock (UpdateMutex) { - Widget tmp = CreateITorFromIMLFragment (source).CreateInstance(); - ClearInterface(); - AddWidget (tmp); - tmp.DataSource = this; - } - } - catch (IML.InstantiatorException iTorEx) - { - delSetCurrentException(iTorEx.InnerException); - } - catch (System.Exception ex) - { - delSetCurrentException(ex); - } - } - } - public void Resize (int width, int height) { - if (!HaveVkvgBackend) - ProcessResize (new Rectangle(0,0,width, height)); - } - public override void ProcessResize(Rectangle bounds) { - lock (UpdateMutex) { - clientRectangle = bounds.Size; - - CreateMainSurface (ref clientRectangle); - - foreach (Widget g in GraphicTree) - g.RegisterForLayouting (LayoutingType.All); - - RegisterClip (clientRectangle); - } - } - public override void ForceMousePosition() - { - Point p = Point.Parse(delGetScreenCoordinate().ToString()); - Glfw.Glfw3.SetCursorPosition (WindowHandle, p.X + MousePosition.X, p.Y + MousePosition.Y); - } - } -} diff --git a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs deleted file mode 100644 index 113e5e07..00000000 --- a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs +++ /dev/null @@ -1,472 +0,0 @@ -// Copyright (c) 2013-2019 Bruyère Jean-Philippe <jp_bruyere@hotmail.com> -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) - -using System; -using Glfw; -using System.Reflection; -using System.Runtime.Loader; -using System.IO; -using Crow.Drawing; -using System.Diagnostics; -using System.Collections.Generic; -using Crow.DebugLogger; -using System.Linq; - -namespace Crow -{ - public class DebugInterfaceWidget : Widget { - - string imlSource; - List<DbgEvent> events; - List<DbgWidgetRecord> widgets; - Exception currentException; - object dbgIFace; - AssemblyLoadContext crowLoadCtx; - Assembly crowAssembly, thisAssembly; - Type dbgIfaceType; - Action<int, int> delResize; - Func<int, int, bool> delMouseMove; - Func<float, bool> delMouseWheelChanged; - Func<MouseButton, bool> delMouseDown, delMouseUp; - Func<char, bool> delKeyPress; - Func<Key, bool> delKeyDown, delKeyUp; - Action delResetDirtyState; - Action delResetDebugger; - Action<object, string> delSaveDebugLog; - Func<IntPtr> delGetSurfacePointer; - Action<string> delSetSource; - - FieldInfo fiDbg_IncludeEvents, fiDbg_DiscardEvents, fiDbg_ConsoleOutput; - - bool initialized, recording, hasVkvgBackend; - string crowDbgAssemblyLocation; - DbgEvtType recordedEvents, discardedEvents; - - public CommandGroup LoggerCommands => - new CommandGroup( - new Command("Get logs", () => getLog ()), - new Command("Reset logs", () => delResetDebugger ()), - new Command("Save to file", () => saveLogToDebugLogFilePath ()), - new Command("Load from file", () => loadLogFromDebugLogFilePath ()) - ); - public string IMLSource { - get => imlSource; - set { - if (imlSource == value) - return; - imlSource = value; - if (initialized) - delSetSource (imlSource); - NotifyValueChangedAuto(imlSource); - RegisterForRedraw(); - } - } - public Exception CurrentException { - get => currentException; - set { - if (currentException == value) - return; - currentException = value; - NotifyValueChangedAuto(currentException); - } - } - public string CrowDbgAssemblyLocation { - get => crowDbgAssemblyLocation; - set { - if (crowDbgAssemblyLocation == value) - return; - crowDbgAssemblyLocation = value; - NotifyValueChangedAuto(CrowDbgAssemblyLocation); - tryStartDebugInterface(); - } - } - - public bool Recording { - get => recording; - set { - if (recording == value) - return; - recording = value & initialized; - if (recording) { - fiDbg_DiscardEvents.SetValue (dbgIFace, DiscardedEvents); - fiDbg_IncludeEvents.SetValue (dbgIFace, RecordedEvents); - } else { - fiDbg_DiscardEvents.SetValue (dbgIFace, DiscardedEvents); - fiDbg_IncludeEvents.SetValue (dbgIFace, RecordedEvents); - } - NotifyValueChangedAuto(recording); - } - } - public DbgEvtType RecordedEvents { - get => recordedEvents; - set { - if (recordedEvents == value) - return; - recordedEvents = value; - if (Recording) - fiDbg_IncludeEvents.SetValue (dbgIFace, value); - NotifyValueChangedAuto (recordedEvents); - } - } - public DbgEvtType DiscardedEvents { - get => discardedEvents; - set { - if (discardedEvents == value) - return; - discardedEvents = value; - if (Recording) - fiDbg_DiscardEvents.SetValue (dbgIFace, value); - NotifyValueChangedAuto (discardedEvents); - } - } - public string DebugLogFilePath { - get => Configuration.Global.Get<string> ("DebugLogFilePath"); - set { - if (DebugLogFilePath == value) - return; - Configuration.Global.Set ("DebugLogFilePath", value); - NotifyValueChangedAuto (value); - } - } - public string DebugLogFileFolder => System.IO.Path.GetDirectoryName (DebugLogFilePath); - public Command CMDSelectDebugLogFilePath => new Command ("...", - () => { - FileDialog dlg = IFace.LoadIMLFragment<FileDialog> (@" - <FileDialog Caption='Select Log file' CurrentDirectory='{DebugLogFileFolder}' - ShowFiles='true' ShowHidden='true' />"); - dlg.OkClicked += (sender, e) => DebugLogFilePath = (sender as FileDialog).SelectedFileFullPath; - dlg.DataSource = this; - } - ); - int firstWidgetIndexToSave, lastWidgetIndexToSave; - public int FirstWidgetIndexToSave { - get => firstWidgetIndexToSave; - set { - if (firstWidgetIndexToSave == value) - return; - if (value > lastWidgetIndexToSave) - firstWidgetIndexToSave = lastWidgetIndexToSave; - else - firstWidgetIndexToSave = value; - - NotifyValueChangedAuto (firstWidgetIndexToSave); - } - } - public int LastWidgetIndexToSave { - get => lastWidgetIndexToSave; - set { - if (lastWidgetIndexToSave == value) - return; - if (lastWidgetIndexToSave > widgets.Count) - lastWidgetIndexToSave = widgets.Count; - else - lastWidgetIndexToSave = value; - - NotifyValueChangedAuto (lastWidgetIndexToSave); - } - } - - protected override void onInitialized(object sender, EventArgs e) - { - base.onInitialized(sender, e); - - - } - - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - } - - public bool CrowDebuggerOK => initialized; - public bool CrowDebuggerNOK => !initialized; - public string CrowDebuggerErrorMessage = ""; - void notifyCrowDebuggerState (string errorMsg = null) { - NotifyValueChanged("CrowDebuggerOK", CrowDebuggerOK); - NotifyValueChanged("CrowDebuggerNOK", CrowDebuggerNOK); - CrowDebuggerErrorMessage = errorMsg; - NotifyValueChanged("CrowDebuggerErrorMessage", CrowDebuggerErrorMessage); - } - - void tryStartDebugInterface () { - if (initialized) - return; - if (!File.Exists (crowDbgAssemblyLocation)) { - notifyCrowDebuggerState($"Crow.dll for debugging file not found"); - return; - } - - crowLoadCtx = new AssemblyLoadContext("CrowDebuggerLoadContext"); - crowLoadCtx.Resolving += (context, assemblyName) => { - return crowLoadCtx.LoadFromAssemblyPath ( - System.IO.Path.Combine ( - System.IO.Path.GetDirectoryName(crowDbgAssemblyLocation), assemblyName.Name + ".dll")); - }; - - //using (crowLoadCtx.EnterContextualReflection()) { - crowAssembly = crowLoadCtx.LoadFromAssemblyPath (crowDbgAssemblyLocation); - thisAssembly = crowLoadCtx.LoadFromAssemblyPath (new Uri(Assembly.GetEntryAssembly().CodeBase).LocalPath); - - Type debuggerType = crowAssembly.GetType("Crow.DbgLogger"); - if (!(bool)debuggerType.GetField("IsEnabled").GetValue(null)) { - notifyCrowDebuggerState("Crow.dll must be compiled with CrowDebugLogEnabled='True'"); - return; - } - - dbgIfaceType = thisAssembly.GetType("Crow.DebugInterface"); - dbgIFace = Activator.CreateInstance (dbgIfaceType, new object[] {IFace.WindowHandle}); - - delResize = (Action<int, int>)Delegate.CreateDelegate(typeof(Action<int, int>), - dbgIFace, dbgIfaceType.GetMethod("Resize")); - - delMouseMove = (Func<int, int, bool>)Delegate.CreateDelegate(typeof(Func<int, int, bool>), - dbgIFace, dbgIfaceType.GetMethod("OnMouseMove")); - - delMouseWheelChanged = (Func<float, bool>)Delegate.CreateDelegate(typeof(Func<float, bool>), - dbgIFace, dbgIfaceType.GetMethod("OnMouseWheelChanged")); - - - delMouseDown = (Func<MouseButton, bool>)Delegate.CreateDelegate(typeof(Func<MouseButton, bool>), - dbgIFace, dbgIfaceType.GetMethod("OnMouseButtonDown")); - - delMouseUp = (Func<MouseButton, bool>)Delegate.CreateDelegate(typeof(Func<MouseButton, bool>), - dbgIFace, dbgIfaceType.GetMethod("OnMouseButtonUp")); - - delKeyDown = (Func<Key, bool>)Delegate.CreateDelegate(typeof(Func<Key, bool>), - dbgIFace, dbgIfaceType.GetMethod("OnKeyDown")); - delKeyUp = (Func<Key, bool>)Delegate.CreateDelegate(typeof(Func<Key, bool>), - dbgIFace, dbgIfaceType.GetMethod("OnKeyUp")); - delKeyPress = (Func<char, bool>)Delegate.CreateDelegate(typeof(Func<char, bool>), - dbgIFace, dbgIfaceType.GetMethod("OnKeyPress")); - - - delGetSurfacePointer = (Func<IntPtr>)Delegate.CreateDelegate(typeof(Func<IntPtr>), - dbgIFace, dbgIfaceType.GetProperty("SurfacePointer").GetGetMethod()); - delSetSource = (Action<string>)Delegate.CreateDelegate(typeof(Action<string>), - dbgIFace, dbgIfaceType.GetProperty("Source").GetSetMethod()); - - delResetDirtyState = (Action)Delegate.CreateDelegate(typeof(Action), - dbgIFace, dbgIfaceType.GetMethod("ResetDirtyState")); - - fiDbg_IncludeEvents = debuggerType.GetField("IncludeEvents"); - fiDbg_DiscardEvents = debuggerType.GetField("DiscardEvents"); - fiDbg_ConsoleOutput = debuggerType.GetField("ConsoleOutput"); - delResetDebugger = (Action)Delegate.CreateDelegate(typeof(Action), - null, debuggerType.GetMethod("Reset")); - /*delSaveDebugLog = (Action<object, string>)Delegate.CreateDelegate(typeof(Action<object, string>), - null, debuggerType.GetMethod("Save", new Type[] {dbgIfaceType, typeof(string)}));*/ - hasVkvgBackend = (bool)dbgIfaceType.GetField ("HaveVkvgBackend", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue (null); - - dbgIfaceType.GetMethod("RegisterDebugInterfaceCallback").Invoke (dbgIFace, new object[] {this} ); - dbgIfaceType.GetMethod("Run").Invoke (dbgIFace, null); - - initialized = true; - notifyCrowDebuggerState(); - - //Console.WriteLine($"DbgIFace: LoadCtx:{AssemblyLoadContext.GetLoadContext (dbgIFace.GetType().Assembly).Name})"); - //} - } - - protected override void onDraw(Context gr) - { - gr.SetSource(Colors.RoyalBlue); - gr.Paint(); - } - public override bool CacheEnabled { get => true; set => base.CacheEnabled = true; } - - public override void onKeyDown(object sender, KeyEventArgs e) - { - if (initialized) { - try - { - e.Handled = delKeyDown (e.Key); - } - catch (System.Exception ex) - { - Console.WriteLine($"[Error][DebugIFace key down]{ex}"); - } - } - base.onKeyDown(sender, e); - } - public override void onKeyUp(object sender, KeyEventArgs e) - { - if (initialized) { - try - { - e.Handled = delKeyUp (e.Key); - } - catch (System.Exception ex) - { - Console.WriteLine($"[Error][DebugIFace key up]{ex}"); - } - } - base.onKeyUp(sender, e); - } - public override void onKeyPress(object sender, KeyPressEventArgs e) - { - if (initialized) { - try - { - e.Handled = delKeyPress (e.KeyChar); - } - catch (System.Exception ex) - { - Console.WriteLine($"[Error][DebugIFace key press]{ex}"); - } - } - base.onKeyPress(sender, e); - } - public override void onMouseMove(object sender, MouseMoveEventArgs e) - { - if (initialized) { - try - { - Point m = ScreenPointToLocal (e.Position); - e.Handled = delMouseMove (m.X, m.Y); - } - catch (System.Exception ex) - { - Console.WriteLine($"[Error][DebugIFace mouse move]{ex}"); - } - } - base.onMouseMove(sender, e); - } - public override void onMouseDown(object sender, MouseButtonEventArgs e) - { - if (initialized) { - try - { - e.Handled = delMouseDown (e.Button); - } - catch (System.Exception ex) - { - Console.WriteLine($"[Error][DebugIFace mouse down]{ex}"); - } - } - base.onMouseDown (sender, e); - } - public override void onMouseUp(object sender, MouseButtonEventArgs e) - { - if (initialized) { - try - { - e.Handled = delMouseUp (e.Button); - } - catch (System.Exception ex) - { - Console.WriteLine($"[Error][DebugIFace mouse up]{ex}"); - } - } - base.onMouseUp (sender, e); - } - public override void onMouseWheel(object sender, MouseWheelEventArgs e) - { - if (initialized) { - try - { - e.Handled = delMouseWheelChanged (e.Delta); - } - catch (System.Exception ex) - { - Console.WriteLine($"[Error][DebugIFace mouse wheel change]{ex}"); - } - } - base.onMouseWheel(sender, e); - } - - protected override void RecreateCache() - { - bmp?.Dispose (); - - if (initialized) { - delResize (Slot.Width, Slot.Height); - if (hasVkvgBackend) - bmp = IFace.CreateSurfaceForData (delGetSurfacePointer(), Slot.Width, Slot.Height); - else - bmp = IFace.CreateSurface (delGetSurfacePointer()); - - } else - bmp = IFace.CreateSurface (Slot.Width, Slot.Height); - - IsDirty = false; - } - protected override void UpdateCache(Context ctx) - { - if (initialized && bmp != null) { - paintCache (ctx, Slot + Parent.ClientRectangle.Position); - delResetDirtyState (); - } - - } - - int firstWidgetIndexToGet = 0; - void getLog () { - DebugLogAnalyzer.Program dla = IFace as DebugLogAnalyzer.Program; - - using (Stream stream = new MemoryStream (1024)) { - Type debuggerType = crowAssembly.GetType("Crow.DbgLogger"); - MethodInfo miSave = debuggerType.GetMethod("Save", - new Type[] { - dbgIfaceType, - typeof(Stream), - typeof(int), - typeof(bool) - }); - - - widgets = new List<DbgWidgetRecord>(); - events = new List<DbgEvent>(); - miSave.Invoke(null, new object[] {dbgIFace, stream, firstWidgetIndexToGet, true}); - stream.Seek(0, SeekOrigin.Begin); - DbgLogger.Load (stream, events, widgets); - - lock (dla.UpdateMutex) { - for (int i = 0; i < widgets.Count; i++) { - widgets[i].listIndex = dla.Widgets.Count; - dla.Widgets.Add (widgets[i]); - } - for (int i = 0; i < events.Count; i++) { - dla.Events.Add (events[i]); - updateWidgetEvents (dla.Widgets, events[i]); - } - } - firstWidgetIndexToGet += widgets.Count; - if (widgets.Count > 0 && firstWidgetIndexToGet != widgets.Last().InstanceIndex + 1) - Debugger.Break (); - } - } - void updateWidgetEvents (IList<DbgWidgetRecord> widgets, DbgEvent evt) { - if (evt is DbgWidgetEvent we) - widgets.FirstOrDefault (w => w.InstanceIndex == we.InstanceIndex)?.Events.Add (we); - if (evt.Events == null) - return; - foreach (DbgEvent e in evt.Events) - updateWidgetEvents (widgets, e); - } - void saveLogToDebugLogFilePath () { - - } - void loadLogFromDebugLogFilePath () { - DebugLogAnalyzer.Program dla = IFace as DebugLogAnalyzer.Program; - - widgets = new List<DbgWidgetRecord>(); - events = new List<DbgEvent>(); - - DbgLogger.Load(DebugLogFilePath, events, widgets); - - lock (dla.UpdateMutex) { - for (int i = 0; i < widgets.Count; i++) { - widgets[i].listIndex = dla.Widgets.Count; - dla.Widgets.Add (widgets[i]); - } - for (int i = 0; i < events.Count; i++) { - dla.Events.Add (events[i]); - updateWidgetEvents (dla.Widgets, events[i]); - } - } - } - - public virtual object GetScreenCoordinates () => ScreenCoordinates(Slot).TopLeft; - } -}
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/src/Program.cs b/Samples/DebugLogAnalyzer/src/Program.cs deleted file mode 100644 index 13e0234d..00000000 --- a/Samples/DebugLogAnalyzer/src/Program.cs +++ /dev/null @@ -1,259 +0,0 @@ -using System.Reflection.PortableExecutable; -// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com> -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) - -using System; -using Crow; -using System.IO; -using Glfw; -using Crow.Text; -using System.Collections.Generic; -using Encoding = System.Text.Encoding; -using Crow.DebugLogger; -using System.Linq; -using Samples; - -namespace DebugLogAnalyzer -{ - public class Program : SampleBaseForEditor - { - - static void Main (string [] args) - { - initDebugLog (); - - using (Program app = new Program ()) { - CurrentProgramInstance = app; - app.Run (); - } - } - protected override void OnInitialized () { - base.OnInitialized (); - - Load ("#Dbg.main.crow").DataSource = this; - //crowContainer = FindByName ("CrowContainer") as Container; - editor = FindByName ("tb") as TextBox; - - /*TreeView tv = FindByName("dbgTV") as TreeView; - dbgTreeViewScroller = tv.FindByNameInTemplate ("scroller1") as Scroller;*/ - if (DebugLogOnStartup) - DebugLogRecording = true; - - if (!File.Exists (CurrentFile)) - newFile (); - //I set an empty object as datasource at this level to force update when new - //widgets are added to the interface - - reloadFromFile (); - } - - public override void UpdateFrame() - { - base.UpdateFrame(); - - } - - - ObservableList<DbgEvent> events = new ObservableList<DbgEvent>(); - ObservableList<DbgWidgetRecord> widgets = new ObservableList<DbgWidgetRecord>(); - DbgEvent curEvent; - bool disableCurrentEventHistory; - Stack<DbgEvent> CurrentEventHistoryForward = new Stack<DbgEvent>(); - Stack<DbgEvent> CurrentEventHistoryBackward = new Stack<DbgEvent>(); - DbgWidgetRecord curWidget = new DbgWidgetRecord(); - bool debugLogRecording; - int targetTvScroll = -1; - - public string[] AllEventTypes => Enum.GetNames (typeof(DbgEvtType)); - string searchEventType; - DbgWidgetRecord searchWidget; - public string SearchEventType { - get => searchEventType; - set { - if (searchEventType == value) - return; - searchEventType = value; - NotifyValueChanged (searchEventType); - } - } - - public DbgWidgetRecord SearchWidget { - get => searchWidget; - set { - if (searchWidget == value) - return; - searchWidget = value; - NotifyValueChanged (searchWidget); - } - } - public Command CMDGotoParentEvent, CMDEventHistoryForward, CMDEventHistoryBackward; - public CommandGroup EventCommands, DirectoryCommands; - protected override void initCommands () - { - base.initCommands (); - - CMDGotoParentEvent = new Command("parent", ()=> { CurrentEvent = CurrentEvent?.parentEvent; }, null, false); - CMDEventHistoryBackward = new Command("back.", currentEventHistoryGoBack, null, false); - CMDEventHistoryForward = new Command("forw.", currentEventHistoryGoForward, null, false); - - EventCommands = new CommandGroup( - CMDGotoParentEvent, CMDEventHistoryBackward, CMDEventHistoryForward - ); - DirectoryCommands = new CommandGroup( - new Command("Set as root directory", ()=> { CurrentEvent = CurrentEvent?.parentEvent; }) - ); - - } - - public string CrowDbgAssemblyLocation { - get => Configuration.Global.Get<string>("CrowDbgAssemblyLocation"); - set { - if (CrowDbgAssemblyLocation == value) - return; - Configuration.Global.Set ("CrowDbgAssemblyLocation", value); - NotifyValueChanged(CrowDbgAssemblyLocation); - } - } - public ObservableList<DbgEvent> Events { - get => events; - set { - if (events == value) - return; - events = value; - NotifyValueChanged (nameof (Events), events); - } - } - public ObservableList<DbgWidgetRecord> Widgets { - get => widgets; - set { - if (widgets == value) - return; - widgets = value; - NotifyValueChanged (nameof (Widgets), widgets); - } - } - - public DbgEvent CurrentEvent { - get => curEvent; - set { - if (curEvent == value) - return; - - if (!disableCurrentEventHistory) { - CurrentEventHistoryForward.Clear (); - CMDEventHistoryForward.CanExecute = false; - if (!(value == null || curEvent == null)) { - CurrentEventHistoryBackward.Push (curEvent); - CMDEventHistoryBackward.CanExecute = true; - } - } - - curEvent = value; - - NotifyValueChanged (nameof (CurrentEvent), curEvent); - NotifyValueChanged ("CurEventChildEvents", curEvent?.Events); - if (CurrentEvent != null && CurrentEvent.parentEvent != null) - CMDGotoParentEvent.CanExecute = true; - else - CMDGotoParentEvent.CanExecute = false; - } - } - void currentEventHistoryGoBack () { - disableCurrentEventHistory = true; - if (CurrentEvent != null) { - CurrentEventHistoryForward.Push (CurrentEvent); - CMDEventHistoryForward.CanExecute = true; - } - CurrentEvent = CurrentEventHistoryBackward.Pop (); - CMDEventHistoryBackward.CanExecute = CurrentEventHistoryBackward.Count > 0; - - disableCurrentEventHistory = false; - } - - void currentEventHistoryGoForward () { - disableCurrentEventHistory = true; - CurrentEventHistoryBackward.Push (CurrentEvent); - CMDEventHistoryBackward.CanExecute = true; - CurrentEvent = CurrentEventHistoryForward.Pop (); - CMDEventHistoryForward.CanExecute = CurrentEventHistoryForward.Count > 0; - - disableCurrentEventHistory = false; - } - - public DbgWidgetRecord CurrentWidget { - get => curWidget; - set { - if (curWidget == value) - return; - curWidget = value; - NotifyValueChanged (nameof (CurrentWidget), curWidget); - NotifyValueChanged ("CurWidgetRootEvents", curWidget?.RootEvents); - NotifyValueChanged ("CurrentWidgetEvents", curWidget?.Events); - } - } - public List<DbgWidgetEvent> CurWidgetRootEvents => curWidget == null? new List<DbgWidgetEvent>() : curWidget.RootEvents; - - /*public string DebugLogFilePath { - get => Configuration.Global.Get<string> (nameof (DebugLogFilePath)); - set { - if (CurrentFile == value) - return; - Configuration.Global.Set (nameof (DebugLogFilePath), value); - NotifyValueChanged (DebugLogFilePath); - } - }*/ - public bool DebugLogOnStartup { - get => Configuration.Global.Get<bool> (nameof(DebugLogOnStartup)); - set { - if (DebugLogOnStartup == value) - return; - Configuration.Global.Set (nameof(DebugLogOnStartup), value); - NotifyValueChanged(DebugLogOnStartup); - } - } - - - Exception currentException; - - public Exception CurrentException { - get => currentException; - set { - if (currentException == value) - return; - currentException = value; - NotifyValueChanged ("ShowError", ShowError); - NotifyValueChanged ("CurrentExceptionMSG", (object)CurrentExceptionMSG); - NotifyValueChanged (currentException); - } - } - public bool ShowError => currentException != null; - public string CurrentExceptionMSG => currentException == null ? "" : currentException.Message; - - - public override bool OnKeyDown (Key key) { - - switch (key) { - case Key.F5: - Load ("#Dbg.DebugLog.crow").DataSource = this; - return true; - /*case Key.F6: - if (DebugLogRecording) { - DbgLogger.IncludeEvents = DbgEvtType.None; - DbgLogger.DiscardEvents = DbgEvtType.All; - if (DebugLogToFile && !string.IsNullOrEmpty(DebugLogFilePath)) - DbgLogger.Save (this, DebugLogFilePath); - DebugLogRecording = false; - } else { - DbgLogger.Reset (); - DbgLogger.IncludeEvents = RecordedEvents; - DbgLogger.DiscardEvents = DiscardedEvents; - DebugLogRecording = true; - } - return true;*/ - } - return base.OnKeyDown (key); - } - } -} - diff --git a/Samples/DebugLogAnalyzer/ui/Button.template b/Samples/DebugLogAnalyzer/ui/Button.template deleted file mode 100644 index c7e2fa06..00000000 --- a/Samples/DebugLogAnalyzer/ui/Button.template +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> -<Border Background="{./Background}" MinimumSize="50,20" Name="Content" - Foreground="Transparent" CornerRadius="{../CornerRadius}" BorderWidth="1" - MouseEnter="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black};{caption.Foreground=White}" - MouseLeave="{Foreground=Transparent};{caption.Foreground=LightGrey}" - MouseDown="{Foreground=vgradient|0:Black|0.05:Grey|0.85:Grey|1:White}" - MouseUp="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black}"> - <HorizontalStack Margin="2"> - <Image Style="Icon" Path="{./Icon}"/> - <Label Font="{./Font}" Name="caption" Margin="3" Foreground="LightGrey" Text="{./Caption}"/> - </HorizontalStack> -</Border>
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/ui/DbgEventTreeItems.itemp b/Samples/DebugLogAnalyzer/ui/DbgEventTreeItems.itemp deleted file mode 100644 index 0dd44c74..00000000 --- a/Samples/DebugLogAnalyzer/ui/DbgEventTreeItems.itemp +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<ItemTemplate Data="Events"> - <ListItem Height="Fit" - Selected="{/exp.Background=${ControlHighlight}}" - Unselected="{/exp.Background=Transparent}"> - <Expandable Name="exp" Caption="{type}" MouseDoubleClick="/onClickForExpand" CacheEnabled="true" > - <Template> - <VerticalStack> - <Border CornerRadius="2" Margin="0" Height="Fit" MouseDoubleClick="./onClickForExpand" - Foreground="Transparent" - Background="{./Background}" - MouseEnter="{Foreground=DimGrey}" - MouseLeave="{Foreground=Transparent}"> - <HorizontalStack Spacing="2" > - <Image Margin="1" Width="9" Height="9" Focusable="true" MouseDown="./onClickForExpand" - Path="{./Image}" - Visible="{HasChildEvents}" - SvgSub="{./IsExpanded}" - MouseEnter="{Background=LightGrey}" - MouseLeave="{Background=Transparent}"/> - <Label Text="{./Caption}" Width="80" Font="mono, 8" /> - <Label Text="{DurationMS}" Width="40" Font="mono, 8" TextAlignment="Center" Background="DimGrey"/> - <DbgEventWidget Event="{}" Tooltip="#Dbg.DbgEvtTooltip.crow" Width="Stretched" Height="5"/> - </HorizontalStack> - </Border> - <Container Name="Content" Visible="false"/> - </VerticalStack> - </Template> - <HorizontalStack Height="Fit"> - <Widget Width="12" Height="10"/> - <VerticalStack Height="Fit" Name="ItemsContainer"/> - </HorizontalStack> - </Expandable> - </ListItem> -</ItemTemplate> -<ItemTemplate Data="Events" DataType="DbgWidgetEvent"> - <ListItem Height="Fit" - Selected="{/exp.Background=${ControlHighlight}}" - Unselected="{/exp.Background=Transparent}"> - <Expandable Name="exp" Caption="{type}" MouseDoubleClick="/onClickForExpand" CacheEnabled="true" > - <Template> - <VerticalStack> - <Border CornerRadius="2" Margin="0" Height="Fit" MouseDoubleClick="./onClickForExpand" - Foreground="Transparent" - Background="{./Background}" - MouseEnter="{Foreground=DimGrey}" - MouseLeave="{Foreground=Transparent}"> - <HorizontalStack Spacing="2" > - <Image Margin="1" Width="9" Height="9" Focusable="true" MouseDown="./onClickForExpand" - Path="{./Image}" - Visible="{HasChildEvents}" - SvgSub="{./IsExpanded}" - MouseEnter="{Background=LightGrey}" - MouseLeave="{Background=Transparent}"/> - <Label Text="{./Caption}" Width="80" Font="mono, 8" /> - <Label Text="{DurationMS}" Width="40" Font="mono, 8" TextAlignment="Center" Background="DimGrey"/> - <Label Text="{InstanceIndex}" Width="40" Font="mono, 8" TextAlignment="Center" Background="DimGrey"/> - <DbgEventWidget Event="{}" Tooltip="#Dbg.DbgEvtTooltip.crow" Width="Stretched" Height="5"/> - </HorizontalStack> - </Border> - <Container Name="Content" Visible="false"/> - </VerticalStack> - </Template> - <HorizontalStack Height="Fit"> - <Widget Width="12" Height="10"/> - <VerticalStack Height="Fit" Name="ItemsContainer"/> - </HorizontalStack> - </Expandable> - </ListItem> -</ItemTemplate>
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/ui/DbgEventView.template b/Samples/DebugLogAnalyzer/ui/DbgEventView.template deleted file mode 100644 index 2a61874e..00000000 --- a/Samples/DebugLogAnalyzer/ui/DbgEventView.template +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0"?> -<VerticalStack Margin="${TooltipMargin}" DataSource="{./Event}"> - <Label Text="{type}" Background="{Color}" Foreground="Black" Width="200" TextAlignment="Center" Margin="6"/> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Visible="{IsWidgetEvent}" Background="DimGrey" Margin="2"> - <Label Text="Instance:" Foreground="White" Width="50%" /> - <Label Text="{InstanceIndex}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - <Label Text="{Message}" Foreground="White" Background="Onyx" Width="Stretched" Visible="{HasMessage}" Margin="2" Tooltip="{}"/> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="Duration(ms):" Foreground="White" Width="50%" /> - <Label Text="{DurationMS}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Right"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2"> - <Label Text="Begin(s):" Foreground="${TooltipForeground}" Width="50%"/> - <Label Text="{BeginMS}" Foreground="${TooltipForeground}" Width="Stretched" TextAlignment="Right"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2"> - <Label Text="End(s):" Foreground="${TooltipForeground}" Width="50%"/> - <Label Text="{EndMS}" Foreground="${TooltipForeground}" Width="Stretched" TextAlignment="Right"/> - </HorizontalStack> - <VerticalStack Height="Fit" Width="Stretched" IsVisible="{IsLayoutEvent}" > - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="Layout:" Foreground="White" Width="50%" /> - <Label Text="{layouting}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="Result:" Foreground="White" Width="50%" /> - <Label Text="{result}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="Old Slot:" Foreground="White" Width="50%" /> - <Label Text="{OldSlot}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="New Slot:" Foreground="White" Width="50%" /> - <Label Text="{NewSlot}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - </VerticalStack> - <DbgEventWidget Height="10" Width="Stretched" Event="{}" Tooltip="#Dbg.DbgEvtTooltip.crow" /> - <GroupBox Caption="Parent Event" Height="Fit" > - <DbgEventWidget Height="10" Width="Stretched" Event="{parentEvent}" Tooltip="#Dbg.DbgEvtTooltip.crow" /> - </GroupBox> - <!--<Label Text="{}" Foreground="${TooltipForeground}"/>--> -</VerticalStack>
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/ui/DbgEvtTooltip.crow b/Samples/DebugLogAnalyzer/ui/DbgEvtTooltip.crow deleted file mode 100644 index a3369249..00000000 --- a/Samples/DebugLogAnalyzer/ui/DbgEvtTooltip.crow +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<Border Fit="true" Foreground="${TooltipForeground}" Background="${TooltipBackground}"> - <VerticalStack Fit="true" Margin="${TooltipMargin}" DataSource="{HoverEvent}"> - <Label Text="{type}" Background="{Color}" Foreground="Black" Width="200" TextAlignment="Center" Margin="6"/> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Visible="{IsWidgetEvent}" Background="DimGrey" Margin="2"> - <Label Text="Instance:" Foreground="White" Width="50%" /> - <Label Text="{InstanceIndex}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - <Label Text="{Message}" Foreground="White" Background="Onyx" Width="Stretched" Visible="{HasMessage}" Margin="2" Tooltip="{}"/> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="Duration:" Foreground="White" Width="50%" /> - <Label Text="{DurationMS}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Right"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2"> - <Label Text="Begin:" Foreground="${TooltipForeground}" Width="50%"/> - <Label Text="{BeginMS}" Foreground="${TooltipForeground}" Width="Stretched" TextAlignment="Right"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2"> - <Label Text="End:" Foreground="${TooltipForeground}" Width="50%"/> - <Label Text="{EndMS}" Foreground="${TooltipForeground}" Width="Stretched" TextAlignment="Right"/> - </HorizontalStack> - <VerticalStack Height="Fit" Width="Stretched" IsVisible="{IsLayoutEvent}" > - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="Layout:" Foreground="White" Width="50%" /> - <Label Text="{layouting}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="Result:" Foreground="White" Width="50%" /> - <Label Text="{result}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="Old Slot:" Foreground="White" Width="50%" /> - <Label Text="{OldSlot}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="New Slot:" Foreground="White" Width="50%" /> - <Label Text="{NewSlot}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - </VerticalStack> - <!--<Label Text="{}" Foreground="${TooltipForeground}"/>--> - </VerticalStack> -</Border>
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/ui/DebugLog.crow b/Samples/DebugLogAnalyzer/ui/DebugLog.crow deleted file mode 100644 index a4e947af..00000000 --- a/Samples/DebugLogAnalyzer/ui/DebugLog.crow +++ /dev/null @@ -1,104 +0,0 @@ -<?xml version="1.0"?> -<Window Caption="Debug Log" Background="0.05,0.05,0.1,0.9" Width="80%" Height="80%"> - <VerticalStack> - <TabView> - <VerticalStack Name="LogGraph" Background="DarkGrey"> - <EnumSelector RadioButtonStyle="CheckBox2" Template="#Dbg.EnumSelector.template" - Caption="Discarded Events" EnumValue="{²../dbv.Filter}" BitFieldExcludeMask="255" /> - <HorizontalStack> - <DbgLogViewer Visible="true" Name="dbv" Events="{Events}" Widgets="{Widgets}" - CurrentEvent="{²CurrentEvent}" CurrentWidget="{²CurrentWidget}" /> - <ScrollBar Maximum="{../dbv.MaxScrollY}" Value="{²../dbv.ScrollY}" SmallIncrement="1" LargeIncrement="10" - CursorRatio="{../dbv.ChildHeightRatio}"/> - </HorizontalStack> - <ScrollBar Style="HScrollBar" Maximum="{../dbv.MaxScrollX}" Value="{²../dbv.ScrollX}" SmallIncrement="1" LargeIncrement="10" - CursorRatio="{../dbv.ChildWidthRatio}"/> - <HorizontalStack Height="Fit" DataSource="{CurrentWidget}" Spacing="3"> - <Label Style="smallLabValue" Text="{name}"/> - <Label Style="smallLabValue" Text="{listIndex}" Tooltip="List index"/> - <Label Style="smallLabValue" Text="{treeIndex}" Tooltip="tree index"/> - <Label Style="smallLabValue" Text="{yIndex}" Tooltip="yIndex"/> - <Label Style="smallLabValue" Text="{xLevel}" Tooltip="xLevel"/> - <Label Style="smallLabCaption" Text="Width:"/> - <Label Style="smallLabValue" Text="{Width}"/> - <Label Style="smallLabCaption" Text="Height:" /> - <Label Style="smallLabValue" Text="{Height}"/> - <Label Style="smallLabCaption" Text="ScrollX:" /> - <Label Style="smallLabValue" Text="{../../dbv.ScrollX}"/> - <Label Style="smallLabCaption" Text="MaxScrollX:" /> - <Label Style="smallLabValue" Text="{../../dbv.MaxScrollX}"/> - <Label Style="smallLabValue" Tooltip="XScale" Text="{../../dbv.XScale}"/> - <Label Style="smallLabValue" Tooltip="VisibleTicks" Text="{../../dbv.VisibleTicks}"/> - </HorizontalStack> - </VerticalStack> - <VerticalStack Name="AllEvents" Width="Stretched" IsVisible="false"> - <TreeView Height="Stretched" Name="dbgTV" Data="{Events}" SelectedItem="{²CurrentEvent}" Background="DarkGrey" - ItemTemplate="#Dbg.DbgEventTreeItems.itemp"/> - <ListBox Data="{CurWidgetEvents}" Height="100" SelectedItem="{²CurrentEvent}"> - <ItemTemplate> - <ListItem Margin="0" Height="16" Width="Fit" - Selected="{Background=${ControlHighlight}}" - Unselected="{Background=Transparent}"> - <DbgEventWidget Height="10" Width="Fit" Event="{}" Tooltip="#Dbg.DbgEvtTooltip.crow" TicksPerPixel="20" VerticalAlignment="Center"/> - </ListItem> - </ItemTemplate> - <Template> - <Wrapper Name="ItemsContainer" Spacing="1" Background="DarkGrey"/> - </Template> - </ListBox> - </VerticalStack> - <VerticalStack Name="CurWidgetEvents" Width="Stretched" IsVisible="false"> - <TreeView Height="Stretched" Data="{CurrentWidgetEvents}" Background="DarkGrey" - ItemTemplate="#Dbg.DbgEventTreeItems.itemp"/> - </VerticalStack> - </TabView> - <Splitter/> - <HorizontalStack Height="30%"> - <ListBox Data="{Widgets}" Width="200" SelectedItem="{²CurrentWidget}" - ItemTemplate="#Dbg.WidgetRecord.itemp"> - </ListBox> - <Splitter/> - <VerticalStack> - <HorizontalStack Height="Fit" Background="Onyx" Spacing="5"> - <Label Text="{CurrentWidget}"/> - <Label Text="events"/> - </HorizontalStack> - <ListBox Data="{CurrentWidgetEvents}" Background="Black" SelectedItem="{²CurrentEvent}"> - <ItemTemplate> - <ListItem Margin="0" Height="16" IsSelected="{²IsSelected}" Width="Fit" - Selected="{Background=${ControlHighlight}}" Template="Crow.ScrollingListBox.template" - Unselected="{Background=Transparent}"> - <DbgEventWidget Height="10" Width="Fit" Event="{}" Tooltip="#Dbg.DbgEvtTooltip.crow" TicksPerPixel="50" VerticalAlignment="Center"/> - </ListItem> - </ItemTemplate> - <Template> - <Wrapper Name="ItemsContainer" Spacing="1" Background="{./Background}"/> - </Template> - </ListBox> - <!--<TreeView Data="{Events}" SelectedItem="{²CurrentEvent}" Background="DarkGrey" - ItemTemplate="#Dbg.DbgEventTreeItems.itemp"/>--> - </VerticalStack> - <Splitter/> - <DbgEventView Template="#Dbg.DbgEventView.template" Event="{../../dbv.HoverEvent}"/> - <Splitter/> - <DbgEventView Template="#Dbg.DbgEventView.template" Event="{CurrentEvent}"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Background="Onyx" Margin="1"> - <HorizontalStack Height="Fit" DataSource="{CurrentEvent}"> - <Label Foreground="Black" Text="Current Event:" Background="{Color}" Margin="2" /> - <DbgEventWidget Height="14" Width="Stretched" Event="{}" Tooltip="#Dbg.DbgEvtTooltip.crow" /> - </HorizontalStack> - <Menu Fit="true" Data="{EventCommands}"> - <ItemTemplate> - <Button Command="{}"/> - </ItemTemplate> - </Menu> - <Popper Caption="Search..."> - <VerticalStack Fit="true" Background="Onyx" Margin="10"> - <ComboBox Caption="Event Type" Data="{AllEventTypes}" SelectedItem="{²SearchEventType}"/> - <ComboBox Caption="Widget" Data="{Widgets}" SelectedItem="{²SearchWidget}"/> - </VerticalStack> - </Popper> - </HorizontalStack> - </VerticalStack> -</Window>
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/ui/EnumSelector.template b/Samples/DebugLogAnalyzer/ui/EnumSelector.template deleted file mode 100644 index 01d04383..00000000 --- a/Samples/DebugLogAnalyzer/ui/EnumSelector.template +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0"?> -<Popper > - <Template> - <HorizontalStack Background="{../../Background}" Margin="5" Spacing="10"> - <Label Text="{../../../Caption}" Width="Stretched"/> - <Label Background="SeaGreen" Text="{../../../EnumValue}" Margin="3"/> - </HorizontalStack> - </Template> - <Wrapper Name="Content" Height="Fit" Width="{../PopWidth}" Background="Jet" /> -</Popper>
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/ui/WidgetRecord.itemp b/Samples/DebugLogAnalyzer/ui/WidgetRecord.itemp deleted file mode 100644 index 2b1297d3..00000000 --- a/Samples/DebugLogAnalyzer/ui/WidgetRecord.itemp +++ /dev/null @@ -1,11 +0,0 @@ -<ListItem Height="Fit" Margin="1" Focusable="true" HorizontalAlignment="Left" - Selected = "{Background=${ControlHighlight}}" - Unselected = "{Background=Transparent}"> - <HorizontalStack> - <Label Text="{name}" Width="Stretched"/> - <Label Style="labWidgetRecordList" Text="{listIndex}" Tooltip="List index"/> - <Label Style="labWidgetRecordList" Text="{treeIndex}" Tooltip="tree index"/> - <Label Style="labWidgetRecordList" Text="{yIndex}" Tooltip="yIndex"/> - <Label Style="labWidgetRecordList" Text="{xLevel}" Tooltip="xLevel"/> - </HorizontalStack> -</ListItem>
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/ui/dbg.style b/Samples/DebugLogAnalyzer/ui/dbg.style deleted file mode 100644 index ee2b14c1..00000000 --- a/Samples/DebugLogAnalyzer/ui/dbg.style +++ /dev/null @@ -1,37 +0,0 @@ -IcoButton { - Template = "#Dbg.Button.template"; - Background = "Onyx"; -} -CheckBox2 { - Width = "200"; -} -smallLabCaption { - Font="mono, 8"; - Foreground="Grey"; -} -smallLabValue { - Font="mono, 10"; - Foreground="White"; -} -DbgLogViewer { - MouseWheelSpeed="3"; - Font="mono, 8"; - Background="Onyx"; - CacheEnabled = "true"; -} -DbgEventView { - Height="Fit"; - Width="150"; -} -labWidgetRecordList { - Font="mono, 11"; - Background="Grey"; - Foreground="Jet"; - Margin="0"; - Width="24"; - TextAlignment="Right"; -} - -DbgEventWidget { - CacheEnabled = "true"; -}
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/ui/dbglog.crow b/Samples/DebugLogAnalyzer/ui/dbglog.crow deleted file mode 100644 index fd42833c..00000000 --- a/Samples/DebugLogAnalyzer/ui/dbglog.crow +++ /dev/null @@ -1,100 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<VerticalStack> - <VerticalStack Height="40%"> - <DbgLogViewer Visible="true" Name="dbv" Events="{Events}" Widgets="{Widgets}" MouseWheelSpeed="10" Font="mono, 8" - CurrentEvent="{²CurrentEvent}" CurrentWidget="{²CurrentWidget}" Background="Onyx"/> - <ScrollBar Style="HScrollBar" Maximum="{../dbv.MaxScrollX}" Value="{²../dbv.ScrollX}"/> - <HorizontalStack Height="Fit" DataSource="{CurrentWidget}"> - <Label Text="{name}"/> - <Label Text="{listIndex}"/> - <Label Text="{treeIndex}"/> - <Label Text="{yIndex}"/> - <Label Text="{xLevel}"/> - <Label Text="Width:" Foreground="Grey"/> - <Label Text="{Width}"/> - <Label Text="Height:" Foreground="Grey"/> - <Label Text="{Height}"/> - <Label Text="ScrollX:" Foreground="Grey"/> - <Label Text="{../../dbv.ScrollX}"/> - <Label Text="MaxScrollX:" Foreground="Grey"/> - <Label Text="{../../dbv.MaxScrollX}"/> - </HorizontalStack> - </VerticalStack> - <Splitter/> - <HorizontalStack Height="40%"> - <VerticalStack Width="Stretched"> - <TreeView Height="Stretched" Name="dbgTV" Data="{Events}" SelectedItem="{²CurrentEvent}" Background="DarkGrey" - SelectedItemContainerChanged="onSelectedItemContainerChanged" Painted="onTvPainted" - ItemTemplate="#Dbg.DbgEventTreeItems.itemp"/> - <ListBox Data="{CurWidgetRootEvents}" Height="100" SelectedItem="{²CurrentEvent}"> - <ItemTemplate> - <ListItem Margin="0" Height="16" IsSelected="{²IsSelected}" Width="Fit" - Selected="{Background=${ControlHighlight}}" - Unselected="{Background=Transparent}"> - <DbgEventWidget Height="10" Width="Fit" Event="{}" Tooltip="#Dbg.DbgEvtTooltip.crow" TicksPerPixel="20" VerticalAlignment="Center"/> - </ListItem> - </ItemTemplate> - <Template> - <Wrapper Name="ItemsContainer" Spacing="0" Background="DarkGrey"/> - </Template> - </ListBox> - </VerticalStack> - <Splitter/> - <VerticalStack Height="Stretched" Width="20%" Margin="${TooltipMargin}" DataSource="{CurrentEvent}"> - <Label Text="{type}" Background="{Color}" Foreground="Black" Width="200" TextAlignment="Center" Margin="6"/> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Visible="{IsWidgetEvent}" Background="DimGrey" Margin="2"> - <Label Text="Instance:" Foreground="White" Width="50%" /> - <Label Text="{InstanceIndex}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="Duration:" Foreground="White" Width="50%" /> - <Label Text="{Duration}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Right"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2"> - <Label Text="Begin:" Foreground="${TooltipForeground}" Width="50%"/> - <Label Text="{begin}" Foreground="${TooltipForeground}" Width="Stretched" TextAlignment="Right"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2"> - <Label Text="End:" Foreground="${TooltipForeground}" Width="50%"/> - <Label Text="{end}" Foreground="${TooltipForeground}" Width="Stretched" TextAlignment="Right"/> - </HorizontalStack> - <VerticalStack Height="Fit" Width="Stretched" > - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="Layout:" Foreground="White" Width="50%" /> - <Label Text="{layouting}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="Result:" Foreground="White" Width="50%" /> - <Label Text="{result}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="Old Slot:" Foreground="White" Width="50%" /> - <Label Text="{OldSlot}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched" Spacing="2" Background="DimGrey" Margin="2"> - <Label Text="New Slot:" Foreground="White" Width="50%" /> - <Label Text="{NewSlot}" Foreground="White" Background="Onyx" Width="Stretched" TextAlignment="Center"/> - </HorizontalStack> - </VerticalStack> - <!--<Label Text="{}" Foreground="${TooltipForeground}"/>--> - </VerticalStack> - </HorizontalStack> - <Splitter/> - <VerticalStack Name="vs"> - - <VerticalStack DataSource="{CurrentEvent}"> - <ListBox Data="{Events}" Height="100" SelectedItem="{²CurrentEvent}"> - <ItemTemplate> - <ListItem Margin="0" IsSelected="{²IsSelected}" Height="12" - Selected="{Background=${ControlHighlight}}" - Unselected="{Background=Transparent}"> - <HorizontalStack> - <Label Text="{type}" Width="80"/> - <DbgEventWidget Height="8" Width="Stretched" Event="{}"/> - </HorizontalStack> - </ListItem> - </ItemTemplate> - </ListBox> - </VerticalStack> - </VerticalStack> -</VerticalStack>
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/ui/dockWindows/winLogGraph.crow b/Samples/DebugLogAnalyzer/ui/dockWindows/winLogGraph.crow deleted file mode 100644 index 7e6a11b8..00000000 --- a/Samples/DebugLogAnalyzer/ui/dockWindows/winLogGraph.crow +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> -<DockWindow Caption="Debug Log" Background="0.05,0.05,0.1,0.9" Width="80%" Height="80%"> - <VerticalStack Name="LogGraph" Background="DarkGrey"> - <EnumSelector RadioButtonStyle="CheckBox2" Template="#Dbg.EnumSelector.template" - Caption="Discarded Events" EnumValue="{²../dbv.Filter}" BitFieldExcludeMask="255" /> - <HorizontalStack> - <DbgLogViewer Visible="true" Name="dbv" Events="{Events}" Widgets="{Widgets}" - CurrentEvent="{²CurrentEvent}" CurrentWidget="{²CurrentWidget}" /> - <ScrollBar Maximum="{../dbv.MaxScrollY}" Value="{²../dbv.ScrollY}" SmallIncrement="1" LargeIncrement="10" - CursorRatio="{../dbv.ChildHeightRatio}"/> - </HorizontalStack> - <ScrollBar Style="HScrollBar" Maximum="{../dbv.MaxScrollX}" Value="{²../dbv.ScrollX}" SmallIncrement="1" LargeIncrement="10" - CursorRatio="{../dbv.ChildWidthRatio}"/> - </VerticalStack> -</Window>
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/ui/focused.crow b/Samples/DebugLogAnalyzer/ui/focused.crow deleted file mode 100644 index 755345ae..00000000 --- a/Samples/DebugLogAnalyzer/ui/focused.crow +++ /dev/null @@ -1,17 +0,0 @@ -<Window Width="80%" Movable="false"> - <VerticalStack> - <HorizontalStack Height="Fit"> - <Label Text="Hover:" Width="50" Foreground="Grey"/> - <Label Text="{HoverWidget}" Font="mono, 8"/> - </HorizontalStack> - <HorizontalStack Height="Fit"> - <Label Text="Focus:" Width="50" Foreground="Grey"/> - <Label Text="{FocusedWidget}" Font="mono, 8"/> - </HorizontalStack> - <HorizontalStack Height="Fit"> - <Label Text="Active:" Width="50" Foreground="Grey"/> - <Label Text="{ActiveWidget}" Font="mono, 8"/> - </HorizontalStack> - </VerticalStack> -</Window> - diff --git a/Samples/DebugLogAnalyzer/ui/main.crow b/Samples/DebugLogAnalyzer/ui/main.crow deleted file mode 100644 index bbeffe0f..00000000 --- a/Samples/DebugLogAnalyzer/ui/main.crow +++ /dev/null @@ -1,167 +0,0 @@ -<?xml version="1.0"?> -<VerticalStack Background="DarkGrey"> - <HorizontalStack > - <TabView Width="25%" > - <VerticalStack Name="Explorer" Background="Onyx"> - <HorizontalStack Height="Fit" Margin="2" > - <Image Margin="2" Width="16" Height="16" Path="#Crow.Icons.level-up.svg" MouseClick="goUpDirClick" - Background="Jet" MouseEnter="{Background=Grey}" MouseLeave="{Background=Jet}" /> - <TextBox Text="{²CurrentDir}" Margin="2"/> - </HorizontalStack> - <DirectoryView Margin="1" Name="dv" CurrentDirectory="{CurrentDir}" SelectedItemChanged="Dv_SelectedItemChanged"> - <Template> - <TreeView IsRoot="true" Name="treeView" Data="{./FileSystemEntries}" Background="{./Background}" - SelectedItemChanged="./onSelectedItemChanged"> - <ItemTemplate DataType="System.IO.FileInfo"> - <ListItem CornerRadius="2" Margin="0" Height="Fit" Width="Stretched" - ContextCommands="{GetCommands}" - Selected="{Background=${ControlHighlight}}" - Unselected="{Background=Transparent}"> - <HorizontalStack> - <Image Margin="1" Width="14" Height="14" Path="#Crow.Icons.file.svg"/> - <Label Text="{Name}" Width="Stretched"/> - </HorizontalStack> - </ListItem> - </ItemTemplate> - <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfosOrdered"> - <ListItem ContextCommands="{GetCommands}" - Selected="{/exp.Background=${ControlHighlight}}" - Unselected="{/exp.Background=Transparent}"> - <Expandable Name="exp" Caption="{Name}" MouseDoubleClick="/onClickForExpand"> - <Template> - <VerticalStack> - <Border CornerRadius="2" Margin="0" Height="Fit" MouseDoubleClick="./onClickForExpand" - Foreground="Transparent" - MouseEnter="{Foreground=DimGrey}" - MouseLeave="{Foreground=Transparent}"> - <HorizontalStack Background="{./Background}" Spacing="1"> - <Image Margin="1" Width="9" Height="9" Focusable="true" MouseDown="./onClickForExpand" - Path="{./Image}" - Visible="{./IsExpandable}" - SvgSub="{./IsExpanded}" - MouseEnter="{Background=LightGrey}" - MouseLeave="{Background=Transparent}"/> - <Image Margin="1" Width="16" Height="16" - Path="#Crow.Icons.folder.svg" SvgSub="{./IsExpanded}"/> - <Label Text="{./Caption}"/> - </HorizontalStack> - </Border> - <Container Name="Content" Visible="false"/> - </VerticalStack> - </Template> - <HorizontalStack Height="Fit"> - <Widget Width="12" Height="10"/> - <VerticalStack Height="Fit" Name="ItemsContainer"/> - </HorizontalStack> - </Expandable> - </ListItem> - </ItemTemplate> - </TreeView> - </Template> - </DirectoryView> - </VerticalStack> - <VerticalStack Name="DebugLogger" Margin="5" IsVisible="false" Background="Onyx"> - <HorizontalStack Height="Fit"> - <Image Width="30" Height="20" Path="#Crow.Icons.IconAlerte.svg" Visible="{../../../../dbgIfaceWidget.CrowDebuggerNOK}"/> - <Label Fit="true" Text="Crow debug assembly path:"/> - <Widget Width="5" Height="5" Background="SeaGreen" IsVisible="{../../../../dbgIfaceWidget.HasFocus}"/> - <Widget Width="5" Height="5" Background="Yellow" IsVisible="{../../../../dbgIfaceWidget.IsHover}"/> - <TextBox Text="{²CrowDbgAssemblyLocation}" Margin="2"/> - </HorizontalStack> - <Label Background="Red" Foreground="White" Margin="5" Width="Stretched" Text="{../../../dbgIfaceWidget.CrowDebuggerErrorMessage}" - IsVisible="{../../../dbgIfaceWidget.CrowDebuggerNOK}"/> - <HorizontalStack Height="Fit" Width="Stretched" Background="Onyx" Margin="5"> - <Label Text="Debug log output file:" Fit="true"/> - <TextBox Text="{²../../../../dbgIfaceWidget.DebugLogFilePath}" /> - <Button Command="{../../../../dbgIfaceWidget.CMDSelectDebugLogFilePath}"/> - </HorizontalStack> - <EnumSelector RadioButtonStyle="CheckBox2" Template="#Dbg.EnumSelector.template" - Background="Grey" - Caption="Recorded Events" EnumValue="{²RecordedEvents}" BitFieldExcludeMask="255" /> - <EnumSelector RadioButtonStyle="CheckBox2" Template="#Dbg.EnumSelector.template" - Background="Onyx" - Caption="Discarded Events" EnumValue="{²DiscardedEvents}" BitFieldExcludeMask="255" /> - <CheckBox Caption="Begin recording on startup" IsChecked="{²DebugLogOnStartup}" Background="Onyx"/> - <HorizontalStack Height="Fit"> - <CheckBox Caption="Recording" IsChecked="{²DebugLogRecording}" Height="40" Width="60" - Checked="{sh.Path='A 8,8,7.5,0,6.3 O 0.8,0,0,1 f O 0,0,0,0.5 G'}" - Unchecked="{sh.Path='R 0.5,0.5,15,15 f O 0,0,0,1 G'}"> - <Template> - <Border Background="Onyx" Margin="10" CornerRadius="5"> - <Shape Name="sh" Foreground="Grey" Size="16,16" Path="R 0.5,0.5,15,15 f O 0,0,0,1 G"/> - </Border> - </Template> - </CheckBox> - <Menu Data="{../../../../dbgIfaceWidget.LoggerCommands}" Height="Fit" Width="Stretched"> - <Template> - <Wrapper Orientation="Vertical" Name="ItemsContainer" Margin="0" Background="{./Background}"/> - </Template> - <ItemTemplate> - <Button Command="{}" Height="Fit" Width="Fit"/> - </ItemTemplate> - </Menu> - </HorizontalStack> - </VerticalStack> - </TabView> - <Splitter Width="6" /> - <VerticalStack> - <DebugInterfaceWidget Name="dbgIfaceWidget" Height="60%" Background="Black" Focusable="true" - CrowDbgAssemblyLocation="{²CrowDbgAssemblyLocation}" - Recording="{²DebugLogRecording}" - IMLSource="{Source}" - CurrentException="{²CurrentException}" - DiscardedEvents="{DiscardedEvents}" RecordedEvents="{RecordedEvents}"/> - <Splitter/> - <!--<TabView>--> - <VerticalStack Name="Editor" Spacing="0"> - <HorizontalStack Height="Fit"> - <Button Style="IcoButton" Command="{CMDNew}" /> - <Button Style="IcoButton" Command="{CMDSave}" /> - <Button Style="IcoButton" Command="{CMDSaveAs}" /> - <Button Style="IcoButton" Command="{CMDUndo}" /> - <Button Style="IcoButton" Command="{CMDRedo}" /> - <!--<Button Style="IcoButton" Command="{CMDCut}" /> - <Button Style="IcoButton" Command="{CMDCopy}" /> - <Button Style="IcoButton" Command="{CMDPaste}" />--> - <Widget Width="Stretched" /> - <Widget Background="Red" IsVisible="{DebugLogRecording}" CornerRadius="10" Width="12" Height="12"/> - </HorizontalStack> - - <HorizontalStack> - <Editor Name="tb" Text="{Source}" Multiline="true" Font="consolas, 12" Focusable="true" Height="Stretched" Width="Stretched" - TextChanged="onTextChanged" KeyDown="textView_KeyDown" ContextCommands="{EditorCommands}" - Foreground="DarkGrey" Background="White"/> - <!--SelectionChanged="onSelectedTextChanged"--> - <ScrollBar Value="{²../tb.ScrollY}" - LargeIncrement="{../tb.PageHeight}" SmallIncrement="1" - CursorRatio="{../tb.ChildHeightRatio}" Maximum="{../tb.MaxScrollY}" /> - </HorizontalStack> - <ScrollBar Style="HScrollBar" Value="{²../tb.ScrollX}" - LargeIncrement="{../tb.PageWidth}" SmallIncrement="1" - CursorRatio="{../tb.ChildWidthRatio}" Maximum="{../tb.MaxScrollX}" /> - <HorizontalStack Height="Fit" Spacing="10" Background="DarkGrey"> - <Widget Width="10" Height="10" Background="RoyalBlue" Visible="{IsDirty}"/> - <Label Text="{CurrentFile}" Width="Stretched"/> - <Widget Width="Stretched"/> - <Label Text="Line:" Foreground="Grey"/> - <Label Text="{../../tb.CurrentLine}" Margin="2"/> - <Label Text="Col:" Foreground="Grey"/> - <Label Text="{../../tb.CurrentColumn}" Margin="2"/> - </HorizontalStack> - <Popper IsVisible="{ShowError}" Background="Red"> - <Template> - <CheckBox IsChecked="{²./IsPopped}" MouseEnter="{IsChecked='true'}" MouseLeave="{IsChecked='false'}"> - <Template> - <Label Text="{CurrentExceptionMSG}" Background="Red" Foreground="White" Width="Stretched" Margin="2" - Multiline="true"/> - </Template> - </CheckBox> - </Template> - <Label Text="{CurrentException}" Background="DarkRed" Foreground="White" Width="Stretched" Margin="2" Multiline="true"/> - </Popper> - </VerticalStack> - - <!--</TabView>--> - </VerticalStack> - </HorizontalStack> -</VerticalStack>
\ No newline at end of file diff --git a/Samples/Directory.Build.props b/Samples/Directory.Build.props index ea8b31f3..3cdb4a64 100644 --- a/Samples/Directory.Build.props +++ b/Samples/Directory.Build.props @@ -2,7 +2,7 @@ <PropertyGroup> <TargetFrameworks>netcoreapp3.1</TargetFrameworks> <!--<TargetFrameworks>net5</TargetFrameworks>--> - <OutputType>Exe</OutputType> + <OutputType>WinExe</OutputType> <SolutionDir>$(MSBuildThisFileDirectory)..\</SolutionDir> <OutputPath>$(SolutionDir)build\$(Configuration)\</OutputPath> diff --git a/Samples/HelloWorld/HelloWorld.csproj b/Samples/HelloWorld/HelloWorld.csproj index 8186985d..7ceb582d 100644 --- a/Samples/HelloWorld/HelloWorld.csproj +++ b/Samples/HelloWorld/HelloWorld.csproj @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk"> + <ItemGroup> <EmbeddedResource Include="ui\**\*.*"> <LogicalName>HelloWorld.%(Filename)%(Extension)</LogicalName> diff --git a/Samples/PathPainter/Painter.cs b/Samples/PathPainter/Painter.cs deleted file mode 100644 index 3077aa09..00000000 --- a/Samples/PathPainter/Painter.cs +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (c) 2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com> -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) - -using Crow.Drawing; -using System.ComponentModel; - -namespace Crow -{ - public class Painter : ScrollingObject - { - #region CTOR - protected Painter () { } - public Painter (Interface iface, string style = null) : base (iface, style) { } - #endregion - - public class Point - { - public double X; - public double Y; - } - - public enum DrawMode - { - Select, - Lines, - Rect, - Arc, - } - DrawMode currentDrawMode = DrawMode.Select; - public DrawMode CurrentDrawMode { - get => currentDrawMode; - set { - if (value == currentDrawMode) - return; - currentDrawMode = value; - NotifyValueChanged ("CurrentDrawMode", currentDrawMode); - updateMouseCursor (); - } - } - - void updateMouseCursor () { - if (currentDrawMode == DrawMode.Select) - MouseCursor = MouseCursor.arrow; - else - MouseCursor = MouseCursor.crosshair; - } - - public double[] Zooms => new double[] { 0.5, 1.0, 2.0, 4.0, 8.0, 16.0 }; - - string path; - double strokeWidth; - Size size; - double zoom; - Fill shapeBackground, shapeForeground; - - [DefaultValue(1.0)] - public double Zoom { - get => zoom; - set { - if (zoom == value) - return; - zoom = value; - NotifyValueChangedAuto (zoom); - RegisterForGraphicUpdate (); - updateMaxScrolls (); - } - } - - /// <summary> - /// Path expression, for syntax see 'PathParser'. - /// </summary> - public string Path { - get { return path; } - set { - if (path == value) - return; - path = value; - contentSize = default (Size); - NotifyValueChangedAuto (path); - RegisterForGraphicUpdate (); - } - } - /// <summary> - /// Default stroke width, may be overriden by a 'S' command in the path string. - /// </summary> - /// <value>The width of the stoke.</value> - [DefaultValue (1.0)] - public double StrokeWidth { - get { return strokeWidth; } - set { - if (strokeWidth == value) - return; - strokeWidth = value; - contentSize = default (Size); - NotifyValueChangedAuto (strokeWidth); - RegisterForGraphicUpdate (); - } - } - /// <summary> - /// View box size in pixel - /// </summary> - [DefaultValue ("32,32")] - public Size Size { - get { return size; } - set { - if (size == value) - return; - size = value; - NotifyValueChangedAuto (size); - //RegisterForLayouting (LayoutingType.Sizing); - RegisterForGraphicUpdate (); - updateMaxScrolls (); - } - } - - [DefaultValue ("White")] - public virtual Fill ShapeBackground { - get => shapeBackground; - set { - if (shapeBackground == value) - return; - shapeBackground = value; - NotifyValueChangedAuto (shapeBackground); - RegisterForRedraw (); - } - } - [DefaultValue ("Black")] - public virtual Fill ShapeForeground { - get => shapeForeground; - set { - if (shapeForeground == value) - return; - shapeForeground = value; - NotifyValueChangedAuto (shapeForeground); - RegisterForRedraw (); - } - } - - public override void OnLayoutChanges (LayoutingType layoutType) { - base.OnLayoutChanges (layoutType); - - if (layoutType == LayoutingType.Height) - NotifyValueChanged ("PageHeight", Slot.Height); - else if (layoutType == LayoutingType.Width) - NotifyValueChanged ("PageWidth", Slot.Width); - else - return; - updateMaxScrolls (); - } - public override void onMouseEnter (object sender, MouseMoveEventArgs e) { - base.onMouseEnter (sender, e); - updateMouseCursor (); - } - protected override void onDraw (Context gr) { - base.onDraw (gr); - - if (string.IsNullOrEmpty (path)) - return; - - Rectangle cr = ClientRectangle; - - gr.Save (); - gr.Translate (-ScrollX, -ScrollY); - gr.Scale (Zoom, Zoom); - - Rectangle r = new Rectangle (cr.Position, size); - shapeBackground.SetAsSource (IFace, gr); - gr.Rectangle (r); - gr.Fill (); - - gr.LineWidth = strokeWidth; - ShapeForeground.SetAsSource (IFace, gr, cr); - - using (PathParser parser = new PathParser (path)) - parser.Draw (gr); - - gr.Restore (); - } - - public override void onMouseWheel (object sender, MouseWheelEventArgs e) { - if (e.Delta > 0) - Zoom *= 2.0; - else - Zoom /= 2.0; - e.Handled = true; - base.onMouseWheel (sender, e); - } - - void updateMaxScrolls () { - Rectangle cb = ClientRectangle; - Size scalledSize = size * Zoom; - - MaxScrollX = scalledSize.Width - cb.Width; - if (scalledSize.Width > 0) - NotifyValueChanged ("ChildWidthRatio", (double)cb.Width / scalledSize.Width); - - MaxScrollY = scalledSize.Height - cb.Height; - if (scalledSize.Height > 0) - NotifyValueChanged ("ChildHeightRatio", (double)cb.Height / scalledSize.Height); - } - } -} diff --git a/Samples/PathPainter/PathPainter.csproj b/Samples/PathPainter/PathPainter.csproj deleted file mode 100644 index 173ecf80..00000000 --- a/Samples/PathPainter/PathPainter.csproj +++ /dev/null @@ -1,7 +0,0 @@ -<Project Sdk="Microsoft.NET.Sdk"> - <ItemGroup> - <EmbeddedResource Include="ui\**\*.*"> - <LogicalName>ui.%(Filename)%(Extension)</LogicalName> - </EmbeddedResource> - </ItemGroup> -</Project> diff --git a/Samples/PathPainter/Program.cs b/Samples/PathPainter/Program.cs deleted file mode 100644 index 257817ea..00000000 --- a/Samples/PathPainter/Program.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Crow; -using System; -using Samples; - -namespace PathPainter -{ - class Program : SampleBase - { - static void Main (string[] args) { - using (Program app = new Program ()) - app.Run (); - } - - protected override void OnInitialized () { - base.OnInitialized (); - Load ("#ui.main.crow").DataSource = this; - } - string currentPath = "M 5.5,0.5 L 10.5,10.5 L 0.5,10.5 Z F"; - int currentSize = 11; - double zoom = 1.0; - double strokeWidth = 1.0; - Color foreground = Colors.Black; - Color background = Colors.White; - - public Measure DesignSize => (int)(zoom * currentSize); - - public double StrokeWidth { - get => strokeWidth; - set { - if (strokeWidth == value) - return; - strokeWidth = value; - NotifyValueChanged (strokeWidth); - } - } - public string CurrentPath { - get => currentPath; - set { - if (currentPath == value) - return; - currentPath = value; - NotifyValueChanged (currentPath); - } - } - public Size Size => new Size (currentSize); - public int CurrentSize { - get => currentSize; - set { - if (currentSize == value) - return; - currentSize = value; - NotifyValueChanged (currentSize); - NotifyValueChanged ("Size", (object)new Size (currentSize)); - NotifyValueChanged ("CurrentPath", (object)CurrentPath); - } - } - public Color Foreground { - get => foreground; - set { - if (foreground == value) - return; - foreground = value; - NotifyValueChanged (foreground); - } - } - public Color Background { - get => background; - set { - if (background == value) - return; - background = value; - NotifyValueChanged (background); - } - } - - } -} diff --git a/Samples/PathPainter/ui/Icons/Lines.svg b/Samples/PathPainter/ui/Icons/Lines.svg deleted file mode 100644 index 9fb54c4b..00000000 --- a/Samples/PathPainter/ui/Icons/Lines.svg +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generated by IcoMoon.io --> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> -<path fill="#dddddd" d="M1 11.9l-1 4.1 4.1-1 9.2-9.2-3.1-3.1-9.2 9.2zM1.5 15l-0.4-0.5 0.4-2 2 2-2 0.5zM10.9 4.4l-8.1 8-0.6-0.6 8.1-8 0.6 0.6z"></path> -<path fill="#dddddd" d="M15.3 0.7c-1.1-1.1-2.6-0.5-2.6-0.5l-1.5 1.5 3.1 3.1 1.5-1.5c0-0.1 0.6-1.5-0.5-2.6zM13.4 1.6l-0.5-0.5c0.6-0.6 1.1-0.1 1.1-0.1l-0.6 0.6z"></path> -</svg> diff --git a/Samples/PathPainter/ui/Icons/Rect.svg b/Samples/PathPainter/ui/Icons/Rect.svg deleted file mode 100644 index d7d1dc8a..00000000 --- a/Samples/PathPainter/ui/Icons/Rect.svg +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generated by IcoMoon.io --> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> -<path fill="#dddddd" d="M15 1h-14v14h14v-14zM14 14h-12v-12h12v12z"></path> -</svg> diff --git a/Samples/PathPainter/ui/Icons/Select.svg b/Samples/PathPainter/ui/Icons/Select.svg deleted file mode 100644 index 605c0e28..00000000 --- a/Samples/PathPainter/ui/Icons/Select.svg +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generated by IcoMoon.io --> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> -<path fill="#dddddd" d="M11.6 5c-0.2 0-0.5 0-0.6 0 0-0.2-0.2-0.6-0.4-0.8s-0.6-0.4-1.1-0.4c-0.2 0-0.4 0-0.6 0.1-0.1-0.2-0.2-0.3-0.3-0.5-0.2-0.2-0.5-0.4-1.1-0.4-0.2 0-0.4 0-0.5 0.1v-1.7c0-0.6-0.4-1.4-1.4-1.4-0.4 0-0.8 0.2-1.1 0.4-0.5 0.6-0.5 1.4-0.5 1.4v4.3c-0.6 0.1-1.1 0.3-1.4 0.6-0.6 0.7-0.6 1.6-0.6 2.8 0 0.2 0 0.5 0 0.7 0 1.4 0.7 2.1 1.4 2.8l0.3 0.4c1.3 1.2 2.4 1.6 5.1 1.6 2.9 0 4.2-1.6 4.2-5.1v-2.5c0-0.7-0.2-2.1-1.4-2.4zM12 7.4v2.6c0 3.4-1.3 4.1-3.2 4.1-2.4 0-3.3-0.3-4.3-1.3-0.1-0.1-0.2-0.2-0.4-0.4-0.7-0.8-1.1-1.2-1.1-2.2 0-0.2 0-0.5 0-0.7 0-1 0-1.7 0.3-2.1 0.1-0.1 0.4-0.2 0.7-0.2v0.5l-0.3 1.5c0 0.1 0 0.1 0.1 0.2s0.2 0 0.2 0l1-1.2c0-0.1 0-0.2 0-0.2v-6.2c0-0.1 0-0.5 0.2-0.7 0.1 0 0.2-0.1 0.4-0.1 0.3 0 0.4 0.3 0.4 0.4v3.1c0 0 0 0 0 0v1.2c0 0.3 0.2 0.6 0.5 0.6s0.5-0.3 0.5-0.5v-1.3c0 0 0 0 0 0 0-0.1 0.1-0.5 0.5-0.5 0.3 0 0.5 0.1 0.5 0.4v1.3c0 0.3 0.2 0.6 0.5 0.6s0.5-0.3 0.5-0.5v-0.7c0-0.1 0.1-0.3 0.5-0.3 0.2 0 0.3 0.1 0.3 0.1 0.2 0.1 0.2 0.4 0.2 0.4v0.8c0 0.3 0.2 0.5 0.4 0.5 0.3 0 0.5-0.1 0.5-0.4 0-0.1 0.1-0.2 0.2-0.3 0 0 0.1 0 0.2 0 0.6 0.2 0.7 1.2 0.7 1.5 0-0.1 0-0.1 0 0z"></path> -</svg> diff --git a/Samples/PathPainter/ui/Painter.style b/Samples/PathPainter/ui/Painter.style deleted file mode 100644 index 02ad3e34..00000000 --- a/Samples/PathPainter/ui/Painter.style +++ /dev/null @@ -1,3 +0,0 @@ -DrawModeStyle { - Template="#polytest.ui.iconCheckBox.template"; -}
\ No newline at end of file diff --git a/Samples/PathPainter/ui/Spinner.template b/Samples/PathPainter/ui/Spinner.template deleted file mode 100644 index b4baf524..00000000 --- a/Samples/PathPainter/ui/Spinner.template +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<VerticalStack> - <Label Text="{./Caption}"/> - <Border Style="ControlBorder" Background="{./Background}" CornerRadius="{./CornerRadius}"> - <HorizontalStack Spacing="1"> - <TextBox Style="ControlEditableText" Foreground="{./Foreground}" Font="{./Font}" Width="Stretched" - Text="{²./Value}" TextAlignment="Right" /> - <VerticalStack Width="16" Height="Stretched" Spacing="0" Margin="0"> - <Shape KeepProportions="false" Margin="1" Style="ArrowBut" Height="50%" MouseDown="./onUp" Size="10,10" Path="M 4.5,0.5 L 9.5,9.5 L 0.5,9.5 Z F"/> - <Shape KeepProportions="false" Margin="1" Style="ArrowBut" Height="50%" MouseDown="./onDown" Size="10,10" Path="M 0.5,0.5 L 9.5,0.5 L 4.5,9.5 Z F"/> - </VerticalStack> - </HorizontalStack> - </Border> -</VerticalStack>
\ No newline at end of file diff --git a/Samples/PathPainter/ui/colorSelector.template b/Samples/PathPainter/ui/colorSelector.template deleted file mode 100644 index cc12a623..00000000 --- a/Samples/PathPainter/ui/colorSelector.template +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<CheckBox Caption="{./Caption}" IsChecked="{²./IsPopped}" Foreground="{./Foreground}" Background="{./Background}"> - <Template> - <Border Style="ControlBorder" CornerRadius="{./CornerRadius}"> - <HorizontalStack Spacing="10" Margin="5"> - <Label Style="ControlCaption" Text="{./Caption}" /> - <Border Foreground="White" Width="30" Height="20" Background="{./Background}" CornerRadius="5"/> - </HorizontalStack> - </Border> - </Template> -</CheckBox>
\ No newline at end of file diff --git a/Samples/PathPainter/ui/main.crow b/Samples/PathPainter/ui/main.crow deleted file mode 100644 index bb0a6297..00000000 --- a/Samples/PathPainter/ui/main.crow +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0"?> -<HorizontalStack Background="DarkGrey" > - <VerticalStack> - <HorizontalStack Height="Fit"> - <EnumSelector Fit="true" Caption="Draw Mode" EnumValue="{²../../painter.CurrentDrawMode}" /> - <ComboBox Data="{../../painter.Zooms}" SelectedItem="{²../../painter.Zoom}" Width="60"/> - </HorizontalStack> - <HorizontalStack> - <Border Foreground="Black" Width="Stretched" Height="Stretched" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top"> - <Painter Name="painter" ShapeForeground="{Foreground}" ShapeBackground="{Background}" - Zoom="1" - Size="{Size}" Path="{²CurrentPath}" StrokeWidth="{StrokeWidth}"/> - </Border> - <ScrollBar Value="{²../painter.ScrollY}" - LargeIncrement="{../painter.PageHeight}" SmallIncrement="1" - CursorRatio="{../painter.ChildHeightRatio}" Maximum="{../painter.MaxScrollY}" /> - </HorizontalStack> - <ScrollBar Style="HScrollBar" Value="{²../painter.ScrollX}" - LargeIncrement="{../painter.PageWidth}" SmallIncrement="1" - CursorRatio="{../painter.ChildWidthRatio}" Maximum="{../painter.MaxScrollX}" /> - </VerticalStack> - <Splitter/> - <VerticalStack Margin="2" Spacing="2"> - <TextBox Width="Stretched" Text="{²CurrentPath}"/> - <HorizontalStack Height="Fit"> - <Spinner Caption="Stroke Width" SmallIncrement="0.1" LargeIncrement="0.5" Value="{²StrokeWidth}" Width="Fit" Template="#ui.Spinner.template"/> - <Spinner Caption="Size" Value="{²CurrentSize}" Width="Fit" Template="#ui.Spinner.template"/> - <Popper Caption="Foreground" Background="{Foreground}" Fit="True" Template="#ui.colorSelector.template"> - <ColorPicker CurrentColor="{²Foreground}" Background="Onyx" Width="{../PopWidth}"/> - </Popper> - <Popper Caption="Background" Background="{Background}" Fit="True" Template="#ui.colorSelector.template"> - <ColorPicker CurrentColor="{²Background}" Background="Onyx" Width="{../PopWidth}"/> - </Popper> - </HorizontalStack> - <Group Height="200" Background="Jet"> - <Shape Left="23" Top="9" Margin="0" Width="16" Height="16" Foreground="{Foreground}" Background="{Background}" Size="{Size}" Path="{CurrentPath}" StrokeWidth="{StrokeWidth}"/> - <Shape Left="17" Top="31" Margin="0" Width="32" Height="32" Foreground="{Foreground}" Background="{Background}" Size="{Size}" Path="{CurrentPath}" StrokeWidth="{StrokeWidth}"/> - <Shape Left="65" Top="1" Margin="0" Width="64" Height="64" Foreground="{Foreground}" Background="{Background}" Size="{Size}" Path="{CurrentPath}" StrokeWidth="{StrokeWidth}"/> - <Shape Left="1" Top="66" Margin="0" Width="128" Height="128" Foreground="{Foreground}" Background="{Background}" Size="{Size}" Path="{CurrentPath}" StrokeWidth="{StrokeWidth}"/> - </Group> - - </VerticalStack> -</HorizontalStack> diff --git a/Samples/PerfTests/Program.cs b/Samples/PerfTests/Program.cs index dddf30ba..fabf4b45 100644 --- a/Samples/PerfTests/Program.cs +++ b/Samples/PerfTests/Program.cs @@ -161,10 +161,15 @@ namespace PerfTests writer.WriteLine ("Path;MinEllapsed;MaxEllapsed;MeanEllapsed;MedianEllapsed;sigmaEllapsed;MinMem;MaxMem;MeanMem;MedianMem;sigmaMem;MinAlloc;MaxAlloc;MeanAlloc;MedianAlloc;sigmaAlloc"); } - if (screenOutput) + if (screenOutput) { + initBackend (); initSurface (); - else - surf = CreateSurface (ClientRectangle.Width, ClientRectangle.Height); + } else { + SolidBackground = false; + initBackend (true); + + CreateMainSurface (ref clientRectangle); + } initDictionaries (); loadStyling (); @@ -519,7 +524,10 @@ namespace PerfTests else iface.PerformTests (); } - } catch (Exception) { + } catch (Exception e) { + Console.ForegroundColor = ConsoleColor.DarkRed; + Console.WriteLine (e); + Console.ResetColor (); } } } diff --git a/Samples/dockableWindows/dockableWindows.cs b/Samples/dockableWindows/dockableWindows.cs deleted file mode 100644 index 1dccc7b8..00000000 --- a/Samples/dockableWindows/dockableWindows.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Crow; -using Glfw; -using Samples; - -namespace tests -{ - public class BasicTests : SampleBase - { - static void Main () - { - using (BasicTests app = new BasicTests ()) { - app.SolidBackground = false; - app.Run (); - } - } - - Color[] colors = - { - Colors.Blue, - Colors.Red, - Colors.Green, - Colors.DarkOrchid, - Colors.DarkOrange, - Colors.DarkOliveGreen, - Colors.Cyan, - Colors.Chartreuse, - }; - DockStack mainStack; - protected override void OnInitialized () { - Load ("#ui.test.crow").DataSource = this; - mainStack = FindByName ("mainDock") as DockStack; - AddWidget (new DockWindow (this) { Background = Colors.Blue, Left = 10, Top = 110, Resizable = true, Caption = "win1" }); - AddWidget (new DockWindow (this) { Background = Colors.Red, Left = 30, Top = 130, Resizable = true, Caption = "win2" }); - AddWidget (new DockWindow (this) { Background = Colors.Green, Left = 50, Top = 150, Resizable = true, Caption = "win3" }); - AddWidget (new DockWindow (this) { Background = Colors.BurlyWood, Left = 70, Top = 170, Resizable = true, Caption = "win4" }); - AddWidget (new DockWindow (this) { Background = Colors.DarkOrchid, Left = 90, Top = 190, Resizable = true, Caption = "win5" }); - } - private void refreshGraphicTree (object sender, MouseButtonEventArgs e) { - NotifyValueChanged ("GraphicTree", (object)null); - NotifyValueChanged ("GraphicTree", GraphicTree); - } - int colorIdx = 0; - int nameIdx = 6; - public override bool OnKeyDown (Key key) { - if (colorIdx >= colors.Length) - colorIdx = 0; - switch (key) { - case Key.F6: - AddWidget (new DockWindow (this) { Background = colors[colorIdx++], Left = 90, Top = 190, Resizable = true, Caption = $"win{nameIdx++}" }); - return true; - case Key.F2: - Configuration.Global.Set<string> ("WindowConfigTest", mainStack.ExportConfig()); - return true; - case Key.F3: - mainStack.ImportConfig (Configuration.Global.Get<string> ("WindowConfigTest")); - return true; - default: - return base.OnKeyDown (key); - } - } - } -} diff --git a/Samples/dockableWindows/dockableWindows.csproj b/Samples/dockableWindows/dockableWindows.csproj deleted file mode 100644 index 3c9729fe..00000000 --- a/Samples/dockableWindows/dockableWindows.csproj +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project Sdk="Microsoft.NET.Sdk"> - <ItemGroup> - <EmbeddedResource Include="ui\*.*"> - <LogicalName>ui.%(Filename)%(Extension)</LogicalName> - </EmbeddedResource> - </ItemGroup> - <ItemGroup> - <EmbeddedResource Update="ui\GTreeExp.itemp"> - <LogicalName>ui.%(Filename)%(Extension)</LogicalName> - </EmbeddedResource> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/Samples/dockableWindows/ui/GTreeExp.itemp b/Samples/dockableWindows/ui/GTreeExp.itemp deleted file mode 100644 index f2a7c2ba..00000000 --- a/Samples/dockableWindows/ui/GTreeExp.itemp +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<Expandable IsExpanded="{²IsExpanded}" MouseDoubleClick="/onClickForExpand"> - <Template> - <VerticalStack> - <Border CornerRadius="2" Margin="0" Height="Fit" - Foreground="Transparent" - MouseEnter="{Foreground=DimGrey}" - MouseLeave="{Foreground=Transparent}"> - <HorizontalStack Spacing="1"> - <Image Margin="1" Width="9" Height="9" Focusable="true" MouseDown="./onClickForExpand" - Path="{./Image}" - Visible="{./IsExpandable}" - SvgSub="{./IsExpanded}" - MouseEnter="{Background=LightGrey}" - MouseLeave="{Background=Transparent}"/> - <Border Width="16" Height="16" Foreground="Black" Background="DimGrey"> - <Image Margin="2" Path="{GetIcon}" /> - </Border> - <Widget Width="5" Height="5" Background="Blue" Visible="{IsHover}"/> - <Widget Width="5" Height="5" Background="Green" Visible="{Visible}"/> - <Label Text="{Name}" Width="Fit"/> - <Label Text="{LogicalParent}" Width="Stretched" Foreground="Yellow"/> - </HorizontalStack> - </Border> - <Container Name="Content" Visible="false"/> - </VerticalStack> - </Template> - <HorizontalStack Height="Fit"> - <Widget Width="8" Height="10"/> - <VerticalStack Height="Fit" Name="ItemsContainer"/> - </HorizontalStack> -</Expandable> diff --git a/Samples/dockableWindows/ui/TabView.template b/Samples/dockableWindows/ui/TabView.template deleted file mode 100644 index 9490aa7f..00000000 --- a/Samples/dockableWindows/ui/TabView.template +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<VerticalStack Spacing="0" Background="{./Background}"> - <ListBox Data="{./Items}" Fit="true" HorizontalAlignment="Left" VerticalAlignment="Top" SelectedItem="{²./SelectedItem}"> - <Template> - <HorizontalStack Name="ItemsContainer" /> - </Template> - <ItemTemplate> - <!--<ListItem Fit="true" Background="Transparent" IsSelected="{IsVisible}" - Selected="{.DataSource.Visible='true'};{Background=.DataSource.Background}" - Unselected="{.DataSource.Visible='false'};{Background=Transparent}"> - <Label Text="{Caption}" Margin="5" /> - </ListItem>--> - <ListItem Fit="true" Background="Transparent" IsSelected="{IsVisible}" - Selected="{.DataSource.Visible='true'};{Background=.DataSource.Background}" - Unselected="{.DataSource.Visible='false'};{Background=Transparent}"> - <HorizontalStack Margin="2" > - <Label Text="{Caption}" Margin="3" /> - <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="10" Width="10" VerticalAlignment="Center" - MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}"> - <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Icons.exit2.svg" - MouseClick="onQuitPress"/> - </Border> - </HorizontalStack> - </ListItem> - </ItemTemplate> - </ListBox> - <VerticalStack> - <Group Name="ItemsContainer" /> - <Label DataSource="{../../../SelectedItem}" Text="{Caption}" Background="White" Foreground="Black"/> - </VerticalStack> -</VerticalStack> - diff --git a/Samples/dockableWindows/ui/dock.style b/Samples/dockableWindows/ui/dock.style deleted file mode 100644 index 49c7f03c..00000000 --- a/Samples/dockableWindows/ui/dock.style +++ /dev/null @@ -1,15 +0,0 @@ -DockStack { - Margin="0"; - Spacing="0"; - //Background="DimGrey"; -} -DockWindow { - Template="#ui.dockWin.template"; - AllowedStates="Normal|Maximized|Minimized"; - Width="260"; - Height="200"; -} -TabView { - Template="#ui.TabView.template"; - //Background="Onyx"; -}
\ No newline at end of file diff --git a/Samples/dockableWindows/ui/dockWin.template b/Samples/dockableWindows/ui/dockWin.template deleted file mode 100644 index 971be0c4..00000000 --- a/Samples/dockableWindows/ui/dockWin.template +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0"?> -<Border Name="SizeHandle" BorderWidth="1" Foreground="Black" CornerRadius="{./CornerRadius}" StickyMouse="8" StickyMouseEnabled="{./IsFloating}" - Background="{./Background}"> - <VerticalStack Spacing="0" Name="MoveHandle"> - <HorizontalStack Height="Fit" IsVisible="{./IsDocked}" Background="Black"> - <Label Text="{./Caption}"/> - <Label Text="{./CurrentState}" Margin="1" Foreground="Black" Background="Grey"/> - <Label Text="{./DockingPosition}"/> - <ListBox Data="{./DockCommands}" Fit="true"> - <Template> - <HorizontalStack Name="ItemsContainer" /> - </Template> - <ItemTemplate Path="#Crow.WindowButton.template"/> - </ListBox> - <ListBox Data="{./Commands}" Fit="true"> - <Template> - <HorizontalStack Name="ItemsContainer" /> - </Template> - <ItemTemplate Path="#Crow.WindowButton.template"/> - </ListBox> - </HorizontalStack> - <HorizontalStack Background="vgradient|0:0.5,0.6,0.5,0.5|1:0.2,0.3,0.3,0.7" - Name="hs" Margin="0" Spacing="0" Height="Fit" Visible="{./IsFloating}"> - <Widget Width="5"/> - <Image Margin="1" Width="10" Height="10" Path="{./Icon}"/> - <Label Text="{./Caption}"/> - <Label Text="{./CurrentState}" Margin="1" Foreground="Black" Background="Grey"/> - <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Left" Text="{./DockingPosition}" /> - <ListBox Data="{./DockCommands}" Fit="true"> - <Template> - <HorizontalStack Name="ItemsContainer" /> - </Template> - <ItemTemplate Path="#Crow.WindowButton.template"/> - </ListBox> - <ListBox Data="{./Commands}" Fit="true"> - <Template> - <HorizontalStack Name="ItemsContainer" /> - </Template> - <ItemTemplate Path="#Crow.WindowButton.template"/> - </ListBox> </HorizontalStack> - <Container Name="Content" MinimumSize="50,50"/> - </VerticalStack> -</Border> diff --git a/Samples/dockableWindows/ui/test.crow b/Samples/dockableWindows/ui/test.crow deleted file mode 100644 index 1e4e81e4..00000000 --- a/Samples/dockableWindows/ui/test.crow +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0"?> -<VerticalStack Background="DimGrey"> - <VerticalStack Name="Watches" Background="Black" Height="Fit" Width="Stretched"> - <HorizontalStack Height="Fit"> - <Label Style="smallLabel" Text="hover:" Width="50"/> - <Label Style="smallLabel" Text="{HoverWidget}"/> - </HorizontalStack> - <HorizontalStack Height="Fit"> - <Label Style="smallLabel" Text="focus:" Width="50"/> - <Label Style="smallLabel" Text="{FocusedWidget}"/> - </HorizontalStack> - <HorizontalStack Height="Fit"> - <Label Style="smallLabel" Text="active:" Width="50"/> - <Label Style="smallLabel" Text="{ActiveWidget}"/> - </HorizontalStack> - </VerticalStack> - <Label Text="Press 'F6' to add new windows, 'F2'/'F3' for save/restore"/> - <DockStack Name="mainDock" Height="Stretched" /> - <!--<Splitter/> - <Button Caption="Refresh tree" MouseClick="refreshGraphicTree"/> - <TreeView IsRoot="true" Name="treeView" Data="{GraphicTree}" Height="200"> - <ItemTemplate> - <Border Width="Stretched" Focusable="true" Foreground="Transparent"> - <HorizontalStack Spacing="5"> - <Widget Width="5" Height="5"/> - <Border Width="16" Height="16" Foreground="Black" Background="DimGrey"> - <Image Margin="2" Path="{GetIcon}" /> - </Border> - <Widget Width="2" Height="5" Background="Blue" Visible="{IsHover}"/> - <Widget Width="5" Height="5" Background="Green" Visible="{Visible}"/> - <Label Text="{Caption}" Width="Fit"/> - <Label Text="{Name}" Width="Fit"/> - <Label Text="{LogicalParent}" Width="Stretched" Foreground="Yellow"/> - </HorizontalStack> - </Border> - </ItemTemplate> - <ItemTemplate DataType="Crow.Group" Data="GetChildren" - Path="#ui.GTreeExp.itemp"/> - <ItemTemplate DataType="Crow.Container" Data="GetChildren" - Path="#ui.GTreeExp.itemp"/> - <ItemTemplate DataType="Crow.TemplatedContainer" Data="GetChildren" - Path="#ui.GTreeExp.itemp"/> - <ItemTemplate DataType="Crow.TemplatedGroup" Data="GetChildren" - Path="#ui.GTreeExp.itemp"/> - </TreeView>--> -</VerticalStack> diff --git a/Samples/dragNdrop/dragNdrop.cs b/Samples/dragNdrop/dragNdrop.cs deleted file mode 100644 index 29c22f28..00000000 --- a/Samples/dragNdrop/dragNdrop.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using Crow; -using Samples; -using Crow.Drawing; - -namespace tests -{ - public class BasicTests : SampleBase - { - static void Main () - { - using (BasicTests app = new BasicTests ()) { - app.Run (); - } - } - - protected override void OnInitialized () - { - Load ("#ui.test.crow").DataSource = this; - } - - private void refreshGraphicTree (object sender, MouseButtonEventArgs e) { - NotifyValueChanged ("GraphicTree", (object)null); - NotifyValueChanged ("GraphicTree", GraphicTree); - } - - Group startGroup = null; - - - private void W_StartDrag (object sender, DragDropEventArgs e) { - Rectangle r = e.DragSource.LastPaintedSlot; - startGroup = e.DragSource.Parent as Group; - if (e.DragSource.bmp == null) { - Console.WriteLine ($"DragSource surface is null: {e.DragSource}"); - return; - } - - Surface dragImg = CreateSurface (ref r); - using (Context gr = new Context(dragImg)) { - gr.SetSource (e.DragSource.bmp, 0, 0); - gr.Paint (); - } - CreateDragImage (dragImg, r); - /*lock (UpdateMutex) - startGroup.RemoveChild (e.DragSource);*/ - } - private void W_EndDrag (object sender, DragDropEventArgs e) { - lock (UpdateMutex) - startGroup.AddChild (e.DragSource); - ClearDragImage (); - } - - private void W_DragEnter (object sender, DragDropEventArgs e) { - lock (UpdateMutex) - (e.DropTarget as Group).AddChild (e.DragSource); - } - private void W_DragLeave (object sender, DragDropEventArgs e) { - lock (UpdateMutex) - (e.DragSource.Parent as Group).RemoveChild (e.DragSource); - } - private void W_Drop (object sender, DragDropEventArgs e) { - //(e.DropTarget as Group).AddChild (e.DragSource); - ClearDragImage (); - } - - - } -} diff --git a/Samples/dragNdrop/dragNdrop.csproj b/Samples/dragNdrop/dragNdrop.csproj deleted file mode 100644 index 9961c6b9..00000000 --- a/Samples/dragNdrop/dragNdrop.csproj +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project Sdk="Microsoft.NET.Sdk"> - <ItemGroup> - <EmbeddedResource Include="ui\*.*"> - <LogicalName>ui.%(Filename)%(Extension)</LogicalName> - </EmbeddedResource> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/Samples/dragNdrop/ui/GTreeExp.itemp b/Samples/dragNdrop/ui/GTreeExp.itemp deleted file mode 100644 index f2a7c2ba..00000000 --- a/Samples/dragNdrop/ui/GTreeExp.itemp +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<Expandable IsExpanded="{²IsExpanded}" MouseDoubleClick="/onClickForExpand"> - <Template> - <VerticalStack> - <Border CornerRadius="2" Margin="0" Height="Fit" - Foreground="Transparent" - MouseEnter="{Foreground=DimGrey}" - MouseLeave="{Foreground=Transparent}"> - <HorizontalStack Spacing="1"> - <Image Margin="1" Width="9" Height="9" Focusable="true" MouseDown="./onClickForExpand" - Path="{./Image}" - Visible="{./IsExpandable}" - SvgSub="{./IsExpanded}" - MouseEnter="{Background=LightGrey}" - MouseLeave="{Background=Transparent}"/> - <Border Width="16" Height="16" Foreground="Black" Background="DimGrey"> - <Image Margin="2" Path="{GetIcon}" /> - </Border> - <Widget Width="5" Height="5" Background="Blue" Visible="{IsHover}"/> - <Widget Width="5" Height="5" Background="Green" Visible="{Visible}"/> - <Label Text="{Name}" Width="Fit"/> - <Label Text="{LogicalParent}" Width="Stretched" Foreground="Yellow"/> - </HorizontalStack> - </Border> - <Container Name="Content" Visible="false"/> - </VerticalStack> - </Template> - <HorizontalStack Height="Fit"> - <Widget Width="8" Height="10"/> - <VerticalStack Height="Fit" Name="ItemsContainer"/> - </HorizontalStack> -</Expandable> diff --git a/Samples/dragNdrop/ui/test.crow b/Samples/dragNdrop/ui/test.crow deleted file mode 100644 index 026cb482..00000000 --- a/Samples/dragNdrop/ui/test.crow +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0"?> -<VerticalStack Background="Jet" Focusable="true"> - <VerticalStack Name="Watches" Background="Black" Height="Fit" Width="Stretched"> - <HorizontalStack Height="Fit"> - <Label Style="smallLabel" Text="hover:" Width="50"/> - <Label Style="smallLabel" Text="{HoverWidget}"/> - </HorizontalStack> - <HorizontalStack Height="Fit"> - <Label Style="smallLabel" Text="focus:" Width="50"/> - <Label Style="smallLabel" Text="{FocusedWidget}"/> - </HorizontalStack> - <HorizontalStack Height="Fit"> - <Label Style="smallLabel" Text="active:" Width="50"/> - <Label Style="smallLabel" Text="{ActiveWidget}"/> - </HorizontalStack> - </VerticalStack> - <HorizontalStack Margin="20" Name="zone1" Height="100" Width="Stretched" Background="Grey" AllowDrop="true" DragEnter="W_DragEnter" DragLeave="W_DragLeave"> - <Widget CacheEnabled="True" Name="w1" Background="Blue" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/> - <Widget CacheEnabled="True" Name="w2" Background="Red" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/> - <Widget CacheEnabled="True" Name="w3" Background="Green" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/> - <Widget CacheEnabled="True" Name="w4" Background="Yellow" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/> - <Widget CacheEnabled="True" Name="w5" Background="DimGrey" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/> - </HorizontalStack> - <Widget Height="20" Focusable="true"/> - <HorizontalStack Margin="20" Name="zone2" Height="150" Width="Stretched" Background="Grey" AllowDrop="true" DragEnter="W_DragEnter" DragLeave="W_DragLeave"> - </HorizontalStack> - <Widget Height="20"/> - <HorizontalStack Margin="20" Name="zone3" Height="80" Width="Stretched" Background="Grey" AllowDrop="true" DragEnter="W_DragEnter" DragLeave="W_DragLeave"> - </HorizontalStack> - <Button Caption="Refresh tree" MouseClick="refreshGraphicTree"/> - <TreeView IsRoot="true" Name="treeView" Data="{GraphicTree}"> - <ItemTemplate> - <Border Width="Stretched" Focusable="true" Foreground="Transparent"> - <HorizontalStack Spacing="5"> - <Widget Width="5" Height="5"/> - <Border Width="16" Height="16" Foreground="Black" Background="DimGrey"> - <Image Margin="2" Path="{GetIcon}" /> - </Border> - <Widget Width="2" Height="5" Background="Blue" Visible="{IsHover}"/> - <Widget Width="5" Height="5" Background="Green" Visible="{Visible}"/> - <Label Text="{Name}" Width="Fit"/> - <Label Text="{LogicalParent}" Width="Stretched" Foreground="Yellow"/> - </HorizontalStack> - </Border> - </ItemTemplate> - <ItemTemplate DataType="Crow.Group" Data="GetChildren" - Path="#ui.GTreeExp.itemp"/> - <ItemTemplate DataType="Crow.Container" Data="GetChildren" - Path="#ui.GTreeExp.itemp"/> - <ItemTemplate DataType="Crow.TemplatedContainer" Data="GetChildren" - Path="#ui.GTreeExp.itemp"/> - <ItemTemplate DataType="Crow.TemplatedGroup" Data="GetChildren" - Path="#ui.GTreeExp.itemp"/> - </TreeView> -</VerticalStack>
\ No newline at end of file diff --git a/Samples/main.cs b/Samples/main.cs deleted file mode 100644 index 46a89038..00000000 --- a/Samples/main.cs +++ /dev/null @@ -1,564 +0,0 @@ -using System; -using System.Numerics; -using System.Runtime.InteropServices; -using Glfw; -using VK; -using CVKL; -using System.Threading; - -namespace pbrSachaWillem { - class Program : VkWindow, Crow.IValueChange { - static void Main (string[] args) { - using (Program vke = new Program ()) { - vke.Run (); - } - } - bool isRunning; - - protected override void render () { - int idx = swapChain.GetNextImage (); - - lock (crow.RenderMutex) { - if (idx < 0) { - OnResize (); - return; - } - - presentQueue.Submit (cmds[idx], swapChain.presentComplete, drawComplete[idx]); - presentQueue.Present (swapChain, drawComplete[idx]); - presentQueue.WaitIdle (); - } - } - - #region crow - - void crow_thread_func () { - vkvgDev = new vkvg.Device (instance.Handle, phy.Handle, dev.VkDev.Handle, presentQueue.qFamIndex, - vkvg.SampleCount.Sample_4, presentQueue.index); - - crow = new Crow.Interface (vkvgDev, 800, 600); - - isRunning = true; - //int frameCount = 0; - - while (isRunning) { - crow.Update (); - - /*if (frameCount++ > 100) { - for (int i = 0; i < crow.PerfMeasures.Count; i++) - crow.PerfMeasures[i].NotifyChanges (); - frameCount = 0; - }*/ - - Thread.Sleep (2); - } - dev.WaitIdle (); - crow.Dispose (); - vkvgDev.Dispose (); - } - - #region IValueChange implementation - public event EventHandler<Crow.ValueChangeEventArgs> ValueChanged; - public virtual void NotifyValueChanged(string MemberName, object _value) - { - if (ValueChanged != null) - ValueChanged.Invoke(this, new Crow.ValueChangeEventArgs(MemberName, _value)); - } - #endregion - - public float Gamma { - get { return pbrPipeline.matrices.gamma; } - set { - if (value == pbrPipeline.matrices.gamma) - return; - pbrPipeline.matrices.gamma = value; - NotifyValueChanged ("Gamma", value); - updateViewRequested = true; - } - } - public float Exposure { - get { return pbrPipeline.matrices.exposure; } - set { - if (value == pbrPipeline.matrices.exposure) - return; - pbrPipeline.matrices.exposure = value; - NotifyValueChanged ("Exposure", value); - updateViewRequested = true; - } - } - Crow.Interface crow; - #endregion - - protected override void configureEnabledFeatures (VkPhysicalDeviceFeatures available_features, ref VkPhysicalDeviceFeatures features) { - base.configureEnabledFeatures (available_features, ref features); -#if PIPELINE_STATS - features.pipelineStatisticsQuery = true; -#endif - features.samplerAnisotropy = true; - } - - VkSampleCountFlags samples = VkSampleCountFlags.SampleCount4; - - Framebuffer[] frameBuffers; - PBRPipeline pbrPipeline; - - enum DebugView { - none, - color, - normal, - occlusion, - emissive, - metallic, - roughness - } - - DebugView currentDebugView = DebugView.none; - -#if PIPELINE_STATS - PipelineStatisticsQueryPool statPool; - TimestampQueryPool timestampQPool; - ulong[] results; -#endif - - - bool queryUpdatePrefilCube, showDebugImg, showUI = true; - - - Image uiImage; - - #region ui - //DescriptorSet dsDebugImg; - //void initDebugImg () { - // dsDebugImg = descriptorPool.Allocate (descLayoutMain); - // pbrPipeline.envCube.debugImg.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal; - // DescriptorSetWrites uboUpdate = new DescriptorSetWrites (dsDebugImg, descLayoutMain); - // uboUpdate.Write (dev, pbrPipeline.envCube.debugImg.Descriptor); - //} - - vkvg.Device vkvgDev; - - Pipeline uiPipeline; - - void initUIPipeline () { - GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, samples, false); - cfg.RenderPass = pbrPipeline.RenderPass; - cfg.Layout = pbrPipeline.Layout; - cfg.AddShader (VkShaderStageFlags.Vertex, "shaders/FullScreenQuad.vert.spv"); - cfg.AddShader (VkShaderStageFlags.Fragment, "shaders/simpletexture.frag.spv"); - cfg.blendAttachments[0] = new VkPipelineColorBlendAttachmentState (true); - - uiPipeline = new GraphicPipeline (cfg); - - } - void initUISurface () { - lock (crow.UpdateMutex) { - uiImage?.Dispose (); - uiImage = new CVKL.Image (dev, new VkImage ((ulong)crow.surf.VkImage.ToInt64 ()), VkFormat.B8g8r8a8Unorm, - VkImageUsageFlags.Sampled, swapChain.Width, swapChain.Height); - uiImage.SetName ("uiImage"); - uiImage.CreateView (VkImageViewType.ImageView2D, VkImageAspectFlags.Color); - uiImage.CreateSampler (VkFilter.Nearest, VkFilter.Nearest, VkSamplerMipmapMode.Nearest, VkSamplerAddressMode.ClampToBorder); - uiImage.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal; - } - } - - - void recordDrawOverlay (CommandBuffer cmd) { - uiPipeline.Bind (cmd); - - uiImage.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.ColorAttachmentOptimal, VkImageLayout.ShaderReadOnlyOptimal, - VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.FragmentShader); - - cmd.Draw (3, 1, 0, 0); - - uiImage.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.ShaderReadOnlyOptimal, VkImageLayout.ColorAttachmentOptimal, - VkPipelineStageFlags.FragmentShader, VkPipelineStageFlags.BottomOfPipe); - - //if (!showDebugImg) - // return; - //const uint debugImgSize = 256; - //const uint debugImgMargin = 10; - - //cmd.BindDescriptorSet (uiPipeline.Layout, dsDebugImg); - - //cmd.SetViewport (debugImgSize, debugImgSize, debugImgMargin, swapChain.Height - debugImgSize - debugImgMargin); - //cmd.SetScissor (debugImgSize, debugImgSize, (int)debugImgMargin, (int)(swapChain.Height - debugImgSize - debugImgMargin)); - - //cmd.Draw (3, 1, 0, 0); - } - #endregion - - - Vector4 lightPos = new Vector4 (1, 0, 0, 0); - BoundingBox modelAABB; - - Program () { - camera.SetPosition (0, 0, 5); - - Thread crowThread = new Thread (crow_thread_func); - crowThread.IsBackground = true; - crowThread.Start (); - - while (crow == null) - Thread.Sleep (5); - - initUISurface (); - - pbrPipeline = new PBRPipeline (presentQueue, - new RenderPass (dev, swapChain.ColorFormat, dev.GetSuitableDepthFormat (), samples), uiImage); - - initUIPipeline (); - - modelAABB = pbrPipeline.model.DefaultScene.AABB; - - crow.Load ("ui/fps.crow").DataSource = this; - //crow.Load ("#vkvgCrowTest.perfMeasures.crow").DataSource = crow; - - //crow.LoadIMLFragment ("<Window Height='200' Width='200' CornerRadius='5'/>").DataSource=this; - //crow.LoadIMLFragment ("<Window Height='200' Width='200'/>").DataSource = this; - crow.LoadIMLFragment (@"<Image Margin='1' Path='/mnt/devel/gts/vk.net/crow/Images/crow.png' Width='100' Height='100' Background='White' MouseEnter='{Background=Blue}' MouseLeave='{Background=White}'/>"); - //crow.LoadIMLFragment ("<Window Height='200' Width='200'/>").DataSource = this; - UpdateFrequency = 20; - } - - void buildCommandBuffers () { - for (int i = 0; i < swapChain.ImageCount; ++i) { - cmds[i]?.Free (); - cmds[i] = cmdPool.AllocateAndStart (); -#if PIPELINE_STATS - statPool.Begin (cmds[i]); - recordDraw (cmds[i], frameBuffers[i]); - statPool.End (cmds[i]); -#else - recordDraw (cmds[i], frameBuffers[i]); -#endif - - cmds[i].End (); - } - } - void recordDraw (CommandBuffer cmd, Framebuffer fb) { - pbrPipeline.RenderPass.Begin (cmd, fb); - - cmd.SetViewport (fb.Width, fb.Height); - cmd.SetScissor (fb.Width, fb.Height); - - pbrPipeline.RecordDraw (cmd); - - if (showUI) - recordDrawOverlay (cmd); - - pbrPipeline.RenderPass.End (cmd); - } - - - #region update - public override void UpdateView () { - camera.AspectRatio = (float)swapChain.Width / swapChain.Height; - - pbrPipeline.matrices.lightDir = lightPos; - pbrPipeline.matrices.projection = camera.Projection; - pbrPipeline.matrices.view = camera.View; - pbrPipeline.matrices.model = camera.Model; - - - pbrPipeline.matrices.camPos = new Vector4 ( - -camera.Position.Z * (float)Math.Sin (camera.Rotation.Y) * (float)Math.Cos (camera.Rotation.X), - camera.Position.Z * (float)Math.Sin (camera.Rotation.X), - camera.Position.Z * (float)Math.Cos (camera.Rotation.Y) * (float)Math.Cos (camera.Rotation.X), - 0 - ); - pbrPipeline.matrices.debugViewInputs = (float)currentDebugView; - - pbrPipeline.uboMats.Update (pbrPipeline.matrices, (uint)Marshal.SizeOf<PBRPipeline.Matrices> ()); - - updateViewRequested = false; - } - - int frameCount = 0; - - public override void Update () { -#if PIPELINE_STATS - results = statPool.GetResults (); -#endif - camera.Model *= Matrix4x4.CreateRotationY(0.05f); - updateViewRequested = true; - - if (rebuildBuffers) { - buildCommandBuffers (); - rebuildBuffers = false; - } - - if (++frameCount > 20) { - NotifyValueChanged ("fps", fps); - frameCount = 0; - } - } - #endregion - - - protected override void OnResize () { - crow.ProcessResize (new Crow.Rectangle (0,0,(int)swapChain.Width, (int)swapChain.Height)); - - initUISurface (); - - uiImage.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal; - DescriptorSetWrites uboUpdate = new DescriptorSetWrites (pbrPipeline.dsMain, pbrPipeline.Layout.DescriptorSetLayouts[0].Bindings[5]); - uboUpdate.Write (dev, uiImage.Descriptor); - - UpdateView (); - - if (frameBuffers != null) - for (int i = 0; i < swapChain.ImageCount; ++i) - frameBuffers[i]?.Dispose (); - - frameBuffers = new Framebuffer[swapChain.ImageCount]; - - for (int i = 0; i < swapChain.ImageCount; ++i) { - frameBuffers[i] = new Framebuffer (pbrPipeline.RenderPass, swapChain.Width, swapChain.Height, - (pbrPipeline.RenderPass.Samples == VkSampleCountFlags.SampleCount1) ? new Image[] { - swapChain.images[i], - null - } : new Image[] { - null, - null, - swapChain.images[i] - }); - } - - buildCommandBuffers (); - } - - #region Mouse and keyboard - protected override void onMouseMove (double xPos, double yPos) { - if (crow.ProcessMouseMove ((int)xPos, (int)yPos)) - return; - - double diffX = lastMouseX - xPos; - double diffY = lastMouseY - yPos; - if (MouseButton[0]) { - camera.Rotate ((float)-diffX, (float)-diffY); - } else if (MouseButton[1]) { - camera.SetZoom ((float)diffY); - } else - return; - - updateViewRequested = true; - } - protected override void onMouseButtonDown (Glfw.MouseButton button) { - if (crow.ProcessMouseButtonDown ((Crow.MouseButton)button)) - return; - base.onMouseButtonDown (button); - } - protected override void onMouseButtonUp (Glfw.MouseButton button) { - if (crow.ProcessMouseButtonUp ((Crow.MouseButton)button)) - return; - base.onMouseButtonUp (button); - } - - protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) { - switch (key) { - case Key.F: - if (modifiers.HasFlag (Modifier.Shift)) { - pbrPipeline.envCube.debugFace--; - if (pbrPipeline.envCube.debugFace < 0) - pbrPipeline.envCube.debugFace = 5; - } else { - pbrPipeline.envCube.debugFace++; - if (pbrPipeline.envCube.debugFace > 5) - pbrPipeline.envCube.debugFace = 0; - } - queryUpdatePrefilCube = updateViewRequested = true; - break; - case Key.M: - if (modifiers.HasFlag (Modifier.Shift)) { - pbrPipeline.envCube.debugMip--; - if (pbrPipeline.envCube.debugMip < 0) - pbrPipeline.envCube.debugMip = (int)pbrPipeline.envCube.prefilterCube.CreateInfo.mipLevels - 1; - } else { - pbrPipeline.envCube.debugMip++; - if (pbrPipeline.envCube.debugMip > pbrPipeline.envCube.prefilterCube.CreateInfo.mipLevels) - pbrPipeline.envCube.debugMip = 0; - } - queryUpdatePrefilCube = updateViewRequested = true; - break; - case Key.P: - showDebugImg = !showDebugImg; - queryUpdatePrefilCube = updateViewRequested = true; - break; - case Key.Keypad0: - currentDebugView = DebugView.none; - break; - case Key.Keypad1: - currentDebugView = DebugView.color; - break; - case Key.Keypad2: - currentDebugView = DebugView.normal; - break; - case Key.Keypad3: - currentDebugView = DebugView.occlusion; - break; - case Key.Keypad4: - currentDebugView = DebugView.emissive; - break; - case Key.Keypad5: - currentDebugView = DebugView.metallic; - break; - case Key.Keypad6: - currentDebugView = DebugView.roughness; - break; - case Key.Up: - if (modifiers.HasFlag (Modifier.Shift)) - lightPos -= Vector4.UnitZ; - else - camera.Move (0, 0, 1); - break; - case Key.Down: - if (modifiers.HasFlag (Modifier.Shift)) - lightPos += Vector4.UnitZ; - else - camera.Move (0, 0, -1); - break; - case Key.Left: - if (modifiers.HasFlag (Modifier.Shift)) - lightPos -= Vector4.UnitX; - else - camera.Move (1, 0, 0); - break; - case Key.Right: - if (modifiers.HasFlag (Modifier.Shift)) - lightPos += Vector4.UnitX; - else - camera.Move (-1, 0, 0); - break; - case Key.PageUp: - if (modifiers.HasFlag (Modifier.Shift)) - lightPos += Vector4.UnitY; - else - camera.Move (0, 1, 0); - break; - case Key.PageDown: - if (modifiers.HasFlag (Modifier.Shift)) - lightPos -= Vector4.UnitY; - else - camera.Move (0, -1, 0); - break; - case Key.F1: - showUI = !showUI; - rebuildBuffers = true; - break; - case Key.F2: - if (modifiers.HasFlag (Modifier.Shift)) - pbrPipeline.matrices.exposure -= 0.3f; - else - pbrPipeline.matrices.exposure += 0.3f; - break; - case Key.F3: - if (modifiers.HasFlag (Modifier.Shift)) - pbrPipeline.matrices.gamma -= 0.1f; - else - pbrPipeline.matrices.gamma += 0.1f; - break; - case Key.F4: - if (camera.Type == Camera.CamType.FirstPerson) - camera.Type = Camera.CamType.LookAt; - else - camera.Type = Camera.CamType.FirstPerson; - Console.WriteLine ($"camera type = {camera.Type}"); - break; - default: - base.onKeyDown (key, scanCode, modifiers); - return; - } - updateViewRequested = true; - } - #endregion - - #region dispose - protected override void Dispose (bool disposing) { - if (disposing) { - if (!isDisposed) { - dev.WaitIdle (); - - isRunning = false; - - for (int i = 0; i < swapChain.ImageCount; ++i) - frameBuffers[i]?.Dispose (); - - pbrPipeline.Dispose (); - - uiPipeline.Dispose (); - - uiImage?.Dispose (); - } - } - - base.Dispose (disposing); - } - #endregion - } -} - - - - - - - -// protected override void onKeyDown (Glfw.Key key, int scanCode, Modifier modifiers) { -// switch (key) { -// case Glfw.Key.F1: -// if (modifiers.HasFlag (Modifier.Shift)) -// pbrPipeline.matrices.exposure -= 0.3f; -// else -// pbrPipeline.matrices.exposure += 0.3f; -// break; -// case Glfw.Key.F2: -// if (modifiers.HasFlag (Modifier.Shift)) -// pbrPipeline.matrices.gamma -= 0.1f; -// else -// pbrPipeline.matrices.gamma += 0.1f; -// break; -// case Glfw.Key.F3: -// if (camera.Type == Camera.CamType.FirstPerson) -// camera.Type = Camera.CamType.LookAt; -// else -// camera.Type = Camera.CamType.FirstPerson; -// Console.WriteLine ($"camera type = {camera.Type}"); -// break; -// default: -// base.onKeyDown (key, scanCode, modifiers); -// return; -// } -// updateViewRequested = true; -// } -// #endregion - -// protected override void Dispose (bool disposing) { -// if (disposing) { -// if (!isDisposed) { -// dev.WaitIdle (); -// for (int i = 0; i < swapChain.ImageCount; ++i) -// frameBuffers[i]?.Dispose (); - -// pbrPipeline.Dispose (); - -// uiPipeline.Dispose (); -// descLayoutMain.Dispose (); -// descriptorPool.Dispose (); - -// uiImage.Dispose (); - -// crow.Dispose (); - -// vkvgDev.Dispose (); - - -// } -// } - -// base.Dispose (disposing); -// } - - -// } -//} diff --git a/Samples/testMSBuild/Program.cs b/Samples/testMSBuild/Program.cs deleted file mode 100644 index 87814739..00000000 --- a/Samples/testMSBuild/Program.cs +++ /dev/null @@ -1,370 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using Microsoft.Build.Construction; -using Microsoft.Build.Evaluation; -using Microsoft.Build.Execution; -using Microsoft.Build.Framework; - -namespace testMSBuild -{ - class Program - { - - //const string msbuildRoot = "/usr/lib/mono/msbuild/Current/bin/"; - const string msbuildRoot = "/usr/share/dotnet/sdk/3.1.101/"; - //const string msbuildRoot = "/mnt/data/src/microsoft/msbuild/artifacts/bin/bootstrap/netcoreapp2.1/MSBuild/"; - const string toolsVersion = "Current"; - - static void Main (string [] args) - { - /*var nativeSharedMethod = typeof (SolutionFile).Assembly.GetType ("Microsoft.Build.Shared.NativeMethodsShared"); - var isMonoField = nativeSharedMethod.GetField ("_isMono", BindingFlags.Static | BindingFlags.NonPublic); - isMonoField.SetValue (null, true);*/ - - //Environment.SetEnvironmentVariable (MSBUILD_EXE_PATH, "/usr/share/dotnet/sdk/3.1.101/MSBuild.dll"); - Environment.SetEnvironmentVariable ("MSBUILD_EXE_PATH", Path.Combine(msbuildRoot, "MSBuild.dll")); - Environment.SetEnvironmentVariable ("MSBUILD_NUGET_PATH", "/home/jp/.nuget/packages"); - - - //Environment.SetEnvironmentVariable ("COREHOST_TRACE", "1"); - - AppDomain currentDomain = AppDomain.CurrentDomain; - currentDomain.AssemblyResolve += msbuildAssembliesResolve; - - compile (); - } - - static Assembly msbuildAssembliesResolve (object sender, ResolveEventArgs args) - { - string assemblyPath = Path.Combine (msbuildRoot, new AssemblyName (args.Name).Name + ".dll"); - /*Console.BackgroundColor = ConsoleColor.DarkBlue; - Console.ForegroundColor = ConsoleColor.White; - Console.WriteLine ($"Probing: {assemblyPath}"); - Console.ResetColor ();*/ - if (!File.Exists (assemblyPath)) return null; - Assembly assembly = Assembly.LoadFrom (assemblyPath); - return assembly; - } - - - static void compile () - { - //Console.WriteLine ($"{Microsoft.Build. BuildEnvironmentHelper.Instance.CurrentMSBuildExePath}"); - string slnPath = "/mnt/devel/glfw-sharp/glfw-sharp.sln";//<--- change here can be another VS type ex: .vcxproj - //string slnPath = "/mnt/devel/vke.net/vke.net.sln";//<--- change here can be another VS type ex: .vcxproj - //string csprojPath = "/mnt/devel/glfw-sharp/glfw-sharp.csproj"; - //ILogger Logger = new BasicLogger (); - ILogger Logger = new Microsoft.Build.Logging.ConsoleLogger (); - Logger.Verbosity = LoggerVerbosity.Minimal; - //Logger.Parameters = "V=DIAG;consoleloggerparameters:ShowEventId"; - ProjectCollection projectCollection = new ProjectCollection (); - projectCollection.DefaultToolsVersion = toolsVersion; - //projectCollection.IsBuildEnabled = false; - //projectCollection.LoadProject (projectFileName); - SolutionFile sln = SolutionFile.Parse (slnPath); - - /*foreach (ProjectInSolution pis in sln.ProjectsInOrder) { - Console.WriteLine ($"{pis.ProjectName} {pis.RelativePath} {pis.ProjectType}"); - }*/ - - - //Project project = new Project (projectCollection); - BuildParameters buildParams = new BuildParameters (projectCollection); - buildParams.Loggers = new List<ILogger> () { Logger }; - //buildParams.DefaultToolsVersion = "Current"; - //buildParams.DetailedSummary = true; - //buildParams.LogInitialPropertiesAndItems = true; - //buildParams.LogTaskInputs = true; - - buildParams.ResetCaches = false; - - Dictionary<String, String> globalProperties = new Dictionary<String, String> (); - - globalProperties ["Configuration"] = sln.GetDefaultConfigurationName (); - globalProperties ["Platform"] = sln.GetDefaultPlatformName (); - - - //globalProperties ["RollForward"] = "none"; - //globalProperties ["_IsRollForwardSupported"] = "false"; - - //globalProperties ["GenerateRuntimeConfigurationFiles"] = "true"; - - //globalProperties ["NuGetPackageRoot"] = "/home/jp/.nuget/packages"; - //globalProperties ["RoslynTargetsPath"] = Path.Combine (msbuildRoot, "Roslyn/"); - //globalProperties ["MSBuildSDKsPath"] = Path.Combine (msbuildRoot, "Sdks/"); - - //globalProperties ["AdditionalLibPaths"] = msbuildRoot; - //globalProperties ["AssemblySearchPaths"] = msbuildRoot; - - - //globalProperty.Add ("CSharpCoreTargetsPath", "/usr/share/dotnet/sdk/3.1.101/Roslyn/Microsoft.CSharp.Core.targets"); - - /*ProjectInstance pinst = new ProjectInstance (csprojPath, globalProperties, "Current"); - if (pinst.Build (new String [] { "Build" }, buildParams.Loggers, out System.Collections.Generic.IDictionary<string, Microsoft.Build.Execution.TargetResult> targetOutputs)) - Console.WriteLine ("Success"); - ProjectRootElement pre = pinst.ToProjectRootElement ();*/ - - //List <Project> projects = new List<Project> (); - - //projectCollection.ProjectAdded += (sender, e) => { - // // pc = sender as ProjectCollection; - // // Console.ForegroundColor = ConsoleColor.Yellow; - // // Console.WriteLine ($"Proj added: {e.ProjectRootElement} {e.ProjectRootElement.FullPath}"); - // // Console.ResetColor (); - - // Project p = new Project (e.ProjectRootElement);//, globalProperties, toolsVersion, projectCollection); - // // //projects.Add (p); - // Console.WriteLine ($"\nEvaluated properties:"); - // foreach (var pi in p.Properties) - // Console.WriteLine ($"\t{pi.Name} = {pi.EvaluatedValue}"); - // Console.WriteLine (""); - - // // //foreach (ProjectItem pi in p.AllEvaluatedItems) - // // //Console.WriteLine ($"{pi.ItemType} {pi.EvaluatedInclude}"); - // // /*foreach (GlobResult gr in p.GetAllGlobs()) { - // // foreach (string g in gr.IncludeGlobs) { - // // Console.WriteLine ($"\t\t{g}"); - // // } - //}; - - //}; - - BuildManager.DefaultBuildManager.ResetCaches (); - - //string[] targetsToBuild = { "ResolveAssemblyReferences" }; - string [] targetsToBuild = { "restore", "build"}; - //string [] targetsToBuild = { "Rebuild" }; - - //globalProperties ["Configuration"] = "ReleaseSpirVTasks"; - - BuildRequestData buildRequest = new BuildRequestData (slnPath, globalProperties, "Current", targetsToBuild, null); - - BuildResult buildResult = BuildManager.DefaultBuildManager.Build (buildParams, buildRequest); - - - if (buildResult.OverallResult == BuildResultCode.Success) { - Console.WriteLine ("Build succes."); - } else { - foreach (var item in buildResult.ResultsByTarget) { - Console.WriteLine ($"{item.Key} -> {item.Value.ResultCode} {item.Value.ToString()}"); - } - - Console.WriteLine ("Error: " + buildResult.Exception); - } - //Console.WriteLine ($"proj count: {}"); - //MessageBox.Show (Logger.GetLogString ()); - /*foreach (Project p in buildParams. ..LoadedProjects) { - foreach (ProjectItem pi in p.AllEvaluatedItems) { - Console.WriteLine ($"{pi.ItemType} {pi}"); - } - }*/ - - } - } - - public class FileLogger : ILogger - { - public LoggerVerbosity Verbosity { get => throw new NotImplementedException (); set => throw new NotImplementedException (); } - public string Parameters { get => throw new NotImplementedException (); set => throw new NotImplementedException (); } - - Stream log; - StreamWriter sw; - - public void Initialize (IEventSource eventSource) - { - log = new FileStream ("buildlog.txt", FileMode.Create); - sw = new StreamWriter (log); - - eventSource.MessageRaised += (sender, e) => sw.WriteLine ($"{e.Message}"); - eventSource.BuildStarted += (sender, e) => sw.WriteLine("Build started"); - eventSource.BuildFinished += (sender, e) => sw.WriteLine ("Build finished"); - } - - public void Shutdown () - { - log.Flush (); - sw.Dispose (); - log.Dispose (); - } - } - - public class BasicLogger : ILogger - { - public LoggerVerbosity Verbosity { get; set; } - public string Parameters { get; set; } - - public void Initialize (IEventSource eventSource) - { - //eventSource.ProjectStarted += (sender, e) => Console.WriteLine ($"Building project: {e.Message}"); - //eventSource.ProjectFinished += (sender, e) => Console.WriteLine ($"Done project: {e.Message}"); - eventSource.ErrorRaised += (sender, e) => { - Console.ForegroundColor = ConsoleColor.White; - Console.BackgroundColor = ConsoleColor.Red; - Console.WriteLine ($"{e.Message}"); - Console.ResetColor (); - }; - eventSource.TargetStarted += (sender, e) => { - Console.ForegroundColor = ConsoleColor.DarkYellow; - Console.WriteLine ($"Target start: {e.TargetName}<-{e.ParentTarget} {e.Message}"); - Console.ResetColor (); - }; - eventSource.TargetFinished += (sender, e) => { - Console.ForegroundColor = ConsoleColor.DarkYellow; - Console.WriteLine ($"\tDone {e.TargetName} ({e.Succeeded}) : {e.Message}"); - Console.ResetColor (); - }; - - eventSource.MessageRaised += (sender, e) => { - Console.ForegroundColor = ConsoleColor.Gray; - Console.WriteLine ($"{e.HelpKeyword} {e.Message}"); - Console.ResetColor (); - }; - //eventSource.AnyEventRaised += (sender, e) => Console.WriteLine ($"{e.Timestamp}:{e.SenderName}=>{e.Message}"); - //eventSource.BuildStarted += (sender, e) => Console.WriteLine("Build started"); - eventSource.BuildFinished += (sender, e) => Console.WriteLine ("Build finished"); - } - - public void Shutdown () - { - } - } - - //public class BasicLogger : ILogger - // { - // MemoryStream streamMem = new MemoryStream (); - // /// <summary> - // /// Initialize is guaranteed to be called by MSBuild at the start of the build - // /// before any events are raised. - // /// </summary> - // public override void Initialize (IEventSource eventSource) - // { - - // try { - // // Open the file - // this.streamWriter = new StreamWriter (streamMem); - // //this.streamWriter = new StreamWriter(logFile); - // } catch (Exception ex) { - // if - // ( - // ex is UnauthorizedAccessException - // || ex is ArgumentNullException - // || ex is PathTooLongException - // || ex is DirectoryNotFoundException - // || ex is NotSupportedException - // || ex is ArgumentException - // || ex is SecurityException - // || ex is IOException - // ) { - // throw new LoggerException ("Failed to create log file: " + ex.Message); - // } else { - // // Unexpected failure - // throw; - // } - // } - - // // For brevity, we'll only register for certain event types. Loggers can also - // // register to handle TargetStarted/Finished and other events. - // eventSource.ProjectStarted += new ProjectStartedEventHandler (eventSource_ProjectStarted); - // eventSource.TaskStarted += new TaskStartedEventHandler (eventSource_TaskStarted); - // eventSource.MessageRaised += new BuildMessageEventHandler (eventSource_MessageRaised); - // eventSource.WarningRaised += new BuildWarningEventHandler (eventSource_WarningRaised); - // eventSource.ErrorRaised += new BuildErrorEventHandler (eventSource_ErrorRaised); - // eventSource.ProjectFinished += new ProjectFinishedEventHandler (eventSource_ProjectFinished); - // } - - // void eventSource_ErrorRaised (object sender, BuildErrorEventArgs e) - // { - // // BuildErrorEventArgs adds LineNumber, ColumnNumber, File, amongst other parameters - // string line = String.Format (": ERROR {0}({1},{2}): ", e.File, e.LineNumber, e.ColumnNumber); - // WriteLineWithSenderAndMessage (line, e); - // } - - // void eventSource_WarningRaised (object sender, BuildWarningEventArgs e) - // { - // // BuildWarningEventArgs adds LineNumber, ColumnNumber, File, amongst other parameters - // string line = String.Format (": Warning {0}({1},{2}): ", e.File, e.LineNumber, e.ColumnNumber); - // WriteLineWithSenderAndMessage (line, e); - // } - - // void eventSource_MessageRaised (object sender, BuildMessageEventArgs e) - // { - // // BuildMessageEventArgs adds Importance to BuildEventArgs - // // Let's take account of the verbosity setting we've been passed in deciding whether to log the message - // if ((e.Importance == MessageImportance.High && IsVerbosityAtLeast (LoggerVerbosity.Minimal)) - // || (e.Importance == MessageImportance.Normal && IsVerbosityAtLeast (LoggerVerbosity.Normal)) - // || (e.Importance == MessageImportance.Low && IsVerbosityAtLeast (LoggerVerbosity.Detailed)) - // ) { - // WriteLineWithSenderAndMessage (String.Empty, e); - // } - // } - - // void eventSource_TaskStarted (object sender, TaskStartedEventArgs e) - // { - // // TaskStartedEventArgs adds ProjectFile, TaskFile, TaskName - // // To keep this log clean, this logger will ignore these events. - // } - - // void eventSource_ProjectStarted (object sender, ProjectStartedEventArgs e) - // { - // // ProjectStartedEventArgs adds ProjectFile, TargetNames - // // Just the regular message string is good enough here, so just display that. - // WriteLine (String.Empty, e); - // indent++; - // } - - // void eventSource_ProjectFinished (object sender, ProjectFinishedEventArgs e) - // { - // // The regular message string is good enough here too. - // indent--; - // WriteLine (String.Empty, e); - // } - - // /// <summary> - // /// Write a line to the log, adding the SenderName and Message - // /// (these parameters are on all MSBuild event argument objects) - // /// </summary> - // private void WriteLineWithSenderAndMessage (string line, BuildEventArgs e) - // { - // if (0 == String.Compare (e.SenderName, "MSBuild", true /*ignore case*/)) { - // // Well, if the sender name is MSBuild, let's leave it out for prettiness - // WriteLine (line, e); - // } else { - // WriteLine (e.SenderName + ": " + line, e); - // } - // } - - // /// <summary> - // /// Just write a line to the log - // /// </summary> - // private void WriteLine (string line, BuildEventArgs e) - // { - // for (int i = indent; i > 0; i--) { - // streamWriter.Write ("\t"); - // } - // streamWriter.WriteLine (line + e.Message); - // } - - - // public string GetLogString () - // { - // var sr = new StreamReader (streamMem); - // var myStr = sr.ReadToEnd (); - // return myStr; - // } - // /// <summary> - // /// Shutdown() is guaranteed to be called by MSBuild at the end of the build, after all - // /// events have been raised. - // /// </summary> - // /// - // /// - // public override void Shutdown () - // { - // streamWriter.Flush (); - // streamMem.Position = 0; - // } - // private StreamWriter streamWriter; - // private int indent; - //} -} diff --git a/Samples/testMSBuild/testMSBuild.csproj b/Samples/testMSBuild/testMSBuild.csproj deleted file mode 100644 index 9eff9e78..00000000 --- a/Samples/testMSBuild/testMSBuild.csproj +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> - <OutputType>Exe</OutputType> - <!-- <TargetFramework>net472</TargetFramework>--> - <TargetFramework>netcoreapp3.1</TargetFramework> - <ReleaseVersion>0.8.0</ReleaseVersion> - </PropertyGroup> - <ItemGroup> - <PackageReference Include="Microsoft.Build" Version="16.*"> - <IncludeAssets>compile</IncludeAssets> - </PackageReference> - <PackageReference Include="Microsoft.Build.Framework" Version="16.*"> - <IncludeAssets>compile</IncludeAssets> - </PackageReference> - <PackageReference Include="Microsoft.Build.Tasks.Core" Version="16.*"> - <IncludeAssets>compile</IncludeAssets> - </PackageReference> - <PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.*"> - <IncludeAssets>compile</IncludeAssets> - </PackageReference> - </ItemGroup> -</Project>
\ No newline at end of file |