]> O.S.I.I.S - jp/crow.git/commitdiff
TestApp derived from Crow.Application
authorjpbruyere <jp.bruyere@hotmail.com>
Wed, 17 May 2017 15:26:37 +0000 (17:26 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Wed, 17 May 2017 15:26:37 +0000 (17:26 +0200)
testDrm/Main.cs
testDrm/testDrm.csproj
testDrm/tests.cs
testDrm/ui/0.crow [new file with mode: 0755]

index e8485faf7ac0ccbd9ce7bcacaacbfea693114560..73a165b600a50b649a69f501d3d3c44cfc8cbb0a 100644 (file)
@@ -29,23 +29,76 @@ using System.IO;
 using System.Collections.Generic;
 using Cairo;
 using Crow.Linux;
+using Crow;
 
 namespace testDrm
 {
        
-       static class TestDrm
-       {               
+       public class TestApp : Application, IValueChange 
+       {
                static void Main ()
                {
+                       try {
+                               using (TestApp crowApp = new TestApp ()) {
+                                       crowApp.Run ();
+                               }
+                       } catch (Exception ex) {
+                               Console.WriteLine (ex.ToString ());
+                       }
+               }
+
+               #region IValueChange implementation
+               public event EventHandler<ValueChangeEventArgs> ValueChanged;
+               public virtual void NotifyValueChanged(string MemberName, object _value)
+               {
+                       //Debug.WriteLine ("Value changed: {0}->{1} = {2}", this, MemberName, _value);
+                       ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value));
+               }
+               #endregion
+
+               public bool Running = true;
+
+               public TestApp () : base () {
 
-                       using (Application drm = new Application ()) {
-                               //drm.CrowInterface.LoadInterface (@"/mnt/data2/devel/crow/Tests/Interfaces/Divers/colorPicker.crow");
-                               drm.CrowInterface.LoadInterface ("#testDrm.ui.menu.crow");
-                               drm.CrowInterface.LoadInterface (@"/mnt/data2/devel/crow/Tests/Interfaces/Divers/0.crow");
-                               //drm.CrowInterface.LoadInterface (@"/mnt/data2/devel/crow/Tests/Interfaces/GraphicObject/2.crow");
-                               drm.Run ();
+               }
+               int frTime = 0;
+               int frMin = int.MaxValue;
+               int frMax = 0;
+
+               public override void Run ()
+               {
+                       Stopwatch frame = new Stopwatch ();
+                       Load ("#testDrm.ui.menu.crow").DataSource = this;
+                       Load ("#testDrm.ui.0.crow").DataSource = this;
+                       Load ("#testDrm.ui.0.crow").DataSource = this;
+                       Load ("#testDrm.ui.0.crow").DataSource = this;
+                       Load ("#testDrm.ui.0.crow").DataSource = this;
+
+                       while(Running){
+                               try {
+                                       frame.Restart();
+                                       base.Run ();
+                                       frame.Stop();
+                                       frTime = (int)frame.ElapsedTicks;
+                                       NotifyValueChanged("frameTime", frTime);
+                                       if (frTime > frMax){
+                                               frMax = frTime;
+                                               NotifyValueChanged("frameMax", frMax);  
+                                       }
+                                       if (frTime < frMin){
+                                               frMin = frTime;
+                                               NotifyValueChanged("frameMin", frMin);  
+                                       }
+
+                               } catch (Exception ex) {
+                                       Console.WriteLine (ex.ToString());
+                               }
                        }
                }
+               void onQuitClick(object send, Crow.MouseButtonEventArgs e)
+               {
+                       Running = false;
+               }
        }
 }
 
index 5b4f7f840b37100f9258f1df302c3315f0cc2cc7..5517f27475aeaa99cf562afd6567272277483075 100644 (file)
@@ -18,7 +18,7 @@
         <Command type="Execute" command="${TargetName}" workingdir="${SolutionDir}/build/${ProjectConfigName}" />
       </CustomCommands>
     </CustomCommands>
-    <StartupObject>testDrm.Tests</StartupObject>
+    <StartupObject>testDrm.TestApp</StartupObject>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -64,7 +64,6 @@
     <Compile Include="src\Linux\Bindings\Egl.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="tests.cs" />
     <Compile Include="src\Linux\TTY.cs" />
     <Compile Include="src\Linux\Signal.cs" />
     <Compile Include="src\Linux\VT.cs" />
@@ -81,6 +80,7 @@
     <Compile Include="src\Linux\GBM\BufferObject.cs" />
     <Compile Include="src\Linux\GBM\Device.cs" />
     <Compile Include="src\Application.cs" />
+    <Compile Include="Main.cs" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="System" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="ui\menu.crow" />
+    <EmbeddedResource Include="ui\0.crow" />
   </ItemGroup>
   <ItemGroup>
     <None Include="src\DRMContext.cs" />
-    <None Include="Main.cs" />
+    <None Include="tests.cs" />
   </ItemGroup>
 </Project>
\ No newline at end of file
index 1098c10c13d5d79c604f68fb2cef032a17989c49..576b4481acaff032371df5689682d7e2a8423888 100644 (file)
@@ -37,26 +37,54 @@ using System.IO;
 using System.Collections.Generic;
 using System.Linq;
 using Crow;
+using System.Diagnostics;
 
 
 
 namespace testDrm
 {
-       public class TestApp : Application {
+       public class TestApp : Application, IValueChange 
+       {
+               #region IValueChange implementation
+               public event EventHandler<ValueChangeEventArgs> ValueChanged;
+               public virtual void NotifyValueChanged(string MemberName, object _value)
+               {
+                       //Debug.WriteLine ("Value changed: {0}->{1} = {2}", this, MemberName, _value);
+                       ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value));
+               }
+               #endregion
 
                public bool Running = true;
 
                public TestApp () : base () {
                        
                }
+               int frTime = 0;
+               int frMin = int.MaxValue;
+               int frMax = 0;
+
                public override void Run ()
                {
+                       Stopwatch frame = new Stopwatch ();
                        Load ("#testDrm.ui.menu.crow").DataSource = this;
-                       Load (@"/mnt/data2/devel/crow/Tests/Interfaces/Divers/0.crow");
+                       Load ("#testDrm.ui.0.crow").DataSource = this;
 
                        while(Running){
                                try {
+                                       frame.Restart();
                                        base.Run ();
+                                       frame.Stop();
+                                       frTime = (int)frame.ElapsedTicks;
+                                       NotifyValueChanged("frameTime", frTime);
+                                       if (frTime > frMax){
+                                               frMax = frTime;
+                                               NotifyValueChanged("frameMax", frMax);  
+                                       }
+                                       if (frTime < frMin){
+                                               frMin = frTime;
+                                               NotifyValueChanged("frameMin", frMin);  
+                                       }
+
                                } catch (Exception ex) {
                                        Console.WriteLine (ex.ToString());
                                }
diff --git a/testDrm/ui/0.crow b/testDrm/ui/0.crow
new file mode 100755 (executable)
index 0000000..744f3cb
--- /dev/null
@@ -0,0 +1,158 @@
+<?xml version="1.0"?>
+<Window Caption="Showcase" Height="90%" Width="90%">
+       <HorizontalStack >
+               <VerticalStack Width="30%" Margin="5">
+                       <GroupBox Caption="Performance" Height="Fit">
+                               <VerticalStack Width="90%" Height="Fit" Spacing="2" >
+                                       <HorizontalStack Height="Fit">
+                                               <Label Text="Frame:" Style="FpsLabel"/>
+                                               <Label Text="{frameTime}" Style="FpsDisp"/>
+                                       </HorizontalStack>
+                                       <HorizontalStack Height="Fit">
+                                               <Label Text="Frame Min:" Style="FpsLabel"/>
+                                               <Label Text="{frameMin}" Style="FpsDisp"/>
+                                       </HorizontalStack>
+                                       <HorizontalStack Height="Fit">
+                                               <Label Text="FrameMax:" Style="FpsLabel"/>
+                                               <Label Text="{frameMax}" Style="FpsDisp"/>
+                                       </HorizontalStack>
+                                       <HorizontalStack Height="Fit">
+                                               <Label Text="Update:" Style="FpsLabel"/>
+                                               <Label Text="{update}" Style="FpsDisp"/>
+                                       </HorizontalStack>
+                                       <HorizontalStack Height="Fit">
+                                               <Label Text="Layouting:" Style="FpsLabel"/>
+                                               <Label Text="{layouting}" Style="FpsDisp"/>
+                                       </HorizontalStack>
+                                       <HorizontalStack Height="Fit">
+                                               <Label Text="Clipping:" Style="FpsLabel"/>
+                                               <Label Text="{clipping}" Style="FpsDisp"/>
+                                       </HorizontalStack>
+                                       <HorizontalStack Height="Fit">
+                                               <Label Text="Drawing:" Style="FpsLabel"/>
+                                               <Label Text="{drawing}" Style="FpsDisp"/>
+                                       </HorizontalStack>
+                               </VerticalStack>
+                       </GroupBox>
+                       <Label Width="Stretched" Margin="3" Background="Onyx"/>
+                       <TextBox Text="TextBox" Multiline="true" Margin="3"/>
+                       <HorizontalStack Height="Fit" Margin="5" Background="Onyx" CornerRadius="10">
+                               <VerticalStack Spacing="5" Width="50%">
+                                       <CheckBox Fit="true" Caption="test"/>
+                                       <CheckBox Fit="true"/>
+                                       <CheckBox Fit="true"/>
+                                       <CheckBox Fit="true" IsChecked="true"/>
+                               </VerticalStack>
+                               <VerticalStack Spacing="5" Width="50%">
+                                       <RadioButton Fit="true"/>
+                                       <RadioButton Fit="true" IsChecked="true"/>
+                                       <RadioButton Fit="true"/>
+                                       <RadioButton Fit="true"/>
+                               </VerticalStack>
+                       </HorizontalStack>
+                       <HorizontalStack Height="Fit" Margin="5">
+                               <Label Text="MouseEvents" Width="50%" Margin="3"
+                                       Background="Onyx"
+                                       Foreground="DimGray"
+                                       TextAlignment="Center"
+                                       MouseEnter="{Foreground=White}"
+                                       MouseLeave="{Foreground=DimGray}"
+                                       MouseDown="{Background=DarkRed}"
+                                       MouseUp="{Background=Onyx}"/>
+                               <Label Text="MouseEvents" Width="50%" Margin="3"
+                                       Background="Onyx"
+                                       Foreground="DimGray"
+                                       TextAlignment="Center"
+                                       MouseEnter="{Foreground=White}"
+                                       MouseLeave="{Foreground=DimGray}"
+                                       MouseDown="{Background=Mantis}"
+                                       MouseUp="{Background=Onyx}"/>
+                       </HorizontalStack>
+                       <GroupBox Caption="Templated controls" Height="Fit" Margin="5">
+                               <HorizontalStack Height="Fit">
+                                       <VerticalStack Width="50%">
+                                               <CheckBox IsChecked="true" Style="CheckBox2"/>
+                                               <CheckBox Style="CheckBox2"/>
+                                               <CheckBox Style="CheckBox2"/>
+                                               <CheckBox Style="CheckBox2"/>
+                                       </VerticalStack>
+                                       <Splitter/>
+                                       <VerticalStack Width="50%">
+                                               <RadioButton Style="RadioButton2"/>
+                                               <RadioButton Style="RadioButton2"/>
+                                               <RadioButton Style="RadioButton2"/>
+                                               <RadioButton Style="RadioButton2"/>
+                                       </VerticalStack>
+                               </HorizontalStack>
+                       </GroupBox>
+                       <HorizontalStack Height="Fit">
+                               <Label Text="Spinner"/>
+                               <Spinner Fit="true"/>
+                       </HorizontalStack>
+                       <HorizontalStack Height="Fit">
+                               <Button Caption="Button"/>
+                               <Button Caption="Button" IsEnabled="false"/>
+                       </HorizontalStack>
+               </VerticalStack>
+               <Splitter/>
+               <VerticalStack Width="40%" Margin="5" Spacing="5">
+                       <Expandable Background="DimGray">
+                               <Image Path="#Crow.Images.Icons.crow.svg"/>
+                       </Expandable>
+                       <Popper Background="DimGray" >
+                               <Border Fit="True" Background="DimGray" CornerRadius="0" BorderWidth="1">
+                                       <Image Path="#Crow.Images.Icons.crow.svg" Width="100" Height="100" Margin="10"
+                                               MouseEnter="{Background=LightGray}"
+                                               MouseLeave="{Background=Transparent}"/>
+                               </Border>
+                       </Popper>
+                       <Slider Height="10" Width="90%"/>
+                       <Container Height="Fit" Width="200" Background="Onyx" Margin="2" CornerRadius="5">
+                               <ProgressBar Background="DimGray" Height="10" Value="50"/>
+                       </Container>
+                       <Image Path="#Crow.Images.Icons.crow.svg" Width="60" Height="60" Background="LightGray" />
+<!--                   <TabView Name="tabview1"
+                               Height="120" Orientation="Horizontal" Spacing="15">
+                               <TabItem Name="TabItem1" Caption="Tab 1" Margin="0">
+                                       <VerticalStack Fit="true">
+                                               <CheckBox/>
+                                               <CheckBox/>
+                                               <CheckBox/>
+                                               <CheckBox/>
+                                       </VerticalStack>
+                               </TabItem>
+                               <TabItem Name="TabItem2" Caption="Tab 2" Background="Gray">
+                                       <VerticalStack Fit="true">
+                                               <RadioButton/>
+                                               <RadioButton/>
+                                               <RadioButton/>
+                                               <RadioButton/>
+                                       </VerticalStack>
+                               </TabItem>
+                               <TabItem Name="TabItem3" Caption="Tab 3" Background="Gray">
+                                       <Container Margin="5" CornerRadius="2">
+                                               <TextBox Height="Stretched" Margin="5" Multiline="true" TextAlignment="TopLeft"/>
+                                       </Container>
+                               </TabItem>
+                       </TabView>-->
+                       <MessageBox Movable="false"/>
+                       <ColorPicker SelectedColor="{²../go.Background}" Name="colorPicker" Background="Onyx" Margin="5" Fit="True" />
+                       <GraphicObject Name="go" Width="100" Height="60" Background="{../../colorList.SelectedItem}"/>
+                       <Label Text="{../../colorPicker.SelectedRawColor}"/>
+               </VerticalStack>
+               <Splitter/>
+               <VerticalStack Width="30%" Margin="5">
+<!--                   <Border Margin="5" Height="Fit">
+                               <Label Width="Stretched" Margin="1" Text="{../../dv.SelectedItem}"/>
+                       </Border>-->
+<!--                   <Border Margin="5" Height="30%">
+                               <DirectoryView Name="dv" CurrentDirectory="/" Margin="1"/>
+                       </Border>
+                       <Splitter/>-->
+                       <ListBox Name="colorList" Data="{TestList}" Margin="5"
+                                        ItemTemplate="#Tests.Interfaces.colorItem.crow"
+                                        Template="#Crow.Templates.ScrollingListBox.goml"
+                                        />
+               </VerticalStack>
+       </HorizontalStack>
+</Window>
\ No newline at end of file