Work around a wxWidgets bug that loses the preferences item from the menu.

Fixes: lp:1839148
* https://bugs.launchpad.net/kicad/+bug/1839148
This commit is contained in:
Jeff Young 2019-08-06 11:49:33 -06:00
parent 2a3e82a144
commit 4399a52ad3
4 changed files with 28 additions and 8 deletions

View File

@ -27,12 +27,10 @@
#include <fctsys.h>
#include <tool/conditional_menu.h>
#include <eda_3d_viewer.h>
#include <3d_canvas/cinfo3d_visu.h>
#include <menus_helpers.h>
#include <3d_viewer_id.h>
#include <3d_actions.h>
#include <tool/tool_manager.h>
#include <tool/conditional_menu.h>
#include <tool/common_control.h>
#include "help_common_strings.h"
@ -324,6 +322,13 @@ void EDA_3D_VIEWER::CreateMenuBar()
prefsMenu->AddItem( ID_MENU3D_RESET_DEFAULTS, _( "Reset to Default Settings" ), "",
tools_xpm, SELECTION_CONDITIONS::ShowAlways );
#ifdef __APPLE__ // Note: will get moved to Apple menu by wxWidgets
prefsMenu->AddItem( wxID_PREFERENCES,
_( "Preferences...\tCTRL+," ),
_( "Show preferences for all open tools" ),
preference_xpm, SELECTION_CONDITIONS::ShowAlways );
#endif
prefsMenu->Resolve();
//-- Menubar -------------------------------------------------------------

View File

@ -515,10 +515,10 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
SetMenuBar( menuBar );
delete oldMenuBar;
m_menuBarDirty = false;
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
// Populate the Action Plugin sub-menu
buildActionPluginMenus( submenuActionPlugins );
#endif
}

View File

@ -25,8 +25,6 @@
#include <pgm_base.h>
#include <confirm.h>
#include <pcb_edit_frame.h>
#include <collectors.h>
#include <build_version.h>
#include <3d_viewer/eda_3d_viewer.h>
#include <fp_lib_table.h>
#include <bitmaps.h>
@ -38,13 +36,11 @@
#include <pcb_layer_widget.h>
#include <config_params.h>
#include <footprint_edit_frame.h>
#include <dialog_helpers.h>
#include <dialog_plot.h>
#include <dialog_edit_footprint_for_BoardEditor.h>
#include <dialogs/dialog_exchange_footprints.h>
#include <dialog_board_setup.h>
#include <convert_to_biu.h>
#include <view/view.h>
#include <view/view_controls.h>
#include <pcb_painter.h>
#include <invoke_pcb_dialog.h>
@ -57,7 +53,6 @@
#include <wildcards_and_files_ext.h>
#include <kicad_string.h>
#include <pcb_draw_panel_gal.h>
#include <gal/graphics_abstraction_layer.h>
#include <functional>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
@ -116,6 +111,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_CHOICE( ID_ON_ZOOM_SELECT, PCB_EDIT_FRAME::OnSelectZoom )
EVT_CHOICE( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid )
EVT_ACTIVATE( PCB_EDIT_FRAME::OnActivate )
EVT_IDLE( PCB_EDIT_FRAME::OnIdle )
EVT_CLOSE( PCB_EDIT_FRAME::OnCloseWindow )
EVT_SIZE( PCB_EDIT_FRAME::OnSize )
@ -464,6 +461,20 @@ void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
}
void PCB_EDIT_FRAME::OnActivate( wxActivateEvent& event )
{
// Work around wxWidgets bug where the Preferences item gets lost...
m_menuBarDirty = true;
}
void PCB_EDIT_FRAME::OnIdle( wxIdleEvent& event )
{
if( m_menuBarDirty )
ReCreateMenuBar();
}
void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
if( GetScreen()->IsModify() && !GetBoard()->IsEmpty() )

View File

@ -280,6 +280,7 @@ public:
wxChoice* m_SelTrackWidthBox; // a choice box to display and select current track width
wxChoice* m_SelViaSizeBox; // a choice box to display and select current via diameter
bool m_menuBarDirty;
bool m_show_microwave_tools;
bool m_show_layer_manager_tools;
@ -298,6 +299,9 @@ public:
*/
void LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter );
void OnActivate( wxActivateEvent& event );
void OnIdle( wxIdleEvent& event );
void OnQuit( wxCommandEvent& event );
/**