Skip to content

Commit

Permalink
Release.
Browse files Browse the repository at this point in the history
  • Loading branch information
MRGRD56 committed Dec 5, 2020
1 parent fcaa34e commit dde0a8f
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 7 deletions.
3 changes: 3 additions & 0 deletions FastVolumeFw/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<setting name="WindowRightMargin" serializeAs="String">
<value>30</value>
</setting>
<setting name="MouseWheelVolumeChangeStep" serializeAs="String">
<value>2</value>
</setting>
</FastVolumeFw.Properties.Settings>
</userSettings>
</configuration>
12 changes: 12 additions & 0 deletions FastVolumeFw/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions FastVolumeFw/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
<Setting Name="WindowRightMargin" Type="System.UInt32" Scope="User">
<Value Profile="(Default)">30</Value>
</Setting>
<Setting Name="MouseWheelVolumeChangeStep" Type="System.UInt32" Scope="User">
<Value Profile="(Default)">2</Value>
</Setting>
</Settings>
</SettingsFile>
20 changes: 20 additions & 0 deletions FastVolumeFw/ViewModel/SettingsWindowVm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class SettingsWindowVm : INotifyPropertyChanged
private bool _unmuteWhileChangingVolume;
private bool _volumeControlWithMouseWheel;
private uint _windowRightMargin;
private uint _mouseWheelVolumeChangeStep;

public bool IsAppDisabledInFullScreenMode
{
Expand Down Expand Up @@ -96,13 +97,31 @@ public uint WindowRightMargin
}
}

public uint MouseWheelVolumeChangeStep
{
get => _mouseWheelVolumeChangeStep;
set
{
if (value < 1 || value > 10) return;

_mouseWheelVolumeChangeStep = value;
if (Default.MouseWheelVolumeChangeStep != value)
{
Default.MouseWheelVolumeChangeStep = value;
Default.Save();
}
OnPropertyChanged();
}
}

public SettingsWindowVm()
{
IsAppDisabledInFullScreenMode = Default.IsAppDisabledInFullScreenMode;
PlaySoundAfterVolumeChange = Default.PlaySoundAfterVolumeChange;
UnmuteWhileChangingVolume = Default.UnmuteWhileChangingVolume;
VolumeControlWithMouseWheel = Default.VolumeControlWithMouseWheel;
WindowRightMargin = Default.WindowRightMargin;
MouseWheelVolumeChangeStep = Default.MouseWheelVolumeChangeStep;
}

public void RestoreDefaults()
Expand All @@ -112,6 +131,7 @@ public void RestoreDefaults()
UnmuteWhileChangingVolume = true;
VolumeControlWithMouseWheel = true;
WindowRightMargin = 30;
MouseWheelVolumeChangeStep = 2;
}

public event PropertyChangedEventHandler PropertyChanged;
Expand Down
10 changes: 6 additions & 4 deletions FastVolumeFw/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,19 @@ private void MainBorder_MouseWheel(object sender, MouseWheelEventArgs e)
if (!Properties.Settings.Default.VolumeControlWithMouseWheel)
return;

var step = Properties.Settings.Default.MouseWheelVolumeChangeStep;

if (e.Delta > 0)
{
if (ViewModel.Volume <= 98)
ViewModel.Volume += 2;
if (ViewModel.Volume <= 100 - step)
ViewModel.Volume += (int) step;
else
ViewModel.Volume = 100;
}
else if (e.Delta < 0)
{
if (ViewModel.Volume >= 2)
ViewModel.Volume -= 2;
if (ViewModel.Volume >= step)
ViewModel.Volume -= (int) step;
else
ViewModel.Volume = 0;
}
Expand Down
13 changes: 10 additions & 3 deletions FastVolumeFw/Windows/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,20 @@
<Label Content="Enable volume control with the mouse wheel" ToolTip="When you move the mouse wheel within the application window, the volume changes."/>
</StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="210"/>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="Window right margin: " ToolTip="Offset of the main window from the right edge. Range: 0-100."/>
<TextBox Grid.Column="1" TextAlignment="Center" Text="{Binding WindowRightMargin, UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Row="0" Grid.Column="0" Content="Mouse wheel volume change step: " ToolTip="Volume change step when adjusting with the mouse wheel. Range: 1-10."/>
<TextBox Grid.Row="0" Grid.Column="1" TextAlignment="Center" IsEnabled="{Binding VolumeControlWithMouseWheel}"
Text="{Binding MouseWheelVolumeChangeStep, UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Row="1" Grid.Column="0" Content="Window right margin: " ToolTip="Offset of the main window from the right edge. Range: 0-100."/>
<TextBox Grid.Row="1" Grid.Column="1" TextAlignment="Center" Text="{Binding WindowRightMargin, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</StackPanel>
<StackPanel Grid.RowSpan="2" VerticalAlignment="Bottom" Margin="0,0,5,5" Width="135" HorizontalAlignment="Right">
Expand Down

0 comments on commit dde0a8f

Please sign in to comment.