cec-config-gui: updated labels, added 'not implemented' warning for the button config...
authorLars Op den Kamp <lars@opdenkamp.eu>
Wed, 15 Feb 2012 01:48:39 +0000 (02:48 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Wed, 15 Feb 2012 01:48:39 +0000 (02:48 +0100)
src/cec-config-gui/CecConfigGUI.Designer.cs
src/cec-config-gui/CecConfigGUI.cs
src/cec-config-gui/DeviceInformation.Designer.cs
src/cec-config-gui/DeviceInformation.cs
src/cec-config-gui/actions/SendActivateSource.cs
src/cec-config-gui/actions/SendImageViewOn.cs
src/cec-config-gui/actions/SendStandby.cs
src/cec-config-gui/actions/ShowDeviceInfo.cs

index d3907535c49f5c0a6f575f8300f4bb079321ce23..7225d42261c4ed72279fbdc928694dff9054bc31 100644 (file)
       this.tbButtons = new System.Windows.Forms.TabPage();
       this.dgButtons = new System.Windows.Forms.DataGridView();
       this.CecButtonName = new System.Windows.Forms.DataGridViewTextBoxColumn();
-      this.playerButtonDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
-      this.cecButtonConfigBindingSource = new System.Windows.Forms.BindingSource(this.components);
       this.tbTestCommands = new System.Windows.Forms.TabPage();
+      this.bMute = new System.Windows.Forms.Button();
+      this.bVolDown = new System.Windows.Forms.Button();
+      this.bVolUp = new System.Windows.Forms.Button();
       this.bActivateSource = new System.Windows.Forms.Button();
       this.bScan = new System.Windows.Forms.Button();
       this.bStandby = new System.Windows.Forms.Button();
       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.label1 = new System.Windows.Forms.Label();
+      this.cbWakeDevices = new System.Windows.Forms.CheckedListBox();
+      this.lWakeDevices = new System.Windows.Forms.Label();
+      this.playerButtonDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
+      this.cecButtonConfigBindingSource = new System.Windows.Forms.BindingSource(this.components);
       this.tabControl1.SuspendLayout();
       this.Configuration.SuspendLayout();
       this.tbButtons.SuspendLayout();
       ((System.ComponentModel.ISupportInitialize)(this.dgButtons)).BeginInit();
-      ((System.ComponentModel.ISupportInitialize)(this.cecButtonConfigBindingSource)).BeginInit();
       this.tbTestCommands.SuspendLayout();
       this.LogOutput.SuspendLayout();
+      ((System.ComponentModel.ISupportInitialize)(this.cecButtonConfigBindingSource)).BeginInit();
       this.SuspendLayout();
       // 
       // tabControl1
       // 
       // Configuration
       // 
+      this.Configuration.Controls.Add(this.lWakeDevices);
+      this.Configuration.Controls.Add(this.cbWakeDevices);
       this.Configuration.Controls.Add(this.cbPowerOffOnStandby);
       this.Configuration.Controls.Add(this.cbPowerOffScreensaver);
       this.Configuration.Controls.Add(this.cbPowerOffShutdown);
       // 
       // tbButtons
       // 
+      this.tbButtons.Controls.Add(this.label1);
       this.tbButtons.Controls.Add(this.dgButtons);
       this.tbButtons.Location = new System.Drawing.Point(4, 22);
       this.tbButtons.Name = "tbButtons";
       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;
-      // 
-      // cecButtonConfigBindingSource
-      // 
-      this.cecButtonConfigBindingSource.DataSource = typeof(CecConfigGui.CecButtonConfig);
-      // 
       // tbTestCommands
       // 
+      this.tbTestCommands.Controls.Add(this.bMute);
+      this.tbTestCommands.Controls.Add(this.bVolDown);
+      this.tbTestCommands.Controls.Add(this.bVolUp);
       this.tbTestCommands.Controls.Add(this.bActivateSource);
       this.tbTestCommands.Controls.Add(this.bScan);
       this.tbTestCommands.Controls.Add(this.bStandby);
       this.tbTestCommands.Text = "CEC tester";
       this.tbTestCommands.UseVisualStyleBackColor = true;
       // 
+      // bMute
+      // 
+      this.bMute.Enabled = false;
+      this.bMute.Location = new System.Drawing.Point(164, 65);
+      this.bMute.Name = "bMute";
+      this.bMute.Size = new System.Drawing.Size(150, 23);
+      this.bMute.TabIndex = 8;
+      this.bMute.Text = "Mute";
+      this.bMute.UseVisualStyleBackColor = true;
+      this.bMute.Click += new System.EventHandler(this.bMute_Click);
+      // 
+      // bVolDown
+      // 
+      this.bVolDown.Enabled = false;
+      this.bVolDown.Location = new System.Drawing.Point(164, 36);
+      this.bVolDown.Name = "bVolDown";
+      this.bVolDown.Size = new System.Drawing.Size(150, 23);
+      this.bVolDown.TabIndex = 7;
+      this.bVolDown.Text = "Volume down";
+      this.bVolDown.UseVisualStyleBackColor = true;
+      this.bVolDown.Click += new System.EventHandler(this.bVolDown_Click);
+      // 
+      // bVolUp
+      // 
+      this.bVolUp.Enabled = false;
+      this.bVolUp.Location = new System.Drawing.Point(164, 7);
+      this.bVolUp.Name = "bVolUp";
+      this.bVolUp.Size = new System.Drawing.Size(150, 23);
+      this.bVolUp.TabIndex = 6;
+      this.bVolUp.Text = "Volume up";
+      this.bVolUp.UseVisualStyleBackColor = true;
+      this.bVolUp.Click += new System.EventHandler(this.bVolUp_Click);
+      // 
       // bActivateSource
       // 
-      this.bActivateSource.Location = new System.Drawing.Point(7, 90);
+      this.bActivateSource.Location = new System.Drawing.Point(8, 65);
       this.bActivateSource.Name = "bActivateSource";
       this.bActivateSource.Size = new System.Drawing.Size(150, 23);
       this.bActivateSource.TabIndex = 5;
-      this.bActivateSource.Text = "Activate source";
+      this.bActivateSource.Text = "Make device active";
       this.bActivateSource.UseVisualStyleBackColor = true;
       this.bActivateSource.Click += new System.EventHandler(this.bActivateSource_Click);
       // 
       // bScan
       // 
-      this.bScan.Location = new System.Drawing.Point(7, 61);
+      this.bScan.Location = new System.Drawing.Point(8, 94);
       this.bScan.Name = "bScan";
       this.bScan.Size = new System.Drawing.Size(150, 23);
       this.bScan.TabIndex = 4;
       // 
       // bStandby
       // 
-      this.bStandby.Location = new System.Drawing.Point(7, 32);
+      this.bStandby.Location = new System.Drawing.Point(8, 36);
       this.bStandby.Name = "bStandby";
       this.bStandby.Size = new System.Drawing.Size(150, 23);
       this.bStandby.TabIndex = 3;
-      this.bStandby.Text = "Standby";
+      this.bStandby.Text = "Put device in standby";
       this.bStandby.UseVisualStyleBackColor = true;
       this.bStandby.Click += new System.EventHandler(this.bStandby_Click);
       // 
       // bSendImageViewOn
       // 
-      this.bSendImageViewOn.Location = new System.Drawing.Point(7, 3);
+      this.bSendImageViewOn.Location = new System.Drawing.Point(8, 7);
       this.bSendImageViewOn.Name = "bSendImageViewOn";
       this.bSendImageViewOn.Size = new System.Drawing.Size(150, 23);
       this.bSendImageViewOn.TabIndex = 2;
-      this.bSendImageViewOn.Text = "Image view on";
+      this.bSendImageViewOn.Text = "Power on device";
       this.bSendImageViewOn.UseVisualStyleBackColor = true;
       this.bSendImageViewOn.Click += new System.EventHandler(this.bSendImageViewOn_Click);
       // 
       this.cbCommandDestination.Size = new System.Drawing.Size(121, 21);
       this.cbCommandDestination.TabIndex = 0;
       this.cbCommandDestination.Text = "0: TV";
+      this.cbCommandDestination.SelectedIndexChanged += new System.EventHandler(this.cbCommandDestination_SelectedIndexChanged);
       // 
       // LogOutput
       // 
       this.lStatus.TabIndex = 2;
       this.lStatus.Text = "Initialising...";
       // 
+      // label1
+      // 
+      this.label1.AutoSize = true;
+      this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
+      this.label1.Location = new System.Drawing.Point(118, 252);
+      this.label1.Name = "label1";
+      this.label1.Size = new System.Drawing.Size(354, 31);
+      this.label1.TabIndex = 1;
+      this.label1.Text = "NOT IMPLEMENTED YET";
+      // 
+      // cbWakeDevices
+      // 
+      this.cbWakeDevices.FormattingEnabled = true;
+      this.cbWakeDevices.Items.AddRange(new object[] {
+            "0: TV",
+            "1: Recorder 1",
+            "2: Recorder 2",
+            "3: Tuner 1",
+            "4: Playback 1",
+            "5: Audio system",
+            "6: Tuner 2",
+            "7: Tuner 3",
+            "8: Playback 2",
+            "9: Recorder 3",
+            "A: Tuner 4",
+            "B: Playback 3",
+            "C: Reserved 1",
+            "D: Reserved 2",
+            "E: Free use",
+            "F: Broadcast"});
+      this.cbWakeDevices.Location = new System.Drawing.Point(333, 218);
+      this.cbWakeDevices.Name = "cbWakeDevices";
+      this.cbWakeDevices.Size = new System.Drawing.Size(118, 94);
+      this.cbWakeDevices.TabIndex = 23;
+      // 
+      // lWakeDevices
+      // 
+      this.lWakeDevices.AutoSize = true;
+      this.lWakeDevices.Location = new System.Drawing.Point(339, 201);
+      this.lWakeDevices.Name = "lWakeDevices";
+      this.lWakeDevices.Size = new System.Drawing.Size(102, 13);
+      this.lWakeDevices.TabIndex = 24;
+      this.lWakeDevices.Text = "Wake when starting";
+      // 
+      // playerButtonDataGridViewTextBoxColumn
+      // 
+      this.playerButtonDataGridViewTextBoxColumn.DataPropertyName = "PlayerButton";
+      this.playerButtonDataGridViewTextBoxColumn.FillWeight = 260F;
+      this.playerButtonDataGridViewTextBoxColumn.HeaderText = "Mapped to";
+      this.playerButtonDataGridViewTextBoxColumn.Name = "playerButtonDataGridViewTextBoxColumn";
+      this.playerButtonDataGridViewTextBoxColumn.Width = 260;
+      // 
+      // cecButtonConfigBindingSource
+      // 
+      this.cecButtonConfigBindingSource.DataSource = typeof(CecConfigGui.CecButtonConfig);
+      // 
       // CecConfigGUI
       // 
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.Configuration.ResumeLayout(false);
       this.Configuration.PerformLayout();
       this.tbButtons.ResumeLayout(false);
+      this.tbButtons.PerformLayout();
       ((System.ComponentModel.ISupportInitialize)(this.dgButtons)).EndInit();
-      ((System.ComponentModel.ISupportInitialize)(this.cecButtonConfigBindingSource)).EndInit();
       this.tbTestCommands.ResumeLayout(false);
       this.tbTestCommands.PerformLayout();
       this.LogOutput.ResumeLayout(false);
       this.LogOutput.PerformLayout();
+      ((System.ComponentModel.ISupportInitialize)(this.cecButtonConfigBindingSource)).EndInit();
       this.ResumeLayout(false);
       this.PerformLayout();
 
     private System.Windows.Forms.Label lDestination;
     private System.Windows.Forms.Button bActivateSource;
     private System.Windows.Forms.Button bScan;
+    private System.Windows.Forms.Button bMute;
+    private System.Windows.Forms.Button bVolDown;
+    private System.Windows.Forms.Button bVolUp;
+    private System.Windows.Forms.Label label1;
+    private System.Windows.Forms.Label lWakeDevices;
+    private System.Windows.Forms.CheckedListBox cbWakeDevices;
   }
 }
