Files
Chronos/src/Titano.App/Sections/SequenceView.xaml
T
Claude 757695f037 fix(editor): server jobs, stale proxies and read-only accounts in the remote editor
- A server sequence whose cached frames are no longer the server's (a load, a 409
  merge or a frames change event finds other frame ids) turns read-only and says
  why; opening it, or a sequence without cached proxies, queues the proxy
  download and opens it when done. Signed out reads "Connect to the server".
- Server jobs show queued, running (with a bar), paused and analysing glyphs in
  the header with Cancel; a failed or cancelled one raises a toast with Retry.
  Progress alone no longer refreshes the whole editor.
- The server job list is read by state and kind to its last page; "Add to queue"
  sets the job's priority; the event listener survives any failure and always
  releases its frames and connection.
- An account that may render but not edit picks the preset to render without
  changing the project; preset cards and their batch boxes say why they wait.
- Export tab of a server sequence: no local encoder, notices or folder; no Jobs
  history link. Sync at 12 px beside a folder that keeps 96 px and trims.
- Restore's Undo puts back the project from before the restore, only while that
  restore is the editor's last change.
- Export "Sync" of a render that ends while the session is down is queued for the
  saved session's server; skips are logged; sync follows the engine before it
  starts.
- Capture: sequence-remote-export, -running and -readonly, and
  sequence-export-copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-05 22:15:34 +00:00

196 lines
15 KiB
XML

<UserControl x:Class="Titano.App.Sections.SequenceView"
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:v="clr-namespace:Titano.Ui.Visuals;assembly=Titano.Ui"
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
KeyDown="OnKeyDown" Loaded="OnLoaded">
<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" IsVisibleChanged="OnEditorVisibleChanged"
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}" />
<KeyBinding Key="A" Modifiers="Control+Shift" Command="{Binding AnalyseCommand}" />
</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" />
<!-- A server sequence edited with proxies: where it lives (read-only or out of date says so) and its analysis or render on the server,
before the summary; all of it shares the space the actions leave and ends in an ellipsis. -->
<DockPanel Grid.Column="2" VerticalAlignment="Center">
<ui:StatusGlyph DockPanel.Dock="Left" Kind="Remote" Text="{Binding RemoteText}" ToolTip="{Binding RemoteToolTip}" FontSize="{StaticResource Size.Body}" Margin="0,0,12,0"
MaxWidth="220" VerticalAlignment="Center" Visibility="{Binding IsRemote, Converter={StaticResource BoolToVisibility}}" />
<!-- The server job: its bar, what it is and how far (the text gives way first), and Cancel, which always stays (BRIEF §11.5). -->
<Grid DockPanel.Dock="Left" Margin="0,0,12,0" MaxWidth="300" VerticalAlignment="Center"
Visibility="{Binding ServerJobText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ProgressBar Width="48" Maximum="1" Value="{Binding ServerJobProgress, Mode=OneWay}" VerticalAlignment="Center" Margin="0,0,8,0"
AutomationProperties.Name="{Binding ServerJobText}" Visibility="{Binding HasServerJobProgress, Converter={StaticResource BoolToVisibility}}" />
<ui:StatusGlyph Grid.Column="1" Kind="{Binding ServerJobKind}" Text="{Binding ServerJobText}" ToolTip="{Binding ServerJobToolTip}"
FontSize="{StaticResource Size.Body}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
<Button Grid.Column="2" Style="{StaticResource Button.IconSubtle}" Width="26" Height="26" Margin="4,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Cancel}"
Command="{Binding CancelServerJobCommand}" ToolTip="{Binding CancelServerJobToolTip}" ToolTipService.ShowOnDisabled="True"
AutomationProperties.Name="{l:Loc Editor.ServerJob.Cancel}" />
</Grid>
<TextBlock Text="{Binding Summary}" Style="{StaticResource Text.Secondary}" FontSize="{StaticResource Size.Body}" VerticalAlignment="Center"
TextTrimming="CharacterEllipsis" Typography.NumeralAlignment="Tabular" ToolTip="{Binding Summary}" />
</DockPanel>
<StackPanel Grid.Column="3" Orientation="Horizontal" VerticalAlignment="Center" Margin="12,0,0,0">
<Button Content="{l:Loc Editor.Analyse}" Command="{Binding AnalyseCommand}" ToolTip="{Binding AnalyseToolTip}" ToolTipService.ShowOnDisabled="True" />
<Button Content="{l:Loc Editor.OptimiseAll}" Command="{Binding OptimiseAllCommand}" ToolTip="{Binding OptimiseAllToolTip}"
ToolTipService.ShowOnDisabled="True" Margin="12,0,0,0" />
<v:SplitButton x:Name="RenderButton" IsPrimary="True" Margin="12,0,0,0" Content="{Binding RenderText}" Command="{Binding RenderCommand}"
ItemsSource="{Binding RenderChoices}" DisplayMemberPath="Label" SelectedItem="{Binding SelectedRenderChoice}" ToolTip="{Binding RenderToolTip}"
ToolTipService.ShowOnDisabled="True" DropDownToolTip="{Binding RenderChoiceToolTip}"
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 ViewVectors}"
MotionVectors="{Binding MotionVectors}" VectorScale="{Binding VectorScale}" ShowRegions="{Binding ViewRegions}"
RegionBoundary="{Binding RegionBoundary}" ShowCropMask="{Binding ShowCropMask}" CropRect="{Binding CropRect}"
CropMaskMode="{Binding CropMaskMode}" InfoText="{Binding InfoText}" ToolTip="{l:Loc Tooltips.Editor.Preview.View}"
AutomationProperties.Name="{l:Loc Editor.Preview}" SizeChanged="OnPreviewSizeChanged">
<v:PreviewViewport.ToolsContent>
<!-- Tools give the keyboard back to the preview after a click, so Space keeps playing (OnToolClicked). -->
<StackPanel Orientation="Horizontal" DataContext="{Binding DataContext, ElementName=EditorRoot}" ButtonBase.Click="OnToolClicked">
<ToggleButton Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding IsCompare}" ui:ButtonIcon.Glyph="{StaticResource Icon.Compare}"
Content="{l:Loc Editor.Preview.Compare}" ToolTip="{l:Loc Tooltips.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}" Content="{l:Loc Editor.Preview.Vectors}"
ToolTip="{l:Loc Tooltips.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}" Content="{l:Loc Editor.Preview.Regions}"
ToolTip="{l:Loc Tooltips.Editor.Preview.Regions}" />
<ToggleButton Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding ShowCropMask}" ui:ButtonIcon.Glyph="{StaticResource Icon.CropMask}"
Content="{l:Loc Editor.Preview.CropMask}" ToolTip="{l:Loc Tooltips.Editor.Preview.CropMask}" />
<!-- "What I lose" (dimmed) or "how it will look" (hidden) outside the crop (BRIEF §12.3). -->
<ToggleButton Visibility="{Binding ShowCropMask, Converter={StaticResource BoolToVisibility}}" Style="{StaticResource ToggleButton.PreviewToolIcon}"
IsChecked="{Binding IsCropResult}" ui:ButtonIcon.Glyph="{StaticResource Icon.Eye}" ToolTip="{Binding CropModeToolTip}"
AutomationProperties.Name="{l:Loc Editor.Preview.CropResult}" />
<ToggleButton Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource ToggleButton.PreviewTool}"
IsChecked="{Binding IsActualSize}" Content="{l:Loc Editor.Preview.ActualSize}" ToolTip="{l:Loc Tooltips.Editor.Preview.ActualSize}" />
<Button Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource Button.PreviewToolIcon}"
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.PlayTool}"
Command="{Binding PlayCommand}" ToolTip="{Binding PlayToolTip}" AutomationProperties.Name="{Binding PlayName}" />
<Button Content="{l:Loc Editor.Preview.Clip}" Command="{Binding PreviewClipCommand}" ToolTip="{Binding ClipToolTip}"
Visibility="{Binding IsExportTab, Converter={StaticResource BoolToVisibility}}">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource Button.PreviewTool}">
<Setter Property="ui:ButtonIcon.Glyph" Value="{StaticResource Icon.Play}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsPlaying}" Value="True">
<Setter Property="ui:ButtonIcon.Glyph" Value="{StaticResource Icon.Pause}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</StackPanel>
</v:PreviewViewport.ToolsContent>
</v:PreviewViewport>
<!-- The frame on screen cannot be read: one sentence instead of another frame's picture. -->
<TextBlock Text="{Binding PreviewMessage}" Style="{StaticResource Text.Secondary}" HorizontalAlignment="Center" VerticalAlignment="Center"
IsHitTestVisible="False" Visibility="{Binding PreviewMessage, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
<v:Filmstrip Grid.Row="1" Margin="0,10,0,0" Source="{Binding Thumbnails}" CurrentIndex="{Binding CurrentIndex, Mode=TwoWay}" Markers="{Binding Markers}"
ToolTip="{l:Loc Tooltips.Editor.Filmstrip}" 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>