Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

35.0 KB
Raw Blame
<!-- "Cut a clip": a frameless soft-rounded stage like the crop overlay's. The frame at the handle being moved large in
     the middle; floating on the stage the file chip (top left), maximize and close (top right), and at the bottom a
     card with the start, length and end, the timeline of the video with the clip between two handles, and the toolbar
     pill with the quick lengths, the fast / exact choice, Skip and "Save clip". After the last file, when a file could
     not be opened, a card with what went wrong. -->
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="using:Filee.App.ViewModels"
        xmlns:c="using:Filee.App.Controls"
        x:Class="Filee.App.Views.ClipWindow"
        x:DataType="vm:ClipWindowViewModel"
        Title="{DynamicResource preset.clip}"
        Icon="avares://Filee/Assets/Icons/filee.ico"
        Width="1240" Height="880" MinWidth="960" MinHeight="680"
        WindowDecorations="None"
        Background="Transparent"
        TransparencyLevelHint="Transparent"
        Topmost="True"
        CanResize="True">

  <Window.Resources>
    <StreamGeometry x:Key="Clip.Maximize">M4 7a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3z M7 6.2a.8.8 0 0 0-.8.8v10c0 .44.36.8.8.8h10a.8.8 0 0 0 .8-.8V7a.8.8 0 0 0-.8-.8z</StreamGeometry>
    <StreamGeometry x:Key="Clip.Grip">M18 10a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3z M18 16a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3z M12 16a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3z</StreamGeometry>
    <StreamGeometry x:Key="Clip.Fast">M13.2 2.2 4.6 13.4h6.1l-1.5 8.4 8.6-11.2h-6.1z</StreamGeometry>
    <StreamGeometry x:Key="Clip.Play">M8 5.5v13l11-6.5z</StreamGeometry>
    <StreamGeometry x:Key="Clip.Pause">M6.5 5h4v14h-4z M13.5 5h4v14h-4z</StreamGeometry>
    <StreamGeometry x:Key="Clip.Undo">M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z</StreamGeometry>
    <StreamGeometry x:Key="Clip.Redo">M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7z</StreamGeometry>
    <StreamGeometry x:Key="Clip.Magnet">M3,7V13A9,9 0 0,0 12,22A9,9 0 0,0 21,13V7H17V13A5,5 0 0,1 12,18A5,5 0 0,1 7,13V7M17,5H21V2H17M3,5H7V2H3</StreamGeometry>
    <StreamGeometry x:Key="Clip.Volume">M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z</StreamGeometry>
    <StreamGeometry x:Key="Clip.Speed">M12,16A3,3 0 0,1 9,13C9,11.88 9.61,10.9 10.5,10.39L20.21,4.77L14.68,14.35C14.18,15.33 13.17,16 12,16M12,3C13.81,3 15.5,3.5 16.97,4.32L14.87,5.53C14,5.19 13,5 12,5A8,8 0 0,0 4,13C4,15.21 4.89,17.21 6.34,18.65C6.74,19.04 6.74,19.67 6.35,20.06C5.96,20.45 5.32,20.45 4.93,20.07C3.12,18.26 2,15.76 2,13A10,10 0 0,1 12,3M22,13C22,15.76 20.88,18.26 19.07,20.07C18.68,20.45 18.05,20.45 17.66,20.06C17.27,19.67 17.27,19.04 17.66,18.65C19.11,17.2 20,15.21 20,13C20,12 19.81,11 19.46,10.1L20.67,8C21.5,9.5 22,11.18 22,13Z</StreamGeometry>
    <StreamGeometry x:Key="Clip.FadeIn">M2 20h20V4z</StreamGeometry>
    <StreamGeometry x:Key="Clip.FadeOut">M2 4v16h20z</StreamGeometry>
    <StreamGeometry x:Key="Clip.Silence">M2 11h2v2H2z M5.5 8h2v8h-2z M9 5h2v14H9z M17 8h2v8h-2z M20 11h2v2h-2z M12.6 11.3h2.8v1.4h-2.8z</StreamGeometry>
    <StreamGeometry x:Key="Clip.Music">M12,3V12.26C11.5,12.09 11,12 10.5,12C8,12 6,14 6,16.5C6,19 8,21 10.5,21C13,21 15,19 15,16.5V6H19V3H12Z</StreamGeometry>
    <StreamGeometry x:Key="Clip.Muted">M12,4L9.91,6.09L12,8.18M4.27,3L3,4.27L7.73,9H3V15H7L12,20V13.27L16.25,17.53C15.58,18.04 14.83,18.46 14,18.7V20.77C15.38,20.45 16.63,19.82 17.68,18.96L19.73,21L21,19.73L12,10.73M19,12C19,12.94 18.8,13.82 18.46,14.64L19.97,16.15C20.62,14.91 21,13.5 21,12C21,7.72 18,4.14 14,3.23V5.29C16.89,6.15 19,8.83 19,12M16.5,12C16.5,10.23 15.5,8.71 14,7.97V10.18L16.45,12.63C16.5,12.43 16.5,12.21 16.5,12Z</StreamGeometry>
    <StreamGeometry x:Key="Clip.CloseGaps">M13,20V4H15.03V20H13M10,20V4H12.03V20H10M5,8L9.03,12L5,16V13H2V11H5V8M20,16L16,12L20,8V11H23V13H20V16Z</StreamGeometry>
  </Window.Resources>

  <Window.Styles>
    <!-- The frame of the window; none when maximized -->
    <Style Selector="Border#Shell">
      <Setter Property="Margin" Value="12" />
      <Setter Property="CornerRadius" Value="{DynamicResource SoftRadiusLarge}" />
    </Style>
    <Style Selector="Window.maximized Border#Shell">
      <Setter Property="Margin" Value="0" />
      <Setter Property="CornerRadius" Value="0" />
      <Setter Property="BorderThickness" Value="0" />
    </Style>

    <!-- Floating pieces on the stage -->
    <Style Selector="Border.float">
      <Setter Property="Background" Value="{DynamicResource SurfaceBrush}" />
      <Setter Property="BorderBrush" Value="{DynamicResource SubtleBorderBrush}" />
      <Setter Property="BorderThickness" Value="1" />
      <Setter Property="CornerRadius" Value="999" />
      <Setter Property="BoxShadow" Value="{DynamicResource CardShadow}" />
    </Style>

    <!-- Toolbar buttons: quiet, round, a soft tint on hover -->
    <Style Selector="Button.tool, ToggleButton.tool">
      <Setter Property="Background" Value="Transparent" />
      <Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
      <Setter Property="BorderThickness" Value="0" />
      <Setter Property="CornerRadius" Value="999" />
      <Setter Property="Padding" Value="12,8" />
      <Setter Property="VerticalAlignment" Value="Center" />
      <Setter Property="Cursor" Value="Hand" />
    </Style>
    <Style Selector="Button.tool:pointerover /template/ ContentPresenter#PART_ContentPresenter, ToggleButton.tool:pointerover /template/ ContentPresenter#PART_ContentPresenter">
      <Setter Property="Background" Value="{DynamicResource AccentFaintBrush}" />
      <Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
    </Style>
    <Style Selector="ToggleButton.tool:checked /template/ ContentPresenter#PART_ContentPresenter">
      <Setter Property="Background" Value="{DynamicResource AccentSoftBrush}" />
      <Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
    </Style>
    <Style Selector="Button.tool:disabled /template/ ContentPresenter#PART_ContentPresenter, ToggleButton.tool:disabled /template/ ContentPresenter#PART_ContentPresenter">
      <Setter Property="Background" Value="Transparent" />
    </Style>
    <Style Selector="Button.tool:disabled, ToggleButton.tool:disabled">
      <Setter Property="Opacity" Value="0.45" />
    </Style>
    <Style Selector="Border.divider">
      <Setter Property="Width" Value="1" />
      <Setter Property="Height" Value="22" />
      <Setter Property="Margin" Value="3,0" />
      <Setter Property="Background" Value="{DynamicResource SubtleBorderBrush}" />
      <Setter Property="VerticalAlignment" Value="Center" />
    </Style>
    <Style Selector="ComboBox.speed">
      <Setter Property="MinWidth" Value="74" />
      <Setter Property="Height" Value="32" />
      <Setter Property="VerticalAlignment" Value="Center" />
      <Setter Property="CornerRadius" Value="999" />
    </Style>
    <Style Selector="Button.round, ToggleButton.round">
      <Setter Property="Padding" Value="9" />
      <Setter Property="Width" Value="34" />
      <Setter Property="Height" Value="34" />
    </Style>
    <Style Selector="Button.primary">
      <Setter Property="CornerRadius" Value="999" />
      <Setter Property="Padding" Value="16,8" />
      <Setter Property="FontWeight" Value="SemiBold" />
      <Setter Property="VerticalAlignment" Value="Center" />
    </Style>

    <!-- The start and end: what they are, the time, and their key; the active one tinted -->
    <Style Selector="Button.time">
      <Setter Property="Background" Value="Transparent" />
      <Setter Property="BorderThickness" Value="0" />
      <Setter Property="CornerRadius" Value="{DynamicResource SoftRadius}" />
      <Setter Property="Padding" Value="10,5" />
      <Setter Property="Cursor" Value="Hand" />
    </Style>
    <Style Selector="Button.time:pointerover /template/ ContentPresenter#PART_ContentPresenter">
      <Setter Property="Background" Value="{DynamicResource AccentFaintBrush}" />
    </Style>
    <Style Selector="Button.time.active /template/ ContentPresenter#PART_ContentPresenter">
      <Setter Property="Background" Value="{DynamicResource AccentSoftBrush}" />
    </Style>
    <Style Selector="TextBlock.caption">
      <Setter Property="FontSize" Value="11.5" />
      <Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}" />
    </Style>
    <Style Selector="TextBlock.clock">
      <Setter Property="FontSize" Value="17" />
      <Setter Property="FontWeight" Value="SemiBold" />
      <Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
    </Style>

    <!-- Keycaps: the shortcut beside a button's name -->
    <Style Selector="Border.key">
      <Setter Property="Background" Value="{DynamicResource SurfaceAltBrush}" />
      <Setter Property="CornerRadius" Value="5" />
      <Setter Property="Padding" Value="5,0" />
      <Setter Property="MinWidth" Value="18" />
      <Setter Property="Height" Value="18" />
      <Setter Property="VerticalAlignment" Value="Center" />
    </Style>
    <Style Selector="Border.key > TextBlock">
      <Setter Property="FontSize" Value="10.5" />
      <Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}" />
      <Setter Property="HorizontalAlignment" Value="Center" />
      <Setter Property="VerticalAlignment" Value="Center" />
    </Style>
    <Style Selector="Border.key.onaccent">
      <Setter Property="Background" Value="#2EFFFFFF" />
    </Style>
    <Style Selector="Border.key.onaccent > TextBlock">
      <Setter Property="Foreground" Value="{DynamicResource OnAccentBrush}" />
    </Style>
  </Window.Styles>

  <Border x:Name="Shell" ClipToBounds="True"
          Background="{DynamicResource PageBrush}"
          BorderBrush="{DynamicResource SubtleBorderBrush}" BorderThickness="1"
          BoxShadow="{DynamicResource CardShadow}">
    <Grid x:Name="Stage">
      <Grid RowDefinitions="*,Auto" IsVisible="{Binding IsEditing}">
        <!-- The frame at the active handle, as large as fits -->
        <Panel Margin="36,66,36,12">
          <Border x:Name="PreviewFrame" CornerRadius="{DynamicResource SoftRadius}" ClipToBounds="True"
                  HorizontalAlignment="Center" VerticalAlignment="Center"
                  Background="{DynamicResource SurfaceAltBrush}" BoxShadow="{DynamicResource CardShadow}">
            <Panel>
              <Image Source="{Binding Preview}" Stretch="Uniform" />
              <!-- Busy: preparing to play, finding silence, reading the music -->
              <Border Classes="float" Padding="10,5,12,5" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="10"
                      IsVisible="{Binding IsBusy}">
                <StackPanel Orientation="Horizontal" Spacing="8">
                  <ProgressBar Classes="soft" IsIndeterminate="True" Width="34" VerticalAlignment="Center" />
                  <TextBlock Text="{Binding BusyText}" FontSize="12.5" FontWeight="SemiBold" VerticalAlignment="Center"
                             Foreground="{DynamicResource TextPrimaryBrush}" />
                </StackPanel>
              </Border>
              <!-- Which handle's frame this is, on the picture -->
              <Border Classes="float" Padding="10,4" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="10"
                      IsVisible="{Binding Preview, Converter={x:Static ObjectConverters.IsNotNull}}">
                <TextBlock Text="{Binding PreviewLabel}" FontSize="12.5" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimaryBrush}" />
              </Border>
            </Panel>
          </Border>
        </Panel>

        <!-- The clip: start, length, end and the timeline; then the toolbar and the keys -->
        <StackPanel Grid.Row="1" Margin="16,0,16,12" Spacing="8">
          <!-- Left to right in every language, as time runs on the timeline: the start on the left, the end on the right -->
          <Border Classes="float" CornerRadius="{DynamicResource SoftRadiusLarge}" Padding="10,8,10,10" MaxWidth="980"
                  FlowDirection="LeftToRight">
            <StackPanel Spacing="6" IsEnabled="{Binding CanEdit}">
              <Grid ColumnDefinitions="Auto,*,Auto">
                <Button x:Name="StartButton" Classes="time" Classes.active="{Binding IsStartActive}" Command="{Binding ActivateStartCommand}"
                        AutomationProperties.Name="{DynamicResource clip.start}">
                  <StackPanel Orientation="Horizontal" Spacing="9">
                    <StackPanel Spacing="0">
                      <TextBlock Classes="caption" Text="{DynamicResource clip.start}" />
                      <TextBlock Classes="clock" Text="{Binding StartText}" />
                    </StackPanel>
                    <Border Classes="key"><TextBlock Text="S" /></Border>
                  </StackPanel>
                </Button>
                <StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="0">
                  <TextBlock Classes="caption" Text="{DynamicResource clip.length}" HorizontalAlignment="Center" />
                  <TextBlock Classes="clock" Text="{Binding LengthText}" HorizontalAlignment="Center"
                             Foreground="{DynamicResource AccentBrush}" />
                </StackPanel>
                <Button x:Name="EndButton" Grid.Column="2" Classes="time" Classes.active="{Binding IsEndActive}" Command="{Binding ActivateEndCommand}"
                        AutomationProperties.Name="{DynamicResource clip.end}">
                  <StackPanel Orientation="Horizontal" Spacing="9">
                    <Border Classes="key"><TextBlock Text="E" /></Border>
                    <StackPanel Spacing="0">
                      <TextBlock Classes="caption" Text="{DynamicResource clip.end}" HorizontalAlignment="Right" />
                      <TextBlock Classes="clock" Text="{Binding EndText}" HorizontalAlignment="Right" />
                    </StackPanel>
                  </StackPanel>
                </Button>
              </Grid>

              <!-- The whole video: where the clip is in it (its ends dragged here) -->
              <c:ClipTimeline x:Name="Timeline" Height="58" Margin="2,0"
                              AutomationProperties.Name="{DynamicResource clip.timeline}"
                              Duration="{Binding Duration}" Start="{Binding Start}" End="{Binding End}"
                              Playhead="{Binding Playhead}" ActiveHandle="{Binding ActiveHandle}"
                              Pieces="{Binding Pieces}" SelectedIndex="{Binding SelectedIndex}" Loudness="{Binding Loudness}"
                              FadeIn="{Binding HasFadeIn}" FadeOut="{Binding HasFadeOut}" Snap="{Binding IsMagnet}"
                              ViewStart="{Binding ViewStart}" ViewEnd="{Binding ViewEnd}"
                              Thumbnails="{Binding Thumbnails}"
                              AccentBrush="{DynamicResource AccentBrush}" OnAccentBrush="{DynamicResource OnAccentBrush}"
                              TrackBrush="{DynamicResource SurfaceAltBrush}" StageBrush="{DynamicResource SurfaceBrush}"
                              Foreground="{DynamicResource TextPrimaryBrush}" />

              <Grid ColumnDefinitions="*,*" Margin="16,0">
                <TextBlock Classes="caption" Text="{Binding ViewStartText}" />
                <TextBlock Grid.Column="1" Classes="caption" Text="{Binding ViewEndText}" HorizontalAlignment="Right" />
              </Grid>

              <!-- The clip as it plays: pictures (V1), its sound (A1) and the music (A2) -->
              <c:ClipSequence x:Name="Sequence" Margin="2,4,2,0"
                              AutomationProperties.Name="{DynamicResource clip.sequence}"
                              Pieces="{Binding Pieces}" Playhead="{Binding SequencePlayhead}"
                              SelectedIndex="{Binding SelectedIndex}" SelectedIndices="{Binding SelectedIndices}"
                              SelectedLane="{Binding SelectedLane}"
                              Thumbnails="{Binding DetailThumbnails}" Loudness="{Binding DetailLoudness}"
                              DetailStart="{Binding DetailStart}" DetailEnd="{Binding DetailEnd}"
                              Music="{Binding Music}" MusicLoudness="{Binding MusicLoudness}"
                              FadeIn="{Binding HasFadeIn}" FadeOut="{Binding HasFadeOut}" Snap="{Binding IsMagnet}"
                              GapText="{DynamicResource clip.close_gap}" NoMusicText="{DynamicResource clip.no_music_yet}"
                              AccentBrush="{DynamicResource AccentBrush}" OnAccentBrush="{DynamicResource OnAccentBrush}"
                              TrackBrush="{DynamicResource SurfaceAltBrush}" StageBrush="{DynamicResource SurfaceBrush}"
                              Foreground="{DynamicResource TextPrimaryBrush}" />
            </StackPanel>
          </Border>

          <!-- Editing: play, the blade, cutting out, undo, the magnet, the piece's volume and speed, silences -->
          <Border Classes="float" Padding="5" HorizontalAlignment="Center">
            <StackPanel Orientation="Horizontal" Spacing="2" IsEnabled="{Binding CanEdit}">
              <Button x:Name="PlayButton" Classes="tool round" Command="{Binding PlayPauseCommand}"
                      ToolTip.Tip="{Binding PlayToolTip}" AutomationProperties.Name="{Binding PlayToolTip}">
                <Panel>
                  <PathIcon Width="14" Height="14" Data="{StaticResource Clip.Play}" Foreground="{DynamicResource AccentBrush}" IsVisible="{Binding !IsPlaying}" />
                  <PathIcon Width="14" Height="14" Data="{StaticResource Clip.Pause}" Foreground="{DynamicResource AccentBrush}" IsVisible="{Binding IsPlaying}" />
                </Panel>
              </Button>
              <TextBlock Text="{Binding PlayheadText}" FontSize="13" FontWeight="SemiBold" MinWidth="50" VerticalAlignment="Center"
                         Margin="2,0,6,0" Foreground="{DynamicResource TextPrimaryBrush}" />
              <Border Background="{DynamicResource AccentSoftBrush}" CornerRadius="999" Padding="8,2" Margin="0,0,4,0" VerticalAlignment="Center"
                      IsVisible="{Binding SelectionText, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
                <TextBlock Text="{Binding SelectionText}" FontSize="11.5" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimaryBrush}" />
              </Border>

              <Border Classes="divider" />

              <Button Classes="tool" Command="{Binding SplitCommand}" Padding="10,8"
                      ToolTip.Tip="{DynamicResource clip.cut_hint}" AutomationProperties.Name="{DynamicResource clip.cut}">
                <StackPanel Orientation="Horizontal" Spacing="7">
                  <PathIcon Width="13" Height="13" Data="{StaticResource Icon.Cut}" Foreground="{DynamicResource TextSecondaryBrush}" />
                  <TextBlock Text="{DynamicResource clip.cut}" FontSize="13" VerticalAlignment="Center" />
                </StackPanel>
              </Button>
              <Button Classes="tool" Command="{Binding DeleteSelectedCommand}" Padding="10,8"
                      ToolTip.Tip="{DynamicResource clip.delete_hint}" AutomationProperties.Name="{Binding DeleteText}">
                <StackPanel Orientation="Horizontal" Spacing="7">
                  <PathIcon Width="13" Height="13" Data="{StaticResource Icon.Delete}" Foreground="{DynamicResource TextSecondaryBrush}" />
                  <TextBlock Text="{Binding DeleteText}" FontSize="13" VerticalAlignment="Center" />
                </StackPanel>
              </Button>
              <Button Classes="tool round" Command="{Binding UndoCommand}" IsEnabled="{Binding CanUndo}"
                      ToolTip.Tip="{DynamicResource clip.undo}" AutomationProperties.Name="{DynamicResource clip.undo}">
                <PathIcon Width="14" Height="14" Data="{StaticResource Clip.Undo}" Foreground="{DynamicResource TextSecondaryBrush}" />
              </Button>
              <Button Classes="tool round" Command="{Binding RedoCommand}" IsEnabled="{Binding CanRedo}"
                      ToolTip.Tip="{DynamicResource clip.redo}" AutomationProperties.Name="{DynamicResource clip.redo}">
                <PathIcon Width="14" Height="14" Data="{StaticResource Clip.Redo}" Foreground="{DynamicResource TextSecondaryBrush}" />
              </Button>
              <ToggleButton x:Name="ZoomToggle" Classes="tool round" IsChecked="{Binding IsZoomed}" Width="34" Height="34" Padding="9"
                            ToolTip.Tip="{DynamicResource clip.zoom_hint}" AutomationProperties.Name="{DynamicResource clip.zoom}">
                <PathIcon Width="14" Height="14" Data="{StaticResource Icon.Search}" Foreground="{DynamicResource AccentBrush}" />
              </ToggleButton>
              <ToggleButton x:Name="MagnetToggle" Classes="tool round" IsChecked="{Binding IsMagnet}" Width="34" Height="34" Padding="9"
                            ToolTip.Tip="{DynamicResource clip.magnet_hint}" AutomationProperties.Name="{DynamicResource clip.magnet}">
                <PathIcon Width="14" Height="14" Data="{StaticResource Clip.Magnet}" Foreground="{DynamicResource AccentBrush}" />
              </ToggleButton>

              <Border Classes="divider" />

              <StackPanel Orientation="Horizontal" Spacing="6" Margin="6,0" VerticalAlignment="Center"
                          ToolTip.Tip="{DynamicResource clip.volume_hint}">
                <ToggleButton x:Name="MuteToggle" Classes="tool round" IsChecked="{Binding IsCurrentMuted}" Width="30" Height="30" Padding="7"
                              ToolTip.Tip="{DynamicResource clip.mute_hint}" AutomationProperties.Name="{DynamicResource clip.mute}">
                  <Panel>
                    <PathIcon Width="14" Height="14" Data="{StaticResource Clip.Volume}" Foreground="{DynamicResource TextSecondaryBrush}"
                              IsVisible="{Binding !IsCurrentMuted}" />
                    <PathIcon Width="14" Height="14" Data="{StaticResource Clip.Muted}" Foreground="{DynamicResource AccentBrush}"
                              IsVisible="{Binding IsCurrentMuted}" />
                  </Panel>
                </ToggleButton>
                <Slider x:Name="VolumeSlider" Width="96" Minimum="0" Maximum="2" SmallChange="0.05" LargeChange="0.25"
                        Value="{Binding SelectedVolume}" VerticalAlignment="Center"
                        AutomationProperties.Name="{DynamicResource clip.volume}" />
                <TextBlock Text="{Binding VolumeText}" FontSize="12" MinWidth="40" VerticalAlignment="Center"
                           Foreground="{DynamicResource TextSecondaryBrush}" />
              </StackPanel>
              <StackPanel Orientation="Horizontal" Spacing="6" Margin="2,0,4,0" VerticalAlignment="Center"
                          ToolTip.Tip="{DynamicResource clip.speed_hint}">
                <PathIcon Width="14" Height="14" Data="{StaticResource Clip.Speed}" Foreground="{DynamicResource TextSecondaryBrush}" />
                <ComboBox x:Name="SpeedBox" Classes="speed" ItemsSource="{Binding Speeds}" SelectedItem="{Binding SelectedSpeed}"
                          AutomationProperties.Name="{DynamicResource clip.speed}">
                  <ComboBox.ItemTemplate>
                    <DataTemplate x:DataType="vm:IChoice">
                      <TextBlock Text="{Binding Label}" />
                    </DataTemplate>
                  </ComboBox.ItemTemplate>
                </ComboBox>
              </StackPanel>

              <Border Classes="divider" />

              <Button Classes="tool" Command="{Binding RemoveSilenceCommand}" Padding="10,8"
                      ToolTip.Tip="{DynamicResource clip.remove_silence_hint}" AutomationProperties.Name="{DynamicResource clip.remove_silence}">
                <StackPanel Orientation="Horizontal" Spacing="7">
                  <PathIcon Width="14" Height="14" Data="{StaticResource Clip.Silence}" Foreground="{DynamicResource TextSecondaryBrush}" />
                  <TextBlock Text="{DynamicResource clip.remove_silence}" FontSize="13" VerticalAlignment="Center" />
                </StackPanel>
              </Button>
              <Button Classes="tool" Click="OnAddMusic" Padding="10,8"
                      ToolTip.Tip="{DynamicResource clip.music_hint}" AutomationProperties.Name="{DynamicResource clip.music}">
                <StackPanel Orientation="Horizontal" Spacing="7">
                  <PathIcon Width="14" Height="14" Data="{StaticResource Clip.Music}" Foreground="{DynamicResource TextSecondaryBrush}" />
                  <TextBlock Text="{DynamicResource clip.music}" FontSize="13" VerticalAlignment="Center" />
                </StackPanel>
              </Button>
              <Button Classes="tool" Command="{Binding CloseGapsCommand}" IsVisible="{Binding HasGaps}" Padding="10,8"
                      ToolTip.Tip="{DynamicResource clip.close_gaps_hint}" AutomationProperties.Name="{DynamicResource clip.close_gaps}">
                <StackPanel Orientation="Horizontal" Spacing="7">
                  <PathIcon Width="14" Height="14" Data="{StaticResource Clip.CloseGaps}" Foreground="{DynamicResource TextSecondaryBrush}" />
                  <TextBlock Text="{DynamicResource clip.close_gaps}" FontSize="13" VerticalAlignment="Center" />
                </StackPanel>
              </Button>
            </StackPanel>
          </Border>

          <Border Classes="float" Padding="5" HorizontalAlignment="Center">
            <StackPanel Orientation="Horizontal" Spacing="3" IsEnabled="{Binding CanEdit}">
              <Button Classes="tool" Content="{Binding Length15Text}" Command="{Binding QuickLengthCommand}" CommandParameter="15"
                      IsEnabled="{Binding Can15}" ToolTip.Tip="{DynamicResource clip.length_hint}" />
              <Button Classes="tool" Content="{Binding Length30Text}" Command="{Binding QuickLengthCommand}" CommandParameter="30"
                      IsEnabled="{Binding Can30}" ToolTip.Tip="{DynamicResource clip.length_hint}" />
              <Button Classes="tool" Content="{Binding Length60Text}" Command="{Binding QuickLengthCommand}" CommandParameter="60"
                      IsEnabled="{Binding Can60}" ToolTip.Tip="{DynamicResource clip.length_hint}" />

              <Border Classes="divider" />

              <ToggleButton Classes="tool" IsChecked="{Binding HasFadeIn}" Padding="10,8"
                            ToolTip.Tip="{DynamicResource clip.fade_in_hint}" AutomationProperties.Name="{DynamicResource clip.fade_in}">
                <StackPanel Orientation="Horizontal" Spacing="7">
                  <PathIcon Width="13" Height="13" Data="{StaticResource Clip.FadeIn}" Foreground="{DynamicResource AccentBrush}" />
                  <TextBlock Text="{DynamicResource clip.fade_in}" FontSize="13" VerticalAlignment="Center" />
                </StackPanel>
              </ToggleButton>
              <ToggleButton Classes="tool" IsChecked="{Binding HasFadeOut}" Padding="10,8"
                            ToolTip.Tip="{DynamicResource clip.fade_out_hint}" AutomationProperties.Name="{DynamicResource clip.fade_out}">
                <StackPanel Orientation="Horizontal" Spacing="7">
                  <PathIcon Width="13" Height="13" Data="{StaticResource Clip.FadeOut}" Foreground="{DynamicResource AccentBrush}" />
                  <TextBlock Text="{DynamicResource clip.fade_out}" FontSize="13" VerticalAlignment="Center" />
                </StackPanel>
              </ToggleButton>

              <Border Classes="divider" />

              <ToggleButton x:Name="FastToggle" Classes="tool" IsChecked="{Binding IsFast}" IsEnabled="{Binding CanFast}" Padding="10,8,12,8"
                            ToolTip.Tip="{Binding FastToolTip}" AutomationProperties.Name="{DynamicResource clip.fast}">
                <StackPanel Orientation="Horizontal" Spacing="7">
                  <PathIcon Width="13" Height="13" Data="{StaticResource Clip.Fast}" Foreground="{DynamicResource AccentBrush}" />
                  <TextBlock Text="{DynamicResource clip.fast}" FontSize="13" VerticalAlignment="Center" />
                </StackPanel>
              </ToggleButton>

              <Button Classes="tool" Command="{Binding SkipCommand}" IsVisible="{Binding HasMultipleFiles}"
                      AutomationProperties.Name="{DynamicResource crop.skip}">
                <StackPanel Orientation="Horizontal" Spacing="5">
                  <TextBlock Text="{DynamicResource crop.skip}" FontSize="13" VerticalAlignment="Center" />
                  <PathIcon Width="11" Height="11" Data="{StaticResource Icon.ChevronRight}" Foreground="{DynamicResource TextSecondaryBrush}" />
                </StackPanel>
              </Button>

              <Button x:Name="PrimaryButton" Classes="accent primary" Margin="4,0,0,0" Command="{Binding SaveCommand}"
                      AutomationProperties.Name="{Binding SaveText}">
                <StackPanel Orientation="Horizontal" Spacing="9">
                  <PathIcon Width="13" Height="13" Data="{StaticResource Icon.Cut}" Foreground="{DynamicResource OnAccentBrush}" />
                  <TextBlock Text="{Binding SaveText}" FontSize="13" VerticalAlignment="Center" />
                  <Border Classes="key onaccent"><TextBlock Text="Enter" /></Border>
                </StackPanel>
              </Button>
            </StackPanel>
          </Border>
          <Panel HorizontalAlignment="Center">
            <TextBlock Text="{DynamicResource clip.hint_keys}" FontSize="11" HorizontalAlignment="Center" TextAlignment="Center"
                       TextWrapping="Wrap" MaxWidth="820" Opacity="0.8" Foreground="{DynamicResource TextSecondaryBrush}"
                       IsVisible="{Binding !HasMessage}" />
            <!-- What an action did, for a moment -->
            <TextBlock Text="{Binding Message}" FontSize="12" FontWeight="SemiBold" HorizontalAlignment="Center" TextAlignment="Center"
                       TextWrapping="Wrap" MaxWidth="820" Foreground="{DynamicResource AccentBrush}" IsVisible="{Binding HasMessage}" />
          </Panel>
        </StackPanel>
      </Grid>

      <!-- Top: the file and close -->
      <Grid ColumnDefinitions="*,Auto" VerticalAlignment="Top" Margin="14,14,14,0">
        <StackPanel Spacing="8" HorizontalAlignment="Left">
          <Border Classes="float" Padding="5,5,12,5" IsVisible="{Binding IsEditing}" HorizontalAlignment="Left">
            <StackPanel Orientation="Horizontal" Spacing="9">
              <Border Width="26" Height="26" CornerRadius="999" Background="{DynamicResource AccentSoftBrush}">
                <PathIcon Width="13" Height="13" Data="{StaticResource Icon.Cut}" Foreground="{DynamicResource AccentBrush}" />
              </Border>
              <TextBlock Text="{Binding CurrentFileName}" FontSize="13" FontWeight="SemiBold" VerticalAlignment="Center"
                         TextTrimming="CharacterEllipsis" MaxWidth="360" Foreground="{DynamicResource TextPrimaryBrush}" />
              <Border IsVisible="{Binding HasMultipleFiles}" Background="{DynamicResource SurfaceAltBrush}" CornerRadius="999"
                      Padding="8,2" VerticalAlignment="Center">
                <TextBlock Text="{Binding CounterText}" FontSize="11.5" Foreground="{DynamicResource TextSecondaryBrush}" />
              </Border>
            </StackPanel>
          </Border>

          <!-- The last file that could not be opened -->
          <Border Classes="float" Padding="10,6,12,6" IsVisible="{Binding HasStatusNotice}" HorizontalAlignment="Left"
                  CornerRadius="{DynamicResource SoftRadius}" MaxWidth="420">
            <StackPanel Orientation="Horizontal" Spacing="8">
              <PathIcon Width="13" Height="13" Data="{StaticResource Icon.Alert}" Foreground="{DynamicResource WarningBrush}" VerticalAlignment="Center" />
              <TextBlock Text="{Binding StatusNotice}" FontSize="12" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"
                         Foreground="{DynamicResource TextSecondaryBrush}" MaxWidth="380" />
            </StackPanel>
          </Border>
        </StackPanel>

        <Border Grid.Column="1" Classes="float" Padding="3" VerticalAlignment="Top">
          <StackPanel Orientation="Horizontal" Spacing="2">
            <Button x:Name="MaximizeButton" Classes="tool round" Click="OnMaximize"
                    ToolTip.Tip="{DynamicResource crop.maximize}" AutomationProperties.Name="{DynamicResource crop.maximize}">
              <PathIcon Width="13" Height="13" Data="{StaticResource Clip.Maximize}" Foreground="{DynamicResource TextSecondaryBrush}" />
            </Button>
            <Button Classes="tool round" Command="{Binding CancelCommand}"
                    ToolTip.Tip="{DynamicResource crop.close_hint}" AutomationProperties.Name="{DynamicResource common.close}">
              <PathIcon Width="11" Height="11" Data="{StaticResource Icon.Close}" Foreground="{DynamicResource TextSecondaryBrush}" />
            </Button>
          </StackPanel>
        </Border>
      </Grid>

      <!-- Drag the bottom-right corner to resize -->
      <Border x:Name="ResizeGrip" Width="22" Height="22" Background="Transparent" HorizontalAlignment="Right" VerticalAlignment="Bottom"
              Margin="0,0,4,4" Cursor="BottomRightCorner">
        <PathIcon Width="14" Height="14" Data="{StaticResource Clip.Grip}" Foreground="{DynamicResource TextSecondaryBrush}" Opacity="0.6" />
      </Border>

      <!-- After the last file, when files could not be opened -->
      <Border Classes="card" IsVisible="{Binding IsFinished}" HorizontalAlignment="Center" VerticalAlignment="Center"
              MaxWidth="540" Margin="24" Padding="26,24">
        <StackPanel Spacing="14">
          <TextBlock Text="{Binding Summary}" FontWeight="SemiBold" FontSize="16" TextAlignment="Center" TextWrapping="Wrap"
                     Foreground="{DynamicResource TextPrimaryBrush}" />
          <Border Background="{DynamicResource SurfaceAltBrush}" CornerRadius="{DynamicResource SoftRadiusSmall}" Padding="14,10">
            <ScrollViewer MaxHeight="220">
              <ItemsControl ItemsSource="{Binding Problems}">
                <ItemsControl.ItemTemplate>
                  <DataTemplate x:DataType="x:String">
                    <TextBlock Text="{Binding}" FontSize="12" Margin="0,2" TextWrapping="Wrap" Foreground="{DynamicResource TextSecondaryBrush}" />
                  </DataTemplate>
                </ItemsControl.ItemTemplate>
              </ItemsControl>
            </ScrollViewer>
          </Border>
          <Button x:Name="CloseButton" Classes="accent primary" HorizontalAlignment="Center" MinWidth="120"
                  HorizontalContentAlignment="Center" Content="{DynamicResource common.close}" Command="{Binding CancelCommand}" />
        </StackPanel>
      </Border>

      <!-- Reading the video -->
      <Border Classes="float" IsVisible="{Binding IsLoading}" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="18,14">
        <ProgressBar Classes="soft" IsIndeterminate="True" Width="96" />
      </Border>
    </Grid>
  </Border>
</Window>