Commit 8b09ede8 authored by sr55's avatar sr55

WinGui: Improvements to dropdown visibility behaviour on the Audio Defaults. #2135

parent 482edae6
......@@ -20,14 +20,34 @@ namespace HandBrakeWPF.Converters.Audio
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length == 1)
if (values.Length == 3)
{
bool isVisibile = (bool)values[0];
bool isPassthru = (bool)values[1];
AudioEncoder fallbackEncoder = (AudioEncoder)values[2];
if (!isVisibile)
{
return Visibility.Collapsed;
}
// When the Fallback Encoder is "None" and we have a passthru encoder selected on the track, we don't have any encoder options to override so don't show them.
if (isPassthru && fallbackEncoder == AudioEncoder.None)
{
return Visibility.Collapsed;
}
}
if (values.Length == 2)
{
bool isPassthru = (bool)values[0];
AudioEncoder fallbackEncoder = (AudioEncoder)values[1];
// When the Fallback Encoder is "None" and we have a passthru encoder selected on the track, we don't have any encoder options to override so don't show them.
if (isPassthru && fallbackEncoder == AudioEncoder.None)
{
return Visibility.Collapsed;
}
}
return Visibility.Visible;
......
......@@ -277,6 +277,8 @@
<ComboBox.Visibility>
<MultiBinding Converter="{StaticResource audioControlVisibilityConverter}">
<Binding Path="IsRateTypeVisible" />
<Binding Path="IsPassthru" />
<Binding Path="DataContext.AudioEncoderFallback" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Window}}" />
</MultiBinding>
</ComboBox.Visibility>
</ComboBox>
......@@ -286,6 +288,8 @@
<ComboBox.Visibility>
<MultiBinding Converter="{StaticResource audioControlVisibilityConverter}">
<Binding Path="IsQualityVisible" />
<Binding Path="IsPassthru" />
<Binding Path="DataContext.AudioEncoderFallback" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Window}}" />
</MultiBinding>
</ComboBox.Visibility>
</ComboBox>
......@@ -295,26 +299,56 @@
<ComboBox.Visibility>
<MultiBinding Converter="{StaticResource audioControlVisibilityConverter}">
<Binding Path="IsBitrateVisible" />
<Binding Path="IsPassthru" />
<Binding Path="DataContext.AudioEncoderFallback" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Window}}" />
</MultiBinding>
</ComboBox.Visibility>
</ComboBox>
<ComboBox Grid.Row="0" Grid.Column="7" Height="22" Width="120" Margin="5,0,5,0" HorizontalAlignment="Stretch"
ItemsSource="{Binding Mixdowns}" SelectedItem="{Binding MixDown}"
DisplayMemberPath="DisplayName" />
DisplayMemberPath="DisplayName" >
<ComboBox.Visibility>
<MultiBinding Converter="{StaticResource audioControlVisibilityConverter}">
<Binding Path="IsPassthru" />
<Binding Path="DataContext.AudioEncoderFallback" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Window}}" />
</MultiBinding>
</ComboBox.Visibility>
</ComboBox>
<ComboBox Width="70" Height="22" Margin="5,0,5,0" Grid.Column="9"
ItemsSource="{Binding DataContext.SampleRates, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
SelectedItem="{Binding SampleRateDisplayValue}" />
SelectedItem="{Binding SampleRateDisplayValue}" >
<ComboBox.Visibility>
<MultiBinding Converter="{StaticResource audioControlVisibilityConverter}">
<Binding Path="IsPassthru" />
<Binding Path="DataContext.AudioEncoderFallback" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Window}}" />
</MultiBinding>
</ComboBox.Visibility>
</ComboBox>
<controls:NumberBox Name="drcNumericCtl" Width="45" Margin="5,0,5,0" HorizontalAlignment="Left" Grid.Column="11" VerticalAlignment="Center" Height="22"
Minimum="0" Modulus="0.1" Maximum="4" Number="{Binding DRC, Mode=TwoWay}" UpdateBindingOnTextChange="True"
ShowIncrementButtons="True" AllowEmpty="False" />
ShowIncrementButtons="True" AllowEmpty="False">
<controls:NumberBox.Visibility>
<MultiBinding Converter="{StaticResource audioControlVisibilityConverter}">
<Binding Path="IsPassthru" />
<Binding Path="DataContext.AudioEncoderFallback" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Window}}" />
</MultiBinding>
</controls:NumberBox.Visibility>
</controls:NumberBox>
<controls:NumberBox Name="gainNumericCtl" Width="45" Margin="5,0,5,0" HorizontalAlignment="Left" Grid.Column="13" VerticalAlignment="Center" Height="22"
Minimum="-20" Modulus="1" Maximum="20" Number="{Binding Gain, Mode=TwoWay}" UpdateBindingOnTextChange="True"
ShowIncrementButtons="True" AllowEmpty="False" />
ShowIncrementButtons="True" AllowEmpty="False" >
<controls:NumberBox.Visibility>
<MultiBinding Converter="{StaticResource audioControlVisibilityConverter}">
<Binding Path="IsPassthru" />
<Binding Path="DataContext.AudioEncoderFallback" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Window}}" />
</MultiBinding>
</controls:NumberBox.Visibility>
</controls:NumberBox>
</Grid>
<!-- Delete -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment