Remove WX_COMPATIBILITY flag

Some classes had been originally designed to be usable separate from wx,
but over time our uses of the classes have become entertwined with wx
features (e.g. colors), and various changes have also leaked wx into the
classes unguarded. So just remove the option to hide wx in those classes
to simplify the code.
This commit is contained in:
Ian McInerney 2023-02-22 01:23:32 +00:00
parent 301777f3c9
commit be19e967dc
6 changed files with 5 additions and 32 deletions

View File

@ -905,10 +905,6 @@ endif()
# Find wxWidgets library, required
#
# Turn on wxWidgets compatibility mode for some classes
add_compile_definitions( WX_COMPATIBILITY )
# Check if '--toolkit=xxx' option has been passed
string( REGEX MATCH "--toolkit=([a-zA-Z0-9]+)"
WXWIDGETS_REQUESTED_TOOLKIT "${wxWidgets_CONFIG_OPTIONS}" )

View File

@ -109,7 +109,6 @@ COLOR4D::COLOR4D( EDA_COLOR_T aColor )
}
#ifdef WX_COMPATIBILITY
COLOR4D::COLOR4D( const wxString& aColorStr )
{
if( !SetFromHexString( aColorStr ) )
@ -242,7 +241,7 @@ COLOR4D COLOR4D::LegacyMix( const COLOR4D& aColor ) const
return candidate;
}
#endif
namespace KIGFX {

View File

@ -30,11 +30,8 @@
#include <tool/tool_manager.h>
#include <tool/actions.h>
#ifdef WX_COMPATIBILITY
#include <wx/debug.h>
#else
#include <cassert>
#endif
struct FlagString
{
@ -75,11 +72,7 @@ void TOOL_EVENT::init()
VECTOR2D TOOL_EVENT::returnCheckedPosition( const VECTOR2D& aPos ) const
{
#ifdef WX_COMPATIBILITY
wxCHECK_MSG( HasPosition(), VECTOR2D(), "Attempted to get position from non-position event" );
#else
assert( HasPosition() );
#endif
return aPos;
}

View File

@ -28,12 +28,10 @@
#define COLOR4D_H_
#include <wx/debug.h>
#include <nlohmann/json_fwd.hpp>
#ifdef WX_COMPATIBILITY
#include <wx/colour.h>
#include <wx/string.h>
#endif
#include <nlohmann/json_fwd.hpp>
/**
* Legacy color enumeration. Also contains a flag and the alpha value in the upper bits
@ -145,8 +143,6 @@ public:
*/
COLOR4D& FromCSSRGBA( int aRed, int aGreen, int aBlue, double aAlpha = 1.0 );
#ifdef WX_COMPATIBILITY
/**
* Defines a color from a CSS or HTML-type string
* @param aColorStr input string
@ -182,8 +178,6 @@ public:
* @param aColor The color to mix with this one
*/
COLOR4D LegacyMix( const COLOR4D& aColor ) const;
#endif /* WX_COMPATIBILITY */
/**
* Converts current color (stored in RGB) to HSL format.

View File

@ -19,9 +19,7 @@
#ifndef GAL_PRINT_H
#define GAL_PRINT_H
#ifdef WX_COMPATIBILITY
class wxDC;
#endif /* WX_COMPATIBILITY */
namespace KIGFX {
class GAL;
@ -43,9 +41,8 @@ public:
class GAL_PRINT
{
public:
#ifdef WX_COMPATIBILITY
static std::unique_ptr<GAL_PRINT> Create( GAL_DISPLAY_OPTIONS& aOptions, wxDC* aDC );
#endif /* WX_COMPATIBILITY */
virtual ~GAL_PRINT() {}
virtual GAL* GetGAL() = 0;

View File

@ -29,9 +29,7 @@
#include <gal/color4d.h>
#ifdef WX_COMPATIBILITY
#include <wx/colour.h>
#endif
// All these tests are of a class in KIGFX
using namespace KIGFX;
@ -259,8 +257,6 @@ BOOST_AUTO_TEST_CASE( FromHsl )
}
#ifdef WX_COMPATIBILITY
struct WX_CONV_CASE
{
wxColour wx;
@ -309,6 +305,4 @@ BOOST_AUTO_TEST_CASE( FromWx )
}
}
#endif // WX_COMPATIBILITY
BOOST_AUTO_TEST_SUITE_END()