Skip to content

Commit

Permalink
#5231: Compilation in gcc
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed May 18, 2020
1 parent 33e3010 commit 354d8c1
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 69 deletions.
8 changes: 4 additions & 4 deletions include/ieventmanager.h
Expand Up @@ -73,8 +73,8 @@ class IEvent
virtual void connectTopLevelWindow(wxTopLevelWindow* widget) = 0;
virtual void disconnectTopLevelWindow(wxTopLevelWindow* widget) = 0;

virtual void connectToolItem(wxToolBarToolBase* item) = 0;
virtual void disconnectToolItem(wxToolBarToolBase* item) = 0;
virtual void connectToolItem(const wxToolBarToolBase* item) = 0;
virtual void disconnectToolItem(const wxToolBarToolBase* item) = 0;

virtual void connectMenuItem(wxMenuItem* item) = 0;
virtual void disconnectMenuItem(wxMenuItem* item) = 0;
Expand Down Expand Up @@ -153,8 +153,8 @@ class IEventManager :
virtual void registerMenuItem(const std::string& eventName, wxMenuItem* item) = 0;
virtual void unregisterMenuItem(const std::string& eventName, wxMenuItem* item) = 0;

virtual void registerToolItem(const std::string& eventName, wxToolBarToolBase* item) = 0;
virtual void unregisterToolItem(const std::string& eventName, wxToolBarToolBase* item) = 0;
virtual void registerToolItem(const std::string& eventName, const wxToolBarToolBase* item) = 0;
virtual void unregisterToolItem(const std::string& eventName, const wxToolBarToolBase* item) = 0;

// Loads the shortcut->command associations from the XMLRegistry
virtual void loadAccelerators() = 0;
Expand Down
9 changes: 0 additions & 9 deletions radiant/Makefile.am
Expand Up @@ -146,15 +146,6 @@ darkradiant_SOURCES = main.cpp \
particles/ParticleDef.cpp \
render/OpenGLModule.cpp \
render/View.cpp \
#shaders/CameraCubeMapDecl.cpp \
#shaders/textures/TextureManipulator.cpp \
#$(SHADERS_SOURCES) \
#shaders/ShaderTemplate.cpp \
#shaders/MapExpression.cpp \
#shaders/CShader.cpp \
#shaders/Doom3ShaderSystem.cpp \
#shaders/ShaderLibrary.cpp \
#shaders/ShaderExpression.cpp \
ui/UserInterfaceModule.cpp \
ui/Documentation.cpp \
ui/entitychooser/EntityClassChooser.cpp \
Expand Down
24 changes: 12 additions & 12 deletions radiant/camera/Camera.cpp
Expand Up @@ -353,9 +353,9 @@ void Camera::rotateRightDiscrete() {
setAngles(angles);
}

void Camera::onForwardKey(ui::KeyEventType eventType)
void Camera::onForwardKey(KeyEventType eventType)
{
if (eventType == ui::KeyEventType::KeyPressed)
if (eventType == KeyEventType::KeyPressed)
{
if (freeMoveEnabled)
{
Expand All @@ -372,9 +372,9 @@ void Camera::onForwardKey(ui::KeyEventType eventType)
}
}

void Camera::onBackwardKey(ui::KeyEventType eventType)
void Camera::onBackwardKey(KeyEventType eventType)
{
if (eventType == ui::KeyEventType::KeyPressed)
if (eventType == KeyEventType::KeyPressed)
{
if (freeMoveEnabled)
{
Expand All @@ -391,9 +391,9 @@ void Camera::onBackwardKey(ui::KeyEventType eventType)
}
}

void Camera::onLeftKey(ui::KeyEventType eventType)
void Camera::onLeftKey(KeyEventType eventType)
{
if (eventType == ui::KeyEventType::KeyPressed)
if (eventType == KeyEventType::KeyPressed)
{
if (freeMoveEnabled)
{
Expand All @@ -410,9 +410,9 @@ void Camera::onLeftKey(ui::KeyEventType eventType)
}
}

void Camera::onRightKey(ui::KeyEventType eventType)
void Camera::onRightKey(KeyEventType eventType)
{
if (eventType == ui::KeyEventType::KeyPressed)
if (eventType == KeyEventType::KeyPressed)
{
if (freeMoveEnabled)
{
Expand All @@ -429,9 +429,9 @@ void Camera::onRightKey(ui::KeyEventType eventType)
}
}

void Camera::onUpKey(ui::KeyEventType eventType)
void Camera::onUpKey(KeyEventType eventType)
{
if (eventType == ui::KeyEventType::KeyPressed)
if (eventType == KeyEventType::KeyPressed)
{
if (freeMoveEnabled)
{
Expand All @@ -448,9 +448,9 @@ void Camera::onUpKey(ui::KeyEventType eventType)
}
}

void Camera::onDownKey(ui::KeyEventType eventType)
void Camera::onDownKey(KeyEventType eventType)
{
if (eventType == ui::KeyEventType::KeyPressed)
if (eventType == KeyEventType::KeyPressed)
{
if (freeMoveEnabled)
{
Expand Down
13 changes: 7 additions & 6 deletions radiant/camera/Camera.h
@@ -1,5 +1,6 @@
#pragma once

#include "ieventmanager.h"
#include "math/Vector3.h"
#include "math/Matrix4.h"
#include "wxutil/DeferredMotionDelta.h"
Expand Down Expand Up @@ -112,12 +113,12 @@ class Camera :
void moveBackDiscrete(double units);
void moveForwardDiscrete(double units);

void onForwardKey(ui::KeyEventType eventType);
void onBackwardKey(ui::KeyEventType eventType);
void onLeftKey(ui::KeyEventType eventType);
void onRightKey(ui::KeyEventType eventType);
void onUpKey(ui::KeyEventType eventType);
void onDownKey(ui::KeyEventType eventType);
void onForwardKey(KeyEventType eventType);
void onBackwardKey(KeyEventType eventType);
void onLeftKey(KeyEventType eventType);
void onRightKey(KeyEventType eventType);
void onUpKey(KeyEventType eventType);
void onDownKey(KeyEventType eventType);

}; // class Camera

Expand Down
21 changes: 13 additions & 8 deletions radiant/eventmanager/Event.h
Expand Up @@ -63,8 +63,8 @@ class Event :
virtual void connectMenuItem(wxMenuItem* item) {}
virtual void disconnectMenuItem(wxMenuItem* item) {}

virtual void connectToolItem(wxToolBarToolBase* item) {}
virtual void disconnectToolItem(wxToolBarToolBase* item) {}
virtual void connectToolItem(const wxToolBarToolBase* item) {}
virtual void disconnectToolItem(const wxToolBarToolBase* item) {}

virtual void connectToggleButton(wxToggleButton* button) {}
virtual void disconnectToggleButton(wxToggleButton* button) {}
Expand All @@ -91,24 +91,29 @@ class Event :
item->SetItemLabel(item->GetItemLabel().BeforeFirst('\t'));
}

static void setToolItemAccelerator(wxToolBarToolBase* tool, Accelerator& accel)
static void setToolItemAccelerator(const wxToolBarToolBase* tool, Accelerator& accel)
{
setToolItemAccelerator(tool, accel.getString(true));
}

static void setToolItemAccelerator(wxToolBarToolBase* tool, const std::string& accelText)
static void setToolItemAccelerator(const wxToolBarToolBase* tool, const std::string& accelText)
{
tool->SetShortHelp(getCleanToolItemHelpText(tool) +
if (tool->GetToolBar() == nullptr)
{
return;
}

tool->GetToolBar()->SetToolShortHelp(tool->GetId(), getCleanToolItemHelpText(tool) +
(!accelText.empty() ? " (" + string::replace_all_copy(accelText, "~", "-") + ")" : ""));
}

static void clearToolItemAccelerator(wxToolBarToolBase* tool)
static void clearToolItemAccelerator(const wxToolBarToolBase* tool)
{
// Remove the accelerator from this tool
tool->SetShortHelp(getCleanToolItemHelpText(tool));
tool->GetToolBar()->SetToolShortHelp(tool->GetId(), getCleanToolItemHelpText(tool));
}

static std::string getCleanToolItemHelpText(wxToolBarToolBase* tool)
static std::string getCleanToolItemHelpText(const wxToolBarToolBase* tool)
{
std::string prevHelp = tool->GetShortHelp().ToStdString();

Expand Down
9 changes: 5 additions & 4 deletions radiant/eventmanager/EventManager.cpp
Expand Up @@ -8,6 +8,7 @@

#include <wx/wxprec.h>
#include <wx/toolbar.h>
#include <wx/menu.h>

#include "registry/registry.h"
#include "xmlutil/Node.h"
Expand Down Expand Up @@ -258,7 +259,7 @@ void EventManager::setToggled(const std::string& name, const bool toggled)

void EventManager::registerMenuItem(const std::string& eventName, wxMenuItem* item)
{
auto result = _menuItems.emplace(eventName, item);
_menuItems.emplace(eventName, item);

// Set the accelerator of this menu item
auto& accelerator = findAccelerator(eventName);
Expand Down Expand Up @@ -302,9 +303,9 @@ void EventManager::unregisterMenuItem(const std::string& eventName, wxMenuItem*
}
}

void EventManager::registerToolItem(const std::string& eventName, wxToolBarToolBase* item)
void EventManager::registerToolItem(const std::string& eventName, const wxToolBarToolBase* item)
{
auto result = _toolItems.emplace(eventName, item);
_toolItems.emplace(eventName, item);

// Set the accelerator of this menu item
auto& accelerator = findAccelerator(eventName);
Expand All @@ -326,7 +327,7 @@ void EventManager::registerToolItem(const std::string& eventName, wxToolBarToolB
}
}

void EventManager::unregisterToolItem(const std::string& eventName, wxToolBarToolBase* item)
void EventManager::unregisterToolItem(const std::string& eventName, const wxToolBarToolBase* item)
{
for (auto it = _toolItems.begin(); it != _toolItems.end(); ++it)
{
Expand Down
6 changes: 3 additions & 3 deletions radiant/eventmanager/EventManager.h
Expand Up @@ -24,7 +24,7 @@ class EventManager :
typedef std::map<const std::string, IEventPtr> EventMap;

std::multimap<std::string, wxMenuItem*> _menuItems;
std::multimap<std::string, wxToolBarToolBase*> _toolItems;
std::multimap<std::string, const wxToolBarToolBase*> _toolItems;

// The command-to-accelerator map containing all registered shortcuts
typedef std::map<std::string, Accelerator::Ptr> AcceleratorMap;
Expand Down Expand Up @@ -71,8 +71,8 @@ class EventManager :
void registerMenuItem(const std::string& eventName, wxMenuItem* item) override;
void unregisterMenuItem(const std::string& eventName, wxMenuItem* item) override;

void registerToolItem(const std::string& eventName, wxToolBarToolBase* item) override;
void unregisterToolItem(const std::string& eventName, wxToolBarToolBase* item) override;
void registerToolItem(const std::string& eventName, const wxToolBarToolBase* item) override;
void unregisterToolItem(const std::string& eventName, const wxToolBarToolBase* item) override;

// Connects the given accelerator to the given command (identified by the string)
void connectAccelerator(wxKeyEvent& keyEvent, const std::string& command) override;
Expand Down
4 changes: 2 additions & 2 deletions radiant/eventmanager/Statement.cpp
Expand Up @@ -99,7 +99,7 @@ void Statement::onMenuItemClicked(wxCommandEvent& ev)
ev.Skip();
}

void Statement::connectToolItem(wxToolBarToolBase* item)
void Statement::connectToolItem(const wxToolBarToolBase* item)
{
if (_toolItems.find(item) != _toolItems.end())
{
Expand All @@ -113,7 +113,7 @@ void Statement::connectToolItem(wxToolBarToolBase* item)
item->GetToolBar()->Bind(wxEVT_TOOL, &Statement::onToolItemClicked, this, item->GetId());
}

void Statement::disconnectToolItem(wxToolBarToolBase* item)
void Statement::disconnectToolItem(const wxToolBarToolBase* item)
{
if (_toolItems.find(item) == _toolItems.end())
{
Expand Down
6 changes: 3 additions & 3 deletions radiant/eventmanager/Statement.h
Expand Up @@ -29,7 +29,7 @@ class Statement :
typedef std::set<wxMenuItem*> MenuItems;
MenuItems _menuItems;

typedef std::set<wxToolBarToolBase*> ToolItems;
typedef std::set<const wxToolBarToolBase*> ToolItems;
ToolItems _toolItems;

public:
Expand All @@ -48,8 +48,8 @@ class Statement :
virtual void connectMenuItem(wxMenuItem* item);
virtual void disconnectMenuItem(wxMenuItem* item);

virtual void connectToolItem(wxToolBarToolBase* item);
virtual void disconnectToolItem(wxToolBarToolBase* item);
virtual void connectToolItem(const wxToolBarToolBase* item);
virtual void disconnectToolItem(const wxToolBarToolBase* item);

virtual bool empty() const;

Expand Down
4 changes: 2 additions & 2 deletions radiant/eventmanager/Toggle.cpp
Expand Up @@ -134,7 +134,7 @@ void Toggle::onMenuItemClicked(wxCommandEvent& ev)
ev.Skip();
}

void Toggle::connectToolItem(wxToolBarToolBase* item)
void Toggle::connectToolItem(const wxToolBarToolBase* item)
{
if (_toolItems.find(item) != _toolItems.end())
{
Expand All @@ -151,7 +151,7 @@ void Toggle::connectToolItem(wxToolBarToolBase* item)
item->GetToolBar()->Bind(wxEVT_TOOL, &Toggle::onToolItemClicked, this, item->GetId());
}

void Toggle::disconnectToolItem(wxToolBarToolBase* item)
void Toggle::disconnectToolItem(const wxToolBarToolBase* item)
{
if (_toolItems.find(item) == _toolItems.end())
{
Expand Down
6 changes: 3 additions & 3 deletions radiant/eventmanager/Toggle.h
Expand Up @@ -35,7 +35,7 @@ class Toggle :
typedef std::set<wxMenuItem*> MenuItems;
MenuItems _menuItems;

typedef std::set<wxToolBarToolBase*> ToolItems;
typedef std::set<const wxToolBarToolBase*> ToolItems;
ToolItems _toolItems;

typedef std::set<wxToggleButton*> Buttons;
Expand Down Expand Up @@ -73,8 +73,8 @@ class Toggle :
virtual void connectMenuItem(wxMenuItem* item);
virtual void disconnectMenuItem(wxMenuItem* item);

virtual void connectToolItem(wxToolBarToolBase* item);
virtual void disconnectToolItem(wxToolBarToolBase* item);
virtual void connectToolItem(const wxToolBarToolBase* item);
virtual void disconnectToolItem(const wxToolBarToolBase* item);

virtual void connectToggleButton(wxToggleButton* button);
virtual void disconnectToggleButton(wxToggleButton* button);
Expand Down
1 change: 1 addition & 0 deletions radiant/ui/LongRunningOperationHandler.h
@@ -1,6 +1,7 @@
#pragma once

#include <functional>
#include "i18n.h"
#include "iradiant.h"
#include "imainframe.h"
#include "messages/LongRunningOperationMessage.h"
Expand Down
1 change: 1 addition & 0 deletions radiant/ui/filters/FilterUserInterface.h
Expand Up @@ -3,6 +3,7 @@
#include <map>
#include <sigc++/connection.h>
#include "imodule.h"
#include "ieventmanager.h"

namespace ui
{
Expand Down
3 changes: 3 additions & 0 deletions radiant/ui/grid/GridUserInterface.cpp
@@ -1,6 +1,9 @@
#include "GridUserInterface.h"

#include <functional>
#include <fmt/format.h>

#include "i18n.h"
#include "iuimanager.h"
#include "imainframe.h"

Expand Down
2 changes: 1 addition & 1 deletion radiant/uimanager/ToolbarManager.cpp
Expand Up @@ -166,7 +166,7 @@ void ToolbarManager::onToolbarDestroy(wxWindowDestroyEvent& ev)
GlobalEventManager().unregisterToolItem(cmdData->GetString().ToStdString(), toolItem);

// free the client data, the toolbar item doesn't delete it
toolItem->SetClientData(nullptr);
toolbar->SetToolClientData(toolItem->GetId(), nullptr);
delete cmdData;
}
}
Expand Down
24 changes: 12 additions & 12 deletions radiantcore/Makefile.am
Expand Up @@ -90,18 +90,18 @@ libradiantcore_la_SOURCES = Radiant.cpp \
map/namespace/NamespaceFactory.cpp \
modulesystem/ModuleLoader.cpp \
modulesystem/ModuleRegistry.cpp \
render/backend/glprogram/ARBBumpProgram.cpp \
render/backend/glprogram/ARBDepthFillProgram.cpp \
render/backend/glprogram/GenericVFPProgram.cpp \
render/backend/glprogram/GLSLBumpProgram.cpp \
render/backend/glprogram/GLSLDepthFillProgram.cpp \
render/backend/OpenGLShader.cpp \
render/backend/GLProgramFactory.cpp \
render/backend/OpenGLShaderPass.cpp \
render/LinearLightList.cpp \
render/OpenGLRenderSystem.cpp \
render/RenderSystemFactory.cpp \
render/debug/SpacePartitionRenderer.cpp \
rendersystem/backend/glprogram/ARBBumpProgram.cpp \
rendersystem/backend/glprogram/ARBDepthFillProgram.cpp \
rendersystem/backend/glprogram/GenericVFPProgram.cpp \
rendersystem/backend/glprogram/GLSLBumpProgram.cpp \
rendersystem/backend/glprogram/GLSLDepthFillProgram.cpp \
rendersystem/backend/OpenGLShader.cpp \
rendersystem/backend/GLProgramFactory.cpp \
rendersystem/backend/OpenGLShaderPass.cpp \
rendersystem/LinearLightList.cpp \
rendersystem/OpenGLRenderSystem.cpp \
rendersystem/RenderSystemFactory.cpp \
rendersystem/debug/SpacePartitionRenderer.cpp \
scenegraph/SceneGraph.cpp \
scenegraph/Octree.cpp \
scenegraph/SceneGraphFactory.cpp \
Expand Down
1 change: 1 addition & 0 deletions radiantcore/entity/EntitySettings.h
@@ -1,5 +1,6 @@
#pragma once

#include "ientity.h"
#include "iregistry.h"
#include <sigc++/connection.h>
#include <sigc++/signal.h>
Expand Down

0 comments on commit 354d8c1

Please sign in to comment.