# HG changeset patch # User sl # Date 1404842532 -7200 # Node ID 7c363a7a975edea7cc21ef5510b8921e4f7eba0d # Parent 5129c03ab7badc40ab870a9593f1b4ede5299e2a Persisting brightness, fixing brightness tracker steps, adding show borders option. diff -r 5129c03ab7ba -r 7c363a7a975e App.config --- a/App.config Tue Jul 08 18:59:07 2014 +0200 +++ b/App.config Tue Jul 08 20:02:12 2014 +0200 @@ -16,6 +16,9 @@ Microsoft Sans Serif, 9.75pt + + False + \ No newline at end of file diff -r 5129c03ab7ba -r 7c363a7a975e MainForm.Designer.cs --- a/MainForm.Designer.cs Tue Jul 08 18:59:07 2014 +0200 +++ b/MainForm.Designer.cs Tue Jul 08 20:02:12 2014 +0200 @@ -38,8 +38,6 @@ this.buttonOpen = new System.Windows.Forms.Button(); this.buttonCapture = new System.Windows.Forms.Button(); this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); - this.marqueeLabelTop = new SharpDisplayManager.MarqueeLabel(); - this.marqueeLabelBottom = new SharpDisplayManager.MarqueeLabel(); this.buttonFont = new System.Windows.Forms.Button(); this.tabPageTests = new System.Windows.Forms.TabPage(); this.fontDialog = new System.Windows.Forms.FontDialog(); @@ -48,6 +46,9 @@ this.toolStripStatusLabelConnect = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabelSpring = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabelFps = new System.Windows.Forms.ToolStripStatusLabel(); + this.checkBoxShowBorders = new System.Windows.Forms.CheckBox(); + this.marqueeLabelTop = new SharpDisplayManager.MarqueeLabel(); + this.marqueeLabelBottom = new SharpDisplayManager.MarqueeLabel(); this.tabControl.SuspendLayout(); this.tabPageDisplay.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.trackBarBrightness)).BeginInit(); @@ -70,6 +71,7 @@ // // tabPageDisplay // + this.tabPageDisplay.Controls.Add(this.checkBoxShowBorders); this.tabPageDisplay.Controls.Add(this.trackBarBrightness); this.tabPageDisplay.Controls.Add(this.buttonFill); this.tabPageDisplay.Controls.Add(this.buttonClear); @@ -198,39 +200,6 @@ this.tableLayoutPanel.Size = new System.Drawing.Size(256, 64); this.tableLayoutPanel.TabIndex = 4; // - // marqueeLabelTop - // - this.marqueeLabelTop.AutoEllipsis = true; - this.marqueeLabelTop.BackColor = System.Drawing.Color.Transparent; - this.marqueeLabelTop.Dock = System.Windows.Forms.DockStyle.Fill; - this.marqueeLabelTop.Location = new System.Drawing.Point(1, 1); - this.marqueeLabelTop.Margin = new System.Windows.Forms.Padding(0); - this.marqueeLabelTop.Name = "marqueeLabelTop"; - this.marqueeLabelTop.OwnTimer = false; - this.marqueeLabelTop.PixelsPerSecond = 64; - this.marqueeLabelTop.Separator = ""; - this.marqueeLabelTop.Size = new System.Drawing.Size(254, 30); - this.marqueeLabelTop.TabIndex = 2; - this.marqueeLabelTop.Text = "ABCDEFGHIJKLMNOPQRST-0123456789"; - this.marqueeLabelTop.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.marqueeLabelTop.UseCompatibleTextRendering = true; - // - // marqueeLabelBottom - // - this.marqueeLabelBottom.AutoEllipsis = true; - this.marqueeLabelBottom.Dock = System.Windows.Forms.DockStyle.Fill; - this.marqueeLabelBottom.Location = new System.Drawing.Point(1, 32); - this.marqueeLabelBottom.Margin = new System.Windows.Forms.Padding(0); - this.marqueeLabelBottom.Name = "marqueeLabelBottom"; - this.marqueeLabelBottom.OwnTimer = false; - this.marqueeLabelBottom.PixelsPerSecond = 64; - this.marqueeLabelBottom.Separator = " | "; - this.marqueeLabelBottom.Size = new System.Drawing.Size(254, 31); - this.marqueeLabelBottom.TabIndex = 3; - this.marqueeLabelBottom.Text = "abcdefghijklmnopqrst-0123456789"; - this.marqueeLabelBottom.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.marqueeLabelBottom.UseCompatibleTextRendering = true; - // // buttonFont // this.buttonFont.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -289,6 +258,50 @@ this.toolStripStatusLabelFps.Size = new System.Drawing.Size(26, 17); this.toolStripStatusLabelFps.Text = "FPS"; // + // checkBoxShowBorders + // + this.checkBoxShowBorders.AutoSize = true; + this.checkBoxShowBorders.Location = new System.Drawing.Point(113, 344); + this.checkBoxShowBorders.Name = "checkBoxShowBorders"; + this.checkBoxShowBorders.Size = new System.Drawing.Size(91, 17); + this.checkBoxShowBorders.TabIndex = 11; + this.checkBoxShowBorders.Text = "Show borders"; + this.checkBoxShowBorders.UseVisualStyleBackColor = true; + this.checkBoxShowBorders.CheckedChanged += new System.EventHandler(this.checkBoxShowBorders_CheckedChanged); + // + // marqueeLabelTop + // + this.marqueeLabelTop.AutoEllipsis = true; + this.marqueeLabelTop.BackColor = System.Drawing.Color.Transparent; + this.marqueeLabelTop.Dock = System.Windows.Forms.DockStyle.Fill; + this.marqueeLabelTop.Location = new System.Drawing.Point(1, 1); + this.marqueeLabelTop.Margin = new System.Windows.Forms.Padding(0); + this.marqueeLabelTop.Name = "marqueeLabelTop"; + this.marqueeLabelTop.OwnTimer = false; + this.marqueeLabelTop.PixelsPerSecond = 64; + this.marqueeLabelTop.Separator = ""; + this.marqueeLabelTop.Size = new System.Drawing.Size(254, 9); + this.marqueeLabelTop.TabIndex = 2; + this.marqueeLabelTop.Text = "ABCDEFGHIJKLMNOPQRST-0123456789"; + this.marqueeLabelTop.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.marqueeLabelTop.UseCompatibleTextRendering = true; + // + // marqueeLabelBottom + // + this.marqueeLabelBottom.AutoEllipsis = true; + this.marqueeLabelBottom.Dock = System.Windows.Forms.DockStyle.Fill; + this.marqueeLabelBottom.Location = new System.Drawing.Point(1, 21); + this.marqueeLabelBottom.Margin = new System.Windows.Forms.Padding(0); + this.marqueeLabelBottom.Name = "marqueeLabelBottom"; + this.marqueeLabelBottom.OwnTimer = false; + this.marqueeLabelBottom.PixelsPerSecond = 64; + this.marqueeLabelBottom.Separator = null; + this.marqueeLabelBottom.Size = new System.Drawing.Size(254, 20); + this.marqueeLabelBottom.TabIndex = 3; + this.marqueeLabelBottom.Text = "abcdefghijklmnopqrst-0123456789"; + this.marqueeLabelBottom.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.marqueeLabelBottom.UseCompatibleTextRendering = true; + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -332,6 +345,7 @@ private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelConnect; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelFps; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelSpring; + private System.Windows.Forms.CheckBox checkBoxShowBorders; } } diff -r 5129c03ab7ba -r 7c363a7a975e MainForm.cs --- a/MainForm.cs Tue Jul 08 18:59:07 2014 +0200 +++ b/MainForm.cs Tue Jul 08 20:02:12 2014 +0200 @@ -26,6 +26,7 @@ //Load settings marqueeLabelTop.Font = Properties.Settings.Default.DisplayFont; marqueeLabelBottom.Font = Properties.Settings.Default.DisplayFont; + checkBoxShowBorders.Checked = Properties.Settings.Default.DisplayShowBorders; } private void buttonFont_Click(object sender, EventArgs e) @@ -89,7 +90,7 @@ unchecked { uint color=(uint)bmp.GetPixel(i, j).ToArgb(); - iDisplay.SetPixel(i, j, Convert.ToInt32(color!=0xFFFFFFFF)); + iDisplay.SetPixel(i, j, Convert.ToInt32((checkBoxShowBorders.Checked?color!=0xFFFFFFFF:color == 0xFF000000))); } } } @@ -122,6 +123,7 @@ private void buttonClose_Click(object sender, EventArgs e) { iDisplay.Close(); + UpdateStatus(); } private void buttonClear_Click(object sender, EventArgs e) @@ -138,7 +140,10 @@ private void trackBarBrightness_Scroll(object sender, EventArgs e) { + Properties.Settings.Default.DisplayBrightness = trackBarBrightness.Value; + Properties.Settings.Default.Save(); iDisplay.SetBrightness(trackBarBrightness.Value); + } private void UpdateStatus() @@ -151,7 +156,12 @@ buttonClose.Enabled = true; trackBarBrightness.Enabled = true; trackBarBrightness.Minimum = iDisplay.MinBrightness(); - trackBarBrightness.Maximum = iDisplay.MaxBrightness(); + trackBarBrightness.Maximum = iDisplay.MaxBrightness(); + trackBarBrightness.Value = Properties.Settings.Default.DisplayBrightness; + trackBarBrightness.LargeChange = Math.Max(1,(iDisplay.MaxBrightness() - iDisplay.MinBrightness())/5); + trackBarBrightness.SmallChange = 1; + iDisplay.SetBrightness(Properties.Settings.Default.DisplayBrightness); + toolStripStatusLabelConnect.Text = "Connected"; } else @@ -161,8 +171,14 @@ buttonOpen.Enabled = true; buttonClose.Enabled = false; trackBarBrightness.Enabled = false; - toolStripStatusLabelConnect.Text = "Not connected"; + toolStripStatusLabelConnect.Text = "Disconnected"; } } + + private void checkBoxShowBorders_CheckedChanged(object sender, EventArgs e) + { + Properties.Settings.Default.DisplayShowBorders = checkBoxShowBorders.Checked; + Properties.Settings.Default.Save(); + } } } diff -r 5129c03ab7ba -r 7c363a7a975e Properties/Settings.Designer.cs --- a/Properties/Settings.Designer.cs Tue Jul 08 18:59:07 2014 +0200 +++ b/Properties/Settings.Designer.cs Tue Jul 08 20:02:12 2014 +0200 @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18063 +// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -46,5 +46,17 @@ this["DisplayFont"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool DisplayShowBorders { + get { + return ((bool)(this["DisplayShowBorders"])); + } + set { + this["DisplayShowBorders"] = value; + } + } } } diff -r 5129c03ab7ba -r 7c363a7a975e Properties/Settings.settings --- a/Properties/Settings.settings Tue Jul 08 18:59:07 2014 +0200 +++ b/Properties/Settings.settings Tue Jul 08 20:02:12 2014 +0200 @@ -8,5 +8,8 @@ Microsoft Sans Serif, 9.75pt + + False + \ No newline at end of file