Disable pin table and part properties when there's no part.

Fixes: lp:1828962
* https://bugs.launchpad.net/kicad/+bug/1828962
This commit is contained in:
Jeff Young 2019-05-16 23:50:54 +01:00
parent 68224e0fcd
commit 5dd71b5563
2 changed files with 12 additions and 14 deletions

View File

@ -192,23 +192,21 @@ bool EE_SELECTION_TOOL::Init()
auto wireSelection = EE_CONDITIONS::MoreThan( 0 )
&& EE_CONDITIONS::OnlyType( SCH_LINE_LOCATE_WIRE_T );
auto busSelection = EE_CONDITIONS::MoreThan( 0 )
&& EE_CONDITIONS::OnlyType( SCH_LINE_LOCATE_BUS_T );
auto wireOrBusSelection = EE_CONDITIONS::MoreThan( 0 )
&& EE_CONDITIONS::OnlyTypes( wireOrBusTypes );
auto sheetSelection = SELECTION_CONDITIONS::Count( 1 )
&& SELECTION_CONDITIONS::OnlyType( SCH_SHEET_T );
auto libEdit = [this] ( const SELECTION& aSel ) {
return m_isLibEdit;
auto schEditCondition = [this] ( const SELECTION& aSel ) {
return !m_isLibEdit;
};
auto belowRootSheetCondition = [this] ( const SELECTION& aSel ) {
return !m_isLibEdit && g_CurrentSheet->Last() != g_RootSheet;
};
auto havePartCondition = [ this ] ( const SELECTION& sel ) {
return m_isLibEdit && ( (LIB_EDIT_FRAME*) m_frame )->GetCurPart();
};
auto& menu = m_menu.GetMenu();
@ -217,8 +215,8 @@ bool EE_SELECTION_TOOL::Init()
menu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 1 );
menu.AddSeparator( EE_CONDITIONS::Empty, 100 );
menu.AddItem( EE_ACTIONS::startWire, !libEdit && EE_CONDITIONS::Empty, 100 );
menu.AddItem( EE_ACTIONS::startBus, !libEdit && EE_CONDITIONS::Empty, 100 );
menu.AddItem( EE_ACTIONS::startWire, schEditCondition && EE_CONDITIONS::Empty, 100 );
menu.AddItem( EE_ACTIONS::startBus, schEditCondition && EE_CONDITIONS::Empty, 100 );
menu.AddSeparator( SCH_WIRE_BUS_TOOL::IsDrawingWire, 100 );
menu.AddItem( EE_ACTIONS::finishWire, SCH_WIRE_BUS_TOOL::IsDrawingWire, 100 );
@ -236,9 +234,9 @@ bool EE_SELECTION_TOOL::Init()
menu.AddItem( EE_ACTIONS::breakBus, busSelection && EE_CONDITIONS::Idle, 200 );
menu.AddItem( EE_ACTIONS::importSheetPin, sheetSelection && EE_CONDITIONS::Idle, 200 );
menu.AddSeparator( libEdit && EE_CONDITIONS::Empty, 400 );
menu.AddItem( EE_ACTIONS::symbolProperties, libEdit && EE_CONDITIONS::Empty, 400 );
menu.AddItem( EE_ACTIONS::pinTable, libEdit && EE_CONDITIONS::Empty, 400 );
menu.AddSeparator( havePartCondition && EE_CONDITIONS::Empty, 400 );
menu.AddItem( EE_ACTIONS::symbolProperties, havePartCondition && EE_CONDITIONS::Empty, 400 );
menu.AddItem( EE_ACTIONS::pinTable, havePartCondition && EE_CONDITIONS::Empty, 400 );
menu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1000 );
m_menu.AddStandardSubMenus( m_frame );

View File

@ -663,11 +663,11 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
m_frame->InitSheet( sheet, sheet->GetFileName() );
}
item->SetFlags( IS_NEW | IS_MOVED );
item->SetFlags( IS_NEW | IS_PASTED | IS_MOVED );
m_frame->AddItemToScreenAndUndoList( (SCH_ITEM*) item, i > 0 );
// Reset flags for subsequent move operation
item->SetFlags( IS_NEW | IS_MOVED );
item->SetFlags( IS_NEW | IS_PASTED | IS_MOVED );
}
if( sheetsPasted )