-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCESPlugIn.cpp
More file actions
141 lines (119 loc) · 4.21 KB
/
Copy pathCESPlugIn.cpp
File metadata and controls
141 lines (119 loc) · 4.21 KB
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
#include "pch.h"
#include "CESPlugIn.h"
#include "ISFPRadarScreen.h"
#include <string>
#include <commdlg.h>
CESPlugIn* pMyPlugIn = nullptr;
void __declspec (dllexport)
EuroScopePlugInInit(EuroScopePlugIn::CPlugIn** ppPlugInInstance)
{
*ppPlugInInstance = pMyPlugIn =
new CESPlugIn();
}
void __declspec (dllexport)
EuroScopePlugInExit(void)
{
delete pMyPlugIn;
}
CESPlugIn::CESPlugIn(void)
:CPlugIn(EuroScopePlugIn::COMPATIBILITY_CODE,
"ISFP-eLink",
"1.0.0",
"ISFPFLY",
"Powered by ISFP")
{
DisplayUserMessage("ISFP-eLink", "", "ISFP-eLink Powered by ISFP", 1, 0, 0, 0, 0);
DisplayUserMessage("ISFP-eLink", "", "Welcome to ISFP!", 1, 0, 0, 0, 0);
DisplayUserMessage("ISFP-eLink", "", "Server Address: fsd.flyisfp.com", 1, 0, 0, 0, 0);
DisplayUserMessage("ISFP-eLink", "", "TeamSpeak Address: ts.flyisfp.com", 1, 0, 0, 0, 0);
DisplayUserMessage("ISFP-eLink", "", "QQ Group: 644614465", 1, 0, 0, 0, 0);
DisplayUserMessage("ISFP-eLink", "", "Have a good time!", 1, 0, 0, 0, 0);
}
CESPlugIn::~CESPlugIn()
{
}
CRadarScreen* CESPlugIn::OnRadarScreenCreated(const char* sDisplayName,
bool NeedRadarContent,
bool GeoReferenced,
bool CanBeSaved,
bool CanBeCreated)
{
if (strcmp(sDisplayName, "Standard ES radar screen") == 0)
{
return new CISFPRadarScreen();
}
return nullptr;
}
void CESPlugIn::RegisterScreen(CISFPRadarScreen* pScreen)
{
m_vecScreens.push_back(pScreen);
}
void CESPlugIn::UnregisterScreen(CISFPRadarScreen* pScreen)
{
for (size_t i = 0; i < m_vecScreens.size(); i++)
{
if (m_vecScreens[i] == pScreen)
{
m_vecScreens.erase(m_vecScreens.begin() + i);
break;
}
}
}
bool CESPlugIn::OnCompileCommand(const char* sCommandLine)
{
const char* cmd = sCommandLine;
if (cmd[0] == '.')
cmd++;
else
return false;
if (strncmp(cmd, "help", 4) == 0 && (cmd[4] == '\0' || cmd[4] == ' '))
{
DisplayUserMessage("ISFP-eLink", "Help", ".background - Select a background image", 1, 0, 0, 0, 0);
DisplayUserMessage("ISFP-eLink", "Help", ".background <0-100> - Set background opacity", 1, 0, 0, 0, 0);
DisplayUserMessage("ISFP-eLink", "Help", ".background off - Clear background image", 1, 0, 0, 0, 0);
DisplayUserMessage("ISFP-eLink", "Help", ".help - Show this help", 1, 0, 0, 0, 0);
return true;
}
if (strncmp(cmd, "background", 10) != 0)
return false;
cmd += 10;
while (*cmd == ' ') cmd++;
if (*cmd == '\0')
{
wchar_t wszPath[MAX_PATH] = { 0 };
OPENFILENAMEW ofn = { sizeof(ofn) };
ofn.lpstrFilter = L"Image Files\0*.png;*.jpg;*.jpeg;*.bmp;*.gif\0All Files\0*.*\0";
ofn.lpstrFile = wszPath;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER;
if (GetOpenFileNameW(&ofn))
{
for (size_t i = 0; i < m_vecScreens.size(); i++)
m_vecScreens[i]->SetBackgroundImage(wszPath);
char szMsg[512];
sprintf_s(szMsg, sizeof(szMsg), "Background image loaded");
DisplayUserMessage("ISFP-eLink", "Background", szMsg, 1, 0, 0, 0, 0);
}
return true;
}
if (strcmp(cmd, "off") == 0 || strcmp(cmd, "clear") == 0)
{
for (size_t i = 0; i < m_vecScreens.size(); i++)
m_vecScreens[i]->ClearBackgroundImage();
char szMsg[512];
sprintf_s(szMsg, sizeof(szMsg), "Background image cleared");
DisplayUserMessage("ISFPPlugin", "Background", szMsg, 1, 0, 0, 0, 0);
return true;
}
int nOpacity = atoi(cmd);
if (nOpacity >= 0 && nOpacity <= 100)
{
for (size_t i = 0; i < m_vecScreens.size(); i++)
m_vecScreens[i]->SetBackgroundOpacity(nOpacity);
char szMsg[512];
sprintf_s(szMsg, sizeof(szMsg), "Background opacity set to %d%%", nOpacity);
DisplayUserMessage("ISFPPlugin", "Background", szMsg, 1, 0, 0, 0, 0);
return true;
}
return false;
}