Skip to content

Commit

Permalink
Merge pull request #278 from Leo-Corporation/vNext
Browse files Browse the repository at this point in the history
Version 5.2.0.2305
  • Loading branch information
lpeyr authored May 28, 2023
2 parents c244acd + 6fb2333 commit d619c79
Show file tree
Hide file tree
Showing 28 changed files with 493 additions and 32 deletions.
4 changes: 2 additions & 2 deletions ColorPicker.Setup/Setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "ColorPicker Max"
#define MyAppVersion "5.1.1.2304"
#define MyAppFullVersion "5.1.1.2304"
#define MyAppVersion "5.2.0.2305"
#define MyAppFullVersion "5.2.0.2305"
#define MyAppPublisher "Léo Corporation"
#define MyAppURL "https://leocorporation.dev/"
#define MyAppExeName "ColorPicker.exe"
Expand Down
1 change: 1 addition & 0 deletions ColorPicker/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
if (Global.Bookmarks.ColorBookmarks is null) Global.Bookmarks.ColorBookmarks = new();
if (Global.Bookmarks.PaletteBookmarks is null) Global.Bookmarks.PaletteBookmarks = new();
if (Global.Bookmarks.GradientBookmarks is null) Global.Bookmarks.GradientBookmarks = new();
if (Global.Bookmarks.TextBookmarks is null) Global.Bookmarks.TextBookmarks = new();

// Pages
Global.SelectorPage = new();
Expand Down
34 changes: 34 additions & 0 deletions ColorPicker/Classes/Bookmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
using PeyrSharp.Core.Converters;
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
Expand All @@ -32,6 +33,39 @@ public class Bookmarks
public List<string> ColorBookmarks { get; set; }
public List<string> PaletteBookmarks { get; set; }
public List<Gradient> GradientBookmarks { get; set; }
public List<BookmarkText> TextBookmarks { get; set; }
}

public class BookmarkText : IEquatable<BookmarkText>
{
public string FontFamily { get; init; }
public string ForegroundColor { get; init; }
public string BackgroundColor { get; init; }
public BookmarkText()
{
FontFamily = "Arial"; // Fallback values
ForegroundColor = "#000000";
BackgroundColor = "#FFFFFF";
}

public BookmarkText(string font, string fore, string back)
{
FontFamily = font;
ForegroundColor = fore;
BackgroundColor = back;
}

public bool Equals(BookmarkText? obj)
{
if (obj == null || GetType() != obj.GetType())
{
return false;
}
return FontFamily == obj.FontFamily && ForegroundColor == obj.ForegroundColor && BackgroundColor == obj.BackgroundColor;
}


public override bool Equals(object obj) => Equals(obj as BookmarkText);
}

[XmlType("BookmarkGradientStop")]
Expand Down
2 changes: 1 addition & 1 deletion ColorPicker/Classes/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static class Global
internal static string SettingsPath => $@"{FileSys.AppDataPath}\Léo Corporation\ColorPicker Max\Settings.xml";
public static string LastVersionLink => "https://raw.githubusercontent.com/Leo-Corporation/LeoCorp-Docs/master/Liens/Update%20System/ColorPicker/5.0/Version.txt";

public static string Version => "5.1.1.2304";
public static string Version => "5.2.0.2305";

