@@ -181,7 +181,7 @@ void CSMRRadar::LoadCustomFont()
181181 if (strcmp (CurrentConfig->getActiveProfile ()[" font" ][" weight" ].GetString (), " Italic" ) == 0 )
182182 fontStyle = Gdiplus::FontStyleItalic;
183183
184- customFont = new Gdiplus::Font (buffer.c_str (), Gdiplus::REAL (currentFontSize), fontStyle, Gdiplus::UnitPixel);
184+ customFont = new Gdiplus::Font (buffer.c_str (), Gdiplus::REAL (currentFontSize), fontStyle, Gdiplus::UnitPixel); // @Leak
185185}
186186
187187void CSMRRadar::LoadProfile (CBString profileName)
@@ -312,7 +312,7 @@ void CSMRRadar::OnAsrContentLoaded(bool Loaded)
312312 predictedTrackLength = strtof (p_value, NULL );
313313
314314 if ((p_value = GetDataFromAsr (" PredictedTrackWidth" )) != NULL )
315- predictedTrackWidth = strtof (p_value, NULL );
315+ predictedTrackWidth = atoi (p_value);
316316
317317 if ((p_value = GetDataFromAsr (" CustomCursor" )) != NULL )
318318 useCustomCursor = atoi (p_value) == 1 ? true : false ;
@@ -390,7 +390,7 @@ void CSMRRadar::OnAsrContentToBeSaved()
390390 temp.format (" %f" , predictedTrackLength);
391391 SaveDataToAsr (" PredictedTrackLength" , " vSMR Predicted Track Lines" , temp);
392392
393- temp.format (" %f " , predictedTrackWidth);
393+ temp.format (" %d " , predictedTrackWidth);
394394 SaveDataToAsr (" PredictedTrackWidth" , " vSMR Predicted Track Lines" , temp);
395395
396396 temp.format (" %d" , isProMode);
@@ -691,7 +691,7 @@ void CSMRRadar::OnClickScreenObject(int ObjectType, const char * sObjectId, POIN
691691 GetPlugIn ()->AddPopupListElement (" GRND Trail Dots" , " " , RIMCAS_OPEN_LIST);
692692 GetPlugIn ()->AddPopupListElement (" APPR Trail Dots" , " " , RIMCAS_OPEN_LIST);
693693 GetPlugIn ()->AddPopupListElement (bstr2cstr (bformat (" Predicted Track Line Length: %.1f" , predictedTrackLength), ' ' ), " " , RIMCAS_UPDATE_PTL_LENGTH_EDIT);
694- GetPlugIn ()->AddPopupListElement (bstr2cstr (bformat (" Predicted Track Line Width: %.2f " , predictedTrackWidth), ' ' ), " " , RIMCAS_UPDATE_PTL_WIDTH_EDIT);
694+ GetPlugIn ()->AddPopupListElement (bstr2cstr (bformat (" Predicted Track Line Width: %d " , predictedTrackWidth), ' ' ), " " , RIMCAS_UPDATE_PTL_WIDTH_EDIT);
695695 GetPlugIn ()->AddPopupListElement (" Acquire" , " " , RIMCAS_UPDATE_ACQUIRE);
696696 GetPlugIn ()->AddPopupListElement (" Release" , " " , RIMCAS_UPDATE_RELEASE);
697697 GetPlugIn ()->AddPopupListElement (" Close" , " " , RIMCAS_CLOSE, false , 2 , false , true );
@@ -1015,12 +1015,12 @@ void CSMRRadar::OnFunctionCall(int FunctionId, const char * sItemString, POINT P
10151015 }
10161016 }
10171017 else if (FunctionId == RIMCAS_UPDATE_PTL_WIDTH_EDIT) {
1018- GetPlugIn ()->OpenPopupEdit (Area, RIMCAS_UPDATE_PTL_WIDTH_EDITOR, bstr2cstr (bformat (" %.2f " , predictedTrackWidth), ' ' ));
1018+ GetPlugIn ()->OpenPopupEdit (Area, RIMCAS_UPDATE_PTL_WIDTH_EDITOR, bstr2cstr (bformat (" %d " , predictedTrackWidth), ' ' ));
10191019 onFunctionCallDoubleCallHack = true ;
10201020 }
10211021 else if (FunctionId == RIMCAS_UPDATE_PTL_WIDTH_EDITOR) {
10221022 if (onFunctionCallDoubleCallHack) {
1023- predictedTrackWidth = strtof (sItemString , NULL );
1023+ predictedTrackWidth = atoi (sItemString );
10241024 onFunctionCallDoubleCallHack = false ;
10251025 }
10261026 }
@@ -1804,6 +1804,11 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
18041804 return;
18051805 */
18061806
1807+ for (int tt = 0 ; tt < 100000 ; tt++) {
1808+ // Memory leak checker, put whatever you think might leak here and monitor RAM
1809+ }
1810+
1811+
18071812 Logger::info (__FUNCSIG__);
18081813 // Changing the mouse cursor
18091814 if (initCursor) {
@@ -2000,8 +2005,8 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
20002005 // Draw an arc segment
20012006 CPen arcPen (PS_SOLID, 2 , aircraft.colors .second );
20022007 CBrush arcBrush (aircraft.colors .first );
2003- defer (DeleteObject (arcPen));
2004- defer (DeleteObject (arcBrush));
2008+ // defer(DeleteObject(arcPen)); // These don't actually leak
2009+ // defer(DeleteObject(arcBrush));
20052010
20062011 dc.SelectObject (arcPen);
20072012 dc.SelectObject (arcBrush);
@@ -2392,8 +2397,8 @@ void CSMRRadar::DrawTargets(Graphics* graphics, CDC* dc, CInsetWindow* insetWind
23922397 acPosPix = insetWindow->projectPoint (RtPos.GetPosition (), AirportPositions[ActiveAirport]);
23932398 }
23942399
2395- CPen qTrailPen (PS_SOLID, 1 , ColorManager->get_corrected_color (" symbol" , Gdiplus::Color::White).ToCOLORREF ());
2396- CPen* pqOrigPen = dc->SelectObject (&qTrailPen );
2400+ CPen trailPen (PS_SOLID, 1 , ColorManager->get_corrected_color (" symbol" , Gdiplus::Color::White).ToCOLORREF ());
2401+ CPen* origPen = dc->SelectObject (&trailPen );
23972402
23982403 if (RtPos.GetTransponderC ()) {
23992404 dc->MoveTo ({ acPosPix.x , acPosPix.y - 6 });
@@ -2414,7 +2419,9 @@ void CSMRRadar::DrawTargets(Graphics* graphics, CDC* dc, CInsetWindow* insetWind
24142419 }
24152420
24162421 // Predicted Track Line
2417- // It starts 20 seconds away from the ac
2422+ CPen predictTrackPen (PS_SOLID, predictedTrackWidth, ColorManager->get_corrected_color (" symbol" , Gdiplus::Color::White).ToCOLORREF ());
2423+ dc->SelectObject (&predictTrackPen);
2424+
24182425 if (reportedGS > 50 ) {
24192426 double d = double (rt.GetPosition ().GetReportedGS ()*0.514444 ) * (predictedTrackLength * 60.0 );
24202427 CPosition PredictedEnd = BetterHarversine (rt.GetPosition ().GetPosition (), rt.GetTrackHeading (), d);
@@ -2451,7 +2458,7 @@ void CSMRRadar::DrawTargets(Graphics* graphics, CDC* dc, CInsetWindow* insetWind
24512458 else {
24522459 AddScreenObject (DRAWING_AC_SYMBOL_APPWINDOW_BASE + (insetWindow->m_Id - SRW_APPWINDOW), rt.GetCallsign (), { acPosPix.x - 5 , acPosPix.y - 5 , acPosPix.x + 5 , acPosPix.y + 5 }, false , GetBottomLine (rt.GetCallsign ()));
24532460 }
2454- dc->SelectObject (pqOrigPen );
2461+ dc->SelectObject (origPen );
24552462 }
24562463}
24572464
@@ -2576,11 +2583,11 @@ void CSMRRadar::DrawTags(Graphics* graphics, CInsetWindow* insetWindow)
25762583 fontSizeScaling = LabelsSettings[getEnumString (ColorTagType)][" first_line_font_factor" ].GetDouble ();
25772584 fontsize = round ((float )fontSizeScaling * fontsize);
25782585 }
2579- Gdiplus::Font* firstLineFont = new Gdiplus::Font (wide_font_name.c_str (), Gdiplus::REAL (fontsize), customFont->GetStyle (), Gdiplus::UnitPixel);
2580- defer (delete (firstLineFont));
2586+ Gdiplus::Font firstLineFont (wide_font_name.c_str (), Gdiplus::REAL (fontsize), customFont->GetStyle (), Gdiplus::UnitPixel);
2587+ // defer(delete(firstLineFont));
25812588
25822589 mesureRect = RectF (0 , 0 , 0 , 0 );
2583- graphics->MeasureString (L" AZERTYUIOPQSDFGHJKLMWXCVBN" , wcslen (L" AZERTYUIOPQSDFGHJKLMWXCVBN" ), firstLineFont, PointF (0 , 0 ), stformat, &mesureRect);
2590+ graphics->MeasureString (L" AZERTYUIOPQSDFGHJKLMWXCVBN" , wcslen (L" AZERTYUIOPQSDFGHJKLMWXCVBN" ), & firstLineFont, PointF (0 , 0 ), stformat, &mesureRect);
25842591 auto firstLineHeight = mesureRect.GetBottom ();
25852592
25862593 // get label lines definitions
@@ -2597,10 +2604,10 @@ void CSMRRadar::DrawTags(Graphics* graphics, CInsetWindow* insetWindow)
25972604
25982605
25992606 REAL TagWidth = 0 , TagHeight = 0 ;
2600- REAL TAG_PADDING_LEFT = (REAL)(currentFontSize / 4.0 );
2601- REAL TAG_PADDING_RIGHT = TAG_PADDING_LEFT;
2602- REAL TAG_PADDING_TOP = TAG_PADDING_LEFT*(REAL)0.5 ;
2603- REAL TAG_PADDING_BOTTOM = TAG_PADDING_LEFT*(REAL)0.5 ;
2607+ REAL TAG_PADDING_LEFT = 0 ; // (REAL)(currentFontSize / 4.0);
2608+ REAL TAG_PADDING_RIGHT = 0 ; // TAG_PADDING_LEFT;
2609+ REAL TAG_PADDING_TOP = 0 ; // TAG_PADDING_LEFT*(REAL)0.5;
2610+ REAL TAG_PADDING_BOTTOM = 0 ; // TAG_PADDING_LEFT*(REAL)0.5;
26042611
26052612 for (unsigned int i = 0 ; i < LabelLines.Size (); i++) {
26062613
@@ -2629,7 +2636,7 @@ void CSMRRadar::DrawTags(Graphics* graphics, CInsetWindow* insetWindow)
26292636
26302637 wstring wstr = ToWString (TagMap[tagKey].value );
26312638 if (i == 0 ) {
2632- graphics->MeasureString (wstr.c_str (), wcslen (wstr.c_str ()), firstLineFont, PointF (0 , 0 ), stformat, &mesureRect); // special case for first line
2639+ graphics->MeasureString (wstr.c_str (), wcslen (wstr.c_str ()), & firstLineFont, PointF (0 , 0 ), stformat, &mesureRect); // special case for first line
26332640 }
26342641 else {
26352642 graphics->MeasureString (wstr.c_str (), wcslen (wstr.c_str ()), customFont, PointF (0 , 0 ), stformat, &mesureRect);
@@ -2804,11 +2811,11 @@ void CSMRRadar::DrawTags(Graphics* graphics, CInsetWindow* insetWindow)
28042811 if (heightOffset == TAG_PADDING_TOP) { // first line
28052812 heightOffset;
28062813
2807- graphics->DrawString (welement.c_str (), wcslen (welement.c_str ()), firstLineFont,
2814+ graphics->DrawString (welement.c_str (), wcslen (welement.c_str ()), & firstLineFont,
28082815 PointF (Gdiplus::REAL (TagBackgroundRect.left ) + widthOffset, Gdiplus::REAL (TagBackgroundRect.top ) + heightOffset),
28092816 stformat, color);
28102817
2811- graphics->MeasureString (welement.c_str (), wcslen (welement.c_str ()), firstLineFont,
2818+ graphics->MeasureString (welement.c_str (), wcslen (welement.c_str ()), & firstLineFont,
28122819 PointF (0 , 0 ), stformat, &mRect );
28132820 }
28142821 else {
0 commit comments