Issue #17 Remove aircraft labels (not supported in xpmp2)

This commit is contained in:
Mat Sutcliffe
2020-05-27 15:31:45 +01:00
parent bfa82affb9
commit 0a6d9e6081
4 changed files with 4 additions and 58 deletions

View File

@@ -31,10 +31,6 @@ namespace XSwiftBus
{
// m_startServerMenuItem = m_menu.item("Start XSwiftBus", [this]{ startServer(CDBusConnection::SessionBus); });
m_showHideLabelsMenuItem = m_menu.item("Show/Hide Aircraft Labels", [this]
{
m_traffic->setDrawingLabels(!m_traffic->isDrawingLabels());
});
m_messageWindowSubMenu = m_menu.subMenu("Message Window");
m_toggleMessageWindowMenuItem = m_messageWindowSubMenu.item("Show/Hide", [this]
{

View File

@@ -61,9 +61,6 @@ namespace XSwiftBus
s_instance = this;
XPLMRegisterDrawCallback(drawCallback, xplm_Phase_Airplanes, 1, this);
XPLMRegisterKeySniffer(followAircraftKeySniffer, 1, this);
// init labels
this->setDrawingLabels(this->getSettings().isDrawingLabels());
}
// *INDENT-ON*
@@ -290,30 +287,6 @@ namespace XSwiftBus
XPMPSetDefaultPlaneICAO(defaultIcao.c_str());
}
void CTraffic::setDrawingLabels(bool drawing)
{
CSettings s = this->getSettings();
if (s.isDrawingLabels() != drawing)
{
s.setDrawingLabels(drawing);
this->setSettings(s);
}
if (drawing)
{
XPMPEnableAircraftLabels();
}
else
{
XPMPDisableAircraftLabels();
}
}
bool CTraffic::isDrawingLabels() const
{
return XPMPDrawingAircraftLabels();
}
void CTraffic::setMaxPlanes(int planes)
{
CSettings s = this->getSettings();
@@ -628,19 +601,13 @@ namespace XSwiftBus
else if (message.getMethodName() == "setDrawingLabels")
{
maybeSendEmptyDBusReply(wantsReply, sender, serial);
bool drawing = true;
message.beginArgumentRead();
message.getArgument(drawing);
queueDBusCall([ = ]()
{
setDrawingLabels(drawing);
});
// removed in xpmp2
}
else if (message.getMethodName() == "isDrawingLabels")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, isDrawingLabels());
sendDBusReply(sender, serial, false); // always false in xpmp2
});
}
else if (message.getMethodName() == "setMaxPlanes")
@@ -1129,17 +1096,6 @@ namespace XSwiftBus
traffic->m_countFrame++;
// slow updates by modulo
if (traffic->m_countFrame % 250 == 0)
{
// update labels
const CSettings s = traffic->getSettings();
if (traffic->isDrawingLabels() != s.isDrawingLabels())
{
traffic->setDrawingLabels(s.isDrawingLabels());
}
}
return 1;
}

View File

@@ -77,12 +77,6 @@ namespace XSwiftBus
//! Set the ICAO code to use for aircraft without a model match
void setDefaultIcao(const std::string &defaultIcao);
//! Set whether the plugin draws type and callsign labels above aircraft
void setDrawingLabels(bool drawing);
//! Get whether the plugin draws type and callsign labels above aircraft
bool isDrawingLabels() const;
//! Set the maximum number of aircraft.
void setMaxPlanes(int planes);