APM Planner 1.1.48

Add ThemeManager - re andrew
Add CustomMessageBox - re andrew and me
few mono fixs
mono tts working (speech)
This commit is contained in:
Michael Oborne 2012-03-04 08:42:42 +08:00
parent a480b32400
commit ba3ffb3b8b
23 changed files with 678 additions and 215 deletions

View File

@ -19,7 +19,7 @@ namespace ArdupilotMega.Antenna
{ {
InitializeComponent(); InitializeComponent();
MainV2.fixtheme(this); ThemeManager.ApplyThemeTo(this);
CMB_serialport.DataSource = SerialPort.GetPortNames(); CMB_serialport.DataSource = SerialPort.GetPortNames();

View File

@ -241,6 +241,7 @@
<Compile Include="Antenna\Tracker.Designer.cs"> <Compile Include="Antenna\Tracker.Designer.cs">
<DependentUpon>Tracker.cs</DependentUpon> <DependentUpon>Tracker.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Controls\MessageBox.cs" />
<Compile Include="Controls\ProgressReporterDialogue.cs"> <Compile Include="Controls\ProgressReporterDialogue.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -464,6 +465,7 @@
</Compile> </Compile>
<Compile Include="Radio\Uploader.cs" /> <Compile Include="Radio\Uploader.cs" />
<Compile Include="LangUtility.cs" /> <Compile Include="LangUtility.cs" />
<Compile Include="ThemeManager.cs" />
<EmbeddedResource Include="Antenna\Tracker.resx"> <EmbeddedResource Include="Antenna\Tracker.resx">
<DependentUpon>Tracker.cs</DependentUpon> <DependentUpon>Tracker.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

View File

@ -652,7 +652,7 @@ namespace ArdupilotMega
form.MinimizeBox = false; form.MinimizeBox = false;
form.MaximizeBox = false; form.MaximizeBox = false;
MainV2.fixtheme(form); ThemeManager.ApplyThemeTo(form);
form.Show(); form.Show();
form.Refresh(); form.Refresh();
@ -706,7 +706,7 @@ namespace ArdupilotMega
form.MinimizeBox = false; form.MinimizeBox = false;
form.MaximizeBox = false; form.MaximizeBox = false;
MainV2.fixtheme(form); ThemeManager.ApplyThemeTo(form);
DialogResult dialogResult =form.ShowDialog(); DialogResult dialogResult =form.ShowDialog();
@ -760,7 +760,7 @@ namespace ArdupilotMega
form.AcceptButton = buttonOk; form.AcceptButton = buttonOk;
form.CancelButton = buttonCancel; form.CancelButton = buttonCancel;
MainV2.fixtheme(form); ThemeManager.ApplyThemeTo(form);
DialogResult dialogResult = DialogResult.Cancel; DialogResult dialogResult = DialogResult.Cancel;

View File

@ -86,7 +86,7 @@ namespace System.IO.Ports
frmProgressReporter.UpdateProgressAndStatus(-1, "Connecting Mavlink UDP"); frmProgressReporter.UpdateProgressAndStatus(-1, "Connecting Mavlink UDP");
ArdupilotMega.MainV2.fixtheme(frmProgressReporter); ArdupilotMega.ThemeManager.ApplyThemeTo(frmProgressReporter);
frmProgressReporter.RunBackgroundOperationAsync(); frmProgressReporter.RunBackgroundOperationAsync();

View File

@ -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");
}
}
/// <summary>
/// Get system icon for MessageBoxIcon.
/// </summary>
/// <param name="icon">The MessageBoxIcon value.</param>
/// <returns>SystemIcon type Icon.</returns>
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;
}
}
}
}

View File

@ -42,7 +42,16 @@ namespace ArdupilotMega.Controls
private void RunBackgroundOperation(object o) 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 try
{ {
if (this.DoWork != null) this.DoWork(this, doWorkArgs); if (this.DoWork != null) this.DoWork(this, doWorkArgs);
@ -56,6 +65,7 @@ namespace ArdupilotMega.Controls
return; return;
} }
if (doWorkArgs.CancelRequested && doWorkArgs.CancelAcknowledged) if (doWorkArgs.CancelRequested && doWorkArgs.CancelAcknowledged)
{ {
ShowDoneCancelled(); ShowDoneCancelled();

View File

@ -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");
}
}
/// <summary>
/// Get system icon for MessageBoxIcon.
/// </summary>
/// <param name="icon">The MessageBoxIcon value.</param>
/// <returns>SystemIcon type Icon.</returns>
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;
}
}
}
}

