Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Commit

Permalink
Added background colour setting for UI window.
Browse files Browse the repository at this point in the history
Updated version.
  • Loading branch information
KFreon committed Dec 29, 2016
1 parent 8ac2da9 commit 1c7b90d
Show file tree
Hide file tree
Showing 12 changed files with 204 additions and 18 deletions.
4 changes: 2 additions & 2 deletions CSharpImageLibrary/CSharpImageLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UsefulThings, Version=1.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\UsefulCSharpThings.1.7.1\lib\net462\UsefulThings.dll</HintPath>
<Reference Include="UsefulThings, Version=1.7.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\UsefulCSharpThings.1.7.2\lib\net462\UsefulThings.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
Expand Down
4 changes: 2 additions & 2 deletions CSharpImageLibrary/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.1.0")]
[assembly: AssemblyFileVersion("4.0.1.0")]
[assembly: AssemblyVersion("4.0.2.0")]
[assembly: AssemblyFileVersion("4.0.2.0")]
2 changes: 1 addition & 1 deletion CSharpImageLibrary/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<packages>
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.2.1" targetFramework="net462" />
<package id="Microsoft.Tpl.Dataflow" version="4.5.24" targetFramework="net462" />
<package id="UsefulCSharpThings" version="1.7.1" targetFramework="net462" />
<package id="UsefulCSharpThings" version="1.7.2" targetFramework="net462" />
</packages>
12 changes: 12 additions & 0 deletions UI_Project/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
<setting name="NumThreads" serializeAs="String">
<value>-1</value>
</setting>
<setting name="BackgroundRed" serializeAs="String">
<value>0</value>
</setting>
<setting name="BackgroundGreen" serializeAs="String">
<value>0</value>
</setting>
<setting name="BackgroundBlue" serializeAs="String">
<value>0</value>
</setting>
<setting name="BackgroundAlpha" serializeAs="String">
<value>158</value>
</setting>
</UI_Project.Properties.Settings>
</userSettings>
</configuration>
44 changes: 37 additions & 7 deletions UI_Project/NewMainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
xmlns:Library="clr-namespace:CSharpImageLibrary;assembly=CSharpImageLibrary"
xmlns:UsefulWPF="clr-namespace:UsefulThings.WPF;assembly=UsefulThings"
mc:Ignorable="d"
Title="NewMainWindow" Height="900" Width="1100" AllowsTransparency="True" Background="#9F000000" WindowStyle="None" ResizeMode="CanResizeWithGrip"
Title="NewMainWindow" Height="900" Width="1100" AllowsTransparency="True" Background="{Binding WindowBackgroundColour}" WindowStyle="None" ResizeMode="CanResizeWithGrip"
Loaded="Window_Loaded" d:DataContext="{d:DesignInstance Type=local:Design_ViewModel, IsDesignTimeCreatable=True}"
AllowDrop="True" DragOver="TOPWINDOW_DragOver" Drop="TOPWINDOW_Drop" KeyDown="TOPWINDOW_KeyDown" MouseLeftButtonDown="TOPWINDOW_MouseLeftButtonDown" MouseDown="TOPWINDOW_MouseDown" Closing="TOPWINDOW_Closing">
<Window.Resources>
Expand All @@ -22,6 +22,7 @@
<UsefulThingsConverters:PercentageConverter x:Key="PercentageConverter"/>
<UsefulThingsConverters:InverseBooleanConverter x:Key="InverseBoolConverter"/>
<UsefulThingsConverters:MutuallyExclusiveCheckersConverter x:Key="MutuallyExclusiveCheckersConverter"/>

<sys:Boolean x:Key="TrueValue">
True
</sys:Boolean>
Expand Down Expand Up @@ -1021,13 +1022,9 @@
<DockPanel LastChildFill="False">
<Label Content="Settings" Style="{StaticResource TitleStyle}" FontSize="30" DockPanel.Dock="Top"/>

<Button x:Name="SettingsPanelCloseButton" Content="Close" Foreground="White" DockPanel.Dock="Bottom" HorizontalAlignment="Center" Margin="0,10,0,5"
Click="SettingsPanelCloseButton_Click"/>
<CheckBox Content="Use Windows Codecs where available" DockPanel.Dock="Top" Foreground="White" VerticalContentAlignment="Center" Margin="0,20,0,5" IsChecked="{Binding UseWindowsCodecs}"/>

