forked from 0ad/0ad
Remove unused GUIUtil functions, unused GUI includes and some tails in GUIUtil.
HasSetting from3dfa23cd25
is actually redundant with IGUIObject::SettingExists. GetSettingPointer from8f4f8e240f
is superseded by GetSetting reference following3dfa23cd25
and040624acff
. Deregister copying SetSetting variants for CStr and CStrW following copy removal in040624acff
. The default template <typename T=int> fromc2a71e41bf
can be removed following FallBackSprite/FallBackColor removal in9985fcf5bd
and RecurseObject unification ind4d5187c9d
. Delete all unused GUI includes, refs D1478. Remove GUIUtil friend class following something. Differential Revision: https://code.wildfiregames.com/D2225 Tested on: gcc 9.1.0, Jenkins This was SVN commit r22779.
This commit is contained in:
parent
b197df5ee6
commit
4919a6185e
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2017 Wildfire Games.
|
/* Copyright (C) 2019 Wildfire Games.
|
||||||
* This file is part of 0 A.D.
|
* This file is part of 0 A.D.
|
||||||
*
|
*
|
||||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||||
@ -24,10 +24,6 @@
|
|||||||
|
|
||||||
#include "graphics/Camera.h"
|
#include "graphics/Camera.h"
|
||||||
#include "graphics/GameView.h"
|
#include "graphics/GameView.h"
|
||||||
#include "gui/CGUI.h"
|
|
||||||
#include "gui/GUIutil.h"
|
|
||||||
#include "gui/GUIManager.h"
|
|
||||||
#include "gui/IGUIObject.h"
|
|
||||||
#include "lib/ogl.h"
|
#include "lib/ogl.h"
|
||||||
#include "maths/MathUtil.h"
|
#include "maths/MathUtil.h"
|
||||||
#include "maths/Quaternion.h"
|
#include "maths/Quaternion.h"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "graphics/ShaderManager.h"
|
#include "graphics/ShaderManager.h"
|
||||||
#include "graphics/TextureManager.h"
|
#include "graphics/TextureManager.h"
|
||||||
#include "gui/CGUIColor.h"
|
#include "gui/CGUIColor.h"
|
||||||
|
#include "gui/CGUISprite.h"
|
||||||
#include "gui/GUIutil.h"
|
#include "gui/GUIutil.h"
|
||||||
#include "gui/GUIMatrix.h"
|
#include "gui/GUIMatrix.h"
|
||||||
#include "i18n/L10n.h"
|
#include "i18n/L10n.h"
|
||||||
|
@ -30,8 +30,6 @@ TYPE(bool)
|
|||||||
TYPE(i32)
|
TYPE(i32)
|
||||||
TYPE(u32)
|
TYPE(u32)
|
||||||
TYPE(float)
|
TYPE(float)
|
||||||
TYPE(CStr)
|
|
||||||
TYPE(CStrW)
|
|
||||||
TYPE(EAlign)
|
TYPE(EAlign)
|
||||||
TYPE(EVAlign)
|
TYPE(EVAlign)
|
||||||
TYPE(CPos)
|
TYPE(CPos)
|
||||||
@ -44,4 +42,6 @@ TYPE(CGUIList)
|
|||||||
TYPE(CGUISeries)
|
TYPE(CGUISeries)
|
||||||
TYPE(CGUISpriteInstance)
|
TYPE(CGUISpriteInstance)
|
||||||
TYPE(CGUIString)
|
TYPE(CGUIString)
|
||||||
|
TYPE(CStr)
|
||||||
|
TYPE(CStrW)
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "GUIutil.h"
|
#include "GUIutil.h"
|
||||||
|
|
||||||
#include "gui/GUI.h"
|
#include "gui/GUI.h"
|
||||||
#include "gui/GUIManager.h"
|
|
||||||
#include "ps/CLogger.h"
|
#include "ps/CLogger.h"
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -81,35 +80,6 @@ void CGUISetting<T>::ToJSVal(JSContext* cx, JS::MutableHandleValue Value)
|
|||||||
ScriptInterface::ToJSVal<T>(cx, Value, m_pSetting);
|
ScriptInterface::ToJSVal<T>(cx, Value, m_pSetting);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
PSRETURN GUI<T>::GetSettingPointer(const IGUIObject* pObject, const CStr& Setting, T*& Value)
|
|
||||||
{
|
|
||||||
ENSURE(pObject != NULL);
|
|
||||||
|
|
||||||
std::map<CStr, IGUISetting*>::const_iterator it = pObject->m_Settings.find(Setting);
|
|
||||||
if (it == pObject->m_Settings.end())
|
|
||||||
{
|
|
||||||
LOGWARNING("setting %s was not found on object %s",
|
|
||||||
Setting.c_str(),
|
|
||||||
pObject->GetPresentableName().c_str());
|
|
||||||
return PSRETURN_GUI_InvalidSetting;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (it->second == nullptr)
|
|
||||||
return PSRETURN_GUI_InvalidSetting;
|
|
||||||
|
|
||||||
// Get value
|
|
||||||
Value = &(static_cast<CGUISetting<T>* >(it->second)->m_pSetting);
|
|
||||||
|
|
||||||
return PSRETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
bool GUI<T>::HasSetting(const IGUIObject* pObject, const CStr& Setting)
|
|
||||||
{
|
|
||||||
return pObject->m_Settings.count(Setting) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T& GUI<T>::GetSetting(const IGUIObject* pObject, const CStr& Setting)
|
T& GUI<T>::GetSetting(const IGUIObject* pObject, const CStr& Setting)
|
||||||
{
|
{
|
||||||
@ -173,11 +143,9 @@ PSRETURN GUI<T>::SetSettingWrap(IGUIObject* pObject, const CStr& Setting, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Instantiate templated functions:
|
// Instantiate templated functions:
|
||||||
// These functions avoid copies by working with a pointer and move semantics.
|
// These functions avoid copies by working with a reference and move semantics.
|
||||||
#define TYPE(T) \
|
#define TYPE(T) \
|
||||||
template bool GUI<T>::HasSetting(const IGUIObject* pObject, const CStr& Setting); \
|
|
||||||
template T& GUI<T>::GetSetting(const IGUIObject* pObject, const CStr& Setting); \
|
template T& GUI<T>::GetSetting(const IGUIObject* pObject, const CStr& Setting); \
|
||||||
template PSRETURN GUI<T>::GetSettingPointer(const IGUIObject* pObject, const CStr& Setting, T*& Value); \
|
|
||||||
template PSRETURN GUI<T>::SetSetting(IGUIObject* pObject, const CStr& Setting, T& Value, const bool& SkipMessage); \
|
template PSRETURN GUI<T>::SetSetting(IGUIObject* pObject, const CStr& Setting, T& Value, const bool& SkipMessage); \
|
||||||
template class CGUISetting<T>; \
|
template class CGUISetting<T>; \
|
||||||
|
|
||||||
|
@ -23,15 +23,11 @@
|
|||||||
#ifndef INCLUDED_GUIUTIL
|
#ifndef INCLUDED_GUIUTIL
|
||||||
#define INCLUDED_GUIUTIL
|
#define INCLUDED_GUIUTIL
|
||||||
|
|
||||||
#include "gui/CGUI.h"
|
|
||||||
#include "gui/CGUISprite.h"
|
|
||||||
#include "gui/GUIbase.h"
|
|
||||||
#include "gui/IGUIObject.h"
|
#include "gui/IGUIObject.h"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
class CClientArea;
|
class CGUI;
|
||||||
class CGUIString;
|
|
||||||
template<typename T> class GUI;
|
template<typename T> class GUI;
|
||||||
|
|
||||||
class IGUISetting
|
class IGUISetting
|
||||||
@ -101,42 +97,26 @@ private:
|
|||||||
T m_pSetting;
|
T m_pSetting;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SGUIMessage;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Includes static functions that needs one template
|
* Includes static functions that needs one template
|
||||||
* argument.
|
* argument.
|
||||||
*
|
|
||||||
* int is only to please functions that doesn't even use T
|
|
||||||
* and are only within this class because it's convenient
|
|
||||||
*/
|
*/
|
||||||
template <typename T=int>
|
template <typename T>
|
||||||
class GUI
|
class GUI
|
||||||
{
|
{
|
||||||
// Private functions further ahead
|
|
||||||
friend class CGUI;
|
|
||||||
friend class IGUIObject;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NONCOPYABLE(GUI);
|
NONCOPYABLE(GUI);
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines whether a setting with the given name is registered.
|
|
||||||
* This function may be used as a safeguard for GetSetting.
|
|
||||||
*/
|
|
||||||
static bool HasSetting(const IGUIObject* pObject, const CStr& Setting);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a mutable reference to the setting.
|
* Get a mutable reference to the setting.
|
||||||
* If no such setting exists, an exception of type std::out_of_range is thrown.
|
* If no such setting exists, an exception of type std::out_of_range is thrown.
|
||||||
|
* Use SettingExists if a safeguard is needed.
|
||||||
*
|
*
|
||||||
* If the value is modified, there is no GUIM_SETTINGS_UPDATED message sent.
|
* If the value is modified, there is no GUIM_SETTINGS_UPDATED message sent.
|
||||||
* SetSetting should be used to modify the value if there is a use for the message.
|
* SetSetting should be used to modify the value if there is a use for the message.
|
||||||
*/
|
*/
|
||||||
static T& GetSetting(const IGUIObject* pObject, const CStr& Setting);
|
static T& GetSetting(const IGUIObject* pObject, const CStr& Setting);
|
||||||
|
|
||||||
static PSRETURN GetSettingPointer(const IGUIObject* pObject, const CStr& Setting, T*& Value);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value by name using a real datatype as input.
|
* Sets a value by name using a real datatype as input.
|
||||||
* This variant will use the move-assignment.
|
* This variant will use the move-assignment.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2018 Wildfire Games.
|
/* Copyright (C) 2019 Wildfire Games.
|
||||||
* This file is part of 0 A.D.
|
* This file is part of 0 A.D.
|
||||||
*
|
*
|
||||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||||
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "JSInterface_Lobby.h"
|
#include "JSInterface_Lobby.h"
|
||||||
|
|
||||||
#include "gui/GUIManager.h"
|
|
||||||
#include "lib/utf8.h"
|
#include "lib/utf8.h"
|
||||||
#include "lobby/IXmppClient.h"
|
#include "lobby/IXmppClient.h"
|
||||||
#include "network/NetServer.h"
|
#include "network/NetServer.h"
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "NetClientTurnManager.h"
|
#include "NetClientTurnManager.h"
|
||||||
#include "NetClient.h"
|
#include "NetClient.h"
|
||||||
|
|
||||||
#include "gui/GUIManager.h"
|
|
||||||
#include "ps/CLogger.h"
|
#include "ps/CLogger.h"
|
||||||
#include "ps/Pyrogenesis.h"
|
#include "ps/Pyrogenesis.h"
|
||||||
#include "ps/Replay.h"
|
#include "ps/Replay.h"
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#include "graphics/TerrainTextureManager.h"
|
#include "graphics/TerrainTextureManager.h"
|
||||||
#include "gui/GUI.h"
|
#include "gui/GUI.h"
|
||||||
#include "gui/GUIManager.h"
|
#include "gui/GUIManager.h"
|
||||||
#include "gui/scripting/ScriptFunctions.h"
|
|
||||||
#include "i18n/L10n.h"
|
#include "i18n/L10n.h"
|
||||||
#include "maths/MathUtil.h"
|
#include "maths/MathUtil.h"
|
||||||
#include "network/NetServer.h"
|
#include "network/NetServer.h"
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "SavedGame.h"
|
#include "SavedGame.h"
|
||||||
|
|
||||||
#include "graphics/GameView.h"
|
#include "graphics/GameView.h"
|
||||||
#include "gui/GUIManager.h"
|
|
||||||
#include "i18n/L10n.h"
|
#include "i18n/L10n.h"
|
||||||
#include "lib/allocators/shared_ptr.h"
|
#include "lib/allocators/shared_ptr.h"
|
||||||
#include "lib/file/archive/archive_zip.h"
|
#include "lib/file/archive/archive_zip.h"
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "VisualReplay.h"
|
#include "VisualReplay.h"
|
||||||
#include "graphics/GameView.h"
|
#include "graphics/GameView.h"
|
||||||
#include "gui/GUIManager.h"
|
|
||||||
#include "lib/allocators/shared_ptr.h"
|
#include "lib/allocators/shared_ptr.h"
|
||||||
#include "lib/external_libraries/libsdl.h"
|
#include "lib/external_libraries/libsdl.h"
|
||||||
#include "lib/utf8.h"
|
#include "lib/utf8.h"
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "graphics/GameView.h"
|
#include "graphics/GameView.h"
|
||||||
#include "graphics/LightEnv.h"
|
#include "graphics/LightEnv.h"
|
||||||
#include "graphics/ShaderManager.h"
|
#include "graphics/ShaderManager.h"
|
||||||
#include "gui/GUIutil.h"
|
|
||||||
#include "lib/bits.h"
|
#include "lib/bits.h"
|
||||||
#include "lib/ogl.h"
|
#include "lib/ogl.h"
|
||||||
#include "maths/MathUtil.h"
|
#include "maths/MathUtil.h"
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "graphics/GameView.h"
|
#include "graphics/GameView.h"
|
||||||
#include "graphics/ObjectManager.h"
|
#include "graphics/ObjectManager.h"
|
||||||
#include "gui/GUIManager.h"
|
|
||||||
#include "lib/external_libraries/libsdl.h"
|
#include "lib/external_libraries/libsdl.h"
|
||||||
#include "lib/ogl.h"
|
#include "lib/ogl.h"
|
||||||
#include "maths/MathUtil.h"
|
#include "maths/MathUtil.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user