Require wxWidgets 3.2

Removes old defines and work arounds for earlier wx versions and adds a
CMake requirement to use at least 3.2 (or the minimum matching wxPython
version)
This commit is contained in:
Seth Hillbrand 2023-08-22 11:32:25 -07:00
parent f4f1ca352a
commit db8e15ce88
50 changed files with 11 additions and 707 deletions

View File

@ -71,10 +71,7 @@ BEGIN_EVENT_TABLE( EDA_3D_CANVAS, HIDPI_GL_3D_CANVAS )
EVT_MIDDLE_DOWN( EDA_3D_CANVAS::OnMiddleDown)
EVT_MOUSEWHEEL( EDA_3D_CANVAS::OnMouseWheel )
EVT_MOTION( EDA_3D_CANVAS::OnMouseMove )
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
EVT_MAGNIFY( EDA_3D_CANVAS::OnMagnify )
#endif
// other events
EVT_ERASE_BACKGROUND( EDA_3D_CANVAS::OnEraseBackground )
@ -156,9 +153,7 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList,
wxEVT_RIGHT_UP, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_DCLICK,
wxEVT_MIDDLE_UP, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_DCLICK,
wxEVT_MOTION, wxEVT_MOUSEWHEEL, wxEVT_CHAR, wxEVT_CHAR_HOOK,
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
wxEVT_MAGNIFY,
#endif
wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT
};
@ -613,7 +608,6 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
}
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
void EDA_3D_CANVAS::OnMagnify( wxMouseEvent& event )
{
SetFocus();
@ -631,7 +625,6 @@ void EDA_3D_CANVAS::OnMagnify( wxMouseEvent& event )
DisplayStatus();
Request_refresh();
}
#endif
void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )

View File

@ -228,10 +228,7 @@ private:
void OnMouseWheel( wxMouseEvent& event );
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
void OnMagnify( wxMouseEvent& event );
#endif
void OnMouseMove( wxMouseEvent& event );
void OnLeftDown( wxMouseEvent& event );
void OnLeftUp( wxMouseEvent& event );

View File

@ -960,6 +960,9 @@ find_package( wxWidgets ${wxWidgets_REQ_VERSION} COMPONENTS gl aui adv html core
# Include wxWidgets macros.
include( ${wxWidgets_USE_FILE} )
if( ${wxWidgets_VERSION_STRING} VERSION_LESS 3.2 )
message( FATAL_ERROR "wxWidgets 3.2.0 or greater is required" )
if( MINGW )
# This needs to be on a separate line to protect against a broken FindWxWidgets.cmake in vcpkg
if( ${wxWidgets_VERSION_STRING} VERSION_LESS 3.1 )

View File

@ -122,7 +122,7 @@ wxBitmap KiBitmap( const BITMAP_OPAQUE* aBitmap )
int KiIconScale( wxWindow* aWindow )
{
#if defined( __WXMSW__) && wxCHECK_VERSION( 3, 1, 6 )
#if defined( __WXMSW__)
// Basically don't try and scale within kicad and let wx do its thing
// with wx introducing bitmap bundles, it will auto scale automatically with dpi
// the issue is, none of the scaling factors have any tie to system scaling

View File

@ -310,10 +310,6 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const VECTOR2I& aPos,
// Be carefull before changing the code.
bool useTransform = aDC->CanUseTransformMatrix();
#if wxCHECK_VERSION( 3, 1, 6 ) && !wxCHECK_VERSION( 3, 1, 7 )
useTransform = false;
#endif
wxAffineMatrix2D init_matrix = aDC->GetTransformMatrix();
// Note: clipping bitmap area was made to fix a minor issue in old versions of

View File

@ -53,16 +53,7 @@ extern std::string GetCurlLibVersion();
wxString GetPlatformGetBitnessName()
{
wxPlatformInfo platform;
// TODO (ISM): Read conditional once our wx fork and flatpaks are running released 3.1.5
// On Windows, use GetBitnessName if exists
// I (J-PC) hope 3.1.6 has no problem
#if defined( __WINDOWS__ ) && wxCHECK_VERSION( 3, 1, 5 )
return platform.GetBitnessName();
#elif wxCHECK_VERSION( 3, 1, 6 )
return platform.GetBitnessName();
#else
return platform.GetArchName();
#endif
}
@ -146,17 +137,7 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
wxPlatformInfo platform;
aMsg << "Application: " << aTitle;
#if wxCHECK_VERSION( 3, 1, 6 )
aMsg << " " << wxGetCpuArchitectureName() << " on " << wxGetNativeCpuArchitectureName();
#elif defined( KICAD_BUILD_ARCH_X64 )
aMsg << " (64-bit)";
#elif defined( KICAD_BUILD_ARCH_X86 )
aMsg << " (32-bit)";
#elif defined( KICAD_BUILD_ARCH_ARM )
aMsg << " (ARM 32-bit)";
#elif defined( KICAD_BUILD_ARCH_ARM64 )
aMsg << " (ARM 64-bit)";
#endif
aMsg << eol << eol;

View File

@ -396,7 +396,7 @@ void DIALOG_COLOR_PICKER::drawRGBPalette()
// Use Y axis from bottom to top and origin to center
bitmapDC.SetAxisOrientation( true, true );
#if wxCHECK_VERSION( 3, 1, 7 ) && defined( __WXMSW__)
#if defined( __WXMSW__)
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
bitmapDC.SetDeviceOrigin( half_size, -half_size );
#else
@ -466,7 +466,7 @@ void DIALOG_COLOR_PICKER::drawHSVPalette()
// Use Y axis from bottom to top and origin to center
bitmapDC.SetAxisOrientation( true, true );
#if wxCHECK_VERSION( 3, 1, 7 ) && defined( __WXMSW__)
#if defined( __WXMSW__)
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
bitmapDC.SetDeviceOrigin( half_size, -half_size );
#else

View File

@ -138,15 +138,8 @@ PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( wxWindow* aParent )
// Hide the option of icons in menus for platforms that do not support them
m_checkBoxIconsInMenus->Show( KIPLATFORM::UI::AllowIconsInMenus() );
/*
* Font scaling hacks are only needed on GTK under wxWidgets 3.0.
*/
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
m_fontScalingHelp->SetFont( KIUI::GetInfoFont( this ).Italic() );
#else
m_scaleFonts->Show( false );
m_fontScalingHelp->Show( false );
#endif
if( m_iconScaleSlider )
{

View File

@ -142,9 +142,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
wxEVT_MOUSEWHEEL,
wxEVT_CHAR,
wxEVT_CHAR_HOOK,
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
wxEVT_MAGNIFY,
#endif
KIGFX::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE
};

View File

@ -445,22 +445,8 @@ void EDA_BASE_FRAME::HandleUpdateUIEvent( wxUpdateUIEvent& aEvent, EDA_BASE_FRAM
aEvent.Enable( enableRes );
aEvent.Show( showRes );
// wxWidgets 3.1.5+ includes a field in the event that says if the event supports being
// checked, since wxMenuItems don't want to be checked unless they actually are checkable
#if wxCHECK_VERSION( 3, 1, 5 )
if( aEvent.IsCheckable() )
aEvent.Check( checkRes );
#else
bool canCheck = true;
// wxMenuItems don't want to be checked unless they actually are checkable, so we have to
// check to see if they can be and can't just universally apply a check in this event.
if( wxMenu* menu = dynamic_cast<wxMenu*>( aEvent.GetEventObject() ) )
canCheck = menu->FindItem( aEvent.GetId() )->IsCheckable();
if( canCheck )
aEvent.Check( checkRes );
#endif
}

View File

@ -172,7 +172,6 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_messagePanel->SetBackgroundColour( COLOR4D( LIGHTGRAY ).ToColour() );
#if wxCHECK_VERSION( 3, 1, 3 )
Bind( wxEVT_DPI_CHANGED,
[&]( wxDPIChangedEvent& )
{
@ -189,7 +188,6 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_messagePanel->SetPosition( wxPoint( 0, m_frameSize.y ) );
m_messagePanel->SetSize( m_frameSize.x, m_msgFrameHeight );
} );
#endif
}

View File

@ -314,9 +314,7 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
Connect( wxEVT_AUX2_UP, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) );
Connect( wxEVT_AUX2_DCLICK, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) );
Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) );
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
Connect( wxEVT_MAGNIFY, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) );
#endif
#if defined _WIN32 || defined _WIN64
Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) );
#endif
@ -2556,15 +2554,6 @@ void OPENGL_GAL::init()
wxASSERT_MSG( m_isContextLocked, "This should only be called from within a locked context." );
// IsDisplayAttr() handles WX_GL_{MAJOR,MINOR}_VERSION correctly only in 3.0.4
// starting with 3.1.0 one should use wxGLContext::IsOk() (done by GL_CONTEXT_MANAGER)
#if wxCHECK_VERSION( 3, 0, 3 ) and !wxCHECK_VERSION( 3, 1, 0 )
const int attr[] = { WX_GL_MAJOR_VERSION, 2, WX_GL_MINOR_VERSION, 1, 0 };
if( !IsDisplaySupported( attr ) )
throw std::runtime_error( "OpenGL 2.1 or higher is required!" );
#endif /* wxCHECK_VERSION( 3, 0, 3 ) */
// Check correct initialization from the constructor
if( m_tesselator == nullptr )
throw std::runtime_error( "Could not create the tesselator" );

