SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC ) { wxString line; SCH_SHEET_PIN* sheetPin; sheetPin = new SCH_SHEET_PIN( aSheet, wxPoint( 0, 0 ), line ); sheetPin->SetFlags( IS_NEW ); sheetPin->SetSize( m_lastSheetPinTextSize ); sheetPin->SetShape( m_lastSheetPinType ); int response = EditSheetPin( sheetPin, NULL ); if( sheetPin->GetText().IsEmpty() || (response == wxID_CANCEL) ) { delete sheetPin; return NULL; } m_lastSheetPinType = sheetPin->GetShape(); m_lastSheetPinTextSize = sheetPin->GetSize(); sheetPin->SetPosition( GetCrossHairPosition() ); sheetPin->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); MoveItem( (SCH_ITEM*) sheetPin, aDC ); OnModify(); return sheetPin; }
bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer ) { wxCHECK_MSG( aLayer == LAYER_NOTES || aLayer == LAYER_BUS || aLayer == LAYER_WIRE, false, wxT( "Invalid layer type passed to SCH_SCREEN::IsTerminalPoint()." ) ); SCH_SHEET_PIN* label; SCH_TEXT* text; switch( aLayer ) { case LAYER_BUS: if( GetBus( aPosition ) ) return true; label = GetSheetLabel( aPosition ); if( label && IsBusLabel( label->GetText() ) && label->IsConnected( aPosition ) ) return true; text = GetLabel( aPosition ); if( text && IsBusLabel( text->GetText() ) && text->IsConnected( aPosition ) && (text->Type() != SCH_LABEL_T) ) return true; break; case LAYER_NOTES: if( GetLine( aPosition ) ) return true; break; case LAYER_WIRE: if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_BUS_WIRE_ENTRY_T) ) return true; if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_BUS_BUS_ENTRY_T) ) return true; if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_JUNCTION_T ) ) return true; if( GetPin( aPosition, NULL, true ) ) return true; if( GetWire( aPosition ) ) return true; text = GetLabel( aPosition ); if( text && text->IsConnected( aPosition ) && !IsBusLabel( text->GetText() ) ) return true; label = GetSheetLabel( aPosition ); if( label && label->IsConnected( aPosition ) && !IsBusLabel( label->GetText() ) ) return true; break; default: break; } return false; }