feat: Phase 0 shells, design system, server skeleton, Docker and CI
- Titano.Ui: DESIGN.md tokens (dark/light), generated 16-px icon set, styles for all standard controls, custom chrome window with snap layouts, rail, job bar, Auto/manual slider, chips, toasts. - Titano desktop shell with sections, Settings (language, theme), About and a --capture screenshot mode. - Titano Server skeleton: env/server.json configuration, self-signed TLS with fingerprint, /health, /server/info, i18n endpoint and the embedded admin panel; in-process server tests. - Docker image (multi-arch, PUID/PGID, health check), compose file, Unraid template; CI, release and nightly workflows; changelog tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
122 files changed
+6838
-22
No files matched your search
@@ -0,0 +1,142 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Advisor-aware slider (BRIEF §10.4, DESIGN §4): in Auto the track is accent with an "Auto · value" pill whose
|
||||
/// tooltip carries the advisor's reason; touching the slider switches to manual (sun track, value shown, reset
|
||||
/// button returns to Auto). When not applicable the value reads "n/a" with the reason in the tooltip.
|
||||
/// </summary>
|
||||
[TemplatePart(Name = PartSlider, Type = typeof(Slider))]
|
||||
public class AutoSlider : Control
|
||||
{
|
||||
public const string PartSlider = "PART_Slider";
|
||||
|
||||
public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(nameof(Header), typeof(string), typeof(AutoSlider));
|
||||
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(nameof(Value), typeof(double), typeof(AutoSlider),
|
||||
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnValueChanged));
|
||||
public static readonly DependencyProperty MinimumProperty = DependencyProperty.Register(nameof(Minimum), typeof(double), typeof(AutoSlider), new PropertyMetadata(0.0));
|
||||
public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register(nameof(Maximum), typeof(double), typeof(AutoSlider), new PropertyMetadata(1.0));
|
||||
public static readonly DependencyProperty SmallChangeProperty = DependencyProperty.Register(nameof(SmallChange), typeof(double), typeof(AutoSlider), new PropertyMetadata(0.01));
|
||||
public static readonly DependencyProperty IsSnapToTickEnabledProperty = DependencyProperty.Register(nameof(IsSnapToTickEnabled), typeof(bool), typeof(AutoSlider), new PropertyMetadata(false));
|
||||
public static readonly DependencyProperty TickFrequencyProperty = DependencyProperty.Register(nameof(TickFrequency), typeof(double), typeof(AutoSlider), new PropertyMetadata(1.0));
|
||||
public static readonly DependencyProperty IsAutoProperty = DependencyProperty.Register(nameof(IsAuto), typeof(bool), typeof(AutoSlider),
|
||||
new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
|
||||
public static readonly DependencyProperty AutoValueProperty = DependencyProperty.Register(nameof(AutoValue), typeof(double), typeof(AutoSlider), new PropertyMetadata(0.0, OnAutoValueChanged));
|
||||
public static readonly DependencyProperty AutoReasonProperty = DependencyProperty.Register(nameof(AutoReason), typeof(string), typeof(AutoSlider));
|
||||
public static readonly DependencyProperty IsApplicableProperty = DependencyProperty.Register(nameof(IsApplicable), typeof(bool), typeof(AutoSlider), new PropertyMetadata(true));
|
||||
public static readonly DependencyProperty NotApplicableReasonProperty = DependencyProperty.Register(nameof(NotApplicableReason), typeof(string), typeof(AutoSlider));
|
||||
public static readonly DependencyProperty ValueFormatProperty = DependencyProperty.Register(nameof(ValueFormat), typeof(string), typeof(AutoSlider), new PropertyMetadata("0.##", OnFormatChanged));
|
||||
public static readonly DependencyProperty DisplayValueProperty = DependencyProperty.Register(nameof(DisplayValue), typeof(string), typeof(AutoSlider), new PropertyMetadata(string.Empty));
|
||||
public static readonly DependencyProperty AutoTextProperty = DependencyProperty.Register(nameof(AutoText), typeof(string), typeof(AutoSlider), new PropertyMetadata(string.Empty));
|
||||
public static readonly DependencyProperty SliderToolTipProperty = DependencyProperty.Register(nameof(SliderToolTip), typeof(object), typeof(AutoSlider));
|
||||
|
||||
public static readonly RoutedCommand ResetCommand = new(nameof(ResetCommand), typeof(AutoSlider));
|
||||
|
||||
private Slider? _slider;
|
||||
private bool _syncing;
|
||||
|
||||
static AutoSlider()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(AutoSlider), new FrameworkPropertyMetadata(typeof(AutoSlider)));
|
||||
}
|
||||
|
||||
public AutoSlider()
|
||||
{
|
||||
CommandBindings.Add(new CommandBinding(ResetCommand, (_, _) => ResetToAuto()));
|
||||
UpdateTexts();
|
||||
}
|
||||
|
||||
public string? Header { get => (string?)GetValue(HeaderProperty); set => SetValue(HeaderProperty, value); }
|
||||
public double Value { get => (double)GetValue(ValueProperty); set => SetValue(ValueProperty, value); }
|
||||
public double Minimum { get => (double)GetValue(MinimumProperty); set => SetValue(MinimumProperty, value); }
|
||||
public double Maximum { get => (double)GetValue(MaximumProperty); set => SetValue(MaximumProperty, value); }
|
||||
public double SmallChange { get => (double)GetValue(SmallChangeProperty); set => SetValue(SmallChangeProperty, value); }
|
||||
public bool IsSnapToTickEnabled { get => (bool)GetValue(IsSnapToTickEnabledProperty); set => SetValue(IsSnapToTickEnabledProperty, value); }
|
||||
public double TickFrequency { get => (double)GetValue(TickFrequencyProperty); set => SetValue(TickFrequencyProperty, value); }
|
||||
public bool IsAuto { get => (bool)GetValue(IsAutoProperty); set => SetValue(IsAutoProperty, value); }
|
||||
public double AutoValue { get => (double)GetValue(AutoValueProperty); set => SetValue(AutoValueProperty, value); }
|
||||
public string? AutoReason { get => (string?)GetValue(AutoReasonProperty); set => SetValue(AutoReasonProperty, value); }
|
||||
public bool IsApplicable { get => (bool)GetValue(IsApplicableProperty); set => SetValue(IsApplicableProperty, value); }
|
||||
public string? NotApplicableReason { get => (string?)GetValue(NotApplicableReasonProperty); set => SetValue(NotApplicableReasonProperty, value); }
|
||||
public string ValueFormat { get => (string)GetValue(ValueFormatProperty); set => SetValue(ValueFormatProperty, value); }
|
||||
|
||||
/// <summary>Formatted current value (read by the template).</summary>
|
||||
public string DisplayValue { get => (string)GetValue(DisplayValueProperty); private set => SetValue(DisplayValueProperty, value); }
|
||||
|
||||
/// <summary>"Auto · 41" pill text; the "Auto" word comes from the catalog (Common.Auto).</summary>
|
||||
public string AutoText { get => (string)GetValue(AutoTextProperty); private set => SetValue(AutoTextProperty, value); }
|
||||
|
||||
/// <summary>Tooltip of the slider track: what moving it does.</summary>
|
||||
public object? SliderToolTip { get => GetValue(SliderToolTipProperty); set => SetValue(SliderToolTipProperty, value); }
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
if (_slider is not null)
|
||||
{
|
||||
_slider.ValueChanged -= OnSliderValueChanged;
|
||||
_slider.PreviewMouseDown -= OnSliderTouched;
|
||||
_slider.PreviewKeyDown -= OnSliderTouched;
|
||||
}
|
||||
base.OnApplyTemplate();
|
||||
_slider = GetTemplateChild(PartSlider) as Slider;
|
||||
if (_slider is not null)
|
||||
{
|
||||
_slider.Value = IsAuto ? AutoValue : Value;
|
||||
_slider.ValueChanged += OnSliderValueChanged;
|
||||
_slider.PreviewMouseDown += OnSliderTouched;
|
||||
_slider.PreviewKeyDown += OnSliderTouched;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Returns the control to the advisor's value.</summary>
|
||||
public void ResetToAuto()
|
||||
{
|
||||
IsAuto = true;
|
||||
Value = AutoValue;
|
||||
UpdateTexts();
|
||||
}
|
||||
|
||||
private void OnSliderTouched(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (e is KeyEventArgs k && k.Key is not (Key.Left or Key.Right or Key.Up or Key.Down or Key.PageUp or Key.PageDown or Key.Home or Key.End)) return;
|
||||
IsAuto = false;
|
||||
}
|
||||
|
||||
private void OnSliderValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (_syncing) return;
|
||||
Value = e.NewValue;
|
||||
}
|
||||
|
||||
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var s = (AutoSlider)d;
|
||||
if (s._slider is not null && !s._syncing)
|
||||
{
|
||||
s._syncing = true;
|
||||
s._slider.Value = (double)e.NewValue;
|
||||
s._syncing = false;
|
||||
}
|
||||
s.UpdateTexts();
|
||||
}
|
||||
|
||||
private static void OnAutoValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var s = (AutoSlider)d;
|
||||
if (s.IsAuto) s.Value = (double)e.NewValue;
|
||||
s.UpdateTexts();
|
||||
}
|
||||
|
||||
private static void OnFormatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((AutoSlider)d).UpdateTexts();
|
||||
|
||||
private void UpdateTexts()
|
||||
{
|
||||
var culture = Core.Localization.Loc.Culture;
|
||||
DisplayValue = Value.ToString(ValueFormat, culture);
|
||||
AutoText = Core.Localization.Loc.L("Common.Auto") + " · " + AutoValue.ToString(ValueFormat, culture);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Titano.Core.Branding;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>The Titano mark drawn as vectors from <see cref="BrandMark"/> geometry (plate optional).</summary>
|
||||
public sealed class BrandMarkIcon : FrameworkElement
|
||||
{
|
||||
public static readonly DependencyProperty ShowPlateProperty = DependencyProperty.Register(
|
||||
nameof(ShowPlate), typeof(bool), typeof(BrandMarkIcon), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
private static readonly Brush Accent = Frozen(new SolidColorBrush(Color.FromRgb(BrandMark.Accent.R, BrandMark.Accent.G, BrandMark.Accent.B)));
|
||||
private static readonly Brush Sun = Frozen(new SolidColorBrush(Color.FromRgb(BrandMark.Sun.R, BrandMark.Sun.G, BrandMark.Sun.B)));
|
||||
private static readonly Brush Plate = Frozen(new SolidColorBrush(Color.FromRgb(BrandMark.Plate.R, BrandMark.Plate.G, BrandMark.Plate.B)));
|
||||
|
||||
public bool ShowPlate
|
||||
{
|
||||
get => (bool)GetValue(ShowPlateProperty);
|
||||
set => SetValue(ShowPlateProperty, value);
|
||||
}
|
||||
|
||||
protected override Size MeasureOverride(Size availableSize)
|
||||
{
|
||||
var s = double.IsInfinity(availableSize.Width) ? 16 : Math.Min(availableSize.Width, double.IsInfinity(availableSize.Height) ? availableSize.Width : availableSize.Height);
|
||||
return new Size(s, s);
|
||||
}
|
||||
|
||||
protected override void OnRender(DrawingContext dc)
|
||||
{
|
||||
var size = Math.Min(ActualWidth, ActualHeight);
|
||||
if (size <= 0) return;
|
||||
var scale = size / BrandMark.Canvas;
|
||||
dc.PushTransform(new ScaleTransform(scale, scale));
|
||||
if (ShowPlate)
|
||||
dc.DrawRoundedRectangle(Plate, null, new Rect(0, 0, BrandMark.Canvas, BrandMark.Canvas), BrandMark.PlateRadius, BrandMark.PlateRadius);
|
||||
// Below ~24 px keep the stroke at least ~1.3 device pixels.
|
||||
var stroke = Math.Max(BrandMark.StrokeWidth, 1.3 / scale);
|
||||
for (var i = 0; i < BrandMark.TickCount; i++)
|
||||
{
|
||||
var (a0, a1) = BrandMark.TickAngles(i);
|
||||
var (x0, y0) = BrandMark.Polar(a0);
|
||||
var (x1, y1) = BrandMark.Polar(a1);
|
||||
var figure = new PathFigure { StartPoint = new Point(x0, y0) };
|
||||
figure.Segments.Add(new ArcSegment(new Point(x1, y1), new Size(BrandMark.RingRadius, BrandMark.RingRadius), 0, false, SweepDirection.Clockwise, true));
|
||||
var geometry = new PathGeometry([figure]);
|
||||
var pen = new Pen(Accent, stroke) { StartLineCap = PenLineCap.Round, EndLineCap = PenLineCap.Round };
|
||||
dc.PushOpacity(BrandMark.TickOpacity(i));
|
||||
dc.DrawGeometry(null, pen, geometry);
|
||||
dc.Pop();
|
||||
}
|
||||
dc.DrawEllipse(Sun, null, new Point(BrandMark.SunX, BrandMark.SunY), BrandMark.SunRadius, BrandMark.SunRadius);
|
||||
dc.Pop();
|
||||
}
|
||||
|
||||
private static Brush Frozen(SolidColorBrush b)
|
||||
{
|
||||
b.Freeze();
|
||||
return b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>24-px pill (DESIGN §4). Selected or recommended chips use the accent border and text.</summary>
|
||||
public class Chip : ContentControl
|
||||
{
|
||||
public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(nameof(IsSelected), typeof(bool), typeof(Chip));
|
||||
public static readonly DependencyProperty IsRecommendedProperty = DependencyProperty.Register(nameof(IsRecommended), typeof(bool), typeof(Chip));
|
||||
public static readonly DependencyProperty RemoveCommandProperty = DependencyProperty.Register(nameof(RemoveCommand), typeof(ICommand), typeof(Chip));
|
||||
public static readonly DependencyProperty RemoveCommandParameterProperty = DependencyProperty.Register(nameof(RemoveCommandParameter), typeof(object), typeof(Chip));
|
||||
public static readonly DependencyProperty RemoveToolTipProperty = DependencyProperty.Register(nameof(RemoveToolTip), typeof(object), typeof(Chip));
|
||||
|
||||
static Chip()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(Chip), new FrameworkPropertyMetadata(typeof(Chip)));
|
||||
}
|
||||
|
||||
public bool IsSelected { get => (bool)GetValue(IsSelectedProperty); set => SetValue(IsSelectedProperty, value); }
|
||||
public bool IsRecommended { get => (bool)GetValue(IsRecommendedProperty); set => SetValue(IsRecommendedProperty, value); }
|
||||
|
||||
/// <summary>When set, a small ✕ button removes the chip (filters, tags).</summary>
|
||||
public ICommand? RemoveCommand { get => (ICommand?)GetValue(RemoveCommandProperty); set => SetValue(RemoveCommandProperty, value); }
|
||||
|
||||
public object? RemoveCommandParameter { get => GetValue(RemoveCommandParameterProperty); set => SetValue(RemoveCommandParameterProperty, value); }
|
||||
public object? RemoveToolTip { get => GetValue(RemoveToolTipProperty); set => SetValue(RemoveToolTipProperty, value); }
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>Attached brushes that let one control template serve every button variant (DESIGN §4 states).</summary>
|
||||
public static class ControlState
|
||||
{
|
||||
public static readonly DependencyProperty HoverBackgroundProperty = DependencyProperty.RegisterAttached("HoverBackground", typeof(Brush), typeof(ControlState));
|
||||
public static readonly DependencyProperty PressedBackgroundProperty = DependencyProperty.RegisterAttached("PressedBackground", typeof(Brush), typeof(ControlState));
|
||||
public static readonly DependencyProperty HoverBorderBrushProperty = DependencyProperty.RegisterAttached("HoverBorderBrush", typeof(Brush), typeof(ControlState));
|
||||
public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(ControlState), new FrameworkPropertyMetadata(new CornerRadius(6)));
|
||||
public static readonly DependencyProperty AccentProperty = DependencyProperty.RegisterAttached("Accent", typeof(Brush), typeof(ControlState), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
public static Brush? GetHoverBackground(DependencyObject d) => (Brush?)d.GetValue(HoverBackgroundProperty);
|
||||
public static void SetHoverBackground(DependencyObject d, Brush? v) => d.SetValue(HoverBackgroundProperty, v);
|
||||
public static Brush? GetPressedBackground(DependencyObject d) => (Brush?)d.GetValue(PressedBackgroundProperty);
|
||||
public static void SetPressedBackground(DependencyObject d, Brush? v) => d.SetValue(PressedBackgroundProperty, v);
|
||||
public static Brush? GetHoverBorderBrush(DependencyObject d) => (Brush?)d.GetValue(HoverBorderBrushProperty);
|
||||
public static void SetHoverBorderBrush(DependencyObject d, Brush? v) => d.SetValue(HoverBorderBrushProperty, v);
|
||||
public static CornerRadius GetCornerRadius(DependencyObject d) => (CornerRadius)d.GetValue(CornerRadiusProperty);
|
||||
public static void SetCornerRadius(DependencyObject d, CornerRadius v) => d.SetValue(CornerRadiusProperty, v);
|
||||
|
||||
/// <summary>Fill colour of slider tracks and progress (accent = Auto, sun = manual).</summary>
|
||||
public static Brush? GetAccent(DependencyObject d) => (Brush?)d.GetValue(AccentProperty);
|
||||
|
||||
public static void SetAccent(DependencyObject d, Brush? v) => d.SetValue(AccentProperty, v);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>null → Collapsed, otherwise Visible.</summary>
|
||||
public sealed class NullToCollapsedConverter : IValueConverter
|
||||
{
|
||||
public static NullToCollapsedConverter Instance { get; } = new();
|
||||
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) =>
|
||||
value is null || value is string { Length: 0 } ? Visibility.Collapsed : Visibility.Visible;
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>true → Collapsed (inverse of BooleanToVisibilityConverter).</summary>
|
||||
public sealed class InverseBoolToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public static InverseBoolToVisibilityConverter Instance { get; } = new();
|
||||
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) =>
|
||||
value is true ? Visibility.Collapsed : Visibility.Visible;
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>0 → Collapsed, any other number → Visible.</summary>
|
||||
public sealed class ZeroToCollapsedConverter : IValueConverter
|
||||
{
|
||||
public static ZeroToCollapsedConverter Instance { get; } = new();
|
||||
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) =>
|
||||
value switch
|
||||
{
|
||||
int i => i == 0 ? Visibility.Collapsed : Visibility.Visible,
|
||||
long l => l == 0 ? Visibility.Collapsed : Visibility.Visible,
|
||||
double d => d == 0 ? Visibility.Collapsed : Visibility.Visible,
|
||||
_ => Visibility.Collapsed,
|
||||
};
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotSupportedException();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>Empty state: the mark, one sentence and the action buttons supplied as content (BRIEF §0.2 rule 6).</summary>
|
||||
public class EmptyState : ContentControl
|
||||
{
|
||||
public static readonly DependencyProperty MessageProperty = DependencyProperty.Register(nameof(Message), typeof(string), typeof(EmptyState));
|
||||
|
||||
static EmptyState()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(EmptyState), new FrameworkPropertyMetadata(typeof(EmptyState)));
|
||||
}
|
||||
|
||||
public string? Message { get => (string?)GetValue(MessageProperty); set => SetValue(MessageProperty, value); }
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>Attached field helpers: placeholder text and an inline leading icon for text inputs.</summary>
|
||||
public static class Field
|
||||
{
|
||||
public static readonly DependencyProperty PlaceholderProperty = DependencyProperty.RegisterAttached(
|
||||
"Placeholder", typeof(string), typeof(Field), new FrameworkPropertyMetadata(null));
|
||||
|
||||
public static readonly DependencyProperty GlyphProperty = DependencyProperty.RegisterAttached(
|
||||
"Glyph", typeof(IconData), typeof(Field), new FrameworkPropertyMetadata(null));
|
||||
|
||||
public static string? GetPlaceholder(DependencyObject d) => (string?)d.GetValue(PlaceholderProperty);
|
||||
|
||||
public static void SetPlaceholder(DependencyObject d, string? value) => d.SetValue(PlaceholderProperty, value);
|
||||
|
||||
public static IconData? GetGlyph(DependencyObject d) => (IconData?)d.GetValue(GlyphProperty);
|
||||
|
||||
public static void SetGlyph(DependencyObject d, IconData? value) => d.SetValue(GlyphProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>Attached glyph for buttons: renders an <see cref="IconData"/> before (or instead of) the content.</summary>
|
||||
public static class ButtonIcon
|
||||
{
|
||||
public static readonly DependencyProperty GlyphProperty = DependencyProperty.RegisterAttached(
|
||||
"Glyph", typeof(IconData), typeof(ButtonIcon), new FrameworkPropertyMetadata(null));
|
||||
|
||||
public static IconData? GetGlyph(DependencyObject d) => (IconData?)d.GetValue(GlyphProperty);
|
||||
|
||||
public static void SetGlyph(DependencyObject d, IconData? value) => d.SetValue(GlyphProperty, value);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>Renders an <see cref="IconData"/> on the 16-unit grid, scaled to the element size, in the inherited foreground.</summary>
|
||||
public sealed class Icon : FrameworkElement
|
||||
{
|
||||
public static readonly DependencyProperty GlyphProperty = DependencyProperty.Register(
|
||||
nameof(Glyph), typeof(IconData), typeof(Icon),
|
||||
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public static readonly DependencyProperty ForegroundProperty = TextElement.ForegroundProperty.AddOwner(
|
||||
typeof(Icon), new FrameworkPropertyMetadata(Brushes.Gray, FrameworkPropertyMetadataOptions.Inherits | FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public static readonly DependencyProperty SizeProperty = DependencyProperty.Register(
|
||||
nameof(Size), typeof(double), typeof(Icon),
|
||||
new FrameworkPropertyMetadata(16.0, FrameworkPropertyMetadataOptions.AffectsMeasure));
|
||||
|
||||
public static readonly DependencyProperty StrokeWidthProperty = DependencyProperty.Register(
|
||||
nameof(StrokeWidth), typeof(double), typeof(Icon),
|
||||
new FrameworkPropertyMetadata(1.5, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
static Icon()
|
||||
{
|
||||
SnapsToDevicePixelsProperty.OverrideMetadata(typeof(Icon), new FrameworkPropertyMetadata(true));
|
||||
FocusableProperty.OverrideMetadata(typeof(Icon), new FrameworkPropertyMetadata(false));
|
||||
}
|
||||
|
||||
public IconData? Glyph
|
||||
{
|
||||
get => (IconData?)GetValue(GlyphProperty);
|
||||
set => SetValue(GlyphProperty, value);
|
||||
}
|
||||
|
||||
public Brush Foreground
|
||||
{
|
||||
get => (Brush)GetValue(ForegroundProperty);
|
||||
set => SetValue(ForegroundProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>Edge length in device-independent pixels (default 16).</summary>
|
||||
public double Size
|
||||
{
|
||||
get => (double)GetValue(SizeProperty);
|
||||
set => SetValue(SizeProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>Stroke width on the 16-unit grid (default 1.5).</summary>
|
||||
public double StrokeWidth
|
||||
{
|
||||
get => (double)GetValue(StrokeWidthProperty);
|
||||
set => SetValue(StrokeWidthProperty, value);
|
||||
}
|
||||
|
||||
protected override Size MeasureOverride(Size availableSize) => new(Size, Size);
|
||||
|
||||
protected override void OnRender(DrawingContext dc)
|
||||
{
|
||||
var glyph = Glyph;
|
||||
if (glyph is null) return;
|
||||
var scale = Size / 16.0;
|
||||
dc.PushTransform(new ScaleTransform(scale, scale));
|
||||
if (glyph.Fill is not null) dc.DrawGeometry(Foreground, null, glyph.Fill);
|
||||
if (glyph.Stroke is not null)
|
||||
{
|
||||
var pen = new Pen(Foreground, StrokeWidth)
|
||||
{
|
||||
StartLineCap = PenLineCap.Round,
|
||||
EndLineCap = PenLineCap.Round,
|
||||
LineJoin = PenLineJoin.Round,
|
||||
};
|
||||
pen.Freeze();
|
||||
dc.DrawGeometry(null, pen, glyph.Stroke);
|
||||
}
|
||||
dc.Pop();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>A 16×16 icon: a stroked outline and an optional filled part (DESIGN.md §5).</summary>
|
||||
public sealed class IconData
|
||||
{
|
||||
private Geometry? _stroke;
|
||||
private Geometry? _fill;
|
||||
|
||||
/// <summary>Outline drawn with a 1.5-px round pen in the foreground colour.</summary>
|
||||
public Geometry? Stroke
|
||||
{
|
||||
get => _stroke;
|
||||
set => _stroke = Freeze(value);
|
||||
}
|
||||
|
||||
/// <summary>Solid part filled with the foreground colour.</summary>
|
||||
public Geometry? Fill
|
||||
{
|
||||
get => _fill;
|
||||
set => _fill = Freeze(value);
|
||||
}
|
||||
|
||||
private static Geometry? Freeze(Geometry? g)
|
||||
{
|
||||
if (g is { CanFreeze: true, IsFrozen: false }) g.Freeze();
|
||||
return g;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>40-px strip under the title bar: current job, progress, time left and a stop button (DESIGN §4).</summary>
|
||||
public class JobBar : Control
|
||||
{
|
||||
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(nameof(Text), typeof(string), typeof(JobBar));
|
||||
public static readonly DependencyProperty ProgressProperty = DependencyProperty.Register(nameof(Progress), typeof(double), typeof(JobBar), new PropertyMetadata(0.0));
|
||||
public static readonly DependencyProperty IsIndeterminateProperty = DependencyProperty.Register(nameof(IsIndeterminate), typeof(bool), typeof(JobBar));
|
||||
public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register(nameof(IsActive), typeof(bool), typeof(JobBar));
|
||||
public static readonly DependencyProperty StopCommandProperty = DependencyProperty.Register(nameof(StopCommand), typeof(ICommand), typeof(JobBar));
|
||||
public static readonly DependencyProperty StopToolTipProperty = DependencyProperty.Register(nameof(StopToolTip), typeof(object), typeof(JobBar));
|
||||
|
||||
static JobBar()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(JobBar), new FrameworkPropertyMetadata(typeof(JobBar)));
|
||||
}
|
||||
|
||||
public string? Text { get => (string?)GetValue(TextProperty); set => SetValue(TextProperty, value); }
|
||||
|
||||
/// <summary>0..1.</summary>
|
||||
public double Progress { get => (double)GetValue(ProgressProperty); set => SetValue(ProgressProperty, value); }
|
||||
|
||||
public bool IsIndeterminate { get => (bool)GetValue(IsIndeterminateProperty); set => SetValue(IsIndeterminateProperty, value); }
|
||||
|
||||
/// <summary>A job is running: shows the progress fill and the stop button.</summary>
|
||||
public bool IsActive { get => (bool)GetValue(IsActiveProperty); set => SetValue(IsActiveProperty, value); }
|
||||
|
||||
public ICommand? StopCommand { get => (ICommand?)GetValue(StopCommandProperty); set => SetValue(StopCommandProperty, value); }
|
||||
public object? StopToolTip { get => GetValue(StopToolTipProperty); set => SetValue(StopToolTipProperty, value); }
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>Attached state of the navigation rail (DESIGN §3: 128 px, collapses to 48 px icons).</summary>
|
||||
public static class NavRail
|
||||
{
|
||||
public static readonly DependencyProperty IsCollapsedProperty = DependencyProperty.RegisterAttached(
|
||||
"IsCollapsed", typeof(bool), typeof(NavRail), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
public static bool GetIsCollapsed(DependencyObject d) => (bool)d.GetValue(IsCollapsedProperty);
|
||||
|
||||
public static void SetIsCollapsed(DependencyObject d, bool value) => d.SetValue(IsCollapsedProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>One rail entry: icon, label, optional attention badge; active = card fill + 3-px accent edge.</summary>
|
||||
public class NavRailButton : RadioButton
|
||||
{
|
||||
public static readonly DependencyProperty GlyphProperty = DependencyProperty.Register(
|
||||
nameof(Glyph), typeof(IconData), typeof(NavRailButton));
|
||||
|
||||
public static readonly DependencyProperty BadgeProperty = DependencyProperty.Register(
|
||||
nameof(Badge), typeof(int), typeof(NavRailButton), new PropertyMetadata(0));
|
||||
|
||||
static NavRailButton()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(NavRailButton), new FrameworkPropertyMetadata(typeof(NavRailButton)));
|
||||
}
|
||||
|
||||
public IconData? Glyph
|
||||
{
|
||||
get => (IconData?)GetValue(GlyphProperty);
|
||||
set => SetValue(GlyphProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>Count of things needing attention; hidden when 0.</summary>
|
||||
public int Badge
|
||||
{
|
||||
get => (int)GetValue(BadgeProperty);
|
||||
set => SetValue(BadgeProperty, value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>Status vocabulary of DESIGN §4: colour is always paired with a glyph and a word.</summary>
|
||||
public enum StatusKind
|
||||
{
|
||||
Analysed,
|
||||
NotAnalysed,
|
||||
Proxies,
|
||||
NoProxies,
|
||||
Rendered,
|
||||
Synced,
|
||||
Remote,
|
||||
Analysing,
|
||||
Warning,
|
||||
Error,
|
||||
Running,
|
||||
Queued,
|
||||
Done,
|
||||
Failed,
|
||||
Paused,
|
||||
Online,
|
||||
Offline,
|
||||
}
|
||||
|
||||
/// <summary>Glyph + text in the colour of the status kind.</summary>
|
||||
public class StatusGlyph : Control
|
||||
{
|
||||
public static readonly DependencyProperty KindProperty = DependencyProperty.Register(nameof(Kind), typeof(StatusKind), typeof(StatusGlyph), new PropertyMetadata(StatusKind.Analysed));
|
||||
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(nameof(Text), typeof(string), typeof(StatusGlyph));
|
||||
|
||||
static StatusGlyph()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(StatusGlyph), new FrameworkPropertyMetadata(typeof(StatusGlyph)));
|
||||
FocusableProperty.OverrideMetadata(typeof(StatusGlyph), new FrameworkPropertyMetadata(false));
|
||||
}
|
||||
|
||||
public StatusKind Kind { get => (StatusKind)GetValue(KindProperty); set => SetValue(KindProperty, value); }
|
||||
public string? Text { get => (string?)GetValue(TextProperty); set => SetValue(TextProperty, value); }
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shell;
|
||||
using Titano.Ui.Interop;
|
||||
using Titano.Ui.Theming;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Window with Titano's custom chrome: 34-px title bar in the Chrome colour, brand mark, title, optional
|
||||
/// title-bar content and drawn caption buttons. The maximise button answers HTMAXBUTTON so Windows 11
|
||||
/// snap layouts appear on hover.
|
||||
/// </summary>
|
||||
[TemplatePart(Name = PartMaximize, Type = typeof(Button))]
|
||||
public class TitanoWindow : Window
|
||||
{
|
||||
public const string PartMaximize = "PART_Maximize";
|
||||
|
||||
public static readonly DependencyProperty TitleBarContentProperty = DependencyProperty.Register(
|
||||
nameof(TitleBarContent), typeof(object), typeof(TitanoWindow));
|
||||
|
||||
public static readonly DependencyProperty IsDialogProperty = DependencyProperty.Register(
|
||||
nameof(IsDialog), typeof(bool), typeof(TitanoWindow), new PropertyMetadata(false));
|
||||
|
||||
public static readonly DependencyProperty IsMaximizeHoveredProperty = DependencyProperty.Register(
|
||||
nameof(IsMaximizeHovered), typeof(bool), typeof(TitanoWindow), new PropertyMetadata(false));
|
||||
|
||||
private Button? _maximize;
|
||||
|
||||
static TitanoWindow()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(TitanoWindow), new FrameworkPropertyMetadata(typeof(TitanoWindow)));
|
||||
}
|
||||
|
||||
public TitanoWindow()
|
||||
{
|
||||
WindowChrome.SetWindowChrome(this, new WindowChrome
|
||||
{
|
||||
CaptionHeight = 34,
|
||||
ResizeBorderThickness = new Thickness(6),
|
||||
GlassFrameThickness = new Thickness(0),
|
||||
CornerRadius = new CornerRadius(0),
|
||||
UseAeroCaptionButtons = false,
|
||||
});
|
||||
CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, (_, _) => SystemCommands.CloseWindow(this)));
|
||||
CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand, (_, _) => SystemCommands.MinimizeWindow(this)));
|
||||
CommandBindings.Add(new CommandBinding(SystemCommands.MaximizeWindowCommand, (_, _) => ToggleMaximize()));
|
||||
CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, (_, _) => ToggleMaximize()));
|
||||
UseLayoutRounding = true;
|
||||
TextOptions.SetTextFormattingMode(this, TextFormattingMode.Display);
|
||||
}
|
||||
|
||||
/// <summary>Extra content placed in the title bar between the title and the caption buttons.</summary>
|
||||
public object? TitleBarContent
|
||||
{
|
||||
get => GetValue(TitleBarContentProperty);
|
||||
set => SetValue(TitleBarContentProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>Dialog windows show only the close button.</summary>
|
||||
public bool IsDialog
|
||||
{
|
||||
get => (bool)GetValue(IsDialogProperty);
|
||||
set => SetValue(IsDialogProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>True while the pointer is over the maximise button (non-client, so tracked from WndProc).</summary>
|
||||
public bool IsMaximizeHovered
|
||||
{
|
||||
get => (bool)GetValue(IsMaximizeHoveredProperty);
|
||||
set => SetValue(IsMaximizeHoveredProperty, value);
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
_maximize = GetTemplateChild(PartMaximize) as Button;
|
||||
}
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
{
|
||||
base.OnSourceInitialized(e);
|
||||
ThemeManager.ApplyChrome(this);
|
||||
if (PresentationSource.FromVisual(this) is HwndSource source) source.AddHook(WndProc);
|
||||
}
|
||||
|
||||
private void ToggleMaximize()
|
||||
{
|
||||
if (WindowState == WindowState.Maximized) SystemCommands.RestoreWindow(this);
|
||||
else SystemCommands.MaximizeWindow(this);
|
||||
}
|
||||
|
||||
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case NativeMethods.WM_NCHITTEST when _maximize is { IsVisible: true } && ResizeMode is ResizeMode.CanResize or ResizeMode.CanResizeWithGrip:
|
||||
if (IsOverMaximize(lParam))
|
||||
{
|
||||
IsMaximizeHovered = true;
|
||||
handled = true;
|
||||
return NativeMethods.HTMAXBUTTON;
|
||||
}
|
||||
IsMaximizeHovered = false;
|
||||
break;
|
||||
case NativeMethods.WM_NCLBUTTONDOWN when wParam == NativeMethods.HTMAXBUTTON:
|
||||
handled = true;
|
||||
break;
|
||||
case NativeMethods.WM_NCLBUTTONUP when wParam == NativeMethods.HTMAXBUTTON:
|
||||
handled = true;
|
||||
ToggleMaximize();
|
||||
break;
|
||||
case NativeMethods.WM_NCMOUSELEAVE:
|
||||
IsMaximizeHovered = false;
|
||||
break;
|
||||
}
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
private bool IsOverMaximize(IntPtr lParam)
|
||||
{
|
||||
if (_maximize is null) return false;
|
||||
var x = unchecked((short)(long)lParam);
|
||||
var y = unchecked((short)((long)lParam >> 16));
|
||||
try
|
||||
{
|
||||
var point = _maximize.PointFromScreen(new Point(x, y));
|
||||
return point.X >= 0 && point.Y >= 0 && point.X < _maximize.ActualWidth && point.Y < _maximize.ActualHeight;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using Titano.Ui.Mvvm;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>One in-window notification (DESIGN §4: 420 px, accent left edge, one action, 8 s, hover pauses).</summary>
|
||||
public sealed class Toast : ObservableObject
|
||||
{
|
||||
public required string Title { get; init; }
|
||||
public string? Message { get; init; }
|
||||
public string? ActionText { get; init; }
|
||||
public ICommand? ActionCommand { get; init; }
|
||||
public string? ActionToolTip { get; init; }
|
||||
public TimeSpan Lifetime { get; init; } = TimeSpan.FromSeconds(8);
|
||||
}
|
||||
|
||||
/// <summary>Bottom-right stack of <see cref="Toast"/>s with auto-dismiss.</summary>
|
||||
public class ToastHost : ItemsControl
|
||||
{
|
||||
private readonly Dictionary<Toast, DispatcherTimer> _timers = [];
|
||||
|
||||
static ToastHost()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(ToastHost), new FrameworkPropertyMetadata(typeof(ToastHost)));
|
||||
}
|
||||
|
||||
public ToastHost()
|
||||
{
|
||||
ItemsSource = Toasts;
|
||||
CommandBindings.Add(new CommandBinding(DismissCommand, (_, e) =>
|
||||
{
|
||||
if (e.Parameter is Toast t) Dismiss(t);
|
||||
}));
|
||||
}
|
||||
|
||||
public static RoutedCommand DismissCommand { get; } = new(nameof(DismissCommand), typeof(ToastHost));
|
||||
|
||||
public ObservableCollection<Toast> Toasts { get; } = [];
|
||||
|
||||
public void Show(Toast toast)
|
||||
{
|
||||
Toasts.Add(toast);
|
||||
while (Toasts.Count > 3) Dismiss(Toasts[0]);
|
||||
var timer = new DispatcherTimer { Interval = toast.Lifetime };
|
||||
timer.Tick += (_, _) => Dismiss(toast);
|
||||
_timers[toast] = timer;
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
/// <summary>Pauses or resumes the dismissal timer (hover pauses).</summary>
|
||||
public void SetPaused(Toast toast, bool paused)
|
||||
{
|
||||
if (!_timers.TryGetValue(toast, out var timer)) return;
|
||||
if (paused) timer.Stop();
|
||||
else timer.Start();
|
||||
}
|
||||
|
||||
public void Dismiss(Toast toast)
|
||||
{
|
||||
if (_timers.Remove(toast, out var timer)) timer.Stop();
|
||||
Toasts.Remove(toast);
|
||||
}
|
||||
|
||||
protected override void OnPreviewMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnPreviewMouseMove(e);
|
||||
foreach (var t in Toasts.ToList()) SetPaused(t, true);
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseLeave(e);
|
||||
foreach (var t in Toasts.ToList()) SetPaused(t, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="clr-namespace:Titano.Ui.Controls">
|
||||
<!-- Generated by branding/ui-icons/icons.py — 16-px grid, 1.5-px round strokes (DESIGN.md §5). Do not edit by hand. -->
|
||||
<ui:IconData x:Key="Icon.About" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M8 7 V11 M8 4.8 V5.2" />
|
||||
<ui:IconData x:Key="Icon.ActualSize" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M5 6 L6 5.5 V10.5 M9.5 6 L10.5 5.5 V10.5 M8 7 V7.1 M8 9.5 V9.6" />
|
||||
<ui:IconData x:Key="Icon.Analyse" Stroke="M1.5 8.5 H4.5 L6.5 3.5 L9.5 12.5 L11.5 8.5 H14.5" />
|
||||
<ui:IconData x:Key="Icon.Archive" Stroke="M2 4.5 H14 V13.5 H2 Z M2 2 H14 V4.5 H2 Z M6 8 H10" />
|
||||
<ui:IconData x:Key="Icon.Back" Stroke="M13 8 H3 M7 4 L3 8 L7 12" />
|
||||
<ui:IconData x:Key="Icon.Calendar" Stroke="M3.0 3 H13.0 A1.5 1.5 0 0 1 14.5 4.5 V13.0 A1.5 1.5 0 0 1 13.0 14.5 H3.0 A1.5 1.5 0 0 1 1.5 13.0 V4.5 A1.5 1.5 0 0 1 3.0 3 Z M1.5 6.5 H14.5 M5 1.5 V4 M11 1.5 V4" />
|
||||
<ui:IconData x:Key="Icon.Camera" Stroke="M1.5 5 A1 1 0 0 1 2.5 4 H4.5 L6 2.5 H10 L11.5 4 H13.5 A1 1 0 0 1 14.5 5 V12.5 A1 1 0 0 1 13.5 13.5 H2.5 A1 1 0 0 1 1.5 12.5 Z M5.2 8.5 A2.8 2.8 0 1 0 10.8 8.5 A2.8 2.8 0 1 0 5.2 8.5 Z" />
|
||||
<ui:IconData x:Key="Icon.Cancel" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M5.8 5.8 L10.2 10.2 M10.2 5.8 L5.8 10.2" />
|
||||
<ui:IconData x:Key="Icon.Card" Stroke="M4.5 1.5 H10 L12.5 4 V13.5 A1 1 0 0 1 11.5 14.5 H4.5 A1 1 0 0 1 3.5 13.5 V2.5 A1 1 0 0 1 4.5 1.5 Z M6 3.5 V5.5 M8 3.5 V5.5 M10 4.5 V5.5" />
|
||||
<ui:IconData x:Key="Icon.Chart" Stroke="M2 2 V14 H14 M4.5 10.5 L7.5 7 L9.5 9 L13.5 4" />
|
||||
<ui:IconData x:Key="Icon.Check" Stroke="M3 8.5 L6.5 12 L13 4.5" />
|
||||
<ui:IconData x:Key="Icon.ChevronDown" Stroke="M4 6 L8 10 L12 6" />
|
||||
<ui:IconData x:Key="Icon.ChevronLeft" Stroke="M10 4 L6 8 L10 12" />
|
||||
<ui:IconData x:Key="Icon.ChevronRight" Stroke="M6 4 L10 8 L6 12" />
|
||||
<ui:IconData x:Key="Icon.ChevronUp" Stroke="M4 10 L8 6 L12 10" />
|
||||
<ui:IconData x:Key="Icon.Clipboard" Stroke="M4.0 2.5 H12.0 A1.5 1.5 0 0 1 13.5 4.0 V13.0 A1.5 1.5 0 0 1 12.0 14.5 H4.0 A1.5 1.5 0 0 1 2.5 13.0 V4.0 A1.5 1.5 0 0 1 4.0 2.5 Z M6.3 1.5 H9.7 A0.8 0.8 0 0 1 10.5 2.3 V3.2 A0.8 0.8 0 0 1 9.7 4.0 H6.3 A0.8 0.8 0 0 1 5.5 3.2 V2.3 A0.8 0.8 0 0 1 6.3 1.5 Z" />
|
||||
<ui:IconData x:Key="Icon.Clock" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M8 4.5 V8 L10.5 9.5" />
|
||||
<ui:IconData x:Key="Icon.Close" Stroke="M4 4 L12 12 M12 4 L4 12" />
|
||||
<ui:IconData x:Key="Icon.Compare" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M8 1 V15" />
|
||||
<ui:IconData x:Key="Icon.Copy" Stroke="M6.5 5 H13.0 A1.5 1.5 0 0 1 14.5 6.5 V13.0 A1.5 1.5 0 0 1 13.0 14.5 H6.5 A1.5 1.5 0 0 1 5 13.0 V6.5 A1.5 1.5 0 0 1 6.5 5 Z M11 5 V2.5 A1 1 0 0 0 10 1.5 H2.5 A1 1 0 0 0 1.5 2.5 V10 A1 1 0 0 0 2.5 11 H5" />
|
||||
<ui:IconData x:Key="Icon.CropMask" Stroke="M4 1.5 V12 H14.5 M1.5 4 H12 V14.5" />
|
||||
<ui:IconData x:Key="Icon.Cross" Stroke="M4.5 4.5 L11.5 11.5 M11.5 4.5 L4.5 11.5" />
|
||||
<ui:IconData x:Key="Icon.Database" Stroke="M2.5 3.8 C2.5 2.5 13.5 2.5 13.5 3.8 C13.5 5.1 2.5 5.1 2.5 3.8 Z M2.5 3.8 V12.2 C2.5 13.5 13.5 13.5 13.5 12.2 V3.8 M2.5 8 C2.5 9.3 13.5 9.3 13.5 8" />
|
||||
<ui:IconData x:Key="Icon.Delete" Stroke="M2.5 4 H13.5 M6 4 V2.5 H10 V4 M3.8 4 L4.6 14 H11.4 L12.2 4 M6.6 6.8 V11.2 M9.4 6.8 V11.2" />
|
||||
<ui:IconData x:Key="Icon.Dot" Fill="M4.5 8 A3.5 3.5 0 1 0 11.5 8 A3.5 3.5 0 1 0 4.5 8 Z" />
|
||||
<ui:IconData x:Key="Icon.Download" Stroke="M8 2 V10 M4.5 6.5 L8 10 L11.5 6.5 M2.5 13.5 H13.5" />
|
||||
<ui:IconData x:Key="Icon.Drive" Stroke="M3.0 4.5 H13.0 A1.5 1.5 0 0 1 14.5 6.0 V10.0 A1.5 1.5 0 0 1 13.0 11.5 H3.0 A1.5 1.5 0 0 1 1.5 10.0 V6.0 A1.5 1.5 0 0 1 3.0 4.5 Z M4.5 8 H4.6 M7 8 H11.5" />
|
||||
<ui:IconData x:Key="Icon.Duplicate" Stroke="M6.5 5 H13.0 A1.5 1.5 0 0 1 14.5 6.5 V13.0 A1.5 1.5 0 0 1 13.0 14.5 H6.5 A1.5 1.5 0 0 1 5 13.0 V6.5 A1.5 1.5 0 0 1 6.5 5 Z M11 5 V2.5 A1 1 0 0 0 10 1.5 H2.5 A1 1 0 0 0 1.5 2.5 V10 A1 1 0 0 0 2.5 11 H5" />
|
||||
<ui:IconData x:Key="Icon.Eject" Stroke="M3 13 H13" Fill="M8 2.8 L13 9.5 H3 Z" />
|
||||
<ui:IconData x:Key="Icon.ErrorCircle" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M5.8 5.8 L10.2 10.2 M10.2 5.8 L5.8 10.2" />
|
||||
<ui:IconData x:Key="Icon.Exclude" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M3.4 12.6 L12.6 3.4" />
|
||||
<ui:IconData x:Key="Icon.Export" Stroke="M8 10 V1.8 M4.8 5 L8 1.8 L11.2 5 M5 7.5 H3 A1 1 0 0 0 2 8.5 V13.5 A1 1 0 0 0 3 14.5 H13 A1 1 0 0 0 14 13.5 V8.5 A1 1 0 0 0 13 7.5 H11" />
|
||||
<ui:IconData x:Key="Icon.Exposure" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M3.4 12.6 L12.6 3.4 M4.5 6 H7 M5.75 4.75 V7.25 M9 10 H11.5" />
|
||||
<ui:IconData x:Key="Icon.ExternalLink" Stroke="M9.5 2 H14 V6.5 M14 2 L7.5 8.5 M12 9.5 V13 A1 1 0 0 1 11 14 H3 A1 1 0 0 1 2 13 V5 A1 1 0 0 1 3 4 H6.5" />
|
||||
<ui:IconData x:Key="Icon.Eye" Stroke="M1.5 8 C3.5 4 12.5 4 14.5 8 C12.5 12 3.5 12 1.5 8 Z M5.8 8 A2.2 2.2 0 1 0 10.2 8 A2.2 2.2 0 1 0 5.8 8 Z" />
|
||||
<ui:IconData x:Key="Icon.Filmstrip" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M4.5 2.5 V13.5 M11.5 2.5 V13.5 M1.5 6 H4.5 M1.5 10 H4.5 M11.5 6 H14.5 M11.5 10 H14.5" />
|
||||
<ui:IconData x:Key="Icon.Filter" Stroke="M1.5 2.5 H14.5 L9.5 8.5 V13.5 L6.5 12 V8.5 Z" />
|
||||
<ui:IconData x:Key="Icon.Folder" Stroke="M1.5 4 A1 1 0 0 1 2.5 3 H6 L7.5 4.5 H13.5 A1 1 0 0 1 14.5 5.5 V12.5 A1 1 0 0 1 13.5 13.5 H2.5 A1 1 0 0 1 1.5 12.5 Z" />
|
||||
<ui:IconData x:Key="Icon.FolderOpen" Stroke="M1.5 12.5 V4 A1 1 0 0 1 2.5 3 H6 L7.5 4.5 H12.5 V6.5 M1.5 12.5 L3.5 7 H14.5 L12.5 13.5 H2.5 A1 1 0 0 1 1.5 12.5 Z" />
|
||||
<ui:IconData x:Key="Icon.Forward" Stroke="M3 8 H13 M9 4 L13 8 L9 12" />
|
||||
<ui:IconData x:Key="Icon.Fullscreen" Stroke="M2 6 V2 H6 M10 2 H14 V6 M14 10 V14 H10 M6 14 H2 V10" />
|
||||
<ui:IconData x:Key="Icon.Gpu" Stroke="M5.0 3.5 H11.0 A1.5 1.5 0 0 1 12.5 5.0 V11.0 A1.5 1.5 0 0 1 11.0 12.5 H5.0 A1.5 1.5 0 0 1 3.5 11.0 V5.0 A1.5 1.5 0 0 1 5.0 3.5 Z M6.5 6 H9.5 A0.5 0.5 0 0 1 10 6.5 V9.5 A0.5 0.5 0 0 1 9.5 10 H6.5 A0.5 0.5 0 0 1 6 9.5 V6.5 A0.5 0.5 0 0 1 6.5 6 Z M6 1.5 V3.5 M10 1.5 V3.5 M6 12.5 V14.5 M10 12.5 V14.5 M1.5 6 H3.5 M1.5 10 H3.5 M12.5 6 H14.5 M12.5 10 H14.5" />
|
||||
<ui:IconData x:Key="Icon.Grip" Fill="M5 4 A1 1 0 1 0 7 4 A1 1 0 1 0 5 4 ZM9 4 A1 1 0 1 0 11 4 A1 1 0 1 0 9 4 ZM5 8 A1 1 0 1 0 7 8 A1 1 0 1 0 5 8 ZM9 8 A1 1 0 1 0 11 8 A1 1 0 1 0 9 8 ZM5 12 A1 1 0 1 0 7 12 A1 1 0 1 0 5 12 ZM9 12 A1 1 0 1 0 11 12 A1 1 0 1 0 9 12 Z" />
|
||||
<ui:IconData x:Key="Icon.HalfDot" Stroke="M4.5 8 A3.5 3.5 0 1 0 11.5 8 A3.5 3.5 0 1 0 4.5 8 Z" Fill="M8 4.5 A3.5 3.5 0 0 1 8 11.5 Z" />
|
||||
<ui:IconData x:Key="Icon.Hero" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z" Fill="M8 4.8 L8.9 6.9 L11.1 7.1 L9.4 8.5 L9.9 10.7 L8 9.5 L6.1 10.7 L6.6 8.5 L4.9 7.1 L7.1 6.9 Z" />
|
||||
<ui:IconData x:Key="Icon.Image" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M1.5 11 L5.5 7 L9 10.5 L11 8.5 L14.5 12" Fill="M9.600000000000001 5.6 A1.2 1.2 0 1 0 12.0 5.6 A1.2 1.2 0 1 0 9.600000000000001 5.6 Z" />
|
||||
<ui:IconData x:Key="Icon.Import" Stroke="M8 2V10 M4.5 6.5 L8 10 L11.5 6.5 M2.5 13.5 H13.5" />
|
||||
<ui:IconData x:Key="Icon.Info" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M8 7 V11 M8 4.8 V5.2" />
|
||||
<ui:IconData x:Key="Icon.Jobs" Stroke="M3 8 H13 M3 4 H13 M3 12 H9" />
|
||||
<ui:IconData x:Key="Icon.Key" Stroke="M2 10.5 A3 3 0 1 0 8 10.5 A3 3 0 1 0 2 10.5 Z M7.2 8.3 L13.5 2 M11.5 4 L13 5.5 M9.8 5.7 L11 6.9" />
|
||||
<ui:IconData x:Key="Icon.Keyframe" Stroke="M8 2 L13 8 L8 14 L3 8 Z" />
|
||||
<ui:IconData x:Key="Icon.Layers" Stroke="M8 1.8 L14.5 5.2 L8 8.6 L1.5 5.2 Z M1.5 8.2 L8 11.6 L14.5 8.2 M1.5 11 L8 14.4 L14.5 11" />
|
||||
<ui:IconData x:Key="Icon.Library" Stroke="M2.5 1.5 H6.0 A1 1 0 0 1 7.0 2.5 V6.0 A1 1 0 0 1 6.0 7.0 H2.5 A1 1 0 0 1 1.5 6.0 V2.5 A1 1 0 0 1 2.5 1.5 ZM10 1.5 H13.5 A1 1 0 0 1 14.5 2.5 V6.0 A1 1 0 0 1 13.5 7.0 H10 A1 1 0 0 1 9 6.0 V2.5 A1 1 0 0 1 10 1.5 ZM2.5 9 H6.0 A1 1 0 0 1 7.0 10 V13.5 A1 1 0 0 1 6.0 14.5 H2.5 A1 1 0 0 1 1.5 13.5 V10 A1 1 0 0 1 2.5 9 ZM10 9 H13.5 A1 1 0 0 1 14.5 10 V13.5 A1 1 0 0 1 13.5 14.5 H10 A1 1 0 0 1 9 13.5 V10 A1 1 0 0 1 10 9 Z" />
|
||||
<ui:IconData x:Key="Icon.Link" Stroke="M6.8 9.2 L9.2 6.8 M7.5 4.5 L9 3 A2.8 2.8 0 0 1 13 7 L11.5 8.5 M8.5 11.5 L7 13 A2.8 2.8 0 0 1 3 9 L4.5 7.5" />
|
||||
<ui:IconData x:Key="Icon.Lock" Stroke="M4.5 7 H11.5 A1.5 1.5 0 0 1 13 8.5 V13.0 A1.5 1.5 0 0 1 11.5 14.5 H4.5 A1.5 1.5 0 0 1 3 13.0 V8.5 A1.5 1.5 0 0 1 4.5 7 Z M5.5 7 V5 A2.5 2.5 0 0 1 10.5 5 V7" />
|
||||
<ui:IconData x:Key="Icon.Logs" Stroke="M3.5 1.5 H9.5 L12.5 4.5 V14.5 H3.5 Z M5.5 7 H10.5 M5.5 9.5 H10.5 M5.5 12 H8.5" />
|
||||
<ui:IconData x:Key="Icon.Menu" Stroke="M2.5 4 H13.5 M2.5 8 H13.5 M2.5 12 H13.5" />
|
||||
<ui:IconData x:Key="Icon.Minus" Stroke="M3 8 H13" />
|
||||
<ui:IconData x:Key="Icon.Moon" Stroke="M9.5 1.8 A6.5 6.5 0 1 0 14.2 11.2 A5.5 5.5 0 0 1 9.5 1.8 Z" />
|
||||
<ui:IconData x:Key="Icon.More" Fill="M2.4 8 A1.1 1.1 0 1 0 4.6 8 A1.1 1.1 0 1 0 2.4 8 ZM6.9 8 A1.1 1.1 0 1 0 9.1 8 A1.1 1.1 0 1 0 6.9 8 ZM11.4 8 A1.1 1.1 0 1 0 13.6 8 A1.1 1.1 0 1 0 11.4 8 Z" />
|
||||
<ui:IconData x:Key="Icon.Motion" Stroke="M1.5 8 C3.5 3 5.5 3 7.5 8 C9.5 13 11.5 13 14.5 8" />
|
||||
<ui:IconData x:Key="Icon.Network" Stroke="M2 6 A8.5 8.5 0 0 1 14 6 M4 8.5 A5.5 5.5 0 0 1 12 8.5 M6 11 A2.6 2.6 0 0 1 10 11" Fill="M6.9 13 A1.1 1.1 0 1 0 9.1 13 A1.1 1.1 0 1 0 6.9 13 Z" />
|
||||
<ui:IconData x:Key="Icon.Optimise" Stroke="M7 2 L8.2 5.8 L12 7 L8.2 8.2 L7 12 L5.8 8.2 L2 7 L5.8 5.8 Z M12.5 10.5 L13 12 L14.5 12.5 L13 13 L12.5 14.5 L12 13 L10.5 12.5 L12 12 Z" />
|
||||
<ui:IconData x:Key="Icon.Pause" Fill="M4.8 3 H5.8 A0.8 0.8 0 0 1 6.6 3.8 V12.2 A0.8 0.8 0 0 1 5.8 13 H4.8 A0.8 0.8 0 0 1 4 12.2 V3.8 A0.8 0.8 0 0 1 4.8 3 ZM10.200000000000001 3 H11.2 A0.8 0.8 0 0 1 12.0 3.8 V12.2 A0.8 0.8 0 0 1 11.2 13 H10.200000000000001 A0.8 0.8 0 0 1 9.4 12.2 V3.8 A0.8 0.8 0 0 1 10.200000000000001 3 Z" />
|
||||
<ui:IconData x:Key="Icon.Play" Fill="M4.5 2.8 L13 8 L4.5 13.2 Z" />
|
||||
<ui:IconData x:Key="Icon.Plus" Stroke="M8 3 V13 M3 8 H13" />
|
||||
<ui:IconData x:Key="Icon.Power" Stroke="M8 1.8 V7.5 M11.54 4.59 A5.5 5.5 0 1 1 4.46 4.59" />
|
||||
<ui:IconData x:Key="Icon.Refresh" Stroke="M10.75 3.24 A5.5 5.5 0 1 1 4.46 3.79 M13.2 2.6 L13.2 5.3 L10.5 5.3" />
|
||||
<ui:IconData x:Key="Icon.Regions" Stroke="M1.5 9.5 C4 8 6 10.5 8.5 9 C10.5 7.8 12.5 8.5 14.5 9.5 M1.5 13.5 H14.5 M1.5 2.5 H14.5" />
|
||||
<ui:IconData x:Key="Icon.Render" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z" Fill="M6.5 5.5 L10.8 8 L6.5 10.5 Z" />
|
||||
<ui:IconData x:Key="Icon.Reset" Stroke="M3.67 6.00 A5 5 0 1 1 5.50 12.83 M3.2 3.2 V6.2 H6.2" />
|
||||
<ui:IconData x:Key="Icon.Retry" Stroke="M10.75 3.24 A5.5 5.5 0 1 1 4.46 3.79 M13.2 2.6 L13.2 5.3 L10.5 5.3" />
|
||||
<ui:IconData x:Key="Icon.Ring" Stroke="M4.5 8 A3.5 3.5 0 1 0 11.5 8 A3.5 3.5 0 1 0 4.5 8 Z" />
|
||||
<ui:IconData x:Key="Icon.Search" Stroke="M2.5 7 A4.5 4.5 0 1 0 11.5 7 A4.5 4.5 0 1 0 2.5 7 Z M10.4 10.4 L14 14" />
|
||||
<ui:IconData x:Key="Icon.Sequence" Stroke="M2 12.5 L11.5 3 L13 4.5 L3.5 14 H2 Z" />
|
||||
<ui:IconData x:Key="Icon.Server" Stroke="M4.5 12.5 A3 3 0 0 1 4.2 6.5 A4 4 0 0 1 11.9 5.5 A3.5 3.5 0 0 1 12.2 12.5 Z" />
|
||||
<ui:IconData x:Key="Icon.Settings" Stroke="M5.8 8 A2.2 2.2 0 1 0 10.2 8 A2.2 2.2 0 1 0 5.8 8 Z M8 1.5 V3.5 M8 12.5 V14.5 M1.5 8 H3.5 M12.5 8 H14.5 M3.4 3.4 L4.8 4.8 M11.2 11.2 L12.6 12.6 M3.4 12.6 L4.8 11.2 M11.2 4.8 L12.6 3.4" />
|
||||
<ui:IconData x:Key="Icon.Sort" Stroke="M5 2.5 V13.5 M2.5 11 L5 13.5 L7.5 11 M11 13.5 V2.5 M8.5 5 L11 2.5 L13.5 5" />
|
||||
<ui:IconData x:Key="Icon.Spline" Stroke="M2 13 C5 13 5 3 8 8 C11 13 11 3 14 3" Fill="M0.8 13 A1.2 1.2 0 1 0 3.2 13 A1.2 1.2 0 1 0 0.8 13 ZM12.8 3 A1.2 1.2 0 1 0 15.2 3 A1.2 1.2 0 1 0 12.8 3 Z" />
|
||||
<ui:IconData x:Key="Icon.Stack" Stroke="M8 1.8 L14.5 5.2 L8 8.6 L1.5 5.2 Z M1.5 8.2 L8 11.6 L14.5 8.2 M1.5 11 L8 14.4 L14.5 11" />
|
||||
<ui:IconData x:Key="Icon.Star" Stroke="M8 1.8 L9.9 5.8 L14.2 6.3 L11 9.3 L11.9 13.6 L8 11.4 L4.1 13.6 L5 9.3 L1.8 6.3 L6.1 5.8 Z" />
|
||||
<ui:IconData x:Key="Icon.StarFilled" Fill="M8 1.8 L9.9 5.8 L14.2 6.3 L11 9.3 L11.9 13.6 L8 11.4 L4.1 13.6 L5 9.3 L1.8 6.3 L6.1 5.8 Z" />
|
||||
<ui:IconData x:Key="Icon.Stop" Fill="M5.0 3.5 H11.0 A1.5 1.5 0 0 1 12.5 5.0 V11.0 A1.5 1.5 0 0 1 11.0 12.5 H5.0 A1.5 1.5 0 0 1 3.5 11.0 V5.0 A1.5 1.5 0 0 1 5.0 3.5 Z" />
|
||||
<ui:IconData x:Key="Icon.SuccessCircle" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M5 8.3 L7.1 10.3 L11 6" />
|
||||
<ui:IconData x:Key="Icon.Sun" Stroke="M5 8 A3 3 0 1 0 11 8 A3 3 0 1 0 5 8 Z M8 1 V2.5 M8 13.5 V15 M1 8 H2.5 M13.5 8 H15 M3 3 L4 4 M12 12 L13 13 M3 13 L4 12 M12 4 L13 3" />
|
||||
<ui:IconData x:Key="Icon.Sync" Stroke="M9.88 2.83 A5.5 5.5 0 0 1 9.88 13.17 M6.12 13.17 A5.5 5.5 0 0 1 6.12 2.83 M13.5 6.5 L13.2 9.4 L10.6 8.4 M2.5 9.5 L2.8 6.6 L5.4 7.6" />
|
||||
<ui:IconData x:Key="Icon.Tag" Stroke="M1.5 2.5 A1 1 0 0 1 2.5 1.5 H7.5 L14.5 8.5 L8.5 14.5 L1.5 7.5 Z M5 5 H5.1" />
|
||||
<ui:IconData x:Key="Icon.Time" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M8 4.5 V8 L10.5 9.5" />
|
||||
<ui:IconData x:Key="Icon.Tray" Stroke="M1.5 9.5 H5 L6.5 11.5 H9.5 L11 9.5 H14.5 M1.5 9.5 L3.5 3 H12.5 L14.5 9.5 V13.5 H1.5 Z" />
|
||||
<ui:IconData x:Key="Icon.Triangle" Fill="M8 3 L13.5 12.5 H2.5 Z" />
|
||||
<ui:IconData x:Key="Icon.TriangleRight" Fill="M5 3 L12 8 L5 13 Z" />
|
||||
<ui:IconData x:Key="Icon.Upload" Stroke="M8 10.5 V2.5 M4.5 6 L8 2.5 L11.5 6 M2.5 13.5 H13.5" />
|
||||
<ui:IconData x:Key="Icon.User" Stroke="M5 5 A3 3 0 1 0 11 5 A3 3 0 1 0 5 5 Z M2.5 14 A5.5 5.5 0 0 1 13.5 14" />
|
||||
<ui:IconData x:Key="Icon.Users" Stroke="M5 5 A3 3 0 1 0 11 5 A3 3 0 1 0 5 5 Z M2.5 14 A5.5 5.5 0 0 1 13.5 14" />
|
||||
<ui:IconData x:Key="Icon.Vectors" Stroke="M2.5 12.5 L7 8 M7 8 H4.5 M7 8 V10.5 M9 7 L13.5 2.5 M13.5 2.5 H11 M13.5 2.5 V5" />
|
||||
<ui:IconData x:Key="Icon.Verify" Stroke="M8 1.5 L13.5 3.5 V7.5 C13.5 11 11 13.3 8 14.5 C5 13.3 2.5 11 2.5 7.5 V3.5 Z M5.5 8 L7.3 9.8 L10.6 6.3" />
|
||||
<ui:IconData x:Key="Icon.ViewGrid" Stroke="M2.5 1.5 H6.0 A1 1 0 0 1 7.0 2.5 V6.0 A1 1 0 0 1 6.0 7.0 H2.5 A1 1 0 0 1 1.5 6.0 V2.5 A1 1 0 0 1 2.5 1.5 ZM10 1.5 H13.5 A1 1 0 0 1 14.5 2.5 V6.0 A1 1 0 0 1 13.5 7.0 H10 A1 1 0 0 1 9 6.0 V2.5 A1 1 0 0 1 10 1.5 ZM2.5 9 H6.0 A1 1 0 0 1 7.0 10 V13.5 A1 1 0 0 1 6.0 14.5 H2.5 A1 1 0 0 1 1.5 13.5 V10 A1 1 0 0 1 2.5 9 ZM10 9 H13.5 A1 1 0 0 1 14.5 10 V13.5 A1 1 0 0 1 13.5 14.5 H10 A1 1 0 0 1 9 13.5 V10 A1 1 0 0 1 10 9 Z" />
|
||||
<ui:IconData x:Key="Icon.ViewList" Stroke="M5.5 4 H13.5 M5.5 8 H13.5 M5.5 12 H13.5 M2.5 4 H2.6 M2.5 8 H2.6 M2.5 12 H2.6" />
|
||||
<ui:IconData x:Key="Icon.ViewTimeline" Stroke="M2 13.5 H14 M3.5 11 V8 M6 11 V5 M8.5 11 V7 M11 11 V3.5 M13.5 11 V9" />
|
||||
<ui:IconData x:Key="Icon.Warning" Stroke="M8 1.8 L14.8 13.8 H1.2 Z M8 6.2 V9.6 M8 11.7 V11.8" />
|
||||
<ui:IconData x:Key="Icon.Window" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M1.5 5.5 H14.5" />
|
||||
<ui:IconData x:Key="Icon.Wipe" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M8 1 V15" />
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Titano.Ui.Interop;
|
||||
|
||||
/// <summary>The few Win32/DWM calls the shared UI needs (window chrome and theme).</summary>
|
||||
internal static partial class NativeMethods
|
||||
{
|
||||
public const int WM_NCHITTEST = 0x0084;
|
||||
public const int WM_NCMOUSEMOVE = 0x00A0;
|
||||
public const int WM_NCLBUTTONDOWN = 0x00A1;
|
||||
public const int WM_NCLBUTTONUP = 0x00A2;
|
||||
public const int WM_NCMOUSELEAVE = 0x02A2;
|
||||
public const int WM_GETMINMAXINFO = 0x0024;
|
||||
public const int HTMAXBUTTON = 9;
|
||||
|
||||
public const int DWMWA_USE_IMMERSIVE_DARK_MODE_OLD = 19;
|
||||
public const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20;
|
||||
public const int DWMWA_WINDOW_CORNER_PREFERENCE = 33;
|
||||
public const int DWMWA_BORDER_COLOR = 34;
|
||||
public const int DWMWA_CAPTION_COLOR = 35;
|
||||
|
||||
[LibraryImport("dwmapi.dll")]
|
||||
public static partial int DwmSetWindowAttribute(IntPtr hwnd, int attribute, ref int value, int size);
|
||||
|
||||
/// <summary>Sets a 32-bit DWM attribute; false when the OS does not support it.</summary>
|
||||
public static bool TrySetDwm(IntPtr hwnd, int attribute, int value)
|
||||
{
|
||||
if (hwnd == IntPtr.Zero || !OperatingSystem.IsWindows()) return false;
|
||||
try
|
||||
{
|
||||
return DwmSetWindowAttribute(hwnd, attribute, ref value, sizeof(int)) == 0;
|
||||
}
|
||||
catch (DllNotFoundException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
catch (EntryPointNotFoundException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>COLORREF (0x00BBGGRR) from RGB bytes.</summary>
|
||||
public static int ColorRef(byte r, byte g, byte b) => r | g << 8 | b << 16;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
using Titano.Core.Localization;
|
||||
|
||||
namespace Titano.Ui.Localization;
|
||||
|
||||
/// <summary>
|
||||
/// XAML access to the string catalog: <c>Text="{l:Loc Library.Filter.Year}"</c>. The value is a binding, so
|
||||
/// changing <see cref="Loc.SetCulture"/> updates the whole UI without restart (BRIEF §16).
|
||||
/// </summary>
|
||||
[MarkupExtensionReturnType(typeof(string))]
|
||||
public sealed class LocExtension : MarkupExtension
|
||||
{
|
||||
public LocExtension()
|
||||
{
|
||||
}
|
||||
|
||||
public LocExtension(string key) => Key = key;
|
||||
|
||||
[ConstructorArgument("key")]
|
||||
public string Key { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Optional format applied to the localized string (e.g. "{0}…").</summary>
|
||||
public string? StringFormat { get; set; }
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
var binding = new Binding("[" + Key + "]")
|
||||
{
|
||||
Source = LocSource.Instance,
|
||||
Mode = BindingMode.OneWay,
|
||||
StringFormat = StringFormat,
|
||||
};
|
||||
return binding.ProvideValue(serviceProvider);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Indexer source for <see cref="LocExtension"/> bindings; raises a refresh on culture change.</summary>
|
||||
public sealed class LocSource : INotifyPropertyChanged
|
||||
{
|
||||
private LocSource() => Loc.CultureChanged += (_, _) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Item[]"));
|
||||
|
||||
public static LocSource Instance { get; } = new();
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
public string this[string key] => Loc.L(key);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Titano.Core.Localization;
|
||||
|
||||
namespace Titano.Ui.Mvvm;
|
||||
|
||||
/// <summary>Minimal INotifyPropertyChanged base.</summary>
|
||||
public abstract class ObservableObject : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
protected bool Set<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
|
||||
field = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string? propertyName = null) =>
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
|
||||
/// <summary>Signals that every property changed (used after a culture switch).</summary>
|
||||
protected void OnAllPropertiesChanged() => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(string.Empty));
|
||||
}
|
||||
|
||||
/// <summary>View model whose computed, localized texts refresh when the UI language changes.</summary>
|
||||
public abstract class LocalizedViewModel : ObservableObject, IDisposable
|
||||
{
|
||||
protected LocalizedViewModel() => Loc.CultureChanged += OnCultureChanged;
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
Loc.CultureChanged -= OnCultureChanged;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void OnCultureChanged(object? sender, EventArgs e) => OnAllPropertiesChanged();
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Titano.Ui.Mvvm;
|
||||
|
||||
/// <summary>Synchronous command with optional can-execute predicate.</summary>
|
||||
public sealed class RelayCommand(Action<object?> execute, Func<object?, bool>? canExecute = null) : ICommand
|
||||
{
|
||||
public RelayCommand(Action execute, Func<bool>? canExecute = null)
|
||||
: this(_ => execute(), canExecute is null ? null : _ => canExecute())
|
||||
{
|
||||
}
|
||||
|
||||
public event EventHandler? CanExecuteChanged
|
||||
{
|
||||
add => CommandManager.RequerySuggested += value;
|
||||
remove => CommandManager.RequerySuggested -= value;
|
||||
}
|
||||
|
||||
public bool CanExecute(object? parameter) => canExecute?.Invoke(parameter) ?? true;
|
||||
|
||||
public void Execute(object? parameter) => execute(parameter);
|
||||
}
|
||||
|
||||
/// <summary>Asynchronous command that disables itself while running and reports failures through <see cref="Failed"/>.</summary>
|
||||
public sealed class AsyncRelayCommand(Func<object?, CancellationToken, Task> execute, Func<object?, bool>? canExecute = null) : ICommand
|
||||
{
|
||||
private CancellationTokenSource? _cts;
|
||||
|
||||
public AsyncRelayCommand(Func<Task> execute, Func<bool>? canExecute = null)
|
||||
: this((_, _) => execute(), canExecute is null ? null : _ => canExecute())
|
||||
{
|
||||
}
|
||||
|
||||
public event EventHandler? CanExecuteChanged;
|
||||
|
||||
/// <summary>Raised on the UI thread when the command throws (other than cancellation).</summary>
|
||||
public static event Action<Exception>? Failed;
|
||||
|
||||
public bool IsRunning => _cts is not null;
|
||||
|
||||
public bool CanExecute(object? parameter) => !IsRunning && (canExecute?.Invoke(parameter) ?? true);
|
||||
|
||||
public async void Execute(object? parameter)
|
||||
{
|
||||
if (!CanExecute(parameter)) return;
|
||||
_cts = new CancellationTokenSource();
|
||||
RaiseCanExecuteChanged();
|
||||
try
|
||||
{
|
||||
await execute(parameter, _cts.Token);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Failed?.Invoke(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_cts.Dispose();
|
||||
_cts = null;
|
||||
RaiseCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void Cancel() => _cts?.Cancel();
|
||||
|
||||
public void RaiseCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,70 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- DESIGN.md §1 tokens, Dark theme. Colours are referenced through DynamicResource so the theme can switch at run time. -->
|
||||
<Color x:Key="Color.Bg">#1F1F23</Color>
|
||||
<Color x:Key="Color.Chrome">#1A1A1E</Color>
|
||||
<Color x:Key="Color.Surface">#26262C</Color>
|
||||
<Color x:Key="Color.Card">#2F3038</Color>
|
||||
<Color x:Key="Color.CardHover">#383943</Color>
|
||||
<Color x:Key="Color.CardPressed">#2A2B32</Color>
|
||||
<Color x:Key="Color.Stroke">#3E404A</Color>
|
||||
<Color x:Key="Color.StrokeStrong">#535663</Color>
|
||||
<Color x:Key="Color.Text">#F2F3F5</Color>
|
||||
<Color x:Key="Color.TextMuted">#A9AEB9</Color>
|
||||
<Color x:Key="Color.TextFaint">#7B818E</Color>
|
||||
<Color x:Key="Color.Accent">#4CC2FF</Color>
|
||||
<Color x:Key="Color.AccentHover">#6FCFFF</Color>
|
||||
<Color x:Key="Color.AccentPressed">#3BA9E0</Color>
|
||||
<Color x:Key="Color.OnAccent">#0B1B24</Color>
|
||||
<Color x:Key="Color.AccentSelected">#404CC2FF</Color>
|
||||
<Color x:Key="Color.AccentSubtle">#1F4CC2FF</Color>
|
||||
<Color x:Key="Color.Sun">#F5A524</Color>
|
||||
<Color x:Key="Color.Success">#35C48F</Color>
|
||||
<Color x:Key="Color.Warning">#E8B339</Color>
|
||||
<Color x:Key="Color.Error">#F0625D</Color>
|
||||
<Color x:Key="Color.Region">#5AD1C8</Color>
|
||||
<Color x:Key="Color.ToolTip">#F2F3F5</Color>
|
||||
<Color x:Key="Color.OnToolTip">#1A1A1A</Color>
|
||||
<Color x:Key="Color.Scrim">#99000000</Color>
|
||||
<Color x:Key="Color.Track">#3E404A</Color>
|
||||
<Color x:Key="Color.Preview">#141417</Color>
|
||||
<Color x:Key="Color.WarningSubtle">#1FE8B339</Color>
|
||||
<Color x:Key="Color.ErrorSubtle">#1FF0625D</Color>
|
||||
<Color x:Key="Color.SuccessSubtle">#1F35C48F</Color>
|
||||
<Color x:Key="Color.SunSubtle">#26F5A524</Color>
|
||||
<Color x:Key="Color.CaptionCloseHover">#C42B1C</Color>
|
||||
<Color x:Key="Color.Shadow">#66000000</Color>
|
||||
<SolidColorBrush x:Key="Brush.Bg" Color="{StaticResource Color.Bg}" />
|
||||
<SolidColorBrush x:Key="Brush.Chrome" Color="{StaticResource Color.Chrome}" />
|
||||
<SolidColorBrush x:Key="Brush.Surface" Color="{StaticResource Color.Surface}" />
|
||||
<SolidColorBrush x:Key="Brush.Card" Color="{StaticResource Color.Card}" />
|
||||
<SolidColorBrush x:Key="Brush.CardHover" Color="{StaticResource Color.CardHover}" />
|
||||
<SolidColorBrush x:Key="Brush.CardPressed" Color="{StaticResource Color.CardPressed}" />
|
||||
<SolidColorBrush x:Key="Brush.Stroke" Color="{StaticResource Color.Stroke}" />
|
||||
<SolidColorBrush x:Key="Brush.StrokeStrong" Color="{StaticResource Color.StrokeStrong}" />
|
||||
<SolidColorBrush x:Key="Brush.Text" Color="{StaticResource Color.Text}" />
|
||||
<SolidColorBrush x:Key="Brush.TextMuted" Color="{StaticResource Color.TextMuted}" />
|
||||
<SolidColorBrush x:Key="Brush.TextFaint" Color="{StaticResource Color.TextFaint}" />
|
||||
<SolidColorBrush x:Key="Brush.Accent" Color="{StaticResource Color.Accent}" />
|
||||
<SolidColorBrush x:Key="Brush.AccentHover" Color="{StaticResource Color.AccentHover}" />
|
||||
<SolidColorBrush x:Key="Brush.AccentPressed" Color="{StaticResource Color.AccentPressed}" />
|
||||
<SolidColorBrush x:Key="Brush.OnAccent" Color="{StaticResource Color.OnAccent}" />
|
||||
<SolidColorBrush x:Key="Brush.AccentSelected" Color="{StaticResource Color.AccentSelected}" />
|
||||
<SolidColorBrush x:Key="Brush.AccentSubtle" Color="{StaticResource Color.AccentSubtle}" />
|
||||
<SolidColorBrush x:Key="Brush.Sun" Color="{StaticResource Color.Sun}" />
|
||||
<SolidColorBrush x:Key="Brush.Success" Color="{StaticResource Color.Success}" />
|
||||
<SolidColorBrush x:Key="Brush.Warning" Color="{StaticResource Color.Warning}" />
|
||||
<SolidColorBrush x:Key="Brush.Error" Color="{StaticResource Color.Error}" />
|
||||
<SolidColorBrush x:Key="Brush.Region" Color="{StaticResource Color.Region}" />
|
||||
<SolidColorBrush x:Key="Brush.ToolTip" Color="{StaticResource Color.ToolTip}" />
|
||||
<SolidColorBrush x:Key="Brush.OnToolTip" Color="{StaticResource Color.OnToolTip}" />
|
||||
<SolidColorBrush x:Key="Brush.Scrim" Color="{StaticResource Color.Scrim}" />
|
||||
<SolidColorBrush x:Key="Brush.Track" Color="{StaticResource Color.Track}" />
|
||||
<SolidColorBrush x:Key="Brush.Preview" Color="{StaticResource Color.Preview}" />
|
||||
<SolidColorBrush x:Key="Brush.WarningSubtle" Color="{StaticResource Color.WarningSubtle}" />
|
||||
<SolidColorBrush x:Key="Brush.ErrorSubtle" Color="{StaticResource Color.ErrorSubtle}" />
|
||||
<SolidColorBrush x:Key="Brush.SuccessSubtle" Color="{StaticResource Color.SuccessSubtle}" />
|
||||
<SolidColorBrush x:Key="Brush.SunSubtle" Color="{StaticResource Color.SunSubtle}" />
|
||||
<SolidColorBrush x:Key="Brush.CaptionCloseHover" Color="{StaticResource Color.CaptionCloseHover}" />
|
||||
<SolidColorBrush x:Key="Brush.Shadow" Color="{StaticResource Color.Shadow}" />
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,70 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- DESIGN.md §1 tokens, Light theme. Colours are referenced through DynamicResource so the theme can switch at run time. -->
|
||||
<Color x:Key="Color.Bg">#F3F3F3</Color>
|
||||
<Color x:Key="Color.Chrome">#FFFFFF</Color>
|
||||
<Color x:Key="Color.Surface">#FFFFFF</Color>
|
||||
<Color x:Key="Color.Card">#FFFFFF</Color>
|
||||
<Color x:Key="Color.CardHover">#F5F5F5</Color>
|
||||
<Color x:Key="Color.CardPressed">#EBEBEB</Color>
|
||||
<Color x:Key="Color.Stroke">#E5E5E5</Color>
|
||||
<Color x:Key="Color.StrokeStrong">#D1D1D1</Color>
|
||||
<Color x:Key="Color.Text">#1A1A1A</Color>
|
||||
<Color x:Key="Color.TextMuted">#616161</Color>
|
||||
<Color x:Key="Color.TextFaint">#9E9E9E</Color>
|
||||
<Color x:Key="Color.Accent">#0067C0</Color>
|
||||
<Color x:Key="Color.AccentHover">#1975C5</Color>
|
||||
<Color x:Key="Color.AccentPressed">#005AA8</Color>
|
||||
<Color x:Key="Color.OnAccent">#FFFFFF</Color>
|
||||
<Color x:Key="Color.AccentSelected">#E8F1FA</Color>
|
||||
<Color x:Key="Color.AccentSubtle">#F0F6FC</Color>
|
||||
<Color x:Key="Color.Sun">#E08A1E</Color>
|
||||
<Color x:Key="Color.Success">#0F7B4F</Color>
|
||||
<Color x:Key="Color.Warning">#9A6700</Color>
|
||||
<Color x:Key="Color.Error">#C42B1C</Color>
|
||||
<Color x:Key="Color.Region">#1A9E95</Color>
|
||||
<Color x:Key="Color.ToolTip">#1A1A1A</Color>
|
||||
<Color x:Key="Color.OnToolTip">#F2F3F5</Color>
|
||||
<Color x:Key="Color.Scrim">#66000000</Color>
|
||||
<Color x:Key="Color.Track">#E0E0E0</Color>
|
||||
<Color x:Key="Color.Preview">#E9E9EC</Color>
|
||||
<Color x:Key="Color.WarningSubtle">#FFF4CE</Color>
|
||||
<Color x:Key="Color.ErrorSubtle">#FDE7E9</Color>
|
||||
<Color x:Key="Color.SuccessSubtle">#DFF6DD</Color>
|
||||
<Color x:Key="Color.SunSubtle">#FFF1DE</Color>
|
||||
<Color x:Key="Color.CaptionCloseHover">#C42B1C</Color>
|
||||
<Color x:Key="Color.Shadow">#33000000</Color>
|
||||
<SolidColorBrush x:Key="Brush.Bg" Color="{StaticResource Color.Bg}" />
|
||||
<SolidColorBrush x:Key="Brush.Chrome" Color="{StaticResource Color.Chrome}" />
|
||||
<SolidColorBrush x:Key="Brush.Surface" Color="{StaticResource Color.Surface}" />
|
||||
<SolidColorBrush x:Key="Brush.Card" Color="{StaticResource Color.Card}" />
|
||||
<SolidColorBrush x:Key="Brush.CardHover" Color="{StaticResource Color.CardHover}" />
|
||||
<SolidColorBrush x:Key="Brush.CardPressed" Color="{StaticResource Color.CardPressed}" />
|
||||
<SolidColorBrush x:Key="Brush.Stroke" Color="{StaticResource Color.Stroke}" />
|
||||
<SolidColorBrush x:Key="Brush.StrokeStrong" Color="{StaticResource Color.StrokeStrong}" />
|
||||
<SolidColorBrush x:Key="Brush.Text" Color="{StaticResource Color.Text}" />
|
||||
<SolidColorBrush x:Key="Brush.TextMuted" Color="{StaticResource Color.TextMuted}" />
|
||||
<SolidColorBrush x:Key="Brush.TextFaint" Color="{StaticResource Color.TextFaint}" />
|
||||
<SolidColorBrush x:Key="Brush.Accent" Color="{StaticResource Color.Accent}" />
|
||||
<SolidColorBrush x:Key="Brush.AccentHover" Color="{StaticResource Color.AccentHover}" />
|
||||
<SolidColorBrush x:Key="Brush.AccentPressed" Color="{StaticResource Color.AccentPressed}" />
|
||||
<SolidColorBrush x:Key="Brush.OnAccent" Color="{StaticResource Color.OnAccent}" />
|
||||
<SolidColorBrush x:Key="Brush.AccentSelected" Color="{StaticResource Color.AccentSelected}" />
|
||||
<SolidColorBrush x:Key="Brush.AccentSubtle" Color="{StaticResource Color.AccentSubtle}" />
|
||||
<SolidColorBrush x:Key="Brush.Sun" Color="{StaticResource Color.Sun}" />
|
||||
<SolidColorBrush x:Key="Brush.Success" Color="{StaticResource Color.Success}" />
|
||||
<SolidColorBrush x:Key="Brush.Warning" Color="{StaticResource Color.Warning}" />
|
||||
<SolidColorBrush x:Key="Brush.Error" Color="{StaticResource Color.Error}" />
|
||||
<SolidColorBrush x:Key="Brush.Region" Color="{StaticResource Color.Region}" />
|
||||
<SolidColorBrush x:Key="Brush.ToolTip" Color="{StaticResource Color.ToolTip}" />
|
||||
<SolidColorBrush x:Key="Brush.OnToolTip" Color="{StaticResource Color.OnToolTip}" />
|
||||
<SolidColorBrush x:Key="Brush.Scrim" Color="{StaticResource Color.Scrim}" />
|
||||
<SolidColorBrush x:Key="Brush.Track" Color="{StaticResource Color.Track}" />
|
||||
<SolidColorBrush x:Key="Brush.Preview" Color="{StaticResource Color.Preview}" />
|
||||
<SolidColorBrush x:Key="Brush.WarningSubtle" Color="{StaticResource Color.WarningSubtle}" />
|
||||
<SolidColorBrush x:Key="Brush.ErrorSubtle" Color="{StaticResource Color.ErrorSubtle}" />
|
||||
<SolidColorBrush x:Key="Brush.SuccessSubtle" Color="{StaticResource Color.SuccessSubtle}" />
|
||||
<SolidColorBrush x:Key="Brush.SunSubtle" Color="{StaticResource Color.SunSubtle}" />
|
||||
<SolidColorBrush x:Key="Brush.CaptionCloseHover" Color="{StaticResource Color.CaptionCloseHover}" />
|
||||
<SolidColorBrush x:Key="Brush.Shadow" Color="{StaticResource Color.Shadow}" />
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,85 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:sys="clr-namespace:System;assembly=System.Runtime">
|
||||
<!-- DESIGN.md §2–3: one typeface, six sizes, 4-px spacing scale, fixed radii and sizes. -->
|
||||
<FontFamily x:Key="Font.Ui">Segoe UI Variable Text, Segoe UI, Microsoft YaHei UI, Yu Gothic UI, Malgun Gothic, Leelawadee UI, Nirmala UI, Tahoma</FontFamily>
|
||||
<FontFamily x:Key="Font.Display">Segoe UI Variable Display, Segoe UI, Microsoft YaHei UI, Yu Gothic UI, Malgun Gothic</FontFamily>
|
||||
<FontFamily x:Key="Font.Mono">Cascadia Mono, Consolas</FontFamily>
|
||||
|
||||
<sys:Double x:Key="Size.PageTitle">18</sys:Double>
|
||||
<sys:Double x:Key="Size.Title">16</sys:Double>
|
||||
<sys:Double x:Key="Size.Section">14</sys:Double>
|
||||
<sys:Double x:Key="Size.Body">13</sys:Double>
|
||||
<sys:Double x:Key="Size.Secondary">12</sys:Double>
|
||||
<sys:Double x:Key="Size.Chip">11</sys:Double>
|
||||
|
||||
<Thickness x:Key="Space.1">4</Thickness>
|
||||
<Thickness x:Key="Space.2">8</Thickness>
|
||||
<Thickness x:Key="Space.3">12</Thickness>
|
||||
<Thickness x:Key="Space.4">16</Thickness>
|
||||
<Thickness x:Key="Space.5">20</Thickness>
|
||||
|
||||
<CornerRadius x:Key="Radius.Control">6</CornerRadius>
|
||||
<CornerRadius x:Key="Radius.Card">8</CornerRadius>
|
||||
<CornerRadius x:Key="Radius.Pill">12</CornerRadius>
|
||||
<CornerRadius x:Key="Radius.Dialog">12</CornerRadius>
|
||||
|
||||
<sys:Double x:Key="Height.Control">32</sys:Double>
|
||||
<sys:Double x:Key="Height.Compact">28</sys:Double>
|
||||
<sys:Double x:Key="Height.Row">38</sys:Double>
|
||||
<sys:Double x:Key="Height.TitleBar">34</sys:Double>
|
||||
<sys:Double x:Key="Height.JobBar">40</sys:Double>
|
||||
<sys:Double x:Key="Height.Toolbar">56</sys:Double>
|
||||
<sys:Double x:Key="Height.StatusBar">30</sys:Double>
|
||||
<sys:Double x:Key="Width.Rail">128</sys:Double>
|
||||
<sys:Double x:Key="Width.RailCollapsed">48</sys:Double>
|
||||
<sys:Double x:Key="Width.SidePanel">320</sys:Double>
|
||||
<sys:Double x:Key="Width.SettingsList">200</sys:Double>
|
||||
<GridLength x:Key="Grid.LabelColumn">116</GridLength>
|
||||
<GridLength x:Key="Grid.SettingsLabelColumn">180</GridLength>
|
||||
|
||||
<Style x:Key="Text.Base" TargetType="TextBlock">
|
||||
<Setter Property="FontFamily" Value="{StaticResource Font.Ui}" />
|
||||
<Setter Property="FontSize" Value="{StaticResource Size.Body}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
||||
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style x:Key="Text.PageTitle" TargetType="TextBlock" BasedOn="{StaticResource Text.Base}">
|
||||
<Setter Property="FontFamily" Value="{StaticResource Font.Display}" />
|
||||
<Setter Property="FontSize" Value="{StaticResource Size.PageTitle}" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="LineHeight" Value="24" />
|
||||
</Style>
|
||||
<Style x:Key="Text.Title" TargetType="TextBlock" BasedOn="{StaticResource Text.Base}">
|
||||
<Setter Property="FontSize" Value="{StaticResource Size.Title}" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="LineHeight" Value="22" />
|
||||
</Style>
|
||||
<Style x:Key="Text.Section" TargetType="TextBlock" BasedOn="{StaticResource Text.Base}">
|
||||
<Setter Property="FontSize" Value="{StaticResource Size.Section}" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="LineHeight" Value="20" />
|
||||
</Style>
|
||||
<Style x:Key="Text.Body" TargetType="TextBlock" BasedOn="{StaticResource Text.Base}" />
|
||||
<Style x:Key="Text.Secondary" TargetType="TextBlock" BasedOn="{StaticResource Text.Base}">
|
||||
<Setter Property="FontSize" Value="{StaticResource Size.Secondary}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
|
||||
</Style>
|
||||
<Style x:Key="Text.Faint" TargetType="TextBlock" BasedOn="{StaticResource Text.Base}">
|
||||
<Setter Property="FontSize" Value="{StaticResource Size.Chip}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.TextFaint}" />
|
||||
</Style>
|
||||
<Style x:Key="Text.Chip" TargetType="TextBlock" BasedOn="{StaticResource Text.Base}">
|
||||
<Setter Property="FontSize" Value="{StaticResource Size.Chip}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
|
||||
</Style>
|
||||
<Style x:Key="Text.ColumnHeader" TargetType="TextBlock" BasedOn="{StaticResource Text.Faint}">
|
||||
<Setter Property="FontSize" Value="11" />
|
||||
</Style>
|
||||
<!-- Tabular numbers for tables and counters (DESIGN §2). -->
|
||||
<Style x:Key="Text.Number" TargetType="TextBlock" BasedOn="{StaticResource Text.Base}">
|
||||
<Setter Property="Typography.NumeralAlignment" Value="Tabular" />
|
||||
<Setter Property="TextAlignment" Value="Right" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,112 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using Microsoft.Win32;
|
||||
using Titano.Ui.Interop;
|
||||
|
||||
namespace Titano.Ui.Theming;
|
||||
|
||||
public enum AppTheme
|
||||
{
|
||||
System,
|
||||
Dark,
|
||||
Light,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the Titano design system into an application and switches between the dark and light token sets
|
||||
/// at run time (DESIGN.md §1: dark is the client default, light follows the OS when System is chosen).
|
||||
/// </summary>
|
||||
public static class ThemeManager
|
||||
{
|
||||
private const string Base = "pack://application:,,,/Titano.Ui;component/";
|
||||
private static ResourceDictionary? _tokens;
|
||||
private static Application? _app;
|
||||
private static bool _initialized;
|
||||
|
||||
public static AppTheme Requested { get; private set; } = AppTheme.Dark;
|
||||
|
||||
public static bool IsDark { get; private set; }
|
||||
|
||||
public static event EventHandler? Changed;
|
||||
|
||||
/// <summary>Merges typography, tokens, icons and control styles into <paramref name="app"/>.</summary>
|
||||
public static void Initialize(Application app, AppTheme theme)
|
||||
{
|
||||
_app = app;
|
||||
var merged = app.Resources.MergedDictionaries;
|
||||
// Controls.xaml merges Typography.xaml and Icons.xaml itself so its StaticResources resolve at load.
|
||||
_tokens = Load(TokensFor(Resolve(theme)));
|
||||
merged.Insert(0, _tokens);
|
||||
merged.Insert(1, Load("Themes/Controls.xaml"));
|
||||
|
||||
ToolTipService.InitialShowDelayProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(400));
|
||||
ToolTipService.BetweenShowDelayProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(100));
|
||||
ToolTipService.ShowDurationProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(20000));
|
||||
|
||||
SystemEvents.UserPreferenceChanged += (_, e) =>
|
||||
{
|
||||
if (e.Category == UserPreferenceCategory.General && Requested == AppTheme.System)
|
||||
app.Dispatcher.BeginInvoke(() => Apply(AppTheme.System));
|
||||
};
|
||||
Apply(theme);
|
||||
}
|
||||
|
||||
public static void Apply(AppTheme theme)
|
||||
{
|
||||
if (_app is null || _tokens is null) throw new InvalidOperationException("ThemeManager.Initialize first.");
|
||||
Requested = theme;
|
||||
var dark = Resolve(theme);
|
||||
if (dark != IsDark || !_initialized)
|
||||
{
|
||||
var merged = _app.Resources.MergedDictionaries;
|
||||
var index = merged.IndexOf(_tokens);
|
||||
_tokens = Load(TokensFor(dark));
|
||||
merged[index] = _tokens;
|
||||
IsDark = dark;
|
||||
_initialized = true;
|
||||
}
|
||||
foreach (Window w in _app.Windows) ApplyChrome(w);
|
||||
Changed?.Invoke(null, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <summary>True when Windows apps are set to dark mode.</summary>
|
||||
public static bool SystemPrefersDark()
|
||||
{
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
|
||||
return key?.GetValue("AppsUseLightTheme") is not int light || light == 0;
|
||||
}
|
||||
catch (System.Security.SecurityException)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Colours the DWM frame (border/caption) to match the current tokens.</summary>
|
||||
public static void ApplyChrome(Window window)
|
||||
{
|
||||
var hwnd = new WindowInteropHelper(window).Handle;
|
||||
if (hwnd == IntPtr.Zero) return;
|
||||
NativeMethods.TrySetDwm(hwnd, NativeMethods.DWMWA_USE_IMMERSIVE_DARK_MODE, IsDark ? 1 : 0);
|
||||
NativeMethods.TrySetDwm(hwnd, NativeMethods.DWMWA_USE_IMMERSIVE_DARK_MODE_OLD, IsDark ? 1 : 0);
|
||||
NativeMethods.TrySetDwm(hwnd, NativeMethods.DWMWA_WINDOW_CORNER_PREFERENCE, 2);
|
||||
if (_app?.TryFindResource("Color.Chrome") is Color chrome)
|
||||
NativeMethods.TrySetDwm(hwnd, NativeMethods.DWMWA_CAPTION_COLOR, NativeMethods.ColorRef(chrome.R, chrome.G, chrome.B));
|
||||
if (_app?.TryFindResource("Color.Stroke") is Color stroke)
|
||||
NativeMethods.TrySetDwm(hwnd, NativeMethods.DWMWA_BORDER_COLOR, NativeMethods.ColorRef(stroke.R, stroke.G, stroke.B));
|
||||
}
|
||||
|
||||
private static bool Resolve(AppTheme theme) => theme switch
|
||||
{
|
||||
AppTheme.Dark => true,
|
||||
AppTheme.Light => false,
|
||||
_ => SystemPrefersDark(),
|
||||
};
|
||||
|
||||
private static string TokensFor(bool dark) => dark ? "Themes/Tokens.Dark.xaml" : "Themes/Tokens.Light.xaml";
|
||||
|
||||
private static ResourceDictionary Load(string path) => new() { Source = new Uri(Base + path, UriKind.Absolute) };
|
||||
}
|
||||
Reference in new issue
Block a user