\ No newline at end of file
index a75f6c4e0590dd8e340466ba0584fa2501fbb5bd..b8c2b54fa68ca7031ef3b410c72639a63f9e732c 100644 (file)
@@ -224,6 +224,16 @@ namespace CecConfigGui
 
     public int ReceiveCommand(CecCommand command)
     {
+      bool bGetNewPhysicalAddress = false;
+      if (command.Opcode == CecOpcode.ReportPhysicalAddress)
+        bGetNewPhysicalAddress = true;
+
+      if (bGetNewPhysicalAddress)
+      {
+        LibCECConfiguration config = new LibCECConfiguration();
+        Lib.GetCurrentConfiguration(config);
+        SetControlText(this.tbPhysicalAddress, String.Format("{0,4:X}", config.PhysicalAddress));
+      }
       return 1;
     }
 
@@ -348,14 +358,25 @@ namespace CecConfigGui
       SetControlEnabled(cbPortNumber, val);
       SetControlEnabled(cbConnectedDevice, cbConnectedDevice.Items.Count > 1 ? val : false);
       SetControlEnabled(tbPhysicalAddress, val);
-      SetControlEnabled(cbDeviceType, val);
+      SetControlEnabled(cbDeviceType, false); // TODO not implemented yet
       SetControlEnabled(cbUseTVMenuLanguage, val);
       SetControlEnabled(cbPowerOnStartup, val);
       SetControlEnabled(cbPowerOffShutdown, val);
       SetControlEnabled(cbPowerOffScreensaver, val);
       SetControlEnabled(cbPowerOffOnStandby, val);