View File

@ -734,7 +734,7 @@ namespace ArdupilotMega.GCSViews
temp.Configuration = this; temp.Configuration = this;
MainV2.fixtheme(temp); ThemeManager.ApplyThemeTo(temp);
temp.ShowDialog(); temp.ShowDialog();
@ -985,7 +985,7 @@ namespace ArdupilotMega.GCSViews
private void BUT_Joystick_Click(object sender, EventArgs e) private void BUT_Joystick_Click(object sender, EventArgs e)
{ {
Form joy = new JoystickSetup(); Form joy = new JoystickSetup();
MainV2.fixtheme(joy); ThemeManager.ApplyThemeTo(joy);
joy.Show(); joy.Show();
} }
@ -1146,7 +1146,7 @@ namespace ArdupilotMega.GCSViews
sr.Close(); sr.Close();
ParamCompare temp = new ParamCompare(this, param, param2); ParamCompare temp = new ParamCompare(this, param, param2);
MainV2.fixtheme(temp); ThemeManager.ApplyThemeTo(temp);
temp.ShowDialog(); temp.ShowDialog();
} }
} }

View File

@ -226,7 +226,7 @@ namespace ArdupilotMega.GCSViews
else if (items.Count == 2 && false) else if (items.Count == 2 && false)
{ {
XorPlus select = new XorPlus(); XorPlus select = new XorPlus();
MainV2.fixtheme(select); ThemeManager.ApplyThemeTo(select);
select.ShowDialog(); select.ShowDialog();
int a = 0; int a = 0;
@ -685,7 +685,7 @@ namespace ArdupilotMega.GCSViews
private void BUT_setup_Click(object sender, EventArgs e) private void BUT_setup_Click(object sender, EventArgs e)
{ {
Form temp = new Setup.Setup(); Form temp = new Setup.Setup();
MainV2.fixtheme(temp); ThemeManager.ApplyThemeTo(temp);
temp.ShowDialog(); temp.ShowDialog();
} }

View File

@ -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 comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RC_CHANNELS, MainV2.cs.raterc); // request rc info
} }
catch { } catch { }
lastdata = DateTime.Now; // prevent flooding lastdata = DateTime.Now.AddSeconds(12); // prevent flooding
} }
if (!MainV2.comPort.logreadmode) if (!MainV2.comPort.logreadmode)
@ -852,7 +852,7 @@ namespace ArdupilotMega.GCSViews
private void BUT_RAWSensor_Click(object sender, EventArgs e) private void BUT_RAWSensor_Click(object sender, EventArgs e)
{ {
Form temp = new RAW_Sensor(); Form temp = new RAW_Sensor();
MainV2.fixtheme(temp); ThemeManager.ApplyThemeTo(temp);
temp.Show(); temp.Show();
} }
@ -1185,14 +1185,14 @@ namespace ArdupilotMega.GCSViews
} }
Form frm = new MavlinkLog(); Form frm = new MavlinkLog();
MainV2.fixtheme(frm); ThemeManager.ApplyThemeTo(frm);
frm.ShowDialog(); frm.ShowDialog();
} }
private void BUT_joystick_Click(object sender, EventArgs e) private void BUT_joystick_Click(object sender, EventArgs e)
{ {
Form joy = new JoystickSetup(); Form joy = new JoystickSetup();
MainV2.fixtheme(joy); ThemeManager.ApplyThemeTo(joy);
joy.Show(); joy.Show();
} }
@ -1480,7 +1480,7 @@ namespace ArdupilotMega.GCSViews
selectform.Width = x + 100; selectform.Width = x + 100;
} }
} }
MainV2.fixtheme(selectform); ThemeManager.ApplyThemeTo(selectform);
selectform.Show(); selectform.Show();
} }
@ -1555,7 +1555,7 @@ namespace ArdupilotMega.GCSViews
MessageBox.Show("Max 10 at a time."); MessageBox.Show("Max 10 at a time.");
((CheckBox)sender).Checked = false; ((CheckBox)sender).Checked = false;
} }
MainV2.fixtheme(this); ThemeManager.ApplyThemeTo(this);
string selected = ""; string selected = "";
try try

View File

