Skip to content

Commit

Permalink
Bug fixes; explicitly set dpi awareness.
Browse files Browse the repository at this point in the history
  • Loading branch information
alxnull committed Jul 8, 2018
1 parent 831d039 commit c5e2f05
Show file tree
Hide file tree
Showing 21 changed files with 183 additions and 77 deletions.
9 changes: 9 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Colora Changelog

#### v.0.1.1 (2018-07)
- **Fixed:** High-DPI support ([#2](https://github.com/bluegrams/Colora/issues/2)).
- **Fixed:** Bug with 'Pin on Top'.
- **Fixed:** Little UI issues.

### v.0.1 (2018-03)
- First released version.
1 change: 1 addition & 0 deletions Colora.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColoraTests", "ColoraTests\
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B19FEE5B-517A-45C3-855B-F49034D16E4E}"
ProjectSection(SolutionItems) = preProject
Changelog.md = Changelog.md
LICENSE.txt = LICENSE.txt
README.md = README.md
EndProjectSection
Expand Down
3 changes: 3 additions & 0 deletions Colora/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
</startup>
<runtime>
<AppContextSwitchOverrides value = "Switch.System.Windows.DoNotScaleForDpiChanges=false"/>
</runtime>
</configuration>
2 changes: 1 addition & 1 deletion Colora/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<Style TargetType="{x:Type ButtonBase}">
<Setter Property="Control.Height" Value="35"/>
<Setter Property="Control.Width" Value="40"/>
<Setter Property="Control.Padding" Value="4"/>
<Setter Property="Control.Padding" Value="0"/>
<Setter Property="Control.BorderThickness" Value="0"/>
</Style>
<Style TargetType="ToggleButton" BasedOn="{StaticResource {x:Type ButtonBase}}"/>
Expand Down
15 changes: 10 additions & 5 deletions Colora/Colora.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="MiniAppManager.Shared, Version=0.3.0.18095, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MiniAppManager.WPF.0.3.0.18095\lib\net451\MiniAppManager.Shared.dll</HintPath>
<Reference Include="MiniAppManager.Shared, Version=0.4.0.18188, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MiniAppManager.WPF.0.4.0-beta\lib\net45\MiniAppManager.Shared.dll</HintPath>
</Reference>
<Reference Include="MiniAppManager.WPF, Version=0.3.0.18095, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MiniAppManager.WPF.0.3.0.18095\lib\net451\MiniAppManager.WPF.dll</HintPath>
<Reference Include="MiniAppManager.WPF, Version=0.4.0.18188, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MiniAppManager.WPF.0.4.0-beta\lib\net45\MiniAppManager.WPF.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
Expand Down Expand Up @@ -86,6 +89,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="ColorConversion.cs" />
<Compile Include="CustomCommands.cs" />
<Compile Include="FixedColorCollection.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
Expand Down Expand Up @@ -131,6 +135,7 @@
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand All @@ -153,7 +158,7 @@
<Resource Include="img\1list.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="img\colorasmall.png" />
<Resource Include="img\colora.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="colora.ico" />
Expand Down
24 changes: 24 additions & 0 deletions Colora/CustomCommands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Windows.Input;

namespace Colora
{
static class CustomCommands
{
public static readonly RoutedCommand ColorDialog = new RoutedCommand("ColorDialog",
typeof(CustomCommands),
new InputGestureCollection() { new KeyGesture(Key.D, ModifierKeys.Control) });

public static readonly RoutedCommand MinimalSize = new RoutedCommand("MinimalSize",
typeof(CustomCommands),
new InputGestureCollection() { new KeyGesture(Key.M, ModifierKeys.Control) });

public static readonly RoutedCommand PaletteEditor = new RoutedCommand("PaletteEditor",
typeof(CustomCommands),
new InputGestureCollection() { new KeyGesture(Key.P, ModifierKeys.Control) });

public static readonly RoutedCommand TopMost = new RoutedCommand("TopMost",
typeof(CustomCommands),
new InputGestureCollection() { new KeyGesture(Key.T, ModifierKeys.Control) });
}
}
66 changes: 35 additions & 31 deletions Colora/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:p="clr-namespace:Colora.Properties"
xmlns:local="clr-namespace:Colora"
mc:Ignorable="d"
x:Name="mainWindow"
Title="Colora" SizeToContent="WidthAndHeight" ResizeMode="CanMinimize" FontSize="11.5" KeyDown="Window_KeyDown"
Loaded="Window_Loaded" Closing="Window_Closing" Icon="img/colorasmall.png" SnapsToDevicePixels="True">
Loaded="Window_Loaded" Closing="Window_Closing" Icon="img/colora.png" SnapsToDevicePixels="True">
<Window.Resources>
<Style TargetType="Button">
<Setter Property="Control.Padding" Value="8,0"/>
Expand All @@ -18,59 +18,62 @@
</Style>
</Window.Resources>
<Window.CommandBindings>
<CommandBinding Command="Select" Executed="SelectCommand_Executed"/>
<CommandBinding Command="Zoom" Executed="SizeCommand_Executed"/>
<CommandBinding Command="FirstPage" Executed="FirstPageCommand_Executed"/>
<CommandBinding Command="local:CustomCommands.ColorDialog" Executed="SelectCommand_Executed"/>
<CommandBinding Command="local:CustomCommands.MinimalSize" Executed="SizeCommand_Executed"/>
<CommandBinding Command="local:CustomCommands.TopMost" Executed="TopMostCommand_Executed"/>
<CommandBinding Command="New" Executed="NewCommand_Executed"/>
<CommandBinding Command="Print" Executed="PaletteCommand_Executed"/>
<CommandBinding Command="local:CustomCommands.PaletteEditor" Executed="PaletteCommand_Executed"/>
<CommandBinding Command="Help" Executed="HelpCommand_Executed"/>
</Window.CommandBindings>
<Window.InputBindings>
<KeyBinding Key="D" Modifiers="Ctrl" Command="Select"/>
<KeyBinding Key="M" Modifiers="Ctrl" Command="Zoom"/>
<KeyBinding Key="T" Modifiers="Ctrl" Command="FirstPage"/>
</Window.InputBindings>
<DockPanel KeyboardNavigation.TabNavigation="Local">
<Menu DockPanel.Dock="Top" Background="#dddddd">
<MenuItem Header="{x:Static p:Resources.MainWindow_menOptions}">
<MenuItem Header="{x:Static p:Resources.MainWindow_menColorDialog}" Command="Select" InputGestureText="{Binding Source={x:Static p:Resources.Global_keyCtrl}, StringFormat={}{0}+D}"/>
<MenuItem Header="{x:Static p:Resources.MainWindow_menPickScreen}" Click="MenuPickScreen_Click" InputGestureText="{Binding Source={x:Static p:Resources.Global_keyCtrl}, StringFormat={}{0}+Alt+C}"/>
<MenuItem Header="{x:Static p:Resources.MainWindow_menColorDialog}" Command="local:CustomCommands.ColorDialog"
InputGestureText="{Binding Source={x:Static p:Resources.Global_keyCtrl}, StringFormat={}{0}+D}"/>
<MenuItem Header="{x:Static p:Resources.MainWindow_menPickScreen}" Click="MenuPickScreen_Click"
InputGestureText="{Binding Source={x:Static p:Resources.Global_keyCtrl}, StringFormat={}{0}+Alt+C}"/>
<Separator/>
<MenuItem x:Name="menNewPalette" Header="{x:Static p:Resources.MainWindow_menNewPalette}" Command="New" />
<MenuItem x:Name="menDeleteLatest" Header="{x:Static p:Resources.MainWindow_menDeleteLatest}" Click="menDeleteLatest_Click"/>
</MenuItem>
<MenuItem Header="{x:Static p:Resources.MainWindow_menView}">
<MenuItem Header="{x:Static p:Resources.MainWindow_menMinimalSize}" Command="Zoom" InputGestureText="{Binding Source={x:Static p:Resources.Global_keyCtrl}, StringFormat={}{0}+M}" IsChecked="{Binding ElementName=grpScreenPicker, Path=IsVisible, Mode=OneWay, Converter={StaticResource boolInverter}}"/>
<MenuItem Header="{x:Static p:Resources.MainWindow_menPaletteEditor}" Command="Print"/>
<MenuItem Header="{x:Static p:Resources.MainWindow_menMinimalSize}" Command="local:CustomCommands.MinimalSize"
InputGestureText="{Binding Source={x:Static p:Resources.Global_keyCtrl}, StringFormat={}{0}+M}"
IsChecked="{Binding ElementName=grpScreenPicker, Path=IsVisible, Mode=OneWay, Converter={StaticResource boolInverter}}"/>
<MenuItem Header="{x:Static p:Resources.MainWindow_menPaletteEditor}" Command="local:CustomCommands.PaletteEditor"
InputGestureText="{Binding Source={x:Static p:Resources.Global_keyCtrl}, StringFormat={}{0}+P}"/>
<Separator/>
<MenuItem Header="{x:Static p:Resources.MainWindow_menTopmost}" InputGestureText="{Binding Source={x:Static p:Resources.Global_keyCtrl}, StringFormat={}{0}+T}" IsCheckable="True" IsChecked="{Binding ElementName=butTopmost, Path=IsChecked}"/>
<MenuItem Header="{x:Static p:Resources.MainWindow_menTopmost}" Command="local:CustomCommands.TopMost"
InputGestureText="{Binding Source={x:Static p:Resources.Global_keyCtrl}, StringFormat={}{0}+T}"
IsChecked="{Binding ElementName=mainWindow, Path=Topmost}"/>
</MenuItem>
<MenuItem Header=" _? ">
<MenuItem Header="{x:Static p:Resources.MainWindow_menAbout}" Command="Help"/>
</MenuItem>
</Menu>
<DockPanel Style="{StaticResource toolBar}" DockPanel.Dock="Top" KeyboardNavigation.TabNavigation="Local">
<Button x:Name="butDialog" Command="Select" ToolTip="{Binding Source={x:Static p:Resources.MainWindow_menColorDialog}, Converter={StaticResource UScoreConverter}}"
TabIndex="0">
<Button x:Name="butDialog" Command="local:CustomCommands.ColorDialog" TabIndex="0"
ToolTip="{Binding Source={x:Static p:Resources.MainWindow_menColorDialog}, Converter={StaticResource UScoreConverter}}">
<Image Source="img/1color.png" Stretch="None"/>
</Button>
<Separator/>
<ToggleButton x:Name="butPick" Checked="butPick_Checked" Unchecked="butPick_Unchecked" ToolTip="{Binding Source={x:Static p:Resources.MainWindow_menPickScreen}, Converter={StaticResource UScoreConverter}}"
TabIndex="1">
<ToggleButton x:Name="butPick" Checked="butPick_Checked" Unchecked="butPick_Unchecked" TabIndex="1"
ToolTip="{Binding Source={x:Static p:Resources.MainWindow_menPickScreen}, Converter={StaticResource UScoreConverter}}">
<Image Source="img/1detect.png" Stretch="None"/>
</ToggleButton>
<ToggleButton x:Name="butTopmost" DockPanel.Dock="Right" ToolTip="{Binding Source={x:Static p:Resources.MainWindow_menTopmost}, Converter={StaticResource UScoreConverter}}" Click="butTopmost_Click"
TabIndex="3">
<ToggleButton x:Name="butTopmost" DockPanel.Dock="Right" TabIndex="3"
ToolTip="{Binding Source={x:Static p:Resources.MainWindow_menTopmost}, Converter={StaticResource UScoreConverter}}"
IsChecked="{Binding ElementName=mainWindow, Path=Topmost}">
<Image Source="img/1tack.png" Stretch="None"/>
</ToggleButton>
<Separator DockPanel.Dock="Right"/>
<ToggleButton DockPanel.Dock="Right" Command="Print" Padding="2" ToolTip="{x:Static p:Resources.PaletteWindow_Title}" TabIndex="2"
IsChecked="{Binding ElementName=butAddPalette, Path=IsEnabled}">
<Button DockPanel.Dock="Right" Command="local:CustomCommands.PaletteEditor"
ToolTip="{x:Static p:Resources.PaletteWindow_Title}" TabIndex="2">
<Image Source="img/1list.png" Stretch="None"/>
</ToggleButton>
</Button>
</DockPanel>
<StatusBar DockPanel.Dock="Bottom" Height="30" Background="#dddddd">
<Label x:Name="statInfo"></Label>
<Label x:Name="statInfo" Padding="0"/>
</StatusBar>
<StackPanel>
<DockPanel>
Expand All @@ -86,7 +89,8 @@
<Label x:Name="lblScreenCoord">X: 0 | Y: 0</Label>
<DockPanel>
<Label Content="{Binding ElementName=sldZoom, Path=Value}" ContentStringFormat="{}{0}x"/>
<Slider x:Name="sldZoom" Minimum="1" Maximum="5" Value="3" TickPlacement="BottomRight" IsSnapToTickEnabled="True" ValueChanged="sldZoom_ValueChanged"></Slider>
<Slider x:Name="sldZoom" Minimum="1" Maximum="5" Value="3" TickPlacement="BottomRight" IsSnapToTickEnabled="True"
ValueChanged="sldZoom_ValueChanged"/>
</DockPanel>
</StackPanel>
</GroupBox>
Expand Down Expand Up @@ -134,10 +138,10 @@
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button x:Name="butAddLast" Grid.Column="0" ContentStringFormat="&#9661; {0}" Content="{x:Static p:Resources.MainWindow_butAddLast}" Click="butAddLast_Click"
TabIndex="6"/>
<Button x:Name="butAddPalette" Grid.Column="1" ContentStringFormat="{}{0} &#9655;" Content="{x:Static p:Resources.MainWindow_butAddPalette}" Click="butAddPalette_Click" IsEnabled="False"
TabIndex="7"/>
<Button x:Name="butAddLast" Grid.Column="0" ContentStringFormat="&#9661; {0}" TabIndex="6"
Content="{x:Static p:Resources.MainWindow_butAddLast}" Click="butAddLast_Click"/>
<Button x:Name="butAddPalette" Grid.Column="1" ContentStringFormat="{}{0} &#9655;" TabIndex="7"
Content="{x:Static p:Resources.MainWindow_butAddPalette}" Click="butAddPalette_Click" IsEnabled="False"/>
</Grid>
</Grid>
</GroupBox>
Expand Down
Loading

0 comments on commit c5e2f05

Please sign in to comment.