# HG changeset patch # User StephaneLenclud # Date 1423423596 -3600 # Node ID 5c61a13c42413927f4fb21bd05a8e110f614e012 # Parent debe115b3b22414fcccbb367dc62677d8043d98a MDM166AA: Adding support for volume label. diff -r debe115b3b22 -r 5c61a13c4241 Server/Display.cs --- a/Server/Display.cs Sun Feb 08 18:56:43 2015 +0100 +++ b/Server/Display.cs Sun Feb 08 20:26:36 2015 +0100 @@ -231,6 +231,46 @@ } + /// + /// + /// + /// + /// + public void SetIconStatus(TMiniDisplayIconType aIcon, int aStatus) + { + int iconCount = IconCount(aIcon); + for (int i = 0; i < iconCount; i++) + { + SetIconStatus(aIcon, i, aStatus); + } + } + + /// + /// + /// + /// + public void SetIconOn(TMiniDisplayIconType aIcon) + { + int iconCount = IconCount(aIcon); + for (int i = 0; i < iconCount; i++) + { + SetIconStatus(aIcon, i, IconStatusCount(aIcon) - 1); + } + } + + /// + /// + /// + /// + public void SetIconOff(TMiniDisplayIconType aIcon) + { + int iconCount = IconCount(aIcon); + for (int i = 0; i < iconCount; i++) + { + SetIconStatus(aIcon, i, 0); + } + } + public string Vendor() diff -r debe115b3b22 -r 5c61a13c4241 Server/DisplaySettings.cs --- a/Server/DisplaySettings.cs Sun Feb 08 18:56:43 2015 +0100 +++ b/Server/DisplaySettings.cs Sun Feb 08 20:26:36 2015 +0100 @@ -26,6 +26,7 @@ ReverseScreen = false; InverseColors = true; ShowBorders = false; + ShowVolumeLabel = false; FontName = "Microsoft Sans Serif, 9.75pt"; ScaleToFit = true; MinFontSize = 15.0f; @@ -33,6 +34,10 @@ ScrollingSpeedInPixelsPerSecond = 64; } + + [DataMember] + public bool ShowVolumeLabel { get; set; } + [DataMember] public int Brightness { get; set; } diff -r debe115b3b22 -r 5c61a13c4241 Server/MainForm.Designer.cs --- a/Server/MainForm.Designer.cs Sun Feb 08 18:56:43 2015 +0100 +++ b/Server/MainForm.Designer.cs Sun Feb 08 20:26:36 2015 +0100 @@ -91,12 +91,13 @@ this.checkBoxAutoStart = new System.Windows.Forms.CheckBox(); this.buttonUpdate = new System.Windows.Forms.Button(); this.tabPageAudio = new System.Windows.Forms.TabPage(); + this.checkBoxMute = new System.Windows.Forms.CheckBox(); this.trackBarMasterVolume = new System.Windows.Forms.TrackBar(); this.labelFontWidth = new System.Windows.Forms.Label(); this.labelFontHeight = new System.Windows.Forms.Label(); this.pictureBoxDemo = new System.Windows.Forms.PictureBox(); this.toolTip = new System.Windows.Forms.ToolTip(this.components); - this.checkBoxMute = new System.Windows.Forms.CheckBox(); + this.checkBoxShowVolumeLabel = new System.Windows.Forms.CheckBox(); this.panelDisplay.SuspendLayout(); this.tableLayoutPanel.SuspendLayout(); this.statusStrip.SuspendLayout(); @@ -691,6 +692,7 @@ // // tabPageAudio // + this.tabPageAudio.Controls.Add(this.checkBoxShowVolumeLabel); this.tabPageAudio.Controls.Add(this.checkBoxMute); this.tabPageAudio.Controls.Add(this.trackBarMasterVolume); this.tabPageAudio.Location = new System.Drawing.Point(4, 22); @@ -701,6 +703,18 @@ this.tabPageAudio.Text = "Audio"; this.tabPageAudio.UseVisualStyleBackColor = true; // + // checkBoxMute + // + this.checkBoxMute.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.checkBoxMute.AutoSize = true; + this.checkBoxMute.Location = new System.Drawing.Point(3, 219); + this.checkBoxMute.Name = "checkBoxMute"; + this.checkBoxMute.Size = new System.Drawing.Size(50, 17); + this.checkBoxMute.TabIndex = 17; + this.checkBoxMute.Text = "Mute"; + this.checkBoxMute.UseVisualStyleBackColor = true; + this.checkBoxMute.CheckedChanged += new System.EventHandler(this.checkBoxMute_CheckedChanged); + // // trackBarMasterVolume // this.trackBarMasterVolume.BackColor = System.Drawing.SystemColors.Window; @@ -741,17 +755,17 @@ this.pictureBoxDemo.TabIndex = 21; this.pictureBoxDemo.TabStop = false; // - // checkBoxMute + // checkBoxShowVolumeLabel // - this.checkBoxMute.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.checkBoxMute.AutoSize = true; - this.checkBoxMute.Location = new System.Drawing.Point(462, 219); - this.checkBoxMute.Name = "checkBoxMute"; - this.checkBoxMute.Size = new System.Drawing.Size(50, 17); - this.checkBoxMute.TabIndex = 17; - this.checkBoxMute.Text = "Mute"; - this.checkBoxMute.UseVisualStyleBackColor = true; - this.checkBoxMute.CheckedChanged += new System.EventHandler(this.checkBoxMute_CheckedChanged); + this.checkBoxShowVolumeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.checkBoxShowVolumeLabel.AutoSize = true; + this.checkBoxShowVolumeLabel.Location = new System.Drawing.Point(3, 196); + this.checkBoxShowVolumeLabel.Name = "checkBoxShowVolumeLabel"; + this.checkBoxShowVolumeLabel.Size = new System.Drawing.Size(115, 17); + this.checkBoxShowVolumeLabel.TabIndex = 18; + this.checkBoxShowVolumeLabel.Text = "Show volume label"; + this.checkBoxShowVolumeLabel.UseVisualStyleBackColor = true; + this.checkBoxShowVolumeLabel.CheckedChanged += new System.EventHandler(this.checkBoxShowVolumeLabel_CheckedChanged); // // MainForm // @@ -856,6 +870,7 @@ private System.Windows.Forms.TabPage tabPageAudio; private System.Windows.Forms.TrackBar trackBarMasterVolume; private System.Windows.Forms.CheckBox checkBoxMute; + private System.Windows.Forms.CheckBox checkBoxShowVolumeLabel; } } diff -r debe115b3b22 -r 5c61a13c4241 Server/MainForm.cs --- a/Server/MainForm.cs Sun Feb 08 18:56:43 2015 +0100 +++ b/Server/MainForm.cs Sun Feb 08 20:26:36 2015 +0100 @@ -233,7 +233,6 @@ iMultiMediaDevice.AudioEndpointVolume.Mute = checkBoxMute.Checked; } - /// /// Device State Changed /// @@ -885,6 +884,7 @@ checkBoxStartMinimized.Checked = Properties.Settings.Default.StartMinimized; checkBoxReverseScreen.Checked = cds.ReverseScreen; checkBoxInverseColors.Checked = cds.InverseColors; + checkBoxShowVolumeLabel.Checked = cds.ShowVolumeLabel; checkBoxScaleToFit.Checked = cds.ScaleToFit; maskedTextBoxMinFontSize.Enabled = cds.ScaleToFit; labelMinFontSize.Enabled = cds.ScaleToFit; @@ -955,11 +955,25 @@ buttonShowClock.Enabled = false; buttonHideClock.Enabled = false; } + + + //Check if Volume Label is supported. To date only MDM166AA supports that crap :) + checkBoxShowVolumeLabel.Enabled = iDisplay.IconCount(Display.TMiniDisplayIconType.EMiniDisplayIconVolumeLabel)>0; + + if (cds.ShowVolumeLabel) + { + iDisplay.SetIconOn(Display.TMiniDisplayIconType.EMiniDisplayIconVolumeLabel); + } + else + { + iDisplay.SetIconOff(Display.TMiniDisplayIconType.EMiniDisplayIconVolumeLabel); + } } else { //Display is connection not available //Reflect that in our UI + checkBoxShowVolumeLabel.Enabled = false; tableLayoutPanel.Enabled = false; panelDisplay.Enabled = false; buttonFill.Enabled = false; @@ -978,6 +992,17 @@ } + /// + /// + /// + /// + /// + private void checkBoxShowVolumeLabel_CheckedChanged(object sender, EventArgs e) + { + cds.ShowVolumeLabel = checkBoxShowVolumeLabel.Checked; + Properties.Settings.Default.Save(); + UpdateStatus(); + } private void checkBoxShowBorders_CheckedChanged(object sender, EventArgs e) { @@ -1915,7 +1940,6 @@ //We need to re-create our bitmap. iCreateBitmap = true; } - } ///