From 270d5b18309adbc00813efa5a807487e75db8666 Mon Sep 17 00:00:00 2001 From: mandrolic Date: Sat, 29 Jan 2011 09:07:42 +0000 Subject: [PATCH] Configurator.Net: Added visual indication of origin for gyro/accel indicators git-svn-id: https://arducopter.googlecode.com/svn/trunk@1573 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- .../Views/FlightDataView.Designer.cs | 6 ++-- .../Views/TransmitterChannelsView.Designer.cs | 12 +++---- .../Views/controls/LinearIndicatorControl.cs | 32 +++++++++++++++---- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Configurator/Configurator.Net/Views/FlightDataView.Designer.cs b/Configurator/Configurator.Net/Views/FlightDataView.Designer.cs index 30df9a1b98..908e03cbc7 100644 --- a/Configurator/Configurator.Net/Views/FlightDataView.Designer.cs +++ b/Configurator/Configurator.Net/Views/FlightDataView.Designer.cs @@ -101,7 +101,7 @@ // // textBox1 // - this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.FlightDataVmBindingSource, "MotorLeft", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, null, "N0")); + this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.FlightDataVmBindingSource, "MotorLeft", true)); this.textBox1.Location = new System.Drawing.Point(2, 247); this.textBox1.Name = "textBox1"; this.textBox1.ReadOnly = true; @@ -144,9 +144,9 @@ this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(12, 62); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(57, 13); + this.label6.Size = new System.Drawing.Size(55, 13); this.label6.TabIndex = 15; - this.label6.Text = "Roll Accell"; + this.label6.Text = "Roll Accel"; // // textBox4 // diff --git a/Configurator/Configurator.Net/Views/TransmitterChannelsView.Designer.cs b/Configurator/Configurator.Net/Views/TransmitterChannelsView.Designer.cs index 0b0c9499cd..595654943e 100644 --- a/Configurator/Configurator.Net/Views/TransmitterChannelsView.Designer.cs +++ b/Configurator/Configurator.Net/Views/TransmitterChannelsView.Designer.cs @@ -180,7 +180,7 @@ this.linearIndicatorControl3.Offset = 0; this.linearIndicatorControl3.Size = new System.Drawing.Size(20, 111); this.linearIndicatorControl3.TabIndex = 43; - this.linearIndicatorControl3.Value = 1000; + this.linearIndicatorControl3.Value = 1600; // // linearIndicatorControl1 // @@ -199,7 +199,7 @@ this.linearIndicatorControl1.Offset = 0; this.linearIndicatorControl1.Size = new System.Drawing.Size(20, 111); this.linearIndicatorControl1.TabIndex = 44; - this.linearIndicatorControl1.Value = 1000; + this.linearIndicatorControl1.Value = 1100; // // linearIndicatorControl2 // @@ -218,7 +218,7 @@ this.linearIndicatorControl2.Offset = 0; this.linearIndicatorControl2.Size = new System.Drawing.Size(20, 73); this.linearIndicatorControl2.TabIndex = 45; - this.linearIndicatorControl2.Value = 1000; + this.linearIndicatorControl2.Value = 1050; // // linearIndicatorControl4 // @@ -237,7 +237,7 @@ this.linearIndicatorControl4.Offset = 0; this.linearIndicatorControl4.Size = new System.Drawing.Size(20, 73); this.linearIndicatorControl4.TabIndex = 46; - this.linearIndicatorControl4.Value = 1000; + this.linearIndicatorControl4.Value = 1900; // // linearIndicatorControl5 // @@ -256,7 +256,7 @@ this.linearIndicatorControl5.Offset = 0; this.linearIndicatorControl5.Size = new System.Drawing.Size(100, 20); this.linearIndicatorControl5.TabIndex = 47; - this.linearIndicatorControl5.Value = 1000; + this.linearIndicatorControl5.Value = 1300; // // linearIndicatorControl6 // @@ -275,7 +275,7 @@ this.linearIndicatorControl6.Offset = 0; this.linearIndicatorControl6.Size = new System.Drawing.Size(100, 20); this.linearIndicatorControl6.TabIndex = 48; - this.linearIndicatorControl6.Value = 1000; + this.linearIndicatorControl6.Value = 1200; // // TransmitterChannelsView // diff --git a/Configurator/Configurator.Net/Views/controls/LinearIndicatorControl.cs b/Configurator/Configurator.Net/Views/controls/LinearIndicatorControl.cs index 04d1c8ef91..c6d2f1f29d 100644 --- a/Configurator/Configurator.Net/Views/controls/LinearIndicatorControl.cs +++ b/Configurator/Configurator.Net/Views/controls/LinearIndicatorControl.cs @@ -127,13 +127,7 @@ namespace ArducopterConfigurator.Views.controls using (var white = new LinearGradientBrush(rect, _barBgLightColour, _barBgDarkColor, isVertical ? 0 : 90.0F, false)) g.FillRectangle(white, rect); - // Border around the whole thing - using (Pen p = new Pen(_borderColor, _borderWidth * 2)) - { - p.Alignment = PenAlignment.Outset; - p.LineJoin = LineJoin.Round; - g.DrawRectangle(p, x, y, width, height); - } + // Now do the progress bar that represents the value var barSize = (float)Math.Abs(_val - _offset) / (_max - _min) * (isVertical ? height : width); @@ -149,6 +143,8 @@ namespace ArducopterConfigurator.Views.controls using (var bg = new LinearGradientBrush(rect, _barLightColour, _barDarkColour, isVertical ? 0 : 90.0F, false)) g.FillRectangle(bg, rect); + + using (Pen p = new Pen(_borderColor, _borderWidth)) { p.Alignment = PenAlignment.Inset; @@ -157,6 +153,28 @@ namespace ArducopterConfigurator.Views.controls } } + + // Now the line that represents the Offset/Origin + if (_offset > _min && _offset < _max) + using (Pen p = new Pen(_borderColor, _borderWidth)) + { + var linePos = (float)(_offset - _min) / (_max - _min) * (isVertical ? height : width); + + if (isVertical) + g.DrawLine(p, 0, linePos, width, linePos); + else + g.DrawLine(p, linePos, 0, linePos, height); + } + + + // Border around the whole thing + using (Pen p = new Pen(_borderColor, _borderWidth * 2)) + { + p.Alignment = PenAlignment.Outset; + p.LineJoin = LineJoin.Round; + g.DrawRectangle(p, x, y, width, height); + } + // using (Pen p = new Pen(_barDarkColour, _borderWidth)) // { // p.Alignment = PenAlignment.Inset;