Semi working profiles and longer macros
This commit is contained in:
+45
-17
@@ -35,6 +35,10 @@ public class ActionDialog : Form
|
||||
private readonly Panel _cmdPanel;
|
||||
private readonly TextBox _cmdBox;
|
||||
|
||||
// Profil wechseln
|
||||
private readonly Panel _profilePanel;
|
||||
private readonly ComboBox _profileCombo;
|
||||
|
||||
// LED-Farbe
|
||||
private readonly Panel _colorPanel;
|
||||
private readonly Button _colorBtn;
|
||||
@@ -50,11 +54,11 @@ public class ActionDialog : Form
|
||||
private readonly MacroTable _macros;
|
||||
private readonly int _macroSlot;
|
||||
// Je Step: [CaptureBtn, CheckCtrl, CheckShift, CheckAlt]
|
||||
private readonly Button[] _stepBtns = new Button[4];
|
||||
private readonly CheckBox[] _stepCtrl = new CheckBox[4];
|
||||
private readonly CheckBox[] _stepShift = new CheckBox[4];
|
||||
private readonly CheckBox[] _stepAlt = new CheckBox[4];
|
||||
private readonly byte[] _stepKeycodes = new byte[4];
|
||||
private readonly Button[] _stepBtns = new Button[8];
|
||||
private readonly CheckBox[] _stepCtrl = new CheckBox[8];
|
||||
private readonly CheckBox[] _stepShift = new CheckBox[8];
|
||||
private readonly CheckBox[] _stepAlt = new CheckBox[8];
|
||||
private readonly byte[] _stepKeycodes = new byte[8];
|
||||
private int _captureStep = -1; // -1 = nicht im Capture-Modus
|
||||
|
||||
// Capture-Zustand
|
||||
@@ -220,7 +224,7 @@ public class ActionDialog : Form
|
||||
_showColor = showColor;
|
||||
|
||||
// Bestehende Makro-Steps aus der Tabelle laden
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 8; i++)
|
||||
_stepKeycodes[i] = _macros.Steps[_macroSlot, i].Keycode;
|
||||
|
||||
// Formular-Grundeinstellungen
|
||||
@@ -240,7 +244,7 @@ public class ActionDialog : Form
|
||||
DropDownStyle = ComboBoxStyle.DropDownList,
|
||||
};
|
||||
_typeCombo.Items.AddRange(new object[]
|
||||
{ "Keine Aktion", "HID Tastatur", "HID Consumer", "Host Command", "Makro" });
|
||||
{ "Keine Aktion", "HID Tastatur", "HID Consumer", "Host Command", "Makro", "Profil wechseln" });
|
||||
_typeCombo.SelectedIndex = (int)action.Type;
|
||||
_typeCombo.SelectedIndexChanged += OnTypeChanged;
|
||||
|
||||
@@ -320,6 +324,22 @@ public class ActionDialog : Form
|
||||
};
|
||||
_cmdPanel.Controls.AddRange(new Control[] { cmdLabel, _cmdBox });
|
||||
|
||||
// ── Profil-Panel ──────────────────────────────────────────────────────
|
||||
_profilePanel = new Panel { Location = new Point(12, 48), Size = new Size(396, 30) };
|
||||
var profileLabel = new Label { Text = "Ziel-Profil:", Location = new Point(0, 8), AutoSize = true };
|
||||
_profileCombo = new ComboBox
|
||||
{
|
||||
Location = new Point(90, 4),
|
||||
Width = 200,
|
||||
DropDownStyle = ComboBoxStyle.DropDownList,
|
||||
};
|
||||
_profileCombo.Items.AddRange(new object[]
|
||||
{ "Nächstes Profil (Zyklus)", "Profil 1", "Profil 2", "Profil 3" });
|
||||
_profileCombo.SelectedIndex = action.Type == ActionType.ProfileSwitch
|
||||
? (action.Data == 0xFFFF ? 0 : Math.Clamp((int)action.Data + 1, 1, 3))
|
||||
: 0;
|
||||
_profilePanel.Controls.AddRange(new Control[] { profileLabel, _profileCombo });
|
||||
|
||||
// ── Farb-Panel ────────────────────────────────────────────────────────
|
||||
_colorPanel = new Panel
|
||||
{
|
||||
@@ -378,8 +398,8 @@ public class ActionDialog : Form
|
||||
_animPanel.Controls.AddRange(new Control[]
|
||||
{ animLabel, _animCombo, periodLabel, _periodCombo });
|
||||
|
||||
// ── Makro-Panel (4 Steps) ─────────────────────────────────────────────
|
||||
_macroPanel = new Panel { Location = new Point(12, 48), Size = new Size(396, 4 * 30 + 22) };
|
||||
// ── Makro-Panel (8 Steps) ─────────────────────────────────────────────
|
||||
_macroPanel = new Panel { Location = new Point(12, 48), Size = new Size(396, 8 * 30 + 22) };
|
||||
|
||||
var macroHint = new Label
|
||||
{
|
||||
@@ -391,7 +411,7 @@ public class ActionDialog : Form
|
||||
};
|
||||
_macroPanel.Controls.Add(macroHint);
|
||||
|
||||
for (int step = 0; step < 4; step++)
|
||||
for (int step = 0; step < 8; step++)
|
||||
{
|
||||
int s = step;
|
||||
int y2 = 30 + step * 30;
|
||||
@@ -454,7 +474,7 @@ public class ActionDialog : Form
|
||||
Controls.AddRange(new Control[]
|
||||
{
|
||||
typeLabel, _typeCombo,
|
||||
_hidKeyPanel, _consumerPanel, _cmdPanel, _macroPanel,
|
||||
_hidKeyPanel, _consumerPanel, _cmdPanel, _profilePanel, _macroPanel,
|
||||
_colorPanel, _animPanel,
|
||||
_okBtn, _cancelBtn,
|
||||
});
|
||||
@@ -481,6 +501,7 @@ public class ActionDialog : Form
|
||||
_hidKeyPanel.Visible = t == ActionType.HidKey;
|
||||
_consumerPanel.Visible = t == ActionType.HidConsumer;
|
||||
_cmdPanel.Visible = t == ActionType.HostCommand;
|
||||
_profilePanel.Visible = t == ActionType.ProfileSwitch;
|
||||
_macroPanel.Visible = t == ActionType.Macro;
|
||||
_colorPanel.Visible = _showColor;
|
||||
_animPanel.Visible = _showColor;
|
||||
@@ -496,11 +517,12 @@ public class ActionDialog : Form
|
||||
|
||||
int contentH = t switch
|
||||
{
|
||||
ActionType.HidKey => 110,
|
||||
ActionType.HidConsumer => 30,
|
||||
ActionType.HostCommand => 30,
|
||||
ActionType.Macro => 4 * 30 + 22,
|
||||
_ => 0,
|
||||
ActionType.HidKey => 110,
|
||||
ActionType.HidConsumer => 30,
|
||||
ActionType.HostCommand => 30,
|
||||
ActionType.ProfileSwitch => 30,
|
||||
ActionType.Macro => 8 * 30 + 22,
|
||||
_ => 0,
|
||||
};
|
||||
|
||||
int ledY = 48 + contentH + 10;
|
||||
@@ -710,12 +732,18 @@ public class ActionDialog : Form
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case ActionType.ProfileSwitch:
|
||||
data = _profileCombo.SelectedIndex == 0
|
||||
? (ushort)0xFFFF // Zyklus: Firmware rechnet (current+1)%3
|
||||
: (ushort)(_profileCombo.SelectedIndex - 1); // Profil 0/1/2
|
||||
break;
|
||||
}
|
||||
|
||||
if (type == ActionType.Macro)
|
||||
{
|
||||
// Steps in die Makro-Tabelle schreiben
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
byte mod = 0;
|
||||
if (_stepCtrl[i].Checked) mod |= 0x01;
|
||||
|
||||
Reference in New Issue
Block a user