Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Commit

Permalink
Fix #19
Browse files Browse the repository at this point in the history
  • Loading branch information
ixjf committed Feb 26, 2019
1 parent 525883c commit c013f98
Show file tree
Hide file tree
Showing 14 changed files with 532 additions and 566 deletions.
7 changes: 1 addition & 6 deletions MSIRGB.DLL/MSIRGB.Lighting.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,7 @@ namespace MSIRGB {

bool SetColour(Byte index, Color colour)
{
try {
return lighting->set_colour(index, logic::Lighting::Colour {colour.R, colour.G, colour.B});
}
catch (std::invalid_argument &) {
return false;
}
return lighting->set_colour(index, logic::Lighting::Colour {colour.R, colour.G, colour.B});
}

Nullable<Color> GetColour(Byte index)
Expand Down
2 changes: 1 addition & 1 deletion MSIRGB.GUI/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Styles.xaml" />
<ResourceDictionary Source="pack://application:,,,/Controls/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
107 changes: 76 additions & 31 deletions MSIRGB.GUI/Controls/ColourPicker/ColourPicker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,82 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d">
<Canvas x:Name="Canv"
Width="256.0"
Height="256.0"
MouseMove="Picker_MouseMove"
MouseLeftButtonDown="Picker_MouseLeftButtonDown"
MouseLeftButtonUp="Picker_MouseLeftButtonUp">
<Image Width="256.0"
Height="256.0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Source="pack://application:,,,/Controls/ColourPicker/Images/ColourPickerBitmap.png" />
<UserControl.Resources>
<DoubleCollection x:Key="Ticks">0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15</DoubleCollection>
</UserControl.Resources>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Vertical">
<TextBlock
Style="{StaticResource CustomTextBlockStyle}"
Foreground="{StaticResource GamingRed}">Red: </TextBlock>
<StackPanel Orientation="Horizontal">
<Slider
x:Name="RedChannelSlider"
Style="{DynamicResource CustomSliderStyle}"
Width="128"
Minimum="0"
Maximum="15"
Ticks="{StaticResource Ticks}"
IsSnapToTickEnabled="True"
ValueChanged="Slider_ValueChanged" />
<TextBox
x:Name="RedChannelTextBox"
Style="{StaticResource CustomTextBoxStyle}"
Width="13"
Margin="5, 0, 0, 0"
PreviewTextInput="TextBox_PreviewTextInput"
TextChanged="TextBox_TextChanged">0</TextBox>
</StackPanel>
</StackPanel>

<Viewbox x:Name="Handle"
Width="{Binding HandleSize, ElementName=ColourPickerControl}"
Height="{Binding HandleSize, ElementName=ColourPickerControl}">
<Grid>
<Line X1="0"
Y1="5"
X2="10"
Y2="5"
Stroke="{Binding HandleBrush, ElementName=ColourPickerControl}"
StrokeThickness="{Binding HandleThickness, ElementName=ColourPickerControl}" />
<Line X1="5"
Y1="0"
X2="5"
Y2="10"
Stroke="{Binding HandleBrush, ElementName=ColourPickerControl}"
StrokeThickness="{Binding HandleThickness, ElementName=ColourPickerControl}" />
</Grid>
</Viewbox>
</Canvas>
<StackPanel Orientation="Vertical" Margin="0, 5, 0, 0">
<TextBlock
Style="{StaticResource CustomTextBlockStyle}"
Foreground="{StaticResource GamingRed}">Green:</TextBlock>
<StackPanel Orientation="Horizontal">
<Slider
x:Name="GreenChannelSlider"
Style="{StaticResource CustomSliderStyle}"
Width="128"
Minimum="0"
Maximum="15"
Ticks="{StaticResource Ticks}"
IsSnapToTickEnabled="True"
ValueChanged="Slider_ValueChanged" />
<TextBox
x:Name="GreenChannelTextBox"
Style="{StaticResource CustomTextBoxStyle}"
Width="13"
Margin="5, 0, 0, 0"
PreviewTextInput="TextBox_PreviewTextInput"
TextChanged="TextBox_TextChanged">0</TextBox>
</StackPanel>
</StackPanel>

<StackPanel Orientation="Vertical" Margin="0, 5, 0, 0">
<TextBlock
Style="{StaticResource CustomTextBlockStyle}"
Foreground="{StaticResource GamingRed}">Blue:</TextBlock>
<StackPanel Orientation="Horizontal">
<Slider
x:Name="BlueChannelSlider"
Style="{StaticResource CustomSliderStyle}"
Width="128"
Minimum="0"
Maximum="15"
Ticks="{StaticResource Ticks}"
IsSnapToTickEnabled="True"
ValueChanged="Slider_ValueChanged" />
<TextBox
x:Name="BlueChannelTextBox"
Style="{StaticResource CustomTextBoxStyle}"
Margin="5, 0, 0, 0"
Width="13"
PreviewTextInput="TextBox_PreviewTextInput"
TextChanged="TextBox_TextChanged">0</TextBox>
</StackPanel>
</StackPanel>
</StackPanel>
</UserControl>
Loading

0 comments on commit c013f98

Please sign in to comment.