<CheckBox x:Name="UseWindowTransparencyChecker" Foreground="White" Content="Use Window Transparency?" Checked="UseWindowTransparencyChecker_Checked" Unchecked="UseWindowTransparencyChecker_Unchecked" DockPanel.Dock="Bottom"/>
<CheckBox Content="Use Windows Codecs where available" DockPanel.Dock="Bottom" Foreground="White" VerticalContentAlignment="Center" Margin="0,20,0,5" IsChecked="{Binding UseWindowsCodecs}"/>

<DockPanel LastChildFill="False">
<DockPanel LastChildFill="False" DockPanel.Dock="Top">
<CheckBox Content="Enable Threading" IsChecked="{Binding EnableThreading}" DockPanel.Dock="Top" Foreground="White" VerticalContentAlignment="Center"/>
<TextBlock DockPanel.Dock="Right" FontSize="8" VerticalAlignment="Center" Foreground="White" IsEnabled="{Binding EnableThreading}">
<Run Text="-1 signifies system managed threading."/>
Expand All @@ -1038,6 +1035,39 @@
<TextBox Text="{Binding NumThreads}" IsEnabled="{Binding EnableThreading}" Width="30" Margin="5,3,10,3" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"/>
</DockPanel>


<Label Content="Window Colour/Display Settings" Style="{StaticResource TitleStyle}" DockPanel.Dock="Top" Margin="0,20,0,0"/>
<CheckBox x:Name="UseWindowTransparencyChecker" Foreground="White" Content="Blur Window Background?" Checked="UseWindowTransparencyChecker_Checked"
Unchecked="UseWindowTransparencyChecker_Unchecked" DockPanel.Dock="Top"/>

<DockPanel DockPanel.Dock="Top" Margin="3">
<Label Content="Red: " Foreground="White"/>
<TextBox Text="{Binding WindowBackground_Red}" DockPanel.Dock="Right" Width="30" HorizontalContentAlignment="Center"/>
<Slider Maximum="255" Value="{Binding WindowBackground_Red}" VerticalAlignment="Center"/>
</DockPanel>

<DockPanel DockPanel.Dock="Top" Margin="3">
<Label Content="Green: " Foreground="White"/>
<TextBox Text="{Binding WindowBackground_Green}" DockPanel.Dock="Right" Width="30" HorizontalContentAlignment="Center"/>
<Slider Maximum="255" Value="{Binding WindowBackground_Green}" VerticalAlignment="Center"/>
</DockPanel>

<DockPanel DockPanel.Dock="Top" Margin="3">
<Label Content="Blue: " Foreground="White"/>
<TextBox Text="{Binding WindowBackground_Blue}" DockPanel.Dock="Right" Width="30" HorizontalContentAlignment="Center"/>
<Slider Maximum="255" Value="{Binding WindowBackground_Blue}" VerticalAlignment="Center"/>
</DockPanel>

<DockPanel DockPanel.Dock="Top" Margin="3">
<Label Content="Alpha: " Foreground="White"/>
<TextBox Text="{Binding WindowBackground_Alpha}" DockPanel.Dock="Right" Width="30" HorizontalContentAlignment="Center"/>
<Slider Maximum="255" Value="{Binding WindowBackground_Alpha}" VerticalAlignment="Center"/>
</DockPanel>

<Button x:Name="Settings_ColoursDefaultButton" DockPanel.Dock="Top" Content="Default Colours" Click="Settings_ColoursDefaultButton_Click" HorizontalAlignment="Center"/>

<Button x:Name="SettingsPanelCloseButton" Content="Close" Foreground="White" DockPanel.Dock="Bottom" HorizontalAlignment="Center" Margin="0,10,0,5"
Click="SettingsPanelCloseButton_Click"/>
</DockPanel>
</Border>
</Border>
Expand Down
15 changes: 14 additions & 1 deletion UI_Project/NewMainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -602,14 +602,27 @@ private void UseWindowTransparencyChecker_Checked(object sender, RoutedEventArgs

private void UseWindowTransparencyChecker_Unchecked(object sender, RoutedEventArgs e)
{
//UsefulThings.WPF.WindowBlur.DisableBlur(this);
UsefulThings.WPF.WindowBlur.DisableBlur(this);
Properties.Settings.Default.IsWindowBlurred = false;
}

private void TOPWINDOW_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
Properties.Settings.Default.NumThreads = ImageEngine.NumThreads;
Properties.Settings.Default.BackgroundAlpha = vm.WindowBackground_Alpha;
Properties.Settings.Default.BackgroundRed = vm.WindowBackground_Red;
Properties.Settings.Default.BackgroundGreen = vm.WindowBackground_Green;
Properties.Settings.Default.BackgroundBlue = vm.WindowBackground_Blue;
Properties.Settings.Default.Save();
}

