Skip to content

Commit

Permalink
adding pinning option to EHS list
Browse files Browse the repository at this point in the history
Resolving #60
  • Loading branch information
kusterjs committed Dec 13, 2024
1 parent 3ec24fa commit 17fa85e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
24 changes: 21 additions & 3 deletions CCAMS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ CCAMS::CCAMS(const EquipmentCodes&& ec, const SquawkCodes&& sc) : CPlugIn(EuroSc

RegisterTagItemFunction("Auto assign squawk", ItemCodes::TAG_FUNC_ASSIGN_SQUAWK_AUTO);
RegisterTagItemFunction("Open SQUAWK assign popup", ItemCodes::TAG_FUNC_SQUAWK_POPUP);
RegisterTagItemFunction("Toggle pin to EHS list", ItemCodes::TAG_FUNC_TOGGLE_EHS_LIST);

FpListEHS = RegisterFpList("Mode S EHS");
if (FpListEHS.GetColumnNumber() == 0)
{
FpListEHS.AddColumnDefinition("P", 1, false, MY_PLUGIN_NAME, ItemCodes::TAG_ITEM_EHS_PINNED, MY_PLUGIN_NAME, ItemCodes::TAG_FUNC_TOGGLE_EHS_LIST, NULL, NULL);
FpListEHS.AddColumnDefinition("C/S", 8, false, NULL, TAG_ITEM_TYPE_CALLSIGN, NULL, TAG_ITEM_FUNCTION_OPEN_FP_DIALOG, NULL, NULL);
FpListEHS.AddColumnDefinition("HDG", 5, true, MY_PLUGIN_NAME, ItemCodes::TAG_ITEM_EHS_HDG, NULL, NULL, NULL, NULL);
FpListEHS.AddColumnDefinition("Roll", 5, true, MY_PLUGIN_NAME, ItemCodes::TAG_ITEM_EHS_ROLL, NULL, NULL, NULL, NULL);
Expand Down Expand Up @@ -341,13 +343,20 @@ void CCAMS::OnGetTagItem(CFlightPlan FlightPlan, CRadarTarget RadarTarget, int I
}
strcpy_s(sItemString, 16, assr);
}
else if (ItemCode == ItemCodes::TAG_ITEM_EHS_PINNED)
{
if (std::find(EHSListFlightPlans.begin(), EHSListFlightPlans.end(), FlightPlan.GetCallsign()) != EHSListFlightPlans.end())
strcpy_s(sItemString, 16, "¤");
else
strcpy_s(sItemString, 16, "¬");
}
}
}

void CCAMS::OnFlightPlanDisconnect(CFlightPlan FlightPlan)
{
ProcessedFlightPlans.erase(remove(ProcessedFlightPlans.begin(), ProcessedFlightPlans.end(), FlightPlan.GetCallsign()),
ProcessedFlightPlans.end());
ProcessedFlightPlans.erase(remove(ProcessedFlightPlans.begin(), ProcessedFlightPlans.end(), FlightPlan.GetCallsign()), ProcessedFlightPlans.end());
EHSListFlightPlans.erase(remove(EHSListFlightPlans.begin(), EHSListFlightPlans.end(), FlightPlan.GetCallsign()), EHSListFlightPlans.end());

FpListEHS.RemoveFpFromTheList(FlightPlan);
}
Expand Down Expand Up @@ -419,9 +428,11 @@ void CCAMS::OnRefreshFpListContent(CFlightPlanList AcList)
#endif
for (CFlightPlan FP = FlightPlanSelectFirst(); FP.IsValid(); FP = FlightPlanSelectNext(FP))
{
FpListEHS.RemoveFpFromTheList(FP);
if (std::find(EHSListFlightPlans.begin(), EHSListFlightPlans.end(), FP.GetCallsign()) == EHSListFlightPlans.end())
FpListEHS.RemoveFpFromTheList(FP);
}
FpListEHS.AddFpToTheList(FlightPlanSelectASEL());

}
}

Expand Down Expand Up @@ -487,6 +498,13 @@ void CCAMS::OnFunctionCall(int FunctionId, const char* sItemString, POINT Pt, RE
case ItemCodes::TAG_FUNC_ASSIGN_SQUAWK_VFR:
FlightPlan.GetControllerAssignedData().SetSquawk(squawkVFR);
break;
case ItemCodes::TAG_FUNC_TOGGLE_EHS_LIST:
if (std::find(EHSListFlightPlans.begin(), EHSListFlightPlans.end(), FlightPlan.GetCallsign()) != EHSListFlightPlans.end())
EHSListFlightPlans.erase(remove(EHSListFlightPlans.begin(), EHSListFlightPlans.end(), FlightPlan.GetCallsign()), EHSListFlightPlans.end());
else
EHSListFlightPlans.push_back(FlightPlan.GetCallsign());
FpListEHS.AddFpToTheList(FlightPlan);
break;
default:
break;
}
Expand Down
11 changes: 7 additions & 4 deletions CCAMS.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ using namespace EuroScopePlugIn;

#define MY_PLUGIN_NAME "CCAMS"
#ifdef _DEBUG
#define MY_PLUGIN_VERSION "2.4.1 DEV"
#define MY_PLUGIN_VERSION "2.4.5 DEV"
#else
#define MY_PLUGIN_VERSION "2.4.1"
#define MY_PLUGIN_VERSION "2.4.5"
#endif
#define MY_PLUGIN_VERSIONCODE 15
#ifdef USE_HTTPLIB
Expand All @@ -40,7 +40,8 @@ struct ItemCodes
TAG_ITEM_EHS_ROLL,
TAG_ITEM_EHS_GS,
TAG_ITEM_ERROR_MODES_USE,
TAG_ITEM_SQUAWK
TAG_ITEM_SQUAWK,
TAG_ITEM_EHS_PINNED
};

enum ItemFunctions : int
Expand All @@ -51,7 +52,8 @@ struct ItemCodes
TAG_FUNC_ASSIGN_SQUAWK_MANUAL,
TAG_FUNC_ASSIGN_SQUAWK_VFR,
TAG_FUNC_ASSIGN_SQUAWK_MODES,
TAG_FUNC_ASSIGN_SQUAWK_DISCRETE
TAG_FUNC_ASSIGN_SQUAWK_DISCRETE,
TAG_FUNC_TOGGLE_EHS_LIST
};
};

Expand Down Expand Up @@ -108,6 +110,7 @@ class CCAMS :
vector<string> ProcessedFlightPlans;
regex ModeSAirports;
CFlightPlanList FpListEHS;
vector<string> EHSListFlightPlans;
string EquipmentCodesFAA;
string EquipmentCodesICAO;
string EquipmentCodesICAOEHS;
Expand Down

0 comments on commit 17fa85e

Please sign in to comment.