@ -1205,7 +1205,7 @@ namespace ArdupilotMega.GCSViews
frmProgressReporter.DoWork += getWPs; frmProgressReporter.DoWork += getWPs;
frmProgressReporter.UpdateProgressAndStatus(-1, "Receiving WP's"); frmProgressReporter.UpdateProgressAndStatus(-1, "Receiving WP's");
MainV2.fixtheme(frmProgressReporter); ThemeManager.ApplyThemeTo(frmProgressReporter);
frmProgressReporter.RunBackgroundOperationAsync(); frmProgressReporter.RunBackgroundOperationAsync();
} }
@ -1314,7 +1314,7 @@ namespace ArdupilotMega.GCSViews
frmProgressReporter.DoWork += saveWPs; frmProgressReporter.DoWork += saveWPs;
frmProgressReporter.UpdateProgressAndStatus(-1, "Sending WP's"); frmProgressReporter.UpdateProgressAndStatus(-1, "Sending WP's");
MainV2.fixtheme(frmProgressReporter); ThemeManager.ApplyThemeTo(frmProgressReporter);
frmProgressReporter.RunBackgroundOperationAsync(); frmProgressReporter.RunBackgroundOperationAsync();
@ -2332,7 +2332,7 @@ namespace ArdupilotMega.GCSViews
double homealt; double homealt;
double.TryParse(TXT_homealt.Text, out homealt); double.TryParse(TXT_homealt.Text, out homealt);
Form temp = new ElevationProfile(pointlist, homealt); Form temp = new ElevationProfile(pointlist, homealt);
MainV2.fixtheme(temp); ThemeManager.ApplyThemeTo(temp);
temp.ShowDialog(); temp.ShowDialog();
} }
@ -2952,7 +2952,7 @@ namespace ArdupilotMega.GCSViews
private void BUT_Camera_Click(object sender, EventArgs e) private void BUT_Camera_Click(object sender, EventArgs e)
{ {
Camera form = new Camera(); Camera form = new Camera();
MainV2.fixtheme(form); ThemeManager.ApplyThemeTo(form);
form.Show(); form.Show();
} }

View File

@ -293,7 +293,7 @@ namespace ArdupilotMega.GCSViews
private void Logs_Click(object sender, EventArgs e) private void Logs_Click(object sender, EventArgs e)
{ {
Form Log = new Log(); Form Log = new Log();
MainV2.fixtheme(Log); ThemeManager.ApplyThemeTo(Log);
inlogview = true; inlogview = true;
Log.ShowDialog(); Log.ShowDialog();
inlogview = false; inlogview = false;
@ -302,7 +302,7 @@ namespace ArdupilotMega.GCSViews
private void BUT_logbrowse_Click(object sender, EventArgs e) private void BUT_logbrowse_Click(object sender, EventArgs e)
{ {
Form logbrowse = new LogBrowse(); Form logbrowse = new LogBrowse();
MainV2.fixtheme(logbrowse); ThemeManager.ApplyThemeTo(logbrowse);
logbrowse.ShowDialog(); logbrowse.ShowDialog();
} }
} }

View File

@ -256,7 +256,7 @@ namespace ArdupilotMega
MainV2.joystick = joy; MainV2.joystick = joy;
MainV2.fixtheme(this); ThemeManager.ApplyThemeTo(this);
CMB_joysticks.SelectedIndex = CMB_joysticks.Items.IndexOf(joy.name); CMB_joysticks.SelectedIndex = CMB_joysticks.Items.IndexOf(joy.name);
} }

View File

@ -146,7 +146,7 @@ namespace ArdupilotMega
frmProgressReporter.DoWork += FrmProgressReporterDoWorkNOParams; frmProgressReporter.DoWork += FrmProgressReporterDoWorkNOParams;
} }
frmProgressReporter.UpdateProgressAndStatus(-1, "Mavlink Connecting..."); frmProgressReporter.UpdateProgressAndStatus(-1, "Mavlink Connecting...");
MainV2.fixtheme(frmProgressReporter); ThemeManager.ApplyThemeTo(frmProgressReporter);
frmProgressReporter.RunBackgroundOperationAsync(); frmProgressReporter.RunBackgroundOperationAsync();
} }
@ -582,7 +582,7 @@ namespace ArdupilotMega
frmProgressReporter.DoWork += FrmProgressReporterGetParams; frmProgressReporter.DoWork += FrmProgressReporterGetParams;
frmProgressReporter.UpdateProgressAndStatus(-1, "Getting Params..."); frmProgressReporter.UpdateProgressAndStatus(-1, "Getting Params...");
MainV2.fixtheme(frmProgressReporter); ThemeManager.ApplyThemeTo(frmProgressReporter);
frmProgressReporter.RunBackgroundOperationAsync(); frmProgressReporter.RunBackgroundOperationAsync();
} }

