Skip to content

Commit

Permalink
FlightData: fix gimbal video context menu bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlong13 committed Jan 3, 2025
1 parent 1dc7c1c commit 0a8dac8
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions GCSViews/FlightData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6469,20 +6469,16 @@ private void jumpToTagToolStripMenuItem_Click(object sender, EventArgs e)
ToolStripMenuItem gimbalVideoShowMiniMap = new ToolStripMenuItem("Mini map");
ToolStripMenuItem gimbalVideoSwapPosition = new ToolStripMenuItem("Swap with map");
ToolStripMenuItem gimbalVideoClose = new ToolStripMenuItem("Close");
bool gimbalMenuHandlersInitialized = false;
GimbalVideoControl _gimbalVideoControl;
GimbalVideoControl gimbalVideoControl
{
get
{
// Check if we need to construct a gimbalVideoControl
if (_gimbalVideoControl == null || _gimbalVideoControl.IsDisposed)
// If this is the first call, create the handlers for the context menu items
if (!gimbalMenuHandlersInitialized)
{
_gimbalVideoControl = new GimbalVideoControl();
_gimbalVideoControl.Dock = DockStyle.Fill;

// Add option to show/hide minimap
gimbalVideoShowMiniMap.CheckOnClick = true;
gimbalVideoShowMiniMap.Checked = true;
gimbalMenuHandlersInitialized = true;
gimbalVideoShowMiniMap.CheckedChanged += (s, ev) =>
{
gMapControl1.Visible = gimbalVideoShowMiniMap.Checked;
Expand All @@ -6506,6 +6502,16 @@ GimbalVideoControl gimbalVideoControl
gimbalVideoControl.Stop();
gimbalVideoControl.Dispose();
};
}
// Check if we need to construct a gimbalVideoControl
if (_gimbalVideoControl == null || _gimbalVideoControl.IsDisposed)
{
_gimbalVideoControl = new GimbalVideoControl();
_gimbalVideoControl.Dock = DockStyle.Fill;

// Add option to show/hide minimap
gimbalVideoShowMiniMap.CheckOnClick = true;
gimbalVideoShowMiniMap.Checked = true;

_gimbalVideoControl.VideoBoxContextMenu.Items.Add(gimbalVideoShowMiniMap);
_gimbalVideoControl.VideoBoxContextMenu.Items.Add(gimbalVideoSwapPosition);
Expand Down

0 comments on commit 0a8dac8

Please sign in to comment.