Remove linked-pin processing from LIB_PIN's setters.
It belongs in the tool layer (specifically LIB_PIN_TOOL).
This commit is contained in:
parent
a146cd9e2e
commit
dcd02539e3
|
@ -64,8 +64,6 @@ set( EESCHEMA_DLGS
|
||||||
dialogs/dialog_junction_props_base.cpp
|
dialogs/dialog_junction_props_base.cpp
|
||||||
dialogs/dialog_lib_edit_draw_item.cpp
|
dialogs/dialog_lib_edit_draw_item.cpp
|
||||||
dialogs/dialog_lib_edit_draw_item_base.cpp
|
dialogs/dialog_lib_edit_draw_item_base.cpp
|
||||||
dialogs/dialog_lib_edit_pin.cpp
|
|
||||||
dialogs/dialog_lib_edit_pin_base.cpp
|
|
||||||
dialogs/dialog_lib_edit_pin_table.cpp
|
dialogs/dialog_lib_edit_pin_table.cpp
|
||||||
dialogs/dialog_lib_edit_pin_table_base.cpp
|
dialogs/dialog_lib_edit_pin_table_base.cpp
|
||||||
dialogs/dialog_lib_edit_text.cpp
|
dialogs/dialog_lib_edit_text.cpp
|
||||||
|
@ -78,6 +76,8 @@ set( EESCHEMA_DLGS
|
||||||
dialogs/dialog_netlist_base.cpp
|
dialogs/dialog_netlist_base.cpp
|
||||||
dialogs/dialog_paste_special.cpp
|
dialogs/dialog_paste_special.cpp
|
||||||
dialogs/dialog_paste_special_base.cpp
|
dialogs/dialog_paste_special_base.cpp
|
||||||
|
dialogs/dialog_pin_properties.cpp
|
||||||
|
dialogs/dialog_pin_properties_base.cpp
|
||||||
dialogs/dialog_plot_schematic.cpp
|
dialogs/dialog_plot_schematic.cpp
|
||||||
dialogs/dialog_plot_schematic_base.cpp
|
dialogs/dialog_plot_schematic_base.cpp
|
||||||
dialogs/dialog_print_using_printer.cpp
|
dialogs/dialog_print_using_printer.cpp
|
||||||
|
|
|
@ -178,41 +178,51 @@ public:
|
||||||
case COL_NUMBER:
|
case COL_NUMBER:
|
||||||
pin->SetNumber( aValue );
|
pin->SetNumber( aValue );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_NAME:
|
case COL_NAME:
|
||||||
pin->SetName( aValue );
|
pin->SetName( aValue );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_TYPE:
|
case COL_TYPE:
|
||||||
if( g_typeNames.Index( aValue ) != wxNOT_FOUND )
|
if( g_typeNames.Index( aValue ) != wxNOT_FOUND )
|
||||||
pin->SetType( (ELECTRICAL_PINTYPE) g_typeNames.Index( aValue ), false );
|
pin->SetType( (ELECTRICAL_PINTYPE) g_typeNames.Index( aValue ) );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_SHAPE:
|
case COL_SHAPE:
|
||||||
if( g_shapeNames.Index( aValue ) != wxNOT_FOUND )
|
if( g_shapeNames.Index( aValue ) != wxNOT_FOUND )
|
||||||
pin->SetShape( (GRAPHIC_PINSHAPE) g_shapeNames.Index( aValue ) );
|
pin->SetShape( (GRAPHIC_PINSHAPE) g_shapeNames.Index( aValue ) );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_ORIENTATION:
|
case COL_ORIENTATION:
|
||||||
if( g_orientationNames.Index( aValue ) != wxNOT_FOUND )
|
if( g_orientationNames.Index( aValue ) != wxNOT_FOUND )
|
||||||
pin->SetOrientation( LIB_PIN::GetOrientationCode(
|
pin->SetOrientation( LIB_PIN::GetOrientationCode(
|
||||||
g_orientationNames.Index( aValue ) ), false );
|
g_orientationNames.Index( aValue ) ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_NUMBER_SIZE:
|
case COL_NUMBER_SIZE:
|
||||||
pin->SetNumberTextSize( ValueFromString( m_userUnits, aValue, true ) );
|
pin->SetNumberTextSize( ValueFromString( m_userUnits, aValue, true ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_NAME_SIZE:
|
case COL_NAME_SIZE:
|
||||||
pin->SetNameTextSize( ValueFromString( m_userUnits, aValue, true ) );
|
pin->SetNameTextSize( ValueFromString( m_userUnits, aValue, true ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_LENGTH:
|
case COL_LENGTH:
|
||||||
pin->SetLength( ValueFromString( m_userUnits, aValue ) );
|
pin->SetLength( ValueFromString( m_userUnits, aValue ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_POSX:
|
case COL_POSX:
|
||||||
pin->SetPinPosition( wxPoint( ValueFromString( m_userUnits, aValue ),
|
pin->SetPosition( wxPoint( ValueFromString( m_userUnits, aValue ),
|
||||||
pin->GetPosition().y ) );
|
pin->GetPosition().y ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_POSY:
|
case COL_POSY:
|
||||||
pin->SetPinPosition( wxPoint( pin->GetPosition().x,
|
pin->SetPosition( wxPoint( pin->GetPosition().x,
|
||||||
ValueFromString( m_userUnits, aValue ) ) );
|
ValueFromString( m_userUnits, aValue ) ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxFAIL;
|
wxFAIL;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -29,12 +29,12 @@
|
||||||
#include <lib_edit_frame.h>
|
#include <lib_edit_frame.h>
|
||||||
#include <class_libentry.h>
|
#include <class_libentry.h>
|
||||||
#include <lib_pin.h>
|
#include <lib_pin.h>
|
||||||
#include <dialog_lib_edit_pin.h>
|
#include <dialog_pin_properties.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <widgets/tab_traversal.h>
|
#include <widgets/tab_traversal.h>
|
||||||
|
|
||||||
DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( LIB_EDIT_FRAME* parent, LIB_PIN* aPin ) :
|
DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( LIB_EDIT_FRAME* parent, LIB_PIN* aPin ) :
|
||||||
DIALOG_LIB_EDIT_PIN_BASE( parent ),
|
DIALOG_PIN_PROPERTIES_BASE( parent ),
|
||||||
m_frame( parent ),
|
m_frame( parent ),
|
||||||
m_pin( aPin ),
|
m_pin( aPin ),
|
||||||
m_posX( parent, m_posXLabel, m_posXCtrl, m_posXUnits, true ),
|
m_posX( parent, m_posXLabel, m_posXCtrl, m_posXUnits, true ),
|
||||||
|
@ -46,11 +46,6 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( LIB_EDIT_FRAME* parent, LIB_PIN* aPin
|
||||||
// Creates a dummy pin to show on a panel, inside this dialog:
|
// Creates a dummy pin to show on a panel, inside this dialog:
|
||||||
m_dummyPin = new LIB_PIN( *m_pin );
|
m_dummyPin = new LIB_PIN( *m_pin );
|
||||||
|
|
||||||
// m_dummyPin changes do not propagate to other pins of the current lib component,
|
|
||||||
// so set parent to null and clear flags
|
|
||||||
m_dummyPin->SetParent( nullptr );
|
|
||||||
m_dummyPin->ClearFlags();
|
|
||||||
|
|
||||||
COLOR4D bgColor = parent->GetRenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND );
|
COLOR4D bgColor = parent->GetRenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||||
m_panelShowPin->SetBackgroundColour( bgColor.ToColour() );
|
m_panelShowPin->SetBackgroundColour( bgColor.ToColour() );
|
||||||
|
|
||||||
|
@ -92,13 +87,13 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( LIB_EDIT_FRAME* parent, LIB_PIN* aPin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DIALOG_LIB_EDIT_PIN::~DIALOG_LIB_EDIT_PIN()
|
DIALOG_PIN_PROPERTIES::~DIALOG_PIN_PROPERTIES()
|
||||||
{
|
{
|
||||||
delete m_dummyPin;
|
delete m_dummyPin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DIALOG_LIB_EDIT_PIN::TransferDataToWindow()
|
bool DIALOG_PIN_PROPERTIES::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
if( !DIALOG_SHIM::TransferDataToWindow() )
|
if( !DIALOG_SHIM::TransferDataToWindow() )
|
||||||
return false;
|
return false;
|
||||||
|
@ -125,7 +120,7 @@ bool DIALOG_LIB_EDIT_PIN::TransferDataToWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DIALOG_LIB_EDIT_PIN::TransferDataFromWindow()
|
bool DIALOG_PIN_PROPERTIES::TransferDataFromWindow()
|
||||||
{
|
{
|
||||||
if( !DIALOG_SHIM::TransferDataFromWindow() )
|
if( !DIALOG_SHIM::TransferDataFromWindow() )
|
||||||
return false;
|
return false;
|
||||||
|
@ -146,20 +141,17 @@ bool DIALOG_LIB_EDIT_PIN::TransferDataFromWindow()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_pin->GetEditFlags() == 0 )
|
|
||||||
m_frame->SaveCopyInUndoList( m_pin->GetParent() );
|
|
||||||
|
|
||||||
m_pin->SetName( m_textPinName->GetValue() );
|
m_pin->SetName( m_textPinName->GetValue() );
|
||||||
m_pin->SetNumber( m_textPinNumber->GetValue() );
|
m_pin->SetNumber( m_textPinNumber->GetValue() );
|
||||||
m_pin->SetNameTextSize( m_nameSize.GetValue() );
|
m_pin->SetNameTextSize( m_nameSize.GetValue() );
|
||||||
m_pin->SetNumberTextSize( m_numberSize.GetValue() );
|
m_pin->SetNumberTextSize( m_numberSize.GetValue() );
|
||||||
m_pin->SetOrientation( LIB_PIN::GetOrientationCode( m_choiceOrientation->GetSelection() ) );
|
m_pin->SetOrientation( LIB_PIN::GetOrientationCode( m_choiceOrientation->GetSelection() ) );
|
||||||
m_pin->SetLength( m_pinLength.GetValue() );
|
m_pin->SetLength( m_pinLength.GetValue() );
|
||||||
m_pin->SetPinPosition( newPos );
|
m_pin->SetPosition( newPos );
|
||||||
m_pin->SetType( m_choiceElectricalType->GetPinTypeSelection() );
|
m_pin->SetType( m_choiceElectricalType->GetPinTypeSelection() );
|
||||||
m_pin->SetShape( m_choiceStyle->GetPinShapeSelection() );
|
m_pin->SetShape( m_choiceStyle->GetPinShapeSelection() );
|
||||||
m_pin->SetConversion( m_checkApplyToAllConversions->GetValue() ? 0 : m_frame->GetConvert() );
|
m_pin->SetConvert( m_checkApplyToAllConversions->GetValue() ? 0 : m_frame->GetConvert() );
|
||||||
m_pin->SetPartNumber( m_checkApplyToAllParts->GetValue() ? 0 : m_frame->GetUnit() );
|
m_pin->SetUnit( m_checkApplyToAllParts->GetValue() ? 0 : m_frame->GetUnit() );
|
||||||
m_pin->SetVisible( m_checkShow->GetValue() );
|
m_pin->SetVisible( m_checkShow->GetValue() );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -169,7 +161,7 @@ bool DIALOG_LIB_EDIT_PIN::TransferDataFromWindow()
|
||||||
/*
|
/*
|
||||||
* Draw (on m_panelShowPin) the pin according to current settings in dialog
|
* Draw (on m_panelShowPin) the pin according to current settings in dialog
|
||||||
*/
|
*/
|
||||||
void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
|
void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
||||||
{
|
{
|
||||||
wxPaintDC dc( m_panelShowPin );
|
wxPaintDC dc( m_panelShowPin );
|
||||||
wxSize dc_size = dc.GetSize();
|
wxSize dc_size = dc.GetSize();
|
||||||
|
@ -179,7 +171,6 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
|
||||||
// In fact m_dummyPin should not have a parent, but draw functions need a parent
|
// In fact m_dummyPin should not have a parent, but draw functions need a parent
|
||||||
// to know some options, about pin texts
|
// to know some options, about pin texts
|
||||||
LIB_EDIT_FRAME* libframe = (LIB_EDIT_FRAME*) GetParent();
|
LIB_EDIT_FRAME* libframe = (LIB_EDIT_FRAME*) GetParent();
|
||||||
m_dummyPin->SetParent( libframe->GetCurPart() );
|
|
||||||
|
|
||||||
// Calculate a suitable scale to fit the available draw area
|
// Calculate a suitable scale to fit the available draw area
|
||||||
EDA_RECT bBox = m_dummyPin->GetBoundingBox( true );
|
EDA_RECT bBox = m_dummyPin->GetBoundingBox( true );
|
||||||
|
@ -200,13 +191,11 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
|
||||||
|
|
||||||
m_dummyPin->Print( renderSettings, -bBox.Centre(), (void*) &opts, DefaultTransform );
|
m_dummyPin->Print( renderSettings, -bBox.Centre(), (void*) &opts, DefaultTransform );
|
||||||
|
|
||||||
m_dummyPin->SetParent( nullptr );
|
|
||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event )
|
void DIALOG_PIN_PROPERTIES::OnPropertiesChange( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( !IsShown() ) // do nothing at init time
|
if( !IsShown() ) // do nothing at init time
|
||||||
return;
|
return;
|
|
@ -29,13 +29,13 @@
|
||||||
#include <pin_shape_combobox.h>
|
#include <pin_shape_combobox.h>
|
||||||
#include <pin_type_combobox.h>
|
#include <pin_type_combobox.h>
|
||||||
|
|
||||||
#include <dialog_lib_edit_pin_base.h>
|
#include <dialog_pin_properties_base.h>
|
||||||
#include <widgets/unit_binder.h>
|
#include <widgets/unit_binder.h>
|
||||||
#include <lib_pin.h>
|
#include <lib_pin.h>
|
||||||
#include <lib_edit_frame.h>
|
#include <lib_edit_frame.h>
|
||||||
|
|
||||||
/** Implementing DIALOG_LIB_EDIT_PIN_BASE */
|
/** Implementing DIALOG_LIB_EDIT_PIN_BASE */
|
||||||
class DIALOG_LIB_EDIT_PIN : public DIALOG_LIB_EDIT_PIN_BASE
|
class DIALOG_PIN_PROPERTIES : public DIALOG_PIN_PROPERTIES_BASE
|
||||||
{
|
{
|
||||||
LIB_EDIT_FRAME* m_frame;
|
LIB_EDIT_FRAME* m_frame;
|
||||||
LIB_PIN* m_pin;
|
LIB_PIN* m_pin;
|
||||||
|
@ -51,8 +51,8 @@ class DIALOG_LIB_EDIT_PIN : public DIALOG_LIB_EDIT_PIN_BASE
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
DIALOG_LIB_EDIT_PIN( LIB_EDIT_FRAME* parent, LIB_PIN* aPin );
|
DIALOG_PIN_PROPERTIES( LIB_EDIT_FRAME* parent, LIB_PIN* aPin );
|
||||||
~DIALOG_LIB_EDIT_PIN() override;
|
~DIALOG_PIN_PROPERTIES() override;
|
||||||
|
|
||||||
bool TransferDataToWindow() override;
|
bool TransferDataToWindow() override;
|
||||||
bool TransferDataFromWindow() override;
|
bool TransferDataFromWindow() override;
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version v3.8.0)
|
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -9,11 +9,11 @@
|
||||||
#include "pin_type_combobox.h"
|
#include "pin_type_combobox.h"
|
||||||
#include "wx/bmpcbox.h"
|
#include "wx/bmpcbox.h"
|
||||||
|
|
||||||
#include "dialog_lib_edit_pin_base.h"
|
#include "dialog_pin_properties_base.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
DIALOG_PIN_PROPERTIES_BASE::DIALOG_PIN_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||||
{
|
{
|
||||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||||
|
|
||||||
|
@ -188,34 +188,34 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
|
||||||
this->Centre( wxBOTH );
|
this->Centre( wxBOTH );
|
||||||
|
|
||||||
// Connect Events
|
// Connect Events
|
||||||
m_textPinName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_textPinName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_textPinNumber->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_textPinNumber->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_pinLengthCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_pinLengthCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_nameSizeCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_nameSizeCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_numberSizeCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_numberSizeCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_choiceElectricalType->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_choiceElectricalType->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_choiceStyle->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_choiceStyle->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_choiceOrientation->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_choiceOrientation->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_checkApplyToAllParts->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_checkApplyToAllParts->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_checkApplyToAllConversions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_checkApplyToAllConversions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_checkShow->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_checkShow->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_panelShowPin->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPaintShowPanel ), NULL, this );
|
m_panelShowPin->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
DIALOG_LIB_EDIT_PIN_BASE::~DIALOG_LIB_EDIT_PIN_BASE()
|
DIALOG_PIN_PROPERTIES_BASE::~DIALOG_PIN_PROPERTIES_BASE()
|
||||||
{
|
{
|
||||||
// Disconnect Events
|
// Disconnect Events
|
||||||
m_textPinName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_textPinName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_textPinNumber->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_textPinNumber->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_pinLengthCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_pinLengthCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_nameSizeCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_nameSizeCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_numberSizeCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_numberSizeCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_choiceElectricalType->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_choiceElectricalType->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_choiceStyle->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_choiceStyle->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_choiceOrientation->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_choiceOrientation->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_checkApplyToAllParts->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_checkApplyToAllParts->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_checkApplyToAllConversions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_checkApplyToAllConversions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_checkShow->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
m_checkShow->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||||
m_panelShowPin->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPaintShowPanel ), NULL, this );
|
m_panelShowPin->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this );
|
||||||
|
|
||||||
}
|
}
|
|
@ -11,12 +11,12 @@
|
||||||
<property name="embedded_files_path">res</property>
|
<property name="embedded_files_path">res</property>
|
||||||
<property name="encoding">UTF-8</property>
|
<property name="encoding">UTF-8</property>
|
||||||
<property name="event_generation">connect</property>
|
<property name="event_generation">connect</property>
|
||||||
<property name="file">dialog_lib_edit_pin_base</property>
|
<property name="file">dialog_pin_properties_base</property>
|
||||||
<property name="first_id">1000</property>
|
<property name="first_id">1000</property>
|
||||||
<property name="help_provider">none</property>
|
<property name="help_provider">none</property>
|
||||||
<property name="indent_with_spaces"></property>
|
<property name="indent_with_spaces"></property>
|
||||||
<property name="internationalize">1</property>
|
<property name="internationalize">1</property>
|
||||||
<property name="name">dialog_lib_edit_pin</property>
|
<property name="name">dialog_pin_properties</property>
|
||||||
<property name="namespace"></property>
|
<property name="namespace"></property>
|
||||||
<property name="path">.</property>
|
<property name="path">.</property>
|
||||||
<property name="precompiled_header"></property>
|
<property name="precompiled_header"></property>
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
<property name="id">wxID_ANY</property>
|
<property name="id">wxID_ANY</property>
|
||||||
<property name="maximum_size"></property>
|
<property name="maximum_size"></property>
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="name">DIALOG_LIB_EDIT_PIN_BASE</property>
|
<property name="name">DIALOG_PIN_PROPERTIES_BASE</property>
|
||||||
<property name="pos"></property>
|
<property name="pos"></property>
|
||||||
<property name="size">-1,-1</property>
|
<property name="size">-1,-1</property>
|
||||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version v3.8.0)
|
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -34,9 +34,9 @@ class wxBitmapComboBox;
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// Class DIALOG_LIB_EDIT_PIN_BASE
|
/// Class DIALOG_PIN_PROPERTIES_BASE
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class DIALOG_LIB_EDIT_PIN_BASE : public DIALOG_SHIM
|
class DIALOG_PIN_PROPERTIES_BASE : public DIALOG_SHIM
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ class DIALOG_LIB_EDIT_PIN_BASE : public DIALOG_SHIM
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
DIALOG_PIN_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||||
~DIALOG_LIB_EDIT_PIN_BASE();
|
~DIALOG_PIN_PROPERTIES_BASE();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -157,13 +157,14 @@ static int externalPinDecoSize( RENDER_SETTINGS* aSettings, const LIB_PIN &aPin
|
||||||
return aPin.GetNumberTextSize() / 2;
|
return aPin.GetNumberTextSize() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
LIB_PIN::LIB_PIN( LIB_PART* aParent )
|
|
||||||
: LIB_ITEM( LIB_PIN_T, aParent ), m_shape( GRAPHIC_PINSHAPE::LINE )
|
LIB_PIN::LIB_PIN( LIB_PART* aParent ) :
|
||||||
|
LIB_ITEM( LIB_PIN_T, aParent )
|
||||||
{
|
{
|
||||||
m_orientation = PIN_RIGHT; // Pin orient: Up, Down, Left, Right
|
m_orientation = PIN_RIGHT; // Pin orient: Up, Down, Left, Right
|
||||||
m_type = ELECTRICAL_PINTYPE::PT_UNSPECIFIED; // electrical type of pin
|
m_type = ELECTRICAL_PINTYPE::PT_UNSPECIFIED; // electrical type of pin
|
||||||
m_attributes = 0; // bit 0 != 0: pin invisible
|
m_shape = GRAPHIC_PINSHAPE::LINE;
|
||||||
m_width = 0;
|
m_attributes = 0; // bit 0 != 0: pin invisible
|
||||||
|
|
||||||
// Use the application settings for pin sizes if exists.
|
// Use the application settings for pin sizes if exists.
|
||||||
// pgm can be nullptr when running a shared lib from a script, not from a kicad appl
|
// pgm can be nullptr when running a shared lib from a script, not from a kicad appl
|
||||||
|
@ -185,375 +186,6 @@ LIB_PIN::LIB_PIN( LIB_PART* aParent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::SetName( const wxString& aName, bool aTestOtherPins )
|
|
||||||
{
|
|
||||||
wxString tmp = ( aName.IsEmpty() ) ? wxT( "~" ) : aName;
|
|
||||||
|
|
||||||
// pin name string does not support spaces
|
|
||||||
tmp.Replace( wxT( " " ), wxT( "_" ) );
|
|
||||||
|
|
||||||
if( m_name != tmp )
|
|
||||||
{
|
|
||||||
m_name = tmp;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !aTestOtherPins )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( GetParent() == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
LIB_PINS pinList;
|
|
||||||
GetParent()->GetPins( pinList );
|
|
||||||
|
|
||||||
for( size_t i = 0; i < pinList.size(); i++ )
|
|
||||||
{
|
|
||||||
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_name == m_name )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pinList[i]->m_name = m_name;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::SetNameTextSize( int size, bool aTestOtherPins )
|
|
||||||
{
|
|
||||||
if( size != m_nameTextSize )
|
|
||||||
{
|
|
||||||
m_nameTextSize = size;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !aTestOtherPins )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( GetParent() == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
LIB_PINS pinList;
|
|
||||||
GetParent()->GetPins( pinList );
|
|
||||||
|
|
||||||
for( size_t i = 0; i < pinList.size(); i++ )
|
|
||||||
{
|
|
||||||
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_nameTextSize == size )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pinList[i]->m_nameTextSize = size;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::SetNumber( const wxString& aNumber )
|
|
||||||
{
|
|
||||||
// Unlike SetName, others pin numbers marked by EnableEditMode() are
|
|
||||||
// not modified because each pin has its own number, so set number
|
|
||||||
// only for this.
|
|
||||||
|
|
||||||
wxString tmp = ( aNumber.IsEmpty() ) ? wxT( "~" ) : aNumber;
|
|
||||||
|
|
||||||
// pin number string does not support spaces
|
|
||||||
tmp.Replace( wxT( " " ), wxT( "_" ) );
|
|
||||||
|
|
||||||
if( m_number != tmp )
|
|
||||||
{
|
|
||||||
m_number = tmp;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::SetNumberTextSize( int size, bool aTestOtherPins )
|
|
||||||
{
|
|
||||||
if( size != m_numTextSize )
|
|
||||||
{
|
|
||||||
m_numTextSize = size;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !aTestOtherPins )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( GetParent() == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
LIB_PINS pinList;
|
|
||||||
GetParent()->GetPins( pinList );
|
|
||||||
|
|
||||||
for( size_t i = 0; i < pinList.size(); i++ )
|
|
||||||
{
|
|
||||||
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_numTextSize == size )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pinList[i]->m_numTextSize = size;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::SetOrientation( int orientation, bool aTestOtherPins )
|
|
||||||
{
|
|
||||||
if( m_orientation != orientation )
|
|
||||||
{
|
|
||||||
m_orientation = orientation;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !aTestOtherPins )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( GetParent() == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
LIB_PINS pinList;
|
|
||||||
GetParent()->GetPins( pinList );
|
|
||||||
|
|
||||||
for( size_t i = 0; i < pinList.size(); i++ )
|
|
||||||
{
|
|
||||||
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 ||
|
|
||||||
pinList[i]->m_orientation == orientation )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pinList[i]->m_orientation = orientation;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::SetShape( GRAPHIC_PINSHAPE aShape )
|
|
||||||
{
|
|
||||||
if( m_shape != aShape )
|
|
||||||
{
|
|
||||||
m_shape = aShape;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( GetParent() == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
LIB_PINS pinList;
|
|
||||||
GetParent()->GetPins( pinList );
|
|
||||||
|
|
||||||
for( size_t i = 0; i < pinList.size(); i++ )
|
|
||||||
{
|
|
||||||
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
|
|
||||||
|| pinList[i]->m_Convert != m_Convert
|
|
||||||
|| pinList[i]->m_shape == aShape )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pinList[i]->m_shape = aShape;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::SetType( ELECTRICAL_PINTYPE aType, bool aTestOtherPins )
|
|
||||||
{
|
|
||||||
if( m_type != aType )
|
|
||||||
{
|
|
||||||
m_type = aType;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !aTestOtherPins )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( GetParent() == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
LIB_PINS pinList;
|
|
||||||
GetParent()->GetPins( pinList );
|
|
||||||
|
|
||||||
for( size_t i = 0; i < pinList.size(); i++ )
|
|
||||||
{
|
|
||||||
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_type == aType )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pinList[i]->m_type = aType;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::SetLength( int length, bool aTestOtherPins )
|
|
||||||
{
|
|
||||||
if( m_length != length )
|
|
||||||
{
|
|
||||||
m_length = length;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !aTestOtherPins )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( GetParent() == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
LIB_PINS pinList;
|
|
||||||
GetParent()->GetPins( pinList );
|
|
||||||
|
|
||||||
for( size_t i = 0; i < pinList.size(); i++ )
|
|
||||||
{
|
|
||||||
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
|
|
||||||
|| pinList[i]->m_Convert != m_Convert
|
|
||||||
|| pinList[i]->m_length == length )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pinList[i]->m_length = length;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::SetPinPosition( wxPoint aPosition )
|
|
||||||
{
|
|
||||||
if( m_position != aPosition )
|
|
||||||
{
|
|
||||||
m_position = aPosition;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( GetParent() == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
LIB_PINS pinList;
|
|
||||||
GetParent()->GetPins( pinList );
|
|
||||||
|
|
||||||
for( size_t i = 0; i < pinList.size(); i++ )
|
|
||||||
{
|
|
||||||
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
|
|
||||||
|| pinList[i]->m_Convert != m_Convert
|
|
||||||
|| pinList[i]->m_position == aPosition )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pinList[i]->m_position = aPosition;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::SetPartNumber( int part )
|
|
||||||
{
|
|
||||||
if( m_Unit == part )
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_Unit = part;
|
|
||||||
SetModified();
|
|
||||||
|
|
||||||
if( m_Unit == 0 )
|
|
||||||
{
|
|
||||||
LIB_PIN* pin;
|
|
||||||
LIB_PIN* tmp = GetParent()->GetNextPin();
|
|
||||||
|
|
||||||
while( tmp != NULL )
|
|
||||||
{
|
|
||||||
pin = tmp;
|
|
||||||
tmp = GetParent()->GetNextPin( pin );
|
|
||||||
|
|
||||||
if( pin->m_Flags == 0 || pin == this
|
|
||||||
|| ( m_Convert && ( m_Convert != pin->m_Convert ) )
|
|
||||||
|| ( m_position != pin->m_position )
|
|
||||||
|| ( pin->m_orientation != m_orientation ) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::SetConversion( int style )
|
|
||||||
{
|
|
||||||
if( m_Convert == style )
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_Convert = style;
|
|
||||||
SetFlags( IS_CHANGED );
|
|
||||||
|
|
||||||
if( style == 0 )
|
|
||||||
{
|
|
||||||
LIB_PIN* pin;
|
|
||||||
LIB_PIN* tmp = GetParent()->GetNextPin();
|
|
||||||
|
|
||||||
while( tmp != NULL )
|
|
||||||
{
|
|
||||||
pin = tmp;
|
|
||||||
tmp = GetParent()->GetNextPin( pin );
|
|
||||||
|
|
||||||
if( ( pin->m_Flags & IS_LINKED ) == 0
|
|
||||||
|| ( pin == this )
|
|
||||||
|| ( m_Unit && ( m_Unit != pin->m_Unit ) )
|
|
||||||
|| ( m_position != pin->m_position )
|
|
||||||
|| ( pin->m_orientation != m_orientation ) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::SetVisible( bool visible )
|
|
||||||
{
|
|
||||||
if( visible == IsVisible() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( visible )
|
|
||||||
m_attributes &= ~PIN_INVISIBLE;
|
|
||||||
else
|
|
||||||
m_attributes |= PIN_INVISIBLE;
|
|
||||||
|
|
||||||
SetModified();
|
|
||||||
|
|
||||||
if( GetParent() == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
LIB_PINS pinList;
|
|
||||||
GetParent()->GetPins( pinList );
|
|
||||||
|
|
||||||
for( size_t i = 0; i < pinList.size(); i++ )
|
|
||||||
{
|
|
||||||
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->IsVisible() == visible )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( visible )
|
|
||||||
pinList[i]->m_attributes &= ~PIN_INVISIBLE;
|
|
||||||
else
|
|
||||||
pinList[i]->m_attributes |= PIN_INVISIBLE;
|
|
||||||
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::EnableEditMode( bool aEnable, bool aEditPinByPin )
|
|
||||||
{
|
|
||||||
LIB_PINS pinList;
|
|
||||||
|
|
||||||
if( GetParent() == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
GetParent()->GetPins( pinList );
|
|
||||||
|
|
||||||
for( size_t i = 0; i < pinList.size(); i++ )
|
|
||||||
{
|
|
||||||
if( pinList[i] == this )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( ( pinList[i]->m_position == m_position )
|
|
||||||
&& ( pinList[i]->m_orientation == m_orientation )
|
|
||||||
&& !IsNew() && !aEditPinByPin && aEnable )
|
|
||||||
{
|
|
||||||
pinList[i]->SetFlags( IS_LINKED | IN_EDIT );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pinList[i]->ClearFlags( IS_LINKED | IN_EDIT );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool LIB_PIN::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
bool LIB_PIN::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetBoundingBox();
|
EDA_RECT rect = GetBoundingBox();
|
||||||
|
@ -581,7 +213,7 @@ bool LIB_PIN::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) c
|
||||||
|
|
||||||
int LIB_PIN::GetPenWidth() const
|
int LIB_PIN::GetPenWidth() const
|
||||||
{
|
{
|
||||||
return std::max( m_width, 1 );
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -595,25 +227,25 @@ void LIB_PIN::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* a
|
||||||
LIB_PART* part = GetParent();
|
LIB_PART* part = GetParent();
|
||||||
|
|
||||||
/* Calculate pin orient taking in account the component orientation. */
|
/* Calculate pin orient taking in account the component orientation. */
|
||||||
int orient = PinDrawOrient( aTransform );
|
int orient = PinDrawOrient( aTransform );
|
||||||
|
|
||||||
/* Calculate the pin position */
|
/* Calculate the pin position */
|
||||||
wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
|
wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
|
||||||
|
|
||||||
if( IsVisible() || drawHiddenFields )
|
if( IsVisible() || drawHiddenFields )
|
||||||
{
|
{
|
||||||
PrintPinSymbol( aSettings, pos1, orient );
|
printPinSymbol( aSettings, pos1, orient );
|
||||||
|
|
||||||
PrintPinTexts( aSettings, pos1, orient, part->GetPinNameOffset(), part->ShowPinNumbers(),
|
printPinTexts( aSettings, pos1, orient, part->GetPinNameOffset(), part->ShowPinNumbers(),
|
||||||
part->ShowPinNames() );
|
part->ShowPinNames() );
|
||||||
|
|
||||||
if( showPinType )
|
if( showPinType )
|
||||||
PrintPinElectricalTypeName( aSettings, pos1, orient );
|
printPinElectricalTypeName( aSettings, pos1, orient );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::PrintPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, int aOrient )
|
void LIB_PIN::printPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, int aOrient )
|
||||||
{
|
{
|
||||||
wxDC* DC = aSettings->GetPrintDC();
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
int MapX1, MapY1, x1, y1;
|
int MapX1, MapY1, x1, y1;
|
||||||
|
@ -722,7 +354,7 @@ void LIB_PIN::PrintPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& pin_pos, int orient,
|
void LIB_PIN::printPinTexts( RENDER_SETTINGS* aSettings, wxPoint& pin_pos, int orient,
|
||||||
int TextInside, bool DrawPinNum, bool DrawPinName )
|
int TextInside, bool DrawPinNum, bool DrawPinName )
|
||||||
{
|
{
|
||||||
if( !DrawPinName && !DrawPinNum )
|
if( !DrawPinName && !DrawPinNum )
|
||||||
|
@ -864,7 +496,7 @@ void LIB_PIN::PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& pin_pos, int o
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::PrintPinElectricalTypeName( RENDER_SETTINGS* aSettings, wxPoint& aPosition,
|
void LIB_PIN::printPinElectricalTypeName( RENDER_SETTINGS* aSettings, wxPoint& aPosition,
|
||||||
int aOrientation )
|
int aOrientation )
|
||||||
{
|
{
|
||||||
wxDC* DC = aSettings->GetPrintDC();
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
|
@ -1230,22 +862,6 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint LIB_PIN::PinEndPoint() const
|
|
||||||
{
|
|
||||||
wxPoint pos = m_position;
|
|
||||||
|
|
||||||
switch( m_orientation )
|
|
||||||
{
|
|
||||||
case PIN_UP: pos.y += m_length; break;
|
|
||||||
case PIN_DOWN: pos.y -= m_length; break;
|
|
||||||
case PIN_LEFT: pos.x -= m_length; break;
|
|
||||||
case PIN_RIGHT: pos.x += m_length; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int LIB_PIN::PinDrawOrient( const TRANSFORM& aTransform ) const
|
int LIB_PIN::PinDrawOrient( const TRANSFORM& aTransform ) const
|
||||||
{
|
{
|
||||||
int orient;
|
int orient;
|
||||||
|
@ -1328,9 +944,6 @@ int LIB_PIN::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareFl
|
||||||
if( m_attributes != tmp->m_attributes )
|
if( m_attributes != tmp->m_attributes )
|
||||||
return m_attributes - tmp->m_attributes;
|
return m_attributes - tmp->m_attributes;
|
||||||
|
|
||||||
if( m_width != tmp->m_width )
|
|
||||||
return m_width - tmp->m_width;
|
|
||||||
|
|
||||||
if( m_numTextSize != tmp->m_numTextSize )
|
if( m_numTextSize != tmp->m_numTextSize )
|
||||||
return m_numTextSize - tmp->m_numTextSize;
|
return m_numTextSize - tmp->m_numTextSize;
|
||||||
|
|
||||||
|
@ -1427,16 +1040,6 @@ void LIB_PIN::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::SetWidth( int aWidth )
|
|
||||||
{
|
|
||||||
if( m_width != aWidth )
|
|
||||||
{
|
|
||||||
m_width = aWidth;
|
|
||||||
SetModified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::getMsgPanelInfoBase( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
void LIB_PIN::getMsgPanelInfoBase( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
||||||
{
|
{
|
||||||
wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number;
|
wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number;
|
||||||
|
@ -1689,24 +1292,6 @@ wxString LIB_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxDat )
|
|
||||||
{
|
|
||||||
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
|
|
||||||
|
|
||||||
// Note: this will have to be modified if we add find and replace capability to the
|
|
||||||
// compoment library editor. Otherwise, you wont be able to replace pin text.
|
|
||||||
if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_PINS )
|
|
||||||
|| ( aSearchData.GetFlags() & FR_SEARCH_REPLACE ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
wxLogTrace(
|
|
||||||
traceFindItem, wxT( " child item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
|
|
||||||
|
|
||||||
return EDA_ITEM::Matches( GetName(), aSearchData )
|
|
||||||
|| EDA_ITEM::Matches( m_number, aSearchData );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
|
|
||||||
void LIB_PIN::Show( int nestLevel, std::ostream& os ) const
|
void LIB_PIN::Show( int nestLevel, std::ostream& os ) const
|
||||||
|
|
|
@ -23,10 +23,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file class_libentry.h
|
|
||||||
* @brief Class LIB_PIN definition.
|
|
||||||
*/
|
|
||||||
#ifndef CLASS_PIN_H
|
#ifndef CLASS_PIN_H
|
||||||
#define CLASS_PIN_H
|
#define CLASS_PIN_H
|
||||||
|
|
||||||
|
@ -62,16 +59,11 @@ enum DrawPinOrient {
|
||||||
|
|
||||||
class LIB_PIN : public LIB_ITEM
|
class LIB_PIN : public LIB_ITEM
|
||||||
{
|
{
|
||||||
// Unlike most of the other LIB_ITEMs, the SetXXX() routines on LIB_PINs are at the UI
|
protected:
|
||||||
// level, performing additional pin checking, multi-pin editing, and setting the modified
|
|
||||||
// flag. So the LEGACY_PLUGIN_CACHE needs direct access to the member variables.
|
|
||||||
friend class SCH_LEGACY_PLUGIN_CACHE;
|
|
||||||
|
|
||||||
wxPoint m_position; // Position of the pin.
|
wxPoint m_position; // Position of the pin.
|
||||||
int m_length; // Length of the pin.
|
int m_length; // Length of the pin.
|
||||||
int m_orientation; // Pin orientation (Up, Down, Left, Right)
|
int m_orientation; // Pin orientation (Up, Down, Left, Right)
|
||||||
GRAPHIC_PINSHAPE m_shape; // Shape drawn around pin
|
GRAPHIC_PINSHAPE m_shape; // Shape drawn around pin
|
||||||
int m_width; // Line width of the pin.
|
|
||||||
ELECTRICAL_PINTYPE m_type; // Electrical type of the pin.
|
ELECTRICAL_PINTYPE m_type; // Electrical type of the pin.
|
||||||
int m_attributes; // Set bit 0 to indicate pin is invisible.
|
int m_attributes; // Set bit 0 to indicate pin is invisible.
|
||||||
wxString m_name;
|
wxString m_name;
|
||||||
|
@ -79,290 +71,12 @@ class LIB_PIN : public LIB_ITEM
|
||||||
int m_numTextSize; // Pin num and Pin name sizes
|
int m_numTextSize; // Pin num and Pin name sizes
|
||||||
int m_nameTextSize;
|
int m_nameTextSize;
|
||||||
|
|
||||||
/**
|
protected:
|
||||||
* Print a pin, with or without the pin texts
|
|
||||||
*
|
|
||||||
* @param aOffset Offset to draw
|
|
||||||
* @param aData = used here as a boolean indicating whether or not to draw the pin
|
|
||||||
* electrical types
|
|
||||||
* @param aTransform Transform Matrix (rotation, mirror ..)
|
|
||||||
*/
|
|
||||||
void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
|
||||||
const TRANSFORM& aTransform ) override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
LIB_PIN( LIB_PART* aParent );
|
|
||||||
|
|
||||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
|
||||||
|
|
||||||
~LIB_PIN() { }
|
|
||||||
|
|
||||||
wxString GetClass() const override
|
|
||||||
{
|
|
||||||
return wxT( "LIB_PIN" );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString GetTypeName() override
|
|
||||||
{
|
|
||||||
return _( "Pin" );
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
|
||||||
void Show( int nestLevel, std::ostream& os ) const override;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
|
||||||
|
|
||||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
|
||||||
|
|
||||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display pin info (given by GetMsgPanelInfo) and add some info related to aComponent
|
|
||||||
* (schematic pin position, and sheet path)
|
|
||||||
* @param aList is the message list to fill
|
|
||||||
* @param aComponent is the component which "owns" the pin
|
|
||||||
*/
|
|
||||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList,
|
|
||||||
SCH_COMPONENT* aComponent );
|
|
||||||
|
|
||||||
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override;
|
|
||||||
|
|
||||||
/* Cannot use a default parameter here as it will not be compatible with the virtual. */
|
|
||||||
const EDA_RECT GetBoundingBox() const override { return GetBoundingBox( false ); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param aIncludeInvisibles - if false, do not include labels for invisible pins
|
|
||||||
* in the calculation.
|
|
||||||
*/
|
|
||||||
const EDA_RECT GetBoundingBox( bool aIncludeInvisibles, bool aPinOnly = false ) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The pin end position for a component in the normal orientation.
|
|
||||||
*/
|
|
||||||
wxPoint PinEndPoint() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
|
|
||||||
* according to its orientation and the matrix transform (rot, mirror) \a aTransform.
|
|
||||||
*
|
|
||||||
* @param aTransform Transform matrix
|
|
||||||
*/
|
|
||||||
int PinDrawOrient( const TRANSFORM& aTransform ) const;
|
|
||||||
|
|
||||||
const wxString& GetName() const
|
|
||||||
{
|
|
||||||
return m_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the pin name.
|
|
||||||
*
|
|
||||||
* This will also all of the pin names marked by EnableEditMode().
|
|
||||||
*
|
|
||||||
* @param aName New pin name.
|
|
||||||
* @param aTestOtherPins determines if other pins need to be updated
|
|
||||||
*/
|
|
||||||
void SetName( const wxString& aName, bool aTestOtherPins = true );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the \a aSize of the pin name text.
|
|
||||||
*
|
|
||||||
* This will also update the text size of the name of the pins marked
|
|
||||||
* by EnableEditMode().
|
|
||||||
*
|
|
||||||
* @param aSize The text size of the pin name in schematic units ( mils ).
|
|
||||||
* @param aTestOtherPins determines if other pins need to be updated
|
|
||||||
*/
|
|
||||||
void SetNameTextSize( int aSize, bool aTestOtherPins = true );
|
|
||||||
|
|
||||||
int GetNameTextSize() const { return m_nameTextSize; }
|
|
||||||
|
|
||||||
const wxString& GetNumber() const
|
|
||||||
{
|
|
||||||
return m_number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the pin number.
|
|
||||||
*
|
|
||||||
* Others pin numbers marked by EnableEditMode() are not modified
|
|
||||||
* because each pin has its own number
|
|
||||||
* @param aNumber New pin number.
|
|
||||||
*/
|
|
||||||
void SetNumber( const wxString& aNumber );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the size of the pin number text.
|
|
||||||
*
|
|
||||||
* This will also update the text size of the number of the pins marked
|
|
||||||
* by EnableEditMode().
|
|
||||||
*
|
|
||||||
* @param aSize The text size of the pin number in schematic units ( mils ).
|
|
||||||
* @param aTestOtherPins determines if other pins need to be updated
|
|
||||||
*/
|
|
||||||
void SetNumberTextSize( int aSize, bool aTestOtherPins = true );
|
|
||||||
|
|
||||||
int GetNumberTextSize() const { return m_numTextSize; }
|
|
||||||
|
|
||||||
int GetOrientation() const { return m_orientation; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set orientation on the pin.
|
|
||||||
*
|
|
||||||
* This will also update the orientation of the pins marked by EnableEditMode().
|
|
||||||
*
|
|
||||||
* @param aOrientation - The orientation of the pin.
|
|
||||||
* @param aTestOtherPins determines if other pins need to be updated
|
|
||||||
*/
|
|
||||||
void SetOrientation( int aOrientation, bool aTestOtherPins = true );
|
|
||||||
|
|
||||||
GRAPHIC_PINSHAPE GetShape() const { return m_shape; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the shape of the pin to \a aShape.
|
|
||||||
*
|
|
||||||
* This will also update the draw style of the pins marked by EnableEditMode().
|
|
||||||
*
|
|
||||||
* @param aShape - The draw shape of the pin. See enum GRAPHIC_PINSHAPE.
|
|
||||||
*/
|
|
||||||
void SetShape( GRAPHIC_PINSHAPE aShape );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the electrical type of the pin.
|
|
||||||
*
|
|
||||||
* @return The electrical type of the pin (see enum ELECTRICAL_PINTYPE for values).
|
|
||||||
*/
|
|
||||||
ELECTRICAL_PINTYPE GetType() const { return m_type; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return a string giving the electrical type of a pin.
|
|
||||||
* Can be used when a known, not translated name is needed (for instance in net lists)
|
|
||||||
* @param aType is the electrical type (see enum ELECTRICAL_PINTYPE )
|
|
||||||
* @return The electrical name for a pin type (see enun MsgPinElectricType for names).
|
|
||||||
*/
|
|
||||||
static const wxString GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return a string giving the electrical type of the pin.
|
|
||||||
* Can be used when a known, not translated name is needed (for instance in net lists)
|
|
||||||
* @return The canonical electrical name of the pin.
|
|
||||||
*/
|
|
||||||
wxString const GetCanonicalElectricalTypeName() const
|
|
||||||
{
|
|
||||||
return GetCanonicalElectricalTypeName( m_type );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return a translated string for messages giving the electrical type of the pin.
|
|
||||||
* @return The electrical name of the pin.
|
|
||||||
*/
|
|
||||||
wxString const GetElectricalTypeName() const
|
|
||||||
{
|
|
||||||
return ElectricalPinTypeGetText( m_type );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the electrical type of the pin.
|
|
||||||
*
|
|
||||||
* This will also update the electrical type of the pins marked by
|
|
||||||
* EnableEditMode().
|
|
||||||
*
|
|
||||||
* @param aType - The electrical type of the pin(see enun ELECTRICAL_PINTYPE for values).
|
|
||||||
* @param aTestOtherPins determines if other pins need to be updated
|
|
||||||
*/
|
|
||||||
void SetType( ELECTRICAL_PINTYPE aType, bool aTestOtherPins = true );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the pin length.
|
|
||||||
*
|
|
||||||
* This will also update the length of the pins marked by EnableEditMode().
|
|
||||||
*
|
|
||||||
* @param aLength - The length of the pin in mils.
|
|
||||||
* @param aTestOtherPins determines if other pins need to be updated
|
|
||||||
*/
|
|
||||||
void SetLength( int aLength, bool aTestOtherPins = true );
|
|
||||||
|
|
||||||
int GetLength() { return m_length; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the pin part number.
|
|
||||||
*
|
|
||||||
* If the pin is changed from not common to common to all parts, any
|
|
||||||
* linked pins will be removed from the parent component.
|
|
||||||
*
|
|
||||||
* @param aPart - Number of the part the pin belongs to. Set to zero to
|
|
||||||
* make pin common to all parts in a multi-part component.
|
|
||||||
*/
|
|
||||||
void SetPartNumber( int aPart );
|
|
||||||
|
|
||||||
/** Get the pin part number. */
|
|
||||||
int GetPartNumber() const { return m_Unit; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the body style (conversion) of the pin.
|
|
||||||
*
|
|
||||||
* If the pin is changed from not common to common to all body styles, any
|
|
||||||
* linked pins will be removed from the parent component.
|
|
||||||
*
|
|
||||||
* @param aConversion - Body style of the pin. Set to zero to make pin
|
|
||||||
* common to all body styles.
|
|
||||||
*/
|
|
||||||
void SetConversion( int aConversion );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set or clear the visibility flag for the pin.
|
|
||||||
*
|
|
||||||
* This will also update the visibility of the pins marked by
|
|
||||||
* EnableEditMode().
|
|
||||||
*
|
|
||||||
* @param aVisible - True to make the pin visible or false to hide the pin.
|
|
||||||
*/
|
|
||||||
void SetVisible( bool aVisible );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable or clear pin editing mode.
|
|
||||||
*
|
|
||||||
* The pin editing mode marks or unmarks all pins common to this
|
|
||||||
* pin object for further editing. If any of the pin modification
|
|
||||||
* methods are called after enabling the editing mode, all pins
|
|
||||||
* marked for editing will have the same attribute changed. The
|
|
||||||
* only case were this is not true making this pin common to all
|
|
||||||
* parts or body styles in the component. See SetCommonToAllParts()
|
|
||||||
* and SetCommonToAllBodyStyles() for more information.
|
|
||||||
*
|
|
||||||
* @param aEnable = true marks all common pins for editing mode. False
|
|
||||||
* clears the editing mode.
|
|
||||||
* @param aEditPinByPin == true enables the edit pin by pin mode.
|
|
||||||
* aEditPinByPin == false enables the pin edit coupling between pins at the same location
|
|
||||||
* if aEnable == false, aEditPinByPin is not used
|
|
||||||
*/
|
|
||||||
void EnableEditMode( bool aEnable, bool aEditPinByPin = false );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the visibility status of the draw object.
|
|
||||||
*
|
|
||||||
* @return True if draw object is visible otherwise false.
|
|
||||||
*/
|
|
||||||
bool IsVisible() const { return ( m_attributes & PIN_INVISIBLE ) == 0; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether this pin forms an implicit power connection: i.e., is hidden
|
|
||||||
* and of type POWER_IN.
|
|
||||||
*/
|
|
||||||
bool IsPowerConnection() const
|
|
||||||
{
|
|
||||||
return GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN
|
|
||||||
&& ( !IsVisible() || (LIB_PART*) GetParent()->IsPower() );
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetPenWidth() const override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print the pin symbol without text.
|
* Print the pin symbol without text.
|
||||||
* If \a aColor != 0, draw with \a aColor, else with the normal pin color.
|
* If \a aColor != 0, draw with \a aColor, else with the normal pin color.
|
||||||
*/
|
*/
|
||||||
void PrintPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, int aOrientation );
|
void printPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, int aOrientation );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the pin number and pin text info, given the pin line coordinates.
|
* Put the pin number and pin text info, given the pin line coordinates.
|
||||||
|
@ -372,27 +86,16 @@ public:
|
||||||
* If TextInside then the text is been put inside,otherwise all is drawn outside.
|
* If TextInside then the text is been put inside,otherwise all is drawn outside.
|
||||||
* Pin Name: substring between '~' is negated
|
* Pin Name: substring between '~' is negated
|
||||||
*/
|
*/
|
||||||
void PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& aPosition, int aOrientation,
|
void printPinTexts( RENDER_SETTINGS* aSettings, wxPoint& aPosition, int aOrientation,
|
||||||
int TextInside, bool DrawPinNum, bool DrawPinName );
|
int TextInside, bool DrawPinNum, bool DrawPinName );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw the electrical type text of the pin (only for the footprint editor)
|
* Draw the electrical type text of the pin (only for the footprint editor)
|
||||||
*/
|
*/
|
||||||
void PrintPinElectricalTypeName( RENDER_SETTINGS* aSettings, wxPoint& aPosition,
|
void printPinElectricalTypeName( RENDER_SETTINGS* aSettings, wxPoint& aPosition,
|
||||||
int aOrientation );
|
int aOrientation );
|
||||||
|
|
||||||
/**
|
public:
|
||||||
* Plot the pin number and pin text info, given the pin line coordinates.
|
|
||||||
* Same as DrawPinTexts((), but output is the plotter
|
|
||||||
* The line must be vertical or horizontal.
|
|
||||||
* If TextInside then the text is been put inside (moving from x1, y1 in
|
|
||||||
* the opposite direction to x2,y2), otherwise all is drawn outside.
|
|
||||||
*/
|
|
||||||
void PlotPinTexts( PLOTTER *aPlotter, wxPoint& aPosition, int aOrientation,
|
|
||||||
int aTextInside, bool aDrawPinNum, bool aDrawPinName );
|
|
||||||
|
|
||||||
void PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of pin orientation names.
|
* Get a list of pin orientation names.
|
||||||
*
|
*
|
||||||
|
@ -425,19 +128,165 @@ public:
|
||||||
*/
|
*/
|
||||||
static int GetOrientationIndex( int aCode );
|
static int GetOrientationIndex( int aCode );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return a string giving the electrical type of a pin.
|
||||||
|
* Can be used when a known, not translated name is needed (for instance in net lists)
|
||||||
|
* @param aType is the electrical type (see enum ELECTRICAL_PINTYPE )
|
||||||
|
* @return The electrical name for a pin type (see enun MsgPinElectricType for names).
|
||||||
|
*/
|
||||||
|
static const wxString GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType );
|
||||||
|
|
||||||
|
public:
|
||||||
|
~LIB_PIN() { }
|
||||||
|
|
||||||
|
wxString GetClass() const override
|
||||||
|
{
|
||||||
|
return wxT( "LIB_PIN" );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString GetTypeName() override
|
||||||
|
{
|
||||||
|
return _( "Pin" );
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetOrientation() const { return m_orientation; }
|
||||||
|
void SetOrientation( int aOrientation ) { m_orientation = aOrientation; }
|
||||||
|
|
||||||
|
GRAPHIC_PINSHAPE GetShape() const { return m_shape; }
|
||||||
|
void SetShape( GRAPHIC_PINSHAPE aShape ) { m_shape = aShape; }
|
||||||
|
|
||||||
|
int GetLength() const { return m_length; }
|
||||||
|
void SetLength( int aLength ) { m_length = aLength; }
|
||||||
|
|
||||||
|
ELECTRICAL_PINTYPE GetType() const { return m_type; }
|
||||||
|
void SetType( ELECTRICAL_PINTYPE aType ) { m_type = aType; }
|
||||||
|
|
||||||
|
wxString const GetCanonicalElectricalTypeName() const
|
||||||
|
{
|
||||||
|
return GetCanonicalElectricalTypeName( m_type );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString const GetElectricalTypeName() const
|
||||||
|
{
|
||||||
|
return ElectricalPinTypeGetText( m_type );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsVisible() const { return ( m_attributes & PIN_INVISIBLE ) == 0; }
|
||||||
|
void SetVisible( bool aVisible )
|
||||||
|
{
|
||||||
|
if( aVisible )
|
||||||
|
m_attributes &= ~PIN_INVISIBLE;
|
||||||
|
else
|
||||||
|
m_attributes |= PIN_INVISIBLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wxString& GetName() const { return m_name; }
|
||||||
|
void SetName( const wxString& aName )
|
||||||
|
{
|
||||||
|
m_name = aName;
|
||||||
|
|
||||||
|
// pin name string does not support spaces
|
||||||
|
m_name.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
const wxString& GetNumber() const { return m_number; }
|
||||||
|
void SetNumber( const wxString& aNumber )
|
||||||
|
{
|
||||||
|
m_number = aNumber;
|
||||||
|
|
||||||
|
// pin number string does not support spaces
|
||||||
|
m_number.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetNameTextSize() const { return m_nameTextSize; }
|
||||||
|
void SetNameTextSize( int aSize ) { m_nameTextSize = aSize; }
|
||||||
|
|
||||||
|
int GetNumberTextSize() const { return m_numTextSize; }
|
||||||
|
void SetNumberTextSize( int aSize ) { m_numTextSize = aSize; }
|
||||||
|
|
||||||
|
const EDA_RECT GetBoundingBox( bool aIncludeInvisibles, bool aShowName, bool aShowNum,
|
||||||
|
int aNameTextOffset ) const;
|
||||||
|
/**
|
||||||
|
* Print a pin, with or without the pin texts
|
||||||
|
*
|
||||||
|
* @param aOffset Offset to draw
|
||||||
|
* @param aData = used here as a boolean indicating whether or not to draw the pin
|
||||||
|
* electrical types
|
||||||
|
* @param aTransform Transform Matrix (rotation, mirror ..)
|
||||||
|
*/
|
||||||
|
void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
|
const TRANSFORM& aTransform ) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
|
||||||
|
* according to its orientation and the matrix transform (rot, mirror) \a aTransform.
|
||||||
|
*
|
||||||
|
* @param aTransform Transform matrix
|
||||||
|
*/
|
||||||
|
int PinDrawOrient( const TRANSFORM& aTransform ) const;
|
||||||
|
|
||||||
|
LIB_PIN( LIB_PART* aParent );
|
||||||
|
|
||||||
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
void Show( int nestLevel, std::ostream& os ) const override;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
||||||
|
|
||||||
|
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||||
|
|
||||||
|
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display pin info (given by GetMsgPanelInfo) and add some info related to aComponent
|
||||||
|
* (schematic pin position, and sheet path)
|
||||||
|
* @param aList is the message list to fill
|
||||||
|
* @param aComponent is the component which "owns" the pin
|
||||||
|
*/
|
||||||
|
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList,
|
||||||
|
SCH_COMPONENT* aComponent );
|
||||||
|
|
||||||
|
/* Cannot use a default parameter here as it will not be compatible with the virtual. */
|
||||||
|
const EDA_RECT GetBoundingBox() const override { return GetBoundingBox( false ); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param aIncludeInvisibles - if false, do not include labels for invisible pins
|
||||||
|
* in the calculation.
|
||||||
|
*/
|
||||||
|
const EDA_RECT GetBoundingBox( bool aIncludeInvisibles, bool aPinOnly = false ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether this pin forms an implicit power connection: i.e., is hidden
|
||||||
|
* and of type POWER_IN.
|
||||||
|
*/
|
||||||
|
bool IsPowerConnection() const
|
||||||
|
{
|
||||||
|
return GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN
|
||||||
|
&& ( !IsVisible() || (LIB_PART*) GetParent()->IsPower() );
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plot the pin number and pin text info, given the pin line coordinates.
|
||||||
|
* Same as DrawPinTexts((), but output is the plotter
|
||||||
|
* The line must be vertical or horizontal.
|
||||||
|
* If TextInside then the text is been put inside (moving from x1, y1 in
|
||||||
|
* the opposite direction to x2,y2), otherwise all is drawn outside.
|
||||||
|
*/
|
||||||
|
void PlotPinTexts( PLOTTER *aPlotter, wxPoint& aPosition, int aOrientation,
|
||||||
|
int aTextInside, bool aDrawPinNum, bool aDrawPinName );
|
||||||
|
|
||||||
|
void PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation );
|
||||||
|
|
||||||
void Offset( const wxPoint& aOffset ) override;
|
void Offset( const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
void MoveTo( const wxPoint& aPosition ) override;
|
void MoveTo( const wxPoint& aPosition ) override;
|
||||||
|
|
||||||
wxPoint GetPosition() const override { return m_position; }
|
wxPoint GetPosition() const override { return m_position; }
|
||||||
|
void SetPosition( const wxPoint& aPos ) { m_position = aPos; }
|
||||||
/**
|
|
||||||
* move this and all linked pins to the new position
|
|
||||||
* used in pin editing.
|
|
||||||
* use SetPinPosition to set the position of this only
|
|
||||||
* @param aPosition is the new position of this and linked pins
|
|
||||||
*/
|
|
||||||
void SetPinPosition( wxPoint aPosition );
|
|
||||||
|
|
||||||
void MirrorHorizontal( const wxPoint& aCenter ) override;
|
void MirrorHorizontal( const wxPoint& aCenter ) override;
|
||||||
void MirrorVertical( const wxPoint& aCenter ) override;
|
void MirrorVertical( const wxPoint& aCenter ) override;
|
||||||
|
@ -446,8 +295,9 @@ public:
|
||||||
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||||
const TRANSFORM& aTransform ) override;
|
const TRANSFORM& aTransform ) override;
|
||||||
|
|
||||||
int GetWidth() const override { return m_width; }
|
// Get/SetWidth() not used for pins. Use GetPenWidth() for drawing.
|
||||||
void SetWidth( int aWidth ) override;
|
int GetWidth() const override { return 1; }
|
||||||
|
void SetWidth( int aWidth ) override { };
|
||||||
|
|
||||||
BITMAP_DEF GetMenuImage() const override;
|
BITMAP_DEF GetMenuImage() const override;
|
||||||
|
|
||||||
|
|
|
@ -1449,7 +1449,6 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
||||||
{
|
{
|
||||||
wxArrayString pads = wxSplit( wxString( connect.pad ), ' ' );
|
wxArrayString pads = wxSplit( wxString( connect.pad ), ' ' );
|
||||||
|
|
||||||
pin->SetPartNumber( aGateNumber );
|
|
||||||
pin->SetUnit( aGateNumber );
|
pin->SetUnit( aGateNumber );
|
||||||
pin->SetName( escapeName( pin->GetName() ) );
|
pin->SetName( escapeName( pin->GetName() ) );
|
||||||
|
|
||||||
|
@ -1479,7 +1478,6 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pin->SetPartNumber( aGateNumber );
|
|
||||||
pin->SetUnit( aGateNumber );
|
pin->SetUnit( aGateNumber );
|
||||||
pin->SetNumber( wxString::Format( "%i", pincount ) );
|
pin->SetNumber( wxString::Format( "%i", pincount ) );
|
||||||
aPart->AddDrawItem( pin.release() );
|
aPart->AddDrawItem( pin.release() );
|
||||||
|
|
|
@ -3457,10 +3457,13 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||||
if( tokens.CountTokens() < 11 )
|
if( tokens.CountTokens() < 11 )
|
||||||
SCH_PARSE_ERROR( "invalid pin definition", aReader, line );
|
SCH_PARSE_ERROR( "invalid pin definition", aReader, line );
|
||||||
|
|
||||||
pin->m_name = tokens.GetNextToken();
|
tmp = tokens.GetNextToken();
|
||||||
pos += pin->m_name.size() + 1;
|
pin->SetName( tmp );
|
||||||
pin->m_number = tokens.GetNextToken();
|
pos += tmp.size() + 1;
|
||||||
pos += pin->m_number.size() + 1;
|
|
||||||
|
tmp = tokens.GetNextToken();
|
||||||
|
pin->SetNumber( tmp );
|
||||||
|
pos += tmp.size() + 1;
|
||||||
|
|
||||||
long num;
|
long num;
|
||||||
wxPoint position;
|
wxPoint position;
|
||||||
|
@ -3482,7 +3485,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||||
|
|
||||||
pos += tmp.size() + 1;
|
pos += tmp.size() + 1;
|
||||||
position.y = Mils2Iu( (int) num );
|
position.y = Mils2Iu( (int) num );
|
||||||
pin->m_position = position;
|
pin->SetPosition( position );
|
||||||
|
|
||||||
tmp = tokens.GetNextToken();
|
tmp = tokens.GetNextToken();
|
||||||
|
|
||||||
|
@ -3491,7 +3494,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||||
aReader.LineNumber(), pos );
|
aReader.LineNumber(), pos );
|
||||||
|
|
||||||
pos += tmp.size() + 1;
|
pos += tmp.size() + 1;
|
||||||
pin->m_length = Mils2Iu( (int) num );
|
pin->SetLength( Mils2Iu( (int) num ) );
|
||||||
|
|
||||||
|
|
||||||
tmp = tokens.GetNextToken();
|
tmp = tokens.GetNextToken();
|
||||||
|
@ -3501,7 +3504,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||||
aReader.LineNumber(), pos );
|
aReader.LineNumber(), pos );
|
||||||
|
|
||||||
pos += tmp.size() + 1;
|
pos += tmp.size() + 1;
|
||||||
pin->m_orientation = tmp[0];
|
pin->SetOrientation( tmp[0] );
|
||||||
|
|
||||||
tmp = tokens.GetNextToken();
|
tmp = tokens.GetNextToken();
|
||||||
|
|
||||||
|
@ -3510,7 +3513,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||||
aReader.LineNumber(), pos );
|
aReader.LineNumber(), pos );
|
||||||
|
|
||||||
pos += tmp.size() + 1;
|
pos += tmp.size() + 1;
|
||||||
pin->m_numTextSize = Mils2Iu( (int) num );
|
pin->SetNumberTextSize( Mils2Iu( (int) num ) );
|
||||||
|
|
||||||
tmp = tokens.GetNextToken();
|
tmp = tokens.GetNextToken();
|
||||||
|
|
||||||
|
@ -3519,7 +3522,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||||
aReader.LineNumber(), pos );
|
aReader.LineNumber(), pos );
|
||||||
|
|
||||||
pos += tmp.size() + 1;
|
pos += tmp.size() + 1;
|
||||||
pin->m_nameTextSize = Mils2Iu( (int) num );
|
pin->SetNameTextSize( Mils2Iu( (int) num ) );
|
||||||
|
|
||||||
tmp = tokens.GetNextToken();
|
tmp = tokens.GetNextToken();
|
||||||
|
|
||||||
|
@ -3528,7 +3531,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||||
aReader.LineNumber(), pos );
|
aReader.LineNumber(), pos );
|
||||||
|
|
||||||
pos += tmp.size() + 1;
|
pos += tmp.size() + 1;
|
||||||
pin->m_Unit = (int) num;
|
pin->SetUnit( (int) num );
|
||||||
|
|
||||||
tmp = tokens.GetNextToken();
|
tmp = tokens.GetNextToken();
|
||||||
|
|
||||||
|
@ -3537,7 +3540,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||||
aReader.LineNumber(), pos );
|
aReader.LineNumber(), pos );
|
||||||
|
|
||||||
pos += tmp.size() + 1;
|
pos += tmp.size() + 1;
|
||||||
pin->m_Convert = (int) num;
|
pin->SetConvert( (int) num );
|
||||||
|
|
||||||
tmp = tokens.GetNextToken();
|
tmp = tokens.GetNextToken();
|
||||||
|
|
||||||
|
@ -3552,39 +3555,17 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case 'I':
|
case 'I': pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT ); break;
|
||||||
pin->m_type = ELECTRICAL_PINTYPE::PT_INPUT;
|
case 'O': pin->SetType( ELECTRICAL_PINTYPE::PT_OUTPUT ); break;
|
||||||
break;
|
case 'B': pin->SetType( ELECTRICAL_PINTYPE::PT_BIDI ); break;
|
||||||
case 'O':
|
case 'T': pin->SetType( ELECTRICAL_PINTYPE::PT_TRISTATE ); break;
|
||||||
pin->m_type = ELECTRICAL_PINTYPE::PT_OUTPUT;
|
case 'P': pin->SetType( ELECTRICAL_PINTYPE::PT_PASSIVE ); break;
|
||||||
break;
|
case 'U': pin->SetType( ELECTRICAL_PINTYPE::PT_UNSPECIFIED ); break;
|
||||||
case 'B':
|
case 'W': pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN ); break;
|
||||||
pin->m_type = ELECTRICAL_PINTYPE::PT_BIDI;
|
case 'w': pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_OUT ); break;
|
||||||
break;
|
case 'C': pin->SetType( ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR ); break;
|
||||||
case 'T':
|
case 'E': pin->SetType( ELECTRICAL_PINTYPE::PT_OPENEMITTER ); break;
|
||||||
pin->m_type = ELECTRICAL_PINTYPE::PT_TRISTATE;
|
case 'N': pin->SetType( ELECTRICAL_PINTYPE::PT_NC ); break;
|
||||||
break;
|
|
||||||
case 'P':
|
|
||||||
pin->m_type = ELECTRICAL_PINTYPE::PT_PASSIVE;
|
|
||||||
break;
|
|
||||||
case 'U':
|
|
||||||
pin->m_type = ELECTRICAL_PINTYPE::PT_UNSPECIFIED;
|
|
||||||
break;
|
|
||||||
case 'W':
|
|
||||||
pin->m_type = ELECTRICAL_PINTYPE::PT_POWER_IN;
|
|
||||||
break;
|
|
||||||
case 'w':
|
|
||||||
pin->m_type = ELECTRICAL_PINTYPE::PT_POWER_OUT;
|
|
||||||
break;
|
|
||||||
case 'C':
|
|
||||||
pin->m_type = ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR;
|
|
||||||
break;
|
|
||||||
case 'E':
|
|
||||||
pin->m_type = ELECTRICAL_PINTYPE::PT_OPENEMITTER;
|
|
||||||
break;
|
|
||||||
case 'N':
|
|
||||||
pin->m_type = ELECTRICAL_PINTYPE::PT_NC;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
THROW_PARSE_ERROR( "unknown pin type", aReader.GetSource(), aReader.Line(),
|
THROW_PARSE_ERROR( "unknown pin type", aReader.GetSource(), aReader.Line(),
|
||||||
aReader.LineNumber(), pos );
|
aReader.LineNumber(), pos );
|
||||||
|
@ -3612,13 +3593,13 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||||
switch( tmp[--j].GetValue() )
|
switch( tmp[--j].GetValue() )
|
||||||
{
|
{
|
||||||
case '~': break;
|
case '~': break;
|
||||||
case 'N': pin->m_attributes |= PIN_INVISIBLE; break;
|
case 'N': pin->SetVisible( false ); break;
|
||||||
case 'I': flags |= INVERTED; break;
|
case 'I': flags |= INVERTED; break;
|
||||||
case 'C': flags |= CLOCK; break;
|
case 'C': flags |= CLOCK; break;
|
||||||
case 'L': flags |= LOWLEVEL_IN; break;
|
case 'L': flags |= LOWLEVEL_IN; break;
|
||||||
case 'V': flags |= LOWLEVEL_OUT; break;
|
case 'V': flags |= LOWLEVEL_OUT; break;
|
||||||
case 'F': flags |= FALLING_EDGE; break;
|
case 'F': flags |= FALLING_EDGE; break;
|
||||||
case 'X': flags |= NONLOGIC; break;
|
case 'X': flags |= NONLOGIC; break;
|
||||||
default: THROW_PARSE_ERROR( "invalid pin attribut", aReader.GetSource(),
|
default: THROW_PARSE_ERROR( "invalid pin attribut", aReader.GetSource(),
|
||||||
aReader.Line(), aReader.LineNumber(), pos );
|
aReader.Line(), aReader.LineNumber(), pos );
|
||||||
}
|
}
|
||||||
|
@ -3628,33 +3609,15 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||||
|
|
||||||
switch( flags )
|
switch( flags )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: pin->SetShape( GRAPHIC_PINSHAPE::LINE ); break;
|
||||||
pin->m_shape = GRAPHIC_PINSHAPE::LINE;
|
case INVERTED: pin->SetShape( GRAPHIC_PINSHAPE::INVERTED ); break;
|
||||||
break;
|
case CLOCK: pin->SetShape( GRAPHIC_PINSHAPE::CLOCK ); break;
|
||||||
case INVERTED:
|
case INVERTED | CLOCK: pin->SetShape( GRAPHIC_PINSHAPE::INVERTED_CLOCK ); break;
|
||||||
pin->m_shape = GRAPHIC_PINSHAPE::INVERTED;
|
case LOWLEVEL_IN: pin->SetShape( GRAPHIC_PINSHAPE::INPUT_LOW ); break;
|
||||||
break;
|
case LOWLEVEL_IN | CLOCK: pin->SetShape( GRAPHIC_PINSHAPE::CLOCK_LOW ); break;
|
||||||
case CLOCK:
|
case LOWLEVEL_OUT: pin->SetShape( GRAPHIC_PINSHAPE::OUTPUT_LOW ); break;
|
||||||
pin->m_shape = GRAPHIC_PINSHAPE::CLOCK;
|
case FALLING_EDGE: pin->SetShape( GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK ); break;
|
||||||
break;
|
case NONLOGIC: pin->SetShape( GRAPHIC_PINSHAPE::NONLOGIC ); break;
|
||||||
case INVERTED | CLOCK:
|
|
||||||
pin->m_shape = GRAPHIC_PINSHAPE::INVERTED_CLOCK;
|
|
||||||
break;
|
|
||||||
case LOWLEVEL_IN:
|
|
||||||
pin->m_shape = GRAPHIC_PINSHAPE::INPUT_LOW;
|
|
||||||
break;
|
|
||||||
case LOWLEVEL_IN | CLOCK:
|
|
||||||
pin->m_shape = GRAPHIC_PINSHAPE::CLOCK_LOW;
|
|
||||||
break;
|
|
||||||
case LOWLEVEL_OUT:
|
|
||||||
pin->m_shape = GRAPHIC_PINSHAPE::OUTPUT_LOW;
|
|
||||||
break;
|
|
||||||
case FALLING_EDGE:
|
|
||||||
pin->m_shape = GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK;
|
|
||||||
break;
|
|
||||||
case NONLOGIC:
|
|
||||||
pin->m_shape = GRAPHIC_PINSHAPE::NONLOGIC;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
SCH_PARSE_ERROR( "pin attributes do not define a valid pin shape", aReader, line );
|
SCH_PARSE_ERROR( "pin attributes do not define a valid pin shape", aReader, line );
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,9 +55,26 @@ SCH_PIN& SCH_PIN::operator=( const SCH_PIN& aPin )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
|
bool SCH_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxDat )
|
||||||
{
|
{
|
||||||
return m_libPin->Matches( aSearchData, aAuxData );
|
if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_PINS ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return EDA_ITEM::Matches( GetName(), aSearchData )
|
||||||
|
|| EDA_ITEM::Matches( GetNumber(), aSearchData );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SCH_PIN::Replace( wxFindReplaceData& aSearchData, void* aAuxData )
|
||||||
|
{
|
||||||
|
bool isReplaced = false;
|
||||||
|
|
||||||
|
/* TODO: waiting on a way to override pins in the schematic...
|
||||||
|
isReplaced |= EDA_ITEM::Replace( aSearchData, m_name );
|
||||||
|
isReplaced |= EDA_ITEM::Replace( aSearchData, m_number );
|
||||||
|
*/
|
||||||
|
|
||||||
|
return isReplaced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class SCH_PIN : public SCH_ITEM
|
||||||
bool m_isDangling;
|
bool m_isDangling;
|
||||||
|
|
||||||
/// The name that this pin connection will drive onto a net
|
/// The name that this pin connection will drive onto a net
|
||||||
std::mutex m_netmap_mutex;
|
std::mutex m_netmap_mutex;
|
||||||
std::map<const SCH_SHEET_PATH, wxString> m_net_name_map;
|
std::map<const SCH_SHEET_PATH, wxString> m_net_name_map;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -93,6 +93,8 @@ public:
|
||||||
|
|
||||||
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override;
|
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override;
|
||||||
|
|
||||||
|
bool Replace( wxFindReplaceData& aSearchData, void* aAuxData ) override;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* While many of these are currently simply covers for the equivalent LIB_PIN methods,
|
* While many of these are currently simply covers for the equivalent LIB_PIN methods,
|
||||||
* the new EESchema file format will soon allow us to override them at the SCH level.
|
* the new EESchema file format will soon allow us to override them at the SCH level.
|
||||||
|
|
|
@ -1289,7 +1289,7 @@ LIB_PIN* SCH_SEXPR_PARSER::parsePin()
|
||||||
EDA_TEXT text;
|
EDA_TEXT text;
|
||||||
|
|
||||||
parseEDA_TEXT( &text );
|
parseEDA_TEXT( &text );
|
||||||
pin->SetNumberTextSize( text.GetTextHeight(), false );
|
pin->SetNumberTextSize( text.GetTextHeight() );
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <lib_edit_frame.h>
|
#include <lib_edit_frame.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <ee_actions.h>
|
#include <ee_actions.h>
|
||||||
#include <dialogs/dialog_lib_edit_pin.h>
|
#include <dialogs/dialog_pin_properties.h>
|
||||||
#include <settings/settings_manager.h>
|
#include <settings/settings_manager.h>
|
||||||
#include <libedit/libedit_settings.h>
|
#include <libedit/libedit_settings.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
|
@ -108,15 +108,64 @@ bool LIB_PIN_TOOL::Init()
|
||||||
|
|
||||||
bool LIB_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
bool LIB_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
||||||
{
|
{
|
||||||
aPin->EnableEditMode( true, !m_frame->SynchronizePins() );
|
DIALOG_PIN_PROPERTIES dlg( m_frame, aPin );
|
||||||
|
|
||||||
DIALOG_LIB_EDIT_PIN dlg( m_frame, aPin );
|
if( aPin->GetEditFlags() == 0 )
|
||||||
|
m_frame->SaveCopyInUndoList( aPin->GetParent() );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
{
|
{
|
||||||
|
if( aPin->GetEditFlags() == 0 )
|
||||||
|
m_frame->PopCommandFromUndoList();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aPin->SetModified();
|
||||||
|
|
||||||
|
if( !aPin->IsNew() && m_frame->SynchronizePins() && aPin->GetParent() )
|
||||||
|
{
|
||||||
|
LIB_PINS pinList;
|
||||||
|
aPin->GetParent()->GetPins( pinList );
|
||||||
|
|
||||||
|
for( LIB_PIN* other : pinList )
|
||||||
|
{
|
||||||
|
if( other == aPin )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( other->GetPosition() == aPin->GetPosition()
|
||||||
|
&& other->GetOrientation() == aPin->GetOrientation() )
|
||||||
|
{
|
||||||
|
if( aPin->GetConvert() == 0 )
|
||||||
|
{
|
||||||
|
if( !aPin->GetUnit() || other->GetUnit() == aPin->GetUnit() )
|
||||||
|
aPin->GetParent()->RemoveDrawItem( other );
|
||||||
|
}
|
||||||
|
else if( other->GetConvert() == aPin->GetConvert() )
|
||||||
|
{
|
||||||
|
other->SetPosition( aPin->GetPosition() );
|
||||||
|
other->SetLength( aPin->GetLength() );
|
||||||
|
other->SetShape( aPin->GetShape() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( aPin->GetUnit() == 0 )
|
||||||
|
{
|
||||||
|
if( !aPin->GetConvert() || other->GetConvert() == aPin->GetConvert() )
|
||||||
|
aPin->GetParent()->RemoveDrawItem( other );
|
||||||
|
}
|
||||||
|
|
||||||
|
other->SetOrientation( aPin->GetOrientation() );
|
||||||
|
other->SetType( aPin->GetType() );
|
||||||
|
other->SetVisible( aPin->IsVisible() );
|
||||||
|
other->SetName( aPin->GetName() );
|
||||||
|
other->SetNameTextSize( aPin->GetNameTextSize() );
|
||||||
|
other->SetNumberTextSize( aPin->GetNumberTextSize() );
|
||||||
|
|
||||||
|
other->SetModified();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_frame->RefreshItem( aPin );
|
m_frame->RefreshItem( aPin );
|
||||||
m_frame->OnModify( );
|
m_frame->OnModify( );
|
||||||
|
|
||||||
|
@ -124,8 +173,6 @@ bool LIB_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
||||||
aPin->GetMsgPanelInfo( m_frame, items );
|
aPin->GetMsgPanelInfo( m_frame, items );
|
||||||
m_frame->SetMsgPanel( items );
|
m_frame->SetMsgPanel( items );
|
||||||
|
|
||||||
aPin->EnableEditMode( false );
|
|
||||||
|
|
||||||
// Save the pin properties to use for the next new pin.
|
// Save the pin properties to use for the next new pin.
|
||||||
g_LastPinNameSize = aPin->GetNameTextSize();
|
g_LastPinNameSize = aPin->GetNameTextSize();
|
||||||
g_LastPinNumSize = aPin->GetNumberTextSize();
|
g_LastPinNumSize = aPin->GetNumberTextSize();
|
||||||
|
@ -299,18 +346,22 @@ int LIB_PIN_TOOL::PushPinProperties( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
|
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
|
||||||
{
|
{
|
||||||
if( pin->GetConvert() && pin->GetConvert() != m_frame->GetConvert() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( pin == sourcePin )
|
if( pin == sourcePin )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( aEvent.IsAction( &EE_ACTIONS::pushPinLength ) )
|
if( aEvent.IsAction( &EE_ACTIONS::pushPinLength ) )
|
||||||
pin->SetLength( sourcePin->GetLength() );
|
{
|
||||||
|
if( !pin->GetConvert() || pin->GetConvert() == m_frame->GetConvert() )
|
||||||
|
pin->SetLength( sourcePin->GetLength() );
|
||||||
|
}
|
||||||
else if( aEvent.IsAction( &EE_ACTIONS::pushPinNameSize ) )
|
else if( aEvent.IsAction( &EE_ACTIONS::pushPinNameSize ) )
|
||||||
|
{
|
||||||
pin->SetNameTextSize( sourcePin->GetNameTextSize() );
|
pin->SetNameTextSize( sourcePin->GetNameTextSize() );
|
||||||
|
}
|
||||||
else if( aEvent.IsAction( &EE_ACTIONS::pushPinNumSize ) )
|
else if( aEvent.IsAction( &EE_ACTIONS::pushPinNumSize ) )
|
||||||
|
{
|
||||||
pin->SetNumberTextSize( sourcePin->GetNumberTextSize() );
|
pin->SetNumberTextSize( sourcePin->GetNumberTextSize() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_frame->RebuildView();
|
m_frame->RebuildView();
|
||||||
|
|
Loading…
Reference in New Issue