Mark unfold bus menu as clean so it doesn't get generated a second time.
Fixes: lp:1829878 * https://bugs.launchpad.net/kicad/+bug/1829878
This commit is contained in:
parent
1636405b66
commit
0047f88f82
|
@ -39,7 +39,7 @@ using namespace std::placeholders;
|
|||
|
||||
|
||||
ACTION_MENU::ACTION_MENU() :
|
||||
m_Dirty( true ),
|
||||
m_dirty( true ),
|
||||
m_titleDisplayed( false ),
|
||||
m_selected( -1 ),
|
||||
m_tool( nullptr ),
|
||||
|
@ -244,6 +244,20 @@ void ACTION_MENU::UpdateAll()
|
|||
}
|
||||
|
||||
|
||||
void ACTION_MENU::ClearDirty()
|
||||
{
|
||||
m_dirty = false;
|
||||
runOnSubmenus( std::bind( &ACTION_MENU::ClearDirty, _1 ) );
|
||||
}
|
||||
|
||||
|
||||
void ACTION_MENU::SetDirty()
|
||||
{
|
||||
m_dirty = true;
|
||||
runOnSubmenus( std::bind( &ACTION_MENU::SetDirty, _1 ) );
|
||||
}
|
||||
|
||||
|
||||
void ACTION_MENU::SetTool( TOOL_INTERACTIVE* aTool )
|
||||
{
|
||||
m_tool = aTool;
|
||||
|
@ -319,7 +333,7 @@ void ACTION_MENU::OnMenuEvent( wxMenuEvent& aEvent )
|
|||
|
||||
wxEventType type = aEvent.GetEventType();
|
||||
|
||||
if( type == wxEVT_MENU_OPEN && m_Dirty )
|
||||
if( type == wxEVT_MENU_OPEN && m_dirty )
|
||||
{
|
||||
if( m_tool )
|
||||
getToolManager()->RunAction( ACTIONS::updateMenu, true, this );
|
||||
|
|
|
@ -60,14 +60,14 @@ void TOOL_MENU::ShowContextMenu( SELECTION& aSelection )
|
|||
{
|
||||
m_menu.Evaluate( aSelection );
|
||||
m_menu.UpdateAll();
|
||||
m_menu.m_Dirty = false;
|
||||
m_menu.ClearDirty();
|
||||
m_tool.SetContextMenu( &m_menu, CMENU_NOW );
|
||||
}
|
||||
|
||||
|
||||
void TOOL_MENU::ShowContextMenu()
|
||||
{
|
||||
m_menu.m_Dirty = true;
|
||||
m_menu.SetDirty();
|
||||
m_tool.SetContextMenu( &m_menu, CMENU_NOW );
|
||||
}
|
||||
|
||||
|
|
|
@ -126,6 +126,8 @@ private:
|
|||
SELECTION& selection = selTool->RequestSelection( busType );
|
||||
SCH_LINE* bus = (SCH_LINE*) selection.Front();
|
||||
|
||||
Clear();
|
||||
|
||||
// TODO(JE) remove once real-time is enabled
|
||||
if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
|
||||
{
|
||||
|
@ -166,7 +168,7 @@ private:
|
|||
|
||||
if( member->Type() == CONNECTION_BUS )
|
||||
{
|
||||
wxMenu* submenu = new ACTION_MENU;
|
||||
ACTION_MENU* submenu = new ACTION_MENU;
|
||||
AppendSubMenu( submenu, name );
|
||||
|
||||
for( const auto& sub_member : member->Members() )
|
||||
|
|
|
@ -128,6 +128,13 @@ public:
|
|||
*/
|
||||
void UpdateAll();
|
||||
|
||||
/**
|
||||
* Function ClearDirty()
|
||||
* Clears the dirty flag on the menu and all descendants.
|
||||
*/
|
||||
void ClearDirty();
|
||||
void SetDirty();
|
||||
|
||||
/**
|
||||
* Function SetTool()
|
||||
* Sets a tool that is the creator of the menu.
|
||||
|
@ -140,10 +147,6 @@ public:
|
|||
*/
|
||||
ACTION_MENU* Clone() const;
|
||||
|
||||
public:
|
||||
///> Menu requires updating before display.
|
||||
bool m_Dirty;
|
||||
|
||||
///> The default menu event handler.
|
||||
void OnMenuEvent( wxMenuEvent& aEvent );
|
||||
|
||||
|
@ -206,6 +209,9 @@ protected:
|
|||
///> Checks if any of submenus contains a TOOL_ACTION with a specific ID.
|
||||
OPT_TOOL_EVENT findToolAction( int aId );
|
||||
|
||||
///> Menu requires updating before display.
|
||||
bool m_dirty;
|
||||
|
||||
///> Flag indicating that the menu title was set up.
|
||||
bool m_titleDisplayed;
|
||||
|
||||
|
|
Loading…
Reference in New Issue