mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Merge pull request #805 from Artemis-RGB/feature/debug-logs-select
Fixed a few annoying UI bugs
This commit is contained in:
commit
fc598d88ad
@ -1,4 +1,5 @@
|
|||||||
using SkiaSharp;
|
using System.Text;
|
||||||
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Artemis.Core.ColorScience;
|
namespace Artemis.Core.ColorScience;
|
||||||
|
|
||||||
@ -36,4 +37,14 @@ public readonly record struct ColorSwatch
|
|||||||
/// The <see cref="ColorType.DarkMuted" /> component.
|
/// The <see cref="ColorType.DarkMuted" /> component.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SKColor DarkMuted { get; init; }
|
public SKColor DarkMuted { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override the record ToString method,
|
||||||
|
/// so we get a cleaner datamodel viewer
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override string? ToString()
|
||||||
|
{
|
||||||
|
return base.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using EmbedIO;
|
using EmbedIO;
|
||||||
@ -15,7 +16,7 @@ public class PluginsModule : WebModuleBase
|
|||||||
|
|
||||||
internal PluginsModule(string baseRoute) : base(baseRoute)
|
internal PluginsModule(string baseRoute) : base(baseRoute)
|
||||||
{
|
{
|
||||||
_pluginEndPoints = new Dictionary<string, Dictionary<string, PluginEndPoint>>();
|
_pluginEndPoints = new Dictionary<string, Dictionary<string, PluginEndPoint>>(comparer: StringComparer.InvariantCultureIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AddPluginEndPoint(PluginEndPoint registration)
|
internal void AddPluginEndPoint(PluginEndPoint registration)
|
||||||
|
|||||||
@ -2,13 +2,16 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:aedit="https://github.com/avaloniaui/avaloniaedit"
|
|
||||||
xmlns:controls="clr-namespace:Artemis.UI.Controls"
|
|
||||||
xmlns:logs="clr-namespace:Artemis.UI.Screens.Debugger.Logs"
|
xmlns:logs="clr-namespace:Artemis.UI.Screens.Debugger.Logs"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="Artemis.UI.Screens.Debugger.Logs.LogsDebugView"
|
x:Class="Artemis.UI.Screens.Debugger.Logs.LogsDebugView"
|
||||||
x:DataType="logs:LogsDebugViewModel">
|
x:DataType="logs:LogsDebugViewModel">
|
||||||
<ScrollViewer Name="LogsScrollViewer" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
<ScrollViewer Name="LogsScrollViewer" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||||
<SelectableTextBlock Inlines="{CompiledBinding Lines}" FontFamily="Consolas" SizeChanged="Control_OnSizeChanged"></SelectableTextBlock>
|
<SelectableTextBlock
|
||||||
|
Inlines="{CompiledBinding Lines}"
|
||||||
|
FontFamily="Consolas"
|
||||||
|
SizeChanged="Control_OnSizeChanged"
|
||||||
|
SelectionBrush="{StaticResource TextControlSelectionHighlightColor}"
|
||||||
|
/>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -10,50 +10,17 @@ namespace Artemis.UI.Screens.Debugger.Logs;
|
|||||||
|
|
||||||
public partial class LogsDebugView : ReactiveUserControl<LogsDebugViewModel>
|
public partial class LogsDebugView : ReactiveUserControl<LogsDebugViewModel>
|
||||||
{
|
{
|
||||||
private int _lineCount;
|
|
||||||
|
|
||||||
public LogsDebugView()
|
public LogsDebugView()
|
||||||
{
|
{
|
||||||
_lineCount = 0;
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
base.OnInitialized();
|
base.OnInitialized();
|
||||||
Dispatcher.UIThread.Post(() => LogsScrollViewer.ScrollToEnd(), DispatcherPriority.ApplicationIdle);
|
Dispatcher.UIThread.Post(() => LogsScrollViewer.ScrollToEnd(), DispatcherPriority.ApplicationIdle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void OnTextChanged(object? sender, EventArgs e)
|
|
||||||
// {
|
|
||||||
// if (LogTextEditor.ExtentHeight == 0)
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// int linesAdded = LogTextEditor.LineCount - _lineCount;
|
|
||||||
// double lineHeight = LogTextEditor.ExtentHeight / LogTextEditor.LineCount;
|
|
||||||
// double outOfScreenTextHeight = LogTextEditor.ExtentHeight - LogTextEditor.VerticalOffset - LogTextEditor.ViewportHeight;
|
|
||||||
// double outOfScreenLines = outOfScreenTextHeight / lineHeight;
|
|
||||||
//
|
|
||||||
// //we need this help distance because of rounding.
|
|
||||||
// //if we scroll slightly above the end, we still want it
|
|
||||||
// //to scroll down to the new lines.
|
|
||||||
// const double GRACE_DISTANCE = 1d;
|
|
||||||
//
|
|
||||||
// //if we were at the bottom of the log and
|
|
||||||
// //if the last log event was 5 lines long
|
|
||||||
// //we will be 5 lines out sync.
|
|
||||||
// //if this is the case, scroll down.
|
|
||||||
//
|
|
||||||
// //if we are more than that out of sync,
|
|
||||||
// //the user scrolled up and we should not
|
|
||||||
// //mess with anything.
|
|
||||||
// if (_lineCount == 0 || linesAdded + GRACE_DISTANCE > outOfScreenLines)
|
|
||||||
// {
|
|
||||||
// Dispatcher.UIThread.Post(() => LogTextEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle);
|
|
||||||
// _lineCount = LogTextEditor.LineCount;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
private void Control_OnSizeChanged(object? sender, SizeChangedEventArgs e)
|
private void Control_OnSizeChanged(object? sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!(LogsScrollViewer.Extent.Height - LogsScrollViewer.Offset.Y - LogsScrollViewer.Bounds.Bottom <= 60))
|
if (!(LogsScrollViewer.Extent.Height - LogsScrollViewer.Offset.Y - LogsScrollViewer.Bounds.Bottom <= 60))
|
||||||
|
|||||||
@ -7,7 +7,9 @@ using ReactiveUI;
|
|||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
using Serilog.Formatting.Display;
|
using Serilog.Formatting.Display;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Reactive.Disposables;
|
using System.Reactive.Disposables;
|
||||||
|
using System.Text;
|
||||||
using Avalonia.Controls.Documents;
|
using Avalonia.Controls.Documents;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
|
|
||||||
@ -54,7 +56,6 @@ public class LogsDebugViewModel : ActivatableViewModelBase
|
|||||||
_formatter.Format(logEvent, writer);
|
_formatter.Format(logEvent, writer);
|
||||||
string line = writer.ToString();
|
string line = writer.ToString();
|
||||||
|
|
||||||
|
|
||||||
Lines.Add(new Run(line.TrimEnd('\r', '\n') + '\n')
|
Lines.Add(new Run(line.TrimEnd('\r', '\n') + '\n')
|
||||||
{
|
{
|
||||||
Foreground = logEvent.Level switch
|
Foreground = logEvent.Level switch
|
||||||
|
|||||||
@ -71,7 +71,7 @@ public class EnumSwitchNode : Node
|
|||||||
|
|
||||||
foreach (Enum enumValue in Enum.GetValues(enumType).Cast<Enum>())
|
foreach (Enum enumValue in Enum.GetValues(enumType).Cast<Enum>())
|
||||||
{
|
{
|
||||||
InputPin pin = CreateOrAddInputPin(typeof(object), enumValue.ToString().Humanize(LetterCasing.Sentence));
|
InputPin pin = CreateOrAddInputPin(typeof(object), enumValue.Humanize(LetterCasing.Sentence));
|
||||||
pin.PinConnected += OnInputPinConnected;
|
pin.PinConnected += OnInputPinConnected;
|
||||||
pin.PinDisconnected += OnInputPinDisconnected;
|
pin.PinDisconnected += OnInputPinDisconnected;
|
||||||
_inputPins[enumValue] = pin;
|
_inputPins[enumValue] = pin;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user