public static string HiSentence
{
Expand Down
6 changes: 3 additions & 3 deletions ColorPicker/ColorPicker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Title>ColorPicker</Title>
<Description>Maximize your creativity.</Description>
<RepositoryUrl>https://github.com/Leo-Corporation/ColorPicker</RepositoryUrl>
<Version>5.1.1.2304</Version>
<Version>5.2.0.2305</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>logo.png</PackageIcon>
<ApplicationIcon>CPM.ico</ApplicationIcon>
Expand Down Expand Up @@ -49,8 +49,8 @@
<ItemGroup>
<PackageReference Include="ColorHelper" Version="1.8.1" />
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
<PackageReference Include="PeyrSharp.Core" Version="1.5.0.2304" />
<PackageReference Include="PeyrSharp.Env" Version="1.5.0.2304" />
<PackageReference Include="PeyrSharp.Env" Version="1.6.0.2305" />
<PackageReference Include="PeyrSharp.Core" Version="1.6.0.2305" />
<PackageReference Include="Synethia" Version="1.1.1.2302" />
</ItemGroup>

Expand Down
4 changes: 4 additions & 0 deletions ColorPicker/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ private void InitUI()
ColorItem.GoClick += PageCard_OnCardClick;
PaletteItem.GoClick += PageCard_OnCardClick;
GradientItem.GoClick += PageCard_OnCardClick;
ChromaticWheelPage.GoClick += PageCard_OnCardClick;
SelectorPage.GoClick += PageCard_OnCardClick;
ConverterPage.GoClick += PageCard_OnCardClick;
TextItem.GoClick += PageCard_OnCardClick;

HelloTxt.Text = Global.HiSentence; // Show greeting message to the user

Expand Down
13 changes: 12 additions & 1 deletion ColorPicker/Pages/BookmarksPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@
<TextBlock Text="{x:Static lang:Resources.Gradients}" FontWeight="ExtraBold" FontSize="11" VerticalAlignment="Center" Grid.Column="1" Margin="5 0" HorizontalAlignment="Left" />
</Grid>
</Button>
<Button x:Name="TextBtn" Click="TextBtn_Click" Margin="10,2,0,2" Foreground="{Binding Source={StaticResource AccentColor}}" Style="{DynamicResource DefaultButton}" Background="Transparent" BorderThickness="0" Padding="5" HorizontalContentAlignment="Stretch">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xF793;" FontSize="14" FontFamily="/Fonts/#FluentSystemIcons-Regular" VerticalAlignment="Center"/>
<TextBlock Text="{x:Static lang:Resources.TextTool}" FontWeight="ExtraBold" FontSize="11" VerticalAlignment="Center" Grid.Column="1" Margin="5 0" HorizontalAlignment="Left" />
</Grid>
</Button>
</StackPanel>
<Button x:Name="EmptyHistoryBtn" Click="EmptyHistoryBtn_Click" Margin="10,2,0,2" Foreground="{Binding Source={StaticResource Red}}" Style="{DynamicResource StandardButton}" Background="Transparent" BorderThickness="0" Padding="5" HorizontalContentAlignment="Stretch" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center">
<Grid>
Expand All @@ -69,8 +79,9 @@
</Button>
<Grid x:Name="HistoryGrid" Grid.Row="2" Margin="10" Grid.ColumnSpan="3">
<WrapPanel x:Name="ColorsBookmarks" Orientation="Horizontal"/>
<WrapPanel x:Name="PalettesBookmarks" Visibility="Collapsed"/>
<WrapPanel x:Name="PalettesBookmarks" Visibility="Collapsed"/>
<WrapPanel x:Name="GradientsBookmarks" Visibility="Collapsed"/>
<WrapPanel x:Name="TextBookmarks" Visibility="Collapsed"/>
</Grid>
</Grid>
</Page>
21 changes: 21 additions & 0 deletions ColorPicker/Pages/BookmarksPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ private void InitUI()
ColorsBookmarks.Children.Clear();
PalettesBookmarks.Children.Clear();
GradientsBookmarks.Children.Clear();
TextBookmarks.Children.Clear();

// Load the "Colors" bookmarks
for (int i = 0; i < Global.Bookmarks.ColorBookmarks.Count; i++)
Expand All @@ -65,6 +66,12 @@ private void InitUI()
{
GradientsBookmarks.Children.Add(new GradientItem(Global.Bookmarks.GradientBookmarks[i]));
}

// Load the "Text" bookmarks
for (int i = 0; i < Global.Bookmarks.TextBookmarks.Count; i++)
{
TextBookmarks.Children.Add(new TextItem(Global.Bookmarks.TextBookmarks[i]));
}
}

