Skip to content

Commit

Permalink
Merge pull request #301 from Leo-Corporation/vNext
Browse files Browse the repository at this point in the history
Version 5.4.0.2308
  • Loading branch information
lpeyr authored Aug 3, 2023
2 parents 4243b71 + 3beb7d9 commit 0d91836
Show file tree
Hide file tree
Showing 18 changed files with 891 additions and 16 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.3.0.2307"
#define MyAppFullVersion "5.3.0.2307"
#define MyAppVersion "5.4.0.2308"
#define MyAppFullVersion "5.4.0.2308"
#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 @@ -56,6 +56,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
Global.TextPage = new();
Global.PalettePage = new();
Global.GradientPage = new();
Global.AiGenPage = new();
Global.HomePage = new();
Global.BookmarksPage = new();
Global.SettingsPage = new();
Expand Down
33 changes: 27 additions & 6 deletions ColorPicker/Classes/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.Collections.Generic;
using System.Threading;
using System.Windows;
using System.Windows.Markup.Localizer;
using System.Windows.Media;

namespace ColorPicker.Classes;
Expand All @@ -43,14 +44,15 @@ public static class Global
public static TextPage? TextPage { get; set; }
public static PalettePage? PalettePage { get; set; }
public static GradientPage? GradientPage { get; set; }
public static AiGenPage? AiGenPage { get; set; }
public static HomePage? HomePage { get; set; }
public static BookmarksPage? BookmarksPage { get; set; }
public static SettingsPage? SettingsPage { get; set; }

public static Bookmarks Bookmarks { get; set; }
public static Settings Settings { get; set; } = XmlSerializerManager.LoadFromXml<Settings>(SettingsPath) ?? new();

public static SynethiaConfig SynethiaConfig { get; set; } = SynethiaManager.Load(SynethiaPath, Default);
public static SynethiaConfig SynethiaConfig { get; set; } = GetSynethiaConfig();

public static SynethiaConfig Default => new()
{
Expand All @@ -61,7 +63,8 @@ public static class Global
new PageInfo("Converter"),
new PageInfo("TextTool"),
new PageInfo("Palette"),
new PageInfo("Gradient")
new PageInfo("Gradient"),
new PageInfo("AIGeneration")
},
ActionsInfo = new List<ActionInfo>()
{
Expand All @@ -70,7 +73,8 @@ public static class Global
new ActionInfo(2, "Converter.FromRgb"),
new ActionInfo(3, "TextTool.Contrast"),
new ActionInfo(4, "Palette.GeneratePalette"),
new ActionInfo(5, "Gradient.GenerateGradient")
new ActionInfo(5, "Gradient.GenerateGradient"),
new ActionInfo(6, "Ai.GenerateColor")
}
};

Expand All @@ -79,7 +83,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.3.0.2307";
public static string Version => "5.4.0.2308";

public static string HiSentence
{
Expand Down Expand Up @@ -119,6 +123,7 @@ public static string HiSentence
{ AppPages.TextTool, "\uF7AB" },
{ AppPages.ColorPalette, "\uF2F6" },
{ AppPages.ColorGradient, "\uFD3F" },
{ AppPages.AIGeneration, "\uF4E5" },
};
public static Dictionary<AppPages, string> AppPagesName => new()
{
Expand All @@ -131,10 +136,11 @@ public static string HiSentence
{ AppPages.TextTool, Properties.Resources.TextTool },
{ AppPages.ColorPalette, Properties.Resources.Palette },
{ AppPages.ColorGradient, Properties.Resources.Gradient },
{ AppPages.AIGeneration, Properties.Resources.AIGeneration },
};

public static string[] ActionsIcons => new string[] { "\uFD48", "\uF2BF", "\uF18B", "\uFD1B", "\uF777", "\uFCBA" };
public static string[] ActionsString => new string[] { Properties.Resources.SelectColor, Properties.Resources.SelectChomaticDisc, Properties.Resources.ConvertFromRGB, Properties.Resources.GetContrast, Properties.Resources.GeneratePalette, Properties.Resources.GenerateGradient };
public static string[] ActionsIcons => new string[] { "\uFD48", "\uF2BF", "\uF18B", "\uFD1B", "\uF777", "\uFCBA", "\uF287" };
public static string[] ActionsString => new string[] { Properties.Resources.SelectColor, Properties.Resources.SelectChomaticDisc, Properties.Resources.ConvertFromRGB, Properties.Resources.GetContrast, Properties.Resources.GeneratePalette, Properties.Resources.GenerateGradient, Properties.Resources.AIGeneration };

