← Back to team overview

kicad-developers team mailing list archive

Issue with wxWidgets 3.1.2 - MSW. Need GAL gurus help.

 

I very recently updated wxWidgets from 3.1.1 to 3.1.2

I ran into a problem with Pcbnew and Gerbview (Not eeschema, that has a
different event handler):
The context menus Zoom selection and Grid Selection are no longer
working (and presumably any other context submenu).

I had a look into this issue (MSW specific).
The 3.1.1 and the 3.1.2 have different behaviors.

The attached patch fixes this issue.

However I do not understand this code in context_menu.cpp line 361:
 if( menu && menu != this )

The condition " && menu != this" is the culprit:
in wxWidgets 3.1.2, menu == this happens always.
in wxWidgets 3.1.2, menu == this happens never.

This line has no comment, and must be modified.

I'll be happy if Thomasz or Orson could have a look into that issue, and
that change and if this condition can be explained, if it is needed.

Thanks,

-- 
Jean-Pierre CHARRAS
 common/tool/context_menu.cpp | 6 +++++-
 common/tool/zoom_menu.cpp    | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/common/tool/context_menu.cpp b/common/tool/context_menu.cpp
index fb237486d..aa4100bcf 100644
--- a/common/tool/context_menu.cpp
+++ b/common/tool/context_menu.cpp
@@ -358,7 +358,11 @@ void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
                 wxMenu* menu = nullptr;
                 FindItem( m_selected, &menu );
 
-                if( menu && menu != this )
+    #if wxCHECK_VERSION(3, 1, 2)
+            if( menu )
+    #else
+            if( menu && menu != this )
+    #endif
                 {
                     CONTEXT_MENU* cxmenu = static_cast<CONTEXT_MENU*>( menu );
                     evt = cxmenu->eventHandler( aEvent );
diff --git a/common/tool/zoom_menu.cpp b/common/tool/zoom_menu.cpp
index 0ef6800ae..c080191e3 100644
--- a/common/tool/zoom_menu.cpp
+++ b/common/tool/zoom_menu.cpp
@@ -73,5 +73,9 @@ void ZOOM_MENU::update()
                                (int) screen->m_ZoomList.size() );
 
     for( int i = 0; i < maxZoomIds; ++i )
-        Check( ID_POPUP_ZOOM_LEVEL_START+1 + i, std::fabs( zoomList[i] - zoom ) < 1e-6 );
+    {
+        // Check the value near the current zoom:
+        double rel_error = std::fabs( zoomList[i] - zoom )/zoom;
+        Check( ID_POPUP_ZOOM_LEVEL_START+1 + i, rel_error < 0.1 );
+    }
 }

Follow ups