Added Lighting zones for supported mice.

This commit is contained in:
IceStormNG
2023-07-30 13:41:57 +02:00
parent 9cb2904632
commit 7c80a32fc2
7 changed files with 600 additions and 72 deletions

View File

@@ -60,6 +60,12 @@
labelPerformance = new Label(); labelPerformance = new Label();
panelLighting = new Panel(); panelLighting = new Panel();
panelLightingContent = new Panel(); panelLightingContent = new Panel();
tableLayoutPanel3 = new TableLayoutPanel();
buttonLightingZoneScroll = new UI.RButton();
buttonLightingZoneLogo = new UI.RButton();
buttonLightingZoneAll = new UI.RButton();
buttonLightingZoneUnderglow = new UI.RButton();
buttonLightingZoneDock = new UI.RButton();
comboBoxAnimationDirection = new UI.RComboBox(); comboBoxAnimationDirection = new UI.RComboBox();
labelAnimationDirection = new Label(); labelAnimationDirection = new Label();
checkBoxRandomColor = new CheckBox(); checkBoxRandomColor = new CheckBox();
@@ -89,6 +95,9 @@
pictureBoxBatteryState = new PictureBox(); pictureBoxBatteryState = new PictureBox();
buttonSync = new UI.RButton(); buttonSync = new UI.RButton();
panelBottomButtons = new Panel(); panelBottomButtons = new Panel();
tableLayoutPanel2 = new TableLayoutPanel();
rButton1 = new UI.RButton();
rButton2 = new UI.RButton();
panelProfiles.SuspendLayout(); panelProfiles.SuspendLayout();
panelPerformance.SuspendLayout(); panelPerformance.SuspendLayout();
panelPerformanceOther.SuspendLayout(); panelPerformanceOther.SuspendLayout();
@@ -102,6 +111,7 @@
((System.ComponentModel.ISupportInitialize)pictureKeyboard).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureKeyboard).BeginInit();
panelLighting.SuspendLayout(); panelLighting.SuspendLayout();
panelLightingContent.SuspendLayout(); panelLightingContent.SuspendLayout();
tableLayoutPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxLightingColor).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxLightingColor).BeginInit();
panelLightingHeader.SuspendLayout(); panelLightingHeader.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxLighting).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxLighting).BeginInit();
@@ -112,6 +122,7 @@
panelBatteryState.SuspendLayout(); panelBatteryState.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxBatteryState).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxBatteryState).BeginInit();
panelBottomButtons.SuspendLayout(); panelBottomButtons.SuspendLayout();
tableLayoutPanel2.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// panelProfiles // panelProfiles
@@ -553,12 +564,13 @@
panelLighting.Location = new Point(11, 476); panelLighting.Location = new Point(11, 476);
panelLighting.Name = "panelLighting"; panelLighting.Name = "panelLighting";
panelLighting.Padding = new Padding(0, 0, 0, 25); panelLighting.Padding = new Padding(0, 0, 0, 25);
panelLighting.Size = new Size(654, 271); panelLighting.Size = new Size(654, 329);
panelLighting.TabIndex = 42; panelLighting.TabIndex = 42;
// //
// panelLightingContent // panelLightingContent
// //
panelLightingContent.AutoSize = true; panelLightingContent.AutoSize = true;
panelLightingContent.Controls.Add(tableLayoutPanel3);
panelLightingContent.Controls.Add(comboBoxAnimationDirection); panelLightingContent.Controls.Add(comboBoxAnimationDirection);
panelLightingContent.Controls.Add(labelAnimationDirection); panelLightingContent.Controls.Add(labelAnimationDirection);
panelLightingContent.Controls.Add(checkBoxRandomColor); panelLightingContent.Controls.Add(checkBoxRandomColor);
@@ -572,9 +584,148 @@
panelLightingContent.Location = new Point(0, 30); panelLightingContent.Location = new Point(0, 30);
panelLightingContent.Name = "panelLightingContent"; panelLightingContent.Name = "panelLightingContent";
panelLightingContent.Padding = new Padding(0, 0, 0, 11); panelLightingContent.Padding = new Padding(0, 0, 0, 11);
panelLightingContent.Size = new Size(654, 216); panelLightingContent.Size = new Size(654, 274);
panelLightingContent.TabIndex = 42; panelLightingContent.TabIndex = 42;
// //
// tableLayoutPanel3
//
tableLayoutPanel3.AutoSize = true;
tableLayoutPanel3.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tableLayoutPanel3.ColumnCount = 5;
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
tableLayoutPanel3.Controls.Add(buttonLightingZoneScroll, 0, 0);
tableLayoutPanel3.Controls.Add(buttonLightingZoneLogo, 0, 0);
tableLayoutPanel3.Controls.Add(buttonLightingZoneAll, 0, 0);
tableLayoutPanel3.Controls.Add(buttonLightingZoneUnderglow, 1, 0);
tableLayoutPanel3.Controls.Add(buttonLightingZoneDock, 2, 0);
tableLayoutPanel3.Dock = DockStyle.Top;
tableLayoutPanel3.Location = new Point(0, 0);
tableLayoutPanel3.Margin = new Padding(6, 3, 6, 3);
tableLayoutPanel3.Name = "tableLayoutPanel3";
tableLayoutPanel3.RowCount = 1;
tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Absolute, 60F));
tableLayoutPanel3.Size = new Size(654, 60);
tableLayoutPanel3.TabIndex = 56;
//
// buttonLightingZoneScroll
//
buttonLightingZoneScroll.AccessibleName = "DPI Setting 4";
buttonLightingZoneScroll.Activated = false;
buttonLightingZoneScroll.AutoSize = true;
buttonLightingZoneScroll.AutoSizeMode = AutoSizeMode.GrowAndShrink;
buttonLightingZoneScroll.BackColor = SystemColors.ControlLightLight;
buttonLightingZoneScroll.BorderColor = Color.LightGreen;
buttonLightingZoneScroll.BorderRadius = 5;
buttonLightingZoneScroll.Dock = DockStyle.Fill;
buttonLightingZoneScroll.FlatAppearance.BorderSize = 0;
buttonLightingZoneScroll.FlatStyle = FlatStyle.Flat;
buttonLightingZoneScroll.ForeColor = SystemColors.ControlText;
buttonLightingZoneScroll.ImageAlign = ContentAlignment.BottomCenter;
buttonLightingZoneScroll.Location = new Point(263, 3);
buttonLightingZoneScroll.Name = "buttonLightingZoneScroll";
buttonLightingZoneScroll.Secondary = false;
buttonLightingZoneScroll.Size = new Size(124, 54);
buttonLightingZoneScroll.TabIndex = 7;
buttonLightingZoneScroll.Text = "Scrollwheel";
buttonLightingZoneScroll.TextImageRelation = TextImageRelation.ImageAboveText;
buttonLightingZoneScroll.UseVisualStyleBackColor = false;
//
// buttonLightingZoneLogo
//
buttonLightingZoneLogo.AccessibleName = "DPI Setting 2";
buttonLightingZoneLogo.Activated = false;
buttonLightingZoneLogo.AutoSize = true;
buttonLightingZoneLogo.AutoSizeMode = AutoSizeMode.GrowAndShrink;
buttonLightingZoneLogo.BackColor = SystemColors.ControlLightLight;
buttonLightingZoneLogo.BorderColor = Color.LightGreen;
buttonLightingZoneLogo.BorderRadius = 5;
buttonLightingZoneLogo.Dock = DockStyle.Fill;
buttonLightingZoneLogo.FlatAppearance.BorderSize = 0;
buttonLightingZoneLogo.FlatStyle = FlatStyle.Flat;
buttonLightingZoneLogo.ForeColor = SystemColors.ControlText;
buttonLightingZoneLogo.ImageAlign = ContentAlignment.BottomCenter;
buttonLightingZoneLogo.Location = new Point(133, 3);
buttonLightingZoneLogo.Name = "buttonLightingZoneLogo";
buttonLightingZoneLogo.Secondary = false;
buttonLightingZoneLogo.Size = new Size(124, 54);
buttonLightingZoneLogo.TabIndex = 4;
buttonLightingZoneLogo.Text = "Logo";
buttonLightingZoneLogo.TextImageRelation = TextImageRelation.ImageAboveText;
buttonLightingZoneLogo.UseVisualStyleBackColor = false;
//
// buttonLightingZoneAll
//
buttonLightingZoneAll.AccessibleName = "DPI Setting 1";
buttonLightingZoneAll.Activated = false;
buttonLightingZoneAll.AutoSize = true;
buttonLightingZoneAll.AutoSizeMode = AutoSizeMode.GrowAndShrink;
buttonLightingZoneAll.BackColor = SystemColors.ControlLightLight;
buttonLightingZoneAll.BorderColor = Color.LightGreen;
buttonLightingZoneAll.BorderRadius = 5;
buttonLightingZoneAll.CausesValidation = false;
buttonLightingZoneAll.Dock = DockStyle.Fill;
buttonLightingZoneAll.FlatAppearance.BorderSize = 0;
buttonLightingZoneAll.FlatStyle = FlatStyle.Flat;
buttonLightingZoneAll.ForeColor = SystemColors.ControlText;
buttonLightingZoneAll.Location = new Point(3, 3);
buttonLightingZoneAll.Name = "buttonLightingZoneAll";
buttonLightingZoneAll.Secondary = false;
buttonLightingZoneAll.Size = new Size(124, 54);
buttonLightingZoneAll.TabIndex = 4;
buttonLightingZoneAll.Text = "All";
buttonLightingZoneAll.TextImageRelation = TextImageRelation.ImageAboveText;
buttonLightingZoneAll.UseVisualStyleBackColor = false;
//
// buttonLightingZoneUnderglow
//
buttonLightingZoneUnderglow.AccessibleName = "DPI Setting 3";
buttonLightingZoneUnderglow.Activated = false;
buttonLightingZoneUnderglow.AutoSize = true;
buttonLightingZoneUnderglow.AutoSizeMode = AutoSizeMode.GrowAndShrink;
buttonLightingZoneUnderglow.BackColor = SystemColors.ControlLightLight;
buttonLightingZoneUnderglow.BorderColor = Color.LightGreen;
buttonLightingZoneUnderglow.BorderRadius = 5;
buttonLightingZoneUnderglow.Dock = DockStyle.Fill;
buttonLightingZoneUnderglow.FlatAppearance.BorderSize = 0;
buttonLightingZoneUnderglow.FlatStyle = FlatStyle.Flat;
buttonLightingZoneUnderglow.ForeColor = SystemColors.ControlText;
buttonLightingZoneUnderglow.ImageAlign = ContentAlignment.BottomCenter;
buttonLightingZoneUnderglow.Location = new Point(393, 3);
buttonLightingZoneUnderglow.Name = "buttonLightingZoneUnderglow";
buttonLightingZoneUnderglow.Secondary = false;
buttonLightingZoneUnderglow.Size = new Size(124, 54);
buttonLightingZoneUnderglow.TabIndex = 5;
buttonLightingZoneUnderglow.Text = "Underglow";
buttonLightingZoneUnderglow.TextImageRelation = TextImageRelation.ImageAboveText;
buttonLightingZoneUnderglow.UseVisualStyleBackColor = false;
//
// buttonLightingZoneDock
//
buttonLightingZoneDock.AccessibleName = "DPI Setting 4";
buttonLightingZoneDock.Activated = false;
buttonLightingZoneDock.AutoSize = true;
buttonLightingZoneDock.AutoSizeMode = AutoSizeMode.GrowAndShrink;
buttonLightingZoneDock.BackColor = SystemColors.ControlLightLight;
buttonLightingZoneDock.BorderColor = Color.LightGreen;
buttonLightingZoneDock.BorderRadius = 5;
buttonLightingZoneDock.Dock = DockStyle.Fill;
buttonLightingZoneDock.FlatAppearance.BorderSize = 0;
buttonLightingZoneDock.FlatStyle = FlatStyle.Flat;
buttonLightingZoneDock.ForeColor = SystemColors.ControlText;
buttonLightingZoneDock.ImageAlign = ContentAlignment.BottomCenter;
buttonLightingZoneDock.Location = new Point(523, 3);
buttonLightingZoneDock.Name = "buttonLightingZoneDock";
buttonLightingZoneDock.Secondary = false;
buttonLightingZoneDock.Size = new Size(128, 54);
buttonLightingZoneDock.TabIndex = 6;
buttonLightingZoneDock.Text = "Dock";
buttonLightingZoneDock.TextImageRelation = TextImageRelation.ImageAboveText;
buttonLightingZoneDock.UseVisualStyleBackColor = false;
//
// comboBoxAnimationDirection // comboBoxAnimationDirection
// //
comboBoxAnimationDirection.BorderColor = Color.White; comboBoxAnimationDirection.BorderColor = Color.White;
@@ -582,7 +733,7 @@
comboBoxAnimationDirection.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxAnimationDirection.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxAnimationDirection.FlatStyle = FlatStyle.Flat; comboBoxAnimationDirection.FlatStyle = FlatStyle.Flat;
comboBoxAnimationDirection.FormattingEnabled = true; comboBoxAnimationDirection.FormattingEnabled = true;
comboBoxAnimationDirection.Location = new Point(366, 172); comboBoxAnimationDirection.Location = new Point(366, 230);
comboBoxAnimationDirection.Margin = new Padding(16, 0, 16, 0); comboBoxAnimationDirection.Margin = new Padding(16, 0, 16, 0);
comboBoxAnimationDirection.Name = "comboBoxAnimationDirection"; comboBoxAnimationDirection.Name = "comboBoxAnimationDirection";
comboBoxAnimationDirection.Size = new Size(284, 33); comboBoxAnimationDirection.Size = new Size(284, 33);
@@ -590,7 +741,7 @@
// //
// labelAnimationDirection // labelAnimationDirection
// //
labelAnimationDirection.Location = new Point(6, 172); labelAnimationDirection.Location = new Point(6, 230);
labelAnimationDirection.Margin = new Padding(6, 0, 6, 0); labelAnimationDirection.Margin = new Padding(6, 0, 6, 0);
labelAnimationDirection.Name = "labelAnimationDirection"; labelAnimationDirection.Name = "labelAnimationDirection";
labelAnimationDirection.Size = new Size(316, 33); labelAnimationDirection.Size = new Size(316, 33);
@@ -599,7 +750,7 @@
// //
// checkBoxRandomColor // checkBoxRandomColor
// //
checkBoxRandomColor.Location = new Point(520, 53); checkBoxRandomColor.Location = new Point(520, 111);
checkBoxRandomColor.Margin = new Padding(6, 0, 6, 0); checkBoxRandomColor.Margin = new Padding(6, 0, 6, 0);
checkBoxRandomColor.Name = "checkBoxRandomColor"; checkBoxRandomColor.Name = "checkBoxRandomColor";
checkBoxRandomColor.Size = new Size(128, 37); checkBoxRandomColor.Size = new Size(128, 37);
@@ -614,7 +765,7 @@
comboBoxAnimationSpeed.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxAnimationSpeed.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxAnimationSpeed.FlatStyle = FlatStyle.Flat; comboBoxAnimationSpeed.FlatStyle = FlatStyle.Flat;
comboBoxAnimationSpeed.FormattingEnabled = true; comboBoxAnimationSpeed.FormattingEnabled = true;
comboBoxAnimationSpeed.Location = new Point(366, 130); comboBoxAnimationSpeed.Location = new Point(366, 188);
comboBoxAnimationSpeed.Margin = new Padding(16, 0, 16, 0); comboBoxAnimationSpeed.Margin = new Padding(16, 0, 16, 0);
comboBoxAnimationSpeed.Name = "comboBoxAnimationSpeed"; comboBoxAnimationSpeed.Name = "comboBoxAnimationSpeed";
comboBoxAnimationSpeed.Size = new Size(284, 33); comboBoxAnimationSpeed.Size = new Size(284, 33);
@@ -622,7 +773,7 @@
// //
// labelAnimationSpeed // labelAnimationSpeed
// //
labelAnimationSpeed.Location = new Point(6, 130); labelAnimationSpeed.Location = new Point(6, 188);
labelAnimationSpeed.Margin = new Padding(6, 0, 6, 0); labelAnimationSpeed.Margin = new Padding(6, 0, 6, 0);
labelAnimationSpeed.Name = "labelAnimationSpeed"; labelAnimationSpeed.Name = "labelAnimationSpeed";
labelAnimationSpeed.Size = new Size(316, 33); labelAnimationSpeed.Size = new Size(316, 33);
@@ -632,7 +783,7 @@
// pictureBoxLightingColor // pictureBoxLightingColor
// //
pictureBoxLightingColor.Anchor = AnchorStyles.Top | AnchorStyles.Right; pictureBoxLightingColor.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pictureBoxLightingColor.Location = new Point(480, 62); pictureBoxLightingColor.Location = new Point(480, 120);
pictureBoxLightingColor.Margin = new Padding(6); pictureBoxLightingColor.Margin = new Padding(6);
pictureBoxLightingColor.Name = "pictureBoxLightingColor"; pictureBoxLightingColor.Name = "pictureBoxLightingColor";
pictureBoxLightingColor.Size = new Size(20, 20); pictureBoxLightingColor.Size = new Size(20, 20);
@@ -649,7 +800,7 @@
buttonLightingColor.BorderRadius = 2; buttonLightingColor.BorderRadius = 2;
buttonLightingColor.FlatStyle = FlatStyle.Flat; buttonLightingColor.FlatStyle = FlatStyle.Flat;
buttonLightingColor.ForeColor = SystemColors.ControlText; buttonLightingColor.ForeColor = SystemColors.ControlText;
buttonLightingColor.Location = new Point(373, 53); buttonLightingColor.Location = new Point(373, 111);
buttonLightingColor.Margin = new Padding(3, 6, 3, 6); buttonLightingColor.Margin = new Padding(3, 6, 3, 6);
buttonLightingColor.Name = "buttonLightingColor"; buttonLightingColor.Name = "buttonLightingColor";
buttonLightingColor.Secondary = false; buttonLightingColor.Secondary = false;
@@ -666,7 +817,7 @@
comboBoxLightingMode.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxLightingMode.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxLightingMode.FlatStyle = FlatStyle.Flat; comboBoxLightingMode.FlatStyle = FlatStyle.Flat;
comboBoxLightingMode.FormattingEnabled = true; comboBoxLightingMode.FormattingEnabled = true;
comboBoxLightingMode.Location = new Point(367, 14); comboBoxLightingMode.Location = new Point(367, 72);
comboBoxLightingMode.Margin = new Padding(16, 0, 16, 0); comboBoxLightingMode.Margin = new Padding(16, 0, 16, 0);
comboBoxLightingMode.Name = "comboBoxLightingMode"; comboBoxLightingMode.Name = "comboBoxLightingMode";
comboBoxLightingMode.Size = new Size(284, 33); comboBoxLightingMode.Size = new Size(284, 33);
@@ -674,7 +825,7 @@
// //
// labelLightingMode // labelLightingMode
// //
labelLightingMode.Location = new Point(7, 14); labelLightingMode.Location = new Point(7, 72);
labelLightingMode.Margin = new Padding(6, 0, 6, 0); labelLightingMode.Margin = new Padding(6, 0, 6, 0);
labelLightingMode.Name = "labelLightingMode"; labelLightingMode.Name = "labelLightingMode";
labelLightingMode.Size = new Size(316, 33); labelLightingMode.Size = new Size(316, 33);
@@ -739,7 +890,7 @@
panelEnergy.Controls.Add(labelAutoPowerOff); panelEnergy.Controls.Add(labelAutoPowerOff);
panelEnergy.Controls.Add(panelEnergyHeader); panelEnergy.Controls.Add(panelEnergyHeader);
panelEnergy.Dock = DockStyle.Top; panelEnergy.Dock = DockStyle.Top;
panelEnergy.Location = new Point(11, 747); panelEnergy.Location = new Point(11, 805);
panelEnergy.Name = "panelEnergy"; panelEnergy.Name = "panelEnergy";
panelEnergy.Padding = new Padding(0, 0, 0, 25); panelEnergy.Padding = new Padding(0, 0, 0, 25);
panelEnergy.Size = new Size(654, 143); panelEnergy.Size = new Size(654, 143);
@@ -920,11 +1071,72 @@
panelBottomButtons.AutoSizeMode = AutoSizeMode.GrowAndShrink; panelBottomButtons.AutoSizeMode = AutoSizeMode.GrowAndShrink;
panelBottomButtons.Controls.Add(buttonSync); panelBottomButtons.Controls.Add(buttonSync);
panelBottomButtons.Dock = DockStyle.Top; panelBottomButtons.Dock = DockStyle.Top;
panelBottomButtons.Location = new Point(11, 890); panelBottomButtons.Location = new Point(11, 948);
panelBottomButtons.Name = "panelBottomButtons"; panelBottomButtons.Name = "panelBottomButtons";
panelBottomButtons.Size = new Size(654, 67); panelBottomButtons.Size = new Size(654, 67);
panelBottomButtons.TabIndex = 47; panelBottomButtons.TabIndex = 47;
// //
// tableLayoutPanel2
//
tableLayoutPanel2.AutoSize = true;
tableLayoutPanel2.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tableLayoutPanel2.ColumnCount = 4;
tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableLayoutPanel2.Controls.Add(rButton1, 0, 0);
tableLayoutPanel2.Location = new Point(0, 0);
tableLayoutPanel2.Name = "tableLayoutPanel2";
tableLayoutPanel2.RowCount = 1;
tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
tableLayoutPanel2.Size = new Size(200, 100);
tableLayoutPanel2.TabIndex = 0;
//
// rButton1
//
rButton1.AccessibleName = "DPI Setting 2";
rButton1.Activated = false;
rButton1.BackColor = SystemColors.ControlLightLight;
rButton1.BorderColor = Color.Transparent;
rButton1.BorderRadius = 5;
rButton1.Dock = DockStyle.Top;
rButton1.FlatAppearance.BorderSize = 0;
rButton1.FlatStyle = FlatStyle.Flat;
rButton1.ForeColor = SystemColors.ControlText;
rButton1.Image = Properties.Resources.lighting_dot_32;
rButton1.ImageAlign = ContentAlignment.BottomCenter;
rButton1.Location = new Point(3, 3);
rButton1.Name = "rButton1";
rButton1.Secondary = false;
rButton1.Size = new Size(44, 90);
rButton1.TabIndex = 4;
rButton1.Text = "DPI 2\r\n1000";
rButton1.TextImageRelation = TextImageRelation.ImageAboveText;
rButton1.UseVisualStyleBackColor = false;
//
// rButton2
//
rButton2.AccessibleName = "DPI Setting 1";
rButton2.Activated = false;
rButton2.BackColor = SystemColors.ControlLightLight;
rButton2.BorderColor = Color.Transparent;
rButton2.BorderRadius = 5;
rButton2.CausesValidation = false;
rButton2.Dock = DockStyle.Top;
rButton2.FlatAppearance.BorderSize = 0;
rButton2.FlatStyle = FlatStyle.Flat;
rButton2.ForeColor = SystemColors.ControlText;
rButton2.Image = Properties.Resources.lighting_dot_32;
rButton2.Location = new Point(3, 3);
rButton2.Name = "rButton2";
rButton2.Secondary = false;
rButton2.Size = new Size(44, 90);
rButton2.TabIndex = 4;
rButton2.Text = "DPI 1\r\n800";
rButton2.TextImageRelation = TextImageRelation.ImageAboveText;
rButton2.UseVisualStyleBackColor = false;
//
// AsusMouseSettings // AsusMouseSettings
// //
AutoScaleDimensions = new SizeF(144F, 144F); AutoScaleDimensions = new SizeF(144F, 144F);
@@ -932,7 +1144,7 @@
AutoScroll = true; AutoScroll = true;
AutoSize = true; AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink; AutoSizeMode = AutoSizeMode.GrowAndShrink;
ClientSize = new Size(676, 1030); ClientSize = new Size(676, 1072);
Controls.Add(panelBottomButtons); Controls.Add(panelBottomButtons);
Controls.Add(panelEnergy); Controls.Add(panelEnergy);
Controls.Add(panelLighting); Controls.Add(panelLighting);
@@ -966,6 +1178,9 @@
panelLighting.ResumeLayout(false); panelLighting.ResumeLayout(false);
panelLighting.PerformLayout(); panelLighting.PerformLayout();
panelLightingContent.ResumeLayout(false); panelLightingContent.ResumeLayout(false);
panelLightingContent.PerformLayout();
tableLayoutPanel3.ResumeLayout(false);
tableLayoutPanel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxLightingColor).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxLightingColor).EndInit();
panelLightingHeader.ResumeLayout(false); panelLightingHeader.ResumeLayout(false);
panelLightingHeader.PerformLayout(); panelLightingHeader.PerformLayout();
@@ -979,6 +1194,7 @@
panelBatteryState.PerformLayout(); panelBatteryState.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxBatteryState).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxBatteryState).EndInit();
panelBottomButtons.ResumeLayout(false); panelBottomButtons.ResumeLayout(false);
tableLayoutPanel2.ResumeLayout(false);
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
@@ -1047,5 +1263,14 @@
private UI.RButton buttonSync; private UI.RButton buttonSync;
private Panel panelBottomButtons; private Panel panelBottomButtons;
private NumericUpDown numericUpDownCurrentDPI; private NumericUpDown numericUpDownCurrentDPI;
private TableLayoutPanel tableLayoutPanel3;
private UI.RButton buttonLightingZoneScroll;
private UI.RButton buttonLightingZoneLogo;
private UI.RButton buttonLightingZoneAll;
private UI.RButton buttonLightingZoneUnderglow;
private UI.RButton buttonLightingZoneDock;
private TableLayoutPanel tableLayoutPanel2;
private UI.RButton rButton1;
private UI.RButton rButton2;
} }
} }

