Scene/source builder with image overlays, reuse dialog, and SQLite layout persistence

This commit is contained in:
2026-08-04 17:12:32 -07:00
parent d6ae048583
commit 7dc8490d96
24 changed files with 2375 additions and 170 deletions
+39 -3
View File
@@ -1,8 +1,44 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace ytLive.Models;
public class Scene
public class Scene : INotifyPropertyChanged
{
public string Id { get; init; } = Guid.NewGuid().ToString();
public string Name { get; set; } = string.Empty;
public List<Source> Sources { get; set; } = new();
private string _name = string.Empty;
private bool _isEditing;
private bool _isHidden;
public string Name
{
get => _name;
set => Set(ref _name, value);
}
public bool IsEditing
{
get => _isEditing;
set => Set(ref _isEditing, value);
}
public bool IsHidden
{
get => _isHidden;
set => Set(ref _isHidden, value);
}
public ObservableCollection<Source> Sources { get; } = new();
public bool IsChatScene { get; init; }
public event PropertyChangedEventHandler? PropertyChanged;
private void Set<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(field, value)) return;
field = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
+69 -15
View File
@@ -1,3 +1,8 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Media;
using ytLive.Helpers;
namespace ytLive.Models;
public enum SourceType
@@ -5,31 +10,80 @@ public enum SourceType
DisplayCapture,
WindowCapture,
Webcam,
Background,
Image,
TextOverlay
}
public class Source
public class Source : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
private void Raise([CallerMemberName] string? name = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
private bool Set<T>(ref T field, T value, [CallerMemberName] string? name = null)
{
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
field = value;
Raise(name);
return true;
}
public string Id { get; init; } = Guid.NewGuid().ToString();
public string Name { get; set; } = string.Empty;
public SourceType Type { get; set; }
public bool IsEnabled { get; set; } = true;
private string _name = string.Empty;
public string Name { get => _name; set => Set(ref _name, value); }
private SourceType _type;
public SourceType Type { get => _type; set => Set(ref _type, value); }
private bool _isEnabled = true;
public bool IsEnabled { get => _isEnabled; set => Set(ref _isEnabled, value); }
// Display/Window capture
public int? MonitorIndex { get; set; }
public IntPtr? WindowHandle { get; set; }
private int? _monitorIndex;
public int? MonitorIndex { get => _monitorIndex; set => Set(ref _monitorIndex, value); }
private IntPtr? _windowHandle;
public IntPtr? WindowHandle { get => _windowHandle; set => Set(ref _windowHandle, value); }
// Webcam
public string? DeviceId { get; set; }
private string? _deviceId;
public string? DeviceId { get => _deviceId; set => Set(ref _deviceId, value); }
// Image
public string? FilePath { get; set; }
// Image (asset stored in the layout database)
private string? _assetId;
private ImageSource? _imageSource;
// Position/transform
public double X { get; set; }
public double Y { get; set; }
public double Width { get; set; }
public double Height { get; set; }
public double Opacity { get; set; } = 1.0;
public string? AssetId
{
get => _assetId;
set
{
if (Set(ref _assetId, value))
{
_imageSource = ImageCache.Get(value ?? string.Empty);
Raise(nameof(ImageSource));
}
}
}
public ImageSource? ImageSource => _imageSource;
// Position/transform (per-scene usage)
private double _x;
public double X { get => _x; set => Set(ref _x, value); }
private double _y;
public double Y { get => _y; set => Set(ref _y, value); }
private double _width;
public double Width { get => _width; set => Set(ref _width, value); }
private double _height;
public double Height { get => _height; set => Set(ref _height, value); }
private double _opacity = 1.0;
public double Opacity { get => _opacity; set => Set(ref _opacity, value); }
}