diff --git a/YAMDCC.Config/FanCurveConf.cs b/YAMDCC.Config/FanCurveConf.cs index e882bcc..37a5964 100644 --- a/YAMDCC.Config/FanCurveConf.cs +++ b/YAMDCC.Config/FanCurveConf.cs @@ -36,6 +36,23 @@ public sealed class FanCurveConf [XmlElement] public string Desc { get; set; } + /// + /// The to use with this fan profile, + /// as an index of the available performance modes. + /// + /// + /// + /// This setting is ignored if this + /// is not for the first fan in the computer. + /// + /// + /// Set to -1 to use the default performance mode + /// (as set by ). + /// + /// + [XmlElement] + public int PerfModeSel { get; set; } = -1; + /// /// The fan speeds and associated up and down thresholds. /// diff --git a/YAMDCC.Config/PerfModeConf.cs b/YAMDCC.Config/PerfModeConf.cs index a05d74b..8cca725 100644 --- a/YAMDCC.Config/PerfModeConf.cs +++ b/YAMDCC.Config/PerfModeConf.cs @@ -32,8 +32,8 @@ public sealed class PerfModeConf public byte Reg { get; set; } /// - /// The currently selected performance mode, as - /// an index of the available performance modes. + /// The default performance mode, as an index of the available + /// performance modes, when not overriden by a . /// [XmlElement] public int ModeSel { get; set; } diff --git a/YAMDCC.Config/YAMDCC_Config.cs b/YAMDCC.Config/YAMDCC_Config.cs index 0573c4f..0fa77ad 100644 --- a/YAMDCC.Config/YAMDCC_Config.cs +++ b/YAMDCC.Config/YAMDCC_Config.cs @@ -247,6 +247,12 @@ private bool IsValid() return false; } + // all fans must have same number of fan profiles now + if (!FansHaveSameProfCount()) + { + return false; + } + // YAMDCC doesn't handle MinSpeed lower than MaxSpeed, // so return false if MinSpeed is lower or equal to MaxSpeed: if (cfg.MinSpeed >= cfg.MaxSpeed) @@ -270,7 +276,7 @@ private bool IsValid() // and fan curve registers // - there are the same amount of up threshold registers // as down threshold registers - // - there is one more fan curve register than up/down threshold registers + // - there is one more fan profile register than up/down threshold registers // - there is at least one fan profile to apply (first should be Default) if (cfg.UpThresholdRegs?.Length < 1 || cfg.UpThresholdRegs?.Length != cfg.DownThresholdRegs?.Length || @@ -286,7 +292,7 @@ private bool IsValid() if (string.IsNullOrEmpty(curveCfg.Name) || string.IsNullOrEmpty(curveCfg.Desc) || // there should be exactly one temperature threshold - // per fan curve register; if there isn't, return false + // per fan proffile register; if there isn't, return false curveCfg.TempThresholds?.Count != cfg.FanCurveRegs.Length) { return false; @@ -415,4 +421,16 @@ private bool IsValid() // expected to be nonzero. return true; } + + private bool FansHaveSameProfCount() + { + for (int i = 0; i < FanConfs.Count - 1; i++) + { + if (FanConfs[i].FanCurveConfs.Count != FanConfs[i + 1].FanCurveConfs.Count) + { + return false; + } + } + return true; + } } diff --git a/YAMDCC.ConfigEditor/MainForm.Designer.cs b/YAMDCC.ConfigEditor/MainForm.Designer.cs index 5e346c4..a218144 100644 --- a/YAMDCC.ConfigEditor/MainForm.Designer.cs +++ b/YAMDCC.ConfigEditor/MainForm.Designer.cs @@ -54,7 +54,6 @@ private void InitializeComponent() System.Windows.Forms.ToolStripMenuItem tsiCheckUpdate; System.Windows.Forms.TabControl tcMain; System.Windows.Forms.TabPage tabFanControl; - System.Windows.Forms.FlowLayoutPanel flwFanSelect; System.Windows.Forms.TabPage tabExtra; System.Windows.Forms.TableLayoutPanel tblExtra; System.Windows.Forms.Label lblFanMode; @@ -68,10 +67,10 @@ private void InitializeComponent() System.Windows.Forms.Label lblModel; System.Windows.Forms.Label lblManufacturer; System.Windows.Forms.Label lblAuthor; - System.Windows.Forms.TableLayoutPanel tblApply; - System.Windows.Forms.FlowLayoutPanel flwStats; System.Windows.Forms.Label lblFirmVer; System.Windows.Forms.Label lblFirmDate; + System.Windows.Forms.TableLayoutPanel tblApply; + System.Windows.Forms.FlowLayoutPanel flwStats; this.tsiFile = new System.Windows.Forms.ToolStripMenuItem(); this.tsiLoadConf = new System.Windows.Forms.ToolStripMenuItem(); this.tsiSaveConf = new System.Windows.Forms.ToolStripMenuItem(); @@ -84,7 +83,6 @@ private void InitializeComponent() this.tsiProfRen = new System.Windows.Forms.ToolStripMenuItem(); this.tsiProfChangeDesc = new System.Windows.Forms.ToolStripMenuItem(); this.tsiProfDel = new System.Windows.Forms.ToolStripMenuItem(); - this.tsiSwitchAll = new System.Windows.Forms.ToolStripMenuItem(); this.tsiECtoConf = new System.Windows.Forms.ToolStripMenuItem(); this.tsiECMon = new System.Windows.Forms.ToolStripMenuItem(); this.tsiAdvanced = new System.Windows.Forms.ToolStripMenuItem(); @@ -100,13 +98,15 @@ private void InitializeComponent() this.tsiAbout = new System.Windows.Forms.ToolStripMenuItem(); this.tsiSource = new System.Windows.Forms.ToolStripMenuItem(); this.tblFanControl = new System.Windows.Forms.TableLayoutPanel(); - this.tblCurve = new System.Windows.Forms.TableLayoutPanel(); - this.lblFanSel = new System.Windows.Forms.Label(); - this.cboFanSel = new System.Windows.Forms.ComboBox(); - this.lblProfSel = new System.Windows.Forms.Label(); - this.cboProfSel = new System.Windows.Forms.ComboBox(); - this.btnProfAdd = new System.Windows.Forms.Button(); + this.cboProfPerfMode = new System.Windows.Forms.ComboBox(); + this.lblProfPerfMode = new System.Windows.Forms.Label(); this.btnProfDel = new System.Windows.Forms.Button(); + this.btnProfAdd = new System.Windows.Forms.Button(); + this.cboProfSel = new System.Windows.Forms.ComboBox(); + this.lblProfSel = new System.Windows.Forms.Label(); + this.cboFanSel = new System.Windows.Forms.ComboBox(); + this.lblFanSel = new System.Windows.Forms.Label(); + this.tblCurve = new System.Windows.Forms.TableLayoutPanel(); this.cboFanMode = new System.Windows.Forms.ComboBox(); this.cboPerfMode = new System.Windows.Forms.ComboBox(); this.chkWinFnSwap = new System.Windows.Forms.CheckBox(); @@ -116,10 +116,12 @@ private void InitializeComponent() this.chkChgLim = new System.Windows.Forms.CheckBox(); this.numChgLim = new System.Windows.Forms.NumericUpDown(); this.tabInfo = new System.Windows.Forms.TabPage(); + this.txtFirmDate = new System.Windows.Forms.TextBox(); this.txtModel = new System.Windows.Forms.TextBox(); this.txtManufacturer = new System.Windows.Forms.TextBox(); this.txtAuthor = new System.Windows.Forms.TextBox(); this.btnGetModel = new System.Windows.Forms.Button(); + this.txtFirmVer = new System.Windows.Forms.TextBox(); this.chkFullBlast = new System.Windows.Forms.CheckBox(); this.btnRevert = new System.Windows.Forms.Button(); this.btnApply = new System.Windows.Forms.Button(); @@ -128,8 +130,6 @@ private void InitializeComponent() this.lblFanRPM = new System.Windows.Forms.Label(); this.lblTemp = new System.Windows.Forms.Label(); this.tblMain = new System.Windows.Forms.TableLayoutPanel(); - this.txtFirmVer = new System.Windows.Forms.TextBox(); - this.txtFirmDate = new System.Windows.Forms.TextBox(); menuStrip = new System.Windows.Forms.MenuStrip(); sep1 = new System.Windows.Forms.ToolStripSeparator(); sep2 = new System.Windows.Forms.ToolStripSeparator(); @@ -140,7 +140,6 @@ private void InitializeComponent() tsiCheckUpdate = new System.Windows.Forms.ToolStripMenuItem(); tcMain = new System.Windows.Forms.TabControl(); tabFanControl = new System.Windows.Forms.TabPage(); - flwFanSelect = new System.Windows.Forms.FlowLayoutPanel(); tabExtra = new System.Windows.Forms.TabPage(); tblExtra = new System.Windows.Forms.TableLayoutPanel(); lblFanMode = new System.Windows.Forms.Label(); @@ -154,15 +153,14 @@ private void InitializeComponent() lblModel = new System.Windows.Forms.Label(); lblManufacturer = new System.Windows.Forms.Label(); lblAuthor = new System.Windows.Forms.Label(); - tblApply = new System.Windows.Forms.TableLayoutPanel(); - flwStats = new System.Windows.Forms.FlowLayoutPanel(); lblFirmVer = new System.Windows.Forms.Label(); lblFirmDate = new System.Windows.Forms.Label(); + tblApply = new System.Windows.Forms.TableLayoutPanel(); + flwStats = new System.Windows.Forms.FlowLayoutPanel(); menuStrip.SuspendLayout(); tcMain.SuspendLayout(); tabFanControl.SuspendLayout(); this.tblFanControl.SuspendLayout(); - flwFanSelect.SuspendLayout(); tabExtra.SuspendLayout(); tblExtra.SuspendLayout(); flwKeyLight.SuspendLayout(); @@ -260,7 +258,6 @@ private void InitializeComponent() this.tsiOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.tsiProfAdd, this.tsiProfEdit, - this.tsiSwitchAll, this.tsiECtoConf, sep4, this.tsiECMon, @@ -295,37 +292,30 @@ private void InitializeComponent() // tsiProfRen // this.tsiProfRen.Name = "tsiProfRen"; - this.tsiProfRen.Size = new System.Drawing.Size(178, 22); + this.tsiProfRen.Size = new System.Drawing.Size(180, 22); this.tsiProfRen.Text = "Change Name"; this.tsiProfRen.Click += new System.EventHandler(this.ProfRename); // // tsiProfChangeDesc // this.tsiProfChangeDesc.Name = "tsiProfChangeDesc"; - this.tsiProfChangeDesc.Size = new System.Drawing.Size(178, 22); + this.tsiProfChangeDesc.Size = new System.Drawing.Size(180, 22); this.tsiProfChangeDesc.Text = "Change Description"; this.tsiProfChangeDesc.Click += new System.EventHandler(this.ProfChangeDesc); // // sep3 // sep3.Name = "sep3"; - sep3.Size = new System.Drawing.Size(175, 6); + sep3.Size = new System.Drawing.Size(177, 6); // // tsiProfDel // this.tsiProfDel.Name = "tsiProfDel"; this.tsiProfDel.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Delete))); - this.tsiProfDel.Size = new System.Drawing.Size(178, 22); + this.tsiProfDel.Size = new System.Drawing.Size(180, 22); this.tsiProfDel.Text = "Delete"; this.tsiProfDel.Click += new System.EventHandler(this.ProfDel); // - // tsiSwitchAll - // - this.tsiSwitchAll.Name = "tsiSwitchAll"; - this.tsiSwitchAll.Size = new System.Drawing.Size(257, 22); - this.tsiSwitchAll.Text = "Switch all fan profiles"; - this.tsiSwitchAll.Click += new System.EventHandler(this.SwitchAllToggle); - // // tsiECtoConf // this.tsiECtoConf.Name = "tsiECtoConf"; @@ -486,10 +476,24 @@ private void InitializeComponent() // // tblFanControl // - this.tblFanControl.ColumnCount = 1; - this.tblFanControl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tblFanControl.ColumnCount = 8; + this.tblFanControl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tblFanControl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tblFanControl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tblFanControl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tblFanControl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tblFanControl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tblFanControl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tblFanControl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tblFanControl.Controls.Add(this.cboProfPerfMode, 7, 0); + this.tblFanControl.Controls.Add(this.lblProfPerfMode, 6, 0); + this.tblFanControl.Controls.Add(this.btnProfDel, 5, 0); + this.tblFanControl.Controls.Add(this.btnProfAdd, 4, 0); + this.tblFanControl.Controls.Add(this.cboProfSel, 3, 0); + this.tblFanControl.Controls.Add(this.lblProfSel, 2, 0); + this.tblFanControl.Controls.Add(this.cboFanSel, 1, 0); + this.tblFanControl.Controls.Add(this.lblFanSel, 0, 0); this.tblFanControl.Controls.Add(this.tblCurve, 0, 1); - this.tblFanControl.Controls.Add(flwFanSelect, 0, 0); this.tblFanControl.Dock = System.Windows.Forms.DockStyle.Fill; this.tblFanControl.Location = new System.Drawing.Point(0, 0); this.tblFanControl.Margin = new System.Windows.Forms.Padding(0); @@ -500,67 +504,69 @@ private void InitializeComponent() this.tblFanControl.Size = new System.Drawing.Size(526, 336); this.tblFanControl.TabIndex = 0; // - // tblCurve + // cboProfPerfMode + // + this.cboProfPerfMode.Dock = System.Windows.Forms.DockStyle.Fill; + this.cboProfPerfMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cboProfPerfMode.DropDownWidth = 200; + this.cboProfPerfMode.FormattingEnabled = true; + this.cboProfPerfMode.Location = new System.Drawing.Point(419, 3); + this.cboProfPerfMode.Name = "cboProfPerfMode"; + this.cboProfPerfMode.Size = new System.Drawing.Size(104, 23); + this.cboProfPerfMode.TabIndex = 7; + this.cboProfPerfMode.SelectedIndexChanged += new System.EventHandler(this.ProfPerfModeChanged); + // + // lblProfPerfMode + // + this.lblProfPerfMode.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblProfPerfMode.AutoSize = true; + this.lblProfPerfMode.Location = new System.Drawing.Point(348, 6); + this.lblProfPerfMode.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); + this.lblProfPerfMode.Name = "lblProfPerfMode"; + this.lblProfPerfMode.Padding = new System.Windows.Forms.Padding(0, 0, 0, 2); + this.lblProfPerfMode.Size = new System.Drawing.Size(68, 17); + this.lblProfPerfMode.TabIndex = 6; + this.lblProfPerfMode.Text = "Perf. mode:"; // - this.tblCurve.AutoSize = true; - this.tblCurve.ColumnCount = 1; - this.tblCurve.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tblCurve.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tblCurve.Dock = System.Windows.Forms.DockStyle.Fill; - this.tblCurve.Location = new System.Drawing.Point(0, 29); - this.tblCurve.Margin = new System.Windows.Forms.Padding(0); - this.tblCurve.Name = "tblCurve"; - this.tblCurve.RowCount = 4; - this.tblCurve.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tblCurve.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tblCurve.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tblCurve.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tblCurve.Size = new System.Drawing.Size(526, 307); - this.tblCurve.TabIndex = 2; + // btnProfDel // - // flwFanSelect - // - flwFanSelect.AutoSize = true; - flwFanSelect.Controls.Add(this.lblFanSel); - flwFanSelect.Controls.Add(this.cboFanSel); - flwFanSelect.Controls.Add(this.lblProfSel); - flwFanSelect.Controls.Add(this.cboProfSel); - flwFanSelect.Controls.Add(this.btnProfAdd); - flwFanSelect.Controls.Add(this.btnProfDel); - flwFanSelect.Dock = System.Windows.Forms.DockStyle.Fill; - flwFanSelect.Location = new System.Drawing.Point(0, 0); - flwFanSelect.Margin = new System.Windows.Forms.Padding(0); - flwFanSelect.Name = "flwFanSelect"; - flwFanSelect.Size = new System.Drawing.Size(526, 29); - flwFanSelect.TabIndex = 1; + this.btnProfDel.Location = new System.Drawing.Point(322, 3); + this.btnProfDel.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.btnProfDel.Name = "btnProfDel"; + this.btnProfDel.Size = new System.Drawing.Size(23, 23); + this.btnProfDel.TabIndex = 5; + this.btnProfDel.Text = "-"; + this.btnProfDel.UseVisualStyleBackColor = true; + this.btnProfDel.Click += new System.EventHandler(this.ProfDel); // - // lblFanSel + // btnProfAdd // - this.lblFanSel.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.lblFanSel.AutoSize = true; - this.lblFanSel.Location = new System.Drawing.Point(3, 6); - this.lblFanSel.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); - this.lblFanSel.Name = "lblFanSel"; - this.lblFanSel.Padding = new System.Windows.Forms.Padding(0, 0, 0, 2); - this.lblFanSel.Size = new System.Drawing.Size(29, 17); - this.lblFanSel.TabIndex = 0; - this.lblFanSel.Text = "Fan:"; + this.btnProfAdd.Location = new System.Drawing.Point(299, 3); + this.btnProfAdd.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.btnProfAdd.Name = "btnProfAdd"; + this.btnProfAdd.Size = new System.Drawing.Size(23, 23); + this.btnProfAdd.TabIndex = 4; + this.btnProfAdd.Text = "+"; + this.btnProfAdd.UseVisualStyleBackColor = true; + this.btnProfAdd.Click += new System.EventHandler(this.ProfAdd); + this.btnProfAdd.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.btnProfAdd_KeyPress); // - // cboFanSel + // cboProfSel // - this.cboFanSel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cboFanSel.FormattingEnabled = true; - this.cboFanSel.Location = new System.Drawing.Point(35, 3); - this.cboFanSel.Name = "cboFanSel"; - this.cboFanSel.Size = new System.Drawing.Size(119, 23); - this.cboFanSel.TabIndex = 1; - this.cboFanSel.SelectedIndexChanged += new System.EventHandler(this.FanSelChanged); + this.cboProfSel.Dock = System.Windows.Forms.DockStyle.Fill; + this.cboProfSel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cboProfSel.FormattingEnabled = true; + this.cboProfSel.Location = new System.Drawing.Point(192, 3); + this.cboProfSel.Name = "cboProfSel"; + this.cboProfSel.Size = new System.Drawing.Size(104, 23); + this.cboProfSel.TabIndex = 3; + this.cboProfSel.SelectedIndexChanged += new System.EventHandler(this.ProfSelChanged); // // lblProfSel // this.lblProfSel.Anchor = System.Windows.Forms.AnchorStyles.Left; this.lblProfSel.AutoSize = true; - this.lblProfSel.Location = new System.Drawing.Point(160, 6); + this.lblProfSel.Location = new System.Drawing.Point(145, 6); this.lblProfSel.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); this.lblProfSel.Name = "lblProfSel"; this.lblProfSel.Padding = new System.Windows.Forms.Padding(0, 0, 0, 2); @@ -568,38 +574,47 @@ private void InitializeComponent() this.lblProfSel.TabIndex = 2; this.lblProfSel.Text = "Profile:"; // - // cboProfSel + // cboFanSel // - this.cboProfSel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cboProfSel.FormattingEnabled = true; - this.cboProfSel.Location = new System.Drawing.Point(207, 3); - this.cboProfSel.Name = "cboProfSel"; - this.cboProfSel.Size = new System.Drawing.Size(119, 23); - this.cboProfSel.TabIndex = 3; - this.cboProfSel.SelectedIndexChanged += new System.EventHandler(this.ProfSelChanged); + this.cboFanSel.Dock = System.Windows.Forms.DockStyle.Fill; + this.cboFanSel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cboFanSel.FormattingEnabled = true; + this.cboFanSel.Location = new System.Drawing.Point(35, 3); + this.cboFanSel.Name = "cboFanSel"; + this.cboFanSel.Size = new System.Drawing.Size(104, 23); + this.cboFanSel.TabIndex = 1; + this.cboFanSel.SelectedIndexChanged += new System.EventHandler(this.FanSelChanged); // - // btnProfAdd + // lblFanSel // - this.btnProfAdd.Location = new System.Drawing.Point(332, 3); - this.btnProfAdd.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); - this.btnProfAdd.Name = "btnProfAdd"; - this.btnProfAdd.Size = new System.Drawing.Size(23, 23); - this.btnProfAdd.TabIndex = 4; - this.btnProfAdd.Text = "+"; - this.btnProfAdd.UseVisualStyleBackColor = true; - this.btnProfAdd.Click += new System.EventHandler(this.ProfAdd); - this.btnProfAdd.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.btnProfAdd_KeyPress); + this.lblFanSel.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblFanSel.AutoSize = true; + this.lblFanSel.Location = new System.Drawing.Point(3, 6); + this.lblFanSel.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); + this.lblFanSel.Name = "lblFanSel"; + this.lblFanSel.Padding = new System.Windows.Forms.Padding(0, 0, 0, 2); + this.lblFanSel.Size = new System.Drawing.Size(29, 17); + this.lblFanSel.TabIndex = 0; + this.lblFanSel.Text = "Fan:"; // - // btnProfDel + // tblCurve // - this.btnProfDel.Location = new System.Drawing.Point(355, 3); - this.btnProfDel.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); - this.btnProfDel.Name = "btnProfDel"; - this.btnProfDel.Size = new System.Drawing.Size(23, 23); - this.btnProfDel.TabIndex = 5; - this.btnProfDel.Text = "-"; - this.btnProfDel.UseVisualStyleBackColor = true; - this.btnProfDel.Click += new System.EventHandler(this.ProfDel); + this.tblCurve.AutoSize = true; + this.tblCurve.ColumnCount = 1; + this.tblFanControl.SetColumnSpan(this.tblCurve, 8); + this.tblCurve.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tblCurve.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tblCurve.Dock = System.Windows.Forms.DockStyle.Fill; + this.tblCurve.Location = new System.Drawing.Point(0, 29); + this.tblCurve.Margin = new System.Windows.Forms.Padding(0); + this.tblCurve.Name = "tblCurve"; + this.tblCurve.RowCount = 4; + this.tblCurve.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tblCurve.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tblCurve.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tblCurve.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tblCurve.Size = new System.Drawing.Size(526, 307); + this.tblCurve.TabIndex = 2; // // tabExtra // @@ -847,6 +862,15 @@ private void InitializeComponent() tblInfo.Size = new System.Drawing.Size(520, 330); tblInfo.TabIndex = 1; // + // txtFirmDate + // + this.txtFirmDate.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtFirmDate.Location = new System.Drawing.Point(131, 119); + this.txtFirmDate.Name = "txtFirmDate"; + this.txtFirmDate.ReadOnly = true; + this.txtFirmDate.Size = new System.Drawing.Size(386, 23); + this.txtFirmDate.TabIndex = 10; + // // txtModel // this.txtModel.Dock = System.Windows.Forms.DockStyle.Fill; @@ -917,6 +941,35 @@ private void InitializeComponent() this.btnGetModel.UseVisualStyleBackColor = true; this.btnGetModel.Click += new System.EventHandler(this.btnGetModel_Click); // + // lblFirmVer + // + lblFirmVer.Anchor = System.Windows.Forms.AnchorStyles.Right; + lblFirmVer.AutoSize = true; + lblFirmVer.Location = new System.Drawing.Point(10, 94); + lblFirmVer.Name = "lblFirmVer"; + lblFirmVer.Size = new System.Drawing.Size(115, 15); + lblFirmVer.TabIndex = 7; + lblFirmVer.Text = "EC firmware version:"; + // + // lblFirmDate + // + lblFirmDate.Anchor = System.Windows.Forms.AnchorStyles.Right; + lblFirmDate.AutoSize = true; + lblFirmDate.Location = new System.Drawing.Point(25, 123); + lblFirmDate.Name = "lblFirmDate"; + lblFirmDate.Size = new System.Drawing.Size(100, 15); + lblFirmDate.TabIndex = 8; + lblFirmDate.Text = "EC firmware date:"; + // + // txtFirmVer + // + this.txtFirmVer.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtFirmVer.Location = new System.Drawing.Point(131, 90); + this.txtFirmVer.Name = "txtFirmVer"; + this.txtFirmVer.ReadOnly = true; + this.txtFirmVer.Size = new System.Drawing.Size(386, 23); + this.txtFirmVer.TabIndex = 9; + // // tblApply // tblApply.AutoSize = true; @@ -1043,44 +1096,6 @@ private void InitializeComponent() this.tblMain.Size = new System.Drawing.Size(540, 416); this.tblMain.TabIndex = 1; // - // lblFirmVer - // - lblFirmVer.Anchor = System.Windows.Forms.AnchorStyles.Right; - lblFirmVer.AutoSize = true; - lblFirmVer.Location = new System.Drawing.Point(10, 94); - lblFirmVer.Name = "lblFirmVer"; - lblFirmVer.Size = new System.Drawing.Size(115, 15); - lblFirmVer.TabIndex = 7; - lblFirmVer.Text = "EC firmware version:"; - // - // lblFirmDate - // - lblFirmDate.Anchor = System.Windows.Forms.AnchorStyles.Right; - lblFirmDate.AutoSize = true; - lblFirmDate.Location = new System.Drawing.Point(25, 123); - lblFirmDate.Name = "lblFirmDate"; - lblFirmDate.Size = new System.Drawing.Size(100, 15); - lblFirmDate.TabIndex = 8; - lblFirmDate.Text = "EC firmware date:"; - // - // txtFirmVer - // - this.txtFirmVer.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtFirmVer.Location = new System.Drawing.Point(131, 90); - this.txtFirmVer.Name = "txtFirmVer"; - this.txtFirmVer.ReadOnly = true; - this.txtFirmVer.Size = new System.Drawing.Size(386, 23); - this.txtFirmVer.TabIndex = 9; - // - // txtFirmDate - // - this.txtFirmDate.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtFirmDate.Location = new System.Drawing.Point(131, 119); - this.txtFirmDate.Name = "txtFirmDate"; - this.txtFirmDate.ReadOnly = true; - this.txtFirmDate.Size = new System.Drawing.Size(386, 23); - this.txtFirmDate.TabIndex = 10; - // // MainForm // this.AcceptButton = this.btnApply; @@ -1104,8 +1119,6 @@ private void InitializeComponent() tabFanControl.ResumeLayout(false); this.tblFanControl.ResumeLayout(false); this.tblFanControl.PerformLayout(); - flwFanSelect.ResumeLayout(false); - flwFanSelect.PerformLayout(); tabExtra.ResumeLayout(false); tblExtra.ResumeLayout(false); tblExtra.PerformLayout(); @@ -1179,7 +1192,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem tsiLogWarn; private System.Windows.Forms.ToolStripMenuItem tsiLogError; private System.Windows.Forms.ToolStripMenuItem tsiLogFatal; - private System.Windows.Forms.ToolStripMenuItem tsiSwitchAll; private System.Windows.Forms.ToolStripMenuItem tsiAdvanced; private System.Windows.Forms.ComboBox cboFanMode; private System.Windows.Forms.TabPage tabInfo; @@ -1189,5 +1201,7 @@ private void InitializeComponent() private System.Windows.Forms.Button btnGetModel; private System.Windows.Forms.TextBox txtFirmDate; private System.Windows.Forms.TextBox txtFirmVer; + private System.Windows.Forms.ComboBox cboProfPerfMode; + private System.Windows.Forms.Label lblProfPerfMode; } } diff --git a/YAMDCC.ConfigEditor/MainForm.cs b/YAMDCC.ConfigEditor/MainForm.cs index 7b701c3..2956d8a 100644 --- a/YAMDCC.ConfigEditor/MainForm.cs +++ b/YAMDCC.ConfigEditor/MainForm.cs @@ -75,7 +75,6 @@ public MainForm() tsiProfAdd.ToolTipText = Strings.GetString("ttProfAdd"); tsiProfRen.ToolTipText = Strings.GetString("ttProfRen"); tsiProfChangeDesc.ToolTipText = Strings.GetString("ttProfChangeDesc"); - tsiSwitchAll.ToolTipText = Strings.GetString("ttSwitchAll"); tsiECtoConf.ToolTipText = Strings.GetString("ttECtoConf"); tsiProfDel.ToolTipText = Strings.GetString("ttProfDel"); tsiECMon.ToolTipText = Strings.GetString("ttECMon"); @@ -409,26 +408,6 @@ private void ProfChangeDesc(object sender, EventArgs e) } } - private void SwitchAllToggle(object sender, EventArgs e) - { - if (!tsiSwitchAll.Checked) - { - if (FansHaveSameProfCount()) - { - tsiSwitchAll.Checked = true; - } - else - { - Utils.ShowError("All fans must have the same number of fan profiles."); - } - } - else - { - tsiSwitchAll.Checked = false; - } - - } - private void ECtoConf(object sender, EventArgs e) { if (Utils.ShowInfo(Strings.GetString("dlgECtoConfStart"), @@ -746,21 +725,18 @@ private void ProfSelChanged(object sender, EventArgs e) FanConf cfg = Config.FanConfs[cboFanSel.SelectedIndex]; FanCurveConf curveCfg = cfg.FanCurveConfs[cboProfSel.SelectedIndex]; - if (tsiSwitchAll.Checked) + for (int i = 0; i < Config.FanConfs.Count; i++) { - for (int i = 0; i < Config.FanConfs.Count; i++) - { - Config.FanConfs[i].CurveSel = cboProfSel.SelectedIndex; - } - } - else - { - cfg.CurveSel = cboProfSel.SelectedIndex; + Config.FanConfs[i].CurveSel = cboProfSel.SelectedIndex; } ttMain.SetToolTip(cboProfSel, Strings.GetString( "ttProfSel", cfg.FanCurveConfs[cfg.CurveSel].Desc)); + cboProfPerfMode.SelectedIndex = Config.FanConfs[0] + .FanCurveConfs[cboProfSel.SelectedIndex].PerfModeSel + 1; + cboProfPerfMode.Enabled = true; + bool enable = curveCfg.Name != "Default"; for (int i = 0; i < numFanSpds.Length; i++) { @@ -784,27 +760,15 @@ private void ProfSelChanged(object sender, EventArgs e) tsiProfDel.Enabled = enable; } - private void ProfAdd(object sender, EventArgs e) + private void ProfPerfModeChanged(object sender, EventArgs e) { - if (tsiSwitchAll.Checked) - { - bool switchAll = tsiSwitchAll.Checked; - tsiSwitchAll.Checked = false; - ProfAdd(0, cboFanSel.Items.Count); - tsiSwitchAll.Checked = switchAll; - } - else - { - ProfAdd(cboFanSel.SelectedIndex, cboFanSel.SelectedIndex + 1); - } - - if (!FansHaveSameProfCount()) - { - tsiSwitchAll.Checked = false; - } + int i = cboProfPerfMode.SelectedIndex; + Config.FanConfs[0].FanCurveConfs[cboProfSel.SelectedIndex].PerfModeSel = i - 1; + //ttMain.SetToolTip(cboPerfMode, + // Strings.GetString("ttPerfMode", Config.PerfModeConf.PerfModes[i].Desc)); } - private void ProfAdd(int start, int end) + private void ProfAdd(object sender, EventArgs e) { FanConf cfg = Config.FanConfs[cboFanSel.SelectedIndex]; @@ -814,7 +778,7 @@ private void ProfAdd(int start, int end) if (dlg.ShowDialog() == DialogResult.OK) { - for (int i = start; i < end; i++) + for (int i = 0; i < cboFanSel.Items.Count; i++) { cfg = Config.FanConfs[i]; @@ -874,32 +838,17 @@ private void btnProfAdd_KeyPress(object sender, KeyPressEventArgs e) private void ProfDel(object sender, EventArgs e) { - if (tsiSwitchAll.Checked) - { - ProfDel(0, cboFanSel.Items.Count); - } - else - { - ProfDel(cboFanSel.SelectedIndex, cboFanSel.SelectedIndex + 1); - } - - if (!FansHaveSameProfCount()) - { - tsiSwitchAll.Checked = false; - } - } + FanConf cfg = Config.FanConfs[cboFanSel.SelectedIndex]; + FanCurveConf curveCfg = cfg.FanCurveConfs[cfg.CurveSel]; - private void ProfDel(int start, int end) - { - for (int i = start; i < end; i++) + if (curveCfg.Name != "Default" && Utils.ShowWarning( + Strings.GetString("dlgProfDel", curveCfg.Name), + $"Delete fan profile? ({cfg.Name})") == DialogResult.Yes) { - FanConf cfg = Config.FanConfs[i]; - FanCurveConf curveCfg = cfg.FanCurveConfs[cfg.CurveSel]; - - if (curveCfg.Name != "Default" && Utils.ShowWarning( - Strings.GetString("dlgProfDel", curveCfg.Name), - $"Delete fan profile? ({cfg.Name})") == DialogResult.Yes) + for (int i = 0; i < cboFanSel.Items.Count; i++) { + cfg = Config.FanConfs[i]; + // Remove the fan profile from the config's list cfg.FanCurveConfs.RemoveAt(cfg.CurveSel); cfg.CurveSel -= 1; @@ -969,6 +918,9 @@ private void PerfModeChange(object sender, EventArgs e) Config.PerfModeConf.ModeSel = i; ttMain.SetToolTip(cboPerfMode, Strings.GetString("ttPerfMode", Config.PerfModeConf.PerfModes[i].Desc)); + + PerfModeConf pCfg = Config.PerfModeConf; + cboProfPerfMode.Items[0] = $"Default ({pCfg.PerfModes[pCfg.ModeSel].Name})"; } private void WinFnSwapToggle(object sender, EventArgs e) @@ -1118,7 +1070,6 @@ private void LoadConf(string confPath) private void LoadConf(YAMDCC_Config cfg) { DisableAll(); - tsiSwitchAll.Checked = FansHaveSameProfCount(); tsiSaveConf.Enabled = true; @@ -1172,6 +1123,8 @@ private void LoadConf(YAMDCC_Config cfg) } cboPerfMode.Items.Clear(); + cboProfPerfMode.Items.Clear(); + if (cfg.PerfModeConf is null) { ttMain.SetToolTip(cboPerfMode, Strings.GetString("ttNotSupported")); @@ -1179,9 +1132,11 @@ private void LoadConf(YAMDCC_Config cfg) else { PerfModeConf perfModeConf = cfg.PerfModeConf; + cboProfPerfMode.Items.Add($"Default ({perfModeConf.PerfModes[perfModeConf.ModeSel].Name})"); for (int i = 0; i < perfModeConf.PerfModes.Count; i++) { cboPerfMode.Items.Add(perfModeConf.PerfModes[i].Name); + cboProfPerfMode.Items.Add(perfModeConf.PerfModes[i].Name); } cboPerfMode.SelectedIndex = perfModeConf.ModeSel; @@ -1279,6 +1234,7 @@ private void DisableAll() btnProfDel.Enabled = false; cboFanSel.Enabled = false; cboProfSel.Enabled = false; + cboProfPerfMode.Enabled = false; if (tbFanSpds is not null) { for (int i = 0; i < tbFanSpds.Length; i++) @@ -1315,19 +1271,6 @@ private void ToggleSvcCmds(bool enable) btnRevert.Enabled = enable; } - private bool FansHaveSameProfCount() - { - List cfgs = Config.FanConfs; - for (int i = 0; i < cfgs.Count - 1; i++) - { - if (cfgs[i].FanCurveConfs.Count != cfgs[i + 1].FanCurveConfs.Count) - { - return false; - } - } - return true; - } - private void UpdateStatus(StatusCode status, int data = 0) { if (AppStatus.Code == status) diff --git a/YAMDCC.ConfigEditor/MainForm.resx b/YAMDCC.ConfigEditor/MainForm.resx index 3eaac1b..10bb805 100644 --- a/YAMDCC.ConfigEditor/MainForm.resx +++ b/YAMDCC.ConfigEditor/MainForm.resx @@ -1,4 +1,4 @@ - +