cec-config-gui: added a button configuration panel. currently only shows all cec...
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 14 Feb 2012 13:20:16 +0000 (14:20 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 14 Feb 2012 13:20:16 +0000 (14:20 +0100)
src/cec-config-gui/CecButtonConfig.cs [new file with mode: 0644]
src/cec-config-gui/CecConfigGUI.Designer.cs
src/cec-config-gui/CecConfigGUI.cs
src/cec-config-gui/CecConfigGUI.resx
src/cec-config-gui/Properties/DataSources/CecButtonConfig.datasource [new file with mode: 0644]
src/cec-config-gui/cec-config-gui.csproj

diff --git a/src/cec-config-gui/CecButtonConfig.cs b/src/cec-config-gui/CecButtonConfig.cs
new file mode 100644 (file)
index 0000000..1c2cc81
--- /dev/null
@@ -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<CecButtonConfigItem>
+  {
+  }
+}
index cdbc43c3de1e46adde32957ac4b9672797c810e7..4b5eabb61fd32e65b571460a3554e4ace1d9b673 100644 (file)
@@ -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();
       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
       // 
       // 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);
       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);
       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);
       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
       // 
       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();
 
     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
index 800cd425e1877197d7c186757594a0f7c940ae00..10a484411cea0d143b390980cdc22081c81d08be 100644 (file)
@@ -28,11 +28,97 @@ namespace CecConfigGui
       InitializeComponent();
       Lib = new LibCecSharp(Config);
 
+      LoadButtonConfiguration();
+
       ActiveProcess = new ConnectToDevice(ref Lib);
       ActiveProcess.EventHandler += new EventHandler<UpdateEvent>(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
index da39715b14b00b2fafb47d4c06b8e72ddfd99380..c49183f8df8c900ee5a656b5a800e313a5c373c7 100644 (file)
   <metadata name="helpConnectedHDMIDevice.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>160, 17</value>
   </metadata>
-  <metadata name="helpPortNumber.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>17, 17</value>
-  </metadata>
-  <metadata name="helpConnectedHDMIDevice.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>160, 17</value>
+  <metadata name="CecButtonName.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
   </metadata>
-  <metadata name="helpPhysicalAddress.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>362, 17</value>
-  </metadata>
-  <metadata name="helpDeviceType.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>524, 17</value>
+  <metadata name="cecButtonConfigBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>662, 17</value>
   </metadata>
 </root>
\ 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 (file)
index 0000000..0c133af
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    This file is automatically generated by Visual Studio .Net. It is 
+    used to store generic object data source configuration information.  
+    Renaming the file extension or editing the content of this file may   
+    cause the file to be unrecognizable by the program.
+-->
+<GenericObjectDataSource DisplayName="CecButtonConfig" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
+   <TypeInfo>CecConfigGui.CecButtonConfig, cec-config-gui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
+</GenericObjectDataSource>
\ No newline at end of file
index 3dab4e557d679bc20d2d0bdfe5cd85f30659d127..29237476d998e01211e4501b2ca046770b3f5fce 100644 (file)
@@ -57,6 +57,7 @@
     <Compile Include="actions\ConnectToDevice.cs" />
     <Compile Include="actions\UpdateConnectedDevice.cs" />
     <Compile Include="actions\UpdatePhysicalAddress.cs" />
+    <Compile Include="CecButtonConfig.cs" />
     <Compile Include="CecConfigGUI.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -79,6 +80,7 @@
       <DependentUpon>Resources.resx</DependentUpon>
       <DesignTime>True</DesignTime>
     </Compile>
+    <None Include="Properties\DataSources\CecButtonConfig.datasource" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>