View File

@ -106,8 +106,7 @@ namespace ArdupilotMega
var t = Type.GetType("Mono.Runtime"); var t = Type.GetType("Mono.Runtime");
MONO = (t != null); MONO = (t != null);
if (!MONO) talk = new Speech();
talk = new Speech();
//talk.SpeakAsync("Welcome to APM Planner"); //talk.SpeakAsync("Welcome to APM Planner");
@ -313,174 +312,6 @@ namespace ArdupilotMega
CMB_serialport.Text = oldport; 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) private void MenuFlightData_Click(object sender, EventArgs e)
{ {
@ -490,7 +321,7 @@ namespace ArdupilotMega
UserControl temp = FlightData; UserControl temp = FlightData;
fixtheme(temp); ThemeManager.ApplyThemeTo(temp);
temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@ -516,7 +347,7 @@ namespace ArdupilotMega
UserControl temp = FlightPlanner; UserControl temp = FlightPlanner;
fixtheme(temp); ThemeManager.ApplyThemeTo(temp);
temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@ -551,7 +382,7 @@ namespace ArdupilotMega
UserControl temp = Configuration; UserControl temp = Configuration;
fixtheme(temp); ThemeManager.ApplyThemeTo(temp);
//temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; //temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@ -578,7 +409,7 @@ namespace ArdupilotMega
UserControl temp = Simulation; UserControl temp = Simulation;
fixtheme(temp); ThemeManager.ApplyThemeTo(temp);
temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@ -601,7 +432,7 @@ namespace ArdupilotMega
UserControl temp = Firmware; UserControl temp = Firmware;
fixtheme(temp); ThemeManager.ApplyThemeTo(temp);
temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@ -641,7 +472,7 @@ namespace ArdupilotMega
UserControl temp = Terminal; UserControl temp = Terminal;
fixtheme(temp); ThemeManager.ApplyThemeTo(temp);
temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@ -1616,7 +1447,7 @@ namespace ArdupilotMega
UserControl temp = new GCSViews.Help(); UserControl temp = new GCSViews.Help();
fixtheme(temp); ThemeManager.ApplyThemeTo(temp);
temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
@ -1782,7 +1613,7 @@ namespace ArdupilotMega
StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
}; };
MainV2.fixtheme(frmProgressReporter); ThemeManager.ApplyThemeTo(frmProgressReporter);
frmProgressReporter.DoWork += new Controls.ProgressReporterDialogue.DoWorkEventHandler(frmProgressReporter_DoWork); frmProgressReporter.DoWork += new Controls.ProgressReporterDialogue.DoWorkEventHandler(frmProgressReporter_DoWork);
@ -2015,7 +1846,7 @@ namespace ArdupilotMega
if (keyData == (Keys.Control | Keys.F)) if (keyData == (Keys.Control | Keys.F))
{ {
Form frm = new temp(); Form frm = new temp();
fixtheme(frm); ThemeManager.ApplyThemeTo(frm);
frm.Show(); frm.Show();
return true; return true;
} }
@ -2027,14 +1858,14 @@ namespace ArdupilotMega
if (keyData == (Keys.Control | Keys.G)) // test if (keyData == (Keys.Control | Keys.G)) // test
{ {
Form frm = new SerialOutput(); Form frm = new SerialOutput();
fixtheme(frm); ThemeManager.ApplyThemeTo(frm);
frm.Show(); frm.Show();
return true; return true;
} }
if (keyData == (Keys.Control | Keys.A)) // test if (keyData == (Keys.Control | Keys.A)) // test
{ {
Form frm = new _3DRradio(); Form frm = new _3DRradio();
fixtheme(frm); ThemeManager.ApplyThemeTo(frm);
frm.Show(); frm.Show();
return true; return true;
} }

View File

@ -31,6 +31,7 @@ namespace ArdupilotMega
Application.Idle += Application_Idle; Application.Idle += Application_Idle;
//MagCalib.doWork(); //MagCalib.doWork();
//return; //return;

View File

@ -34,5 +34,5 @@ using System.Resources;
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.47")] [assembly: AssemblyFileVersion("1.1.48")]
[assembly: NeutralResourcesLanguageAttribute("")] [assembly: NeutralResourcesLanguageAttribute("")]

