Move preferences-lost hack down into EDA_DRAW_FRAME.

I've now seen it in Eeschema as well as Pcbnew.

Fixes: lp:1839148
* https://bugs.launchpad.net/kicad/+bug/1839148
This commit is contained in:
Jeff Young 2019-08-09 21:04:59 +01:00
parent bc07c7da11
commit 17b5a3750b
5 changed files with 30 additions and 23 deletions

View File

@ -159,6 +159,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
wxSize( m_FrameSize.x, m_MsgFrameHeight ) );
m_messagePanel->SetBackgroundColour( COLOR4D( LIGHTGRAY ).ToColour() );
Connect( wxEVT_ACTIVATE, wxActivateEventHandler( EDA_DRAW_FRAME::onActivate ), NULL, this );
Connect( wxEVT_IDLE, wxIdleEventHandler( EDA_DRAW_FRAME::onIdle ), NULL, this );
}
@ -187,6 +190,29 @@ EDA_DRAW_FRAME::~EDA_DRAW_FRAME()
m_auimgr.UnInit();
ReleaseFile();
Disconnect( wxEVT_ACTIVATE, wxActivateEventHandler( EDA_DRAW_FRAME::onActivate ), NULL, this );
Disconnect( wxEVT_IDLE, wxIdleEventHandler( EDA_DRAW_FRAME::onIdle ), NULL, this );
}
void EDA_DRAW_FRAME::onActivate( wxActivateEvent& event )
{
#ifdef __WXMAC__
// Work around wxWidgets bug where the OSX Preferences item gets lost when reactivating
// a draw frame...
m_menuBarDirty = true;
#endif
}
void EDA_DRAW_FRAME::onIdle( wxIdleEvent& event )
{
if( m_menuBarDirty )
{
m_menuBarDirty = false;
ReCreateMenuBar();
}
}

View File

@ -114,6 +114,7 @@ protected:
bool m_showBorderAndTitleBlock; // Show the worksheet (border and title block).
long m_firstRunDialogSetting; // Show first run dialog on startup
bool m_menuBarDirty;
wxChoice* m_gridSelectBox;
wxChoice* m_zoomSelectBox;
@ -132,6 +133,9 @@ protected:
/// The current canvas type
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType;
void onActivate( wxActivateEvent& event );
void onIdle( wxIdleEvent& event );
virtual void SetScreen( BASE_SCREEN* aScreen ) { m_currentScreen = aScreen; }
double bestZoom( double sizeX, double sizeY, double scaleFactor, wxPoint centre );

View File

@ -515,7 +515,6 @@ 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

View File

@ -111,8 +111,6 @@ 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 )
@ -461,22 +459,6 @@ void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
}
void PCB_EDIT_FRAME::OnActivate( wxActivateEvent& event )
{
#ifdef __WXMAC__
// Work around wxWidgets bug where the Preferences item gets lost...
m_menuBarDirty = true;
#endif
}
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,7 +280,6 @@ 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;
@ -299,9 +298,6 @@ public:
*/
void LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter );
void OnActivate( wxActivateEvent& event );
void OnIdle( wxIdleEvent& event );
void OnQuit( wxCommandEvent& event );
/**