Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SortIncludes:
Enabled: true
IgnoreCase: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
Expand Down
1 change: 1 addition & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
resource/resource.h
4 changes: 4 additions & 0 deletions resource/UKControllerPlugin.rc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,25,118,10
CONTROL "Notify Departure Release Activity In Chat Area",IDC_RELEASE_CHAT_MESSAGE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,34,152,10
COMBOBOX IDC_COLOUR_PALETTE,178,16,48,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Colour Palette",IDC_STATIC,230,18,43,8
END

IDD_TIMER_CONFIGURATION DIALOGEX 0, 0, 179, 158
Expand Down Expand Up @@ -391,6 +393,8 @@ BEGIN
RIGHTMARGIN, 302
TOPMARGIN, 7
BOTTOMMARGIN, 169
HORZGUIDE, 16
HORZGUIDE, 22
END

IDD_TIMER_CONFIGURATION, DIALOG
Expand Down
3 changes: 2 additions & 1 deletion resource/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#define IDC_TRAIL_TYPE 1004
#define IDC_TRAIL_LENGTH 1005
#define IDC_TRAIL_COLOUR 1009
#define IDC_COLOUR_PALETTE 1146

Check failure on line 40 in resource/resource.h

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this macro by "const", "constexpr" or an "enum".

See more on https://sonarcloud.io/project/issues?id=VATSIM-UK_uk-controller-plugin&issues=AZ5utrYtTGa7whDjHreA&open=AZ5utrYtTGa7whDjHreA&pullRequest=621
#define IDC_SPIN_LENGTH 1010
#define IDC_DOT_SIZE 1012
#define GS_DIALOG_PRENOTE_TITLE 1012
Expand Down Expand Up @@ -214,7 +215,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 147
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1146
#define _APS_NEXT_CONTROL_VALUE 1147

Check failure on line 218 in resource/resource.h

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this macro by "const", "constexpr" or an "enum".

See more on https://sonarcloud.io/project/issues?id=VATSIM-UK_uk-controller-plugin&issues=AZ5utrYtTGa7whDjHreB&open=AZ5utrYtTGa7whDjHreB&pullRequest=621
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
3 changes: 3 additions & 0 deletions src/plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ set(src__graphics
"graphics/GdiGraphicsWrapper.cpp"
"graphics/GdiGraphicsWrapper.h"
"graphics/GdiplusBrushes.h"
"graphics/GdiplusBrushes.cpp"
"graphics/Theme.h"
"graphics/Theme.cpp"
graphics/FontManager.cpp graphics/FontManager.h graphics/StringFormatManager.cpp graphics/StringFormatManager.h)
source_group("src\\graphics" FILES ${src__graphics})

Expand Down
25 changes: 15 additions & 10 deletions src/plugin/approach/ApproachBootstrapProvider.cpp
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
#include "ApproachBootstrapProvider.h"
#include "aircraft/CallsignSelectionListFactory.h"
#include "AircraftSelectionProvider.h"
#include "AirfieldMinimumSeparationSelectorList.h"
#include "AirfieldTargetSelectorList.h"
#include "ApproachBootstrapProvider.h"
#include "ApproachFlightplanEventHandler.h"
#include "ApproachModuleFactory.h"
#include "ApproachSequencerDisplay.h"
#include "ApproachSequencerDisplayAsrLoader.h"
#include "ApproachSequencerDisplayOptions.h"
#include "ApproachSequencerOptionsLoader.h"
#include "ApproachSpacingRingRenderer.h"
#include "GlideslopeDeviationEstimator.h"
#include "GlideslopeDeviationTagItem.h"
#include "RemoveLandedAircraft.h"
#include "SequencerAirfieldSelector.h"
#include "TargetSelectorList.h"
#include "ToggleApproachSequencerDisplay.h"
#include "aircraft/CallsignSelectionListFactory.h"
#include "bootstrap/ModuleFactories.h"
#include "bootstrap/PersistenceContainer.h"
#include "euroscope/AsrEventHandlerCollection.h"
#include "euroscope/PluginSettingsProviderCollection.h"
#include "flightplan/FlightPlanEventHandlerCollection.h"
#include "GlideslopeDeviationEstimator.h"
#include "GlideslopeDeviationTagItem.h"
#include "graphics/GdiplusBrushes.h"
#include "list/PopupListFactory.h"
#include "radarscreen/MenuToggleableDisplayFactory.h"
#include "radarscreen/RadarRenderableCollection.h"
#include "RemoveLandedAircraft.h"
#include "SequencerAirfieldSelector.h"
#include "tag/TagItemCollection.h"
#include "TargetSelectorList.h"
#include "timedevent/TimedEventCollection.h"
#include "ToggleApproachSequencerDisplay.h"

using UKControllerPlugin::Windows::GdiplusBrushes;

namespace UKControllerPlugin::Approach {

void ApproachBootstrapProvider::BootstrapPlugin(Bootstrap::PersistenceContainer& container)
{
container.pluginSettingsProviders->AddProvider(std::make_shared<ApproachSequencerOptionsLoader>(
container.moduleFactories->Approach().SequencerOptions(), *container.airfields));
container.pluginSettingsProviders->AddProvider(
std::make_shared<ApproachSequencerOptionsLoader>(
container.moduleFactories->Approach().SequencerOptions(), *container.airfields));

container.timedHandler->RegisterEvent(
std::make_shared<RemoveLandedAircraft>(
Expand Down Expand Up @@ -92,6 +96,7 @@ namespace UKControllerPlugin::Approach {
container.moduleFactories->Approach().SequencerOptions(), displayOptions),
"Toggle sequencer airfield separation selector"),
*container.plugin,
*container.brushes,
sequencerScreenObjectId),
RadarScreen::RadarRenderableCollection::beforeTags);

Expand Down
4 changes: 4 additions & 0 deletions src/plugin/approach/ApproachBootstrapProvider.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#pragma once
#include "bootstrap/BootstrapProviderInterface.h"

namespace UKControllerPlugin::Windows {
struct GdiplusBrushes;
} // namespace UKControllerPlugin::Windows

namespace UKControllerPlugin::Approach {
class ApproachBootstrapProvider : public Bootstrap::BootstrapProviderInterface
{
Expand Down
96 changes: 52 additions & 44 deletions src/plugin/approach/ApproachSequencerDisplay.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "ApproachSequencerDisplay.h"
#include "AirfieldApproachOptions.h"
#include "ApproachSequence.h"
#include "ApproachSequencedAircraft.h"
#include "ApproachSequencer.h"
#include "ApproachSequencerDisplay.h"
#include "ApproachSequencerDisplayOptions.h"
#include "ApproachSequencerOptions.h"
#include "ApproachSpacingCalculator.h"
Expand All @@ -13,6 +13,7 @@
#include "euroscope/EuroscopePluginLoopbackInterface.h"
#include "graphics/FontManager.h"
#include "graphics/GdiGraphicsInterface.h"
#include "graphics/GdiplusBrushes.h"
#include "graphics/StringFormatManager.h"
#include "helper/HelperFunctions.h"
#include "list/PopupListInterface.h"
Expand All @@ -21,6 +22,7 @@
using UKControllerPlugin::Components::CollapsibleWindowTitleBar;
using UKControllerPlugin::Number::To1Dp;
using UKControllerPlugin::Number::To1DpWide;
using UKControllerPlugin::Windows::GdiplusBrushes;

namespace UKControllerPlugin::Approach {

Expand All @@ -35,28 +37,31 @@ namespace UKControllerPlugin::Approach {
std::shared_ptr<List::PopupListInterface> airfieldTargetSelector,
std::shared_ptr<List::PopupListInterface> airfieldSeparationSelector,
Euroscope::EuroscopePluginLoopbackInterface& plugin,
const GdiplusBrushes& brushes,
int screenObjectId)
: sequencer(sequencer), spacingCalculator(spacingCalculator), options(options),
displayOptions(std::move(displayOptions)), airfieldSelector(std::move(airfieldSelector)),
callsignSelector(std::move(callsignSelector)), targetSelector(std::move(targetSelector)),
airfieldTargetSelector(std::move(airfieldTargetSelector)),
airfieldSeparationSelector(std::move(airfieldSeparationSelector)), plugin(plugin),
screenObjectId(screenObjectId), titleBar(CollapsibleWindowTitleBar::Create(
L"Approach Sequencer",
titleBarArea,
[this]() -> bool { return this->displayOptions->ContentCollapsed(); },
screenObjectId)),
airfieldClickspot(Components::ClickableArea::Create(
this->airfieldTextArea, screenObjectId, AIRFIELD_SELECTOR_CLICKSPOT, false)),
airfieldSeparationSelector(std::move(airfieldSeparationSelector)), plugin(plugin), brushes(brushes),
screenObjectId(screenObjectId), titleBar(
CollapsibleWindowTitleBar::Create(
L"Approach Sequencer",
titleBarArea,
[this]() -> bool { return this->displayOptions->ContentCollapsed(); },
screenObjectId,
brushes)),
airfieldClickspot(
Components::ClickableArea::Create(
this->airfieldTextArea, screenObjectId, AIRFIELD_SELECTOR_CLICKSPOT, false)),
addClickspot(
Components::ClickableArea::Create(this->addButton, screenObjectId, ADD_AIRCRAFT_CLICKSPOT, false)),
airfieldTargetClickspot(Components::ClickableArea::Create(
this->airfieldTargetTextArea, screenObjectId, AIRFIELD_TARGET_CLICKSPOT, false)),
airfieldSeparationClickspot(Components::ClickableArea::Create(
this->airfieldSeparationTextArea, screenObjectId, AIRFIELD_SEPARATION_CLICKSPOT, false)),
backgroundBrush(std::make_shared<Gdiplus::SolidBrush>(BACKGROUND_COLOUR)),
textBrush(std::make_shared<Gdiplus::SolidBrush>(TEXT_COLOUR)),
dividingPen(std::make_shared<Gdiplus::Pen>(TEXT_COLOUR))
airfieldTargetClickspot(
Components::ClickableArea::Create(
this->airfieldTargetTextArea, screenObjectId, AIRFIELD_TARGET_CLICKSPOT, false)),
airfieldSeparationClickspot(
Components::ClickableArea::Create(
this->airfieldSeparationTextArea, screenObjectId, AIRFIELD_SEPARATION_CLICKSPOT, false))
{
}

Expand All @@ -76,12 +81,12 @@ namespace UKControllerPlugin::Approach {
graphics.Translated(
displayOptions->Position().x, displayOptions->Position().y, [this, &graphics, &radarScreen]() {
if (this->displayOptions->ContentCollapsed()) {
this->titleBar->Draw(graphics, radarScreen);
this->titleBar->DrawTheme(graphics, radarScreen, brushes);
return;
}

this->RenderBackground(graphics);
this->titleBar->Draw(graphics, radarScreen);
this->titleBar->DrawTheme(graphics, radarScreen, brushes);
this->RenderAirfield(graphics, radarScreen);
this->RenderAddButton(graphics, radarScreen);
this->RenderAirfieldTarget(graphics, radarScreen);
Expand Down Expand Up @@ -173,39 +178,39 @@ namespace UKControllerPlugin::Approach {
graphics.DrawString(
L"Airfield:",
airfieldStaticArea,
*textBrush,
*this->brushes.textBrush,
Graphics::StringFormatManager::Instance().GetLeftAlign(),
Graphics::FontManager::Instance().GetDefault());

graphics.DrawString(
HelperFunctions::ConvertToWideString(
displayOptions->Airfield().empty() ? "--" : displayOptions->Airfield()),
airfieldTextArea,
*textBrush,
*this->brushes.textBrush,
Graphics::StringFormatManager::Instance().GetLeftAlign(),
Graphics::FontManager::Instance().GetDefault());
this->airfieldClickspot->Apply(graphics, radarScreen);
}

void ApproachSequencerDisplay::RenderDivider(Windows::GdiGraphicsInterface& graphics)
{
graphics.DrawLine(*dividingPen, dividerLeft, dividerRight);
graphics.DrawLine(*this->brushes.textPen, dividerLeft, dividerRight);
}

void ApproachSequencerDisplay::RenderHeaders(Windows::GdiGraphicsInterface& graphics)
{
graphics.DrawString(L"#", numberHeader, *textBrush);
graphics.DrawString(L"Callsign", callsignHeader, *textBrush);
graphics.DrawString(L"Target", targetHeader, *textBrush);
graphics.DrawString(L"Actual", actualHeader, *textBrush);
graphics.DrawString(L"Actions", actionsHeader, *textBrush);
graphics.DrawString(L"#", numberHeader, *this->brushes.textBrush);
graphics.DrawString(L"Callsign", callsignHeader, *this->brushes.textBrush);
graphics.DrawString(L"Target", targetHeader, *this->brushes.textBrush);
graphics.DrawString(L"Actual", actualHeader, *this->brushes.textBrush);
graphics.DrawString(L"Actions", actionsHeader, *this->brushes.textBrush);
}

void ApproachSequencerDisplay::RenderAddButton(
Windows::GdiGraphicsInterface& graphics, Euroscope::EuroscopeRadarLoopbackInterface& radarScreen)
{
graphics.DrawRect(addButton, *dividingPen);
graphics.DrawString(L"Add Aircraft", addButton, *textBrush);
graphics.DrawRect(addButton, *this->brushes.textPen);
graphics.DrawString(L"Add Aircraft", addButton, *this->brushes.textBrush);
addClickspot->Apply(graphics, radarScreen);
}

Expand Down Expand Up @@ -248,46 +253,49 @@ namespace UKControllerPlugin::Approach {
int sequenceNumber = 1;

while (aircraftToProcess != nullptr) {
graphics.DrawString(std::to_wstring(sequenceNumber), numberRect, *textBrush);
graphics.DrawString(std::to_wstring(sequenceNumber), numberRect, *this->brushes.textBrush);
graphics.DrawString(
HelperFunctions::ConvertToWideString(aircraftToProcess->Callsign()), callsignRect, *textBrush);
HelperFunctions::ConvertToWideString(aircraftToProcess->Callsign()),
callsignRect,
*this->brushes.textBrush);

// The target distance / wake
if (aircraftToProcess->Mode() == ApproachSequencingMode::WakeTurbulence) {
graphics.DrawString(L"Wake", targetRect, *textBrush);
graphics.DrawString(L"Wake", targetRect, *this->brushes.textBrush);
} else {
graphics.DrawString(To1DpWide(aircraftToProcess->ExpectedDistance()), targetRect, *textBrush);
graphics.DrawString(
To1DpWide(aircraftToProcess->ExpectedDistance()), targetRect, *this->brushes.textBrush);
}
Components::ClickableArea::Create(
targetRect, screenObjectId, "approachTarget" + aircraftToProcess->Callsign(), false)
->Apply(graphics, radarScreen);

double requiredSpacing = spacingCalculator.Calculate(displayOptions->Airfield(), *aircraftToProcess);
if (requiredSpacing == spacingCalculator.NoSpacing()) {
graphics.DrawString(L"--", actualRect, *textBrush);
graphics.DrawString(L"--", actualRect, *this->brushes.textBrush);
} else {
graphics.DrawString(To1DpWide(requiredSpacing), actualRect, *textBrush);
graphics.DrawString(To1DpWide(requiredSpacing), actualRect, *this->brushes.textBrush);
}

auto upButton = Components::Button::Create(
upButtonRect,
screenObjectId,
"moveUp" + aircraftToProcess->Callsign(),
Components::UpArrow(TEXT_COLOUR));
Components::UpArrow(this->brushes.text));
upButton->Draw(graphics, radarScreen);

auto downButton = Components::Button::Create(
downButtonRect,
screenObjectId,
"moveDown" + aircraftToProcess->Callsign(),
Components::DownArrow(TEXT_COLOUR));
Components::DownArrow(this->brushes.text));
downButton->Draw(graphics, radarScreen);

auto deleteButton = Components::Button::Create(
deleteButtonRect,
screenObjectId,
"deleteButton" + aircraftToProcess->Callsign(),
Components::DeleteButton(TEXT_COLOUR));
Components::DeleteButton(this->brushes.text));
deleteButton->Draw(graphics, radarScreen);

auto toggleButton = Components::Button::Create(
Expand All @@ -297,13 +305,13 @@ namespace UKControllerPlugin::Approach {
[&aircraftToProcess, &radarScreen, this](
Windows::GdiGraphicsInterface& graphics, const Gdiplus::Rect& area) {
Gdiplus::Rect drawArea = {0, 0, area.Width, area.Height};
graphics.FillCircle(drawArea, *textBrush);
graphics.FillCircle(drawArea, *this->brushes.textBrush);
if (!aircraftToProcess->ShouldDraw()) {
Components::Button::Create(
drawArea,
screenObjectId,
"toggleDraw" + aircraftToProcess->Callsign(),
Components::DeleteButton(BACKGROUND_COLOUR))
Components::DeleteButton(this->brushes.background))
->Draw(graphics, radarScreen);
}
});
Expand Down Expand Up @@ -332,7 +340,7 @@ namespace UKControllerPlugin::Approach {
TITLE_BAR_HEIGHT,
WINDOW_WIDTH,
static_cast<INT>(callsignHeader.GetBottom() + INSETS + (numberOfCallsigns * callsignHeader.Height))};
graphics.FillRect(contentArea, *backgroundBrush);
graphics.FillRect(contentArea, *this->brushes.backgroundBrush);
}

void ApproachSequencerDisplay::RenderAirfieldTarget(
Expand All @@ -341,7 +349,7 @@ namespace UKControllerPlugin::Approach {
graphics.DrawString(
L"Target:",
airfieldTargetStatic,
*textBrush,
*this->brushes.textBrush,
Graphics::StringFormatManager::Instance().GetLeftAlign(),
Graphics::FontManager::Instance().GetDefault());

Expand All @@ -356,7 +364,7 @@ namespace UKControllerPlugin::Approach {
graphics.DrawString(
targetString,
airfieldTargetTextArea,
*textBrush,
*this->brushes.textBrush,
Graphics::StringFormatManager::Instance().GetLeftAlign(),
Graphics::FontManager::Instance().GetDefault());
this->airfieldTargetClickspot->Apply(graphics, radarScreen);
Expand All @@ -368,7 +376,7 @@ namespace UKControllerPlugin::Approach {
graphics.DrawString(
L"Separation:",
airfieldSeparationStatic,
*textBrush,
*this->brushes.textBrush,
Graphics::StringFormatManager::Instance().GetLeftAlign(),
Graphics::FontManager::Instance().GetDefault());

Expand All @@ -377,7 +385,7 @@ namespace UKControllerPlugin::Approach {
? L"--"
: To1DpWide(options.Get(displayOptions->Airfield()).minimumSeparationRequirement),
airfieldSeparationTextArea,
*textBrush,
*this->brushes.textBrush,
Graphics::StringFormatManager::Instance().GetLeftAlign(),
Graphics::FontManager::Instance().GetDefault());
this->airfieldSeparationClickspot->Apply(graphics, radarScreen);
Expand Down
Loading
Loading