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 KeyShiftBrush = new SolidColorBrush(Color.Parse("#C9A227"));
|
||||
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 FgBrush = new SolidColorBrush(Color.Parse("#E6E8EA"));
|
||||
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 { Shift: true }) colours.Add(KeyShiftBrush);
|
||||
if (state is { Ctrl: true }) colours.Add(KeyCtrlBrush);
|
||||
if (state is { ShiftCtrl: true }) colours.Add(KeyShiftCtrlBrush);
|
||||
|
||||
if (colours.Count == 0)
|
||||
return new Border { Background = KeyUnassignedBrush };
|
||||
@@ -1144,12 +1146,12 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
foreach (var c in commands)
|
||||
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"),
|
||||
(true, false, "BindShift"),
|
||||
(false, true, "BindCtrl"),
|
||||
(true, true, "BindShiftCtrl"),
|
||||
(false, false, "BindNoMod", KeyPlainBrush),
|
||||
(true, false, "BindShift", KeyShiftBrush),
|
||||
(false, true, "BindCtrl", KeyCtrlBrush),
|
||||
(true, true, "BindShiftCtrl", KeyShiftCtrlBrush),
|
||||
};
|
||||
|
||||
var combos = new ComboBox[slots.Length];
|
||||
@@ -1161,14 +1163,24 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
|
||||
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],
|
||||
Foreground = FgBrush,
|
||||
Orientation = Orientation.Horizontal,
|
||||
Spacing = 6,
|
||||
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.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(KeyShiftBrush, App.Loc["KbShift"]));
|
||||
legend.Children.Add(LegendItem(KeyCtrlBrush, App.Loc["KbCtrl"]));
|
||||
legend.Children.Add(LegendItem(KeyShiftCtrlBrush, App.Loc["KbShiftCtrl"]));
|
||||
return legend;
|
||||
}
|
||||
|
||||
@@ -1302,6 +1315,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
public bool Plain;
|
||||
public bool Shift;
|
||||
public bool Ctrl;
|
||||
public bool ShiftCtrl;
|
||||
public readonly List<string> Tips = new();
|
||||
}
|
||||
|
||||
@@ -1316,9 +1330,13 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
if (!map.TryGetValue(key, out var state))
|
||||
map[key] = state = new KeyState();
|
||||
|
||||
if (!b.Shift && !b.Ctrl) state.Plain = true;
|
||||
if (b.Shift) state.Shift = true;
|
||||
if (b.Ctrl) state.Ctrl = true;
|
||||
switch (b.Shift, b.Ctrl)
|
||||
{
|
||||
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)}");
|
||||
}
|
||||
|
||||
@@ -487,6 +487,7 @@
|
||||
<String key="KbAssigned">Přiřazeno</String>
|
||||
<String key="KbShift">Se Shiftem</String>
|
||||
<String key="KbCtrl">S Ctrl</String>
|
||||
<String key="KbShiftCtrl">S Ctrl + Shift</String>
|
||||
<String key="KbReserved">Vyhrazeno simulátorem</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>
|
||||
|
||||
@@ -522,6 +522,7 @@
|
||||
<String key="KbAssigned">Assigned</String>
|
||||
<String key="KbShift">With Shift</String>
|
||||
<String key="KbCtrl">With Ctrl</String>
|
||||
<String key="KbShiftCtrl">With Ctrl + Shift</String>
|
||||
<String key="KbReserved">Reserved by the simulator</String>
|
||||
<String key="BindKeyTitle">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="KbShift">Shift-tel</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="BindKeyTitle">Billentyű:</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="KbShift">Z klawiszem Shift</String>
|
||||
<String key="KbCtrl">Z klawiszem Ctrl</String>
|
||||
<String key="KbShiftCtrl">Z Ctrl + Shift</String>
|
||||
<String key="KbReserved">Zarezerwowany przez symulator</String>
|
||||
<String key="BindKeyTitle">Klawisz:</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="KbShift">С Shift</String>
|
||||
<String key="KbCtrl">С Ctrl</String>
|
||||
<String key="KbShiftCtrl">С Ctrl + Shift</String>
|
||||
<String key="KbReserved">Зарезервировано симулятором</String>
|
||||
<String key="BindKeyTitle">Клавиша:</String>
|
||||
<String key="BindKeyHint">Назначьте команду каждому сочетанию модификаторов для этой клавиши.</String>
|
||||
|
||||
Reference in New Issue
Block a user