+      SetControlEnabled(cbWakeDevices, false); // TODO not implemented yet
       SetControlEnabled(bClose, val);
       SetControlEnabled(bSave, val);
+
+      SetControlEnabled(bSendImageViewOn, val);
+      SetControlEnabled(bStandby, val);
+      SetControlEnabled(bActivateSource, val);
+      SetControlEnabled(bScan, val);
+
+      bool enableVolumeButtons = (GetTargetDevice() == CecLogicalAddress.AudioSystem) && val;
+      SetControlEnabled(bVolUp, enableVolumeButtons);
+      SetControlEnabled(bVolDown, enableVolumeButtons);
+      SetControlEnabled(bMute, enableVolumeButtons);
     }
 
     delegate void SetControlTextCallback(Control control, string val);
@@ -530,21 +551,26 @@ namespace CecConfigGui
     private CecCallbackWrapper Callbacks;
     private UpdateProcess ActiveProcess = null;
 
-    private void connectedDevice_SelectedIndexChanged(object sender, EventArgs e)
+    public void SetConnectedDevice(CecLogicalAddress address, int portnumber)
     {
       if (ActiveProcess == null)
       {
         SetControlsEnabled(false);
-        SelectedConnectedDevice = (this.cbConnectedDevice.Text.Equals(AVRVendorString)) ? CecLogicalAddress.AudioSystem : CecLogicalAddress.Tv;
-        int iPortNumber = 0;
-        if (!int.TryParse(cbPortNumber.Text, out iPortNumber))
-          iPortNumber = 1;
-        ActiveProcess = new UpdateConnectedDevice(ref Lib, cbConnectedDevice.Text.Equals(AVRVendorString) ? CecLogicalAddress.AudioSystem : CecLogicalAddress.Tv, iPortNumber);
+        ActiveProcess = new UpdateConnectedDevice(ref Lib, address, portnumber);
         ActiveProcess.EventHandler += new EventHandler<UpdateEvent>(ProcessEventHandler);
         (new Thread(new ThreadStart(ActiveProcess.Run))).Start();
       }
     }
 
