From 8674df6af2ed9e296a80450f4b034c11765e70b6 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Tue, 14 Feb 2012 14:20:16 +0100 Subject: [PATCH] cec-config-gui: added a button configuration panel. currently only shows all cec keys and select the correct row when a key is pressed --- src/cec-config-gui/CecButtonConfig.cs | 38 ++++++ src/cec-config-gui/CecConfigGUI.Designer.cs | 73 ++++++++-- src/cec-config-gui/CecConfigGUI.cs | 129 ++++++++++++++++++ src/cec-config-gui/CecConfigGUI.resx | 14 +- .../DataSources/CecButtonConfig.datasource | 10 ++ src/cec-config-gui/cec-config-gui.csproj | 2 + 6 files changed, 247 insertions(+), 19 deletions(-) create mode 100644 src/cec-config-gui/CecButtonConfig.cs create mode 100644 src/cec-config-gui/Properties/DataSources/CecButtonConfig.datasource diff --git a/src/cec-config-gui/CecButtonConfig.cs b/src/cec-config-gui/CecButtonConfig.cs new file mode 100644 index 0000000..1c2cc81 --- /dev/null +++ b/src/cec-config-gui/CecButtonConfig.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CecConfigGui +{ + class CecButtonConfigItem + { + public CecButtonConfigItem(string name, CecSharp.CecKeypress key, string playerButton) + { + CecButtonName = name; + Key = key; + PlayerButton = playerButton; + _enabled = false; + } + + public string PlayerButton { get; set; } + private bool _enabled; + + public bool Enabled + { + get + { + return _enabled || PlayerButton.Length > 0; + } + set + { + _enabled = value; + } + } + public string CecButtonName { get; private set; } + public CecSharp.CecKeypress Key { get; private set; } + } + + class CecButtonConfig : List + { + } +} diff --git a/src/cec-config-gui/CecConfigGUI.Designer.cs b/src/cec-config-gui/CecConfigGUI.Designer.cs index cdbc43c..4b5eabb 100644 --- a/src/cec-config-gui/CecConfigGUI.Designer.cs +++ b/src/cec-config-gui/CecConfigGUI.Designer.cs @@ -50,7 +50,9 @@ this.lConnectedDevice = new System.Windows.Forms.Label(); this.lPortNumber = new System.Windows.Forms.Label(); this.tbButtons = new System.Windows.Forms.TabPage(); + this.dgButtons = new System.Windows.Forms.DataGridView(); this.LogOutput = new System.Windows.Forms.TabPage(); + this.bSaveLog = new System.Windows.Forms.Button(); this.bClearLog = new System.Windows.Forms.Button(); this.cbLogDebug = new System.Windows.Forms.CheckBox(); this.cbLogTraffic = new System.Windows.Forms.CheckBox(); @@ -64,10 +66,15 @@ this.helpConnectedHDMIDevice = new System.Windows.Forms.ToolTip(this.components); this.helpPhysicalAddress = new System.Windows.Forms.ToolTip(this.components); this.helpDeviceType = new System.Windows.Forms.ToolTip(this.components); - this.bSaveLog = new System.Windows.Forms.Button(); + this.cecButtonConfigBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.CecButtonName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.playerButtonDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tabControl1.SuspendLayout(); this.Configuration.SuspendLayout(); + this.tbButtons.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgButtons)).BeginInit(); this.LogOutput.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.cecButtonConfigBindingSource)).BeginInit(); this.SuspendLayout(); // // tabControl1 @@ -311,6 +318,7 @@ // // tbButtons // + this.tbButtons.Controls.Add(this.dgButtons); this.tbButtons.Location = new System.Drawing.Point(4, 22); this.tbButtons.Name = "tbButtons"; this.tbButtons.Padding = new System.Windows.Forms.Padding(3); @@ -319,6 +327,25 @@ this.tbButtons.Text = "Button Configuration"; this.tbButtons.UseVisualStyleBackColor = true; // + // dgButtons + // + this.dgButtons.AllowUserToAddRows = false; + this.dgButtons.AllowUserToDeleteRows = false; + this.dgButtons.AllowUserToResizeColumns = false; + this.dgButtons.AllowUserToResizeRows = false; + this.dgButtons.AutoGenerateColumns = false; + this.dgButtons.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + this.dgButtons.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.CecButtonName, + this.playerButtonDataGridViewTextBoxColumn}); + this.dgButtons.DataSource = this.cecButtonConfigBindingSource; + this.dgButtons.Location = new System.Drawing.Point(7, 7); + this.dgButtons.Name = "dgButtons"; + this.dgButtons.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.dgButtons.Size = new System.Drawing.Size(579, 346); + this.dgButtons.TabIndex = 0; + this.dgButtons.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dataGridView1_CellFormatting); + // // LogOutput // this.LogOutput.Controls.Add(this.bSaveLog); @@ -337,6 +364,16 @@ this.LogOutput.Text = "Log Output"; this.LogOutput.UseVisualStyleBackColor = true; // + // bSaveLog + // + this.bSaveLog.Location = new System.Drawing.Point(430, 330); + this.bSaveLog.Name = "bSaveLog"; + this.bSaveLog.Size = new System.Drawing.Size(75, 23); + this.bSaveLog.TabIndex = 7; + this.bSaveLog.Text = "Save"; + this.bSaveLog.UseVisualStyleBackColor = true; + this.bSaveLog.Click += new System.EventHandler(this.bSaveLog_Click); + // // bClearLog // this.bClearLog.Location = new System.Drawing.Point(511, 330); @@ -428,15 +465,26 @@ this.lStatus.TabIndex = 2; this.lStatus.Text = "Initialising..."; // - // bSaveLog + // cecButtonConfigBindingSource // - this.bSaveLog.Location = new System.Drawing.Point(430, 330); - this.bSaveLog.Name = "bSaveLog"; - this.bSaveLog.Size = new System.Drawing.Size(75, 23); - this.bSaveLog.TabIndex = 7; - this.bSaveLog.Text = "Save"; - this.bSaveLog.UseVisualStyleBackColor = true; - this.bSaveLog.Click += new System.EventHandler(this.bSaveLog_Click); + this.cecButtonConfigBindingSource.DataSource = typeof(CecConfigGui.CecButtonConfig); + // + // CecButtonName + // + this.CecButtonName.DataPropertyName = "CecButtonName"; + this.CecButtonName.FillWeight = 260F; + this.CecButtonName.HeaderText = "Button"; + this.CecButtonName.Name = "CecButtonName"; + this.CecButtonName.ReadOnly = true; + this.CecButtonName.Width = 260; + // + // playerButtonDataGridViewTextBoxColumn + // + this.playerButtonDataGridViewTextBoxColumn.DataPropertyName = "PlayerButton"; + this.playerButtonDataGridViewTextBoxColumn.FillWeight = 260F; + this.playerButtonDataGridViewTextBoxColumn.HeaderText = "Mapped to"; + this.playerButtonDataGridViewTextBoxColumn.Name = "playerButtonDataGridViewTextBoxColumn"; + this.playerButtonDataGridViewTextBoxColumn.Width = 260; // // CecConfigGUI // @@ -451,8 +499,11 @@ this.tabControl1.ResumeLayout(false); this.Configuration.ResumeLayout(false); this.Configuration.PerformLayout(); + this.tbButtons.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dgButtons)).EndInit(); this.LogOutput.ResumeLayout(false); this.LogOutput.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.cecButtonConfigBindingSource)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -496,5 +547,9 @@ private System.Windows.Forms.CheckBox cbLogError; private System.Windows.Forms.Button bClearLog; private System.Windows.Forms.Button bSaveLog; + private System.Windows.Forms.DataGridView dgButtons; + private System.Windows.Forms.BindingSource cecButtonConfigBindingSource; + private System.Windows.Forms.DataGridViewTextBoxColumn CecButtonName; + private System.Windows.Forms.DataGridViewTextBoxColumn playerButtonDataGridViewTextBoxColumn; } } \ No newline at end of file diff --git a/src/cec-config-gui/CecConfigGUI.cs b/src/cec-config-gui/CecConfigGUI.cs index 800cd42..10a4844 100644 --- a/src/cec-config-gui/CecConfigGUI.cs +++ b/src/cec-config-gui/CecConfigGUI.cs @@ -28,11 +28,97 @@ namespace CecConfigGui InitializeComponent(); Lib = new LibCecSharp(Config); + LoadButtonConfiguration(); + ActiveProcess = new ConnectToDevice(ref Lib); ActiveProcess.EventHandler += new EventHandler(ProcessEventHandler); (new Thread(new ThreadStart(ActiveProcess.Run))).Start(); } + private void LoadButtonConfiguration() + { + //TODO load the real configuration + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Select", (new CecSharp.CecKeypress() { Keycode = 0x00 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Up", (new CecSharp.CecKeypress() { Keycode = 0x01 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Down", (new CecSharp.CecKeypress() { Keycode = 0x02 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Left", (new CecSharp.CecKeypress() { Keycode = 0x03 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Right", (new CecSharp.CecKeypress() { Keycode = 0x04 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Right+Up", (new CecSharp.CecKeypress() { Keycode = 0x05 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Right+Down", (new CecSharp.CecKeypress() { Keycode = 0x06 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Left+Up", (new CecSharp.CecKeypress() { Keycode = 0x07 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Left+Down", (new CecSharp.CecKeypress() { Keycode = 0x08 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Root menu", (new CecSharp.CecKeypress() { Keycode = 0x09 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Setup menu", (new CecSharp.CecKeypress() { Keycode = 0x0A }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Contents menu", (new CecSharp.CecKeypress() { Keycode = 0x0B }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Favourite menu", (new CecSharp.CecKeypress() { Keycode = 0x0C }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Exit", (new CecSharp.CecKeypress() { Keycode = 0x0D }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("0", (new CecSharp.CecKeypress() { Keycode = 0x20 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("1", (new CecSharp.CecKeypress() { Keycode = 0x21 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("2", (new CecSharp.CecKeypress() { Keycode = 0x22 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("3", (new CecSharp.CecKeypress() { Keycode = 0x23 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("4", (new CecSharp.CecKeypress() { Keycode = 0x24 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("5", (new CecSharp.CecKeypress() { Keycode = 0x25 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("6", (new CecSharp.CecKeypress() { Keycode = 0x26 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("7", (new CecSharp.CecKeypress() { Keycode = 0x27 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("8", (new CecSharp.CecKeypress() { Keycode = 0x28 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("9", (new CecSharp.CecKeypress() { Keycode = 0x29 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem(".", (new CecSharp.CecKeypress() { Keycode = 0x2A }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Enter", (new CecSharp.CecKeypress() { Keycode = 0x2B }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Clear", (new CecSharp.CecKeypress() { Keycode = 0x2C }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Next favourite", (new CecSharp.CecKeypress() { Keycode = 0x2F }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Channel up", (new CecSharp.CecKeypress() { Keycode = 0x30 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Channel down", (new CecSharp.CecKeypress() { Keycode = 0x31 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Previous channel", (new CecSharp.CecKeypress() { Keycode = 0x32 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Sound select", (new CecSharp.CecKeypress() { Keycode = 0x33 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Input select", (new CecSharp.CecKeypress() { Keycode = 0x34 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Display information", (new CecSharp.CecKeypress() { Keycode = 0x35 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Help", (new CecSharp.CecKeypress() { Keycode = 0x36 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Page up", (new CecSharp.CecKeypress() { Keycode = 0x37 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Page down", (new CecSharp.CecKeypress() { Keycode = 0x38 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Power", (new CecSharp.CecKeypress() { Keycode = 0x40 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Volume up", (new CecSharp.CecKeypress() { Keycode = 0x41 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Volume down", (new CecSharp.CecKeypress() { Keycode = 0x42 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Mute", (new CecSharp.CecKeypress() { Keycode = 0x43 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Play", (new CecSharp.CecKeypress() { Keycode = 0x44 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Stop", (new CecSharp.CecKeypress() { Keycode = 0x45 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Pause", (new CecSharp.CecKeypress() { Keycode = 0x46 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Record", (new CecSharp.CecKeypress() { Keycode = 0x47 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Rewind", (new CecSharp.CecKeypress() { Keycode = 0x48 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Fast forward", (new CecSharp.CecKeypress() { Keycode = 0x49 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Eject", (new CecSharp.CecKeypress() { Keycode = 0x4A }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Forward", (new CecSharp.CecKeypress() { Keycode = 0x4B }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Backward", (new CecSharp.CecKeypress() { Keycode = 0x4C }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Stop record", (new CecSharp.CecKeypress() { Keycode = 0x4D }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Pause record", (new CecSharp.CecKeypress() { Keycode = 0x4E }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Angle", (new CecSharp.CecKeypress() { Keycode = 0x50 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Sub picture", (new CecSharp.CecKeypress() { Keycode = 0x51 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Video on demand", (new CecSharp.CecKeypress() { Keycode = 0x52 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Electronic program guide", (new CecSharp.CecKeypress() { Keycode = 0x53 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Timer programming", (new CecSharp.CecKeypress() { Keycode = 0x54 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Initial configuration", (new CecSharp.CecKeypress() { Keycode = 0x55 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Play (function)", (new CecSharp.CecKeypress() { Keycode = 0x60 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Pause play (function)", (new CecSharp.CecKeypress() { Keycode = 0x61 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Record (function)", (new CecSharp.CecKeypress() { Keycode = 0x62 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Pause record (function)", (new CecSharp.CecKeypress() { Keycode = 0x63 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Stop (function)", (new CecSharp.CecKeypress() { Keycode = 0x64 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Mute (function)", (new CecSharp.CecKeypress() { Keycode = 0x65 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Restore volume", (new CecSharp.CecKeypress() { Keycode = 0x66 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Tune", (new CecSharp.CecKeypress() { Keycode = 0x67 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Select media", (new CecSharp.CecKeypress() { Keycode = 0x68 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Select AV input", (new CecSharp.CecKeypress() { Keycode = 0x69 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Select audio input", (new CecSharp.CecKeypress() { Keycode = 0x6A }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Power toggle", (new CecSharp.CecKeypress() { Keycode = 0x6B }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Power off", (new CecSharp.CecKeypress() { Keycode = 0x6C }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Power on", (new CecSharp.CecKeypress() { Keycode = 0x6D }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F1 (blue)", (new CecSharp.CecKeypress() { Keycode = 0x71 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F2 (red)", (new CecSharp.CecKeypress() { Keycode = 0x72 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F3 (green)", (new CecSharp.CecKeypress() { Keycode = 0x73 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F4 (yellow)", (new CecSharp.CecKeypress() { Keycode = 0x74 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F5", (new CecSharp.CecKeypress() { Keycode = 0x75 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Data", (new CecSharp.CecKeypress() { Keycode = 0x76 }), string.Empty)); + this.cecButtonConfigBindingSource.Add(new CecButtonConfigItem("(Samsung) Return", (new CecSharp.CecKeypress() { Keycode = 0x91 }), string.Empty)); + } + public int ReceiveCommand(CecCommand command) { return 1; @@ -40,9 +126,44 @@ namespace CecConfigGui public int ReceiveKeypress(CecKeypress key) { + SelectKeypressRow(key); return 1; } + delegate void SelectKeypressRowCallback(CecKeypress key); + private void SelectKeypressRow(CecKeypress key) + { + if (dgButtons.InvokeRequired) + { + SelectKeypressRowCallback d = new SelectKeypressRowCallback(SelectKeypressRow); + try + { + this.Invoke(d, new object[] { key }); + } + catch (Exception) { } + } + else + { + int rowIndex = -1; + foreach (DataGridViewRow row in dgButtons.Rows) + { + CecButtonConfigItem item = row.DataBoundItem as CecButtonConfigItem; + if (item != null && item.Key.Keycode == key.Keycode) + { + rowIndex = row.Index; + row.Selected = true; + item.Enabled = true; + } + else + { + row.Selected = false; + } + } + if (rowIndex > -1) + dgButtons.FirstDisplayedScrollingRowIndex = rowIndex; + } + } + delegate void AddLogMessageCallback(CecLogMessage message); private void AddLogMessage(CecLogMessage message) { @@ -449,6 +570,14 @@ namespace CecConfigGui } } } + + private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) + { + DataGridView grid = sender as DataGridView; + CecButtonConfigItem data = grid.Rows[e.RowIndex].DataBoundItem as CecButtonConfigItem; + if (data == null || !data.Enabled) + e.CellStyle.ForeColor = Color.Gray; + } } internal class CecCallbackWrapper : CecCallbackMethods diff --git a/src/cec-config-gui/CecConfigGUI.resx b/src/cec-config-gui/CecConfigGUI.resx index da39715..c49183f 100644 --- a/src/cec-config-gui/CecConfigGUI.resx +++ b/src/cec-config-gui/CecConfigGUI.resx @@ -129,16 +129,10 @@ 160, 17 - - 17, 17 - - - 160, 17 + + True - - 362, 17 - - - 524, 17 + + 662, 17 \ No newline at end of file diff --git a/src/cec-config-gui/Properties/DataSources/CecButtonConfig.datasource b/src/cec-config-gui/Properties/DataSources/CecButtonConfig.datasource new file mode 100644 index 0000000..0c133af --- /dev/null +++ b/src/cec-config-gui/Properties/DataSources/CecButtonConfig.datasource @@ -0,0 +1,10 @@ + + + + CecConfigGui.CecButtonConfig, cec-config-gui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/src/cec-config-gui/cec-config-gui.csproj b/src/cec-config-gui/cec-config-gui.csproj index 3dab4e5..2923747 100644 --- a/src/cec-config-gui/cec-config-gui.csproj +++ b/src/cec-config-gui/cec-config-gui.csproj @@ -57,6 +57,7 @@ + Form @@ -79,6 +80,7 @@ Resources.resx True + SettingsSingleFileGenerator Settings.Designer.cs -- 2.34.1