aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-01-14 08:07:43 +0100
committerj-p <jp_bruyere@hotmail.com>2021-02-06 20:28:02 +0100
commit2ab44f600bd0ecab04d03ba08fdc17ea195babf2 (patch)
tree916e61f3a6776ea97f73d77ea8b601684c2ad5f2 /Samples
parent0f08742ef206f006db97a8d2bc67b1c4cae34deb (diff)
label, cached line width in pixel in LineSpan struct, use stackalloc for a single utf8 conversion for size and print, perfs and samplebase
Diffstat (limited to 'Samples')
-rw-r--r--Samples/BasicTests/BasicTests.cs22
-rw-r--r--Samples/BasicTests/BasicTests.csproj3
-rw-r--r--Samples/DebugLogAnalyzer/Program.cs2
-rw-r--r--Samples/PerfTests/Program.cs14
-rw-r--r--Samples/PerfTests/Properties/launchSettings.json2
-rw-r--r--Samples/ShowCase/ShowCase.cs9
-rw-r--r--Samples/common/SampleBase.cs21
-rw-r--r--Samples/common/ui/Interfaces/Divers/testVisibility.crow4
-rw-r--r--Samples/common/ui/Interfaces/Experimental/testDock2.crow26
-rw-r--r--Samples/common/ui/Interfaces/PerfLabels/0_single_Label.crow (renamed from Samples/common/ui/Interfaces/PerfLabels/0.crow)0
-rw-r--r--Samples/common/ui/Interfaces/PerfLabels/0_single_oldLabel.crow3
-rw-r--r--Samples/common/ui/Interfaces/PerfLabels/1.crow3
-rw-r--r--Samples/common/ui/Interfaces/PerfLabels/1_single_lab_update.crow (renamed from Samples/common/ui/Interfaces/PerfLabels/2.crow)0
-rw-r--r--Samples/common/ui/Interfaces/PerfLabels/1_single_old_update.crow3
-rw-r--r--Samples/common/ui/Interfaces/PerfLabels/2_labels_update.crow (renamed from Samples/common/ui/Interfaces/PerfLabels/labels.crow)24
-rw-r--r--Samples/common/ui/Interfaces/PerfLabels/2_old_labels_update.crow29
16 files changed, 78 insertions, 87 deletions
diff --git a/Samples/BasicTests/BasicTests.cs b/Samples/BasicTests/BasicTests.cs
index 755c4a0b..dcf38db4 100644
--- a/Samples/BasicTests/BasicTests.cs
+++ b/Samples/BasicTests/BasicTests.cs
@@ -28,14 +28,14 @@ namespace tests
// += KeyboardKeyDown1;
//testFiles = new string [] { @"Interfaces/Experimental/testDock.crow" };
- //testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
+ testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
//testFiles = new string [] { @"Interfaces/TemplatedGroup/3.crow" };
//testFiles = new string [] { @"Interfaces/Divers/testShape.crow" };
//testFiles = new string [] { @"Interfaces/TemplatedControl/testEnumSelector.crow" };
//testFiles = new string [] { @"Interfaces/Divers/all.crow" };
//testFiles = new string [] { @"Interfaces/Divers/gauge.crow" };
//testFiles = new string [] { @"Interfaces/Stack/StretchedInFit4.crow" };
- testFiles = new string [] { @"Interfaces/TemplatedGroup/1.crow" };
+ //testFiles = new string [] { @"Interfaces/TemplatedGroup/1.crow" };
//testFiles = new string [] { @"Interfaces/Divers/colorPicker2.crow" };
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray ();
@@ -62,12 +62,7 @@ namespace tests
switch (key) {
case Key.Escape:
Quit ();
- break;
- case Key.F2:
- //if (IsKeyDown (Key.LeftShift))
- //DbgLogger.Reset ();
- //DbgLogger.save (this);
- return false;
+ break;
case Key.F3:
idx--;
break;
@@ -78,15 +73,6 @@ namespace tests
//TestList.Add ("new string");
NotifyValueChanged ("TestList", TestList);
break;
- case Key.F5:
- Load ("Interfaces/Divers/testFileDialog.crow").DataSource = this;
- return false;
- case Key.F6:
- Load ("Interfaces/Divers/0.crow").DataSource = this;
- return false;
- case Key.F7:
- Load ("Interfaces/Divers/perfMeasures.crow").DataSource = this;
- return false;
default:
return base.OnKeyDown (key);
}
@@ -105,7 +91,7 @@ namespace tests
#endif
Load (testFiles [idx]).DataSource = this;
} catch (Exception ex) {
- (LoadIMLFragment ($"<Label Background='Red' Foreground='White' Height='Fit' Width='Stretched' Multiline='true' VerticalAlignment='Bottom' Margin='5' />") as Label).Text = ex.ToString();
+ (LoadIMLFragment ($"<Label Background='Red' Foreground='White' Height='Fit' Width='Stretched' Multiline='true' VerticalAlignment='Bottom' Margin='5' />") as OldLabel).Text = ex.ToString();
Console.WriteLine (ex.Message + "\n" + ex.InnerException);
//MessageBox.Show (CurrentInterface, MessageBox.Type.Error, ex.Message + "\n" + ex.InnerException.Message).Modal = true;
}
diff --git a/Samples/BasicTests/BasicTests.csproj b/Samples/BasicTests/BasicTests.csproj
index b92bf102..63d93cc3 100644
--- a/Samples/BasicTests/BasicTests.csproj
+++ b/Samples/BasicTests/BasicTests.csproj
@@ -8,4 +8,7 @@
<LogicalName>ShowCase.%(Filename)%(Extension)</LogicalName>
</EmbeddedResource>
</ItemGroup>
+ <ItemGroup>
+ <None Remove="C:\Users\Jean-Philippe\source\Crow\Samples\common\ui\Interfaces\Experimental\testDock2.crow" />
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/Samples/DebugLogAnalyzer/Program.cs b/Samples/DebugLogAnalyzer/Program.cs
index bb793da3..7493a842 100644
--- a/Samples/DebugLogAnalyzer/Program.cs
+++ b/Samples/DebugLogAnalyzer/Program.cs
@@ -79,7 +79,7 @@ namespace DebugLogAnalyzer
TreeView tv = FindByName("dbgTV") as TreeView;
dbgTreeViewScroller = tv.FindByNameInTemplate ("scroller1") as Scroller;
- loadDebugFile ("/var/tmp/debug.log");
+ loadDebugFile ("debug.log");
}
void loadDebugFile (string logFile)
diff --git a/Samples/PerfTests/Program.cs b/Samples/PerfTests/Program.cs
index 7a62fd8c..73b97448 100644
--- a/Samples/PerfTests/Program.cs
+++ b/Samples/PerfTests/Program.cs
@@ -16,6 +16,7 @@ namespace PerfTests
readonly bool resetItors = false;
readonly bool screenOutput = false;
readonly string inDirectory = "Interfaces";//directory to test
+ readonly string outFilePath;
Stream outStream;
@@ -24,7 +25,8 @@ namespace PerfTests
bool logToDisk => writer != null;
void writeHeader (TextWriter txtWriter) {
- txtWriter.WriteLine ($"Crow perf test ({clientRectangle.Width} X {clientRectangle.Height}), repeat count = {count}, reset style and templates = {resetItors}");
+ txtWriter.WriteLine ($"Crow perf test ({clientRectangle.Width} X {clientRectangle.Height}), output to screen = { screenOutput }");
+ txtWriter.WriteLine ($"repeat = {count}, update cycles = {updateCycles} reset Instantiators = {resetItors}");
txtWriter.WriteLine ($"git:{ThisAssembly.Git.Commit} {ThisAssembly.Git.Branch} {ThisAssembly.Git.SemVer.Major}.{ThisAssembly.Git.SemVer.Minor}.{ThisAssembly.Git.SemVer.Patch} {ThisAssembly.Git.SemVer.Label}");
}
@@ -39,6 +41,7 @@ namespace PerfTests
Console.WriteLine ("-r,--reset:\n\tenable clear iterators after each test file.");
Console.WriteLine ("-u,--update:\n\tmeasure 'n' update cycle with DateTime.Now string notified.");
Console.WriteLine ("-s,--screen:\n\tenable output to screen.");
+ Console.WriteLine ("--help:\n\tthis help message.");
}
public TestInterface (string[] args, int width = 800, int height = 600)
@@ -86,7 +89,7 @@ namespace PerfTests
case "--screen":
screenOutput = true;
break;
-
+ case "--help":
default:
throw new Exception ();
}
@@ -107,7 +110,8 @@ namespace PerfTests
Directory.CreateDirectory (dirName);
string filename = "crow-" + DateTime.Now.ToString ("yyyy-MM-dd-HH-mm") +".perflog";
- outStream = new FileStream (Path.Combine (dirName, filename), FileMode.Create);
+ outFilePath = Path.Combine (dirName, filename);
+ outStream = new FileStream (outFilePath, FileMode.Create);
writer = new StreamWriter (outStream);
writeHeader (writer);
writer.WriteLine ("Path;Min;Mean;Max;Allocated;LostMem");
@@ -127,6 +131,9 @@ namespace PerfTests
throw new FileNotFoundException ("Input directory not found: " + dirName);
testDir (dirName);
+
+ if (logToDisk)
+ Console.WriteLine ($"\ntest log written to: {outFilePath}");
}
protected override void Dispose (bool disposing) {
@@ -222,6 +229,7 @@ namespace PerfTests
double lostMem = (double)(totMemAfter - totMemBefore) / 1024.0;
if (logToDisk) {
writer.WriteLine ($"{f};{min};{mean};{max};{allocAfter - allocBefore};{totMemAfter - totMemBefore}");
+ Console.Write (".");
} else {
if (miliseconds)
Console.WriteLine ($"{label,-50}|{min,10}|{mean,10}|{max,10}| {allocated,8:0.0} | {lostMem,8:0.0} |");
diff --git a/Samples/PerfTests/Properties/launchSettings.json b/Samples/PerfTests/Properties/launchSettings.json
index c5470b40..278f5ab3 100644
--- a/Samples/PerfTests/Properties/launchSettings.json
+++ b/Samples/PerfTests/Properties/launchSettings.json
@@ -2,7 +2,7 @@
"profiles": {
"PerfTests": {
"commandName": "Project",
- "commandLineArgs": "-c 5 -u 99 -s -i Interfaces/PerfLabels"
+ "commandLineArgs": "-c 20 -u 99 -s -i Interfaces/PerfLabels"
}
}
} \ No newline at end of file
diff --git a/Samples/ShowCase/ShowCase.cs b/Samples/ShowCase/ShowCase.cs
index 8af2c002..d3b40d6f 100644
--- a/Samples/ShowCase/ShowCase.cs
+++ b/Samples/ShowCase/ShowCase.cs
@@ -175,15 +175,6 @@ namespace ShowCase
reloadFromFile ();
}
- public override bool OnKeyDown (Key key)
- {
- switch (key) {
- case Key.F2:
- //DbgLogger.save (this);
- return true;
- }
- return base.OnKeyDown (key);
- }
public void goUpDirClick (object sender, MouseButtonEventArgs e)
diff --git a/Samples/common/SampleBase.cs b/Samples/common/SampleBase.cs
index 65345be7..bdc6608b 100644
--- a/Samples/common/SampleBase.cs
+++ b/Samples/common/SampleBase.cs
@@ -8,6 +8,7 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;
using Crow;
+using Glfw;
namespace Crow
{
@@ -261,5 +262,25 @@ namespace Crow
base.OnInitialized ();
}
+ public override bool OnKeyDown (Key key) {
+
+ switch (key) {
+ case Key.F5:
+ Load ("Interfaces/Divers/testFileDialog.crow").DataSource = this;
+ return true;
+ case Key.F6:
+ Load ("Interfaces/Divers/0.crow").DataSource = this;
+ return true;
+ case Key.F7:
+ Load ("Interfaces/Divers/perfMeasures.crow").DataSource = this;
+ return true;
+ case Key.F2:
+ if (IsKeyDown (Key.LeftShift))
+ DbgLogger.Reset ();
+ DbgLogger.Save (this);
+ return true;
+ }
+ return base.OnKeyDown (key);
+ }
}
} \ No newline at end of file
diff --git a/Samples/common/ui/Interfaces/Divers/testVisibility.crow b/Samples/common/ui/Interfaces/Divers/testVisibility.crow
index 9f9464c9..581bab06 100644
--- a/Samples/common/ui/Interfaces/Divers/testVisibility.crow
+++ b/Samples/common/ui/Interfaces/Divers/testVisibility.crow
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<Container Margin="20" Background="Red" >
- <Container Margin="20" Background="Green" MouseDown="{../go1.Visible=True}" >
+ <!--<Container Margin="20" Background="Green" MouseDown="{../go1.Visible=True}" >
<Widget Name="go1" Margin="20" Background="DimGrey" Visible="false" MouseDown="{Visible=false}"
MouseEnter="{Background=Blue}"
MouseLeave="{Background=DimGrey}"/>
- </Container>
+ </Container>-->
</Container>
diff --git a/Samples/common/ui/Interfaces/Experimental/testDock2.crow b/Samples/common/ui/Interfaces/Experimental/testDock2.crow
deleted file mode 100644
index d4eb29ac..00000000
--- a/Samples/common/ui/Interfaces/Experimental/testDock2.crow
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<Docker >
- <DockWindow Left="100" Top="100" Width="150" Height="150" Background="DarkRed"/>
- <DockWindow Left="200" Top="200" Width="150" Height="150" Background="DarkGreen"/>
- <DockWindow Left="300" Top="300" Width="150" Height="150" Background="Blue"/>
- <DockWindow Left="400" Top="400" Width="150" Height="150" Background="Yellow"/>
- <DockWindow Left="500" Top="500" Width="150" Height="150" Background="Yellow"/>
-</Docker>
-<!--<Group Background="DimGrey" Margin = "0" Focusable="true" >
- <Window Top="100" Left="100" Focusable="true" Caption="View 1" Width="300" Height="300"><Widget Background="Green" Focusable="true" MouseEnter="{Background=Grey}" MouseLeave="{Background=Green}"/></Window>
- <Window Top="200" Left="200" Focusable="true" Caption="View 2" Resizable = "true" Width="300" Height="300"><Widget Focusable="true" Background="Blue" MouseEnter="{Background=Grey}" MouseLeave="{Background=Blue}"/></Window>
- <Window Top="300" Left="300" Focusable="true" Caption="View 3" Resizable = "true" Width="300" Height="300"><Widget Focusable="true" Background="Yellow" MouseEnter="{Background=Grey}" MouseLeave="{Background=Yellow}"/></Window>
- <Window Top="400" Left="400" Focusable="true" Caption="View 4" Resizable = "true" Width="300" Height="300"><Widget Focusable="true" Background="Black" MouseEnter="{Background=Grey}" MouseLeave="{Background=Black}"/></Window>
-</Group>-->
-<!--<Docker >
- <DockWindow Resizable = "true" Top="100" Left="100" Caption="View 1" Width="300" Height="300">
- <VerticalStack Background="DarkGreen" Focusable="true">
- <Label Text="{../../Left}" Background="Black" Width="Stretched"/>
- <Label Text="{../../Top}" Background="Black"/>
- <Label Text="{../../LogicalParent}" Background="Black"/>
- </VerticalStack>
- </DockWindow>
- <DockWindow Top="200" Left="200" Focusable="true" Caption="View 2" Resizable = "true" Width="300" Height="300"><Widget Focusable="true" Background="Blue" MouseEnter="{Background=Grey}" MouseLeave="{Background=Blue}"/></DockWindow>
- <DockWindow Top="300" Left="300" Focusable="true" Caption="View 3" Resizable = "true" Width="300" Height="300"><Widget Focusable="true" Background="Yellow" MouseEnter="{Background=Grey}" MouseLeave="{Background=Yellow}"/></DockWindow>
- <DockWindow Top="400" Left="400" Focusable="true" Caption="View 4" Resizable = "true" Width="300" Height="300"><Widget Focusable="true" Background="Black" MouseEnter="{Background=Grey}" MouseLeave="{Background=Black}"/></DockWindow>
-</Docker>--> \ No newline at end of file
diff --git a/Samples/common/ui/Interfaces/PerfLabels/0.crow b/Samples/common/ui/Interfaces/PerfLabels/0_single_Label.crow
index 14304360..14304360 100644
--- a/Samples/common/ui/Interfaces/PerfLabels/0.crow
+++ b/Samples/common/ui/Interfaces/PerfLabels/0_single_Label.crow
diff --git a/Samples/common/ui/Interfaces/PerfLabels/0_single_oldLabel.crow b/Samples/common/ui/Interfaces/PerfLabels/0_single_oldLabel.crow
new file mode 100644
index 00000000..4157b6a7
--- /dev/null
+++ b/Samples/common/ui/Interfaces/PerfLabels/0_single_oldLabel.crow
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<OldLabel Text="no update in this file"/>
+
diff --git a/Samples/common/ui/Interfaces/PerfLabels/1.crow b/Samples/common/ui/Interfaces/PerfLabels/1.crow
deleted file mode 100644
index 155e5188..00000000
--- a/Samples/common/ui/Interfaces/PerfLabels/1.crow
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0"?>
-<TextRun Text="{elapsed}" Fit="true" Background="Onyx"/>
-
diff --git a/Samples/common/ui/Interfaces/PerfLabels/2.crow b/Samples/common/ui/Interfaces/PerfLabels/1_single_lab_update.crow
index 034518cb..034518cb 100644
--- a/Samples/common/ui/Interfaces/PerfLabels/2.crow
+++ b/Samples/common/ui/Interfaces/PerfLabels/1_single_lab_update.crow
diff --git a/Samples/common/ui/Interfaces/PerfLabels/1_single_old_update.crow b/Samples/common/ui/Interfaces/PerfLabels/1_single_old_update.crow
new file mode 100644
index 00000000..1a02ce7e
--- /dev/null
+++ b/Samples/common/ui/Interfaces/PerfLabels/1_single_old_update.crow
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<OldLabel Text="{elapsed}" Fit="true" Background="Onyx"/>
+
diff --git a/Samples/common/ui/Interfaces/PerfLabels/labels.crow b/Samples/common/ui/Interfaces/PerfLabels/2_labels_update.crow
index 57c49ad5..8d944f01 100644
--- a/Samples/common/ui/Interfaces/PerfLabels/labels.crow
+++ b/Samples/common/ui/Interfaces/PerfLabels/2_labels_update.crow
@@ -24,30 +24,6 @@
<Label Text="{elapsed}" />
<Label Text="{elapsed}" />
</VerticalStack>
- <VerticalStack Width="20%" Height="Fit">
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- </VerticalStack>
- <VerticalStack Width="20%" Height="Fit">
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- <Label Text="{elapsed}" />
- </VerticalStack>
</HorizontalStack>
diff --git a/Samples/common/ui/Interfaces/PerfLabels/2_old_labels_update.crow b/Samples/common/ui/Interfaces/PerfLabels/2_old_labels_update.crow
new file mode 100644
index 00000000..f55bedc3
--- /dev/null
+++ b/Samples/common/ui/Interfaces/PerfLabels/2_old_labels_update.crow
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<HorizontalStack>
+ <VerticalStack Width="20%" Height="Fit">
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ </VerticalStack>
+ <VerticalStack Width="20%" Height="Fit">
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ <OldLabel Text="{elapsed}" />
+ </VerticalStack>
+</HorizontalStack>
+
+