+    private void connectedDevice_SelectedIndexChanged(object sender, EventArgs e)
+    {
+      SelectedConnectedDevice = (this.cbConnectedDevice.Text.Equals(AVRVendorString)) ? CecLogicalAddress.AudioSystem : CecLogicalAddress.Tv;
+      int iPortNumber = 0;
+      if (!int.TryParse(cbPortNumber.Text, out iPortNumber))
+        iPortNumber = 1;
+      SetConnectedDevice(SelectedConnectedDevice, iPortNumber);
+    }
+
     private void bCancel_Click(object sender, EventArgs e)
     {
       this.Dispose();
@@ -621,15 +647,10 @@ namespace CecConfigGui
       SetControlsEnabled(true);
     }
 
-    private void tbPhysicalAddress_TextChanged(object sender, EventArgs e)
+    public void SetPhysicalAddress(ushort physicalAddress)
     {
       if (ActiveProcess == null)
       {
-        if (tbPhysicalAddress.Text.Length != 4)
-          return;
-        ushort physicalAddress = 0;
-        if (!ushort.TryParse(tbPhysicalAddress.Text, NumberStyles.AllowHexSpecifier, null, out physicalAddress))
-          return;
         SetControlsEnabled(false);
         SetControlText(cbPortNumber, string.Empty);
         SetControlText(cbConnectedDevice, string.Empty);
@@ -639,6 +660,17 @@ namespace CecConfigGui
       }
     }
 
