Revert "Change the behavior of ACTION_MENU::Add to require clones if required outside the function"
This reverts commit 651f50a26d
.
This commit is contained in:
parent
57729414e3
commit
c2d72180f8
|
@ -183,20 +183,21 @@ wxMenuItem* ACTION_MENU::Add( const TOOL_ACTION& aAction, bool aIsCheckmarkEntry
|
|||
|
||||
wxMenuItem* ACTION_MENU::Add( ACTION_MENU* aMenu )
|
||||
{
|
||||
m_submenus.push_back( aMenu );
|
||||
ACTION_MENU* menuCopy = aMenu->Clone();
|
||||
m_submenus.push_back( menuCopy );
|
||||
|
||||
wxASSERT_MSG( !aMenu->m_title.IsEmpty(), wxT( "Set a title for ACTION_MENU using SetTitle()" ) );
|
||||
wxASSERT_MSG( !menuCopy->m_title.IsEmpty(), wxT( "Set a title for ACTION_MENU using SetTitle()" ) );
|
||||
|
||||
if( !!aMenu->m_icon )
|
||||
{
|
||||
wxMenuItem* newItem = new wxMenuItem( this, -1, aMenu->m_title );
|
||||
wxMenuItem* newItem = new wxMenuItem( this, -1, menuCopy->m_title );
|
||||
AddBitmapToMenuItem( newItem, KiBitmap( aMenu->m_icon ) );
|
||||
newItem->SetSubMenu( aMenu );
|
||||
newItem->SetSubMenu( menuCopy );
|
||||
return Append( newItem );
|
||||
}
|
||||
else
|
||||
{
|
||||
return AppendSubMenu( aMenu, aMenu->m_title );
|
||||
return AppendSubMenu( menuCopy, menuCopy->m_title );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->Add( ACTIONS::doNew );
|
||||
fileMenu->Add( ACTIONS::open );
|
||||
|
||||
wxMenuItem* item = fileMenu->Add( openRecentMenu->Clone() );
|
||||
wxMenuItem* item = fileMenu->Add( openRecentMenu );
|
||||
|
||||
// Add the file menu condition here since it needs the item ID for the submenu
|
||||
ACTION_CONDITIONS cond;
|
||||
|
|
|
@ -73,7 +73,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
}
|
||||
|
||||
fileMenu->Add( GERBVIEW_ACTIONS::openGerber );
|
||||
wxMenuItem* gbrItem = fileMenu->Add( openRecentGbrMenu->Clone() );
|
||||
wxMenuItem* gbrItem = fileMenu->Add( openRecentGbrMenu );
|
||||
RegisterUIUpdateHandler( gbrItem->GetId(), FileHistoryCond( recentGbrFiles) );
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
}
|
||||
|
||||
fileMenu->Add( GERBVIEW_ACTIONS::openDrillFile );
|
||||
wxMenuItem* drillItem = fileMenu->Add( openRecentDrlMenu->Clone() );
|
||||
wxMenuItem* drillItem = fileMenu->Add( openRecentDrlMenu );
|
||||
RegisterUIUpdateHandler( drillItem->GetId(), FileHistoryCond( m_drillFileHistory ) );
|
||||
|
||||
|
||||
|
@ -109,7 +109,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
}
|
||||
|
||||
fileMenu->Add( GERBVIEW_ACTIONS::openJobFile );
|
||||
wxMenuItem* jobItem = fileMenu->Add( openRecentJobMenu->Clone() );
|
||||
wxMenuItem* jobItem = fileMenu->Add( openRecentJobMenu );
|
||||
RegisterUIUpdateHandler( jobItem->GetId(), FileHistoryCond( m_jobFileHistory ) );
|
||||
|
||||
|
||||
|
@ -127,7 +127,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
}
|
||||
|
||||
fileMenu->Add( GERBVIEW_ACTIONS::openZipFile );
|
||||
wxMenuItem* zipItem = fileMenu->Add( openRecentZipMenu->Clone() );
|
||||
wxMenuItem* zipItem = fileMenu->Add( openRecentZipMenu );
|
||||
RegisterUIUpdateHandler( zipItem->GetId(), FileHistoryCond( m_zipFileHistory ) );
|
||||
|
||||
#undef FileHistoryCond
|
||||
|
|
|
@ -79,7 +79,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
|||
|
||||
fileMenu->Add( KICAD_MANAGER_ACTIONS::openProject );
|
||||
|
||||
wxMenuItem* item = fileMenu->Add( openRecentMenu->Clone() );
|
||||
wxMenuItem* item = fileMenu->Add( openRecentMenu );
|
||||
|
||||
// Add the file menu condition here since it needs the item ID for the submenu
|
||||
ACTION_CONDITIONS cond;
|
||||
|
|
|
@ -68,7 +68,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
|
|||
fileMenu->Add( ACTIONS::doNew );
|
||||
fileMenu->Add( ACTIONS::open );
|
||||
|
||||
wxMenuItem* item = fileMenu->Add( openRecentMenu->Clone() );
|
||||
wxMenuItem* item = fileMenu->Add( openRecentMenu );
|
||||
|
||||
// Add the file menu condition here since it needs the item ID for the submenu
|
||||
ACTION_CONDITIONS cond;
|
||||
|
|
|
@ -74,7 +74,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->Add( ACTIONS::doNew );
|
||||
fileMenu->Add( ACTIONS::open );
|
||||
|
||||
wxMenuItem* item = fileMenu->Add( openRecentMenu->Clone() );
|
||||
wxMenuItem* item = fileMenu->Add( openRecentMenu );
|
||||
|
||||
// Add the file menu condition here since it needs the item ID for the submenu
|
||||
ACTION_CONDITIONS cond;
|
||||
|
|
Loading…
Reference in New Issue