X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcec-config-gui%2FCecConfigGUI.cs;h=5004e041024dfa77eac9913bfbc49a6fd09b4482;hb=66609663d93f48b37fa79647e339ab48a70f73d8;hp=80b4e6ef530f5986f5e148dd497318cdf22190cf;hpb=2b3c67ec5145c5763c28f6ad863962a41e5beec2;p=deb_libcec.git diff --git a/src/cec-config-gui/CecConfigGUI.cs b/src/cec-config-gui/CecConfigGUI.cs index 80b4e6e..5004e04 100644 --- a/src/cec-config-gui/CecConfigGUI.cs +++ b/src/cec-config-gui/CecConfigGUI.cs @@ -271,6 +271,7 @@ namespace CecConfigGui SetControlText(tbPhysicalAddress, string.Format("{0,4:X}", updateEvent.IntValue)); break; case UpdateEventType.ProgressBar: + SetControlVisible(pProgress, true); SetProgressValue(pProgress, updateEvent.IntValue); break; case UpdateEventType.TVVendorId: @@ -316,15 +317,17 @@ namespace CecConfigGui UpdatingInfoPanel.SetControlEnabled(UpdatingInfoPanel.bUpdate, true); UpdatingInfoPanel = null; } + SetControlVisible(pProgress, false); break; } } private void SetControlsEnabled(bool val) { - SetControlEnabled(cbPortNumber, val); - SetControlEnabled(cbConnectedDevice, cbConnectedDevice.Items.Count > 1 ? val : false); - SetControlEnabled(tbPhysicalAddress, val); + SetControlEnabled(cbPortNumber, val && !Config.AutodetectAddress); + SetControlEnabled(cbConnectedDevice, cbConnectedDevice.Items.Count > 1 && !Config.AutodetectAddress ? val : false); + SetControlEnabled(cbOverrideAddress, val); + SetControlEnabled(tbPhysicalAddress, val && !Config.AutodetectAddress && cbOverrideAddress.Checked); SetControlEnabled(cbDeviceType, val); SetControlEnabled(cbUseTVMenuLanguage, val); SetControlEnabled(cbActivateSource, val); @@ -373,6 +376,21 @@ namespace CecConfigGui } } + protected override void Dispose(bool disposing) + { + if (disposing) + { + Lib.DisableCallbacks(); + Lib.StandbyDevices(CecLogicalAddress.Broadcast); + Lib.Close(); + } + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + #region Actions public void ReloadXMLConfiguration() { @@ -396,7 +414,7 @@ namespace CecConfigGui public void SetPhysicalAddress(ushort physicalAddress) { - if (!SuppressUpdates && ActiveProcess == null) + if (!SuppressUpdates && ActiveProcess == null && cbOverrideAddress.Checked) { SetControlsEnabled(false); SetControlText(cbPortNumber, string.Empty); @@ -464,9 +482,15 @@ namespace CecConfigGui #endregion #region Configuration tab + private void cbOverrideAddress_CheckedChanged(object sender, EventArgs e) + { + SetControlEnabled(tbPhysicalAddress, ((CheckBox)sender).Checked); + } + private void tbPhysicalAddress_TextChanged(object sender, EventArgs e) { - if (tbPhysicalAddress.Text.Length != 4) + if (tbPhysicalAddress.Text.Length != 4 || + cbOverrideAddress.Checked) return; ushort physicalAddress = 0; if (!ushort.TryParse(tbPhysicalAddress.Text, NumberStyles.AllowHexSpecifier, null, out physicalAddress)) @@ -554,7 +578,7 @@ namespace CecConfigGui StringBuilder output = new StringBuilder(); output.AppendLine(""); output.AppendLine(""); - output.AppendLine(""); + output.AppendLine(""); output.AppendLine(""); output.AppendLine(""); output.AppendLine(""); @@ -565,20 +589,25 @@ namespace CecConfigGui // only supported by 1.5.0+ clients output.AppendLine(""); - output.AppendLine(""); + output.AppendLine(""); + output.AppendLine(""); output.AppendLine(""); output.AppendLine(""); output.Append(""); output.Append(""); output.AppendLine(""); @@ -867,7 +896,7 @@ namespace CecConfigGui if (!SuppressUpdates && ActiveProcess == null) { SetControlsEnabled(false); - ActiveProcess = new RescanDevices(); + ActiveProcess = new RescanDevices(ref Lib); ActiveProcess.EventHandler += new EventHandler(ProcessEventHandler); (new Thread(new ThreadStart(ActiveProcess.Run))).Start(); } @@ -1015,6 +1044,8 @@ namespace CecConfigGui SetCheckboxItemChecked(cbWakeDevices, iPtr, Config.WakeDevices.IsSet((CecLogicalAddress)iPtr)); for (int iPtr = 0; iPtr < 15; iPtr++) SetCheckboxItemChecked(cbPowerOffDevices, iPtr, Config.PowerOffDevices.IsSet((CecLogicalAddress)iPtr)); + + SetControlText(this, "Pulse-Eight USB-CEC Adapter - libCEC " + Lib.ToString(Config.ServerVersion)); return 1; }