+    private void tbPhysicalAddress_TextChanged(object sender, EventArgs e)
+    {
+      if (tbPhysicalAddress.Text.Length != 4)
+        return;
+      ushort physicalAddress = 0;
+      if (!ushort.TryParse(tbPhysicalAddress.Text, NumberStyles.AllowHexSpecifier, null, out physicalAddress))
+        return;
+
+      SetPhysicalAddress(physicalAddress);
+    }
+
     private void bClearLog_Click(object sender, EventArgs e)
     {
       tbLog.Text = string.Empty;
@@ -682,8 +714,21 @@ namespace CecConfigGui
         e.CellStyle.ForeColor = Color.Gray;
     }
 
+    delegate CecLogicalAddress GetTargetDeviceCallback();
     private CecLogicalAddress GetTargetDevice()
     {
+      if (this.cbCommandDestination.InvokeRequired)
+      {
+        GetTargetDeviceCallback d = new GetTargetDeviceCallback(GetTargetDevice);
+        CecLogicalAddress retval = CecLogicalAddress.Unknown;
+        try
+        {
+          retval = (CecLogicalAddress)this.Invoke(d, new object[] { });
+        }
+        catch (Exception) { }
+        return retval;
+      }
+
       switch (this.cbCommandDestination.Text.Substring(0, 1).ToLower())
       {
         case "0":
@@ -723,49 +768,98 @@ namespace CecConfigGui
       }
     }
 
-    private void bSendImageViewOn_Click(object sender, EventArgs e)
+    public void SendImageViewOn(CecLogicalAddress address)
     {
       if (ActiveProcess == null)
       {
         SetControlsEnabled(false);
-        ActiveProcess = new SendImageViewOn(ref Lib, GetTargetDevice());
+        ActiveProcess = new SendImageViewOn(ref Lib, address);
         ActiveProcess.EventHandler += new EventHandler<UpdateEvent>(ProcessEventHandler);
         (new Thread(new ThreadStart(ActiveProcess.Run))).Start();
       }
     }
 
-    private void bStandby_Click(object sender, EventArgs e)
+    private void bSendImageViewOn_Click(object sender, EventArgs e)
+    {
+      SendImageViewOn(GetTargetDevice());
+    }
+
+    public void SendStandby(CecLogicalAddress address)
     {
       if (ActiveProcess == null)
       {
         SetControlsEnabled(false);
-        ActiveProcess = new SendStandby(ref Lib, GetTargetDevice());
+        ActiveProcess = new SendStandby(ref Lib, address);
         ActiveProcess.EventHandler += new EventHandler<UpdateEvent>(ProcessEventHandler);
         (new Thread(new ThreadStart(ActiveProcess.Run))).Start();
       }
     }
 
-    private void bScan_Click(object sender, EventArgs e)
+    private void bStandby_Click(object sender, EventArgs e)
+    {
+      SendStandby(GetTargetDevice());
+    }
+
+    public void ShowDeviceInfo(CecLogicalAddress address)
     {
       if (ActiveProcess == null)
       {
         SetControlsEnabled(false);
-        ActiveProcess = new ShowDeviceInfo(ref Lib, GetTargetDevice());
+        ActiveProcess = new ShowDeviceInfo(this, ref Lib, address);
         ActiveProcess.EventHandler += new EventHandler<UpdateEvent>(ProcessEventHandler);
         (new Thread(new ThreadStart(ActiveProcess.Run))).Start();
       }
     }
 
-    private void bActivateSource_Click(object sender, EventArgs e)
+    private void bScan_Click(object sender, EventArgs e)
+    {
+      ShowDeviceInfo(GetTargetDevice());
+    }
+
+    public void ActivateSource(CecLogicalAddress address)
     {
       if (ActiveProcess == null)
       {
         SetControlsEnabled(false);
-        ActiveProcess = new SendActivateSource(ref Lib, GetTargetDevice());
+        ActiveProcess = new SendActivateSource(ref Lib, address);
         ActiveProcess.EventHandler += new EventHandler<UpdateEvent>(ProcessEventHandler);
         (new Thread(new ThreadStart(ActiveProcess.Run))).Start();
       }
     }
+
+    private void bActivateSource_Click(object sender, EventArgs e)
+    {
+      ActivateSource(GetTargetDevice());
+    }
+
+    private void cbCommandDestination_SelectedIndexChanged(object sender, EventArgs e)
+    {
+      bool enableVolumeButtons = (GetTargetDevice() == CecLogicalAddress.AudioSystem);
+      this.bVolUp.Enabled = enableVolumeButtons;
+      this.bVolDown.Enabled = enableVolumeButtons;
+      this.bMute.Enabled = enableVolumeButtons;
+    }
+
+    private void bVolUp_Click(object sender, EventArgs e)
+    {
+      SetControlsEnabled(false);
+      Lib.VolumeUp(true);
+      SetControlsEnabled(true);
+    }
+
+    private void bVolDown_Click(object sender, EventArgs e)
+    {
+      SetControlsEnabled(false);
+      Lib.VolumeDown(true);
+      SetControlsEnabled(true);
+    }
+
+    private void bMute_Click(object sender, EventArgs e)
+    {
+      SetControlsEnabled(false);
+      Lib.MuteAudio(true);
+      SetControlsEnabled(true);
+    }
   }
 
   internal class CecCallbackWrapper : CecCallbackMethods
index 53724310e2ad8d919e66e3607175be1b6cef2efd..2992fe812608fd5c0191f77f309b86bc66587974 100644 (file)
@@ -40,7 +40,6 @@
       this.label10 = new System.Windows.Forms.Label();
       this.lMenuLanguage = new System.Windows.Forms.Label();
       this.lOsdName = new System.Windows.Forms.Label();
-      this.lPowerStatus = new System.Windows.Forms.Label();
       this.lCecVersion = new System.Windows.Forms.Label();
       this.lVendor = new System.Windows.Forms.Label();
       this.lActiveSource = new System.Windows.Forms.Label();
@@ -48,6 +47,8 @@
       this.lPhysicalAddress = new System.Windows.Forms.Label();
       this.lLogicalAddress = new System.Windows.Forms.Label();
       this.lDevice = new System.Windows.Forms.Label();
+      this.lInactiveSource = new System.Windows.Forms.LinkLabel();
+      this.lPowerStatus = new System.Windows.Forms.LinkLabel();
       this.SuspendLayout();
       // 
       // label1
       this.lOsdName.Text = "unknown";
       this.lOsdName.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
       // 
-      // lPowerStatus
-      // 
-      this.lPowerStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
-      this.lPowerStatus.Location = new System.Drawing.Point(122, 149);
-      this.lPowerStatus.Name = "lPowerStatus";
-      this.lPowerStatus.Size = new System.Drawing.Size(150, 13);
-      this.lPowerStatus.TabIndex = 21;
-      this.lPowerStatus.Text = "unknown";
-      this.lPowerStatus.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
-      // 
       // lCecVersion
       // 
       this.lCecVersion.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
       this.lActiveSource.Name = "lActiveSource";
       this.lActiveSource.Size = new System.Drawing.Size(150, 13);
       this.lActiveSource.TabIndex = 24;
-      this.lActiveSource.Text = "unknown";
+      this.lActiveSource.Text = "yes";
       this.lActiveSource.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
       // 
       // lDevicePresent
       this.lDevice.Text = "unknown";
       this.lDevice.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
       // 
+      // lInactiveSource
+      // 
+      this.lInactiveSource.Location = new System.Drawing.Point(122, 89);
+      this.lInactiveSource.Name = "lInactiveSource";
+      this.lInactiveSource.Size = new System.Drawing.Size(150, 13);
+      this.lInactiveSource.TabIndex = 29;
+      this.lInactiveSource.TabStop = true;
+      this.lInactiveSource.Text = "no";
+      this.lInactiveSource.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+      this.lInactiveSource.Visible = false;
+      this.lInactiveSource.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lInactiveSource_LinkClicked);
+      // 
+      // lPowerStatus
+      // 
+      this.lPowerStatus.Location = new System.Drawing.Point(122, 149);
+      this.lPowerStatus.Name = "lPowerStatus";
+      this.lPowerStatus.Size = new System.Drawing.Size(150, 13);
+      this.lPowerStatus.TabIndex = 30;
+      this.lPowerStatus.TabStop = true;
+      this.lPowerStatus.Text = "unknown";
+      this.lPowerStatus.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+      this.lPowerStatus.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lStandby_LinkClicked);
+      // 
       // DeviceInformation
       // 
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
       this.ClientSize = new System.Drawing.Size(284, 218);
