Check for single item seletion for most property dialogs.
This commit is contained in:
parent
23927957e1
commit
ba301c292a
|
@ -52,9 +52,9 @@ const std::map<PLOT_DASH_TYPE, struct lineTypeStruct> lineTypeNames = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(
|
DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE( SCH_EDIT_FRAME* aParent,
|
||||||
SCH_EDIT_FRAME* aParent, std::deque<SCH_LINE*>& lines )
|
std::deque<SCH_LINE*>& lines ) :
|
||||||
: DIALOG_EDIT_LINE_STYLE_BASE( aParent ),
|
DIALOG_EDIT_LINE_STYLE_BASE( aParent ),
|
||||||
m_frame( aParent ),
|
m_frame( aParent ),
|
||||||
m_lines( lines ),
|
m_lines( lines ),
|
||||||
m_width( aParent, m_staticTextWidth, m_lineWidth, m_staticWidthUnits, true )
|
m_width( aParent, m_staticTextWidth, m_lineWidth, m_staticWidthUnits, true )
|
||||||
|
|
|
@ -1261,6 +1261,21 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
SCH_ITEM* item = (SCH_ITEM*) selection.Front();
|
SCH_ITEM* item = (SCH_ITEM*) selection.Front();
|
||||||
|
|
||||||
|
switch( item->Type() )
|
||||||
|
{
|
||||||
|
case SCH_LINE_T:
|
||||||
|
if( !selection.AreAllItemsIdentical() )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if( selection.Size() > 1 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case SCH_COMPONENT_T:
|
case SCH_COMPONENT_T:
|
||||||
|
@ -1293,14 +1308,17 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
doRefresh = m_frame->EditSheetProperties( sheet, g_CurrentSheet, &doClearAnnotation );
|
doRefresh = m_frame->EditSheetProperties( sheet, g_CurrentSheet, &doClearAnnotation );
|
||||||
|
|
||||||
if( doClearAnnotation ) // happens when the current sheet load a existing file
|
// If the sheet file is changed and new sheet contents are loaded then we have to
|
||||||
{ // we must clear "new" components annotation
|
// clear the annotations on the new content (as it may have been set from some other
|
||||||
|
// sheet path reference)
|
||||||
|
if( doClearAnnotation )
|
||||||
|
{
|
||||||
SCH_SCREENS screensList( g_RootSheet );
|
SCH_SCREENS screensList( g_RootSheet );
|
||||||
// We clear annotation of new sheet paths here:
|
// We clear annotation of new sheet paths here:
|
||||||
screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
|
screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
|
||||||
// Clear annotation of g_CurrentSheet itself, because its sheetpath
|
// Clear annotation of g_CurrentSheet itself, because its sheetpath is not a new
|
||||||
// is not a new path, but components managed by its sheet path must have
|
// path, but components managed by its sheet path must have their annotation
|
||||||
// their annotation cleared, because they are new:
|
// cleared, because they are new:
|
||||||
sheet->GetScreen()->ClearAnnotation( g_CurrentSheet );
|
sheet->GetScreen()->ClearAnnotation( g_CurrentSheet );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1316,7 +1334,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
case SCH_SHEET_PIN_T:
|
case SCH_SHEET_PIN_T:
|
||||||
{
|
{
|
||||||
SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) item;
|
SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) item;
|
||||||
DIALOG_EDIT_SHEET_PIN dlg( m_frame, pin );
|
DIALOG_EDIT_SHEET_PIN dlg( m_frame, pin );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_OK )
|
if( dlg.ShowModal() == wxID_OK )
|
||||||
|
@ -1366,24 +1384,19 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
case SCH_LINE_T:
|
case SCH_LINE_T:
|
||||||
{
|
{
|
||||||
if( !selection.AreAllItemsIdentical() )
|
std::deque<SCH_LINE*> graphicLines;
|
||||||
break;
|
|
||||||
|
|
||||||
std::deque<SCH_LINE*> lines;
|
for( EDA_ITEM* selItem : selection.Items() )
|
||||||
for( auto selItem : selection.Items() )
|
|
||||||
{
|
{
|
||||||
SCH_LINE* line = dynamic_cast<SCH_LINE*>( selItem );
|
SCH_LINE* line = dynamic_cast<SCH_LINE*>( selItem );
|
||||||
|
|
||||||
if( line )
|
if( line && line->IsGraphicLine() )
|
||||||
lines.push_back( line );
|
graphicLines.push_back( line );
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify we are only editing graphic lines
|
DIALOG_EDIT_LINE_STYLE dlg( m_frame, graphicLines );
|
||||||
if( !std::all_of( lines.begin(), lines.end(),
|
|
||||||
[&]( const SCH_LINE* r ) { return r->IsGraphicLine(); } ) )
|
|
||||||
break;
|
|
||||||
|
|
||||||
DIALOG_EDIT_LINE_STYLE dlg( m_frame, lines );
|
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_OK )
|
if( dlg.ShowModal() == wxID_OK )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue