Skip to content

Commit 1fe1e09

Browse files
committed
Bug fixes
1 parent 4472416 commit 1fe1e09

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

vSMR/InsetWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ void CInsetWindow::render(HDC hDC, CSMRRadar * radar_screen, Graphics* gdi, POIN
557557
for (auto&& tagItem : line)
558558
{
559559
SolidBrush* color = &FontColor;
560-
if (TagMap["sqerror"].value.size() > 0 && strcmp(tagItem.value.c_str(), TagMap["sqerror"].value.c_str()) == 0)
560+
if (TagMap["sqerror"].value.size() > 0 && tagItem.value == TagMap["sqerror"].value)
561561
color = &SquawkErrorColor;
562562

563563
if (radar_screen->RimcasInstance->getAlert(rt.GetCallsign()) != CRimcas::NoAlert)

vSMR/SMRRadar.cpp

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,8 @@ void CSMRRadar::OnMoveScreenObject(int ObjectType, const char * sObjectId, POINT
478478
}
479479
}
480480

481-
if (ObjectType == DRAWING_TAG || ObjectType == TAG_CITEM_MANUALCORRELATE || ObjectType == TAG_CITEM_CALLSIGN || ObjectType == TAG_CITEM_FPBOX || ObjectType == TAG_CITEM_RWY || ObjectType == TAG_CITEM_SID || ObjectType == TAG_CITEM_GATE || ObjectType == TAG_CITEM_NO || ObjectType == TAG_CITEM_GROUNDSTATUS) {
481+
if (ObjectType == DRAWING_TAG || ObjectType == TAG_CITEM_MANUALCORRELATE || ObjectType == TAG_CITEM_CALLSIGN || ObjectType == TAG_CITEM_FPBOX || ObjectType == TAG_CITEM_RWY ||
482+
ObjectType == TAG_CITEM_SID || ObjectType == TAG_CITEM_GATE || ObjectType == TAG_CITEM_NO || ObjectType == TAG_CITEM_GROUNDSTATUS || ObjectType == TAG_CITEM_SCRATCHPAD) {
482483
CRadarTarget rt = GetPlugIn()->RadarTargetSelect(sObjectId);
483484

484485
if (!Released) {
@@ -869,13 +870,14 @@ void CSMRRadar::OnClickScreenObject(int ObjectType, const char * sObjectId, POIN
869870
onFunctionCallDoubleCallHack = true;
870871
}
871872

872-
if (Button == BUTTON_RIGHT && ObjectType == TAG_CITEM_SCRATCHPAD) {
873+
if (Button == BUTTON_RIGHT && ObjectType == TAG_CITEM_SCRATCHPAD) { // We could use the default TAG_ITEM_FUNCTION_EDIT_SCRATCH_PAD, but that sets a default small size for the editing text window, which is a bit meh
873874
CFlightPlan fp = GetPlugIn()->FlightPlanSelect(sObjectId);
874875
GetPlugIn()->SetASELAircraft(fp);
875876
GetPlugIn()->OpenPopupEdit(Area, TAG_FUNC_SCRATCHPAD_EDITOR, fp.GetControllerAssignedData().GetScratchPadString());
876877
onFunctionCallDoubleCallHack = true;
877878
}
878879

880+
879881
if (ObjectType == RIMCAS_DISTANCE_TOOL) {
880882
vector<string> s = split(sObjectId, ',');
881883
pair<string, string> toRemove = pair<string, string>(s.front(), s.back());
@@ -896,7 +898,7 @@ void CSMRRadar::OnClickScreenObject(int ObjectType, const char * sObjectId, POIN
896898
RequestRefresh();
897899
};
898900

899-
void CSMRRadar::OnDoubleClickScreenObject(int ObjectType, const char * sObjectId, POINT Pt, RECT Area, int Button) {
901+
void CSMRRadar::OnDoubleClickScreenObject(int ObjectType, const char * sObjectId, POINT Pt, RECT Area, int Button) {
900902
Logger::info(string(__FUNCSIG__));
901903
mouseLocation = Pt;
902904

@@ -945,6 +947,7 @@ void CSMRRadar::OnFunctionCall(int FunctionId, const char * sItemString, POINT P
945947
onFunctionCallDoubleCallHack = false;
946948
}
947949
}
950+
948951
else if (FunctionId == TAG_FUNC_SCRATCHPAD_EDITOR) { // when finished editing
949952
if (onFunctionCallDoubleCallHack) {
950953
CFlightPlan fp = GetPlugIn()->FlightPlanSelectASEL();
@@ -953,7 +956,6 @@ void CSMRRadar::OnFunctionCall(int FunctionId, const char * sItemString, POINT P
953956
}
954957
}
955958

956-
957959
else if (FunctionId == APPWINDOW_ONE || FunctionId == APPWINDOW_TWO) {
958960
int id = FunctionId - APPWINDOW_BASE;
959961
appWindowDisplays[id] = !appWindowDisplays[id];
@@ -1535,10 +1537,13 @@ map<string, CSMRRadar::TagItem> CSMRRadar::GenerateTagData(CRadarTarget rt, CFli
15351537
}
15361538

15371539
// ----- GSTAT -------
1538-
string gstat = "STS";
1540+
string gstat = "";
15391541
if (fp.IsValid() && isAcCorrelated) {
15401542
gstat = fp.GetGroundState();
15411543
}
1544+
if (gstat == "") {
1545+
gstat = "STS";
1546+
}
15421547

15431548
// ----- Scratchpad ------
15441549
string scratchpad = fp.GetControllerAssignedData().GetScratchPadString();
@@ -1553,7 +1558,7 @@ map<string, CSMRRadar::TagItem> CSMRRadar::GenerateTagData(CRadarTarget rt, CFli
15531558
TagMap["systemid"].value = "T:";
15541559
string tpss = rt.GetSystemID();
15551560
TagMap["systemid"].value.append(tpss.substr(1, 6));
1556-
TagMap["systemid"].function = TAG_CITEM_GROUNDSTATUS;
1561+
TagMap["systemid"].function = TAG_CITEM_FPBOX;
15571562

15581563
// Pro mode data here
15591564
//if (isProMode) {
@@ -2165,13 +2170,18 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
21652170
Pen pw(ColorManager->get_corrected_color("label", Color::White));
21662171
graphics.DrawRectangle(&pw, CopyRect(TagBackgroundRect));
21672172
}
2173+
if (TagMap["groundstatus"].value == "DEPA") { // White border if tag is departure
2174+
Pen pw(ColorManager->get_corrected_color("label", Color::White), 2);
2175+
graphics.DrawRectangle(&pw, CopyRect(TagBackgroundRect));
2176+
}
21682177

21692178
// Drawing the tag text
21702179

21712180
SolidBrush FontColor(ColorManager->get_corrected_color("label", CurrentConfig->getConfigColor(LabelsSettings[Utils::getEnumString(ColorTagType).c_str()]["text_color"])));
21722181
SolidBrush SquawkErrorColor(ColorManager->get_corrected_color("label", CurrentConfig->getConfigColor(LabelsSettings["squawk_error_color"])));
21732182
SolidBrush RimcasTextColor(CurrentConfig->getConfigColor(CurrentConfig->getActiveProfile()["rimcas"]["alert_text_color"]));
21742183

2184+
/*
21752185
SolidBrush GroundPushColor(TagBackgroundColor);
21762186
SolidBrush GroundTaxiColor(TagBackgroundColor);
21772187
SolidBrush GroundDepaColor(TagBackgroundColor);
@@ -2180,6 +2190,7 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
21802190
GroundTaxiColor.SetColor(ColorManager->get_corrected_color("label", CurrentConfig->getConfigColor(LabelsSettings["groundstatus_colors"]["taxi"])));
21812191
GroundDepaColor.SetColor(ColorManager->get_corrected_color("label", CurrentConfig->getConfigColor(LabelsSettings["groundstatus_colors"]["depa"])));
21822192
}
2193+
*/
21832194

21842195
// Drawing the leader line
21852196
RECT TagBackRectData = TagBackgroundRect;
@@ -2233,20 +2244,20 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
22332244
Gdiplus::REAL widthOffset = 0;
22342245
for (auto&& tagItem : line) {
22352246
SolidBrush* color = &FontColor;
2236-
if (TagMap["sqerror"].value.size() > 0 && strcmp(tagItem.value.c_str(), TagMap["sqerror"].value.c_str()) == 0)
2247+
if (TagMap["sqerror"].value.size() > 0 && tagItem.value == TagMap["sqerror"].value)
22372248
color = &SquawkErrorColor;
22382249

22392250
if (RimcasInstance->getAlert(rt.GetCallsign()) != CRimcas::NoAlert)
22402251
color = &RimcasTextColor;
22412252

22422253
// Ground tag colors
2243-
if (strcmp(tagItem.value.c_str(), "PUSH") == 0)
2254+
/*if (tagItem.value == "PUSH")
22442255
color = &GroundPushColor;
2245-
if (strcmp(tagItem.value.c_str(), "TAXI") == 0)
2256+
if (tagItem.value == "TAXI")
22462257
color = &GroundTaxiColor;
2247-
if (strcmp(tagItem.value.c_str(), "DEPA") == 0)
2258+
if (tagItem.value == "DEPA")
22482259
color = &GroundDepaColor;
2249-
2260+
*/
22502261
RectF mRect(0, 0, 0, 0);
22512262
wstring welement = wstring(tagItem.value.begin(), tagItem.value.end());
22522263
Gdiplus::StringFormat stformat = new Gdiplus::StringFormat(StringFormatFlagsMeasureTrailingSpaces);

0 commit comments

Comments
 (0)