diff --git a/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs
index ad65cecda1..80114f674e 100644
--- a/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs
+++ b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs
@@ -19,7 +19,7 @@ namespace ArdupilotMega.Antenna
{
InitializeComponent();
- MainV2.fixtheme(this);
+ ThemeManager.ApplyThemeTo(this);
CMB_serialport.DataSource = SerialPort.GetPortNames();
diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj
index f14a442d90..d059812cba 100644
--- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj
+++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj
@@ -241,6 +241,7 @@
Tracker.cs
+
Form
@@ -464,6 +465,7 @@
+
Tracker.cs
diff --git a/Tools/ArdupilotMegaPlanner/Common.cs b/Tools/ArdupilotMegaPlanner/Common.cs
index 2e16ee37a8..74f101f290 100644
--- a/Tools/ArdupilotMegaPlanner/Common.cs
+++ b/Tools/ArdupilotMegaPlanner/Common.cs
@@ -652,7 +652,7 @@ namespace ArdupilotMega
form.MinimizeBox = false;
form.MaximizeBox = false;
- MainV2.fixtheme(form);
+ ThemeManager.ApplyThemeTo(form);
form.Show();
form.Refresh();
@@ -706,7 +706,7 @@ namespace ArdupilotMega
form.MinimizeBox = false;
form.MaximizeBox = false;
- MainV2.fixtheme(form);
+ ThemeManager.ApplyThemeTo(form);
DialogResult dialogResult =form.ShowDialog();
@@ -760,7 +760,7 @@ namespace ArdupilotMega
form.AcceptButton = buttonOk;
form.CancelButton = buttonCancel;
- MainV2.fixtheme(form);
+ ThemeManager.ApplyThemeTo(form);
DialogResult dialogResult = DialogResult.Cancel;
diff --git a/Tools/ArdupilotMegaPlanner/CommsUdpSerial.cs b/Tools/ArdupilotMegaPlanner/CommsUdpSerial.cs
index a5ac6dbf51..628a3616ec 100644
--- a/Tools/ArdupilotMegaPlanner/CommsUdpSerial.cs
+++ b/Tools/ArdupilotMegaPlanner/CommsUdpSerial.cs
@@ -86,7 +86,7 @@ namespace System.IO.Ports
frmProgressReporter.UpdateProgressAndStatus(-1, "Connecting Mavlink UDP");
- ArdupilotMega.MainV2.fixtheme(frmProgressReporter);
+ ArdupilotMega.ThemeManager.ApplyThemeTo(frmProgressReporter);
frmProgressReporter.RunBackgroundOperationAsync();
diff --git a/Tools/ArdupilotMegaPlanner/Controls/MessageBox.cs b/Tools/ArdupilotMegaPlanner/Controls/MessageBox.cs
new file mode 100644
index 0000000000..53cd628146
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/Controls/MessageBox.cs
@@ -0,0 +1,237 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using ArdupilotMega.Controls;
+using System.Text;
+using ArdupilotMega;
+
+namespace System.Windows.Forms
+{
+ public static class MessageBox
+ {
+ const int FORM_Y_MARGIN = 10;
+ const int FORM_X_MARGIN = 16;
+
+ static DialogResult _state = DialogResult.None;
+
+ public static DialogResult Show(string text)
+ {
+ return Show(text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None);
+ }
+
+ public static DialogResult Show(string text, string caption)
+ {
+ return Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.None);
+ }
+
+ public static DialogResult Show(string text, string caption, MessageBoxButtons buttons)
+ {
+ return Show(text, caption, buttons, MessageBoxIcon.None);
+ }
+
+ public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
+ {
+ if (text == null)
+ text = "";
+
+ if (caption == null)
+ caption = "";
+
+ // ensure we are always in a known state
+ _state = DialogResult.None;
+
+ // convert to nice wrapped lines.
+ text = AddNewLinesToText(text);
+ // get pixel width and height
+ Size textSize = TextRenderer.MeasureText(text, SystemFonts.DefaultFont);
+ // allow for icon
+ if (icon != MessageBoxIcon.None)
+ textSize.Width += SystemIcons.Question.Width;
+
+ var msgBoxFrm = new Form
+ {
+ FormBorderStyle = FormBorderStyle.FixedDialog,
+ ShowInTaskbar = false,
+ StartPosition = FormStartPosition.CenterScreen,
+ Text = caption,
+ MaximizeBox = false,
+ MinimizeBox = false,
+ Width = textSize.Width + 50,
+ Height = textSize.Height + 100,
+ TopMost = true,
+ };
+
+ Rectangle screenRectangle = msgBoxFrm.RectangleToScreen(msgBoxFrm.ClientRectangle);
+ int titleHeight = screenRectangle.Top - msgBoxFrm.Top;
+
+ var lblMessage = new Label
+ {
+ Left = 58,
+ Top = 15,
+ Width = textSize.Width + 10,
+ Height = textSize.Height + 10,
+ Text = text
+ };
+
+ msgBoxFrm.Controls.Add(lblMessage);
+
+ var actualIcon = getMessageBoxIcon(icon);
+
+ if (actualIcon == null)
+ {
+ lblMessage.Location = new Point(FORM_X_MARGIN, FORM_Y_MARGIN);
+ }
+ else
+ {
+ var iconPbox = new PictureBox
+ {
+ Image = actualIcon.ToBitmap(),
+ Location = new Point(FORM_X_MARGIN, FORM_Y_MARGIN)
+ };
+ msgBoxFrm.Controls.Add(iconPbox);
+ }
+
+
+ AddButtonsToForm(msgBoxFrm, buttons);
+
+ ThemeManager.ApplyThemeTo(msgBoxFrm);
+
+ if (System.Windows.Forms.Application.OpenForms.Count > 0)
+ {
+ msgBoxFrm.StartPosition = FormStartPosition.Manual;
+ Form parentForm = System.Windows.Forms.Application.OpenForms[0];
+ // center of first form
+ msgBoxFrm.Location = new Point(parentForm.Location.X + parentForm.Width / 2 - msgBoxFrm.Width / 2,
+ parentForm.Location.Y + parentForm.Height / 2 - msgBoxFrm.Height / 2);
+ DialogResult test = msgBoxFrm.ShowDialog();
+ }
+ else
+ {
+ DialogResult test = msgBoxFrm.ShowDialog();
+ }
+
+ DialogResult answer = _state;
+
+ return answer;
+ }
+
+ static void msgBoxFrm_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ throw new NotImplementedException();
+ }
+
+ // from http://stackoverflow.com/questions/2512781/winforms-big-paragraph-tooltip/2512895#2512895
+ private static int maximumSingleLineTooltipLength = 85;
+
+ private static string AddNewLinesToText(string text)
+ {
+ if (text.Length < maximumSingleLineTooltipLength)
+ return text;
+ int lineLength = maximumSingleLineTooltipLength;
+ StringBuilder sb = new StringBuilder();
+ int currentLinePosition = 0;
+ for (int textIndex = 0; textIndex < text.Length; textIndex++)
+ {
+ // If we have reached the target line length and the next
+ // character is whitespace then begin a new line.
+ if (currentLinePosition >= lineLength &&
+ char.IsWhiteSpace(text[textIndex]))
+ {
+ sb.Append(Environment.NewLine);
+ currentLinePosition = 0;
+ }
+ // If we have just started a new line, skip all the whitespace.
+ if (currentLinePosition == 0)
+ while (textIndex < text.Length && char.IsWhiteSpace(text[textIndex]))
+ textIndex++;
+ // Append the next character.
+ if (textIndex < text.Length) sb.Append(text[textIndex]);
+ currentLinePosition++;
+ }
+ return sb.ToString();
+ }
+
+ private static void AddButtonsToForm(Form msgBoxFrm, MessageBoxButtons buttons)
+ {
+ Rectangle screenRectangle = msgBoxFrm.RectangleToScreen(msgBoxFrm.ClientRectangle);
+ int titleHeight = screenRectangle.Top - msgBoxFrm.Top;
+
+ var t = Type.GetType("Mono.Runtime");
+ if ((t != null))
+ titleHeight = 25;
+
+ switch (buttons)
+ {
+ case MessageBoxButtons.OK:
+ var but = new MyButton
+ {
+ Size = new Size(75, 23),
+ Text = "OK",
+ Left = msgBoxFrm.Width - 75 - FORM_X_MARGIN,
+ Top = msgBoxFrm.Height - 23 - FORM_Y_MARGIN - titleHeight
+ };
+
+ but.Click += delegate { _state = DialogResult.OK; msgBoxFrm.Close(); };
+ msgBoxFrm.Controls.Add(but);
+ msgBoxFrm.AcceptButton = but;
+ break;
+
+ case MessageBoxButtons.YesNo:
+
+ if (msgBoxFrm.Width < (75 * 2 + FORM_X_MARGIN * 3))
+ msgBoxFrm.Width = (75 * 2 + FORM_X_MARGIN * 3);
+
+ var butyes = new MyButton
+ {
+ Size = new Size(75, 23),
+ Text = "Yes",
+ Left = msgBoxFrm.Width - 75 * 2 - FORM_X_MARGIN * 2,
+ Top = msgBoxFrm.Height - 23 - FORM_Y_MARGIN - titleHeight
+ };
+
+ butyes.Click += delegate { _state = DialogResult.Yes; msgBoxFrm.Close(); };
+ msgBoxFrm.Controls.Add(butyes);
+ msgBoxFrm.AcceptButton = butyes;
+
+ var butno = new MyButton
+ {
+ Size = new Size(75, 23),
+ Text = "No",
+ Left = msgBoxFrm.Width - 75 - FORM_X_MARGIN,
+ Top = msgBoxFrm.Height - 23 - FORM_Y_MARGIN - titleHeight
+ };
+
+ butno.Click += delegate { _state = DialogResult.No; msgBoxFrm.Close(); };
+ msgBoxFrm.Controls.Add(butno);
+ msgBoxFrm.CancelButton = butno;
+ break;
+
+ default:
+ throw new NotImplementedException("Only MessageBoxButtons.OK and YesNo supported at this time");
+ }
+ }
+
+ ///
+ /// Get system icon for MessageBoxIcon.
+ ///
+ /// The MessageBoxIcon value.
+ /// SystemIcon type Icon.
+ private static Icon getMessageBoxIcon(MessageBoxIcon icon)
+ {
+ switch (icon)
+ {
+ case MessageBoxIcon.Asterisk:
+ return SystemIcons.Asterisk;
+ case MessageBoxIcon.Error:
+ return SystemIcons.Error;
+ case MessageBoxIcon.Exclamation:
+ return SystemIcons.Exclamation;
+ case MessageBoxIcon.Question:
+ return SystemIcons.Question;
+ default:
+ return null;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Tools/ArdupilotMegaPlanner/Controls/ProgressReporterDialogue.cs b/Tools/ArdupilotMegaPlanner/Controls/ProgressReporterDialogue.cs
index 4a055197cd..85757abd5e 100644
--- a/Tools/ArdupilotMegaPlanner/Controls/ProgressReporterDialogue.cs
+++ b/Tools/ArdupilotMegaPlanner/Controls/ProgressReporterDialogue.cs
@@ -42,7 +42,16 @@ namespace ArdupilotMega.Controls
private void RunBackgroundOperation(object o)
{
- Thread.CurrentThread.Name = "ProgressReporterDialogue Background thread";
+ try
+ {
+ Thread.CurrentThread.Name = "ProgressReporterDialogue Background thread";
+ }
+ catch { } // ok on windows - fails on mono
+
+ // mono fix - ensure the dialog is running
+ while (this.IsHandleCreated == false)
+ System.Threading.Thread.Sleep(5);
+
try
{
if (this.DoWork != null) this.DoWork(this, doWorkArgs);
@@ -56,6 +65,7 @@ namespace ArdupilotMega.Controls
return;
}
+
if (doWorkArgs.CancelRequested && doWorkArgs.CancelAcknowledged)
{
ShowDoneCancelled();
diff --git a/Tools/ArdupilotMegaPlanner/CustomMessageBox.cs b/Tools/ArdupilotMegaPlanner/CustomMessageBox.cs
new file mode 100644
index 0000000000..592263567f
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/CustomMessageBox.cs
@@ -0,0 +1,132 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using ArdupilotMega.Controls;
+
+namespace ArdupilotMega
+{
+ public static class CustomMessageBox
+ {
+ const int FORM_Y_MARGIN = 10;
+ const int FORM_X_MARGIN = 16;
+
+ public static DialogResult Show(string text)
+ {
+ return Show(text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None);
+ }
+
+ public static DialogResult Show(string text, string caption)
+ {
+ return Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.None);
+ }
+
+ public static DialogResult Show(string text, string caption, MessageBoxButtons buttons)
+ {
+ return Show(text, caption, buttons, MessageBoxIcon.None);
+ }
+
+ public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
+ {
+ var msgBoxFrm = new Form
+ {
+ FormBorderStyle = FormBorderStyle.FixedDialog,
+ ShowInTaskbar = false,
+ StartPosition = FormStartPosition.CenterScreen,
+ Text = caption,
+ MaximizeBox = false,
+ MinimizeBox = false,
+ Width = 400,
+ Height = 170
+ };
+
+ Rectangle screenRectangle = msgBoxFrm.RectangleToScreen(msgBoxFrm.ClientRectangle);
+ int titleHeight = screenRectangle.Top - msgBoxFrm.Top;
+
+ var lblMessage = new Label
+ {
+ Left = 58,
+ Top = 15,
+ Width = 300,
+ Text = text,
+ AutoSize = true,
+ };
+
+
+
+ msgBoxFrm.Controls.Add(lblMessage);
+
+ var actualIcon = getMessageBoxIcon(icon);
+
+ if (actualIcon == null)
+ {
+ lblMessage.Location = new Point(FORM_X_MARGIN, FORM_Y_MARGIN);
+ }
+ else
+ {
+ var iconPbox = new PictureBox
+ {
+ Image = actualIcon.ToBitmap(),
+ Location = new Point(FORM_X_MARGIN, FORM_Y_MARGIN)
+ };
+ msgBoxFrm.Controls.Add(iconPbox);
+ }
+
+
+ AddButtonsToForm(msgBoxFrm, buttons);
+
+ ThemeManager.ApplyThemeTo(msgBoxFrm);
+
+ msgBoxFrm.ShowDialog();
+
+ return DialogResult.OK;
+ }
+
+ private static void AddButtonsToForm(Form msgBoxFrm, MessageBoxButtons buttons)
+ {
+ Rectangle screenRectangle = msgBoxFrm.RectangleToScreen(msgBoxFrm.ClientRectangle);
+ int titleHeight = screenRectangle.Top - msgBoxFrm.Top;
+
+ switch (buttons)
+ {
+ case MessageBoxButtons.OK:
+ var but = new CustomButton
+ {
+ Size = new Size(75, 23),
+ Text = "OK",
+ Left = msgBoxFrm.Width - 75 - FORM_X_MARGIN,
+ Top = msgBoxFrm.Height - 23 - FORM_Y_MARGIN - titleHeight
+ };
+
+ but.Click += delegate { msgBoxFrm.Close(); };
+ msgBoxFrm.Controls.Add(but);
+ break;
+
+ default:
+ throw new NotImplementedException("Only MessageBoxButtons.OK supported at this time");
+ }
+ }
+
+ ///
+ /// Get system icon for MessageBoxIcon.
+ ///
+ /// The MessageBoxIcon value.
+ /// SystemIcon type Icon.
+ private static Icon getMessageBoxIcon(MessageBoxIcon icon)
+ {
+ switch (icon)
+ {
+ case MessageBoxIcon.Asterisk:
+ return SystemIcons.Asterisk;
+ case MessageBoxIcon.Error:
+ return SystemIcons.Error;
+ case MessageBoxIcon.Exclamation:
+ return SystemIcons.Exclamation;
+ case MessageBoxIcon.Question:
+ return SystemIcons.Question;
+ default:
+ return null;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs
index 6ef519fefa..04287df16e 100644
--- a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs
+++ b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs
@@ -734,7 +734,7 @@ namespace ArdupilotMega.GCSViews
temp.Configuration = this;
- MainV2.fixtheme(temp);
+ ThemeManager.ApplyThemeTo(temp);
temp.ShowDialog();
@@ -985,7 +985,7 @@ namespace ArdupilotMega.GCSViews
private void BUT_Joystick_Click(object sender, EventArgs e)
{
Form joy = new JoystickSetup();
- MainV2.fixtheme(joy);
+ ThemeManager.ApplyThemeTo(joy);
joy.Show();
}
@@ -1146,7 +1146,7 @@ namespace ArdupilotMega.GCSViews
sr.Close();
ParamCompare temp = new ParamCompare(this, param, param2);
- MainV2.fixtheme(temp);
+ ThemeManager.ApplyThemeTo(temp);
temp.ShowDialog();
}
}
diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs
index b2ae277080..ab5651f73a 100644
--- a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs
+++ b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs
@@ -226,7 +226,7 @@ namespace ArdupilotMega.GCSViews
else if (items.Count == 2 && false)
{
XorPlus select = new XorPlus();
- MainV2.fixtheme(select);
+ ThemeManager.ApplyThemeTo(select);
select.ShowDialog();
int a = 0;
@@ -685,7 +685,7 @@ namespace ArdupilotMega.GCSViews
private void BUT_setup_Click(object sender, EventArgs e)
{
Form temp = new Setup.Setup();
- MainV2.fixtheme(temp);
+ ThemeManager.ApplyThemeTo(temp);
temp.ShowDialog();
}
diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs
index 0d98ff5403..2e55ef0f2f 100644
--- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs
+++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs
@@ -280,7 +280,7 @@ namespace ArdupilotMega.GCSViews
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RC_CHANNELS, MainV2.cs.raterc); // request rc info
}
catch { }
- lastdata = DateTime.Now; // prevent flooding
+ lastdata = DateTime.Now.AddSeconds(12); // prevent flooding
}
if (!MainV2.comPort.logreadmode)
@@ -852,7 +852,7 @@ namespace ArdupilotMega.GCSViews
private void BUT_RAWSensor_Click(object sender, EventArgs e)
{
Form temp = new RAW_Sensor();
- MainV2.fixtheme(temp);
+ ThemeManager.ApplyThemeTo(temp);
temp.Show();
}
@@ -1185,14 +1185,14 @@ namespace ArdupilotMega.GCSViews
}
Form frm = new MavlinkLog();
- MainV2.fixtheme(frm);
+ ThemeManager.ApplyThemeTo(frm);
frm.ShowDialog();
}
private void BUT_joystick_Click(object sender, EventArgs e)
{
Form joy = new JoystickSetup();
- MainV2.fixtheme(joy);
+ ThemeManager.ApplyThemeTo(joy);
joy.Show();
}
@@ -1480,7 +1480,7 @@ namespace ArdupilotMega.GCSViews
selectform.Width = x + 100;
}
}
- MainV2.fixtheme(selectform);
+ ThemeManager.ApplyThemeTo(selectform);
selectform.Show();
}
@@ -1555,7 +1555,7 @@ namespace ArdupilotMega.GCSViews
MessageBox.Show("Max 10 at a time.");
((CheckBox)sender).Checked = false;
}
- MainV2.fixtheme(this);
+ ThemeManager.ApplyThemeTo(this);
string selected = "";
try
diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs
index 04e5e0de87..d615283bad 100644
--- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs
+++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs
@@ -1205,7 +1205,7 @@ namespace ArdupilotMega.GCSViews
frmProgressReporter.DoWork += getWPs;
frmProgressReporter.UpdateProgressAndStatus(-1, "Receiving WP's");
- MainV2.fixtheme(frmProgressReporter);
+ ThemeManager.ApplyThemeTo(frmProgressReporter);
frmProgressReporter.RunBackgroundOperationAsync();
}
@@ -1314,7 +1314,7 @@ namespace ArdupilotMega.GCSViews
frmProgressReporter.DoWork += saveWPs;
frmProgressReporter.UpdateProgressAndStatus(-1, "Sending WP's");
- MainV2.fixtheme(frmProgressReporter);
+ ThemeManager.ApplyThemeTo(frmProgressReporter);
frmProgressReporter.RunBackgroundOperationAsync();
@@ -2332,7 +2332,7 @@ namespace ArdupilotMega.GCSViews
double homealt;
double.TryParse(TXT_homealt.Text, out homealt);
Form temp = new ElevationProfile(pointlist, homealt);
- MainV2.fixtheme(temp);
+ ThemeManager.ApplyThemeTo(temp);
temp.ShowDialog();
}
@@ -2952,7 +2952,7 @@ namespace ArdupilotMega.GCSViews
private void BUT_Camera_Click(object sender, EventArgs e)
{
Camera form = new Camera();
- MainV2.fixtheme(form);
+ ThemeManager.ApplyThemeTo(form);
form.Show();
}
diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.cs
index 4ff9bd2f27..fb5d258c30 100644
--- a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.cs
+++ b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.cs
@@ -293,7 +293,7 @@ namespace ArdupilotMega.GCSViews
private void Logs_Click(object sender, EventArgs e)
{
Form Log = new Log();
- MainV2.fixtheme(Log);
+ ThemeManager.ApplyThemeTo(Log);
inlogview = true;
Log.ShowDialog();
inlogview = false;
@@ -302,7 +302,7 @@ namespace ArdupilotMega.GCSViews
private void BUT_logbrowse_Click(object sender, EventArgs e)
{
Form logbrowse = new LogBrowse();
- MainV2.fixtheme(logbrowse);
+ ThemeManager.ApplyThemeTo(logbrowse);
logbrowse.ShowDialog();
}
}
diff --git a/Tools/ArdupilotMegaPlanner/JoystickSetup.cs b/Tools/ArdupilotMegaPlanner/JoystickSetup.cs
index ce492aa7ae..012475894d 100644
--- a/Tools/ArdupilotMegaPlanner/JoystickSetup.cs
+++ b/Tools/ArdupilotMegaPlanner/JoystickSetup.cs
@@ -256,7 +256,7 @@ namespace ArdupilotMega
MainV2.joystick = joy;
- MainV2.fixtheme(this);
+ ThemeManager.ApplyThemeTo(this);
CMB_joysticks.SelectedIndex = CMB_joysticks.Items.IndexOf(joy.name);
}
diff --git a/Tools/ArdupilotMegaPlanner/MAVLink.cs b/Tools/ArdupilotMegaPlanner/MAVLink.cs
index 36b70180b2..0f66e80614 100644
--- a/Tools/ArdupilotMegaPlanner/MAVLink.cs
+++ b/Tools/ArdupilotMegaPlanner/MAVLink.cs
@@ -146,7 +146,7 @@ namespace ArdupilotMega
frmProgressReporter.DoWork += FrmProgressReporterDoWorkNOParams;
}
frmProgressReporter.UpdateProgressAndStatus(-1, "Mavlink Connecting...");
- MainV2.fixtheme(frmProgressReporter);
+ ThemeManager.ApplyThemeTo(frmProgressReporter);
frmProgressReporter.RunBackgroundOperationAsync();
}
@@ -582,7 +582,7 @@ namespace ArdupilotMega
frmProgressReporter.DoWork += FrmProgressReporterGetParams;
frmProgressReporter.UpdateProgressAndStatus(-1, "Getting Params...");
- MainV2.fixtheme(frmProgressReporter);
+ ThemeManager.ApplyThemeTo(frmProgressReporter);
frmProgressReporter.RunBackgroundOperationAsync();
}
diff --git a/Tools/ArdupilotMegaPlanner/MainV2.cs b/Tools/ArdupilotMegaPlanner/MainV2.cs
index 4e66490df6..0a1d312b20 100644
--- a/Tools/ArdupilotMegaPlanner/MainV2.cs
+++ b/Tools/ArdupilotMegaPlanner/MainV2.cs
@@ -106,8 +106,7 @@ namespace ArdupilotMega
var t = Type.GetType("Mono.Runtime");
MONO = (t != null);
- if (!MONO)
- talk = new Speech();
+ talk = new Speech();
//talk.SpeakAsync("Welcome to APM Planner");
@@ -313,174 +312,6 @@ namespace ArdupilotMega
CMB_serialport.Text = oldport;
}
- public static void fixtheme(Control temp)
- {
- fixtheme(temp, 0);
- }
-
- public static void fixtheme(Control temp, int level)
- {
- if (level == 0)
- {
- temp.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
- temp.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
- }
- //Console.WriteLine(temp.GetType());
-
- //temp.Font = new Font("Lucida Console", 8.25f);
-
- foreach (Control ctl in temp.Controls)
- {
- if (((Type)ctl.GetType()) == typeof(System.Windows.Forms.Button))
- {
- ctl.ForeColor = Color.Black;
- System.Windows.Forms.Button but = (System.Windows.Forms.Button)ctl;
- }
- else if (((Type)ctl.GetType()) == typeof(TextBox))
- {
- ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
- ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
- TextBox txt = (TextBox)ctl;
- txt.BorderStyle = BorderStyle.None;
- }
- else if (((Type)ctl.GetType()) == typeof(DomainUpDown))
- {
- ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
- ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
- DomainUpDown txt = (DomainUpDown)ctl;
- txt.BorderStyle = BorderStyle.None;
- }
- else if (((Type)ctl.GetType()) == typeof(GroupBox))
- {
- ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
- ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
- }
- else if (((Type)ctl.GetType()) == typeof(ZedGraph.ZedGraphControl))
- {
- ZedGraph.ZedGraphControl zg1 = (ZedGraph.ZedGraphControl)ctl;
- zg1.GraphPane.Chart.Fill = new ZedGraph.Fill(Color.FromArgb(0x1f, 0x1f, 0x20));
- zg1.GraphPane.Fill = new ZedGraph.Fill(Color.FromArgb(0x37, 0x37, 0x38));
-
- foreach (ZedGraph.LineItem li in zg1.GraphPane.CurveList)
- {
- li.Line.Width = 4;
- }
-
- zg1.GraphPane.Title.FontSpec.FontColor = Color.White;
-
- zg1.GraphPane.XAxis.MajorTic.Color = Color.White;
- zg1.GraphPane.XAxis.MinorTic.Color = Color.White;
- zg1.GraphPane.YAxis.MajorTic.Color = Color.White;
- zg1.GraphPane.YAxis.MinorTic.Color = Color.White;
-
- zg1.GraphPane.XAxis.MajorGrid.Color = Color.White;
- zg1.GraphPane.YAxis.MajorGrid.Color = Color.White;
-
- zg1.GraphPane.YAxis.Scale.FontSpec.FontColor = Color.White;
- zg1.GraphPane.YAxis.Title.FontSpec.FontColor = Color.White;
-
- zg1.GraphPane.XAxis.Scale.FontSpec.FontColor = Color.White;
- zg1.GraphPane.XAxis.Title.FontSpec.FontColor = Color.White;
-
- zg1.GraphPane.Legend.Fill = new ZedGraph.Fill(Color.FromArgb(0x85, 0x84, 0x83));
- zg1.GraphPane.Legend.FontSpec.FontColor = Color.White;
- }
- else if (((Type)ctl.GetType()) == typeof(BSE.Windows.Forms.Panel) || ((Type)ctl.GetType()) == typeof(System.Windows.Forms.SplitterPanel))
- {
- ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
- ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
- }
- else if (((Type)ctl.GetType()) == typeof(Form))
- {
- ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
- ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
- }
- else if (((Type)ctl.GetType()) == typeof(RichTextBox))
- {
- ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
- ctl.ForeColor = Color.White;
- RichTextBox txtr = (RichTextBox)ctl;
- txtr.BorderStyle = BorderStyle.None;
- }
- else if (((Type)ctl.GetType()) == typeof(CheckedListBox))
- {
- ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
- ctl.ForeColor = Color.White;
- CheckedListBox txtr = (CheckedListBox)ctl;
- txtr.BorderStyle = BorderStyle.None;
- }
- else if (((Type)ctl.GetType()) == typeof(TabPage))
- {
- ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28); //Color.FromArgb(0x43, 0x44, 0x45);
- ctl.ForeColor = Color.White;
- TabPage txtr = (TabPage)ctl;
- txtr.BorderStyle = BorderStyle.None;
- }
- else if (((Type)ctl.GetType()) == typeof(TabControl))
- {
- ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28); //Color.FromArgb(0x43, 0x44, 0x45);
- ctl.ForeColor = Color.White;
- TabControl txtr = (TabControl)ctl;
-
- }
- else if (((Type)ctl.GetType()) == typeof(DataGridView))
- {
- ctl.ForeColor = Color.White;
- DataGridView dgv = (DataGridView)ctl;
- dgv.EnableHeadersVisualStyles = false;
- dgv.BorderStyle = BorderStyle.None;
- dgv.BackgroundColor = Color.FromArgb(0x26, 0x27, 0x28);
- DataGridViewCellStyle rs = new DataGridViewCellStyle();
- rs.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
- rs.ForeColor = Color.White;
- dgv.RowsDefaultCellStyle = rs;
-
- DataGridViewCellStyle hs = new DataGridViewCellStyle(dgv.ColumnHeadersDefaultCellStyle);
- hs.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
- hs.ForeColor = Color.White;
-
- dgv.ColumnHeadersDefaultCellStyle = hs;
-
- dgv.RowHeadersDefaultCellStyle = hs;
- }
- else if (((Type)ctl.GetType()) == typeof(ComboBox))
- {
- ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
- ctl.ForeColor = Color.White;
- ComboBox CMB = (ComboBox)ctl;
- CMB.FlatStyle = FlatStyle.Flat;
- }
- else if (((Type)ctl.GetType()) == typeof(NumericUpDown))
- {
- ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
- ctl.ForeColor = Color.White;
- }
- else if (((Type)ctl.GetType()) == typeof(TrackBar))
- {
- ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
- ctl.ForeColor = Color.White;
- }
- else if (((Type)ctl.GetType()) == typeof(LinkLabel))
- {
- ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
- ctl.ForeColor = Color.White;
- LinkLabel LNK = (LinkLabel)ctl;
- LNK.ActiveLinkColor = Color.White;
- LNK.LinkColor = Color.White;
- LNK.VisitedLinkColor = Color.White;
-
- }
- else if (((Type)ctl.GetType()) == typeof(HorizontalProgressBar2) ||
- ((Type)ctl.GetType()) == typeof(VerticalProgressBar2))
- {
- ((HorizontalProgressBar2)ctl).BackgroundColor = Color.FromArgb(0x43, 0x44, 0x45);
- ((HorizontalProgressBar2)ctl).ValueColor = Color.FromArgb(148, 193, 31);
- }
-
- if (ctl.Controls.Count > 0)
- fixtheme(ctl, 1);
- }
- }
private void MenuFlightData_Click(object sender, EventArgs e)
{
@@ -490,7 +321,7 @@ namespace ArdupilotMega
UserControl temp = FlightData;
- fixtheme(temp);
+ ThemeManager.ApplyThemeTo(temp);
temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@@ -516,7 +347,7 @@ namespace ArdupilotMega
UserControl temp = FlightPlanner;
- fixtheme(temp);
+ ThemeManager.ApplyThemeTo(temp);
temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@@ -551,7 +382,7 @@ namespace ArdupilotMega
UserControl temp = Configuration;
- fixtheme(temp);
+ ThemeManager.ApplyThemeTo(temp);
//temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@@ -578,7 +409,7 @@ namespace ArdupilotMega
UserControl temp = Simulation;
- fixtheme(temp);
+ ThemeManager.ApplyThemeTo(temp);
temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@@ -601,7 +432,7 @@ namespace ArdupilotMega
UserControl temp = Firmware;
- fixtheme(temp);
+ ThemeManager.ApplyThemeTo(temp);
temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@@ -641,7 +472,7 @@ namespace ArdupilotMega
UserControl temp = Terminal;
- fixtheme(temp);
+ ThemeManager.ApplyThemeTo(temp);
temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@@ -1616,7 +1447,7 @@ namespace ArdupilotMega
UserControl temp = new GCSViews.Help();
- fixtheme(temp);
+ ThemeManager.ApplyThemeTo(temp);
temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@@ -1782,7 +1613,7 @@ namespace ArdupilotMega
StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
};
- MainV2.fixtheme(frmProgressReporter);
+ ThemeManager.ApplyThemeTo(frmProgressReporter);
frmProgressReporter.DoWork += new Controls.ProgressReporterDialogue.DoWorkEventHandler(frmProgressReporter_DoWork);
@@ -2015,7 +1846,7 @@ namespace ArdupilotMega
if (keyData == (Keys.Control | Keys.F))
{
Form frm = new temp();
- fixtheme(frm);
+ ThemeManager.ApplyThemeTo(frm);
frm.Show();
return true;
}
@@ -2027,14 +1858,14 @@ namespace ArdupilotMega
if (keyData == (Keys.Control | Keys.G)) // test
{
Form frm = new SerialOutput();
- fixtheme(frm);
+ ThemeManager.ApplyThemeTo(frm);
frm.Show();
return true;
}
if (keyData == (Keys.Control | Keys.A)) // test
{
Form frm = new _3DRradio();
- fixtheme(frm);
+ ThemeManager.ApplyThemeTo(frm);
frm.Show();
return true;
}
diff --git a/Tools/ArdupilotMegaPlanner/Program.cs b/Tools/ArdupilotMegaPlanner/Program.cs
index fb7e6f2e71..e1f808f6c2 100644
--- a/Tools/ArdupilotMegaPlanner/Program.cs
+++ b/Tools/ArdupilotMegaPlanner/Program.cs
@@ -31,6 +31,7 @@ namespace ArdupilotMega
Application.Idle += Application_Idle;
+
//MagCalib.doWork();
//return;
diff --git a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs
index d6bbc81952..951e78d73e 100644
--- a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs
+++ b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs
@@ -34,5 +34,5 @@ using System.Resources;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.1.47")]
+[assembly: AssemblyFileVersion("1.1.48")]
[assembly: NeutralResourcesLanguageAttribute("")]
diff --git a/Tools/ArdupilotMegaPlanner/Setup/Setup.cs b/Tools/ArdupilotMegaPlanner/Setup/Setup.cs
index 6c3feb616d..57a374d2c2 100644
--- a/Tools/ArdupilotMegaPlanner/Setup/Setup.cs
+++ b/Tools/ArdupilotMegaPlanner/Setup/Setup.cs
@@ -986,8 +986,10 @@ namespace ArdupilotMega.Setup
MessageBox.Show("Please Connect First");
this.Close();
}
-
- tabControl1_SelectedIndexChanged(null, new EventArgs());
+ else
+ {
+ tabControl1_SelectedIndexChanged(null, new EventArgs());
+ }
}
private void TXT_srvpos1_Validating(object sender, CancelEventArgs e)
@@ -1407,6 +1409,9 @@ namespace ArdupilotMega.Setup
timer.Dispose();
tabControl1.SelectedIndex = 0;
+
+ // mono runs validation on all controls on exit. try and skip it
+ startup = true;
}
private void CHK_enableoptflow_CheckedChanged(object sender, EventArgs e)
diff --git a/Tools/ArdupilotMegaPlanner/Speech.cs b/Tools/ArdupilotMegaPlanner/Speech.cs
index baa8cd0b0e..0da3155cae 100644
--- a/Tools/ArdupilotMegaPlanner/Speech.cs
+++ b/Tools/ArdupilotMegaPlanner/Speech.cs
@@ -3,11 +3,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech.Synthesis;
+using log4net;
namespace ArdupilotMega
{
public class Speech
{
+ private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+
SpeechSynthesizer _speechwindows;
System.Diagnostics.Process _speechlinux;
@@ -15,8 +18,10 @@ namespace ArdupilotMega
bool MONO = false;
- public SynthesizerState State {
- get {
+ public SynthesizerState State
+ {
+ get
+ {
if (MONO)
{
return _state;
@@ -33,6 +38,8 @@ namespace ArdupilotMega
var t = Type.GetType("Mono.Runtime");
MONO = (t != null);
+ log.Info("TTS: init, mono = " + MONO);
+
if (MONO)
{
_state = SynthesizerState.Ready;
@@ -47,23 +54,39 @@ namespace ArdupilotMega
{
if (MONO)
{
- if (_speechlinux == null || _speechlinux.HasExited)
+ //if (_speechlinux == null)
{
_state = SynthesizerState.Speaking;
_speechlinux = new System.Diagnostics.Process();
- _speechlinux.StartInfo.FileName = "echo " + text + " | festival --tts";
+ _speechlinux.StartInfo.RedirectStandardInput = true;
+ _speechlinux.StartInfo.UseShellExecute = false;
+ _speechlinux.StartInfo.FileName = "festival";
_speechlinux.Start();
_speechlinux.Exited += new EventHandler(_speechlinux_Exited);
+
+ log.Info("TTS: start " + _speechlinux.StartTime);
+
}
+
+ _state = SynthesizerState.Speaking;
+ _speechlinux.StandardInput.WriteLine("(SayText \"" + text + "\")");
+ _speechlinux.StandardInput.WriteLine("(quit)");
+
+ _speechlinux.Close();
+
+ _state = SynthesizerState.Ready;
}
else
{
_speechwindows.SpeakAsync(text);
}
+
+ log.Info("TTS: say " + text);
}
void _speechlinux_Exited(object sender, EventArgs e)
{
+ log.Info("TTS: exit " + _speechlinux.ExitTime);
_state = SynthesizerState.Ready;
}
diff --git a/Tools/ArdupilotMegaPlanner/ThemeManager.cs b/Tools/ArdupilotMegaPlanner/ThemeManager.cs
new file mode 100644
index 0000000000..7723eb9dd3
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/ThemeManager.cs
@@ -0,0 +1,221 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using log4net;
+
+namespace ArdupilotMega
+{
+ ///
+ /// Helper class for the stylng 'theming' of forms and controls, and provides MessageBox
+ /// replacements which are also styled
+ ///
+ public class ThemeManager
+ {
+ private static readonly ILog log =
+ LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+
+ private static Themes _currentTheme = Themes.BurntKermit;
+
+ public enum Themes
+ {
+ ///
+ /// no theme - standard Winforms appearance
+ ///
+ None,
+
+ ///
+ /// Standard Planner Charcoal & Green colours
+ ///
+ BurntKermit,
+ }
+
+ ///
+ /// Change the current theme. Existing controls are not affected
+ ///
+ ///
+ public static void SetTheme(Themes theme)
+ {
+ log.Debug("Theme set to " + Enum.GetName(typeof(Themes), theme));
+ _currentTheme = theme;
+ }
+
+ ///
+ /// Will recursively apply the current theme to 'control'
+ ///
+ ///
+ public static void ApplyThemeTo(Control control)
+ {
+ switch (_currentTheme)
+ {
+ case Themes.BurntKermit: ApplyBurntKermitTheme(control, 0);
+ break;
+
+ // More themes go here
+
+ default:
+ break;
+ }
+
+
+ }
+
+ private static void ApplyBurntKermitTheme(Control temp, int level)
+ {
+ if (level == 0)
+ {
+ temp.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
+ temp.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
+ }
+
+ //temp.Font = new Font("Lucida Console", 8.25f);
+
+ foreach (Control ctl in temp.Controls)
+ {
+ if (ctl.GetType() == typeof(Button))
+ {
+ ctl.ForeColor = Color.Black;
+ }
+ else if (ctl.GetType() == typeof(TextBox))
+ {
+ ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
+ ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
+ TextBox txt = (TextBox)ctl;
+ txt.BorderStyle = BorderStyle.None;
+ }
+ else if (ctl.GetType() == typeof(DomainUpDown))
+ {
+ ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
+ ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
+ DomainUpDown txt = (DomainUpDown)ctl;
+ txt.BorderStyle = BorderStyle.None;
+ }
+ else if (ctl.GetType() == typeof(GroupBox))
+ {
+ ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
+ ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
+ }
+ else if (ctl.GetType() == typeof(ZedGraph.ZedGraphControl))
+ {
+ var zg1 = (ZedGraph.ZedGraphControl)ctl;
+ zg1.GraphPane.Chart.Fill = new ZedGraph.Fill(Color.FromArgb(0x1f, 0x1f, 0x20));
+ zg1.GraphPane.Fill = new ZedGraph.Fill(Color.FromArgb(0x37, 0x37, 0x38));
+
+ foreach (ZedGraph.LineItem li in zg1.GraphPane.CurveList)
+ li.Line.Width = 4;
+
+ zg1.GraphPane.Title.FontSpec.FontColor = Color.White;
+
+ zg1.GraphPane.XAxis.MajorTic.Color = Color.White;
+ zg1.GraphPane.XAxis.MinorTic.Color = Color.White;
+ zg1.GraphPane.YAxis.MajorTic.Color = Color.White;
+ zg1.GraphPane.YAxis.MinorTic.Color = Color.White;
+
+ zg1.GraphPane.XAxis.MajorGrid.Color = Color.White;
+ zg1.GraphPane.YAxis.MajorGrid.Color = Color.White;
+
+ zg1.GraphPane.YAxis.Scale.FontSpec.FontColor = Color.White;
+ zg1.GraphPane.YAxis.Title.FontSpec.FontColor = Color.White;
+
+ zg1.GraphPane.XAxis.Scale.FontSpec.FontColor = Color.White;
+ zg1.GraphPane.XAxis.Title.FontSpec.FontColor = Color.White;
+
+ zg1.GraphPane.Legend.Fill = new ZedGraph.Fill(Color.FromArgb(0x85, 0x84, 0x83));
+ zg1.GraphPane.Legend.FontSpec.FontColor = Color.White;
+ }
+ else if (ctl.GetType() == typeof(BSE.Windows.Forms.Panel) || ctl.GetType() == typeof(SplitterPanel))
+ {
+ ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
+ ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
+ }
+ else if (ctl.GetType() == typeof(Form))
+ {
+ ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
+ ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
+ }
+ else if (ctl.GetType() == typeof(RichTextBox))
+ {
+ ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
+ ctl.ForeColor = Color.White;
+ RichTextBox txtr = (RichTextBox)ctl;
+ txtr.BorderStyle = BorderStyle.None;
+ }
+ else if (ctl.GetType() == typeof(CheckedListBox))
+ {
+ ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
+ ctl.ForeColor = Color.White;
+ CheckedListBox txtr = (CheckedListBox)ctl;
+ txtr.BorderStyle = BorderStyle.None;
+ }
+ else if (ctl.GetType() == typeof(TabPage))
+ {
+ ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28); //Color.FromArgb(0x43, 0x44, 0x45);
+ ctl.ForeColor = Color.White;
+ TabPage txtr = (TabPage)ctl;
+ txtr.BorderStyle = BorderStyle.None;
+ }
+ else if (ctl.GetType() == typeof(TabControl))
+ {
+ ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28); //Color.FromArgb(0x43, 0x44, 0x45);
+ ctl.ForeColor = Color.White;
+ TabControl txtr = (TabControl)ctl;
+
+ }
+ else if (ctl.GetType() == typeof(DataGridView))
+ {
+ ctl.ForeColor = Color.White;
+ DataGridView dgv = (DataGridView)ctl;
+ dgv.EnableHeadersVisualStyles = false;
+ dgv.BorderStyle = BorderStyle.None;
+ dgv.BackgroundColor = Color.FromArgb(0x26, 0x27, 0x28);
+ DataGridViewCellStyle rs = new DataGridViewCellStyle();
+ rs.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
+ rs.ForeColor = Color.White;
+ dgv.RowsDefaultCellStyle = rs;
+
+ DataGridViewCellStyle hs = new DataGridViewCellStyle(dgv.ColumnHeadersDefaultCellStyle);
+ hs.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
+ hs.ForeColor = Color.White;
+
+ dgv.ColumnHeadersDefaultCellStyle = hs;
+ dgv.RowHeadersDefaultCellStyle = hs;
+ }
+ else if (ctl.GetType() == typeof(ComboBox))
+ {
+ ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
+ ctl.ForeColor = Color.White;
+ ComboBox CMB = (ComboBox)ctl;
+ CMB.FlatStyle = FlatStyle.Flat;
+ }
+ else if (ctl.GetType() == typeof(NumericUpDown))
+ {
+ ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
+ ctl.ForeColor = Color.White;
+ }
+ else if (ctl.GetType() == typeof(TrackBar))
+ {
+ ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
+ ctl.ForeColor = Color.White;
+ }
+ else if (ctl.GetType() == typeof(LinkLabel))
+ {
+ ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
+ ctl.ForeColor = Color.White;
+ LinkLabel LNK = (LinkLabel)ctl;
+ LNK.ActiveLinkColor = Color.White;
+ LNK.LinkColor = Color.White;
+ LNK.VisitedLinkColor = Color.White;
+
+ }
+ else if (ctl.GetType() == typeof(HorizontalProgressBar2) || ctl.GetType() == typeof(VerticalProgressBar2))
+ {
+ ((HorizontalProgressBar2)ctl).BackgroundColor = Color.FromArgb(0x43, 0x44, 0x45);
+ ((HorizontalProgressBar2)ctl).ValueColor = Color.FromArgb(148, 193, 31);
+ }
+
+ if (ctl.Controls.Count > 0)
+ ApplyBurntKermitTheme(ctl, 1);
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.pdb b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.pdb
index b5e4392f1e..ae1895b403 100644
Binary files a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.pdb and b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.pdb differ
diff --git a/Tools/ArdupilotMegaPlanner/srtm.cs b/Tools/ArdupilotMegaPlanner/srtm.cs
index 08e5bca0ef..7583ab71c3 100644
--- a/Tools/ArdupilotMegaPlanner/srtm.cs
+++ b/Tools/ArdupilotMegaPlanner/srtm.cs
@@ -190,6 +190,7 @@ namespace ArdupilotMega
requestThread = new Thread(requestRunner);
requestThread.IsBackground = true;
+ requestThread.Name = "SRTM request runner";
requestThread.Start();
}
else
diff --git a/Tools/ArdupilotMegaPlanner/temp.cs b/Tools/ArdupilotMegaPlanner/temp.cs
index 8994baf70e..94b8f99faa 100644
--- a/Tools/ArdupilotMegaPlanner/temp.cs
+++ b/Tools/ArdupilotMegaPlanner/temp.cs
@@ -878,7 +878,7 @@ namespace ArdupilotMega
private void BUT_follow_me_Click(object sender, EventArgs e)
{
SerialInput si = new SerialInput();
- MainV2.fixtheme((Form)si);
+ ThemeManager.ApplyThemeTo((Form)si);
si.Show();
}