Gerbview, gerbview_selection_tool.cpp: add missing code to rebuild the view menu.

This commit is contained in:
jean-pierre charras 2019-05-19 12:39:37 +02:00
parent 5137b54bd8
commit ab6521ff9e
2 changed files with 20 additions and 0 deletions

View File

@ -149,6 +149,22 @@ GERBVIEW_SELECTION_TOOL::GERBVIEW_SELECTION_TOOL() :
}
int GERBVIEW_SELECTION_TOOL::UpdateMenu( const TOOL_EVENT& aEvent )
{
ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
if( conditionalMenu )
conditionalMenu->Evaluate( m_selection );
if( actionMenu )
actionMenu->UpdateAll();
return 0;
}
GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL()
{
getView()->Remove( &m_selection );
@ -457,6 +473,7 @@ bool GERBVIEW_SELECTION_TOOL::selectMultiple()
void GERBVIEW_SELECTION_TOOL::setTransitions()
{
Go( &GERBVIEW_SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() );
Go( &GERBVIEW_SELECTION_TOOL::Main, GERBVIEW_ACTIONS::selectionActivate.MakeEvent() );
Go( &GERBVIEW_SELECTION_TOOL::CursorSelection, GERBVIEW_ACTIONS::selectionCursor.MakeEvent() );
Go( &GERBVIEW_SELECTION_TOOL::ClearSelection, GERBVIEW_ACTIONS::selectionClear.MakeEvent() );

View File

@ -58,6 +58,9 @@ public:
/// @copydoc TOOL_BASE::Reset()
void Reset( RESET_REASON aReason ) override;
// called to rebuild a CONDITIONAL_MENU before opening it:
int UpdateMenu( const TOOL_EVENT& aEvent );
/**
* Function Main()
*