Skip to content

Commit 7d2026e

Browse files
author
Pierre Ferran
committed
Cleaning up a bit
1 parent 22d309c commit 7d2026e

File tree

9 files changed

+67
-63
lines changed

9 files changed

+67
-63
lines changed

vSMR/CPDLCSettingsDialog.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//
33

44
#include "stdafx.h"
5-
#include "vSMR.hpp"
65
#include "CPDLCSettingsDialog.hpp"
76
#include "afxdialogex.h"
87

vSMR/Constant.hpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#pragma once
2+
#include <afxwin.h>
3+
#include "stdafx.h"
4+
5+
const int TAG_ITEM_DATALINK_STS = 444;
6+
const int TAG_FUNC_DATALINK_MENU = 544;
7+
8+
const int TAG_FUNC_DATALINK_CONFIRM = 545;
9+
const int TAG_FUNC_DATALINK_STBY = 546;
10+
const int TAG_FUNC_DATALINK_VOICE = 547;
11+
const int TAG_FUNC_DATALINK_RESET = 548;
12+
13+
static bool startsWith(const char *pre, const char *str)
14+
{
15+
size_t lenpre = strlen(pre), lenstr = strlen(str);
16+
return lenstr < lenpre ? false : strncmp(pre, str, lenpre) == 0;
17+
};
18+
19+
const int DRAWING_TAG = 1211;
20+
const int DRAWING_AC_SYMBOL = 1212;
21+
22+
const int TAG_CITEM_CALLSIGN = 1911;
23+
const int TAG_CITEM_FPBOX = 1912;
24+
const int TAG_CITEM_RWY = 1913;
25+
const int TAG_CITEM_GATE = 1914;
26+
27+
// RIMCAS Menus & shit
28+
const int RIMCAS_CLOSE = EuroScopePlugIn::TAG_ITEM_FUNCTION_NO;
29+
const int RIMCAS_ACTIVE_AIRPORT = 7999;
30+
const int RIMCAS_ACTIVE_AIRPORT_FUNC = 8008;
31+
const int RIMCAS_DISPLAY_MENU = 8000;
32+
const int RIMCAS_RIMCAS_MENU = 8001;
33+
const int RIMCAS_QDM_TOGGLE = 8006;
34+
const int RIMCAS_CA_MONITOR = 9873;
35+
const int RIMCAS_CA_MONITOR_FUNC = 8022;
36+
const int RIMCAS_CA_ARRIVAL = 9874;
37+
const int RIMCAS_CA_ARRIVAL_FUNC = 8020;
38+
const int RIMCAS_CLOSED_RUNWAYS = 9875;
39+
const int RIMCAS_CLOSED_RUNWAYS_FUNC = 8021;
40+
const int RIMCAS_TAGS_MENU = 8007;
41+
const int RIMCAS_TAGS_2NDLINE = 8009;
42+
const int RIMCAS_APPWINDOW = 8010;
43+
const int RIMCAS_UPDATERANGE = 8011;
44+
const int RIMCAS_UPDATEFILTER = 8012;
45+
const int RIMCAS_PRIMARY = 8013;
46+
const int RIMCAS_TAGCOLOR = 8014;
47+
const int RIMCAS_TIMER = 8015;
48+
const int RIMCAS_TAGS_ACTYPE = 8016;
49+
const int RIMCAS_TAGS_SQWARNING = 8017;
50+
const int RIMCAS_TAGS_SPEEDGATE = 8018;

vSMR/DataLinkDialog.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//
33

44
#include "stdafx.h"
5-
#include "vSMR.hpp"
65
#include "DataLinkDialog.hpp"
76
#include "afxdialogex.h"
87

vSMR/SMRPlugin.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ int messageId = 0;
5151

5252
clock_t timer;
5353

54-
bool startsWith(const char *pre, const char *str)
55-
{
56-
size_t lenpre = strlen(pre), lenstr = strlen(str);
57-
return lenstr < lenpre ? false : strncmp(pre, str, lenpre) == 0;
58-
};
59-
6054
void datalinkLogin(void * arg) {
6155
string raw;
6256
string url = baseUrlDatalink;

vSMR/SMRPlugin.hpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "DataLinkDialog.hpp"
66
#include <string>
77
#include <algorithm>
8+
#include "Constant.hpp"
89
#include "Mmsystem.h"
910
#include "SMRRadar.hpp"
1011

@@ -24,14 +25,6 @@ class CSMRPlugin :
2425
CSMRPlugin();
2526
virtual ~CSMRPlugin();
2627

27-
const int TAG_ITEM_DATALINK_STS = 444;
28-
const int TAG_FUNC_DATALINK_MENU = 544;
29-
30-
const int TAG_FUNC_DATALINK_CONFIRM = 545;
31-
const int TAG_FUNC_DATALINK_STBY = 546;
32-
const int TAG_FUNC_DATALINK_VOICE = 547;
33-
const int TAG_FUNC_DATALINK_RESET = 548;
34-
3528
//---OnCompileCommand------------------------------------------
3629

3730
virtual bool OnCompileCommand(const char * sCommandLine);

vSMR/SMRRadar.cpp

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,6 @@ string CSMRRadar::GetBottomLine(const char * Callsign) {
769769

770770
bool CSMRRadar::OnCompileCommand(const char * sCommandLine)
771771
{
772-
773-
774772
return false;
775773
}
776774

@@ -896,7 +894,6 @@ double TrueBearing(CPosition pos1, CPosition pos2)
896894

897895
void CSMRRadar::OnRefresh(HDC hDC, int Phase)
898896
{
899-
900897
if (Phase != REFRESH_PHASE_BEFORE_TAGS)
901898
return;
902899

@@ -1146,10 +1143,12 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
11461143
th.DrawEllipse(dc, acPosPix.x - 4, acPosPix.y - 4, acPosPix.x + 4, acPosPix.y + 4, RGB(255, 255, 255));
11471144
}
11481145

1146+
AddScreenObject(DRAWING_AC_SYMBOL, rt.GetCallsign(), { acPosPix.x - 4, acPosPix.y - 4, acPosPix.x + 4, acPosPix.y + 4 }, false, GetBottomLine(rt.GetCallsign()).c_str());
1147+
11491148
dc.SelectObject(pqOrigPen);
11501149

11511150
}
1152-
else if (rt.GetGS() >= 50 && rt.GetGS() < 180 && rt.GetPosition().GetFlightLevel() < 2500) {
1151+
else if (rt.GetGS() >= 50 && rt.GetGS() < 180 && rt.GetPosition().GetPressureAltitude() < (GetPlugIn()->GetTransitionAltitude()-2000)) {
11531152
TGraphics th;
11541153

11551154
POINT acPosPix = ConvertCoordFromPositionToPixel(RtPos.GetPosition());
@@ -1268,15 +1267,10 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
12681267
dc.LineTo(acPosPix.x, acPosPix.y - 6);
12691268
}
12701269
else {
1271-
dc.MoveTo(acPosPix.x - 6, acPosPix.y);
1272-
dc.LineTo(acPosPix.x + 6, acPosPix.y);
1273-
dc.MoveTo(acPosPix.x, acPosPix.y - 6);
1274-
dc.LineTo(acPosPix.x, acPosPix.y + 6);
1270+
th.DrawEllipse(dc, acPosPix.x - 4, acPosPix.y - 4, acPosPix.x + 4, acPosPix.y + 4, RGB(255, 255, 255));
12751271
}
12761272

1277-
if (RtPos.GetTransponderI()) {
1278-
th.DrawEllipse(dc, acPosPix.x - 7, acPosPix.y - 7, acPosPix.x + 7, acPosPix.y + 7, RGB(255, 255, 255));
1279-
}
1273+
AddScreenObject(DRAWING_AC_SYMBOL, rt.GetCallsign(), { acPosPix.x - 4, acPosPix.y - 4, acPosPix.x + 4, acPosPix.y + 4 }, false, GetBottomLine(rt.GetCallsign()).c_str());
12801274

12811275
dc.SelectObject(pqOrigPen);
12821276
}
@@ -2023,11 +2017,13 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
20232017
to_display = "F";
20242018
FL = RtPos.GetFlightLevel();
20252019
}
2026-
string str = std::to_string(FL);
2027-
for (size_t i = 0; i < 5 - str.length(); i++)
2020+
ostringstream strs;
2021+
strs << FL;
2022+
string str = strs.str();
2023+
for (size_t i = 0; i < 6 - str.length(); i++)
20282024
str = "0" + str;
2029-
2030-
to_display.append(str.substr(0, 3));
2025+
str.erase(str.begin() + 3, str.end());
2026+
to_display.append(str);
20312027
int delta_fl = FL - rt.GetPreviousPosition(RtPos).GetPressureAltitude();
20322028
if (abs(delta_fl) >= 20) {
20332029
if (delta_fl < 0) {

vSMR/SMRRadar.hpp

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <algorithm>
99
#include <time.h>
1010
#include <sstream>
11+
#include "Constant.hpp"
1112
#include "CallsignLookup.hpp"
1213
#include "TGraphics.h"
1314
#include "Rimcas.hpp"
@@ -22,38 +23,6 @@ class CSMRRadar :
2223
CSMRRadar();
2324
virtual ~CSMRRadar();
2425

25-
int DRAWING_TAG = 1211;
26-
27-
const int TAG_CITEM_CALLSIGN = 1911;
28-
const int TAG_CITEM_FPBOX = 1912;
29-
const int TAG_CITEM_RWY = 1913;
30-
const int TAG_CITEM_GATE = 1914;
31-
32-
// RIMCAS Menus & shit
33-
const int RIMCAS_CLOSE = EuroScopePlugIn::TAG_ITEM_FUNCTION_NO;
34-
const int RIMCAS_ACTIVE_AIRPORT = 7999;
35-
const int RIMCAS_ACTIVE_AIRPORT_FUNC = 8008;
36-
const int RIMCAS_DISPLAY_MENU = 8000;
37-
const int RIMCAS_RIMCAS_MENU = 8001;
38-
const int RIMCAS_QDM_TOGGLE = 8006;
39-
const int RIMCAS_CA_MONITOR = 9873;
40-
const int RIMCAS_CA_MONITOR_FUNC = 8022;
41-
const int RIMCAS_CA_ARRIVAL = 9874;
42-
const int RIMCAS_CA_ARRIVAL_FUNC = 8020;
43-
const int RIMCAS_CLOSED_RUNWAYS = 9875;
44-
const int RIMCAS_CLOSED_RUNWAYS_FUNC = 8021;
45-
const int RIMCAS_TAGS_MENU = 8007;
46-
const int RIMCAS_TAGS_2NDLINE = 8009;
47-
const int RIMCAS_APPWINDOW = 8010;
48-
const int RIMCAS_UPDATERANGE = 8011;
49-
const int RIMCAS_UPDATEFILTER = 8012;
50-
const int RIMCAS_PRIMARY = 8013;
51-
const int RIMCAS_TAGCOLOR = 8014;
52-
const int RIMCAS_TIMER = 8015;
53-
const int RIMCAS_TAGS_ACTYPE = 8016;
54-
const int RIMCAS_TAGS_SQWARNING = 8017;
55-
const int RIMCAS_TAGS_SPEEDGATE = 8018;
56-
5726
bool BLINK = false;
5827

5928
map<string, POINT> TagsOffsets;

vSMR/vSMR.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
</ItemGroup>
134134
<ItemGroup>
135135
<ClInclude Include="CallsignLookup.hpp" />
136+
<ClInclude Include="Constant.hpp" />
136137
<ClInclude Include="CPDLCSettingsDialog.hpp" />
137138
<ClInclude Include="DataLinkDialog.hpp" />
138139
<ClInclude Include="HttpHelper.hpp" />

vSMR/vSMR.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@
8686
<ClInclude Include="vSMR.hpp">
8787
<Filter>Header Files</Filter>
8888
</ClInclude>
89+
<ClInclude Include="Constant.hpp">
90+
<Filter>Header Files</Filter>
91+
</ClInclude>
8992
</ItemGroup>
9093
<ItemGroup>
9194
<None Include="vSMR.def">

0 commit comments

Comments
 (0)