private void ColorsBtn_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -96,6 +103,10 @@ private void EmptyHistoryBtn_Click(object sender, RoutedEventArgs e)
{
Global.Bookmarks.PaletteBookmarks.Clear(); // Empty history
}
else if (TextBookmarks.Visibility == Visibility.Visible)
{
Global.Bookmarks.TextBookmarks.Clear(); // Empty history
}
else
{
Global.Bookmarks.GradientBookmarks.Clear(); // Empty history
Expand All @@ -105,6 +116,7 @@ private void EmptyHistoryBtn_Click(object sender, RoutedEventArgs e)
Global.SelectorPage.LoadDetails();
Global.GradientPage.LoadGradientUI();
Global.PalettePage.InitPaletteUI();
Global.TextPage.InitUI();
}

private void GradientsBtn_Click(object sender, RoutedEventArgs e)
Expand All @@ -119,12 +131,21 @@ private void UnCheckAllButtons()
ColorsBtn.Background = new SolidColorBrush { Color = Colors.Transparent };
PaletteBtn.Background = new SolidColorBrush { Color = Colors.Transparent };
GradientsBtn.Background = new SolidColorBrush { Color = Colors.Transparent };
TextBtn.Background = new SolidColorBrush { Color = Colors.Transparent };

ColorsBookmarks.Visibility = Visibility.Collapsed;
PalettesBookmarks.Visibility = Visibility.Collapsed;
GradientsBookmarks.Visibility = Visibility.Collapsed;
TextBookmarks.Visibility = Visibility.Collapsed;
}

private void CheckButton(Button button) => button.Background = new SolidColorBrush { Color = Global.GetColorFromResource("LightAccentColor") };

private void TextBtn_Click(object sender, RoutedEventArgs e)
{
UnCheckAllButtons();
CheckButton(TextBtn);
TextBookmarks.Visibility = Visibility.Visible;
}
}
}
2 changes: 1 addition & 1 deletion ColorPicker/Pages/ChromaticWheelPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
</StackPanel>
<Image x:Name="WheelImg" Cursor="Cross" MouseLeftButtonUp="WheelImg_MouseLeftButtonUp" Grid.Column="0" Source="..\Images\ColorWheel.png" Width="350" VerticalAlignment="Center" Grid.Row="2" Grid.ColumnSpan="2"/>

<Border x:Name="PreviewBorder" Visibility="Hidden" Grid.Row="2" Grid.Column="1" Background="{Binding Source={StaticResource CardBackground}}" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="5" CornerRadius="50 0 0 50">
<Border x:Name="PreviewBorder" Visibility="Hidden" Grid.Row="2" Grid.Column="1" Background="{Binding Source={StaticResource CardBackground}}" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="5" CornerRadius="50 0 0 50" Cursor="Hand" MouseLeftButtonUp="PreviewBorder_MouseLeftButtonUp">
<Border.Effect>
<DropShadowEffect Color="{Binding Source={StaticResource AccentColor}}" BlurRadius="15" Opacity="0.2" ShadowDepth="0"/>
</Border.Effect>
Expand Down
8 changes: 8 additions & 0 deletions ColorPicker/Pages/ChromaticWheelPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
using ColorPicker.Classes;
using ColorPicker.Enums;
using Synethia;
using System;
using System.Windows;
Expand Down Expand Up @@ -165,4 +166,11 @@ private void CopyRgbBtn_Click(object sender, RoutedEventArgs e)
{
Clipboard.SetText(RgbTxt.Text);
}
public static event EventHandler<PageEventArgs> GoClick;

