MDM166AA: Adding support for volume label.
authorStephaneLenclud
Sun, 08 Feb 2015 20:26:36 +0100
changeset 1155c61a13c4241
parent 114 debe115b3b22
child 116 5fc39c560179
MDM166AA: Adding support for volume label.
Server/Display.cs
Server/DisplaySettings.cs
Server/MainForm.Designer.cs
Server/MainForm.cs
     1.1 --- a/Server/Display.cs	Sun Feb 08 18:56:43 2015 +0100
     1.2 +++ b/Server/Display.cs	Sun Feb 08 20:26:36 2015 +0100
     1.3 @@ -231,6 +231,46 @@
     1.4  
     1.5  		}
     1.6  
     1.7 +		/// <summary>
     1.8 +		/// 
     1.9 +		/// </summary>
    1.10 +		/// <param name="aIcon"></param>
    1.11 +		/// <param name="aStatus"></param>
    1.12 +		public void SetIconStatus(TMiniDisplayIconType aIcon, int aStatus)
    1.13 +		{
    1.14 +			int iconCount = IconCount(aIcon);
    1.15 +			for (int i = 0; i < iconCount; i++)
    1.16 +			{
    1.17 +				SetIconStatus(aIcon, i, aStatus);
    1.18 +			}
    1.19 +		}
    1.20 +
    1.21 +		/// <summary>
    1.22 +		/// 
    1.23 +		/// </summary>
    1.24 +		/// <param name="aIcon"></param>
    1.25 +		public void SetIconOn(TMiniDisplayIconType aIcon)
    1.26 +		{
    1.27 +			int iconCount = IconCount(aIcon);
    1.28 +			for (int i = 0; i < iconCount; i++)
    1.29 +			{
    1.30 +				SetIconStatus(aIcon, i, IconStatusCount(aIcon) - 1);
    1.31 +			}
    1.32 +		}
    1.33 +
    1.34 +		/// <summary>
    1.35 +		/// 
    1.36 +		/// </summary>
    1.37 +		/// <param name="aIcon"></param>
    1.38 +		public void SetIconOff(TMiniDisplayIconType aIcon)
    1.39 +		{
    1.40 +			int iconCount = IconCount(aIcon);
    1.41 +			for (int i = 0; i < iconCount; i++)
    1.42 +			{
    1.43 +				SetIconStatus(aIcon, i, 0);
    1.44 +			}
    1.45 +		}
    1.46 +
    1.47  
    1.48  
    1.49          public string Vendor()
     2.1 --- a/Server/DisplaySettings.cs	Sun Feb 08 18:56:43 2015 +0100
     2.2 +++ b/Server/DisplaySettings.cs	Sun Feb 08 20:26:36 2015 +0100
     2.3 @@ -26,6 +26,7 @@
     2.4              ReverseScreen = false;
     2.5              InverseColors = true;
     2.6              ShowBorders = false;
     2.7 +			ShowVolumeLabel = false;
     2.8              FontName = "Microsoft Sans Serif, 9.75pt";
     2.9              ScaleToFit = true;
    2.10              MinFontSize = 15.0f;
    2.11 @@ -33,6 +34,10 @@
    2.12  			ScrollingSpeedInPixelsPerSecond = 64;
    2.13          }
    2.14  
    2.15 +
    2.16 +		[DataMember]
    2.17 +		public bool ShowVolumeLabel { get; set; }
    2.18 +
    2.19          [DataMember]
    2.20          public int Brightness { get; set; }
    2.21  
     3.1 --- a/Server/MainForm.Designer.cs	Sun Feb 08 18:56:43 2015 +0100
     3.2 +++ b/Server/MainForm.Designer.cs	Sun Feb 08 20:26:36 2015 +0100
     3.3 @@ -91,12 +91,13 @@
     3.4  			this.checkBoxAutoStart = new System.Windows.Forms.CheckBox();
     3.5  			this.buttonUpdate = new System.Windows.Forms.Button();
     3.6  			this.tabPageAudio = new System.Windows.Forms.TabPage();
     3.7 +			this.checkBoxMute = new System.Windows.Forms.CheckBox();
     3.8  			this.trackBarMasterVolume = new System.Windows.Forms.TrackBar();
     3.9  			this.labelFontWidth = new System.Windows.Forms.Label();
    3.10  			this.labelFontHeight = new System.Windows.Forms.Label();
    3.11  			this.pictureBoxDemo = new System.Windows.Forms.PictureBox();
    3.12  			this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    3.13 -			this.checkBoxMute = new System.Windows.Forms.CheckBox();
    3.14 +			this.checkBoxShowVolumeLabel = new System.Windows.Forms.CheckBox();
    3.15  			this.panelDisplay.SuspendLayout();
    3.16  			this.tableLayoutPanel.SuspendLayout();
    3.17  			this.statusStrip.SuspendLayout();
    3.18 @@ -691,6 +692,7 @@
    3.19  			// 
    3.20  			// tabPageAudio
    3.21  			// 
    3.22 +			this.tabPageAudio.Controls.Add(this.checkBoxShowVolumeLabel);
    3.23  			this.tabPageAudio.Controls.Add(this.checkBoxMute);
    3.24  			this.tabPageAudio.Controls.Add(this.trackBarMasterVolume);
    3.25  			this.tabPageAudio.Location = new System.Drawing.Point(4, 22);
    3.26 @@ -701,6 +703,18 @@
    3.27  			this.tabPageAudio.Text = "Audio";
    3.28  			this.tabPageAudio.UseVisualStyleBackColor = true;
    3.29  			// 
    3.30 +			// checkBoxMute
    3.31 +			// 
    3.32 +			this.checkBoxMute.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    3.33 +			this.checkBoxMute.AutoSize = true;
    3.34 +			this.checkBoxMute.Location = new System.Drawing.Point(3, 219);
    3.35 +			this.checkBoxMute.Name = "checkBoxMute";
    3.36 +			this.checkBoxMute.Size = new System.Drawing.Size(50, 17);
    3.37 +			this.checkBoxMute.TabIndex = 17;
    3.38 +			this.checkBoxMute.Text = "Mute";
    3.39 +			this.checkBoxMute.UseVisualStyleBackColor = true;
    3.40 +			this.checkBoxMute.CheckedChanged += new System.EventHandler(this.checkBoxMute_CheckedChanged);
    3.41 +			// 
    3.42  			// trackBarMasterVolume
    3.43  			// 
    3.44  			this.trackBarMasterVolume.BackColor = System.Drawing.SystemColors.Window;
    3.45 @@ -741,17 +755,17 @@
    3.46  			this.pictureBoxDemo.TabIndex = 21;
    3.47  			this.pictureBoxDemo.TabStop = false;
    3.48  			// 
    3.49 -			// checkBoxMute
    3.50 +			// checkBoxShowVolumeLabel
    3.51  			// 
    3.52 -			this.checkBoxMute.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    3.53 -			this.checkBoxMute.AutoSize = true;
    3.54 -			this.checkBoxMute.Location = new System.Drawing.Point(462, 219);
    3.55 -			this.checkBoxMute.Name = "checkBoxMute";
    3.56 -			this.checkBoxMute.Size = new System.Drawing.Size(50, 17);
    3.57 -			this.checkBoxMute.TabIndex = 17;
    3.58 -			this.checkBoxMute.Text = "Mute";
    3.59 -			this.checkBoxMute.UseVisualStyleBackColor = true;
    3.60 -			this.checkBoxMute.CheckedChanged += new System.EventHandler(this.checkBoxMute_CheckedChanged);
    3.61 +			this.checkBoxShowVolumeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    3.62 +			this.checkBoxShowVolumeLabel.AutoSize = true;
    3.63 +			this.checkBoxShowVolumeLabel.Location = new System.Drawing.Point(3, 196);
    3.64 +			this.checkBoxShowVolumeLabel.Name = "checkBoxShowVolumeLabel";
    3.65 +			this.checkBoxShowVolumeLabel.Size = new System.Drawing.Size(115, 17);
    3.66 +			this.checkBoxShowVolumeLabel.TabIndex = 18;
    3.67 +			this.checkBoxShowVolumeLabel.Text = "Show volume label";
    3.68 +			this.checkBoxShowVolumeLabel.UseVisualStyleBackColor = true;
    3.69 +			this.checkBoxShowVolumeLabel.CheckedChanged += new System.EventHandler(this.checkBoxShowVolumeLabel_CheckedChanged);
    3.70  			// 
    3.71  			// MainForm
    3.72  			// 
    3.73 @@ -856,6 +870,7 @@
    3.74  		private System.Windows.Forms.TabPage tabPageAudio;
    3.75  		private System.Windows.Forms.TrackBar trackBarMasterVolume;
    3.76  		private System.Windows.Forms.CheckBox checkBoxMute;
    3.77 +		private System.Windows.Forms.CheckBox checkBoxShowVolumeLabel;
    3.78      }
    3.79  }
    3.80  
     4.1 --- a/Server/MainForm.cs	Sun Feb 08 18:56:43 2015 +0100
     4.2 +++ b/Server/MainForm.cs	Sun Feb 08 20:26:36 2015 +0100
     4.3 @@ -233,7 +233,6 @@
     4.4  			iMultiMediaDevice.AudioEndpointVolume.Mute = checkBoxMute.Checked;
     4.5  		}
     4.6  
     4.7 -
     4.8          /// <summary>
     4.9          /// Device State Changed
    4.10          /// </summary>
    4.11 @@ -885,6 +884,7 @@
    4.12  			checkBoxStartMinimized.Checked = Properties.Settings.Default.StartMinimized;
    4.13              checkBoxReverseScreen.Checked = cds.ReverseScreen;
    4.14              checkBoxInverseColors.Checked = cds.InverseColors;
    4.15 +			checkBoxShowVolumeLabel.Checked = cds.ShowVolumeLabel;
    4.16              checkBoxScaleToFit.Checked = cds.ScaleToFit;
    4.17              maskedTextBoxMinFontSize.Enabled = cds.ScaleToFit;
    4.18              labelMinFontSize.Enabled = cds.ScaleToFit;
    4.19 @@ -955,11 +955,25 @@
    4.20                      buttonShowClock.Enabled = false;
    4.21                      buttonHideClock.Enabled = false;
    4.22                  }
    4.23 +
    4.24 +				
    4.25 +				//Check if Volume Label is supported. To date only MDM166AA supports that crap :)
    4.26 +				checkBoxShowVolumeLabel.Enabled = iDisplay.IconCount(Display.TMiniDisplayIconType.EMiniDisplayIconVolumeLabel)>0;
    4.27 +
    4.28 +				if (cds.ShowVolumeLabel)
    4.29 +				{
    4.30 +					iDisplay.SetIconOn(Display.TMiniDisplayIconType.EMiniDisplayIconVolumeLabel);
    4.31 +				}
    4.32 +				else
    4.33 +				{
    4.34 +					iDisplay.SetIconOff(Display.TMiniDisplayIconType.EMiniDisplayIconVolumeLabel);
    4.35 +				}
    4.36              }
    4.37              else
    4.38              {
    4.39  				//Display is connection not available
    4.40  				//Reflect that in our UI
    4.41 +				checkBoxShowVolumeLabel.Enabled = false;
    4.42  				tableLayoutPanel.Enabled = false;
    4.43  				panelDisplay.Enabled = false;
    4.44                  buttonFill.Enabled = false;
    4.45 @@ -978,6 +992,17 @@
    4.46          }
    4.47  
    4.48  
    4.49 +		/// <summary>
    4.50 +		/// 
    4.51 +		/// </summary>
    4.52 +		/// <param name="sender"></param>
    4.53 +		/// <param name="e"></param>
    4.54 +		private void checkBoxShowVolumeLabel_CheckedChanged(object sender, EventArgs e)
    4.55 +		{
    4.56 +			cds.ShowVolumeLabel = checkBoxShowVolumeLabel.Checked;
    4.57 +			Properties.Settings.Default.Save();
    4.58 +			UpdateStatus();
    4.59 +		}
    4.60  
    4.61          private void checkBoxShowBorders_CheckedChanged(object sender, EventArgs e)
    4.62          {
    4.63 @@ -1915,7 +1940,6 @@
    4.64  			//We need to re-create our bitmap.
    4.65  			iCreateBitmap = true;
    4.66  		}
    4.67 -
    4.68      }
    4.69  
    4.70      /// <summary>