-
Notifications
You must be signed in to change notification settings - Fork 0
/
SelectColorDlg.xaml
125 lines (113 loc) · 7.43 KB
/
SelectColorDlg.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<Window x:Class="WPFColorLib.SelectColorDlg" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPFColorLib"
Title="Select Color" Width="440" Height="500" FontFamily="Verdana" FontSize="14">
<Window.Resources>
<Style x:Key="ColorProp" TargetType="{x:Type FrameworkElement}">
<Setter Property="Margin" Value="2, 5" />
</Style>
<Style x:Key="TextIcon" TargetType="TextBlock">
<Setter Property="FontSize" Value="24"/>
<Setter Property="Padding" Value="5, 0"/>
<Setter Property="FontFamily" Value="Font Awesome 5 Free Regular"/>
<Setter Property="TextOptions.TextFormattingMode" Value="Ideal"/>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.2" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="AwesomeBtn" TargetType="Button">
<Setter Property="Padding" Value="5, 3" />
<Setter Property="Margin" Value="2, 5" />
<Setter Property="FontFamily" Value="Font Awesome 5 Free Regular"/>
<Setter Property="TextOptions.TextFormattingMode" Value="Ideal"/>
</Style>
</Window.Resources>
<DockPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="5" DockPanel.Dock="Bottom">
<Button Padding="15,2" Margin="5, 0" IsDefault="True" IsEnabled="False" Name="btnOK" Click="btnOK_Click">
<StackPanel Orientation="Horizontal">
<TextBlock Foreground="LimeGreen" Style="{StaticResource TextIcon}"></TextBlock>
<TextBlock VerticalAlignment="Center" Padding="5, 0">OK</TextBlock>
</StackPanel>
</Button>
<Button Padding="10,2" Margin="5, 0" IsCancel="True">
<StackPanel Orientation="Horizontal">
<TextBlock Foreground="Tomato" Style="{StaticResource TextIcon}"></TextBlock>
<TextBlock VerticalAlignment="Center" Padding="5, 0">Cancel</TextBlock>
</StackPanel>
</Button>
</StackPanel>
<StackPanel DockPanel.Dock="Top" Margin="10">
<local:HSLColorSelector x:Name="hslColorSel" Margin="5" />
<Grid Margin="0, 5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<GroupBox Grid.Column="0" Header="New color">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height = "Auto" />
<RowDefinition Height = "Auto" />
<RowDefinition Height = "Auto" />
</Grid.RowDefinitions>
<Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Name="bordNewClr" Style="{StaticResource ColorProp}" BorderBrush="Black" BorderThickness="1" CornerRadius="3" />
<Button Grid.Row="0" Grid.Column="2" Click="AddFavorites_NewClr_Click" Style="{StaticResource AwesomeBtn}" ToolTip="Add to favorite"></Button>
<!-- RRGGBB -->
<Button Grid.Row="1" Grid.Column="0" Click="PasteNewClrHEX_Click" Style="{StaticResource AwesomeBtn}" ToolTip="Paste RRGGBB"></Button>
<TextBox Grid.Row="1" Grid.Column="1" Name="txtNewClrHEX" PreviewKeyDown="txtNewClrHEX_KeyDown" Style="{StaticResource ColorProp}" />
<Button Grid.Row="1" Grid.Column="2" Click="CopyNewClrHEX_Click" Style="{StaticResource AwesomeBtn}" ToolTip="Copy RRGGBB"></Button>
<!-- d,d,d -->
<Button Grid.Row="2" Grid.Column="0" Click="PasteNewClrDEC_Click" Style="{StaticResource AwesomeBtn}" ToolTip="Paste D,D,D"></Button>
<TextBox Grid.Row="2" Grid.Column="1" Name="txtNewClrDEC" PreviewKeyDown="txtNewClrDEC_KeyDown" Style="{StaticResource ColorProp}" />
<Button Grid.Row="2" Grid.Column="2" Click="CopyNewClrDEC_Click" Style="{StaticResource AwesomeBtn}" ToolTip="Copy D,D,D"></Button>
</Grid>
</GroupBox>
<GroupBox Grid.Column="1" Header="Old color">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height = "Auto" />
<RowDefinition Height = "Auto" />
<RowDefinition Height = "Auto" />
</Grid.RowDefinitions>
<Border Grid.Row="0" Grid.Column="0" Name="bordOldClr" Style="{StaticResource ColorProp}" BorderBrush="Black" BorderThickness="1" CornerRadius="3" />
<Button Grid.Row="0" Grid.Column="1" Click="AddFavorites_OldClr_Click" Style="{StaticResource AwesomeBtn}" ToolTip="Add to favorite"></Button>
<TextBlock Grid.Row="1" Grid.Column="0" Name="txtOldClrHEX" Style="{StaticResource ColorProp}" />
<!-- RRGGBB -->
<Button Grid.Row="1" Grid.Column="1" Click="CopyOldClrHEX_Click" Style="{StaticResource AwesomeBtn}" ToolTip="Copy RRGGBB"></Button>
<TextBlock Grid.Row="2" Grid.Column="0" Name="txtOldClrDEC" Style="{StaticResource ColorProp}" />
<!-- d,d,d -->
<Button Grid.Row="2" Grid.Column="1" Click="CopyOldClrDEC_Click" Style="{StaticResource AwesomeBtn}" ToolTip="Copy D,D,D"></Button>
</Grid>
</GroupBox>
</Grid>
<GroupBox Header="Luminosity palette">
<WrapPanel Name="pnlLumPalette" />
</GroupBox>
</StackPanel>
<GroupBox Header="Favorite colors" Margin="10, 0">
<WrapPanel Name="pnlFavColors" Background="White" PreviewMouseRightButtonUp="pnlFavColors_RMouUp"
ToolTip="Left mouse button - select color, Right mouse button - delete fav.color"/>
<GroupBox.ContextMenu>
<ContextMenu>
<MenuItem Header="Generate colors" IsHitTestVisible="False"/>
<Separator/>
<MenuItem Header="Apple 16" Click="GenerateAppleColors_Click" />
<MenuItem Header="Standard 6 level" Click="GenerateStdColors_Click" />
<Separator/>
<MenuItem Header="Clear all" Click="ClearFav_Click" />
</ContextMenu>
</GroupBox.ContextMenu>
</GroupBox>
</DockPanel>
</Window>