View File

@ -986,8 +986,10 @@ namespace ArdupilotMega.Setup
MessageBox.Show("Please Connect First"); MessageBox.Show("Please Connect First");
this.Close(); this.Close();
} }
else
tabControl1_SelectedIndexChanged(null, new EventArgs()); {
tabControl1_SelectedIndexChanged(null, new EventArgs());
}
} }
private void TXT_srvpos1_Validating(object sender, CancelEventArgs e) private void TXT_srvpos1_Validating(object sender, CancelEventArgs e)
@ -1407,6 +1409,9 @@ namespace ArdupilotMega.Setup
timer.Dispose(); timer.Dispose();
tabControl1.SelectedIndex = 0; 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) private void CHK_enableoptflow_CheckedChanged(object sender, EventArgs e)

View File

@ -3,11 +3,14 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Speech.Synthesis; using System.Speech.Synthesis;
using log4net;
namespace ArdupilotMega namespace ArdupilotMega
{ {
public class Speech public class Speech
{ {
private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
SpeechSynthesizer _speechwindows; SpeechSynthesizer _speechwindows;
System.Diagnostics.Process _speechlinux; System.Diagnostics.Process _speechlinux;
@ -15,8 +18,10 @@ namespace ArdupilotMega
bool MONO = false; bool MONO = false;
public SynthesizerState State { public SynthesizerState State
get { {
get
{
if (MONO) if (MONO)
{ {
return _state; return _state;
@ -33,6 +38,8 @@ namespace ArdupilotMega
var t = Type.GetType("Mono.Runtime"); var t = Type.GetType("Mono.Runtime");
MONO = (t != null); MONO = (t != null);
log.Info("TTS: init, mono = " + MONO);
if (MONO) if (MONO)
{ {
_state = SynthesizerState.Ready; _state = SynthesizerState.Ready;
@ -47,23 +54,39 @@ namespace ArdupilotMega
{ {
if (MONO) if (MONO)
{ {
if (_speechlinux == null || _speechlinux.HasExited) //if (_speechlinux == null)
{ {
_state = SynthesizerState.Speaking; _state = SynthesizerState.Speaking;
_speechlinux = new System.Diagnostics.Process(); _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.Start();
_speechlinux.Exited += new EventHandler(_speechlinux_Exited); _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 else
{ {
_speechwindows.SpeakAsync(text); _speechwindows.SpeakAsync(text);
} }
log.Info("TTS: say " + text);
} }
void _speechlinux_Exited(object sender, EventArgs e) void _speechlinux_Exited(object sender, EventArgs e)
{ {
log.Info("TTS: exit " + _speechlinux.ExitTime);
_state = SynthesizerState.Ready; _state = SynthesizerState.Ready;
} }

View File

@ -0,0 +1,221 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using log4net;
namespace ArdupilotMega
{
/// <summary>
/// Helper class for the stylng 'theming' of forms and controls, and provides MessageBox
/// replacements which are also styled
/// </summary>
public class ThemeManager
{
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static Themes _currentTheme = Themes.BurntKermit;
public enum Themes
{
/// <summary>
/// no theme - standard Winforms appearance
/// </summary>
None,
/// <summary>
/// Standard Planner Charcoal & Green colours
/// </summary>
BurntKermit,
}
/// <summary>
/// Change the current theme. Existing controls are not affected
/// </summary>
/// <param name="theme"></param>
public static void SetTheme(Themes theme)
{
log.Debug("Theme set to " + Enum.GetName(typeof(Themes), theme));
_currentTheme = theme;
}
/// <summary>
/// Will recursively apply the current theme to 'control'
/// </summary>
/// <param name="control"></param>
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);
}
}
}
}

View File

@ -190,6 +190,7 @@ namespace ArdupilotMega
requestThread = new Thread(requestRunner); requestThread = new Thread(requestRunner);
requestThread.IsBackground = true; requestThread.IsBackground = true;
requestThread.Name = "SRTM request runner";
requestThread.Start(); requestThread.Start();
} }
else else

View File

@ -878,7 +878,7 @@ namespace ArdupilotMega
private void BUT_follow_me_Click(object sender, EventArgs e) private void BUT_follow_me_Click(object sender, EventArgs e)
{ {
SerialInput si = new SerialInput(); SerialInput si = new SerialInput();
MainV2.fixtheme((Form)si); ThemeManager.ApplyThemeTo((Form)si);
si.Show(); si.Show();
} }