aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples/ShowCase
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2025-07-16 20:08:03 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2025-07-16 20:08:03 +0200
commit149205e8ebe5c4ab1ca52ca700ff754aabdf14aa (patch)
treee0d567ae9a304ec915e49a25e42af1803e3d83ed /Samples/ShowCase
parente96fecb4bb512ee47e9df0224e779b24d686bc30 (diff)
DebugLogViewer, DockTests
Diffstat (limited to 'Samples/ShowCase')
-rw-r--r--Samples/ShowCase/ShowCase.cs29
-rw-r--r--Samples/ShowCase/ui/DebugLog.crow5
-rw-r--r--Samples/ShowCase/ui/showcase.crow7
3 files changed, 20 insertions, 21 deletions
diff --git a/Samples/ShowCase/ShowCase.cs b/Samples/ShowCase/ShowCase.cs
index 125dc4b5..536fad90 100644
--- a/Samples/ShowCase/ShowCase.cs
+++ b/Samples/ShowCase/ShowCase.cs
@@ -1,28 +1,26 @@
-// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2025 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 System.Text;
using Crow.IML;
-using System.Runtime.CompilerServices;
using Glfw;
using System.Diagnostics;
-using Crow.Text;
using System.Collections.Generic;
using Encoding = System.Text.Encoding;
using Samples;
using System.Threading;
+using System.Linq;
namespace ShowCase
{
class Showcase : SampleBaseForEditor
{
static DbgEvtType[] logEvts = {
- /*DbgEvtType.IFace,
- DbgEvtType.Widget,*/
+ DbgEvtType.IFace,
+ DbgEvtType.Widget,
DbgEvtType.Ressources
/*DbgEvtType.MouseEnter,
DbgEvtType.MouseLeave,
@@ -32,8 +30,8 @@ namespace ShowCase
};
static void Main ()
{
- DbgLogger.ConsoleOutput = true;
- DbgLogger.IncludedEvents.Add(DbgEvtType.Ressources);
+ //DbgLogger.ConsoleOutput = true;
+ //DbgLogger.IncludedEvents.Add(DbgEvtType.Ressources);
//Configuration.Global.Set ("RecordedEvents", new DbgEvtType[] { DbgEvtType.Ressources});
@@ -113,7 +111,7 @@ namespace ShowCase
}
}
public string TemplateContainerSource {
- get => Configuration.Global.Get<string> ("TemplateContainerSource", "<Button/>");
+ get => Configuration.Global.Get<string> ("TemplateContainerSource", "<Button>");
set {
if (TemplateContainerSource == value)
return;
@@ -135,8 +133,13 @@ namespace ShowCase
Instantiator inst = null;
string src = source;
if (EncloseInTemplatedControl) {
+ if (!string.IsNullOrEmpty(src) && src.StartsWith("<?xml")) {
+ int pos = src.IndexOf('>');
+ if (pos > 0)
+ src = src.Substring(pos + 1);
+ }
string tmpControl = TemplateContainerSource.Split (' ', StringSplitOptions.RemoveEmptyEntries)[0].Replace ("<","").Replace (">","");
- src = $"{TemplateContainerSource}\n<Template>\n{source}\n</Template>\n</{tmpControl}>";
+ src = $"{TemplateContainerSource}<Template>{src}</Template></{tmpControl}>";
}
using (MemoryStream ms = new MemoryStream (Encoding.UTF8.GetBytes (src)))
inst = new Instantiator (this, ms);
@@ -187,7 +190,6 @@ namespace ShowCase
reloadChrono.Reset ();
}
-
public override bool OnKeyDown (KeyEventArgs e) {
switch (e.Key) {
@@ -196,12 +198,15 @@ namespace ShowCase
return true;
case Key.F6:
if (DebugLogRecording) {
- DbgLogger.IncludedEvents.Clear();
if (DebugLogToFile && !string.IsNullOrEmpty(DebugLogFilePath))
DbgLogger.Save (this, DebugLogFilePath);
+ DbgLogger.IncludedEvents.Clear();
DebugLogRecording = false;
+ NotifyValueChanged("DebugEvents", DebugEvents );
} else {
+ DbgLogger.ConsoleOutput = false;
DbgLogger.Reset ();
+ NotifyValueChanged("DebugEvents", (object)null );
DbgLogger.IncludedEvents = new List<DbgEvtType> (logEvts);
DebugLogRecording = true;
}
diff --git a/Samples/ShowCase/ui/DebugLog.crow b/Samples/ShowCase/ui/DebugLog.crow
deleted file mode 100644
index db9528b1..00000000
--- a/Samples/ShowCase/ui/DebugLog.crow
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>
-<Window Caption="Debug Log" Background="0.1,0.1,0.1,0.8">
- <ListBox Data="{DebugEvents}">
- </ListBox>
-</Window> \ No newline at end of file
diff --git a/Samples/ShowCase/ui/showcase.crow b/Samples/ShowCase/ui/showcase.crow
index a7d7e97d..69e10dec 100644
--- a/Samples/ShowCase/ui/showcase.crow
+++ b/Samples/ShowCase/ui/showcase.crow
@@ -18,9 +18,9 @@
<Border CornerRadius="2" Margin="0" Height="Fit"
Foreground="Transparent"
MouseEnter="{Foreground=DimGrey}"
- MouseLeave="{Foreground=Transparent}">
+ MouseLeave="{Foreground=Transparent}">
<HorizontalStack>
- <Image Margin="1" Width="14" Height="14" Path="#Crow.Icons.file.svg"/>
+ <Image Margin="1" Width="16" Height="16" Path="#Crow.Icons.file.svg"/>
<Label Text="{Name}" Width="Stretched"/>
</HorizontalStack>
</Border>
@@ -161,8 +161,7 @@
</Template>
<VerticalStack Width="200" Height="200" Background="Jet" Margin="5">
<CheckBox Caption="Embed source in template" IsChecked="{²EncloseInTemplatedControl}"/>
- <TextBox BubbleEvents="None" Text="{²TemplateContainerSource}" Width="Stretched" Height="Stretched" Multiline="true"
- Tooltip="Add '*source* where you want to load the source in the editor."/>
+ <TextBox BubbleEvents="None" Text="{²TemplateContainerSource}" Width="Stretched" Height="Stretched" Multiline="true"/>
</VerticalStack>
</Popper>
</Wrapper>