-
Notifications
You must be signed in to change notification settings - Fork 5
/
RadarScreen.h
170 lines (122 loc) · 4.87 KB
/
RadarScreen.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#pragma once
#include "EuroScopePlugIn.h"
#include <string>
#define _USE_MATH_DEFINES
#include <math.h>
#include "Constants.h"
#include <vector>
#include <algorithm>
#include "CoFrancePlugIn.h"
#include "VERA.h"
#include "PopupSpeedAssign.h"
#include "DYPWindow.h"
using namespace Gdiplus;
using namespace std;
using namespace EuroScopePlugIn;
class RadarScreen : public CRadarScreen
{
public:
RadarScreen(CoFrancePlugIn* CoFrancepluginInstance);
~RadarScreen();
void DrawOCLList(CDC dc);
CoFrancePlugIn* CoFrancepluginInstance;
int Filter_Upper = 99999;
int Filter_Lower = 0;
bool EnableTagDrawings = true;
bool EnableFilters = false;
bool EnableVV = false;
bool ShowDYP = false;
int VV_Minutes = 2;
char* SaveData_RadarDrawing = "RAD";
char* SaveData_Filters = "FILT";
char* SaveData_FiltersAbove = "FILTABOVE";
char* SaveData_FiltersBelow = "FILTBELOW";
char* SaveData_VVEnabled = "VV";
char* SaveData_VVTime = "VVTIME";
char* SaveData_APP = "APP";
bool ApproachMode = false;
string FirstSepToolCallsign = "";
map<string, string> ActiveSepTools;
map<string, CRect> ToAddAcSymbolScreenObject;
int AC_SYMBOL = 800;
int SCREEN_SEP_TOOL = 805;
int BUTTON_FILTRES = 950;
int BUTTON_FILTRES_LOWER = 951;
int BUTTON_FILTRES_UPPER = 952;
int BUTTON_RAD = 953;
int BUTTON_VV = 954;
int BUTTON_VV_TIME = 955;
int BUTTON_APPROACH = 956;
int BUTTON_OCL = 957;
int BUTTON_DYP = 958;
int FUNCTION_SET_VV_TIME = 785;
int FUNCTION_SET_LOWER_FILTER = 787;
int FUNCTION_SET_HIGHER_FILTER = 788;
POINT MousePt;
PopupSpeedAssign aspPopup;
DYPWindow dyp;
//---OnRefresh------------------------------------------------------
void OnRefresh(HDC hDC, int Phase);
void OnAsrContentToBeClosed();
void OnAsrContentToBeSaved();
void OnAsrContentLoaded(bool Loaded);
void OnMoveScreenObject(int ObjectType, const char* sObjectId, POINT Pt, RECT Area, bool Released);
void DrawFixedSizedText(Graphics* g, CPosition TextPosition, int Size, string text, Color c) {
POINT pt = ConvertCoordFromPositionToPixel(TextPosition);
int maxLenghtNm = Size;
CPosition fontPosFirst;
CPosition fontPosLast;
fontPosFirst.LoadFromStrings("E002.09.16.748", "N050.42.02.815");
fontPosLast = Extrapolate(fontPosFirst, 90, maxLenghtNm);
POINT fontPosFirstPt = ConvertCoordFromPositionToPixel(fontPosFirst);
POINT fontPosLastPt = ConvertCoordFromPositionToPixel(fontPosLast);
int width = fontPosLastPt.x - fontPosFirstPt.x;
int FontSize = width / 3;
Font* LevelFontF = new Gdiplus::Font(L"vCTR Text", Gdiplus::REAL(FontSize), Gdiplus::FontStyleRegular, Gdiplus::UnitPixel);
g->DrawString(wstring(text.begin(), text.end()).c_str(), wcslen(wstring(text.begin(), text.end()).c_str()), LevelFontF, PointF(Gdiplus::REAL(pt.x), Gdiplus::REAL(pt.y)), &SolidBrush(c));
}
void OnOverScreenObject(int ObjectType, const char* sObjectId, POINT Pt, RECT Area);
void OnClickScreenObject(int ObjectType, const char* sObjectId, POINT Pt, RECT Area, int Button);
void OnFunctionCall(int FunctionId, const char* sItemString, POINT Pt, RECT Area);
CRect DrawMenuBarButton(CDC* dc, POINT TopLeft, string Text, bool Pressed) {
COLORREF DarkBlueMenu = StaticColours::DarkBlueMenu.ToCOLORREF();
COLORREF LightBlueMenu = StaticColours::LightBlueMenu.ToCOLORREF();
CBrush ButtonBackground(DarkBlueMenu);
CBrush ButtonPressedBackground(LightBlueMenu);
CPen YellowPen(PS_SOLID, 1, StaticColours::YellowHighlight.ToCOLORREF());
// We need to calculate the size of the button according to the text fitting
CSize TextSize = dc->GetTextExtent(Text.c_str());
int Width = TextSize.cx + ButtonPaddingSides * 2;
int Height = TextSize.cy + ButtonPaddingTop * 2;
CRect Button(TopLeft.x, TopLeft.y, TopLeft.x + Width, TopLeft.y + Height);
if (!Pressed)
dc->FillSolidRect(Button, DarkBlueMenu);
else
dc->FillSolidRect(Button, LightBlueMenu);
dc->Draw3dRect(TopLeft.x, TopLeft.y, Width, Height, StaticColours::MenuButtonTop.ToCOLORREF(), StaticColours::MenuButtonBottom.ToCOLORREF());
if (IsInRect(MousePt, Button)) {
dc->SelectStockObject(NULL_BRUSH);
dc->SelectObject(&YellowPen);
dc->Rectangle(Button);
}
// Text Draw
if (!Pressed)
dc->SetTextColor(StaticColours::GreyTextMenu.ToCOLORREF());
else
dc->SetTextColor(StaticColours::DarkBlueMenu.ToCOLORREF());
dc->TextOutA(TopLeft.x + ButtonPaddingSides, TopLeft.y + ButtonPaddingTop, Text.c_str());
return Button;
};
void FillInAltitudeList(CPlugIn* Plugin, int FunctionId, int Current) {
Plugin->AddPopupListElement(" 999 ", "", FunctionId, Current == 99999);
for (int i = 415; i >= 0; i -= 10)
Plugin->AddPopupListElement(string(string(" ") + to_string(i) + string(" ")).c_str(), "", FunctionId, Current / 100 == i);
};
void Log(string s)
{
std::ofstream file;
file.open("C:/Users/Pierre/source/repos/CoFrance/Debug/CoFrance_custom.log", std::ofstream::out | std::ofstream::app);
file << s << endl;
file.close();
}
};