mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Added more actions for m3/m4, fixed scaling
This commit is contained in:
53
Keyboard.cs
53
Keyboard.cs
@@ -1,16 +1,36 @@
|
||||
namespace GHelper
|
||||
using System.Diagnostics.Metrics;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
public partial class Keyboard : Form
|
||||
{
|
||||
|
||||
|
||||
Dictionary<string, string> customActions = new Dictionary<string, string>
|
||||
{
|
||||
{"","--------------" },
|
||||
{"mute", "Volume Mute"},
|
||||
{"screenshot", "Screenshot"},
|
||||
{"play", "Play/Pause"},
|
||||
{"aura", "Aura"},
|
||||
{"custom", "Custom"}
|
||||
};
|
||||
|
||||
|
||||
public Keyboard()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
comboM3.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboM3.SelectedIndex = 0;
|
||||
comboM3.DataSource = new BindingSource(customActions, null);
|
||||
comboM3.DisplayMember = "Value";
|
||||
comboM3.ValueMember = "Key";
|
||||
|
||||
customActions[""] = "Performance";
|
||||
comboM4.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboM4.SelectedIndex = 0;
|
||||
comboM4.DataSource = new BindingSource(customActions, null);
|
||||
comboM4.DisplayMember = "Value";
|
||||
comboM4.ValueMember = "Key";
|
||||
|
||||
comboM3.SelectedValueChanged += ComboM3_SelectedValueChanged;
|
||||
comboM4.SelectedValueChanged += ComboM4_SelectedValueChanged;
|
||||
@@ -35,18 +55,23 @@
|
||||
Program.config.setConfig("m4_custom", tb.Text);
|
||||
}
|
||||
|
||||
private void ComboM4_SelectedValueChanged(object? sender, EventArgs e)
|
||||
private void ComboKeyChanged(object? sender, string name = "m3")
|
||||
{
|
||||
if (sender is null) return;
|
||||
ComboBox cmb = (ComboBox)sender;
|
||||
Program.config.setConfig("m4", cmb.SelectedIndex);
|
||||
|
||||
if (cmb.SelectedValue is not null)
|
||||
Program.config.setConfig(name, cmb.SelectedValue.ToString());
|
||||
}
|
||||
|
||||
private void ComboM4_SelectedValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
ComboKeyChanged(sender, "m4");
|
||||
}
|
||||
|
||||
private void ComboM3_SelectedValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is null) return;
|
||||
ComboBox cmb = (ComboBox)sender;
|
||||
Program.config.setConfig("m3", cmb.SelectedIndex);
|
||||
ComboKeyChanged(sender, "m3");
|
||||
}
|
||||
|
||||
private void Keyboard_Shown(object? sender, EventArgs e)
|
||||
@@ -55,14 +80,14 @@
|
||||
Top = Program.settingsForm.Top;
|
||||
Left = Program.settingsForm.Left - Width - 5;
|
||||
|
||||
int m3 = Program.config.getConfig("m3");
|
||||
int m4 = Program.config.getConfig("m4");
|
||||
string m3 = Program.config.getConfigString("m3");
|
||||
string m4 = Program.config.getConfigString("m4");
|
||||
|
||||
if (m3 != -1)
|
||||
comboM3.SelectedIndex = m3;
|
||||
comboM3.SelectedValue = (m3 is not null) ? m3 : "";
|
||||
comboM4.SelectedValue = (m4 is not null) ? m4 : "";
|
||||
|
||||
if (m4 != -1)
|
||||
comboM4.SelectedIndex = m4;
|
||||
if (comboM3.SelectedValue is null) comboM3.SelectedValue = "";
|
||||
if (comboM4.SelectedValue is null) comboM4.SelectedValue = "";
|
||||
|
||||
textM3.Text = Program.config.getConfigString("m3_custom");
|
||||
textM4.Text = Program.config.getConfigString("m4_custom");
|
||||
|
||||
Reference in New Issue
Block a user