public static (int, int, int) GenerateRandomColor()
{
Expand Down Expand Up @@ -232,6 +238,7 @@ public static AppPages PageInfoToAppPages(PageInfo pageInfo)
"TextTool" => AppPages.TextTool,
"Palette" => AppPages.ColorPalette,
"Gradient" => AppPages.ColorGradient,
"AIGeneration" => AppPages.AIGeneration,
_ => AppPages.Selector
};
}
Expand Down Expand Up @@ -299,4 +306,18 @@ public static void ChangeLanguage()
break;
}
}

private static SynethiaConfig GetSynethiaConfig()
{
var config = SynethiaManager.Load(SynethiaPath, Default);

for (int i = 0; i < config.PagesInfo.Count; i++)
{
if (config.PagesInfo[i].Name == "AIGeneration") return config;
}

config.PagesInfo.Add(new("AIGeneration"));
config.ActionsInfo.Add(new(6, "Ai.GenerateColor"));
return config;
}
}
4 changes: 4 additions & 0 deletions ColorPicker/Classes/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public Settings()
TextToolForeground = "#000000";
TextToolBackground = "#FFFFFF";
IsMaximized = false;
ApiKey = "";
Model = "gpt-3.5-turbo";
}

public Themes Theme { get; set; }
Expand All @@ -61,5 +63,7 @@ public Settings()
public string TextToolForeground { get; set; }
public string TextToolBackground { get; set; }
public bool IsMaximized { get; set; }
public string? ApiKey { get; set; }
public string? Model { get; set; }
}
}
7 changes: 4 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.3.0.2307</Version>
<Version>5.4.0.2308</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>logo.png</PackageIcon>
<ApplicationIcon>CPM.ico</ApplicationIcon>
Expand Down Expand Up @@ -47,10 +47,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Betalgo.OpenAI" Version="7.1.3" />
<PackageReference Include="ColorHelper" Version="1.8.1" />
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
<PackageReference Include="PeyrSharp.Env" Version="1.7.0.2307" />
<PackageReference Include="PeyrSharp.Core" Version="1.7.0.2307" />
<PackageReference Include="PeyrSharp.Env" Version="1.8.0.2308" />
<PackageReference Include="PeyrSharp.Core" Version="1.8.0.2308" />
<PackageReference Include="Synethia" Version="1.1.1.2302" />
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions ColorPicker/Enums/AppPages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ public enum AppPages
TextTool,
ColorPalette,
ColorGradient,
AIGeneration
}
13 changes: 9 additions & 4 deletions ColorPicker/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,15 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="1" FontSize="14" Content="&#xF602;" FontFamily="/Fonts/#FluentSystemIcons-Regular" x:Name="PinBtn" Click="PinBtn_Click" RenderOptions.EdgeMode="Aliased" Style="{StaticResource TitleBarButtonStyle}" Background="Transparent" Width="46" Height="32" Foreground="{Binding Source={StaticResource Foreground1}}"/>
<Button Grid.Column="2" FontSize="14" Content="&#xFC75;" FontFamily="/Fonts/#FluentSystemIcons-Regular" x:Name="MinimizeBtn" Click="MinimizeBtn_Click" RenderOptions.EdgeMode="Aliased" Style="{StaticResource TitleBarButtonStyle}" Background="Transparent" Width="46" Height="32" Foreground="{Binding Source={StaticResource Foreground1}}"/>
<Button Grid.Column="3" FontSize="14" Content="&#xFA40;" FontFamily="/Fonts/#FluentSystemIcons-Regular" x:Name="MaximizeRestoreBtn" Click="MaximizeRestoreBtn_Click" RenderOptions.EdgeMode="Aliased" Style="{StaticResource TitleBarButtonStyle}" Background="Transparent" Width="46" Height="32" Foreground="{Binding Source={StaticResource Foreground1}}"/>
<Button Grid.Column="4" FontSize="14" Content="&#xF36B;" FontFamily="/Fonts/#FluentSystemIcons-Regular" x:Name="CloseBtn" Click="CloseBtn_Click" RenderOptions.EdgeMode="Aliased" Style="{StaticResource TitleBarCloseButtonStyle}" Background="Transparent" Width="46" Height="32" Foreground="{Binding Source={StaticResource Foreground1}}"/>
<Border Grid.Column="1" Padding="5 2" Background="{Binding Source={StaticResource CardBackground}}" CornerRadius="10" VerticalAlignment="Center">
<TextBlock x:Name="VersionTxt" d:Text="5.4.0.2308" FontSize="10" FontWeight="SemiBold" Foreground="{Binding Source={StaticResource DarkGray}}"/>
</Border>
<Button Grid.Column="2" FontSize="14" Content="&#xF602;" FontFamily="/Fonts/#FluentSystemIcons-Regular" x:Name="PinBtn" Click="PinBtn_Click" RenderOptions.EdgeMode="Aliased" Style="{StaticResource TitleBarButtonStyle}" Background="Transparent" Width="46" Height="32" Foreground="{Binding Source={StaticResource Foreground1}}"/>
<Button Grid.Column="3" FontSize="14" Content="&#xFC75;" FontFamily="/Fonts/#FluentSystemIcons-Regular" x:Name="MinimizeBtn" Click="MinimizeBtn_Click" RenderOptions.EdgeMode="Aliased" Style="{StaticResource TitleBarButtonStyle}" Background="Transparent" Width="46" Height="32" Foreground="{Binding Source={StaticResource Foreground1}}"/>
<Button Grid.Column="4" FontSize="14" Content="&#xFA40;" FontFamily="/Fonts/#FluentSystemIcons-Regular" x:Name="MaximizeRestoreBtn" Click="MaximizeRestoreBtn_Click" RenderOptions.EdgeMode="Aliased" Style="{StaticResource TitleBarButtonStyle}" Background="Transparent" Width="46" Height="32" Foreground="{Binding Source={StaticResource Foreground1}}"/>
<Button Grid.Column="5" FontSize="14" Content="&#xF36B;" FontFamily="/Fonts/#FluentSystemIcons-Regular" x:Name="CloseBtn" Click="CloseBtn_Click" RenderOptions.EdgeMode="Aliased" Style="{StaticResource TitleBarCloseButtonStyle}" Background="Transparent" Width="46" Height="32" Foreground="{Binding Source={StaticResource Foreground1}}"/>
</Grid>
</Border>
<Border Grid.Row="1" Style="{StaticResource WindowMainPanelStyle}">
Expand Down Expand Up @@ -330,6 +334,7 @@
<StackPanel x:Name="CreationPanel" Visibility="Collapsed">
<Button x:Name="PalettePageBtn" Content="{x:Static lang:Resources.Palette}" FontSize="10" FontWeight="ExtraBold" BorderThickness="0" Style="{DynamicResource DefaultButton}" Padding="5,2,2,2" Background="Transparent" HorizontalContentAlignment="Left" Foreground="{Binding Source={StaticResource AccentColor}}" Margin="10,0,0,0" Click="PalettePageBtn_Click"/>
<Button x:Name="GradientPageBtn" Content="{x:Static lang:Resources.Gradient}" FontSize="10" FontWeight="ExtraBold" BorderThickness="0" Style="{DynamicResource DefaultButton}" Padding="5,2,2,2" Background="Transparent" HorizontalContentAlignment="Left" Foreground="{Binding Source={StaticResource AccentColor}}" Margin="10,0,0,0" Click="GradientPageBtn_Click"/>
<Button x:Name="AiCreationPageBtn" Content="{x:Static lang:Resources.AIGeneration}" FontSize="10" FontWeight="ExtraBold" BorderThickness="0" Style="{DynamicResource DefaultButton}" Padding="5,2,2,2" Background="Transparent" HorizontalContentAlignment="Left" Foreground="{Binding Source={StaticResource AccentColor}}" Margin="10,0,0,0" Click="AiCreationPageBtn_Click"/>
</StackPanel>
</StackPanel>
</ScrollViewer>
Expand Down
30 changes: 30 additions & 0 deletions ColorPicker/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public MainWindow()