View File

@@ -20,6 +20,7 @@ namespace GHelper
private readonly AsusMouse mouse; private readonly AsusMouse mouse;
private readonly RButton[] dpiButtons; private readonly RButton[] dpiButtons;
private LightingZone visibleZone = LightingZone.All;
private bool updateMouseDPI = true; private bool updateMouseDPI = true;
@@ -33,6 +34,7 @@ namespace GHelper
labelPollingRate.Text = Properties.Strings.PollingRate; labelPollingRate.Text = Properties.Strings.PollingRate;
labelLighting.Text = Properties.Strings.Lighting; labelLighting.Text = Properties.Strings.Lighting;
labelLightingMode.Text = Properties.Strings.AuraLightingMode;
labelEnergy.Text = Properties.Strings.EnergySettings; labelEnergy.Text = Properties.Strings.EnergySettings;
labelPerformance.Text = Properties.Strings.MousePerformance; labelPerformance.Text = Properties.Strings.MousePerformance;
checkBoxRandomColor.Text = Properties.Strings.AuraRandomColor; checkBoxRandomColor.Text = Properties.Strings.AuraRandomColor;
@@ -44,6 +46,12 @@ namespace GHelper
labelChargingState.Text = "(" + Properties.Strings.Charging + ")"; labelChargingState.Text = "(" + Properties.Strings.Charging + ")";
labelProfile.Text = Properties.Strings.Profile; labelProfile.Text = Properties.Strings.Profile;
buttonLightingZoneLogo.Text = Properties.Strings.AuraZoneLogo;
buttonLightingZoneScroll.Text = Properties.Strings.AuraZoneScroll;
buttonLightingZoneUnderglow.Text = Properties.Strings.AuraZoneUnderglow;
buttonLightingZoneAll.Text = Properties.Strings.AuraZoneAll;
buttonLightingZoneDock.Text = Properties.Strings.AuraZoneDock;
InitTheme(); InitTheme();
this.Text = mouse.GetDisplayName(); this.Text = mouse.GetDisplayName();
@@ -80,11 +88,54 @@ namespace GHelper
sliderLowBatteryWarning.MouseUp += SliderLowBatteryWarning_MouseUp; sliderLowBatteryWarning.MouseUp += SliderLowBatteryWarning_MouseUp;
comboBoxAutoPowerOff.DropDownClosed += ComboBoxAutoPowerOff_DropDownClosed; comboBoxAutoPowerOff.DropDownClosed += ComboBoxAutoPowerOff_DropDownClosed;
buttonLightingZoneAll.Click += ButtonLightingZoneAll_Click;
buttonLightingZoneDock.Click += ButtonLightingZoneDock_Click;
buttonLightingZoneLogo.Click += ButtonLightingZoneLogo_Click;
buttonLightingZoneUnderglow.Click += ButtonLightingZoneUnderglow_Click;
buttonLightingZoneScroll.Click += ButtonLightingZoneScroll_Click;
InitMouseCapabilities(); InitMouseCapabilities();
Logger.WriteLine(mouse.GetDisplayName() + " (GUI): Initialized capabilities. Synchronizing mouse data"); Logger.WriteLine(mouse.GetDisplayName() + " (GUI): Initialized capabilities. Synchronizing mouse data");
RefreshMouseData(); RefreshMouseData();
} }
private void SwitchLightingZone(LightingZone zone)
{
if (!mouse.HasRGB())
{
return;
}
visibleZone = zone;
InitLightingModes();
VisusalizeLightingSettings();
}
private void ButtonLightingZoneScroll_Click(object? sender, EventArgs e)
{
SwitchLightingZone(LightingZone.Scrollwheel);
}
private void ButtonLightingZoneUnderglow_Click(object? sender, EventArgs e)
{
SwitchLightingZone(LightingZone.Underglow);
}
private void ButtonLightingZoneLogo_Click(object? sender, EventArgs e)
{
SwitchLightingZone(LightingZone.Logo);
}
private void ButtonLightingZoneDock_Click(object? sender, EventArgs e)
{
SwitchLightingZone(LightingZone.Dock);
}
private void ButtonLightingZoneAll_Click(object? sender, EventArgs e)
{
SwitchLightingZone(LightingZone.All);
}
private void AsusMouseSettings_FormClosing(object? sender, FormClosingEventArgs e) private void AsusMouseSettings_FormClosing(object? sender, FormClosingEventArgs e)
{ {
mouse.BatteryUpdated -= Mouse_BatteryUpdated; mouse.BatteryUpdated -= Mouse_BatteryUpdated;
@@ -175,40 +226,42 @@ namespace GHelper
VisualizeCurrentDPIProfile(); VisualizeCurrentDPIProfile();
} }
private void UpdateLightingSettings(LightingSetting settings, LightingZone zone)
{
mouse.SetLightingSetting(settings, visibleZone);
VisusalizeLightingSettings();
}
private void CheckBoxRandomColor_CheckedChanged(object? sender, EventArgs e) private void CheckBoxRandomColor_CheckedChanged(object? sender, EventArgs e)
{ {
LightingSetting? ls = mouse.LightingSetting; LightingSetting? ls = mouse.LightingSettingForZone(visibleZone);
ls.RandomColor = checkBoxRandomColor.Checked; ls.RandomColor = checkBoxRandomColor.Checked;
mouse.SetLightingSetting(ls); UpdateLightingSettings(ls, visibleZone);
VisusalizeLightingSettings();
} }
private void ComboBoxAnimationDirection_DropDownClosed(object? sender, EventArgs e) private void ComboBoxAnimationDirection_DropDownClosed(object? sender, EventArgs e)
{ {
LightingSetting? ls = mouse.LightingSetting; LightingSetting? ls = mouse.LightingSettingForZone(visibleZone);
ls.AnimationDirection = (AnimationDirection)comboBoxAnimationDirection.SelectedIndex; ls.AnimationDirection = (AnimationDirection)comboBoxAnimationDirection.SelectedIndex;
mouse.SetLightingSetting(ls); UpdateLightingSettings(ls, visibleZone);
VisusalizeLightingSettings();
} }
private void ComboBoxAnimationSpeed_DropDownClosed(object? sender, EventArgs e) private void ComboBoxAnimationSpeed_DropDownClosed(object? sender, EventArgs e)
{ {
LightingSetting? ls = mouse.LightingSetting; LightingSetting? ls = mouse.LightingSettingForZone(visibleZone);
ls.AnimationSpeed = (AnimationSpeed)comboBoxAnimationSpeed.SelectedIndex; ls.AnimationSpeed = (AnimationSpeed)comboBoxAnimationSpeed.SelectedIndex;
mouse.SetLightingSetting(ls); UpdateLightingSettings(ls, visibleZone);
VisusalizeLightingSettings();
} }
private void SliderBrightness_MouseUp(object? sender, MouseEventArgs e) private void SliderBrightness_MouseUp(object? sender, MouseEventArgs e)
{ {
LightingSetting? ls = mouse.LightingSetting; LightingSetting? ls = mouse.LightingSettingForZone(visibleZone);
ls.Brightness = sliderBrightness.Value; ls.Brightness = sliderBrightness.Value;
mouse.SetLightingSetting(ls); UpdateLightingSettings(ls, visibleZone);
} }
private void ComboBoxLightingMode_DropDownClosed(object? sender, EventArgs e) private void ComboBoxLightingMode_DropDownClosed(object? sender, EventArgs e)
@@ -220,11 +273,16 @@ namespace GHelper
LightingMode lm = supportedLightingModes[comboBoxLightingMode.SelectedIndex]; LightingMode lm = supportedLightingModes[comboBoxLightingMode.SelectedIndex];
LightingSetting? ls = mouse.LightingSetting; LightingSetting? ls = mouse.LightingSettingForZone(visibleZone);
if (ls.LightingMode == lm)
{
//Nothing to do here.
return;
}
ls.LightingMode = lm; ls.LightingMode = lm;
mouse.SetLightingSetting(ls); UpdateLightingSettings(ls, visibleZone);
VisusalizeLightingSettings();
} }
private void ButtonLightingColor_Click(object? sender, EventArgs e) private void ButtonLightingColor_Click(object? sender, EventArgs e)
@@ -237,11 +295,10 @@ namespace GHelper
if (colorDlg.ShowDialog() == DialogResult.OK) if (colorDlg.ShowDialog() == DialogResult.OK)
{ {
LightingSetting? ls = mouse.LightingSetting; LightingSetting? ls = mouse.LightingSettingForZone(visibleZone);
ls.RGBColor = colorDlg.Color; ls.RGBColor = colorDlg.Color;
mouse.SetLightingSetting(ls); UpdateLightingSettings(ls, visibleZone);
VisusalizeLightingSettings();
} }
} }
@@ -475,16 +532,14 @@ namespace GHelper
if (mouse.HasRGB()) if (mouse.HasRGB())
{ {
buttonLightingZoneLogo.Visible = mouse.SupportedLightingZones().Contains(LightingZone.Logo);
buttonLightingZoneScroll.Visible = mouse.SupportedLightingZones().Contains(LightingZone.Scrollwheel);
buttonLightingZoneUnderglow.Visible = mouse.SupportedLightingZones().Contains(LightingZone.Underglow);
buttonLightingZoneDock.Visible = mouse.SupportedLightingZones().Contains(LightingZone.Dock);
sliderBrightness.Max = mouse.MaxBrightness(); sliderBrightness.Max = mouse.MaxBrightness();
foreach (LightingMode lm in Enum.GetValues(typeof(LightingMode))) InitLightingModes();
{
if (mouse.IsLightingModeSupported(lm))
{
comboBoxLightingMode.Items.Add(lightingModeNames.GetValueOrDefault(lm));
supportedLightingModes.Add(lm);
}
}
comboBoxAnimationDirection.Items.AddRange(new string[] { comboBoxAnimationDirection.Items.AddRange(new string[] {
Properties.Strings.AuraClockwise, Properties.Strings.AuraClockwise,
@@ -503,11 +558,37 @@ namespace GHelper
} }
} }
private void InitLightingModes()
{
comboBoxLightingMode.Items.Clear();
supportedLightingModes.Clear();
foreach (LightingMode lm in Enum.GetValues(typeof(LightingMode)))
{
if (mouse.IsLightingModeSupported(lm) && mouse.IsLightingModeSupportedForZone(lm, visibleZone))
{
comboBoxLightingMode.Items.Add(lightingModeNames.GetValueOrDefault(lm));
supportedLightingModes.Add(lm);
}
}
}
private void VisualizeMouseSettings() private void VisualizeMouseSettings()
{ {
comboProfile.SelectedIndex = mouse.Profile; comboProfile.SelectedIndex = mouse.Profile;
if (mouse.HasRGB())
{
//If current lighting mode is zoned, pre-select the first zone and not "All".
bool zoned = mouse.IsLightingZoned();
if (zoned)
{
visibleZone = mouse.SupportedLightingZones()[0];
InitLightingModes();
}
}
VisualizeDPIButtons(); VisualizeDPIButtons();
VisualizeCurrentDPIProfile(); VisualizeCurrentDPIProfile();
VisusalizeLightingSettings(); VisusalizeLightingSettings();
@@ -575,6 +656,29 @@ namespace GHelper
} }
} }
public void VisusalizeLightingZones()
{
bool zoned = mouse.IsLightingZoned();
buttonLightingZoneAll.Activated = visibleZone == LightingZone.All;
buttonLightingZoneLogo.Activated = visibleZone == LightingZone.Logo;
buttonLightingZoneScroll.Activated = visibleZone == LightingZone.Scrollwheel;
buttonLightingZoneUnderglow.Activated = visibleZone == LightingZone.Underglow;
buttonLightingZoneDock.Activated = visibleZone == LightingZone.Dock;
buttonLightingZoneAll.Secondary = zoned;
buttonLightingZoneLogo.Secondary = !zoned;
buttonLightingZoneScroll.Secondary = !zoned;
buttonLightingZoneUnderglow.Secondary = !zoned;
buttonLightingZoneDock.Secondary = !zoned;
buttonLightingZoneAll.BackColor = buttonLightingZoneAll.Secondary ? RForm.buttonSecond : RForm.buttonMain;
buttonLightingZoneLogo.BackColor = buttonLightingZoneLogo.Secondary ? RForm.buttonSecond : RForm.buttonMain;
buttonLightingZoneScroll.BackColor = buttonLightingZoneScroll.Secondary ? RForm.buttonSecond : RForm.buttonMain;
buttonLightingZoneUnderglow.BackColor = buttonLightingZoneUnderglow.Secondary ? RForm.buttonSecond : RForm.buttonMain;
buttonLightingZoneDock.BackColor = buttonLightingZoneDock.Secondary ? RForm.buttonSecond : RForm.buttonMain;
}
private void VisusalizeLightingSettings() private void VisusalizeLightingSettings()
{ {
if (!mouse.HasRGB()) if (!mouse.HasRGB())
@@ -582,7 +686,9 @@ namespace GHelper
return; return;
} }
LightingSetting? ls = mouse.LightingSetting; VisusalizeLightingZones();
LightingSetting? ls = mouse.LightingSettingForZone(visibleZone);
if (ls is null) if (ls is null)
{ {

View File

@@ -56,6 +56,15 @@ namespace GHelper.Peripherals.Mouse
BatteryState = 0x6 BatteryState = 0x6
} }
public enum LightingZone
{
Logo = 0x00,
Scrollwheel = 0x01,
Underglow = 0x02,
All = 0x03,
Dock = 0x04,
}
public class LightingSetting public class LightingSetting
{ {
public LightingSetting() public LightingSetting()
@@ -77,11 +86,29 @@ namespace GHelper.Peripherals.Mouse
public AnimationDirection AnimationDirection { get; set; } public AnimationDirection AnimationDirection { get; set; }
public override bool Equals(object? obj)
{
return obj is LightingSetting setting &&
LightingMode == setting.LightingMode &&
Brightness == setting.Brightness &&
RGBColor.Equals(setting.RGBColor) &&
RandomColor == setting.RandomColor &&
AnimationSpeed == setting.AnimationSpeed &&
AnimationDirection == setting.AnimationDirection;
}
public override int GetHashCode()
{
return HashCode.Combine(LightingMode, Brightness, RGBColor, RandomColor, AnimationSpeed, AnimationDirection);
}
public override string? ToString() public override string? ToString()
{ {
return "LightingMode: " + LightingMode + ", Color (" + RGBColor.R + ", " + RGBColor.G + ", " + RGBColor.B return "LightingMode: " + LightingMode + ", Color (" + RGBColor.R + ", " + RGBColor.G + ", " + RGBColor.B
+ "), Brightness: " + Brightness + "%, LightingSpeed: " + AnimationSpeed + ", RandomColor:" + RandomColor + ", AnimationDirection:" + AnimationDirection; + "), Brightness: " + Brightness + "%, LightingSpeed: " + AnimationSpeed + ", RandomColor:" + RandomColor + ", AnimationDirection:" + AnimationDirection;
} }
} }
public class AsusMouseDPI public class AsusMouseDPI
@@ -102,7 +129,7 @@ namespace GHelper.Peripherals.Mouse
public abstract class AsusMouse : Device, IPeripheral public abstract class AsusMouse : Device, IPeripheral
{ {
private static string[] POLLING_RATES = { "125 Hz", "250 Hz", "500 Hz", "1000 Hz", "2000 Hz", "4000 Hz", "8000 Hz", "16000 Hz" }; private static string[] POLLING_RATES = { "125 Hz", "250 Hz", "500 Hz", "1000 Hz", "2000 Hz", "4000 Hz", "8000 Hz", "16000 Hz" };
internal const bool PACKET_LOGGER_ALWAYS_ON = false; internal const bool PACKET_LOGGER_ALWAYS_ON = true;
internal const int ASUS_MOUSE_PACKET_SIZE = 65; internal const int ASUS_MOUSE_PACKET_SIZE = 65;
public event EventHandler? Disconnect; public event EventHandler? Disconnect;
@@ -131,7 +158,7 @@ namespace GHelper.Peripherals.Mouse
public bool Wireless { get; protected set; } public bool Wireless { get; protected set; }
public int Battery { get; protected set; } public int Battery { get; protected set; }
public bool Charging { get; protected set; } public bool Charging { get; protected set; }
public LightingSetting? LightingSetting { get; protected set; } public LightingSetting[] LightingSetting { get; protected set; }
public int LowBatteryWarning { get; protected set; } public int LowBatteryWarning { get; protected set; }
public PowerOffSetting PowerOffSetting { get; protected set; } public PowerOffSetting PowerOffSetting { get; protected set; }
public LiftOffDistance LiftOffDistance { get; protected set; } public LiftOffDistance LiftOffDistance { get; protected set; }
@@ -147,6 +174,7 @@ namespace GHelper.Peripherals.Mouse
this.path = path; this.path = path;
this.Wireless = wireless; this.Wireless = wireless;
DpiSettings = new AsusMouseDPI[1]; DpiSettings = new AsusMouseDPI[1];
LightingSetting = new LightingSetting[SupportedLightingZones().Length];
} }
public override bool Equals(object? obj) public override bool Equals(object? obj)
@@ -1038,31 +1066,97 @@ namespace GHelper.Peripherals.Mouse
|| lightingMode == LightingMode.React; || lightingMode == LightingMode.React;
} }
protected virtual byte[] GetReadLightingModePacket() public virtual LightingZone[] SupportedLightingZones()
{ {
return new byte[] { 0x00, 0x12, 0x03 }; return new LightingZone[] { };
} }
protected virtual byte[] GetUpdateLightingModePacket(LightingSetting lightingSetting) public virtual int IndexForZone(LightingZone zone)
{ {
if (lightingSetting.Brightness < 0 || lightingSetting.Brightness > 100) LightingZone[] lz = SupportedLightingZones();
for (int i = 0; i < lz.Length; ++i)
{ {
Logger.WriteLine(GetDisplayName() + ": Brightness " + lightingSetting.Brightness + " is out of range [0;100]. Setting to 25."); if (lz[i] == zone)
lightingSetting.Brightness = 25; {
return i;
}
}
return 0;
}
public virtual bool IsLightingZoned()
{
//Check whether all zones are the same or not
for (int i = 1; i < LightingSetting.Length; ++i)
{
if (LightingSetting[i] is null
|| LightingSetting[i - 1] is null
|| !LightingSetting[i].Equals(LightingSetting[i - 1]))
{
return true;
}
}
return false;
}
public virtual bool IsLightingModeSupportedForZone(LightingMode lm, LightingZone lz)
{
if (lz == LightingZone.All)
{
return true;
}
return lm == LightingMode.Static
|| lm == LightingMode.Breathing
|| lm == LightingMode.ColorCycle
|| lm == LightingMode.React;
}
public virtual LightingSetting LightingSettingForZone(LightingZone zone)
{
if (zone == LightingZone.All)
{
//First zone is treated as ALL for reading purpose
return LightingSetting[0];
}
return LightingSetting[IndexForZone(zone)];
}
protected virtual byte[] GetReadLightingModePacket(LightingZone zone)
{
int idx = 0;
if (zone != LightingZone.All)
{
idx = IndexForZone(zone);
}
return new byte[] { 0x00, 0x12, 0x03, (byte)idx };
}
protected virtual byte[] GetUpdateLightingModePacket(LightingSetting lightingSetting, LightingZone zone)
{
if (lightingSetting.Brightness < 0 || lightingSetting.Brightness > MaxBrightness())
{
Logger.WriteLine(GetDisplayName() + ": Brightness " + lightingSetting.Brightness
+ " is out of range [0;" + MaxBrightness() + "]. Setting to " + (MaxBrightness() / 4) + " .");
lightingSetting.Brightness = MaxBrightness() / 4; // set t0 25% of max brightness
} }
if (!IsLightingModeSupported(lightingSetting.LightingMode)) if (!IsLightingModeSupported(lightingSetting.LightingMode))
{ {
Logger.WriteLine(GetDisplayName() + ": Lighting Mode " + lightingSetting.LightingMode + " is not supported. Setting to Rainbow ;)"); Logger.WriteLine(GetDisplayName() + ": Lighting Mode " + lightingSetting.LightingMode + " is not supported. Setting to Color Cycle ;)");
lightingSetting.LightingMode = LightingMode.Rainbow; lightingSetting.LightingMode = LightingMode.ColorCycle;
} }
return new byte[] { 0x00, 0x51, 0x28, 0x03, 0x00, return new byte[] { 0x00, 0x51, 0x28, (byte)zone, 0x00,
IndexForLightingMode(lightingSetting.LightingMode), IndexForLightingMode(lightingSetting.LightingMode),
(byte)lightingSetting.Brightness, (byte)lightingSetting.Brightness,
lightingSetting.RGBColor.R, lightingSetting.RGBColor.G, lightingSetting.RGBColor.B, lightingSetting.RGBColor.R, lightingSetting.RGBColor.G, lightingSetting.RGBColor.B,
(byte)lightingSetting.AnimationDirection, (byte)(SupportsAnimationDirection(lightingSetting.LightingMode) ? lightingSetting.AnimationDirection : 0x00),
(byte)(lightingSetting.RandomColor ? 0x01: 0x00), (byte)((lightingSetting.RandomColor && SupportsRandomColor(lightingSetting.LightingMode)) ? 0x01: 0x00),
(byte)lightingSetting.AnimationSpeed (byte)(SupportsAnimationSpeed(lightingSetting.LightingMode) ? lightingSetting.AnimationSpeed : 0x00)
}; };
} }
@@ -1079,11 +1173,18 @@ namespace GHelper.Peripherals.Mouse
setting.Brightness = packet[6]; setting.Brightness = packet[6];
setting.RGBColor = Color.FromArgb(packet[7], packet[8], packet[9]); setting.RGBColor = Color.FromArgb(packet[7], packet[8], packet[9]);
setting.AnimationDirection = (AnimationDirection)packet[11];
setting.RandomColor = packet[12] == 0x01;
setting.AnimationSpeed = (AnimationSpeed)packet[13];
//If the mouse reports 0, which it does when the current setting has no speed option, chose medium as default
setting.AnimationDirection = SupportsAnimationDirection(setting.LightingMode)
? (AnimationDirection)packet[11]
: AnimationDirection.Clockwise;
setting.RandomColor = SupportsRandomColor(setting.LightingMode) && packet[12] == 0x01;
setting.AnimationSpeed = SupportsAnimationSpeed(setting.LightingMode)
? (AnimationSpeed)packet[13]
: AnimationSpeed.Medium;
//If the mouse reports an out of range value, which it does when the current setting has no speed option, chose medium as default
if (setting.AnimationSpeed != AnimationSpeed.Fast if (setting.AnimationSpeed != AnimationSpeed.Fast
&& setting.AnimationSpeed != AnimationSpeed.Medium && setting.AnimationSpeed != AnimationSpeed.Medium
&& setting.AnimationSpeed != AnimationSpeed.Slow) && setting.AnimationSpeed != AnimationSpeed.Slow)
@@ -1100,33 +1201,47 @@ namespace GHelper.Peripherals.Mouse
{ {
return; return;
} }
byte[]? response = WriteForResponse(GetReadLightingModePacket());
if (response is null) return;
LightingSetting = ParseLightingSetting(response); LightingZone[] lz = SupportedLightingZones();
for (int i = 0; i < lz.Length; ++i)
{
byte[]? response = WriteForResponse(GetReadLightingModePacket(lz[i]));
if (response is null) return;
if (LightingSetting is not null) LightingSetting? ls = ParseLightingSetting(response);
{ if (ls is null)
Logger.WriteLine(GetDisplayName() + ": Read RGB Setting" + LightingSetting.ToString()); {
} Logger.WriteLine(GetDisplayName() + ": Failed to read RGB Setting for Zone " + lz[i].ToString());
else continue;
{ }
Logger.WriteLine(GetDisplayName() + ": Failed to read RGB Setting");
Logger.WriteLine(GetDisplayName() + ": Read RGB Setting for Zone " + lz[i].ToString() + ": " + ls.ToString());
LightingSetting[i] = ls;
} }
} }
public void SetLightingSetting(LightingSetting lightingSetting) public void SetLightingSetting(LightingSetting lightingSetting, LightingZone zone)
{ {
if (!HasRGB() || lightingSetting is null) if (!HasRGB() || lightingSetting is null)
{ {
return; return;
} }
WriteForResponse(GetUpdateLightingModePacket(lightingSetting)); WriteForResponse(GetUpdateLightingModePacket(lightingSetting, zone));
FlushSettings(); FlushSettings();
Logger.WriteLine(GetDisplayName() + ": Set RGB Setting " + lightingSetting.ToString()); Logger.WriteLine(GetDisplayName() + ": Set RGB Setting for zone " + zone.ToString() + ": " + lightingSetting.ToString());
this.LightingSetting = lightingSetting; if (zone == LightingZone.All)
{
for (int i = 0; i < this.LightingSetting.Length; ++i)
{
this.LightingSetting[i] = lightingSetting;
}
}
else
{
this.LightingSetting[IndexForZone(zone)] = lightingSetting;
}
} }
protected virtual byte[] GetSaveProfilePacket() protected virtual byte[] GetSaveProfilePacket()

