mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-10-16 23:49:19 +02:00
Show Ctrl+Shift bindings in red on the keyboard
They were drawn as a Shift and a Ctrl binding at once. The key flyout's rows carry the same colours as the keys.
This commit is contained in:
@@ -804,6 +804,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
|||||||
private static readonly IBrush KeyPlainBrush = new SolidColorBrush(Color.Parse("#2E9E1F"));
|
private static readonly IBrush KeyPlainBrush = new SolidColorBrush(Color.Parse("#2E9E1F"));
|
||||||
private static readonly IBrush KeyShiftBrush = new SolidColorBrush(Color.Parse("#C9A227"));
|
private static readonly IBrush KeyShiftBrush = new SolidColorBrush(Color.Parse("#C9A227"));
|
||||||
private static readonly IBrush KeyCtrlBrush = new SolidColorBrush(Color.Parse("#2D7FD3"));
|
private static readonly IBrush KeyCtrlBrush = new SolidColorBrush(Color.Parse("#2D7FD3"));
|
||||||
|
private static readonly IBrush KeyShiftCtrlBrush = new SolidColorBrush(Color.Parse("#C8372D"));
|
||||||
private static readonly IBrush KeyBorderBrush = new SolidColorBrush(Color.Parse("#3A424A"));
|
private static readonly IBrush KeyBorderBrush = new SolidColorBrush(Color.Parse("#3A424A"));
|
||||||
private static readonly IBrush FgBrush = new SolidColorBrush(Color.Parse("#E6E8EA"));
|
private static readonly IBrush FgBrush = new SolidColorBrush(Color.Parse("#E6E8EA"));
|
||||||
private static readonly IBrush FgDimBrush = new SolidColorBrush(Color.Parse("#9098A0"));
|
private static readonly IBrush FgDimBrush = new SolidColorBrush(Color.Parse("#9098A0"));
|
||||||
@@ -1117,6 +1118,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
|||||||
if (state is { Plain: true }) colours.Add(KeyPlainBrush);
|
if (state is { Plain: true }) colours.Add(KeyPlainBrush);
|
||||||
if (state is { Shift: true }) colours.Add(KeyShiftBrush);
|
if (state is { Shift: true }) colours.Add(KeyShiftBrush);
|
||||||
if (state is { Ctrl: true }) colours.Add(KeyCtrlBrush);
|
if (state is { Ctrl: true }) colours.Add(KeyCtrlBrush);
|
||||||
|
if (state is { ShiftCtrl: true }) colours.Add(KeyShiftCtrlBrush);
|
||||||
|
|
||||||
if (colours.Count == 0)
|
if (colours.Count == 0)
|
||||||
return new Border { Background = KeyUnassignedBrush };
|
return new Border { Background = KeyUnassignedBrush };
|
||||||
@@ -1144,12 +1146,12 @@ public partial class Settings : UserControl, ISettingsCapture
|
|||||||
foreach (var c in commands)
|
foreach (var c in commands)
|
||||||
items.Add(CommandLabel(c));
|
items.Add(CommandLabel(c));
|
||||||
|
|
||||||
var slots = new (bool shift, bool ctrl, string labelKey)[]
|
var slots = new (bool shift, bool ctrl, string labelKey, IBrush colour)[]
|
||||||
{
|
{
|
||||||
(false, false, "BindNoMod"),
|
(false, false, "BindNoMod", KeyPlainBrush),
|
||||||
(true, false, "BindShift"),
|
(true, false, "BindShift", KeyShiftBrush),
|
||||||
(false, true, "BindCtrl"),
|
(false, true, "BindCtrl", KeyCtrlBrush),
|
||||||
(true, true, "BindShiftCtrl"),
|
(true, true, "BindShiftCtrl", KeyShiftCtrlBrush),
|
||||||
};
|
};
|
||||||
|
|
||||||
var combos = new ComboBox[slots.Length];
|
var combos = new ComboBox[slots.Length];
|
||||||
@@ -1161,14 +1163,24 @@ public partial class Settings : UserControl, ISettingsCapture
|
|||||||
|
|
||||||
for (int i = 0; i < slots.Length; i++)
|
for (int i = 0; i < slots.Length; i++)
|
||||||
{
|
{
|
||||||
var (shift, ctrl, labelKey) = slots[i];
|
var (shift, ctrl, labelKey, colour) = slots[i];
|
||||||
|
|
||||||
var lbl = new TextBlock
|
// The swatch ties the row to the key colours on the keyboard above.
|
||||||
|
var lbl = new StackPanel
|
||||||
{
|
{
|
||||||
Text = App.Loc[labelKey],
|
Orientation = Orientation.Horizontal,
|
||||||
Foreground = FgBrush,
|
Spacing = 6,
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
VerticalAlignment = VerticalAlignment.Center,
|
||||||
Margin = new Thickness(0, 4, 12, 4)
|
Margin = new Thickness(0, 4, 12, 4),
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new Border
|
||||||
|
{
|
||||||
|
Width = 10, Height = 10, CornerRadius = new CornerRadius(2),
|
||||||
|
Background = colour, VerticalAlignment = VerticalAlignment.Center
|
||||||
|
},
|
||||||
|
new TextBlock { Text = App.Loc[labelKey], Foreground = FgBrush, VerticalAlignment = VerticalAlignment.Center }
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Grid.SetRow(lbl, i);
|
Grid.SetRow(lbl, i);
|
||||||
Grid.SetColumn(lbl, 0);
|
Grid.SetColumn(lbl, 0);
|
||||||
@@ -1271,6 +1283,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
|||||||
legend.Children.Add(LegendItem(KeyPlainBrush, App.Loc["KbAssigned"]));
|
legend.Children.Add(LegendItem(KeyPlainBrush, App.Loc["KbAssigned"]));
|
||||||
legend.Children.Add(LegendItem(KeyShiftBrush, App.Loc["KbShift"]));
|
legend.Children.Add(LegendItem(KeyShiftBrush, App.Loc["KbShift"]));
|
||||||
legend.Children.Add(LegendItem(KeyCtrlBrush, App.Loc["KbCtrl"]));
|
legend.Children.Add(LegendItem(KeyCtrlBrush, App.Loc["KbCtrl"]));
|
||||||
|
legend.Children.Add(LegendItem(KeyShiftCtrlBrush, App.Loc["KbShiftCtrl"]));
|
||||||
return legend;
|
return legend;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1302,6 +1315,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
|||||||
public bool Plain;
|
public bool Plain;
|
||||||
public bool Shift;
|
public bool Shift;
|
||||||
public bool Ctrl;
|
public bool Ctrl;
|
||||||
|
public bool ShiftCtrl;
|
||||||
public readonly List<string> Tips = new();
|
public readonly List<string> Tips = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1316,9 +1330,13 @@ public partial class Settings : UserControl, ISettingsCapture
|
|||||||
if (!map.TryGetValue(key, out var state))
|
if (!map.TryGetValue(key, out var state))
|
||||||
map[key] = state = new KeyState();
|
map[key] = state = new KeyState();
|
||||||
|
|
||||||
if (!b.Shift && !b.Ctrl) state.Plain = true;
|
switch (b.Shift, b.Ctrl)
|
||||||
if (b.Shift) state.Shift = true;
|
{
|
||||||
if (b.Ctrl) state.Ctrl = true;
|
case (false, false): state.Plain = true; break;
|
||||||
|
case (true, false): state.Shift = true; break;
|
||||||
|
case (false, true): state.Ctrl = true; break;
|
||||||
|
default: state.ShiftCtrl = true; break;
|
||||||
|
}
|
||||||
|
|
||||||
state.Tips.Add($"{ComboText(b)} — {CommandLabel(b)}");
|
state.Tips.Add($"{ComboText(b)} — {CommandLabel(b)}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -487,6 +487,7 @@
|
|||||||
<String key="KbAssigned">Přiřazeno</String>
|
<String key="KbAssigned">Přiřazeno</String>
|
||||||
<String key="KbShift">Se Shiftem</String>
|
<String key="KbShift">Se Shiftem</String>
|
||||||
<String key="KbCtrl">S Ctrl</String>
|
<String key="KbCtrl">S Ctrl</String>
|
||||||
|
<String key="KbShiftCtrl">S Ctrl + Shift</String>
|
||||||
<String key="KbReserved">Vyhrazeno simulátorem</String>
|
<String key="KbReserved">Vyhrazeno simulátorem</String>
|
||||||
<String key="BindKeyTitle">Klávesa:</String>
|
<String key="BindKeyTitle">Klávesa:</String>
|
||||||
<String key="BindKeyHint">Přiřaďte příkaz ke každé kombinaci modifikátorů této klávesy.</String>
|
<String key="BindKeyHint">Přiřaďte příkaz ke každé kombinaci modifikátorů této klávesy.</String>
|
||||||
|
|||||||
@@ -522,6 +522,7 @@
|
|||||||
<String key="KbAssigned">Assigned</String>
|
<String key="KbAssigned">Assigned</String>
|
||||||
<String key="KbShift">With Shift</String>
|
<String key="KbShift">With Shift</String>
|
||||||
<String key="KbCtrl">With Ctrl</String>
|
<String key="KbCtrl">With Ctrl</String>
|
||||||
|
<String key="KbShiftCtrl">With Ctrl + Shift</String>
|
||||||
<String key="KbReserved">Reserved by the simulator</String>
|
<String key="KbReserved">Reserved by the simulator</String>
|
||||||
<String key="BindKeyTitle">Key:</String>
|
<String key="BindKeyTitle">Key:</String>
|
||||||
<String key="BindKeyHint">Assign a command to each modifier combination for this key.</String>
|
<String key="BindKeyHint">Assign a command to each modifier combination for this key.</String>
|
||||||
|
|||||||
@@ -487,6 +487,7 @@
|
|||||||
<String key="KbAssigned">Hozzárendelve</String>
|
<String key="KbAssigned">Hozzárendelve</String>
|
||||||
<String key="KbShift">Shift-tel</String>
|
<String key="KbShift">Shift-tel</String>
|
||||||
<String key="KbCtrl">Ctrl-lal</String>
|
<String key="KbCtrl">Ctrl-lal</String>
|
||||||
|
<String key="KbShiftCtrl">Ctrl + Shift-tel</String>
|
||||||
<String key="KbReserved">A szimulátor számára fenntartva</String>
|
<String key="KbReserved">A szimulátor számára fenntartva</String>
|
||||||
<String key="BindKeyTitle">Billentyű:</String>
|
<String key="BindKeyTitle">Billentyű:</String>
|
||||||
<String key="BindKeyHint">Rendeljen parancsot a billentyű minden módosító-kombinációjához.</String>
|
<String key="BindKeyHint">Rendeljen parancsot a billentyű minden módosító-kombinációjához.</String>
|
||||||
|
|||||||
@@ -522,6 +522,7 @@
|
|||||||
<String key="KbAssigned">Przypisany</String>
|
<String key="KbAssigned">Przypisany</String>
|
||||||
<String key="KbShift">Z klawiszem Shift</String>
|
<String key="KbShift">Z klawiszem Shift</String>
|
||||||
<String key="KbCtrl">Z klawiszem Ctrl</String>
|
<String key="KbCtrl">Z klawiszem Ctrl</String>
|
||||||
|
<String key="KbShiftCtrl">Z Ctrl + Shift</String>
|
||||||
<String key="KbReserved">Zarezerwowany przez symulator</String>
|
<String key="KbReserved">Zarezerwowany przez symulator</String>
|
||||||
<String key="BindKeyTitle">Klawisz:</String>
|
<String key="BindKeyTitle">Klawisz:</String>
|
||||||
<String key="BindKeyHint">Przypisz komendę do każdej kombinacji modyfikatorów dla tego klawisza.</String>
|
<String key="BindKeyHint">Przypisz komendę do każdej kombinacji modyfikatorów dla tego klawisza.</String>
|
||||||
|
|||||||
@@ -487,6 +487,7 @@
|
|||||||
<String key="KbAssigned">Назначено</String>
|
<String key="KbAssigned">Назначено</String>
|
||||||
<String key="KbShift">С Shift</String>
|
<String key="KbShift">С Shift</String>
|
||||||
<String key="KbCtrl">С Ctrl</String>
|
<String key="KbCtrl">С Ctrl</String>
|
||||||
|
<String key="KbShiftCtrl">С Ctrl + Shift</String>
|
||||||
<String key="KbReserved">Зарезервировано симулятором</String>
|
<String key="KbReserved">Зарезервировано симулятором</String>
|
||||||
<String key="BindKeyTitle">Клавиша:</String>
|
<String key="BindKeyTitle">Клавиша:</String>
|
||||||
<String key="BindKeyHint">Назначьте команду каждому сочетанию модификаторов для этой клавиши.</String>
|
<String key="BindKeyHint">Назначьте команду каждому сочетанию модификаторов для этой клавиши.</String>
|
||||||
|
|||||||
Reference in New Issue
Block a user