private void PreviewBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
Global.PalettePage.InitFromColor(ColorInfo);
GoClick?.Invoke(this, new(AppPages.ColorPalette));
}
}
7 changes: 5 additions & 2 deletions ColorPicker/Pages/ConverterPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,12 @@
<TextBlock x:Name="ColorValidIconTxt" FontFamily="..\Fonts\#FluentSystemIcons-Filled" VerticalAlignment="Center" FontSize="14"/>
<TextBlock x:Name="ColorValidTxt" d:Text="Placeholder" FontWeight="ExtraBold" Margin="10,0,0,0" VerticalAlignment="Center"/>
</StackPanel>
<Button x:Name="BookmarkBtn" Click="BookmarkBtn_Click" Grid.Column="3" Content="&#xF1F6;" Padding="5" Style="{DynamicResource DefaultButton}" VerticalAlignment="Top" FontFamily="..\Fonts\#FluentSystemIcons-Regular" Foreground="{Binding Source={StaticResource Foreground1}}" Background="{Binding Source={StaticResource Background3}}"/>
<StackPanel Orientation="Horizontal" Grid.Column="3">
<Button Foreground="{Binding Source={StaticResource Foreground1}}" Background="{Binding Source={StaticResource Background3}}" x:Name="PaletteBtn" Click="PaletteBtn_Click" Grid.Column="2" Content="&#xF2F6;" Padding="5" Style="{DynamicResource DefaultButton}" VerticalAlignment="Top" FontFamily="..\Fonts\#FluentSystemIcons-Regular"/>
<Button x:Name="BookmarkBtn" Click="BookmarkBtn_Click" Grid.Column="3" Content="&#xF1F6;" Padding="5" Style="{DynamicResource DefaultButton}" VerticalAlignment="Top" FontFamily="..\Fonts\#FluentSystemIcons-Regular" Foreground="{Binding Source={StaticResource Foreground1}}" Background="{Binding Source={StaticResource Background3}}"/>
</StackPanel>

</Grid>
</Grid>
</Border>
<StackPanel Margin="10" Orientation="Horizontal" Grid.Row="2">
<TextBlock Text="&#xF4A4;" FontSize="16" FontFamily="../Fonts/#FluentSystemIcons-Regular" Foreground="{Binding Source={StaticResource AccentColor}}" VerticalAlignment="Center"/>
Expand Down
8 changes: 8 additions & 0 deletions ColorPicker/Pages/ConverterPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using ColorPicker.Classes;
using ColorPicker.Enums;
using Synethia;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
Expand Down Expand Up @@ -390,4 +391,11 @@ private void BookmarkBtn_Click(object sender, RoutedEventArgs e)
Global.Bookmarks.ColorBookmarks.Add(HexTxt.Text); // Add to color bookmarks
BookmarkBtn.Content = "\uF1F8";
}
public static event EventHandler<PageEventArgs> GoClick;

private void PaletteBtn_Click(object sender, RoutedEventArgs e)
{
Global.PalettePage.InitFromColor(ColorInfo);
GoClick?.Invoke(this, new(AppPages.ColorPalette));
}
}
15 changes: 9 additions & 6 deletions ColorPicker/Pages/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@

</WrapPanel>

<StackPanel Margin="10" Orientation="Horizontal" Grid.Row="3">
<TextBlock Text="&#xF4DB;" FontSize="16" FontFamily="../Fonts/#FluentSystemIcons-Regular" Foreground="{Binding Source={StaticResource AccentColor}}" VerticalAlignment="Center"/>
<TextBlock Text="{x:Static lang:Resources.SuggestedActions}" FontSize="14" VerticalAlignment="Center" FontWeight="ExtraBold" Margin="5,0,0,0"/>
</StackPanel>

<WrapPanel Grid.Row="4" x:Name="SuggestedActionsPanel" Orientation="Horizontal">
<StackPanel Grid.Row="3">
<StackPanel Margin="10,10,10,5" Orientation="Horizontal" Grid.Row="3">
<TextBlock Text="&#xF4DB;" FontSize="16" FontFamily="../Fonts/#FluentSystemIcons-Regular" Foreground="{Binding Source={StaticResource AccentColor}}" VerticalAlignment="Center"/>
<TextBlock Text="{x:Static lang:Resources.SuggestedActions}" FontSize="14" VerticalAlignment="Center" FontWeight="ExtraBold" Margin="5,0,0,0"/>
</StackPanel>
<TextBlock x:Name="KeyboardHintTxt" d:Text="Press Shift+S to start/stop selection" Margin="10,0,10,10"/>
</StackPanel>

