Fixed updating of Zoom & Grid context menus.
This commit is contained in:
parent
094c286024
commit
29cbaa206e
|
@ -61,7 +61,6 @@ CONTEXT_MENU::~CONTEXT_MENU()
|
|||
CONTEXT_MENU& CONTEXT_MENU::operator=( const CONTEXT_MENU& aMenu )
|
||||
{
|
||||
Clear();
|
||||
|
||||
copyFrom( aMenu );
|
||||
|
||||
return *this;
|
||||
|
@ -158,9 +157,6 @@ std::list<wxMenuItem*> CONTEXT_MENU::Add( CONTEXT_MENU* aMenu, const wxString& a
|
|||
}
|
||||
}
|
||||
|
||||
m_submenus.push_back( aMenu );
|
||||
aMenu->m_parent = this;
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
|
@ -191,7 +187,8 @@ void CONTEXT_MENU::UpdateAll()
|
|||
std::cerr << "CONTEXT_MENU error running update handler: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
updateHotKeys();
|
||||
if( m_tool )
|
||||
updateHotKeys();
|
||||
|
||||
runOnSubmenus( boost::bind( &CONTEXT_MENU::UpdateAll, _1 ) );
|
||||
}
|
||||
|
@ -378,7 +375,7 @@ void CONTEXT_MENU::copyFrom( const CONTEXT_MENU& aMenu )
|
|||
|
||||
OPT_TOOL_EVENT CONTEXT_MENU::menuHandlerStub( const wxMenuEvent& )
|
||||
{
|
||||
return OPT_TOOL_EVENT();
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -598,6 +598,7 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
|
|||
st->pendingWait = true;
|
||||
st->waitEvents = TOOL_EVENT( TC_ANY, TA_ANY );
|
||||
|
||||
// Store the menu pointer in case it is changed by the TOOL when handling menu events
|
||||
CONTEXT_MENU* m = st->contextMenu;
|
||||
|
||||
if( st->contextMenuTrigger == CMENU_NOW )
|
||||
|
@ -610,7 +611,7 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
|
|||
m_viewControls->ForceCursorPosition( true, m_viewControls->GetCursorPosition() );
|
||||
|
||||
// Run update handlers
|
||||
st->contextMenu->UpdateAll();
|
||||
m->UpdateAll();
|
||||
|
||||
boost::scoped_ptr<CONTEXT_MENU> menu( new CONTEXT_MENU( *m ) );
|
||||
GetEditFrame()->PopupMenu( menu.get() );
|
||||
|
|
|
@ -509,7 +509,7 @@ void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
|
|||
|
||||
for( unsigned i = 0; i < GetScreen()->m_ZoomList.size(); i++ )
|
||||
{
|
||||
if( zoom == GetScreen()->m_ZoomList[i] )
|
||||
if( std::fabs( zoom - GetScreen()->m_ZoomList[i] ) < 1e-6 )
|
||||
{
|
||||
current = i + 1;
|
||||
break;
|
||||
|
|
|
@ -64,6 +64,7 @@ CONTEXT_MENU* CONDITIONAL_MENU::Generate( SELECTION& aSelection )
|
|||
break;
|
||||
|
||||
case ENTRY::MENU:
|
||||
it->Menu()->UpdateAll();
|
||||
m_menu->Add( it->Menu(), it->Label(), it->Expand() );
|
||||
break;
|
||||
|
||||
|
|
|
@ -67,5 +67,5 @@ void ZOOM_MENU::Update()
|
|||
const std::vector<double>& zoomList = m_parent->GetScreen()->m_ZoomList;
|
||||
|
||||
for( unsigned int i = 0; i < GetMenuItemCount(); ++i )
|
||||
Check( ID_POPUP_ZOOM_LEVEL_START + i, zoomList[i] == zoom );
|
||||
Check( ID_POPUP_ZOOM_LEVEL_START + i, std::fabs( zoomList[i] - zoom ) < 1e-6 );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue