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

Commit

Permalink
окно выбора цвета теперь имеет более человеческий вид
Browse files Browse the repository at this point in the history
  • Loading branch information
veselv2010 committed Jul 20, 2019
1 parent ad3d303 commit db9bcd4
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 37 deletions.
18 changes: 11 additions & 7 deletions SkinEditor/ColourPicker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SkinEditor"
mc:Ignorable="d"
Title="ColourPicker" Height="263" Width="329" Closing="Window_Closing">
Title="ColourPicker" Height="233" Width="289.5" Closing="Window_Closing" ResizeMode="NoResize">
<Grid>
<Rectangle x:Name="RectangleColour" Fill="#FFF4F4F5" Height="160" Margin="138,6,0,0" Stroke="Black" VerticalAlignment="Top" HorizontalAlignment="Left" Width="160"/>
<TextBox x:Name="TextBoxColourR" Height="23" Margin="12,14,0,0" TextWrapping="Wrap" VerticalAlignment="Top" TextChanged="TextBoxColour_TextChanged" HorizontalAlignment="Left" Width="120" PreviewTextInput="TextBox_NumberInput"/>
<TextBox x:Name="TextBoxColourG" Height="23" Margin="12,42,0,0" TextWrapping="Wrap" VerticalAlignment="Top" TextChanged="TextBoxColour_TextChanged" HorizontalAlignment="Left" Width="120"/>
<TextBox x:Name="TextBoxColourB" Height="23" Margin="12,70,0,0" TextWrapping="Wrap" VerticalAlignment="Top" TextChanged="TextBoxColour_TextChanged" HorizontalAlignment="Left" Width="120"/>
<TextBox x:Name="TextBoxColourHEX" Height="23" Margin="12,115,0,0" TextWrapping="Wrap" VerticalAlignment="Top" TextChanged="TextBoxColour_TextChanged" HorizontalAlignment="Left" Width="120"/>
<Button x:Name="button" Content="Button" Margin="112,199,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="74" Click="Button_Click"/>
<Rectangle x:Name="RectangleColour" Fill="#FFF4F4F5" Height="128" Margin="121,10,0,0" Stroke="Black" VerticalAlignment="Top" HorizontalAlignment="Left" Width="143"/>
<TextBox x:Name="TextBoxColourR" Height="23" Margin="54,14,0,0" TextWrapping="Wrap" VerticalAlignment="Top" TextChanged="TextBoxColour_TextChanged" HorizontalAlignment="Left" Width="62" PreviewTextInput="TextBox_NumberInput"/>
<TextBox x:Name="TextBoxColourG" Height="23" Margin="54,42,0,0" TextWrapping="Wrap" VerticalAlignment="Top" TextChanged="TextBoxColour_TextChanged" HorizontalAlignment="Left" Width="62"/>
<TextBox x:Name="TextBoxColourB" Height="23" Margin="54,70,0,0" TextWrapping="Wrap" VerticalAlignment="Top" TextChanged="TextBoxColour_TextChanged" HorizontalAlignment="Left" Width="62"/>
<TextBox x:Name="TextBoxColourHEX" Height="23" Margin="54,115,0,0" TextWrapping="Wrap" VerticalAlignment="Top" TextChanged="TextBoxColour_TextChanged" HorizontalAlignment="Left" Width="62"/>
<Button x:Name="button" Content="Close" Margin="100,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="74" Click="Button_Click"/>
<Label x:Name="label" Content="R" HorizontalAlignment="Left" Margin="6,11,0,0" VerticalAlignment="Top"/>
<Label x:Name="label_Copy" Content="G" HorizontalAlignment="Left" Margin="5,39,0,0" VerticalAlignment="Top"/>
<Label x:Name="label_Copy1" Content="B" HorizontalAlignment="Left" Margin="6,67,0,0" VerticalAlignment="Top"/>
<Label x:Name="label_Copy2" Content="HEX" HorizontalAlignment="Left" Margin="6,112,0,0" VerticalAlignment="Top"/>