<WrapPanel Grid.Row="4" x:Name="SuggestedActionsPanel" Orientation="Horizontal">

</WrapPanel>

Expand Down
6 changes: 6 additions & 0 deletions ColorPicker/Pages/HomePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,11 @@ internal void InitUI()
{
SuggestedActionsPanel.Children.Add(new ActionCard(Global.SynethiaConfig.MostRelevantActions[i].Id));
}

// Keyboard hints
KeyboardHintTxt.Text = string.Format(Properties.Resources.KeyboardSelectionHint, Global.Settings.SelectKeyboardShortcut.Replace("LControlKey", "Ctrl")
.Replace("LShiftKey", "Shift")
.Replace("RShiftKey", "Shift")
.Replace("RControlKey", "Ctrl"));
}
}
7 changes: 7 additions & 0 deletions ColorPicker/Pages/PalettePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,11 @@ internal void ColorBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs
catch { }
RgbBtn_Click(SelectedColorBtn, null);
}

internal void InitFromColor(ColorInfo color)
{
ColorInfo = color;
Global.SynethiaConfig.ActionsInfo[4].UsageCount++; // Increment the usage counter
RgbBtn_Click(SelectedColorBtn, null);
}
}
6 changes: 6 additions & 0 deletions ColorPicker/Pages/SelectorPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@

<StackPanel Grid.Column="2" Orientation="Horizontal">
<Button Foreground="{Binding Source={StaticResource Foreground1}}" Background="{Binding Source={StaticResource Background3}}" x:Name="SelectBtn" Click="SelectBtn_Click" Grid.Column="2" Margin="10 0 0 0" Content="&#xFD3F;" Padding="5" Style="{DynamicResource DefaultButton}" VerticalAlignment="Top" FontFamily="..\Fonts\#FluentSystemIcons-Regular"/>
<Button Foreground="{Binding Source={StaticResource Foreground1}}" Background="{Binding Source={StaticResource Background3}}" x:Name="PaletteBtn" Click="PaletteBtn_Click" Grid.Column="2" Content="&#xF2F6;" Padding="5" Style="{DynamicResource DefaultButton}" VerticalAlignment="Top" FontFamily="..\Fonts\#FluentSystemIcons-Regular"/>
<Button Foreground="{Binding Source={StaticResource Foreground1}}" Background="{Binding Source={StaticResource Background3}}" x:Name="BookmarkBtn" Click="BookmarkBtn_Click" Grid.Column="2" Content="&#xF1F6;" Padding="5" Style="{DynamicResource DefaultButton}" VerticalAlignment="Top" FontFamily="..\Fonts\#FluentSystemIcons-Regular"/>
<ComboBox x:Name="ColorTypeComboBox" SelectionChanged="ColorTypeComboBox_SelectionChanged" BorderThickness="2" Padding="5" Style="{DynamicResource ComboBoxStyle1}" Background="Transparent" BorderBrush="{Binding Source={StaticResource AccentColor}}" Foreground="{Binding Source={StaticResource Foreground1}}" HorizontalAlignment="Left" Margin="1" Height="22" VerticalAlignment="Top" FontSize="10">
<ComboBoxItem Content="{x:Static lang:Resources.RGB}"/>
<ComboBoxItem Content="{x:Static lang:Resources.HSV}"/>
<ComboBoxItem Content="{x:Static lang:Resources.HSL}"/>
</ComboBox>
</StackPanel>
</Grid>
</Border>
Expand Down
Loading

0 comments on commit d619c79

Please sign in to comment.