private void InitUI()
{
VersionTxt.Text = Global.Version;

StateChanged += (o, e) => HandleWindowStateChanged();
Loaded += (o, e) => HandleWindowStateChanged();
LocationChanged += (o, e) => HandleWindowStateChanged();
Expand Down Expand Up @@ -125,6 +127,10 @@ private void InitUI()
Global.SynethiaConfig.PagesInfo[5].EnterUnixTime = Sys.UnixTime;
CheckButton(GradientPageBtn);
break;
case AppPages.AIGeneration:
Global.SynethiaConfig.PagesInfo[6].EnterUnixTime = Sys.UnixTime;
CheckButton(AiCreationPageBtn);
break;
default:
break;
}
Expand All @@ -138,6 +144,7 @@ private void InitUI()
AppPages.TextTool => Global.TextPage,
AppPages.ColorPalette => Global.PalettePage,
AppPages.ColorGradient => Global.GradientPage,
AppPages.AIGeneration => Global.AiGenPage,
_ => Global.HomePage
});
}
Expand Down Expand Up @@ -188,6 +195,13 @@ private void PageCard_OnCardClick(object? sender, PageEventArgs e)
PageDisplayer.Navigate(Global.GradientPage);
Global.SynethiaConfig.PagesInfo[5].EnterUnixTime = Sys.UnixTime;
break;
case AppPages.AIGeneration:
UnCheckAllButton();
CheckButton(AiCreationPageBtn);