</Grid>
</Window>
32 changes: 16 additions & 16 deletions SkinEditor/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,14 @@
<CheckBox x:Name="SpinnerNoBlink" Content="SpinnerNoBlink" HorizontalAlignment="Left" Margin="180,299,0,0" VerticalAlignment="Top" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter"/>
<Label x:Name="LabelToolTip6" Content="SliderBallFrames" Margin="19,273,868,0" VerticalAlignment="Top"/>
<GroupBox x:Name="GroupBoxGeneral" Header="[General]" HorizontalAlignment="Left" Height="341" Margin="10,10,0,0" VerticalAlignment="Top" Width="332" Panel.ZIndex="-1"/>
<Frame x:Name="Combo1" HorizontalAlignment="Left" Height="30" Margin="415,30,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" RenderTransformOrigin="0.522,0.533" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="Combo1" HorizontalAlignment="Left" Height="30" Margin="415,30,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="Combo2" HorizontalAlignment="Left" Height="30" Margin="415,65,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="Combo3" HorizontalAlignment="Left" Height="30" Margin="415,100,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="Combo4" HorizontalAlignment="Left" Height="30" Margin="415,135,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="Combo5" HorizontalAlignment="Left" Height="30" Margin="415,170,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="Combo6" HorizontalAlignment="Left" Height="30" Margin="415,205,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="Combo7" HorizontalAlignment="Left" Height="30" Margin="415,240,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="Combo8" HorizontalAlignment="Left" Height="30" Margin="415,275,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="Combo3" HorizontalAlignment="Left" Height="30" Margin="415,100,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="Combo4" HorizontalAlignment="Left" Height="30" Margin="415,135,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="Combo5" HorizontalAlignment="Left" Height="30" Margin="415,170,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="Combo6" HorizontalAlignment="Left" Height="30" Margin="415,205,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="Combo7" HorizontalAlignment="Left" Height="30" Margin="415,240,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="Combo8" HorizontalAlignment="Left" Height="30" Margin="415,275,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Label x:Name="LabelToolTip1_Copy" Content="Combo1" HorizontalAlignment="Left" Margin="356,30,0,0" VerticalAlignment="Top"/>
<Label x:Name="LabelToolTip1_Copy1" Content="Combo2" HorizontalAlignment="Left" Margin="355,66,0,0" VerticalAlignment="Top"/>
<Label x:Name="LabelToolTip1_Copy2" Content="Combo3" HorizontalAlignment="Left" Margin="356,103,0,0" VerticalAlignment="Top"/>
Expand All @@ -223,15 +223,15 @@
<Label x:Name="LabelToolTip1_Copy5" Content="Combo6" HorizontalAlignment="Left" Margin="355,209,0,0" VerticalAlignment="Top"/>
<Label x:Name="LabelToolTip1_Copy6" Content="Combo7" HorizontalAlignment="Left" Margin="356,244,0,0" VerticalAlignment="Top"/>
<Label x:Name="LabelToolTip1_Copy7" Content="Combo8" HorizontalAlignment="Left" Margin="356,279,0,0" VerticalAlignment="Top"/>
<Frame x:Name="InputOverlayText" HorizontalAlignment="Left" Height="30" Margin="586,30,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" RenderTransformOrigin="0.522,0.533" ToolTip="everything is ok!"/>
<Frame x:Name="MenuGlow" HorizontalAlignment="Left" Height="30" Margin="586,65,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="SliderBall" HorizontalAlignment="Left" Height="30" Margin="586,100,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="SliderBorder" HorizontalAlignment="Left" Height="30" Margin="586,135,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="SliderTrackOverride" HorizontalAlignment="Left" Height="30" Margin="586,170,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="SongSelectActiveText" HorizontalAlignment="Left" Height="30" Margin="586,205,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="SongSelectInactiveText" HorizontalAlignment="Left" Height="30" Margin="586,240,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="SpinnerBackground" HorizontalAlignment="Left" Height="30" Margin="586,276,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="StarBreakAdditive" HorizontalAlignment="Left" Height="30" Margin="586,310,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!"/>
<Frame x:Name="InputOverlayText" HorizontalAlignment="Left" Height="30" Margin="586,30,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="MenuGlow" HorizontalAlignment="Left" Height="30" Margin="586,65,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="SliderBall" HorizontalAlignment="Left" Height="30" Margin="586,100,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="SliderBorder" HorizontalAlignment="Left" Height="30" Margin="586,135,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="SliderTrackOverride" HorizontalAlignment="Left" Height="30" Margin="586,170,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="SongSelectActiveText" HorizontalAlignment="Left" Height="30" Margin="586,205,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="SongSelectInactiveText" HorizontalAlignment="Left" Height="30" Margin="586,240,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="SpinnerBackground" HorizontalAlignment="Left" Height="30" Margin="586,276,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Frame x:Name="StarBreakAdditive" HorizontalAlignment="Left" Height="30" Margin="586,310,0,0" VerticalAlignment="Top" Width="30" Initialized="TextBoxSkinIni_Initialized" MouseEnter="SkinIniProperty_MouseEnter" BorderThickness="1" BorderBrush="Black" ToolTip="everything is ok!" MouseDown="ColourFrame_MouseDown"/>
<Label x:Name="LabelToolTip1_Copy9" Content="MenuGlow" HorizontalAlignment="Left" Margin="450,66,0,0" VerticalAlignment="Top"/>
<Label x:Name="LabelToolTip1_Copy10" Content="SliderBall" HorizontalAlignment="Left" Margin="450,103,0,0" VerticalAlignment="Top"/>
<Label x:Name="LabelToolTip1_Copy11" Content="SliderBorder" HorizontalAlignment="Left" Margin="450,139,0,0" VerticalAlignment="Top"/>
Expand Down
32 changes: 18 additions & 14 deletions SkinEditor/SkinIniParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace SkinEditor
{
class SkinIniParser
{
public static Brush CurrentColour;
public static bool IsVersionValid;
private static readonly List<string> AllowedVersions = new List<string>{ "1.0", "1", "2.0", "2", "2.1", "2.2", "2.3", "2.4", "2.5", "latest", "User" };
private static string SkinIniPathPrivate;
Expand Down Expand Up @@ -59,8 +58,8 @@ public static string VersionValidator(string versiontext)

public static string[] GetToolTipLines(object sender, string[] ToolTipLines)
{
int i = 0;
int j = 0;
int NeededPropertyIndex = 0;
int ToolTipLineIndex = 0;
string[] ToReturn = new string[20]; //рандомное число

var Sender = sender as FrameworkElement;
Expand All @@ -69,16 +68,16 @@ public static string[] GetToolTipLines(object sender, string[] ToolTipLines)
{
if (elem.Contains(Sender.Name))
{
int IndexOfSenderName = i;
int IndexOfSenderName = NeededPropertyIndex;
break;
}
i++;
NeededPropertyIndex++;
}
while (ToolTipLines[i] != "")
while (ToolTipLines[NeededPropertyIndex] != "")
{
ToReturn[j] = ToolTipLines[i];
i++;
j++;
ToReturn[ToolTipLineIndex] = ToolTipLines[NeededPropertyIndex];
NeededPropertyIndex++;
ToolTipLineIndex++;
}
return ToReturn;
}
Expand Down Expand Up @@ -112,11 +111,15 @@ public static string[] SkinIniToExport()
for (int i = Counter - 2; i < MainWindow.SkinIniPropertiesObj.Count; i++)
{
var TempFrame = MainWindow.SkinIniPropertiesObj[i] as Frame;
string BackgroundColour = TempFrame.Background.ToString().Remove(0, 3);
int r = Convert.ToInt32($"{BackgroundColour[0] + BackgroundColour[1]}", 16);
int g = Convert.ToInt32($"{BackgroundColour[2] + BackgroundColour[3]}", 16);
int b = Convert.ToInt32($"{BackgroundColour[4] + BackgroundColour[5]}", 16);

byte[] Colours = GetRgbColours(TempFrame.Background);

byte r = Colours[0];
byte g = Colours[1];
byte b = Colours[2];

ToExport[Counter] = $"{TempFrame.Name}: {r},{g},{b}";

Counter++;
}
return ToExport;
Expand Down Expand Up @@ -160,13 +163,14 @@ public static byte[] GetRgbColours(string Background)
ToReturn[2] = B;
return ToReturn;
}
#endregion

public static byte GetSingleChannel(string Colour)
{
if(Colour != "" && Colour.Length <= 3 && int.Parse(Colour) < 256)
return Convert.ToByte(Colour);
else
return 0;
}
#endregion
}
}

0 comments on commit db9bcd4

Please sign in to comment.