feat(app): sequence editor view with preview tools, filmstrip, section tabs and Export panel
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
16 files changed
+1606
-8
No files matched your search
@@ -2,10 +2,148 @@
|
||||
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;assembly=Titano.Ui"
|
||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui">
|
||||
<Grid Margin="20">
|
||||
<ui:EmptyState Message="{l:Loc Editor.Empty}">
|
||||
xmlns:v="clr-namespace:Titano.Ui.Visuals;assembly=Titano.Ui"
|
||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||
KeyDown="OnKeyDown">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Titano;component/Editor/EditorStyles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<ui:EmptyState Message="{l:Loc Editor.Empty}" Visibility="{Binding IsEmpty, Converter={StaticResource BoolToVisibility}}">
|
||||
<Button Style="{StaticResource Button.Primary}" Content="{l:Loc Shell.Nav.Library}" Command="{Binding OpenLibraryCommand}" ToolTip="{l:Loc Tooltips.Nav.Library}" />
|
||||
</ui:EmptyState>
|
||||
<ProgressBar Width="240" IsIndeterminate="True" VerticalAlignment="Center" Visibility="{Binding IsLoading, Converter={StaticResource BoolToVisibility}}"
|
||||
AutomationProperties.Name="{l:Loc Editor.Loading}" />
|
||||
|
||||
<!-- Editor.html: header, then the preview, filmstrip and section tabs on the left and the section's settings on the right. -->
|
||||
<Grid x:Name="EditorRoot" DataContext="{Binding Editor}" Margin="16,0,16,12"
|
||||
Visibility="{Binding Converter={x:Static ui:NullToCollapsedConverter.Instance}}">
|
||||
<Grid.InputBindings>
|
||||
<KeyBinding Key="Z" Modifiers="Control" Command="{Binding UndoCommand}" />
|
||||
<KeyBinding Key="Y" Modifiers="Control" Command="{Binding RedoCommand}" />
|
||||
<KeyBinding Key="D0" Modifiers="Control" Command="{Binding FitCommand}" />
|
||||
<KeyBinding Key="D1" Modifiers="Control" Command="{Binding ActualSizeCommand}" />
|
||||
<KeyBinding Key="R" Modifiers="Control" Command="{Binding RenderCommand}" />
|
||||
</Grid.InputBindings>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="52" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Style="{StaticResource Button.IconSubtle}" ui:ButtonIcon.Glyph="{StaticResource Icon.Back}" Command="{Binding BackCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Back}" AutomationProperties.Name="{l:Loc Editor.Back}" Margin="-6,0,0,0" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding Title}" Style="{StaticResource Text.Title}" VerticalAlignment="Center" Margin="6,0,12,0" MaxWidth="320"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Grid.Column="2" Text="{Binding Summary}" Style="{StaticResource Text.Secondary}" FontSize="{StaticResource Size.Body}" VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis" Typography.NumeralAlignment="Tabular" />
|
||||
<StackPanel Grid.Column="3" Orientation="Horizontal" VerticalAlignment="Center" Margin="12,0,0,0">
|
||||
<Button Content="{l:Loc Editor.Analyse}" Command="{Binding AnalyseCommand}" ToolTip="{l:Loc Tooltips.Editor.Analyse}" ToolTipService.ShowOnDisabled="True" />
|
||||
<Button Content="{l:Loc Editor.OptimiseAll}" Command="{Binding OptimiseAllCommand}" ToolTip="{l:Loc Tooltips.Editor.OptimiseAll}"
|
||||
ToolTipService.ShowOnDisabled="True" Margin="12,0,0,0" />
|
||||
<v:SplitButton IsPrimary="True" Margin="12,0,0,0" Content="{Binding RenderText}" Command="{Binding RenderCommand}" ItemsSource="{Binding RenderChoices}"
|
||||
DisplayMemberPath="Label" SelectedItem="{Binding SelectedRenderChoice}" ToolTip="{Binding RenderToolTip}"
|
||||
DropDownToolTip="{l:Loc Tooltips.Editor.RenderChoice}" AutomationProperties.Name="{l:Loc Editor.RenderButton}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="{StaticResource Editor.Grid.Panel}" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid Margin="0,0,16,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition MinHeight="160">
|
||||
<RowDefinition.Style>
|
||||
<Style TargetType="RowDefinition">
|
||||
<Setter Property="Height" Value="{StaticResource Editor.Grid.Preview}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsExportTab}" Value="True">
|
||||
<Setter Property="Height" Value="{StaticResource Editor.Grid.ExportPreview}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</RowDefinition.Style>
|
||||
</RowDefinition>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition MinHeight="150">
|
||||
<RowDefinition.Style>
|
||||
<Style TargetType="RowDefinition">
|
||||
<Setter Property="Height" Value="{StaticResource Editor.Grid.Measure}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsExportTab}" Value="True">
|
||||
<Setter Property="Height" Value="{StaticResource Editor.Grid.ExportMeasure}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</RowDefinition.Style>
|
||||
</RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<v:PreviewViewport x:Name="Preview" Source="{Binding PreviewImage}" OriginalSource="{Binding OriginalImage}" IsCompareEnabled="{Binding IsCompare}"
|
||||
WipeLabel="{Binding WipeLabel}" ZoomMode="{Binding ZoomMode, Mode=TwoWay}" ShowVectors="{Binding ShowVectors}"
|
||||
MotionVectors="{Binding MotionVectors}" VectorScale="{Binding VectorScale}" ShowRegions="{Binding ShowRegions}"
|
||||
RegionBoundary="{Binding RegionBoundary}" ShowCropMask="{Binding ShowCropMask}" CropRect="{Binding CropRect}" InfoText="{Binding InfoText}"
|
||||
AutomationProperties.Name="{l:Loc Editor.Preview}" SizeChanged="OnPreviewSizeChanged">
|
||||
<v:PreviewViewport.ToolsContent>
|
||||
<StackPanel Orientation="Horizontal" DataContext="{Binding DataContext, ElementName=EditorRoot}">
|
||||
<ToggleButton Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding IsCompare}" ui:ButtonIcon.Glyph="{StaticResource Icon.Compare}"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Preview.Compare}" AutomationProperties.Name="{l:Loc Editor.Preview.Compare}" />
|
||||
<ToggleButton Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding ShowVectors}" ui:ButtonIcon.Glyph="{StaticResource Icon.Vectors}"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Preview.Vectors}" AutomationProperties.Name="{l:Loc Editor.Preview.Vectors}" />
|
||||
<ToggleButton Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding ShowRegions}" ui:ButtonIcon.Glyph="{StaticResource Icon.Regions}"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Preview.Regions}" AutomationProperties.Name="{l:Loc Editor.Preview.Regions}" />
|
||||
<ToggleButton Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding ShowCropMask}" ui:ButtonIcon.Glyph="{StaticResource Icon.CropMask}"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Preview.CropMask}" AutomationProperties.Name="{l:Loc Editor.Preview.CropMask}" />
|
||||
<ToggleButton Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding IsActualSize}" ui:ButtonIcon.Glyph="{StaticResource Icon.ActualSize}"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Preview.ActualSize}" AutomationProperties.Name="{l:Loc Editor.Preview.ActualSize}" />
|
||||
<Button Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource Button.PreviewTool}" ui:ButtonIcon.Glyph="{StaticResource Icon.Fullscreen}" Click="OnFullScreen"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Preview.FullScreen}" AutomationProperties.Name="{l:Loc Editor.Preview.FullScreen}" />
|
||||
<Button Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource Button.PreviewTool}" ui:ButtonIcon.Glyph="{StaticResource Icon.Play}" Command="{Binding PlayCommand}"
|
||||
ToolTip="{Binding PlayToolTip}" AutomationProperties.Name="{l:Loc Editor.Preview.Play}" />
|
||||
<Button Style="{StaticResource Button.Base}" Height="30" Padding="10,0" Background="{DynamicResource Brush.Chrome}"
|
||||
ui:ButtonIcon.Glyph="{StaticResource Icon.Play}" Content="{l:Loc Editor.Preview.Clip}" Command="{Binding PreviewClipCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Preview.Clip}" Visibility="{Binding IsExportTab, Converter={StaticResource BoolToVisibility}}" />
|
||||
</StackPanel>
|
||||
</v:PreviewViewport.ToolsContent>
|
||||
</v:PreviewViewport>
|
||||
|
||||
<v:Filmstrip Grid.Row="1" Margin="0,10,0,0" Source="{Binding Thumbnails}" CurrentIndex="{Binding CurrentIndex, Mode=TwoWay}" Markers="{Binding Markers}"
|
||||
AutomationProperties.Name="{l:Loc Editor.Filmstrip}" />
|
||||
|
||||
<TabControl Grid.Row="2" Margin="0,10,0,0" ItemsSource="{Binding Tabs}" SelectedItem="{Binding SelectedTab}" AutomationProperties.Name="{l:Loc Editor.Sections}">
|
||||
<TabControl.Resources>
|
||||
<ResourceDictionary Source="pack://application:,,,/Titano;component/Editor/EditorMeasures.xaml" />
|
||||
</TabControl.Resources>
|
||||
<TabControl.ItemContainerStyle>
|
||||
<Style TargetType="TabItem" BasedOn="{StaticResource {x:Type TabItem}}">
|
||||
<Setter Property="Header" Value="{Binding Header}" />
|
||||
<Setter Property="ToolTip" Value="{Binding ToolTip}" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Header}" />
|
||||
</Style>
|
||||
</TabControl.ItemContainerStyle>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
|
||||
<ContentControl Grid.Column="1" Content="{Binding SelectedTab}" Focusable="False">
|
||||
<ContentControl.Resources>
|
||||
<ResourceDictionary Source="pack://application:,,,/Titano;component/Editor/EditorPanels.xaml" />
|
||||
</ContentControl.Resources>
|
||||
</ContentControl>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,8 +1,48 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Titano.App.Editor;
|
||||
|
||||
namespace Titano.App.Sections;
|
||||
|
||||
public partial class SequenceView : UserControl
|
||||
{
|
||||
public SequenceView() => InitializeComponent();
|
||||
|
||||
private EditorViewModel? Editor => (DataContext as SequenceViewModel)?.Editor;
|
||||
|
||||
/// <summary>Space plays or pauses, arrows step a frame (BRIEF §12.3) — unless a text field or a control that uses the key has it.</summary>
|
||||
private void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Handled || Editor is not { } editor || Keyboard.Modifiers != ModifierKeys.None || e.OriginalSource is TextBoxBase) return;
|
||||
var command = e.Key switch
|
||||
{
|
||||
Key.Space => editor.PlayCommand,
|
||||
Key.Left => editor.StepBackCommand,
|
||||
Key.Right => editor.StepForwardCommand,
|
||||
_ => null,
|
||||
};
|
||||
if (command is null) return;
|
||||
command.Execute(null);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
/// <summary>The preview renders at the size it is shown, in device pixels.</summary>
|
||||
private void OnPreviewSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
if (Editor is not { } editor) return;
|
||||
var scale = VisualTreeHelper.GetDpi(this).DpiScaleX;
|
||||
editor.PreviewEdge = (int)(double.Max(e.NewSize.Width, e.NewSize.Height) * scale);
|
||||
}
|
||||
|
||||
private void OnFullScreen(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Editor is not { } editor) return;
|
||||
var restore = editor.PreviewEdge;
|
||||
var window = new FullScreenPreview(editor) { Owner = Window.GetWindow(this) };
|
||||
window.ShowDialog();
|
||||
editor.PreviewEdge = restore;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user