Skip to content

Commit

Permalink
FlightData: Left panel hiding v1
Browse files Browse the repository at this point in the history
FlightData: Left panel hiding subscribed to events
FlightData: Left panel hiding method documentation
  • Loading branch information
LEGIONBOSS committed Oct 4, 2022
1 parent ddaf805 commit 8b1aa72
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions GCSViews/FlightData.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions GCSViews/FlightData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2895,6 +2895,33 @@ private void hud1_vibeclick(object sender, EventArgs e)
frm.Show();
}

/// <summary>
/// <para>Collapses or expands MainH.Panel1 depending on no. of controls within.</para>
/// If you add controls to <b>SubMainLeft</b> that can be hidden, displaced or removed, add their first parent control here. <br/>
/// Otherwise they'll prevent the collapsing of <b>SubMainLeft</b>.
/// </summary>
private void ManageLeftPanelVisibility()
{
// Define controls to check, ADD THEM HERE
List<Control> controlsToCheck = new List<Control>()
{
SubMainLeft.Panel1, // contains hud1
panel_persistent, // might contain plugin controls
tabControlactions // contains the tabs
};

bool controlsEmpty = controlsToCheck.Sum(x => x.Controls.Count) == 0;
bool panelVisible = !MainH.Panel1Collapsed;

// if controls are empty, but panel is visible -> hide
if (controlsEmpty && panelVisible)
MainH.Panel1Collapsed = true;

// if controls have content, but panel is hidden -> show
if (!controlsEmpty && !panelVisible)
MainH.Panel1Collapsed = false;
}

private void loadFileToolStripMenuItem_Click(object sender, EventArgs e)
{
POI.POILoad();
Expand Down

0 comments on commit 8b1aa72

Please sign in to comment.