Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
BindableListView
Class File Seperation
  • Loading branch information
meee1 committed Jun 26, 2020
1 parent 0188f84 commit e8a191c
Show file tree
Hide file tree
Showing 10 changed files with 691 additions and 57 deletions.
614 changes: 614 additions & 0 deletions ExtLibs/Controls/BindableListView.cs

Large diffs are not rendered by default.

33 changes: 4 additions & 29 deletions ExtLibs/Controls/ControlExt.cs
Original file line number Diff line number Diff line change
@@ -1,39 +1,14 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System;
using System.Drawing;
using System.Windows.Forms;

namespace MissionPlanner.Controls
{
public static class SuspendUpdate
{
private const int WM_SETREDRAW = 0x000B;

public static void Suspend(Control control)
{
Message msgSuspendUpdate = Message.Create(control.Handle, WM_SETREDRAW, IntPtr.Zero,
IntPtr.Zero);

NativeWindow window = NativeWindow.FromHandle(control.Handle);
window.DefWndProc(ref msgSuspendUpdate);
}

public static void Resume(Control control)
{
// Create a C "true" boolean as an IntPtr
IntPtr wparam = new IntPtr(1);
Message msgResumeUpdate = Message.Create(control.Handle, WM_SETREDRAW, wparam,
IntPtr.Zero);

NativeWindow window = NativeWindow.FromHandle(control.Handle);
window.DefWndProc(ref msgResumeUpdate);

control.Invalidate();
}
}

public static class ControlExt
{

Expand Down
32 changes: 32 additions & 0 deletions ExtLibs/Controls/SuspendUpdate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Windows.Forms;

namespace MissionPlanner.Controls
{
public static class SuspendUpdate
{
private const int WM_SETREDRAW = 0x000B;

public static void Suspend(Control control)
{
Message msgSuspendUpdate = Message.Create(control.Handle, WM_SETREDRAW, IntPtr.Zero,
IntPtr.Zero);

NativeWindow window = NativeWindow.FromHandle(control.Handle);
window.DefWndProc(ref msgSuspendUpdate);
}

public static void Resume(Control control)
{
// Create a C "true" boolean as an IntPtr
IntPtr wparam = new IntPtr(1);
Message msgResumeUpdate = Message.Create(control.Handle, WM_SETREDRAW, wparam,
IntPtr.Zero);

NativeWindow window = NativeWindow.FromHandle(control.Handle);
window.DefWndProc(ref msgResumeUpdate);

control.Invalidate();
}
}
}
8 changes: 0 additions & 8 deletions GCSViews/ConfigurationView/ConfigTradHeli4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,4 @@ public void Deactivate()
tableLayoutPanel5.Controls.Clear();
}
}

public enum uitype
{
Combo,
Num,
Check,
Mask
}
}
14 changes: 0 additions & 14 deletions GCSViews/ConfigurationView/ConfigUAVCAN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,18 +439,4 @@ private void but_uavcanfilebrowser_Click(object sender, EventArgs e)
new UAVCANFileUI(can, id).ShowUserControl();
}
}

public class UAVCANModel
{
public byte ID { get; set; }
public string Name { get; set; } = "?";
public string Mode { get; set; }
public string Health { get; set; }
public TimeSpan Uptime { get; set; }
public string HardwareVersion { get; set; }
public string SoftwareVersion { get; set; }
public ulong SoftwareCRC { get; set; }
public uavcan.uavcan_protocol_GetNodeInfo_res RawMsg { get; set; }
public string HardwareUID { get; set; }
}
}
19 changes: 19 additions & 0 deletions GCSViews/ConfigurationView/UAVCANModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using UAVCAN;

namespace MissionPlanner.GCSViews.ConfigurationView
{
public class UAVCANModel
{
public byte ID { get; set; }
public string Name { get; set; } = "?";
public string Mode { get; set; }
public string Health { get; set; }
public TimeSpan Uptime { get; set; }
public string HardwareVersion { get; set; }
public string SoftwareVersion { get; set; }
public ulong SoftwareCRC { get; set; }
public uavcan.uavcan_protocol_GetNodeInfo_res RawMsg { get; set; }
public string HardwareUID { get; set; }
}
}
10 changes: 10 additions & 0 deletions GCSViews/ConfigurationView/uitype.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace MissionPlanner.GCSViews.ConfigurationView
{
public enum uitype
{
Combo,
Num,
Check,
Mask
}
}
11 changes: 5 additions & 6 deletions GCSViews/FlightData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2488,15 +2488,15 @@ private void goHereToolStripMenuItem_Click(object sender, EventArgs e)
return;
}

if (MainV2.comPort.MAV.GuidedMode.z == 0)
if (MainV2.comPort.MAV.GuidedMode.z == 0f)
{
flyToHereAltToolStripMenuItem_Click(null, null);

if (MainV2.comPort.MAV.GuidedMode.z == 0)
if (MainV2.comPort.MAV.GuidedMode.z == 0f)
return;
}

if (MouseDownStart.Lat == 0 || MouseDownStart.Lng == 0)
if (MouseDownStart.Lat == 0.0 || MouseDownStart.Lng == 0.0)
{
CustomMessageBox.Show(Strings.BadCoords, Strings.ERROR);
return;
Expand Down Expand Up @@ -3688,14 +3688,13 @@ private void pointCameraHereToolStripMenuItem_Click(object sender, EventArgs e)
"Enter Target Alt (Relative to home)", ref alt))
return;

float intalt = 0;
if (!float.TryParse(alt, out intalt))
if (!float.TryParse(alt, out var intalt))
{
CustomMessageBox.Show("Bad Alt");
return;
}

if (MouseDownStart.Lat == 0 || MouseDownStart.Lng == 0)
if (MouseDownStart.Lat == 0.0 || MouseDownStart.Lng == 0.0)
{
CustomMessageBox.Show("Bad Lat/Long");
return;
Expand Down
2 changes: 2 additions & 0 deletions MissionPlanner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@
<DependentUpon>ConfigUserDefined.cs</DependentUpon>
</Compile>
<Compile Include="GCSViews\ConfigurationView\DeviceInfo.cs" />
<Compile Include="GCSViews\ConfigurationView\UAVCANModel.cs" />
<Compile Include="GCSViews\ConfigurationView\uitype.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Joystick\JoystickAxis.cs">
<SubType>UserControl</SubType>
Expand Down
5 changes: 5 additions & 0 deletions aot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ for i in *.dll; do sudo mono --aot $i; done

sudo mono --aot 'MissionPlanner.exe'


#gdb --args mono --debug 'MissionPlanner.exe'

#handle SIGXCPU SIG33 SIG35 SIG36 SIG37 SIG38 SIGPWR nostop noprint

0 comments on commit e8a191c

Please sign in to comment.