+      this.Controls.Add(this.lPowerStatus);
+      this.Controls.Add(this.lInactiveSource);
       this.Controls.Add(this.lDevice);
       this.Controls.Add(this.lLogicalAddress);
       this.Controls.Add(this.lPhysicalAddress);
       this.Controls.Add(this.lActiveSource);
       this.Controls.Add(this.lVendor);
       this.Controls.Add(this.lCecVersion);
-      this.Controls.Add(this.lPowerStatus);
       this.Controls.Add(this.lOsdName);
       this.Controls.Add(this.lMenuLanguage);
       this.Controls.Add(this.label10);
     private System.Windows.Forms.Label label10;
     private System.Windows.Forms.Label lMenuLanguage;
     private System.Windows.Forms.Label lOsdName;
-    private System.Windows.Forms.Label lPowerStatus;
     private System.Windows.Forms.Label lCecVersion;
     private System.Windows.Forms.Label lVendor;
     private System.Windows.Forms.Label lActiveSource;
     private System.Windows.Forms.Label lPhysicalAddress;
     private System.Windows.Forms.Label lLogicalAddress;
     private System.Windows.Forms.Label lDevice;
+    private System.Windows.Forms.LinkLabel lInactiveSource;
+    private System.Windows.Forms.LinkLabel lPowerStatus;
   }
 }
\ No newline at end of file
index 9d9b983a158bd0ae3ead618754caa539029fb456..d340e4774f1805fed5c87bf1c9595827521e33bd 100644 (file)
@@ -11,21 +11,88 @@ namespace CecConfigGui
 {
   public partial class DeviceInformation : Form
   {
-    public DeviceInformation(CecLogicalAddress address, ref LibCecSharp lib,
+    public DeviceInformation(CecConfigGUI gui, CecLogicalAddress address, ref LibCecSharp lib,
       bool devicePresent, CecVendorId vendor, bool isActiveSource, ushort physicalAddress,
       CecVersion version, CecPowerStatus power, string osdName, string menuLanguage)
     {
+      Gui = gui;
+      Lib = lib;
+      Address = address;
       InitializeComponent();
       this.lDevice.Text = lib.ToString(address);
-      this.lLogicalAddress.Text = "#" + (int)address;
-      this.lPhysicalAddress.Text = physicalAddress.ToString();
+      this.lLogicalAddress.Text = String.Format("{0,1:X}", (int)address);
+      this.lPhysicalAddress.Text = String.Format("{0,4:X}", physicalAddress);
       this.lDevicePresent.Text = devicePresent ? "yes" : "no";
-      this.lActiveSource.Text = isActiveSource ? "yes" : "no";
-      this.lVendor.Text = lib.ToString(vendor) + " (" + (UInt64)vendor +")";
+      this.lActiveSource.Visible = isActiveSource;
+      this.lInactiveSource.Visible = !isActiveSource;
+      this.lVendor.Text = vendor != CecVendorId.Unknown ? lib.ToString(vendor) : "unknown";
       this.lCecVersion.Text = lib.ToString(version);
       this.lPowerStatus.Text = lib.ToString(power);
+      bool isPoweredOn = (power == CecPowerStatus.On || power == CecPowerStatus.InTransitionStandbyToOn);
       this.lOsdName.Text = osdName;
       this.lMenuLanguage.Text = menuLanguage;
+      this.Text = "Device: " + osdName;
     }
+
+    delegate void SetControlVisibleCallback(Control control, bool val);
+    private void SetControlVisible(Control control, bool val)
+    {
+      if (control.InvokeRequired)
+      {
+        SetControlVisibleCallback d = new SetControlVisibleCallback(SetControlVisible);
+        try
+        {
+          this.Invoke(d, new object[] { control, val });
+        }
+        catch (Exception) { }
+      }
+      else
+      {
+        control.Visible = val;
+      }
+    }
+
+    delegate void SetControlTextCallback(Control control, string val);
+    private void SetControlText(Control control, string val)
+    {
+      if (control.InvokeRequired)
+      {
+        SetControlTextCallback d = new SetControlTextCallback(SetControlText);
+        try
+        {
+          this.Invoke(d, new object[] { control, val });
+        }
+        catch (Exception) { }
+      }
+      else
+      {
+        control.Text = val;
+      }
+    }
+
+    private void lInactiveSource_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+    {
+      SetControlVisible(lInactiveSource, false);
+      SetControlVisible(lActiveSource, true);
+      Gui.ActivateSource(Address);
+    }
+
+
+    private void lStandby_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+    {
+      LinkLabel label = sender as LinkLabel;
+      bool sendPowerOn = label.Text != Lib.ToString(CecPowerStatus.InTransitionStandbyToOn) &&
+        label.Text != Lib.ToString(CecPowerStatus.On);
+
+      SetControlText(lPowerStatus, Lib.ToString(sendPowerOn ? CecPowerStatus.On : CecPowerStatus.Standby));
+      if (sendPowerOn)
+        Gui.SendImageViewOn(Address);
+      else
+        Gui.SendStandby(Address);
+    }
+
+    private CecLogicalAddress Address;
+    private CecConfigGUI Gui;
+    private LibCecSharp Lib;
   }
 }
index e60c0a57dc8a0b4ac73f703a940aee07202ea466..17154d6d0f47c78db902de3ae36a761bd6b22ddc 100644 (file)
@@ -19,7 +19,7 @@ namespace CecConfigGui.actions
       SendEvent(UpdateEventType.ProgressBar, 50);
 
       bool bResult = Lib.SetStreamPath(Address);
-      SendEvent(UpdateEventType.StatusText, bResult ? "Command sent successfully." : "The device could not be powered on.");
+      SendEvent(UpdateEventType.StatusText, bResult ? "Command sent successfully." : "The 'active source' command was not acked.");
       SendEvent(UpdateEventType.ProgressBar, 100);
     }
 