View File

@@ -60,6 +60,11 @@ namespace GHelper.Peripherals.Mouse.Models
return true; return true;
} }
public override LightingZone[] SupportedLightingZones()
{
return new LightingZone[] { LightingZone.Logo, LightingZone.Scrollwheel, LightingZone.Underglow };
}
public override bool HasAutoPowerOff() public override bool HasAutoPowerOff()
{ {
return true; return true;

View File

@@ -55,6 +55,11 @@
return true; return true;
} }
public override LightingZone[] SupportedLightingZones()
{
return new LightingZone[] { LightingZone.Logo, LightingZone.Scrollwheel, LightingZone.Underglow };
}
public override bool HasAutoPowerOff() public override bool HasAutoPowerOff()
{ {
return true; return true;

View File

@@ -258,6 +258,15 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Lighting Mode.
/// </summary>
internal static string AuraLightingMode {
get {
return ResourceManager.GetString("AuraLightingMode", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Normal. /// Looks up a localized string similar to Normal.
/// </summary> /// </summary>
@@ -321,6 +330,51 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to All.
/// </summary>
internal static string AuraZoneAll {
get {
return ResourceManager.GetString("AuraZoneAll", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Dock.
/// </summary>
internal static string AuraZoneDock {
get {
return ResourceManager.GetString("AuraZoneDock", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Logo.
/// </summary>
internal static string AuraZoneLogo {
get {
return ResourceManager.GetString("AuraZoneLogo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Scrollwheel.
/// </summary>
internal static string AuraZoneScroll {
get {
return ResourceManager.GetString("AuraZoneScroll", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Underglow.
/// </summary>
internal static string AuraZoneUnderglow {
get {
return ResourceManager.GetString("AuraZoneUnderglow", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Auto Apply. /// Looks up a localized string similar to Auto Apply.
/// </summary> /// </summary>

View File

@@ -183,6 +183,9 @@
<data name="AuraFast" xml:space="preserve"> <data name="AuraFast" xml:space="preserve">
<value>Fast</value> <value>Fast</value>
</data> </data>
<data name="AuraLightingMode" xml:space="preserve">
<value>Lighting Mode</value>
</data>
<data name="AuraNormal" xml:space="preserve"> <data name="AuraNormal" xml:space="preserve">
<value>Normal</value> <value>Normal</value>
</data> </data>
@@ -204,6 +207,21 @@
<data name="AuraStrobe" xml:space="preserve"> <data name="AuraStrobe" xml:space="preserve">
<value>Strobe</value> <value>Strobe</value>
</data> </data>
<data name="AuraZoneAll" xml:space="preserve">
<value>All</value>
</data>
<data name="AuraZoneDock" xml:space="preserve">
<value>Dock</value>
</data>
<data name="AuraZoneLogo" xml:space="preserve">
<value>Logo</value>
</data>
<data name="AuraZoneScroll" xml:space="preserve">
<value>Scrollwheel</value>
</data>
<data name="AuraZoneUnderglow" xml:space="preserve">
<value>Underglow</value>
</data>
<data name="AutoApply" xml:space="preserve"> <data name="AutoApply" xml:space="preserve">
<value>Auto Apply</value> <value>Auto Apply</value>
</data> </data>