Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ControlPad/DataHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public static void LoadPreset(Preset preset, SettingsUserControl settingsUserCon
Settings.Load();
settingsUserControl.SetControls();
SettingsUserControl.ChangeAppTheme(Settings.SelectedThemeIndex);
settingsUserControl.ChangeAppBackground(Settings.SelectedBackgroundIndex);
}
}
}
14 changes: 14 additions & 0 deletions ControlPad/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static class Settings
private static bool _minimizeToSystemTray = true;
private static double _translationExponent = 1d;
private static int _selectedThemeIndex = 0;
private static int _selectedBackgroundIndex = 3;
private static int _sliderDeadZone = 4;

static Settings()
Expand Down Expand Up @@ -73,6 +74,16 @@ public static int SelectedThemeIndex
}
}

public static int SelectedBackgroundIndex
{
get => _selectedBackgroundIndex;
set
{
_selectedBackgroundIndex = value;
Save();
}
}

public static int SliderDeadZone
{
get => _sliderDeadZone;
Expand Down Expand Up @@ -101,6 +112,7 @@ private class Data
public bool MinimizeToSystemTray { get; set; } = true;
public double TranslationExponent { get; set; } = 1d;
public int SelectedThemeIndex { get; set; } = 0;
public int SelectedBackgroundIndex { get; set; } = 3;
public int SliderDeadZone { get; set; } = 4;
}

Expand All @@ -121,6 +133,7 @@ public static void Load()
_startMinimized = data.StartMinimized;
_minimizeToSystemTray = data.MinimizeToSystemTray;
_selectedThemeIndex = data.SelectedThemeIndex;
_selectedBackgroundIndex = data.SelectedBackgroundIndex;
_sliderDeadZone = data.SliderDeadZone;
_translationExponent = data.TranslationExponent;
}
Expand All @@ -141,6 +154,7 @@ private static void Save()
StartMinimized = _startMinimized,
MinimizeToSystemTray = _minimizeToSystemTray,
SelectedThemeIndex = _selectedThemeIndex,
SelectedBackgroundIndex = _selectedBackgroundIndex,
SliderDeadZone = _sliderDeadZone,
TranslationExponent = _translationExponent,
};
Expand Down
32 changes: 32 additions & 0 deletions ControlPad/UI Elements/SettingsUserControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>


Expand Down Expand Up @@ -156,12 +157,43 @@
</ComboBox>
</Grid>

<!-- App Background -->
<Grid Margin="0,8,0,0" Grid.Row="6">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>

<StackPanel Orientation="Vertical" Margin="0,0,16,0">
<Label Content="App _background"
Padding="0"
Target="{Binding ElementName=ThemeComboBox}"/>
<Label Content="Choose how the app background looks.&#x0a;"
Padding="0"
Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</StackPanel>

<ComboBox x:Name="BackgroundComboBox"
Grid.Column="1"
MinWidth="180"
SelectedIndex="3"
VerticalAlignment="Center" SelectionChanged="BackgroundComboBox_SelectionChanged"
>
<ComboBoxItem Content="None"/>
<ComboBoxItem Content="Acrylic"/>
<ComboBoxItem Content="Mica"/>
<ComboBoxItem Content="Tabbed"/>
<ComboBoxItem Content="Auto"/>
</ComboBox>
</Grid>

<!-- Presets -->
<Grid Margin="0,8,0,0" Grid.Row="7">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>

<StackPanel Orientation="Vertical" Margin="0,0,16,0">
<Label Content="_Presets"
Padding="0"
Expand Down
38 changes: 37 additions & 1 deletion ControlPad/UI Elements/SettingsUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Wpf.Ui.Controls;

namespace ControlPad
{
public partial class SettingsUserControl : UserControl
{
private bool _isInitialized = false;
private readonly bool _isInitialized = false;
private readonly MainWindow _mainWindow;

public SettingsUserControl(MainWindow mainWindow)
{
InitializeComponent();
_mainWindow = mainWindow;
_isInitialized = true;
SetControls();
}
Expand Down Expand Up @@ -67,6 +71,15 @@ private void ThemeComboBox_SelectionChanged(object sender, SelectionChangedEvent
Settings.SelectedThemeIndex = ThemeComboBox.SelectedIndex;
}

private void BackgroundComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!_isInitialized)
return;

ChangeAppBackground(BackgroundComboBox.SelectedIndex);
Settings.SelectedBackgroundIndex = BackgroundComboBox.SelectedIndex;
}

private void nb_TranslationExponent_ValueChanged(object sender, Wpf.Ui.Controls.NumberBoxValueChangedEventArgs e)
{
if (!_isInitialized)
Expand Down Expand Up @@ -94,12 +107,35 @@ public static void ChangeAppTheme(int index)
}
}

public void ChangeAppBackground(int index)
{
switch (index)
{
case 0:
_mainWindow.WindowBackdropType = WindowBackdropType.None;
break;
case 1:
_mainWindow.WindowBackdropType = WindowBackdropType.Acrylic;
break;
case 2:
_mainWindow.WindowBackdropType = WindowBackdropType.Mica;
break;
case 3:
_mainWindow.WindowBackdropType = WindowBackdropType.Tabbed;
break;
case 4:
_mainWindow.WindowBackdropType = WindowBackdropType.Auto;
break;
}
}

public void SetControls()
{
cb_StartWithWindows.IsChecked = Settings.StartWithWindows;
cb_StartMinimized.IsChecked = Settings.StartMinimized;
cb_MinimizeToTray.IsChecked = Settings.MinimizeToSystemTray;
ThemeComboBox.SelectedIndex = Settings.SelectedThemeIndex;
BackgroundComboBox.SelectedIndex = Settings.SelectedBackgroundIndex;
nb_TranslationExponent.Value = Settings.TranslationExponent;
}

Expand Down
5 changes: 2 additions & 3 deletions ControlPad/Windows/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
Height="600"
Closing="mainWindow_Closing"
Closed="mainWindow_Closed"
WindowBackdropType="Mica"
WindowBackdropType="Tabbed"
ExtendsContentIntoTitleBar="True"
ResizeMode="NoResize"
>
ResizeMode="NoResize">

<DockPanel>
<tray:NotifyIcon
Expand Down
Loading