PageDisplayer.Navigate(Global.AiGenPage);
Global.SynethiaConfig.PagesInfo[6].EnterUnixTime = Sys.UnixTime;
break;
default:
break;
}
Expand Down Expand Up @@ -352,13 +366,15 @@ private void UnCheckAllButton()
TextPageBtn.Background = new SolidColorBrush(Colors.Transparent);
PalettePageBtn.Background = new SolidColorBrush(Colors.Transparent);
GradientPageBtn.Background = new SolidColorBrush(Colors.Transparent);
AiCreationPageBtn.Background = new SolidColorBrush(Colors.Transparent);

SelectorPageBtn.Foreground = new SolidColorBrush(Global.GetColorFromResource("AccentColor"));
ChromaticPageBtn.Foreground = new SolidColorBrush(Global.GetColorFromResource("AccentColor"));
ConverterPageBtn.Foreground = new SolidColorBrush(Global.GetColorFromResource("AccentColor"));
TextPageBtn.Foreground = new SolidColorBrush(Global.GetColorFromResource("AccentColor"));
PalettePageBtn.Foreground = new SolidColorBrush(Global.GetColorFromResource("AccentColor"));
GradientPageBtn.Foreground = new SolidColorBrush(Global.GetColorFromResource("AccentColor"));
AiCreationPageBtn.Foreground = new SolidColorBrush(Global.GetColorFromResource("AccentColor"));
}

private void ColorToolsBtn_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -458,8 +474,22 @@ private void LeavePage()
Global.SynethiaConfig.PagesInfo[5].LeaveUnixTime = Sys.UnixTime;
Global.SynethiaConfig.PagesInfo[5].TotalTimeSpent += Global.SynethiaConfig.PagesInfo[5].LeaveUnixTime - Global.SynethiaConfig.PagesInfo[5].EnterUnixTime;
break;
case AiGenPage:
Global.SynethiaConfig.PagesInfo[6].LeaveUnixTime = Sys.UnixTime;
Global.SynethiaConfig.PagesInfo[6].TotalTimeSpent += Global.SynethiaConfig.PagesInfo[6].LeaveUnixTime - Global.SynethiaConfig.PagesInfo[6].EnterUnixTime;
break;
default:
break;
}
}

private void AiCreationPageBtn_Click(object sender, RoutedEventArgs e)
{
LeavePage();
UnCheckAllButton();
CheckButton(AiCreationPageBtn);

PageDisplayer.Navigate(Global.AiGenPage);
Global.SynethiaConfig.PagesInfo[6].EnterUnixTime = Sys.UnixTime;
}
}
Loading

0 comments on commit 0d91836

Please sign in to comment.