Add import-sheet-pin error message and move messages to status popups.
Fixes: lp:1829314 * https://bugs.launchpad.net/kicad/+bug/1829314
This commit is contained in:
parent
6630a7227d
commit
0dd1584394
|
@ -910,7 +910,7 @@ public:
|
||||||
* @param aSheet The sheet to add the new sheet pin to.
|
* @param aSheet The sheet to add the new sheet pin to.
|
||||||
* @return The new sheet pin object created or NULL if the task was aborted by the user.
|
* @return The new sheet pin object created or NULL if the task was aborted by the user.
|
||||||
*/
|
*/
|
||||||
SCH_SHEET_PIN* CreateSheetPin( SCH_SHEET* aSheet );
|
SCH_SHEET_PIN* CreateSheetPin( SCH_SHEET* aSheet, SCH_HIERLABEL* aLabel );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the dialog for editing the parameters of \a aSheetPin.
|
* Display the dialog for editing the parameters of \a aSheetPin.
|
||||||
|
@ -922,13 +922,11 @@ public:
|
||||||
int EditSheetPin( SCH_SHEET_PIN* aSheetPin, bool aRedraw );
|
int EditSheetPin( SCH_SHEET_PIN* aSheetPin, bool aRedraw );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatically create a sheet pin from the hierarchical labels in the schematic
|
* Import a hierarchical label with no attached sheet pin.
|
||||||
* referenced by \a aSheet.
|
|
||||||
*
|
*
|
||||||
* @param aSheet The sheet to import the new sheet pin to.
|
* @param aSheet The sheet to import the new sheet pin to.
|
||||||
* @return The new sheet pin object imported or NULL if the task was aborted by the user.
|
|
||||||
*/
|
*/
|
||||||
SCH_SHEET_PIN* ImportSheetPin( SCH_SHEET* aSheet );
|
SCH_HIERLABEL* ImportHierLabel( SCH_SHEET* aSheet );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a given junction and heals any wire segments under the junction
|
* Removes a given junction and heals any wire segments under the junction
|
||||||
|
|
|
@ -342,22 +342,31 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, bool aRedraw )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet )
|
SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, SCH_HIERLABEL* aLabel )
|
||||||
{
|
{
|
||||||
wxString line;
|
wxString text;
|
||||||
SCH_SHEET_PIN* sheetPin;
|
SCH_SHEET_PIN* sheetPin;
|
||||||
|
|
||||||
sheetPin = new SCH_SHEET_PIN( aSheet, wxPoint( 0, 0 ), line );
|
if( aLabel )
|
||||||
|
{
|
||||||
|
text = aLabel->GetText();
|
||||||
|
m_lastSheetPinType = aLabel->GetShape();
|
||||||
|
}
|
||||||
|
|
||||||
|
sheetPin = new SCH_SHEET_PIN( aSheet, wxPoint( 0, 0 ), text );
|
||||||
sheetPin->SetFlags( IS_NEW );
|
sheetPin->SetFlags( IS_NEW );
|
||||||
sheetPin->SetTextSize( GetLastSheetPinTextSize() );
|
sheetPin->SetTextSize( GetLastSheetPinTextSize() );
|
||||||
sheetPin->SetShape( m_lastSheetPinType );
|
sheetPin->SetShape( m_lastSheetPinType );
|
||||||
|
|
||||||
int response = EditSheetPin( sheetPin, false );
|
if( !aLabel )
|
||||||
|
|
||||||
if( sheetPin->GetText().IsEmpty() || (response == wxID_CANCEL) )
|
|
||||||
{
|
{
|
||||||
delete sheetPin;
|
int response = EditSheetPin( sheetPin, false );
|
||||||
return NULL;
|
|
||||||
|
if( sheetPin->GetText().IsEmpty() || (response == wxID_CANCEL) )
|
||||||
|
{
|
||||||
|
delete sheetPin;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastSheetPinType = sheetPin->GetShape();
|
m_lastSheetPinType = sheetPin->GetShape();
|
||||||
|
@ -369,43 +378,22 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET_PIN* SCH_EDIT_FRAME::ImportSheetPin( SCH_SHEET* aSheet )
|
SCH_HIERLABEL* SCH_EDIT_FRAME::ImportHierLabel( SCH_SHEET* aSheet )
|
||||||
{
|
{
|
||||||
EDA_ITEM* item;
|
|
||||||
SCH_SHEET_PIN* sheetPin;
|
|
||||||
SCH_HIERLABEL* label = NULL;
|
|
||||||
|
|
||||||
if( !aSheet->GetScreen() )
|
if( !aSheet->GetScreen() )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
item = aSheet->GetScreen()->GetDrawItems();
|
for( EDA_ITEM* item = aSheet->GetScreen()->GetDrawItems(); item != NULL; item = item->Next() )
|
||||||
|
|
||||||
for( ; item != NULL; item = item->Next() )
|
|
||||||
{
|
{
|
||||||
if( item->Type() != SCH_HIER_LABEL_T )
|
if( item->Type() != SCH_HIER_LABEL_T )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
label = (SCH_HIERLABEL*) item;
|
SCH_HIERLABEL* label = (SCH_HIERLABEL*) item;
|
||||||
|
|
||||||
/* A global label has been found: check if there a corresponding sheet label. */
|
/* A global label has been found: check if there a corresponding sheet label. */
|
||||||
if( !aSheet->HasPin( label->GetText() ) )
|
if( !aSheet->HasPin( label->GetText() ) )
|
||||||
break;
|
return label;
|
||||||
|
|
||||||
label = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( label == NULL )
|
return nullptr;
|
||||||
{
|
|
||||||
DisplayInfoMessage( this, _( "No new hierarchical labels found." ) );
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
sheetPin = new SCH_SHEET_PIN( aSheet, wxPoint( 0, 0 ), label->GetText() );
|
|
||||||
sheetPin->SetFlags( IS_NEW );
|
|
||||||
sheetPin->SetTextSize( GetLastSheetPinTextSize() );
|
|
||||||
m_lastSheetPinType = label->GetShape();
|
|
||||||
sheetPin->SetShape( label->GetShape() );
|
|
||||||
sheetPin->SetPosition( GetCrossHairPosition() );
|
|
||||||
|
|
||||||
return sheetPin;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -658,25 +658,40 @@ int SCH_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
|
||||||
item = m_frame->CreateNewText( LAYER_NOTES );
|
item = m_frame->CreateNewText( LAYER_NOTES );
|
||||||
break;
|
break;
|
||||||
case SCH_SHEET_PIN_T:
|
case SCH_SHEET_PIN_T:
|
||||||
item = m_selectionTool->SelectPoint( cursorPos, EE_COLLECTOR::SheetsOnly );
|
{
|
||||||
|
SCH_HIERLABEL* label = nullptr;
|
||||||
if( item )
|
SCH_SHEET* sheet = (SCH_SHEET*) m_selectionTool->SelectPoint( cursorPos,
|
||||||
{
|
EE_COLLECTOR::SheetsOnly );
|
||||||
if( m_frame->GetToolId() == ID_IMPORT_SHEETPIN_TOOL )
|
if( !sheet )
|
||||||
item = m_frame->ImportSheetPin( (SCH_SHEET*) item );
|
|
||||||
else
|
|
||||||
item = m_frame->CreateSheetPin( (SCH_SHEET*) item );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
|
m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
|
||||||
m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
|
m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
|
||||||
m_statusPopup->SetText( _( "Click over a sheet to create a sheet pin" ) );
|
m_statusPopup->SetText( _( "Click over a sheet." ) );
|
||||||
m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
|
m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
|
||||||
m_statusPopup->Popup();
|
m_statusPopup->Popup();
|
||||||
m_statusPopup->Expire( 1500 );
|
m_statusPopup->Expire( 2000 );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( m_frame->GetToolId() == ID_IMPORT_SHEETPIN_TOOL )
|
||||||
|
{
|
||||||
|
label = m_frame->ImportHierLabel( sheet );
|
||||||
|
|
||||||
|
if( !label )
|
||||||
|
{
|
||||||
|
m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
|
||||||
|
m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
|
||||||
|
m_statusPopup->SetText( _( "No new hierarchical labels found." ) );
|
||||||
|
m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
|
||||||
|
m_statusPopup->Popup();
|
||||||
|
m_statusPopup->Expire( 2000 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
item = m_frame->CreateSheetPin( sheet, label );
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG( "doTwoClickPlace(): unknown type" );
|
wxFAIL_MSG( "doTwoClickPlace(): unknown type" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,7 +333,7 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
|
||||||
{
|
{
|
||||||
editFrame->SendCrossProbeNetName( netName );
|
editFrame->SendCrossProbeNetName( netName );
|
||||||
editFrame->SetStatusText( wxString::Format( _( "Highlighted net: %s" ),
|
editFrame->SetStatusText( wxString::Format( _( "Highlighted net: %s" ),
|
||||||
UnescapeString( netName ) ) );
|
UnescapeString( netName ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
editFrame->SetSelectedNetName( netName );
|
editFrame->SetSelectedNetName( netName );
|
||||||
|
|
Loading…
Reference in New Issue