View File

@ -40,13 +40,11 @@ wxGLContext* GL_CONTEXT_MANAGER::CreateCtx( wxGLCanvas* aCanvas, const wxGLConte
wxGLContext* context = new wxGLContext( aCanvas, aOther );
wxCHECK( context, nullptr );
#if wxCHECK_VERSION( 3, 1, 0 )
if( !context->IsOK() )
{
delete context;
return nullptr;
}
#endif /* wxCHECK_VERSION( 3, 1, 0 ) */
m_glContexts.insert( std::make_pair( context, aCanvas ) );

View File

@ -29,27 +29,6 @@ bool LaunchExternal( const wxString& aPath )
const wchar_t* args[] = { L"open", aPath.wc_str(), nullptr };
return wxExecute( const_cast<wchar_t**>( args ) ) != -1;
#elif defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 1 )
// On Unix systems `wxLaunchDefaultApplication()` before wxWidgets 3.1.1 mistakenly uses
// `wxExecute(xdg_open + " " + document)`, thereby failing for filenames with spaces. Below is
// a backport of the fixed `wxLaunchDefaultApplication()`, to be used until we switch to a
// newer version of wxWidgets.
wxString PATH, xdg_open;
if( wxGetEnv( "PATH", &PATH ) && wxFindFileInPath( &xdg_open, PATH, "xdg-open" ) )
{
const char* argv[3];
argv[0] = xdg_open.fn_str();
argv[1] = aPath.fn_str();
argv[2] = nullptr;
if( wxExecute( const_cast<char**>( argv ) ) )
return true;
}
return false;
#else
wxString path( aPath );

View File

@ -830,11 +830,7 @@ wxString PGM_BASE::GetLanguageTag()
return "";
else
{
#if wxCHECK_VERSION( 3, 1, 6 )
wxString str = langInfo->GetCanonicalWithRegion();
#else
wxString str = langInfo->CanonicalName;
#endif
str.Replace( "_", "-" );
return str;
@ -911,16 +907,7 @@ bool PGM_BASE::IsGUI()
if( !wxTheApp )
return false;
#if wxCHECK_VERSION( 3, 1, 6 )
return wxTheApp->IsGUI();
#else
// wxWidgets older than version 3.1.6 do not have a way to know if the app
// has a GUI or is a console application.
// So the trick is to set the App class name when starting kicad-cli, and when
// the app class name is the kicad-cli class name the app is a console app
bool run_gui = wxTheApp->GetClassName() != KICAD_CLI_APP_NAME;
return run_gui;
#endif
}

View File

@ -64,11 +64,7 @@ bool PG_CELL_RENDERER::Render( wxDC &aDC, const wxRect &aRect, const wxPropertyG
text = wxControl::Ellipsize( text, aDC, wxELLIPSIZE_MIDDLE, aRect.GetWidth() );
#if wxCHECK_VERSION( 3, 1, 6 )
int imageWidth = PreDrawCell( aDC, aRect, aGrid, cell, preDrawFlags );
#else
int imageWidth = PreDrawCell( aDC, aRect, cell, preDrawFlags );
#endif
int imageOffset = aProperty->GetImageOffset( imageWidth );

View File

@ -102,12 +102,7 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
/*
* Font scaling hacks are only needed on GTK under wxWidgets 3.0.
*/
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
m_params.emplace_back( new PARAM<bool>( "appearance.apply_icon_scale_to_fonts",
&m_Appearance.apply_icon_scale_to_fonts, false ) );
#else
m_Appearance.apply_icon_scale_to_fonts = false;
#endif
m_params.emplace_back( new PARAM<bool>( "appearance.show_scrollbars",
&m_Appearance.show_scrollbars, false ) );

View File

@ -492,16 +492,7 @@ void ACTION_MENU::OnMenuEvent( wxMenuEvent& aEvent )
FindItem( m_selected, &menu );
// This conditional compilation is probably not needed.
// It will be removed later, for the Kicad V 6.x version.
// But in "old" 3.0 version, the "&& menu != this" contition was added to avoid
// hang. This hang is no longer encountered in wxWidgets 3.0.4 version, and this
// condition is no longer needed. And in 3.1.2, we have to remove it, as
// "menu != this" never happens ("menu != this" always happens in 3.1.1 and older!).
#if wxCHECK_VERSION( 3, 1, 2 )
if( menu )
#else
if( menu && menu != this )
#endif
{
ACTION_MENU* cxmenu = static_cast<ACTION_MENU*>( menu );
evt = cxmenu->eventHandler( aEvent );

View File

@ -191,12 +191,6 @@ ACTION_TOOLBAR::ACTION_TOOLBAR( EDA_BASE_FRAME* parent, wxWindowID id, const wxP
{
m_paletteTimer = new wxTimer( this );
#if !wxCHECK_VERSION( 3, 1, 0 )
// Custom art provider makes dark mode work on wx < 3.1
WX_AUI_TOOLBAR_ART* newArt = new WX_AUI_TOOLBAR_ART();
SetArtProvider( newArt );
#endif
Connect( wxEVT_COMMAND_TOOL_CLICKED, wxAuiToolBarEventHandler( ACTION_TOOLBAR::onToolEvent ),
nullptr, this );
Connect( wxEVT_AUITOOLBAR_RIGHT_CLICK,
@ -335,12 +329,8 @@ void ACTION_TOOLBAR::doSelectAction( ACTION_GROUP* aGroup, const TOOL_ACTION& aA
// Update the item information
item->SetShortHelp( aAction.GetTooltip() );
item->SetBitmap( KiScaledBitmap( aAction.GetIcon(), GetParent() ) );
#if wxCHECK_VERSION( 3, 1, 6 )
item->SetDisabledBitmap(
MakeDisabledBitmap( item->GetBitmapBundle().GetBitmapFor( GetParent() ) ) );
#else
item->SetDisabledBitmap( MakeDisabledBitmap( item->GetBitmap() ) );
#endif
// Register a new handler with the new UI conditions
if( m_toolManager )

View File

@ -463,9 +463,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
// Mouse handling
// Note: wxEVT_LEFT_DOWN event must always be skipped.
if( type == wxEVT_MOTION || type == wxEVT_MOUSEWHEEL ||
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
type == wxEVT_MAGNIFY ||
#endif
isMouseClick( type ) ||
// Event issued when mouse retains position in screen coordinates,
// but changes in world coordinates (e.g. autopanning)

View File

@ -393,7 +393,6 @@ bool FIELD_VALIDATOR::Validate( wxWindow* aParent )
{
wxArrayString badCharsFound;
#if wxCHECK_VERSION( 3, 1, 3 )
for( const wxUniCharRef& excludeChar : GetCharExcludes() )
{
if( val.Find( excludeChar ) != wxNOT_FOUND )
@ -410,24 +409,6 @@ bool FIELD_VALIDATOR::Validate( wxWindow* aParent )
badCharsFound.Add( wxString::Format( wxT( "'%c'" ), excludeChar ) );
}
}
#else
for( const wxString& excludeChar : GetExcludes() )
{
if( val.Find( excludeChar ) != wxNOT_FOUND )
{
if( excludeChar == wxT( "\r" ) )
badCharsFound.Add( _( "carriage return" ) );
else if( excludeChar == wxT( "\n" ) )
badCharsFound.Add( _( "line feed" ) );
else if( excludeChar == wxT( "\t" ) )
badCharsFound.Add( _( "tab" ) );
else if( excludeChar == wxT( " " ) )
badCharsFound.Add( _( "space" ) );
else
badCharsFound.Add( wxString::Format( wxT( "'%s'" ), excludeChar ) );
}
}
#endif
wxString badChars;

View File

@ -89,10 +89,8 @@ WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, EDA_DRAW_PANEL_GAL* aParentPane
m_parentPanel->Connect( wxEVT_MOTION,
wxMouseEventHandler( WX_VIEW_CONTROLS::onMotion ), nullptr, this );
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
m_parentPanel->Connect( wxEVT_MAGNIFY,
wxMouseEventHandler( WX_VIEW_CONTROLS::onMagnify ), nullptr, this );
#endif
m_parentPanel->Connect( wxEVT_MOUSEWHEEL,
wxMouseEventHandler( WX_VIEW_CONTROLS::onWheel ), nullptr, this );
m_parentPanel->Connect( wxEVT_MIDDLE_UP,
@ -423,7 +421,6 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
}
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
void WX_VIEW_CONTROLS::onMagnify( wxMouseEvent& aEvent )
{
// Scale based on the magnification from our underlying magnification event.
@ -432,7 +429,6 @@ void WX_VIEW_CONTROLS::onMagnify( wxMouseEvent& aEvent )
aEvent.Skip();
}
#endif
void WX_VIEW_CONTROLS::setState( STATE aNewState )

View File

@ -30,31 +30,24 @@ APP_PROGRESS_DIALOG::APP_PROGRESS_DIALOG( const wxString& aTitle, const wxString
bool aIndeterminateTaskBarStatus, int aStyle )
: wxProgressDialog( aTitle,
aMessage == wxEmptyString ? wxString( wxT( " " ) ) : aMessage,
aMaximum, aParent, aStyle )
#if wxCHECK_VERSION( 3, 1, 0 )
,
aMaximum, aParent, aStyle ),
m_appProgressIndicator( aParent, aMaximum ),
m_indeterminateTaskBarStatus( aIndeterminateTaskBarStatus )
#endif
{
#if wxCHECK_VERSION( 3, 1, 0 )
if( m_indeterminateTaskBarStatus )
{
m_appProgressIndicator.Pulse();
}
#endif
}
bool APP_PROGRESS_DIALOG::Update( int aValue, const wxString& aNewMsg, bool* aSkip )
{
#if wxCHECK_VERSION( 3, 1, 0 )
if( !m_indeterminateTaskBarStatus )
{
m_appProgressIndicator.SetValue( aValue );
}
#endif
return wxProgressDialog::Update( aValue, aNewMsg, aSkip );
}

View File

@ -115,11 +115,7 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, const wxString& aRecentSearchesKey, LIB_T
m_query_ctrl->Bind( wxEVT_TEXT, &LIB_TREE::onQueryText, this );
#if wxCHECK_VERSION( 3, 1, 1 )
m_query_ctrl->Bind( wxEVT_SEARCH_CANCEL, &LIB_TREE::onQueryText, this );
#else
m_query_ctrl->Bind( wxEVT_SEARCHCTRL_CANCEL_BTN, &LIB_TREE::onQueryText, this );
#endif
m_query_ctrl->Bind( wxEVT_CHAR_HOOK, &LIB_TREE::onQueryCharHook, this );
m_query_ctrl->Bind( wxEVT_MOTION, &LIB_TREE::onQueryMouseMoved, this );
m_query_ctrl->Bind( wxEVT_LEAVE_WINDOW,
@ -748,11 +744,6 @@ void LIB_TREE::onHeaderContextMenu( wxDataViewEvent& aEvent )
if( dlg.ShowModal() == wxID_OK )
m_adapter->SetShownColumns( dlg.EnabledList() );
}
#if !wxCHECK_VERSION( 3, 1, 0 )
// wxGTK 3.0 sends item right click events for header right clicks
m_skipNextRightClick = true;
#endif
}

View File

@ -1285,9 +1285,7 @@ EVT_SIZE( mpWindow::OnSize )
EVT_MIDDLE_DOWN( mpWindow::OnMouseMiddleDown ) // JLB
EVT_RIGHT_UP( mpWindow::OnShowPopupMenu )
EVT_MOUSEWHEEL( mpWindow::OnMouseWheel ) // JLB
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
EVT_MAGNIFY( mpWindow::OnMagnify )
#endif
EVT_MOTION( mpWindow::OnMouseMove ) // JLB
EVT_LEFT_DOWN( mpWindow::OnMouseLeftDown )
EVT_LEFT_UP( mpWindow::OnMouseLeftRelease )
@ -1412,7 +1410,6 @@ void mpWindow::OnMouseMiddleDown( wxMouseEvent& event )
}
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
void mpWindow::OnMagnify( wxMouseEvent& event )
{
if( !m_enableMouseNavigation )
@ -1429,7 +1426,6 @@ void mpWindow::OnMagnify( wxMouseEvent& event )
else if( zoom < 1.0f )
ZoomOut( pos, 1.0f / zoom );
}
#endif
// Process mouse wheel events

View File

@ -221,18 +221,6 @@ bool PAGED_DIALOG::TransferDataToWindow()
if( !DIALOG_SHIM::TransferDataToWindow() )
return false;
// On wxWidgets 3.0, TransferDataFromWindow() is not called recursively
// so we have to call it for each page
#if !wxCHECK_VERSION( 3, 1, 0 )
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
{
wxWindow* page = m_treebook->GetPage( i );
if( !page->TransferDataToWindow() )
return false;
}
#endif
// Search for a page matching the lastParentPageTitle/lastPageTitle hierarchy
wxString lastPage = g_lastPage[ m_title ];
wxString lastParentPage = g_lastParentPage[ m_title ];
@ -274,22 +262,6 @@ bool PAGED_DIALOG::TransferDataFromWindow()
if( !DIALOG_SHIM::TransferDataFromWindow() )
ret = false;
// On wxWidgets 3.0, TransferDataFromWindow() is not called recursively
// so we have to call it for each page
#if !wxCHECK_VERSION( 3, 1, 0 )
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
{
wxWindow* page = m_treebook->GetPage( i );
if( !page->TransferDataFromWindow() )
{
m_treebook->ChangeSelection( i );
ret = false;
break;
}
}
#endif
return ret;
}

View File

@ -40,12 +40,7 @@ SPLIT_BUTTON::SPLIT_BUTTON( wxWindow* aParent, wxWindowID aId, const wxString& a
{
if( aSize == wxDefaultSize )
{
#if wxCHECK_VERSION( 3, 1, 3 )
wxSize defaultSize = wxButton::GetDefaultSize( aParent );
#else
wxSize defaultSize = wxButton::GetDefaultSize();
#endif
wxSize defaultSize = wxButton::GetDefaultSize( aParent );
wxSize textSize = GetTextExtent( m_label );
SetMinSize( wxSize( std::max( textSize.GetWidth(), defaultSize.GetWidth() + 1 ),
defaultSize.GetHeight() + 1 ) );

View File

@ -40,12 +40,7 @@ STD_BITMAP_BUTTON::STD_BITMAP_BUTTON( wxWindow* aParent, wxWindowID aId,
{
if( aSize == wxDefaultSize )
{
#if wxCHECK_VERSION( 3, 1, 3 )
wxSize defaultSize = wxButton::GetDefaultSize( aParent );
#else
wxSize defaultSize = wxButton::GetDefaultSize();
#endif
wxSize defaultSize = wxButton::GetDefaultSize( aParent );
SetMinSize( wxSize( defaultSize.GetWidth() + 1, defaultSize.GetHeight() + 1 ) );
}

View File

@ -587,33 +587,17 @@ void WIDGET_HOTKEY_LIST::updateColumnWidths()
col->SetWidth( wxCOL_WIDTH_AUTOSIZE );
col->SetWidth( col->GetWidth() );
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
col->SetResizeable( true );
#endif
col = GetDataView()->GetColumn( 1 );
col->SetWidth( wxCOL_WIDTH_AUTOSIZE );
col->SetWidth( col->GetWidth() );
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
col->SetResizeable( true );
#endif
col = GetDataView()->GetColumn( 2 );
col->SetWidth( wxCOL_WIDTH_AUTOSIZE );
col->SetWidth( col->GetWidth() );
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
col->SetResizeable( true );
#endif
col = GetDataView()->GetColumn( 3 );
col->SetWidth( wxCOL_WIDTH_AUTOSIZE );
col->SetWidth( col->GetWidth() );
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
col->SetResizeable( true );
#endif
}

View File

@ -124,13 +124,11 @@ void WX_AUI_TOOLBAR_ART::DrawButton( wxDC& aDc, wxWindow* aWindow, const wxAuiTo
WX_AUI_DOCK_ART::WX_AUI_DOCK_ART() : wxAuiDefaultDockArt()
{
#if defined( _WIN32 )
#if wxCHECK_VERSION( 3, 1, 0 )
// Use normal control font, wx likes to use "small"
m_captionFont = *wxNORMAL_FONT;
// Increase the box the caption rests in size a bit
m_captionSize = wxWindow::FromDIP( 20, nullptr );
#endif
#endif
SetColour( wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR,

View File

@ -108,10 +108,7 @@ WX_GRID::WX_GRID( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxS
if( GetColLabelSize() > 0 )
SetColLabelSize( GetColLabelSize() + 4 );
#if wxCHECK_VERSION( 3, 1, 3 )
Connect( wxEVT_DPI_CHANGED, wxDPIChangedEventHandler( WX_GRID::onDPIChanged ), nullptr, this );
#endif
Connect( wxEVT_GRID_EDITOR_SHOWN, wxGridEventHandler( WX_GRID::onCellEditorShown ), nullptr, this );
Connect( wxEVT_GRID_EDITOR_HIDDEN, wxGridEventHandler( WX_GRID::onCellEditorHidden ), nullptr, this );
}
@ -122,14 +119,11 @@ WX_GRID::~WX_GRID()
if( m_weOwnTable )
DestroyTable( GetTable() );
#if wxCHECK_VERSION( 3, 1, 3 )
Disconnect( wxEVT_DPI_CHANGED, wxDPIChangedEventHandler( WX_GRID::onDPIChanged ), nullptr, this );
#endif
}
#if wxCHECK_VERSION( 3, 1, 3 )
void WX_GRID::onDPIChanged(wxDPIChangedEvent& aEvt)
{
/// This terrible hack is a way to avoid the incredibly disruptive resizing of grids that happens on Macs
@ -138,7 +132,6 @@ void WX_GRID::onDPIChanged(wxDPIChangedEvent& aEvt)
aEvt.Skip();
#endif
}
#endif
void WX_GRID::SetColLabelSize( int aHeight )
@ -345,14 +338,8 @@ void WX_GRID::DrawCornerLabel( wxDC& dc )
// It is reported that we need to erase the background to avoid display
// artifacts, see #12055.
{
// wxWidgets renamed this variable between 3.1.2 and 3.1.3 ...
#if wxCHECK_VERSION( 3, 1, 3 )
wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
wxDCPenChanger setPen( dc, m_colLabelWin->GetBackgroundColour() );
#else
wxDCBrushChanger setBrush( dc, m_colWindow->GetBackgroundColour() );
wxDCPenChanger setPen( dc, m_colWindow->GetBackgroundColour() );
#endif
dc.DrawRectangle( rect.Inflate( 1 ) );
}
@ -375,14 +362,8 @@ void WX_GRID::DrawColLabel( wxDC& dc, int col )
// It is reported that we need to erase the background to avoid display
// artifacts, see #12055.
{
// wxWidgets renamed this variable between 3.1.2 and 3.1.3 ...
#if wxCHECK_VERSION( 3, 1, 3 )
wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
wxDCPenChanger setPen( dc, m_colLabelWin->GetBackgroundColour() );
#else
wxDCBrushChanger setBrush( dc, m_colWindow->GetBackgroundColour() );
wxDCPenChanger setPen( dc, m_colWindow->GetBackgroundColour() );
#endif
dc.DrawRectangle( rect.Inflate( 1 ) );
}
@ -417,14 +398,8 @@ void WX_GRID::DrawRowLabel( wxDC& dc, int row )
// It is reported that we need to erase the background to avoid display
// artifacts, see #12055.
{
// wxWidgets renamed this variable between 3.1.2 and 3.1.3 ...
#if wxCHECK_VERSION( 3, 1, 3 )
wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
wxDCPenChanger setPen( dc, m_colLabelWin->GetBackgroundColour() );
#else
wxDCBrushChanger setBrush( dc, m_colWindow->GetBackgroundColour() );
wxDCPenChanger setPen( dc, m_colWindow->GetBackgroundColour() );
#endif
dc.DrawRectangle( rect.Inflate( 1 ) );
}

View File

@ -40,17 +40,13 @@ WX_PROGRESS_REPORTER::WX_PROGRESS_REPORTER( wxWindow* aParent, const wxString& a
// up another event loop on completion which
// causes all sorts of grief
( aCanAbort ? wxPD_CAN_ABORT : 0 ) | wxPD_ELAPSED_TIME ),
#if wxCHECK_VERSION( 3, 1, 0 )
m_appProgressIndicator( aParent ),
#endif
m_messageWidth( 0 )
{
#if wxCHECK_VERSION( 3, 1, 0 )
// wxAppProgressIndicator doesn't like value > max, ever. However there are some risks
// with multithreaded setting of those values making a mess
// the cop out is just to set the progress to "indeterminate"
m_appProgressIndicator.Pulse();
#endif
}

View File

@ -892,11 +892,7 @@ wxPGProperty* DIALOG_SIM_MODEL<T_symbol, T_field>::newParamProperty( SIM_MODEL*
prop->SetAttribute( wxPG_ATTR_UNITS, wxString::FromUTF8( param.info.unit.c_str() ) );
// Legacy due to the way we extracted the parameters from Ngspice.
#if wxCHECK_VERSION( 3, 1, 0 )
prop->SetCell( 3, wxString::FromUTF8( param.info.defaultValue ) );
#else
prop->SetCell( 3, wxString::FromUTF8( param.info.defaultValue.c_str() ) );
#endif
prop->SetCell( 3, wxString::FromUTF8( param.info.defaultValue ) );
wxString typeStr;

View File

@ -45,9 +45,7 @@ PANEL_EESCHEMA_EDITING_OPTIONS::PANEL_EESCHEMA_EDITING_OPTIONS( wxWindow* aWindo
m_hint2->SetFont( helpFont );
m_spinLabelRepeatStep->SetRange( -100000, 100000 );
#if wxCHECK_VERSION( 3, 1, 6 )
m_spinLabelRepeatStep->SetIncrement( 1 );
#endif
#ifdef __WXOSX_MAC__
m_leftClickCmdsBook->SetSelection( 1 );

View File

@ -73,11 +73,7 @@
#include <kiplatform/io.h>
#if wxCHECK_VERSION( 3, 1, 7 )
#include "widgets/filedlg_hook_save_project.h"
#else
#include "widgets/legacyfiledlg_save_project.h"
#endif
bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
{
@ -860,18 +856,12 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
savePath.GetFullName(), KiCadSchematicFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
#if wxCHECK_VERSION( 3, 1, 7 )
FILEDLG_HOOK_SAVE_PROJECT newProjectHook;
#endif
// Add a "Create a project" checkbox in standalone mode and one isn't loaded
if( Kiface().IsSingle() || aSaveAs )
{
#if wxCHECK_VERSION( 3, 1, 7 )
dlg.SetCustomizeHook( newProjectHook );
#else
dlg.SetExtraControlCreator( &LEGACYFILEDLG_SAVE_PROJECT::Create );
#endif
}
if( dlg.ShowModal() == wxID_CANCEL )
@ -893,13 +883,8 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
return false;
}
#if wxCHECK_VERSION( 3, 1, 7 )
if( newProjectHook.IsAttachedToDialog() )
createNewProject = newProjectHook.GetCreateNewProject();
#else
if( wxWindow* ec = dlg.GetExtraControl() )
createNewProject = static_cast<LEGACYFILEDLG_SAVE_PROJECT*>( ec )->GetValue();
#endif
if( !saveCopy )
{

View File

@ -48,12 +48,7 @@
#include <string_utils.h>
#include "symbol_saveas_type.h"
#if wxCHECK_VERSION( 3, 1, 7 )
#include <widgets/symbol_filedlg_save_as.h>
#else
#include <widgets/symbol_legacyfiledlg_save_as.h>
SYMBOL_SAVEAS_TYPE SYMBOL_LEGACYFILEDLG_SAVE_AS::m_option = SYMBOL_SAVEAS_TYPE::NORMAL_SAVE_AS;
#endif
void SYMBOL_EDIT_FRAME::updateTitle()
@ -1059,12 +1054,8 @@ bool SYMBOL_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile )
default_path, fn.GetFullName(), wildcards,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
#if wxCHECK_VERSION( 3, 1, 7 )
SYMBOL_FILEDLG_SAVE_AS saveAsHook( type );
dlg.SetCustomizeHook( saveAsHook );
#else
dlg.SetExtraControlCreator( &SYMBOL_LEGACYFILEDLG_SAVE_AS::Create );
#endif
if( dlg.ShowModal() == wxID_CANCEL )
return false;
@ -1076,15 +1067,7 @@ bool SYMBOL_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile )
if( fn.GetExt().IsEmpty() )
fn.SetExt( KiCadSymbolLibFileExtension );
#if wxCHECK_VERSION( 3, 1, 7 )
type = saveAsHook.GetOption();
#else
const SYMBOL_LEGACYFILEDLG_SAVE_AS* sah =
dynamic_cast<const SYMBOL_LEGACYFILEDLG_SAVE_AS*>( dlg.GetExtraControl() );
wxCHECK( sah, false );
type = sah->GetOption();
#endif
}
else
{

View File

@ -1,56 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LEGACYFILEDLG_SAVE_PROJ_H
#define LEGACYFILEDLG_SAVE_PROJ_H
#include <wx/checkbox.h>
#include <wx/panel.h>
#include <wx/sizer.h>
///< Helper widget to select whether a new project should be created for a file when saving
class LEGACYFILEDLG_SAVE_PROJECT : public wxPanel
{
public:
LEGACYFILEDLG_SAVE_PROJECT( wxWindow* aParent ) : wxPanel( aParent )
{
m_cbCreateProject =
new wxCheckBox( this, wxID_ANY, _( "Create a new project for this schematic" ) );
m_cbCreateProject->SetValue( true );
m_cbCreateProject->SetToolTip( _( "Creating a project will enable features such as "
"text variables, net classes, and ERC exclusions" ) );
wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
sizer->Add( m_cbCreateProject, 0, wxALL, 8 );
SetSizerAndFit( sizer );
}
bool GetValue() const { return m_cbCreateProject->GetValue(); }
static wxWindow* Create( wxWindow* aParent )
{
return new LEGACYFILEDLG_SAVE_PROJECT( aParent );
}
protected:
wxCheckBox* m_cbCreateProject;
};
#endif

View File

@ -1,117 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SYMBOL_LEGACYFILEDLG_SAVE_AS_
#define SYMBOL_LEGACYFILEDLG_SAVE_AS_
#include <symbol_editor/symbol_saveas_type.h>
#include <wx/panel.h>
#include <wx/radiobut.h>
#include <wx/sizer.h>
/**
* Helper control to inquire user what to do on library save as operation.
*/
class SYMBOL_LEGACYFILEDLG_SAVE_AS : public wxPanel
{
public:
SYMBOL_LEGACYFILEDLG_SAVE_AS( wxWindow* aParent ) : wxPanel( aParent )
{
m_simpleSaveAs = new wxRadioButton( this, wxID_ANY, _( "Do not update library tables" ),
wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_simpleSaveAs->SetToolTip( _( "Do not perform any additional operations after saving "
"library." ) );
m_replaceTableEntry =
new wxRadioButton( this, wxID_ANY, _( "Update existing library table entry" ) );
m_replaceTableEntry->SetToolTip( _( "Update symbol library table entry to point to new "
"library.\n\n"
"The original library will no longer be available "
"for use." ) );
m_addGlobalTableEntry =
new wxRadioButton( this, wxID_ANY, _( "Add new global library table entry" ) );
m_addGlobalTableEntry->SetToolTip( _( "Add new entry to the global symbol library table."
"\n\nThe symbol library table nickname is suffixed "
"with\nan integer to prevent duplicate table "
"entries." ) );
m_addProjectTableEntry =
new wxRadioButton( this, wxID_ANY, _( "Add new project library table entry" ) );
m_addProjectTableEntry->SetToolTip( _( "Add new entry to the project symbol library table."
"\n\nThe symbol library table nickname is suffixed "
"with\nan integer to prevent duplicate table "
"entries." ) );
wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
sizer->Add( m_simpleSaveAs, 0, wxLEFT | wxRIGHT | wxTOP, 5 );
sizer->Add( m_replaceTableEntry, 0, wxLEFT | wxRIGHT | wxTOP, 5 );
sizer->Add( m_addGlobalTableEntry, 0, wxLEFT | wxRIGHT | wxTOP, 5 );
sizer->Add( m_addProjectTableEntry, 0, wxLEFT | wxRIGHT | wxTOP | wxBOTTOM, 5 );
SetSizerAndFit( sizer );
SetOption( m_option );
}
~SYMBOL_LEGACYFILEDLG_SAVE_AS() { m_option = GetOption(); }
void SetOption( SYMBOL_SAVEAS_TYPE aOption )
{
m_simpleSaveAs->SetValue( aOption == SYMBOL_SAVEAS_TYPE::NORMAL_SAVE_AS );
m_replaceTableEntry->SetValue( aOption == SYMBOL_SAVEAS_TYPE::REPLACE_TABLE_ENTRY );
m_addGlobalTableEntry->SetValue( aOption == SYMBOL_SAVEAS_TYPE::ADD_GLOBAL_TABLE_ENTRY );
m_addProjectTableEntry->SetValue( aOption == SYMBOL_SAVEAS_TYPE::ADD_PROJECT_TABLE_ENTRY );
}
SYMBOL_SAVEAS_TYPE GetOption() const
{
if( m_replaceTableEntry->GetValue() )
return SYMBOL_SAVEAS_TYPE::REPLACE_TABLE_ENTRY;
else if( m_addGlobalTableEntry->GetValue() )
return SYMBOL_SAVEAS_TYPE::ADD_GLOBAL_TABLE_ENTRY;
else if( m_addProjectTableEntry->GetValue() )
return SYMBOL_SAVEAS_TYPE::ADD_PROJECT_TABLE_ENTRY;
else
return SYMBOL_SAVEAS_TYPE::NORMAL_SAVE_AS;
}
/**
* Create a new panel to add to a wxFileDialog object.
*
* The caller owns the created object and is responsible for deleting it.
*
* @param aParent is the parent window that will own the created object.
* @return the newly created panel to add to the wxFileDialog.
*/
static wxWindow* Create( wxWindow* aParent )
{
wxCHECK( aParent, nullptr );
return new SYMBOL_LEGACYFILEDLG_SAVE_AS( aParent );
}
private:
static SYMBOL_SAVEAS_TYPE m_option;
wxRadioButton* m_simpleSaveAs;
wxRadioButton* m_replaceTableEntry;
wxRadioButton* m_addGlobalTableEntry;
wxRadioButton* m_addProjectTableEntry;
};
#endif

View File

@ -57,9 +57,7 @@ public:
/// Handler functions
void onWheel( wxMouseEvent& aEvent );
void onMotion( wxMouseEvent& aEvent );
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
void onMagnify( wxMouseEvent& aEvent );
#endif
void onButton( wxMouseEvent& aEvent );
void onEnter( wxMouseEvent& WXUNUSED( aEvent ) );
void onLeave( wxMouseEvent& WXUNUSED( aEvent ) );

View File

@ -25,10 +25,7 @@
#define __APP_PROGRESS_REPORTER
#include <wx/progdlg.h>
#if wxCHECK_VERSION( 3, 1, 0 )
#include <wx/appprogress.h>
#endif
/**
* wxProgressDialog with the option to also update the application progress on the taskbar
@ -45,10 +42,8 @@ public:
private:
#if wxCHECK_VERSION( 3, 1, 0 )
wxAppProgressIndicator m_appProgressIndicator;
bool m_indeterminateTaskBarStatus;
#endif
};
#endif

View File

@ -172,10 +172,7 @@ protected:
void onCellEditorShown( wxGridEvent& aEvent );
void onCellEditorHidden( wxGridEvent& aEvent );
#if wxCHECK_VERSION( 3, 1, 3 )
void onDPIChanged(wxDPIChangedEvent& event);
#endif
protected:
bool m_weOwnTable;

View File

@ -29,9 +29,7 @@
#include <wx/progdlg.h>
#include <wx/gauge.h>
#if wxCHECK_VERSION( 3, 1, 0 )
#include <wx/appprogress.h>
#endif
#include <widgets/progress_reporter_base.h>
@ -75,10 +73,7 @@ private:
bool updateUI() override;
private:
#if wxCHECK_VERSION( 3, 1, 0 )
wxAppProgressIndicator m_appProgressIndicator;
#endif
int m_messageWidth;
};

View File

@ -32,15 +32,10 @@ DIALOG_PCM_PROGRESS::DIALOG_PCM_PROGRESS( wxWindow* parent, bool aShowDownloadSe
m_currentProgress( 0 ),
m_currentProgressTotal( 0 ),
m_finished( false ),
m_disabler( this )
#if wxCHECK_VERSION( 3, 1, 0 )
,
m_disabler( this ),
m_appProgressIndicator( parent->GetParent(), GAUGE_RANGE )
#endif
{
#if wxCHECK_VERSION( 3, 1, 0 )
m_appProgressIndicator.Pulse();
#endif
m_reporter->SetImmediateMode();
m_downloadGauge->SetRange( GAUGE_RANGE );
@ -124,9 +119,7 @@ bool DIALOG_PCM_PROGRESS::updateUI()
current = 1.0;
m_overallGauge->SetValue( current * GAUGE_RANGE );
#if wxCHECK_VERSION( 3, 1, 0 )
m_appProgressIndicator.SetValue( current * GAUGE_RANGE );
#endif
if( m_downloadTotal.load() == 0 )
{

View File

@ -26,9 +26,7 @@
#include "reporter.h"
#include <atomic>
#include <widgets/progress_reporter_base.h>
#if wxCHECK_VERSION( 3, 1, 0 )
#include <wx/appprogress.h>
#endif
/**
@ -81,9 +79,7 @@ private:
wxWindowDisabler m_disabler;
#if wxCHECK_VERSION( 3, 1, 0 )
wxAppProgressIndicator m_appProgressIndicator;
#endif
};
#endif // DIALOG_PCM_PROGRESS_H_

View File

@ -47,11 +47,7 @@
#include <io_mgr.h>
#include <import_proj.h>
#if wxCHECK_VERSION( 3, 1, 7 )
#include "widgets/filedlg_new_project.h"
#else
#include "widgets/legacyfiledlg_new_project.h"
#endif
KICAD_MANAGER_CONTROL::KICAD_MANAGER_CONTROL() :
TOOL_INTERACTIVE( "kicad.Control" ),
@ -73,12 +69,8 @@ int KICAD_MANAGER_CONTROL::NewProject( const TOOL_EVENT& aEvent )
ProjectFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
// Add a "Create a new directory" checkbox
#if wxCHECK_VERSION( 3, 1, 7 )
FILEDLG_NEW_PROJECT newProjectHook;
dlg.SetCustomizeHook( newProjectHook );
#else
dlg.SetExtraControlCreator( &LEGACYFILEDLG_NEW_PROJECT::Create );
#endif
if( dlg.ShowModal() == wxID_CANCEL )
return -1;
@ -98,11 +90,7 @@ int KICAD_MANAGER_CONTROL::NewProject( const TOOL_EVENT& aEvent )
// Append a new directory with the same name of the project file.
bool createNewDir = false;
#if wxCHECK_VERSION( 3, 1, 7 )
createNewDir = newProjectHook.GetCreateNewDir();
#else
createNewDir = static_cast<LEGACYFILEDLG_NEW_PROJECT*>( dlg.GetExtraControl() )->CreateNewDir();
#endif
if( createNewDir )
pro.AppendDir( pro.GetName() );
@ -182,13 +170,8 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
// Add a "Create a new directory" checkbox
#if wxCHECK_VERSION( 3, 1, 7 )
FILEDLG_NEW_PROJECT newProjectHook;
dlg.SetCustomizeHook( newProjectHook );
#else
dlg.SetExtraControlCreator( &LEGACYFILEDLG_NEW_PROJECT::Create );
#endif
if( dlg.ShowModal() == wxID_CANCEL )
return -1;
@ -206,11 +189,7 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
fn.MakeAbsolute();
bool createNewDir = false;
#if wxCHECK_VERSION( 3, 1, 7 )
createNewDir = newProjectHook.GetCreateNewDir();
#else
createNewDir = static_cast<LEGACYFILEDLG_NEW_PROJECT*>( dlg.GetExtraControl() )->CreateNewDir();
#endif
// Append a new directory with the same name of the project file.
if( createNewDir )

View File

@ -1,54 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LEGACY_DIR_CHECKBOX_H_
#define LEGACY_DIR_CHECKBOX_H_
#include <wx/checkbox.h>
#include <wx/panel.h>
#include <wx/sizer.h>
///< Helper widget to select whether a new directory should be created for a project.
class LEGACYFILEDLG_NEW_PROJECT : public wxPanel
{
public:
LEGACYFILEDLG_NEW_PROJECT( wxWindow* aParent ) : wxPanel( aParent )
{
m_cbCreateDir =
new wxCheckBox( this, wxID_ANY, _( "Create a new folder for the project" ) );
m_cbCreateDir->SetValue( true );
wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
sizer->Add( m_cbCreateDir, 0, wxALL, 8 );
SetSizerAndFit( sizer );
}
bool CreateNewDir() const { return m_cbCreateDir->GetValue(); }
static wxWindow* Create( wxWindow* aParent )
{
return new LEGACYFILEDLG_NEW_PROJECT( aParent );
}
protected:
wxCheckBox* m_cbCreateDir;
};
#endif

View File

@ -25,20 +25,6 @@
#include <wx/gdicmn.h>
#include <wx/string.h>
// Some wxWidgets versions (for instance before 3.1.0) do not include
// this function, so add it if missing
#if !wxCHECK_VERSION( 3, 1, 0 )
#define USE_KICAD_WXSTRING_HASH // for common.cpp
///< Template specialization to enable wxStrings for certain containers (e.g. unordered_map)
namespace std
{
template<> struct hash<wxString>
{
size_t operator()( const wxString& s ) const;
};
}
#endif
/// Required to use wxPoint as key type in maps
#define USE_KICAD_WXPOINT_LESS_AND_HASH // for common.cpp
namespace std

View File

@ -789,7 +789,6 @@ void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
}
else
{
#if wxCHECK_VERSION( 3, 1, 4 ) // 3.1.4 required for wxDD_MULTIPLE
wxDirDialog dlg( nullptr, title, openDir,
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST | wxDD_MULTIPLE );
@ -799,42 +798,6 @@ void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
return;
dlg.GetPaths( files );
#else
wxDirDialog dlg( nullptr, title, openDir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
int result = dlg.ShowModal();
if( result == wxID_CANCEL )
return;
// is there a file extension configured to hunt out their containing folders?
if( !fileDesc.m_ExtensionsInDir.empty() )
{
wxDir rootDir( dlg.GetPath() );
LIBRARY_TRAVERSER traverser( fileDesc.m_ExtensionsInDir, rootDir.GetName() );
rootDir.Traverse( traverser );
traverser.GetPaths( files );
if( traverser.HasDirectoryOpenFailures() )
{
wxArrayString failedDirs;
traverser.GetPaths( failedDirs );
wxString detailedMsg = _( "The following directories could not be opened: \n" );
for( const wxString& path : failedDirs )
detailedMsg << path << wxT( "\n" );
DisplayErrorMessage( this, _( "Failed to open directories to look for libraries" ),
detailedMsg );
}
}
else
{
files.Add( dlg.GetPath() );
}
#endif
if( !files.IsEmpty() )
{

View File

@ -68,11 +68,7 @@
#include <wx/filedlg.h>
#include <wx/txtstrm.h>
#if wxCHECK_VERSION( 3, 1, 7 )
#include "widgets/filedlg_hook_save_project.h"
#else
#include "widgets/legacyfiledlg_save_project.h"
#endif
//#define USE_INSTRUMENTATION 1
#define USE_INSTRUMENTATION 0
@ -202,16 +198,10 @@ bool AskSaveBoardFileName( PCB_EDIT_FRAME* aParent, wxString* aFileName, bool* a
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
// Add a "Create a project" checkbox in standalone mode and one isn't loaded
#if wxCHECK_VERSION( 3, 1, 7 )
FILEDLG_HOOK_SAVE_PROJECT newProjectHook;
if( Kiface().IsSingle() && aParent->Prj().IsNullProject() )
dlg.SetCustomizeHook( newProjectHook );
#else
if( Kiface().IsSingle() && aParent->Prj().IsNullProject() )
dlg.SetExtraControlCreator( &LEGACYFILEDLG_SAVE_PROJECT::Create );
#endif
if( dlg.ShowModal() != wxID_OK )
return false;
@ -219,17 +209,10 @@ bool AskSaveBoardFileName( PCB_EDIT_FRAME* aParent, wxString* aFileName, bool* a
*aFileName = dlg.GetPath();
*aFileName = EnsureFileExtension( *aFileName, KiCadPcbFileExtension );
#if wxCHECK_VERSION( 3, 1, 7 )
if( newProjectHook.IsAttachedToDialog() )
*aCreateProject = newProjectHook.GetCreateNewProject();
else if( !aParent->Prj().IsNullProject() )
*aCreateProject = true;
#else
if( wxWindow* ec = dlg.GetExtraControl() )
*aCreateProject = static_cast<LEGACYFILEDLG_SAVE_PROJECT*>( ec )->GetValue();
else if( !aParent->Prj().IsNullProject() )
*aCreateProject = true;
#endif
return true;
}

View File

@ -1,56 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LEGACYFILEDLG_SAVE_PROJ_H_
#define LEGACYFILEDLG_SAVE_PROJ_H_
#include <wx/checkbox.h>
#include <wx/panel.h>
#include <wx/sizer.h>
///< Helper widget to select whether a new project should be created for a file when saving
class LEGACYFILEDLG_SAVE_PROJECT : public wxPanel
{
public:
LEGACYFILEDLG_SAVE_PROJECT( wxWindow* aParent ) : wxPanel( aParent )
{
m_cbCreateProject =
new wxCheckBox( this, wxID_ANY, _( "Create a new project for this board" ) );
m_cbCreateProject->SetValue( true );
m_cbCreateProject->SetToolTip( _( "Creating a project will enable features such as "
"design rules, net classes, and layer presets" ) );
wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
sizer->Add( m_cbCreateProject, 0, wxALL, 8 );
SetSizerAndFit( sizer );
}
bool GetValue() const { return m_cbCreateProject->GetValue(); }
static wxWindow* Create( wxWindow* aParent )
{
return new LEGACYFILEDLG_SAVE_PROJECT( aParent );
}
protected:
wxCheckBox* m_cbCreateProject;
};
#endif