index 26d95346958edec089686e036b126c034d501bc0..29e261eaff0a1da95b7da184df7ba8a1b488ebe1 100644 (file)
@@ -19,7 +19,7 @@ namespace CecConfigGui.actions
       SendEvent(UpdateEventType.ProgressBar, 50);
 
       bool bResult = Lib.PowerOnDevices(Address);
-      SendEvent(UpdateEventType.StatusText, bResult ? "Command sent successfully." : "The device could not be powered on.");
+      SendEvent(UpdateEventType.StatusText, bResult ? "Command sent successfully." : "The 'image view on' command was not acked.");
       SendEvent(UpdateEventType.ProgressBar, 100);
     }
 
index 9eb8afb42aea5fcac3a33f15f7096a01a31badb9..f2b587ea522944923b3c43d64f93e692fc989c35 100644 (file)
@@ -19,7 +19,7 @@ namespace CecConfigGui.actions
       SendEvent(UpdateEventType.ProgressBar, 50);
 
       bool bResult = Lib.StandbyDevices(Address);
-      SendEvent(UpdateEventType.StatusText, bResult ? "Command sent successfully." : "The device could not be powered on.");
+      SendEvent(UpdateEventType.StatusText, bResult ? "Command sent successfully." : "The 'standby' command was not acked.");
       SendEvent(UpdateEventType.ProgressBar, 100);
     }
 
index 61dd35f6461cde35b51914342ec65411c1b7ccb2..a09b3905aa5cdb82d9c284a3a1fcfb4cb33c7e37 100644 (file)
@@ -7,8 +7,9 @@ namespace CecConfigGui.actions
 {
   class ShowDeviceInfo : UpdateProcess
   {
-    public ShowDeviceInfo(ref LibCecSharp lib, CecLogicalAddress address)
+    public ShowDeviceInfo(CecConfigGUI gui, ref LibCecSharp lib, CecLogicalAddress address)
     {
+      Gui = gui;
       Lib = lib;
       Address = address;
     }
@@ -60,14 +61,16 @@ namespace CecConfigGui.actions
 
       SendEvent(UpdateEventType.StatusText, "Showing device information");
       SendEvent(UpdateEventType.ProgressBar, 90);
+      SendEvent(UpdateEventType.ProcessCompleted, true);
 
-      DeviceInformation di = new DeviceInformation(Address, ref Lib, devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage);
+      DeviceInformation di = new DeviceInformation(Gui, Address, ref Lib, devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage);
       di.ShowDialog();
 
       SendEvent(UpdateEventType.StatusText, "Ready.");
       SendEvent(UpdateEventType.ProgressBar, 100);
     }
 
+    private CecConfigGUI Gui;
     private LibCecSharp Lib;
     private CecLogicalAddress Address;
   }