private void Settings_ColoursDefaultButton_Click(object sender, RoutedEventArgs e)
{
vm.WindowBackground_Alpha = 158;
vm.WindowBackground_Red = 0;
vm.WindowBackground_Green = 0;
vm.WindowBackground_Blue = 0;
UseWindowTransparencyChecker_Checked(null, null); // Blur background
}
}
}
71 changes: 71 additions & 0 deletions UI_Project/NewViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,70 @@ public bool MergeChannelsReady
#endregion Merge Channels Properties

#region General Properties
byte windowBackground_Red = 0;
public byte WindowBackground_Red
{
get
{
return windowBackground_Red;
}
set
{
SetProperty(ref windowBackground_Red, value);
OnPropertyChanged(nameof(WindowBackgroundColour));
}
}

byte windowBackground_Green = 0;
public byte WindowBackground_Green
{
get
{
return windowBackground_Green;
}
set
{
SetProperty(ref windowBackground_Green, value);
OnPropertyChanged(nameof(WindowBackgroundColour));
}
}

byte windowBackground_Blue = 0;
public byte WindowBackground_Blue
{
get
{
return windowBackground_Blue;
}
set
{
SetProperty(ref windowBackground_Blue, value);
OnPropertyChanged(nameof(WindowBackgroundColour));
}
}

byte windowBackground_Alpha = 158;
public byte WindowBackground_Alpha
{
get
{
return windowBackground_Alpha;
}
set
{
SetProperty(ref windowBackground_Alpha, value);
OnPropertyChanged(nameof(WindowBackgroundColour));
}
}

public Brush WindowBackgroundColour
{
get
{
return new SolidColorBrush(Color.FromArgb(WindowBackground_Alpha, WindowBackground_Red, WindowBackground_Green, WindowBackground_Blue));
}
}

bool splitChannels = false;
public bool SplitChannels
{
Expand Down Expand Up @@ -928,6 +992,7 @@ public int JPG_CompressionSetting
#endregion General Properties



public NewViewModel() : base()
{
// Space out the Output Window a bit
Expand All @@ -942,6 +1007,12 @@ public NewViewModel() : base()
};

MergeChannelsImages.CollectionChanged += (sender, args) => OnPropertyChanged(nameof(MergeChannelsReady));

// Set background colour
WindowBackground_Alpha = Properties.Settings.Default.BackgroundAlpha;
WindowBackground_Red = Properties.Settings.Default.BackgroundRed;
WindowBackground_Green = Properties.Settings.Default.BackgroundGreen;
WindowBackground_Blue = Properties.Settings.Default.BackgroundBlue;
}

internal async Task LoadImage(string path)
Expand Down
4 changes: 2 additions & 2 deletions UI_Project/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
48 changes: 48 additions & 0 deletions UI_Project/Properties/Settings.Designer.cs

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

12 changes: 12 additions & 0 deletions UI_Project/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,17 @@
<Setting Name="NumThreads" Type="System.Int32" Scope="User">
<Value Profile="(Default)">-1</Value>
</Setting>
<Setting Name="BackgroundRed" Type="System.Byte" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="BackgroundGreen" Type="System.Byte" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="BackgroundBlue" Type="System.Byte" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="BackgroundAlpha" Type="System.Byte" Scope="User">
<Value Profile="(Default)">158</Value>
</Setting>
</Settings>
</SettingsFile>
4 changes: 2 additions & 2 deletions UI_Project/UI_Project.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UsefulThings, Version=1.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\UsefulCSharpThings.1.7.1\lib\net462\UsefulThings.dll</HintPath>
<Reference Include="UsefulThings, Version=1.7.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\UsefulCSharpThings.1.7.2\lib\net462\UsefulThings.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
Expand Down
2 changes: 1 addition & 1 deletion UI_Project/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.2.1" targetFramework="net462" />
<package id="Microsoft.WindowsAPICodePack-Core" version="1.1.0.2" targetFramework="net462" />
<package id="Microsoft.WindowsAPICodePack-Shell" version="1.1.0.0" targetFramework="net462" />
<package id="UsefulCSharpThings" version="1.7.1" targetFramework="net462" />
<package id="UsefulCSharpThings" version="1.7.2" targetFramework="net462" />
</packages>

0 comments on commit 1c7b90d

Please sign in to comment.