Commit 135a6274 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: enhanced Pin editor dialog.

parent 8e538ddd
#include "fctsys.h" #include "fctsys.h"
#include "macros.h"
#include "gr_basic.h"
#include "libeditframe.h"
#include "class_libentry.h"
#include "lib_pin.h"
#include "dialog_lib_edit_pin.h" #include "dialog_lib_edit_pin.h"
...@@ -7,17 +12,24 @@ ...@@ -7,17 +12,24 @@
wxPoint DIALOG_LIB_EDIT_PIN::s_LastPos( -1, -1 ); wxPoint DIALOG_LIB_EDIT_PIN::s_LastPos( -1, -1 );
wxSize DIALOG_LIB_EDIT_PIN::s_LastSize; wxSize DIALOG_LIB_EDIT_PIN::s_LastSize;
DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent ) : DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ) :
DIALOG_LIB_EDIT_PIN_BASE( parent ) DIALOG_LIB_EDIT_PIN_BASE( parent )
{ {
m_dummyPin = new LIB_PIN( *aPin );
m_panelShowPin->SetBackgroundColour( MakeColour( g_DrawBgColor ) );
/* Required to make escape key work correctly in wxGTK. */ /* Required to make escape key work correctly in wxGTK. */
SetFocus(); SetFocus();
// Set tab order // Set tab order
m_textPinName-> MoveAfterInTabOrder(this);
m_textPadName-> MoveAfterInTabOrder(m_textPinName); m_textPadName-> MoveAfterInTabOrder(m_textPinName);
m_sdbSizerButtonsOK->SetDefault(); m_sdbSizerButtonsOK->SetDefault();
} }
DIALOG_LIB_EDIT_PIN::~DIALOG_LIB_EDIT_PIN()
{
delete m_dummyPin;
}
void DIALOG_LIB_EDIT_PIN::SetLastSizeAndPosition() void DIALOG_LIB_EDIT_PIN::SetLastSizeAndPosition()
{ {
if( s_LastPos.x != -1 ) if( s_LastPos.x != -1 )
...@@ -32,6 +44,37 @@ void DIALOG_LIB_EDIT_PIN::SetLastSizeAndPosition() ...@@ -32,6 +44,37 @@ void DIALOG_LIB_EDIT_PIN::SetLastSizeAndPosition()
Center(); Center();
} }
/*
* Draw (on m_panelShowPin) the pin currently edited
* accroding to current settings in dialog
*/
void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
{
wxPaintDC dc( m_panelShowPin );
wxSize dc_size = dc.GetSize();
dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
// Calculate a suitable scale to fit the available draw area
EDA_RECT bBox = m_dummyPin->GetBoundingBox();
double xscale = (double) dc_size.x / bBox.GetWidth();
double yscale = (double) dc_size.y / bBox.GetHeight();
double scale = MIN( xscale, yscale );
// Give a 10% margin
scale *= 0.9;
dc.SetUserScale( scale, scale );
wxPoint offset = bBox.Centre();
NEGATE( offset.x );
NEGATE( offset.y );
GRResetPenAndBrush( &dc );
m_dummyPin->Draw( NULL, &dc, offset, -1, wxCOPY,
NULL, DefaultTransform );
event.Skip();
}
void DIALOG_LIB_EDIT_PIN::OnCloseDialog( wxCloseEvent& event ) void DIALOG_LIB_EDIT_PIN::OnCloseDialog( wxCloseEvent& event )
{ {
// Save the dialog's position // Save the dialog's position
...@@ -56,6 +99,26 @@ void DIALOG_LIB_EDIT_PIN::OnOKButtonClick( wxCommandEvent& event ) ...@@ -56,6 +99,26 @@ void DIALOG_LIB_EDIT_PIN::OnOKButtonClick( wxCommandEvent& event )
EndModal( wxID_OK ); EndModal( wxID_OK );
} }
// Called when a pin properties changes
void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event )
{
int units = ((LIB_EDIT_FRAME*)GetParent())->m_InternalUnits;
int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize(), units );
int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize(), units);
int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() );
int pinLength = ReturnValueFromString( g_UserUnit, GetLength(), units );
int pinShape = LIB_PIN::GetStyleCode( GetStyle() );
m_dummyPin->SetName( GetName() );
m_dummyPin->SetNameTextSize( pinNameSize );
m_dummyPin->SetNumber( GetPadName() );
m_dummyPin->SetNumberTextSize( pinNumSize );
m_dummyPin->SetOrientation( pinOrient );
m_dummyPin->SetLength( pinLength );
m_dummyPin->SetShape( pinShape );
m_panelShowPin->Refresh();
}
void DIALOG_LIB_EDIT_PIN::SetOrientationList( const wxArrayString& list, void DIALOG_LIB_EDIT_PIN::SetOrientationList( const wxArrayString& list,
......
...@@ -13,17 +13,22 @@ ...@@ -13,17 +13,22 @@
/** 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_LIB_EDIT_PIN : public DIALOG_LIB_EDIT_PIN_BASE
{ {
static wxSize s_LastSize; ///< last position and size static wxSize s_LastSize; ///< last position and size
static wxPoint s_LastPos; static wxPoint s_LastPos;
LIB_PIN * m_dummyPin; // a working copy used to show changes
public: public:
/** Constructor */ /** Constructor */
DIALOG_LIB_EDIT_PIN( wxWindow* parent ); DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin );
~DIALOG_LIB_EDIT_PIN();
void SetLastSizeAndPosition(); void SetLastSizeAndPosition();
void OnCloseDialog( wxCloseEvent& event ); void OnCloseDialog( wxCloseEvent& event );
void OnCancelButtonClick( wxCommandEvent& event ); void OnCancelButtonClick( wxCommandEvent& event );
void OnOKButtonClick( wxCommandEvent& event ); void OnOKButtonClick( wxCommandEvent& event );
void OnPaintShowPanel( wxPaintEvent& event );
void OnPropertiesChange( wxCommandEvent& event );
void SetOrientationList( const wxArrayString& list, const char *** aBitmaps ); void SetOrientationList( const wxArrayString& list, const char *** aBitmaps );
void SetOrientation( int orientation ) void SetOrientation( int orientation )
......
...@@ -11,13 +11,6 @@ ...@@ -11,13 +11,6 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_LIB_EDIT_PIN_BASE, wxDialog )
EVT_CLOSE( DIALOG_LIB_EDIT_PIN_BASE::_wxFB_OnCloseDialog )
EVT_CHECKBOX( wxID_ANY, DIALOG_LIB_EDIT_PIN_BASE::_wxFB_OnCBpartSelection )
EVT_BUTTON( wxID_CANCEL, DIALOG_LIB_EDIT_PIN_BASE::_wxFB_OnCancelButtonClick )
EVT_BUTTON( wxID_OK, DIALOG_LIB_EDIT_PIN_BASE::_wxFB_OnOKButtonClick )
END_EVENT_TABLE()
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 ) : wxDialog( parent, id, title, pos, size, style ) 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 ) : wxDialog( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
...@@ -25,135 +18,140 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID ...@@ -25,135 +18,140 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* mainSizer; wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL ); mainSizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer1; wxBoxSizer* bUpperSizer;
fgSizer1 = new wxFlexGridSizer( 5, 6, 0, 0 ); bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->AddGrowableCol( 4 ); wxBoxSizer* bLeftSizer;
fgSizer1->SetFlexibleDirection( wxBOTH ); bLeftSizer = new wxBoxSizer( wxVERTICAL );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL );
wxFlexGridSizer* fgSizerPins;
fgSizerPins = new wxFlexGridSizer( 5, 2, 0, 0 );
fgSizerPins->AddGrowableCol( 1 );
fgSizerPins->SetFlexibleDirection( wxBOTH );
fgSizerPins->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL );
m_staticTextPinName = new wxStaticText( this, wxID_ANY, _("Pin &name:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPinName = new wxStaticText( this, wxID_ANY, _("Pin &name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPinName->Wrap( -1 ); m_staticTextPinName->Wrap( -1 );
fgSizer1->Add( m_staticTextPinName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizerPins->Add( m_staticTextPinName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_textPinName = new wxTextCtrl( this, ID_M_TEXTPINNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textPinName = new wxTextCtrl( this, ID_M_TEXTPINNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textPinName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 ); fgSizerPins->Add( m_textPinName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 3 );
m_staticTextNameSize = new wxStaticText( this, wxID_ANY, _("N&ame text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextNameSize->Wrap( -1 );
fgSizer1->Add( m_staticTextNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_textPinNameTextSize = new wxTextCtrl( this, ID_M_TEXTPINNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textPinNameTextSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
m_staticNameTextSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticNameTextSizeUnits->Wrap( -1 );
fgSizer1->Add( m_staticNameTextSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticTextPadName = new wxStaticText( this, ID_M_STATICTEXTPADNAME, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPadName = new wxStaticText( this, ID_M_STATICTEXTPADNAME, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPadName->Wrap( -1 ); m_staticTextPadName->Wrap( -1 );
m_staticTextPadName->SetToolTip( _("Pin number: 1 to 4 ASCII letters and/or digits") ); m_staticTextPadName->SetToolTip( _("Pin number: 1 to 4 ASCII letters and/or digits") );
fgSizer1->Add( m_staticTextPadName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizerPins->Add( m_staticTextPadName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_textPadName = new wxTextCtrl( this, ID_M_TEXTPADNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textPadName = new wxTextCtrl( this, ID_M_TEXTPADNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textPadName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 ); fgSizerPins->Add( m_textPadName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 3 );
m_staticTextPadNameSize = new wxStaticText( this, wxID_ANY, _("Number te&xt size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPadNameSize->Wrap( -1 );
fgSizer1->Add( m_staticTextPadNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_textPadNameTextSize = new wxTextCtrl( this, ID_M_TEXTPADNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textPadNameTextSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
m_staticNumberTextSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticNumberTextSizeUnits->Wrap( -1 );
fgSizer1->Add( m_staticNumberTextSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("&Orientation:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("&Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextOrient->Wrap( -1 ); m_staticTextOrient->Wrap( -1 );
fgSizer1->Add( m_staticTextOrient, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizerPins->Add( m_staticTextOrient, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_choiceOrientation = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_choiceOrientation = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
fgSizer1->Add( m_choiceOrientation, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); fgSizerPins->Add( m_choiceOrientation, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticTextEType = new wxStaticText( this, wxID_ANY, _("&Electrical type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextEType->Wrap( -1 );
m_staticTextEType->SetToolTip( _("Used by the ERC.") );
fgSizer1->Add( 15, 0, 1, wxEXPAND, 3 ); fgSizerPins->Add( m_staticTextEType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticTextPinLen = new wxStaticText( this, ID_M_STATICTEXTPINLEN, _("&Length:"), wxDefaultPosition, wxDefaultSize, 0 ); m_choiceElectricalType = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_staticTextPinLen->Wrap( -1 ); fgSizerPins->Add( m_choiceElectricalType, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
fgSizer1->Add( m_staticTextPinLen, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_textLength = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic &Style:"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textLength, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 ); m_staticTextGstyle->Wrap( -1 );
fgSizerPins->Add( m_staticTextGstyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticLengthUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); m_choiceStyle = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_staticLengthUnits->Wrap( -1 ); fgSizerPins->Add( m_choiceStyle, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
fgSizer1->Add( m_staticLengthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticTextEType = new wxStaticText( this, wxID_ANY, _("&Electrical type:"), wxDefaultPosition, wxDefaultSize, 0 ); bLeftSizer->Add( fgSizerPins, 0, wxALL|wxEXPAND, 5 );
m_staticTextEType->Wrap( -1 );
m_staticTextEType->SetToolTip( _("Used by the ERC.") );
fgSizer1->Add( m_staticTextEType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); wxBoxSizer* boarderSizer;
boarderSizer = new wxBoxSizer( wxVERTICAL );
m_choiceElectricalType = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); wxStaticBoxSizer* sbSizerPinSharing;
fgSizer1->Add( m_choiceElectricalType, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); sbSizerPinSharing = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pin Sharing") ), wxVERTICAL );
m_checkApplyToAllParts = new wxCheckBox( this, wxID_ANY, _("Add to all &parts in package"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkApplyToAllParts->SetValue(true);
sbSizerPinSharing->Add( m_checkApplyToAllParts, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 3 ); m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Add to all alternate &body styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerPinSharing->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
boarderSizer->Add( sbSizerPinSharing, 0, wxEXPAND|wxALL, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); wxStaticBoxSizer* sbSizerSchematicProperties;
sbSizerSchematicProperties = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Schematic Properties") ), wxVERTICAL );
m_checkShow = new wxCheckBox( this, wxID_ANY, _("&Visible"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShow->SetValue(true);
sbSizerSchematicProperties->Add( m_checkShow, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); boarderSizer->Add( sbSizerSchematicProperties, 0, wxEXPAND|wxALL, 5 );
bLeftSizer->Add( boarderSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 12 );
fgSizer1->Add( 0, 0, 0, wxEXPAND, 3 ); bUpperSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic &Style:"), wxDefaultPosition, wxDefaultSize, 0 ); wxBoxSizer* bRightSizer;
m_staticTextGstyle->Wrap( -1 ); bRightSizer = new wxBoxSizer( wxVERTICAL );
fgSizer1->Add( m_staticTextGstyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_choiceStyle = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); wxFlexGridSizer* fgSizerTextsSizes;
fgSizer1->Add( m_choiceStyle, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); fgSizerTextsSizes = new wxFlexGridSizer( 3, 3, 0, 0 );
fgSizerTextsSizes->AddGrowableCol( 1 );
fgSizerTextsSizes->SetFlexibleDirection( wxBOTH );
fgSizerTextsSizes->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL );
m_staticTextNameSize = new wxStaticText( this, ID_M_STATICTEXTNAMESIZE, _("N&ame text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextNameSize->Wrap( -1 );
fgSizerTextsSizes->Add( m_staticTextNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 3 ); m_textPinNameTextSize = new wxTextCtrl( this, ID_M_TEXTPINNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTextsSizes->Add( m_textPinNameTextSize, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
m_staticNameTextSizeUnits = new wxStaticText( this, ID_M_STATICNAMETEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticNameTextSizeUnits->Wrap( -1 );
fgSizerTextsSizes->Add( m_staticNameTextSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); m_staticTextPadNameSize = new wxStaticText( this, ID_M_STATICTEXTPADNAMESIZE, _("Number te&xt size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPadNameSize->Wrap( -1 );
fgSizerTextsSizes->Add( m_staticTextPadNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_textPadNameTextSize = new wxTextCtrl( this, ID_M_TEXTPADNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTextsSizes->Add( m_textPadNameTextSize, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxEXPAND, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); m_staticNumberTextSizeUnits = new wxStaticText( this, ID_M_STATICNUMBERTEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticNumberTextSizeUnits->Wrap( -1 );
fgSizerTextsSizes->Add( m_staticNumberTextSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
mainSizer->Add( fgSizer1, 1, wxALL|wxEXPAND, 12 ); m_staticTextPinLen = new wxStaticText( this, ID_M_STATICTEXTPINLEN, _("&Length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPinLen->Wrap( -1 );
fgSizerTextsSizes->Add( m_staticTextPinLen, 0, wxALL, 5 );
wxBoxSizer* boarderSizer; m_textLength = new wxTextCtrl( this, ID_M_TEXTLENGTH, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
boarderSizer = new wxBoxSizer( wxVERTICAL ); fgSizerTextsSizes->Add( m_textLength, 0, wxTOP|wxBOTTOM|wxEXPAND, 5 );
m_checkApplyToAllParts = new wxCheckBox( this, wxID_ANY, _("Add to all &parts in package"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticLengthUnits = new wxStaticText( this, ID_M_STATICLENGTHUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
boarderSizer->Add( m_checkApplyToAllParts, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_staticLengthUnits->Wrap( -1 );
fgSizerTextsSizes->Add( m_staticLengthUnits, 0, wxALL, 5 );
m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Add to all alternate &body styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 ); bRightSizer->Add( fgSizerTextsSizes, 0, wxALL|wxEXPAND, 5 );
boarderSizer->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_checkShow = new wxCheckBox( this, wxID_ANY, _("&Visible"), wxDefaultPosition, wxDefaultSize, 0 ); m_panelShowPin = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
m_checkShow->SetValue(true); bRightSizer->Add( m_panelShowPin, 1, wxEXPAND | wxALL, 5 );
boarderSizer->Add( m_checkShow, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bUpperSizer->Add( bRightSizer, 1, wxEXPAND|wxRIGHT, 5 );
boarderSizer->Add( 0, 5, 0, wxALL|wxEXPAND, 10 ); mainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
boarderSizer->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); mainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_sdbSizerButtons = new wxStdDialogButtonSizer(); m_sdbSizerButtons = new wxStdDialogButtonSizer();
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK ); m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
...@@ -161,16 +159,44 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID ...@@ -161,16 +159,44 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL ); m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel ); m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize(); m_sdbSizerButtons->Realize();
boarderSizer->Add( m_sdbSizerButtons, 0, wxALL|wxALIGN_RIGHT, 0 ); mainSizer->Add( m_sdbSizerButtons, 0, wxALL|wxALIGN_RIGHT, 5 );
mainSizer->Add( boarderSizer, 0, wxALL|wxEXPAND, 12 );
this->SetSizer( mainSizer ); this->SetSizer( mainSizer );
this->Layout(); this->Layout();
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnCloseDialog ) );
m_textPinName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_textPadName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceOrientation->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceElectricalType->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceStyle->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_checkApplyToAllConversions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnCBpartSelection ), NULL, this );
m_textPinNameTextSize->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_textPadNameTextSize->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_textLength->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_panelShowPin->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPaintShowPanel ), NULL, this );
m_sdbSizerButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizerButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnOKButtonClick ), NULL, this );
} }
DIALOG_LIB_EDIT_PIN_BASE::~DIALOG_LIB_EDIT_PIN_BASE() DIALOG_LIB_EDIT_PIN_BASE::~DIALOG_LIB_EDIT_PIN_BASE()
{ {
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnCloseDialog ) );
m_textPinName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_textPadName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceOrientation->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceElectricalType->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceStyle->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_checkApplyToAllConversions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnCBpartSelection ), NULL, this );
m_textPinNameTextSize->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_textPadNameTextSize->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_textLength->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_panelShowPin->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPaintShowPanel ), NULL, this );
m_sdbSizerButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnOKButtonClick ), NULL, this );
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -22,6 +22,8 @@ class wxBitmapComboBox; ...@@ -22,6 +22,8 @@ class wxBitmapComboBox;
#include <wx/combobox.h> #include <wx/combobox.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/statbox.h>
#include <wx/panel.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
...@@ -33,60 +35,48 @@ class wxBitmapComboBox; ...@@ -33,60 +35,48 @@ class wxBitmapComboBox;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_LIB_EDIT_PIN_BASE : public wxDialog class DIALOG_LIB_EDIT_PIN_BASE : public wxDialog
{ {
DECLARE_EVENT_TABLE()
private: private:
// Private event handlers
void _wxFB_OnCloseDialog( wxCloseEvent& event ){ OnCloseDialog( event ); }
void _wxFB_OnCBpartSelection( wxCommandEvent& event ){ OnCBpartSelection( event ); }
void _wxFB_OnCancelButtonClick( wxCommandEvent& event ){ OnCancelButtonClick( event ); }
void _wxFB_OnOKButtonClick( wxCommandEvent& event ){ OnOKButtonClick( event ); }
protected: protected:
enum enum
{ {
ID_M_TEXTPINNAME = 1000, ID_M_TEXTPINNAME = 1000,
ID_M_TEXTPINNAMETEXTSIZE,
ID_M_STATICTEXTPADNAME, ID_M_STATICTEXTPADNAME,
ID_M_TEXTPADNAME, ID_M_TEXTPADNAME,
ID_M_STATICTEXTNAMESIZE,
ID_M_TEXTPINNAMETEXTSIZE,
ID_M_STATICNAMETEXTSIZEUNITS,
ID_M_STATICTEXTPADNAMESIZE,
ID_M_TEXTPADNAMETEXTSIZE, ID_M_TEXTPADNAMETEXTSIZE,
ID_M_STATICNUMBERTEXTSIZEUNITS,
ID_M_STATICTEXTPINLEN, ID_M_STATICTEXTPINLEN,
ID_M_TEXTLENGTH,
ID_M_STATICLENGTHUNITS,
}; };
wxStaticText* m_staticTextPinName; wxStaticText* m_staticTextPinName;
wxTextCtrl* m_textPinName; wxTextCtrl* m_textPinName;
wxStaticText* m_staticTextNameSize;
wxTextCtrl* m_textPinNameTextSize;
wxStaticText* m_staticNameTextSizeUnits;
wxStaticText* m_staticTextPadName; wxStaticText* m_staticTextPadName;
wxTextCtrl* m_textPadName; wxTextCtrl* m_textPadName;
wxStaticText* m_staticTextPadNameSize;
wxTextCtrl* m_textPadNameTextSize;
wxStaticText* m_staticNumberTextSizeUnits;
wxStaticText* m_staticTextOrient; wxStaticText* m_staticTextOrient;
wxBitmapComboBox* m_choiceOrientation; wxBitmapComboBox* m_choiceOrientation;
wxStaticText* m_staticTextPinLen;
wxTextCtrl* m_textLength;
wxStaticText* m_staticLengthUnits;
wxStaticText* m_staticTextEType; wxStaticText* m_staticTextEType;
wxBitmapComboBox* m_choiceElectricalType; wxBitmapComboBox* m_choiceElectricalType;
wxStaticText* m_staticTextGstyle; wxStaticText* m_staticTextGstyle;
wxBitmapComboBox* m_choiceStyle; wxBitmapComboBox* m_choiceStyle;
wxCheckBox* m_checkApplyToAllParts; wxCheckBox* m_checkApplyToAllParts;
wxCheckBox* m_checkApplyToAllConversions; wxCheckBox* m_checkApplyToAllConversions;
wxCheckBox* m_checkShow; wxCheckBox* m_checkShow;
wxStaticText* m_staticTextNameSize;
wxTextCtrl* m_textPinNameTextSize;
wxStaticText* m_staticNameTextSizeUnits;
wxStaticText* m_staticTextPadNameSize;
wxTextCtrl* m_textPadNameTextSize;
wxStaticText* m_staticNumberTextSizeUnits;
wxStaticText* m_staticTextPinLen;
wxTextCtrl* m_textLength;
wxStaticText* m_staticLengthUnits;
wxPanel* m_panelShowPin;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizerButtons; wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK; wxButton* m_sdbSizerButtonsOK;
...@@ -94,14 +84,16 @@ class DIALOG_LIB_EDIT_PIN_BASE : public wxDialog ...@@ -94,14 +84,16 @@ class DIALOG_LIB_EDIT_PIN_BASE : public wxDialog
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); } virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
virtual void OnPropertiesChange( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCBpartSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnCBpartSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
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( 487,344 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 499,372 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_EDIT_PIN_BASE(); ~DIALOG_LIB_EDIT_PIN_BASE();
}; };
......
...@@ -319,7 +319,7 @@ void LIB_ARC::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, ...@@ -319,7 +319,7 @@ void LIB_ARC::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LIB_ARC::GetPenSize() int LIB_ARC::GetPenSize() const
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
} }
......
...@@ -102,7 +102,7 @@ public: ...@@ -102,7 +102,7 @@ public:
/** /**
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
virtual int GetPenSize( ); virtual int GetPenSize( ) const;
/** /**
* See LIB_DRAW_ITEM::BeginEdit(). * See LIB_DRAW_ITEM::BeginEdit().
......
...@@ -236,7 +236,7 @@ void LIB_BEZIER::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, ...@@ -236,7 +236,7 @@ void LIB_BEZIER::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LIB_BEZIER::GetPenSize() int LIB_BEZIER::GetPenSize() const
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
} }
......
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
/** /**
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
virtual int GetPenSize( ); virtual int GetPenSize( ) const;
virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame ); virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame );
......
...@@ -191,7 +191,7 @@ void LIB_CIRCLE::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, ...@@ -191,7 +191,7 @@ void LIB_CIRCLE::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LIB_CIRCLE::GetPenSize() int LIB_CIRCLE::GetPenSize() const
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
} }
......
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
/** /**
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
virtual int GetPenSize( ); virtual int GetPenSize( ) const;
virtual EDA_RECT GetBoundingBox() const; virtual EDA_RECT GetBoundingBox() const;
virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame ); virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame );
......
...@@ -185,7 +185,7 @@ public: ...@@ -185,7 +185,7 @@ public:
/** /**
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
virtual int GetPenSize() = 0; virtual int GetPenSize() const = 0;
/** /**
* Write draw item object to \a aFile in "*.lib" format. * Write draw item object to \a aFile in "*.lib" format.
......
...@@ -272,7 +272,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg ) ...@@ -272,7 +272,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LIB_FIELD::GetPenSize() int LIB_FIELD::GetPenSize() const
{ {
return ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness; return ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness;
} }
......
...@@ -86,10 +86,10 @@ public: ...@@ -86,10 +86,10 @@ public:
void SetId( int aId ) { m_id = aId; } void SetId( int aId ) { m_id = aId; }
/** /**
* Function GetPenSize virtual pure * Function GetPenSize virtual
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int GetPenSize( ); virtual int GetPenSize( ) const;
/** /**
* Writes field object out to a FILE in "*.lib" format. * Writes field object out to a FILE in "*.lib" format.
......
...@@ -34,9 +34,10 @@ static const wxString pin_orientation_names[] = ...@@ -34,9 +34,10 @@ static const wxString pin_orientation_names[] =
_( "Up" ), _( "Up" ),
_( "Down" ) _( "Down" )
}; };
// bitmaps to show pins orientations in dialog editor // bitmaps to show pins orientations in dialog editor
// must have same order than pin_orientation_names // must have same order than pin_orientation_names
static const char ** s_icons_Pins_Orientations[] = static const char** s_icons_Pins_Orientations[] =
{ {
pinorient_right_xpm, pinorient_right_xpm,
pinorient_left_xpm, pinorient_left_xpm,
...@@ -44,7 +45,7 @@ static const char ** s_icons_Pins_Orientations[] = ...@@ -44,7 +45,7 @@ static const char ** s_icons_Pins_Orientations[] =
pinorient_down_xpm, pinorient_down_xpm,
}; };
static const int pin_orientation_codes[] = static const int pin_orientation_codes[] =
{ {
PIN_RIGHT, PIN_RIGHT,
PIN_LEFT, PIN_LEFT,
...@@ -53,8 +54,8 @@ static const int pin_orientation_codes[] = ...@@ -53,8 +54,8 @@ static const int pin_orientation_codes[] =
}; };
#define PIN_ORIENTATION_CNT ( sizeof( pin_orientation_names ) / \ #define PIN_ORIENTATION_CNT ( sizeof( pin_orientation_names ) / \
sizeof( wxString ) ) sizeof( wxString ) )
static const wxString pin_style_names[] = static const wxString pin_style_names[] =
...@@ -72,7 +73,7 @@ static const wxString pin_style_names[] = ...@@ -72,7 +73,7 @@ static const wxString pin_style_names[] =
// bitmaps to show pins shapes in dialog editor // bitmaps to show pins shapes in dialog editor
// must have same order than pin_style_names // must have same order than pin_style_names
static const char ** s_icons_Pins_Shapes[] = static const char** s_icons_Pins_Shapes[] =
{ {
pinshape_normal_xpm, pinshape_normal_xpm,
pinshape_invert_xpm, pinshape_invert_xpm,
...@@ -86,7 +87,7 @@ static const char ** s_icons_Pins_Shapes[] = ...@@ -86,7 +87,7 @@ static const char ** s_icons_Pins_Shapes[] =
}; };
#define PIN_STYLE_CNT ( sizeof( pin_style_names ) / sizeof( wxString ) ) #define PIN_STYLE_CNT ( sizeof( pin_style_names ) / sizeof( wxString ) )
static const int pin_style_codes[] = static const int pin_style_codes[] =
...@@ -120,7 +121,7 @@ static const wxString pin_electrical_type_names[] = ...@@ -120,7 +121,7 @@ static const wxString pin_electrical_type_names[] =
// bitmaps to show pins electrical type in dialog editor // bitmaps to show pins electrical type in dialog editor
// must have same order than pin_electrical_type_names // must have same order than pin_electrical_type_names
static const char ** s_icons_Pins_Electrical_Type[] = static const char** s_icons_Pins_Electrical_Type[] =
{ {
pintype_input_xpm, pintype_input_xpm,
pintype_output_xpm, pintype_output_xpm,
...@@ -160,19 +161,19 @@ extern void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos, ...@@ -160,19 +161,19 @@ extern void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
int len, int orient, int Shape ); int len, int orient, int Shape );
LIB_PIN::LIB_PIN( LIB_COMPONENT * aParent ) : LIB_PIN::LIB_PIN( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( LIB_PIN_T, aParent ) LIB_DRAW_ITEM( LIB_PIN_T, aParent )
{ {
m_length = 300; /* default Pin len */ m_length = 300; /* default Pin len */
m_orientation = PIN_RIGHT; /* Pin orient: Up, Down, Left, Right */ m_orientation = PIN_RIGHT; /* Pin orient: Up, Down, Left, Right */
m_shape = NONE; /* Pin shape, bitwise. */ m_shape = NONE; /* Pin shape, bitwise. */
m_type = PIN_UNSPECIFIED; /* electrical type of pin */ m_type = PIN_UNSPECIFIED; /* electrical type of pin */
m_attributes = 0; /* bit 0 != 0: pin invisible */ m_attributes = 0; /* bit 0 != 0: pin invisible */
m_number = 0; /* pin number ( i.e. 4 codes ASCII ) */ m_number = 0; /* pin number ( i.e. 4 codes ASCII ) */
m_PinNumSize = 50; m_PinNumSize = 50;
m_PinNameSize = 50; /* Default size for pin name and num */ m_PinNameSize = 50; /* Default size for pin name and num */
m_width = 0; m_width = 0;
m_typeName = _( "Pin" ); m_typeName = _( "Pin" );
m_PinNumShapeOpt = 0; m_PinNumShapeOpt = 0;
m_PinNameShapeOpt = 0; m_PinNameShapeOpt = 0;
m_PinNumPositionOpt = 0; m_PinNumPositionOpt = 0;
...@@ -182,11 +183,11 @@ LIB_PIN::LIB_PIN( LIB_COMPONENT * aParent ) : ...@@ -182,11 +183,11 @@ LIB_PIN::LIB_PIN( LIB_COMPONENT * aParent ) :
LIB_PIN::LIB_PIN( const LIB_PIN& pin ) : LIB_DRAW_ITEM( pin ) LIB_PIN::LIB_PIN( const LIB_PIN& pin ) : LIB_DRAW_ITEM( pin )
{ {
m_position = pin.m_position; m_position = pin.m_position;
m_length = pin.m_length; m_length = pin.m_length;
m_orientation = pin.m_orientation; m_orientation = pin.m_orientation;
m_shape = pin.m_shape; m_shape = pin.m_shape;
m_type = pin.m_type; m_type = pin.m_type;
m_attributes = pin.m_attributes; m_attributes = pin.m_attributes;
m_number = pin.m_number; m_number = pin.m_number;
m_PinNumSize = pin.m_PinNumSize; m_PinNumSize = pin.m_PinNumSize;
...@@ -195,14 +196,15 @@ LIB_PIN::LIB_PIN( const LIB_PIN& pin ) : LIB_DRAW_ITEM( pin ) ...@@ -195,14 +196,15 @@ LIB_PIN::LIB_PIN( const LIB_PIN& pin ) : LIB_DRAW_ITEM( pin )
m_PinNameShapeOpt = pin.m_PinNameShapeOpt; m_PinNameShapeOpt = pin.m_PinNameShapeOpt;
m_PinNumPositionOpt = pin.m_PinNumPositionOpt; m_PinNumPositionOpt = pin.m_PinNumPositionOpt;
m_PinNamePositionOpt = pin.m_PinNamePositionOpt; m_PinNamePositionOpt = pin.m_PinNamePositionOpt;
m_width = pin.m_width; m_width = pin.m_width;
m_name = pin.m_name; m_name = pin.m_name;
} }
void LIB_PIN::SetName( const wxString& aName ) void LIB_PIN::SetName( const wxString& aName )
{ {
wxString tmp = ( aName.IsEmpty() ) ? wxT( "~" ) : aName; wxString tmp = ( aName.IsEmpty() ) ? wxT( "~" ) : aName;
tmp.Replace( wxT( " " ), wxT( "_" ) ); tmp.Replace( wxT( " " ), wxT( "_" ) );
if( m_name != tmp ) if( m_name != tmp )
...@@ -256,8 +258,9 @@ void LIB_PIN::SetNameTextSize( int size ) ...@@ -256,8 +258,9 @@ void LIB_PIN::SetNameTextSize( int size )
void LIB_PIN::SetNumber( const wxString& number ) void LIB_PIN::SetNumber( const wxString& number )
{ {
wxString tmp = ( number.IsEmpty() ) ? wxT( "~" ) : number; wxString tmp = ( number.IsEmpty() ) ? wxT( "~" ) : number;
tmp.Replace( wxT( " " ), wxT( "_" ) ); tmp.Replace( wxT( " " ), wxT( "_" ) );
long oldNumber = m_number; long oldNumber = m_number;
SetPinNumFromString( tmp ); SetPinNumFromString( tmp );
if( m_number != oldNumber ) if( m_number != oldNumber )
...@@ -338,8 +341,8 @@ void LIB_PIN::SetShape( int aShape ) ...@@ -338,8 +341,8 @@ void LIB_PIN::SetShape( int aShape )
for( size_t i = 0; i < pinList.size(); i++ ) for( size_t i = 0; i < pinList.size(); i++ )
{ {
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
|| pinList[i]->m_Convert != m_Convert || pinList[i]->m_Convert != m_Convert
|| pinList[i]->m_shape == aShape ) || pinList[i]->m_shape == aShape )
continue; continue;
pinList[i]->m_shape = aShape; pinList[i]->m_shape = aShape;
...@@ -390,8 +393,8 @@ void LIB_PIN::SetLength( int length ) ...@@ -390,8 +393,8 @@ void LIB_PIN::SetLength( int length )
for( size_t i = 0; i < pinList.size(); i++ ) for( size_t i = 0; i < pinList.size(); i++ )
{ {
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
|| pinList[i]->m_Convert != m_Convert || pinList[i]->m_Convert != m_Convert
|| pinList[i]->m_length == length ) || pinList[i]->m_length == length )
continue; continue;
pinList[i]->m_length = length; pinList[i]->m_length = length;
...@@ -419,9 +422,9 @@ void LIB_PIN::SetPartNumber( int part ) ...@@ -419,9 +422,9 @@ void LIB_PIN::SetPartNumber( int part )
tmp = GetParent()->GetNextPin( pin ); tmp = GetParent()->GetNextPin( pin );
if( pin->m_Flags == 0 || pin == this if( pin->m_Flags == 0 || pin == this
|| ( m_Convert && ( m_Convert != pin->m_Convert ) ) || ( m_Convert && ( m_Convert != pin->m_Convert ) )
|| ( m_position != pin->m_position ) || ( m_position != pin->m_position )
|| ( pin->m_orientation != m_orientation ) ) || ( pin->m_orientation != m_orientation ) )
continue; continue;
GetParent()->RemoveDrawItem( (LIB_DRAW_ITEM*) pin ); GetParent()->RemoveDrawItem( (LIB_DRAW_ITEM*) pin );
...@@ -436,7 +439,7 @@ void LIB_PIN::SetConversion( int style ) ...@@ -436,7 +439,7 @@ void LIB_PIN::SetConversion( int style )
return; return;
m_Convert = style; m_Convert = style;
m_Flags |= IS_CHANGED; m_Flags |= IS_CHANGED;
if( style == 0 ) if( style == 0 )
{ {
...@@ -449,10 +452,10 @@ void LIB_PIN::SetConversion( int style ) ...@@ -449,10 +452,10 @@ void LIB_PIN::SetConversion( int style )
tmp = GetParent()->GetNextPin( pin ); tmp = GetParent()->GetNextPin( pin );
if( ( pin->m_Flags & IS_LINKED ) == 0 if( ( pin->m_Flags & IS_LINKED ) == 0
|| ( pin == this ) || ( pin == this )
|| ( m_Unit && ( m_Unit != pin->m_Unit ) ) || ( m_Unit && ( m_Unit != pin->m_Unit ) )
|| ( m_position != pin->m_position ) || ( m_position != pin->m_position )
|| ( pin->m_orientation != m_orientation ) ) || ( pin->m_orientation != m_orientation ) )
continue; continue;
GetParent()->RemoveDrawItem( (LIB_DRAW_ITEM*) pin ); GetParent()->RemoveDrawItem( (LIB_DRAW_ITEM*) pin );
...@@ -509,10 +512,10 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin ) ...@@ -509,10 +512,10 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin )
continue; continue;
if( ( pinList[i]->m_position == m_position ) if( ( pinList[i]->m_position == m_position )
&& ( pinList[i]->m_orientation == m_orientation ) && ( pinList[i]->m_orientation == m_orientation )
&& !IsNew() && !IsNew()
&& editPinByPin == false && editPinByPin == false
&& enable ) && enable )
pinList[i]->m_Flags |= IS_LINKED | IN_EDIT; pinList[i]->m_Flags |= IS_LINKED | IN_EDIT;
else else
pinList[i]->m_Flags &= ~( IS_LINKED | IN_EDIT ); pinList[i]->m_Flags &= ~( IS_LINKED | IN_EDIT );
...@@ -780,7 +783,7 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg ) ...@@ -780,7 +783,7 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LIB_PIN::GetPenSize() int LIB_PIN::GetPenSize() const
{ {
return ( m_width == 0 ) ? g_DrawDefaultLineThickness : m_width; return ( m_width == 0 ) ? g_DrawDefaultLineThickness : m_width;
} }
...@@ -807,13 +810,13 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel, ...@@ -807,13 +810,13 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
} }
LIB_COMPONENT* Entry = GetParent(); LIB_COMPONENT* Entry = GetParent();
bool DrawPinText = true; bool DrawPinText = true;
if( ( aData != NULL ) && ( (bool*) aData == false ) ) if( ( aData != NULL ) && ( (bool*) aData == false ) )
DrawPinText = false; DrawPinText = false;
/* Calculate pin orient taking in account the component orientation. */ /* Calculate pin orient taking in account the component orientation. */
int orient = ReturnPinDrawOrient( aTransform ); int orient = ReturnPinDrawOrient( aTransform );
/* Calculate the pin position */ /* Calculate the pin position */
wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset; wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
...@@ -831,10 +834,10 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel, ...@@ -831,10 +834,10 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
/* Set to one (1) to draw bounding box around pin to validate bounding /* Set to one (1) to draw bounding box around pin to validate bounding
* box calculation. */ * box calculation. */
#if 0 #if 0
EDA_RECT bBox = GetBoundingBox(); EDA_RECT* clipbox = aPanel ? &aPanel->m_ClipBox : NULL;
bBox.Inflate( 5, 5 ); EDA_RECT bBox = GetBoundingBox();
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.Move( aOffset );
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA ); GRRect( clipbox, aDC, bBox, 0, LIGHTMAGENTA );
#endif #endif
} }
...@@ -851,11 +854,11 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, ...@@ -851,11 +854,11 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
int aDrawMode, int aDrawMode,
int aColor ) int aColor )
{ {
int MapX1, MapY1, x1, y1; int MapX1, MapY1, x1, y1;
int color; int color;
int width = GetPenSize( ); int width = GetPenSize();
int posX = aPinPos.x, posY = aPinPos.y, len = m_length; int posX = aPinPos.x, posY = aPinPos.y, len = m_length;
BASE_SCREEN* screen = aPanel->GetScreen(); EDA_RECT* clipbox = aPanel ? &aPanel->m_ClipBox : NULL;
color = ReturnLayerColor( LAYER_PIN ); color = ReturnLayerColor( LAYER_PIN );
...@@ -870,53 +873,53 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, ...@@ -870,53 +873,53 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
GRSetDrawMode( aDC, aDrawMode ); GRSetDrawMode( aDC, aDrawMode );
MapX1 = MapY1 = 0; MapX1 = MapY1 = 0;
x1 = posX; x1 = posX;
y1 = posY; y1 = posY;
switch( aOrient ) switch( aOrient )
{ {
case PIN_UP: case PIN_UP:
y1 = posY - len; y1 = posY - len;
MapY1 = 1; MapY1 = 1;
break; break;
case PIN_DOWN: case PIN_DOWN:
y1 = posY + len; y1 = posY + len;
MapY1 = -1; MapY1 = -1;
break; break;
case PIN_LEFT: case PIN_LEFT:
x1 = posX - len; x1 = posX - len;
MapX1 = 1; MapX1 = 1;
break; break;
case PIN_RIGHT: case PIN_RIGHT:
x1 = posX + len; x1 = posX + len;
MapX1 = -1; MapX1 = -1;
break; break;
} }
if( m_shape & INVERT ) if( m_shape & INVERT )
{ {
GRCircle( &aPanel->m_ClipBox, aDC, MapX1 * INVERT_PIN_RADIUS + x1, GRCircle( clipbox, aDC, MapX1 * INVERT_PIN_RADIUS + x1,
MapY1 * INVERT_PIN_RADIUS + y1, MapY1 * INVERT_PIN_RADIUS + y1,
INVERT_PIN_RADIUS, width, color ); INVERT_PIN_RADIUS, width, color );
GRMoveTo( MapX1 * INVERT_PIN_RADIUS * 2 + x1, GRMoveTo( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
MapY1 * INVERT_PIN_RADIUS * 2 + y1 ); MapY1 * INVERT_PIN_RADIUS * 2 + y1 );
GRLineTo( &aPanel->m_ClipBox, aDC, posX, posY, width, color ); GRLineTo( clipbox, aDC, posX, posY, width, color );
} }
else if( m_shape & CLOCK_FALL ) /* an alternative for Inverted Clock */ else if( m_shape & CLOCK_FALL ) /* an alternative for Inverted Clock */
{ {
GRMoveTo( x1 + MapY1 * CLOCK_PIN_DIM, GRMoveTo( x1 + MapY1 * CLOCK_PIN_DIM,
y1 - MapX1 * CLOCK_PIN_DIM ); y1 - MapX1 * CLOCK_PIN_DIM );
GRLineTo( &aPanel->m_ClipBox, GRLineTo( clipbox,
aDC, aDC,
x1 + MapX1 * CLOCK_PIN_DIM, x1 + MapX1 * CLOCK_PIN_DIM,
y1 + MapY1 * CLOCK_PIN_DIM, y1 + MapY1 * CLOCK_PIN_DIM,
width, width,
color ); color );
GRLineTo( &aPanel->m_ClipBox, GRLineTo( clipbox,
aDC, aDC,
x1 - MapY1 * CLOCK_PIN_DIM, x1 - MapY1 * CLOCK_PIN_DIM,
y1 + MapX1 * CLOCK_PIN_DIM, y1 + MapX1 * CLOCK_PIN_DIM,
...@@ -924,12 +927,12 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, ...@@ -924,12 +927,12 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
color ); color );
GRMoveTo( MapX1 * CLOCK_PIN_DIM + x1, GRMoveTo( MapX1 * CLOCK_PIN_DIM + x1,
MapY1 * CLOCK_PIN_DIM + y1 ); MapY1 * CLOCK_PIN_DIM + y1 );
GRLineTo( &aPanel->m_ClipBox, aDC, posX, posY, width, color ); GRLineTo( clipbox, aDC, posX, posY, width, color );
} }
else else
{ {
GRMoveTo( x1, y1 ); GRMoveTo( x1, y1 );
GRLineTo( &aPanel->m_ClipBox, aDC, posX, posY, width, color ); GRLineTo( clipbox, aDC, posX, posY, width, color );
} }
if( m_shape & CLOCK ) if( m_shape & CLOCK )
...@@ -937,13 +940,13 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, ...@@ -937,13 +940,13 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
GRMoveTo( x1, y1 + CLOCK_PIN_DIM ); GRMoveTo( x1, y1 + CLOCK_PIN_DIM );
GRLineTo( &aPanel->m_ClipBox, GRLineTo( clipbox,
aDC, aDC,
x1 - MapX1 * CLOCK_PIN_DIM, x1 - MapX1 * CLOCK_PIN_DIM,
y1, y1,
width, width,
color ); color );
GRLineTo( &aPanel->m_ClipBox, GRLineTo( clipbox,
aDC, aDC,
x1, x1,
y1 - CLOCK_PIN_DIM, y1 - CLOCK_PIN_DIM,
...@@ -953,13 +956,13 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, ...@@ -953,13 +956,13 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
else /* MapX1 = 0 */ else /* MapX1 = 0 */
{ {
GRMoveTo( x1 + CLOCK_PIN_DIM, y1 ); GRMoveTo( x1 + CLOCK_PIN_DIM, y1 );
GRLineTo( &aPanel->m_ClipBox, GRLineTo( clipbox,
aDC, aDC,
x1, x1,
y1 - MapY1 * CLOCK_PIN_DIM, y1 - MapY1 * CLOCK_PIN_DIM,
width, width,
color ); color );
GRLineTo( &aPanel->m_ClipBox, GRLineTo( clipbox,
aDC, aDC,
x1 - CLOCK_PIN_DIM, x1 - CLOCK_PIN_DIM,
y1, y1,
...@@ -968,35 +971,35 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, ...@@ -968,35 +971,35 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
} }
} }
if( m_shape & LOWLEVEL_IN ) /* IEEE symbol "Active Low Input" */ if( m_shape & LOWLEVEL_IN ) /* IEEE symbol "Active Low Input" */
{ {
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
GRMoveTo( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ); GRMoveTo( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 );
GRLineTo( &aPanel->m_ClipBox, GRLineTo( clipbox,
aDC, aDC,
x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
y1 - IEEE_SYMBOL_PIN_DIM, y1 - IEEE_SYMBOL_PIN_DIM,
width, width,
color ); color );
GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1, width, color ); GRLineTo( clipbox, aDC, x1, y1, width, color );
} }
else /* MapX1 = 0 */ else /* MapX1 = 0 */
{ {
GRMoveTo( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ); GRMoveTo( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 );
GRLineTo( &aPanel->m_ClipBox, aDC, x1 - IEEE_SYMBOL_PIN_DIM, GRLineTo( clipbox, aDC, x1 - IEEE_SYMBOL_PIN_DIM,
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2, width, color ); y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2, width, color );
GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1, width, color ); GRLineTo( clipbox, aDC, x1, y1, width, color );
} }
} }
if( m_shape & LOWLEVEL_OUT ) /* IEEE symbol "Active Low Output" */ if( m_shape & LOWLEVEL_OUT ) /* IEEE symbol "Active Low Output" */
{ {
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
GRMoveTo( x1, y1 - IEEE_SYMBOL_PIN_DIM ); GRMoveTo( x1, y1 - IEEE_SYMBOL_PIN_DIM );
GRLineTo( &aPanel->m_ClipBox, GRLineTo( clipbox,
aDC, aDC,
x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
y1, y1,
...@@ -1006,7 +1009,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, ...@@ -1006,7 +1009,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
else /* MapX1 = 0 */ else /* MapX1 = 0 */
{ {
GRMoveTo( x1 - IEEE_SYMBOL_PIN_DIM, y1 ); GRMoveTo( x1 - IEEE_SYMBOL_PIN_DIM, y1 );
GRLineTo( &aPanel->m_ClipBox, GRLineTo( clipbox,
aDC, aDC,
x1, x1,
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2,
...@@ -1018,7 +1021,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, ...@@ -1018,7 +1021,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
{ {
GRMoveTo( x1 - (MapX1 + MapY1) * NONLOGIC_PIN_DIM, GRMoveTo( x1 - (MapX1 + MapY1) * NONLOGIC_PIN_DIM,
y1 - (MapY1 - MapX1) * NONLOGIC_PIN_DIM ); y1 - (MapY1 - MapX1) * NONLOGIC_PIN_DIM );
GRLineTo( &aPanel->m_ClipBox, GRLineTo( clipbox,
aDC, aDC,
x1 + (MapX1 + MapY1) * NONLOGIC_PIN_DIM, x1 + (MapX1 + MapY1) * NONLOGIC_PIN_DIM,
y1 + (MapY1 - MapX1) * NONLOGIC_PIN_DIM, y1 + (MapY1 - MapX1) * NONLOGIC_PIN_DIM,
...@@ -1026,7 +1029,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, ...@@ -1026,7 +1029,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
color ); color );
GRMoveTo( x1 - (MapX1 - MapY1) * NONLOGIC_PIN_DIM, GRMoveTo( x1 - (MapX1 - MapY1) * NONLOGIC_PIN_DIM,
y1 - (MapY1 + MapX1) * NONLOGIC_PIN_DIM ); y1 - (MapY1 + MapX1) * NONLOGIC_PIN_DIM );
GRLineTo( &aPanel->m_ClipBox, GRLineTo( clipbox,
aDC, aDC,
x1 + (MapX1 - MapY1) * NONLOGIC_PIN_DIM, x1 + (MapX1 - MapY1) * NONLOGIC_PIN_DIM,
y1 + (MapY1 + MapX1) * NONLOGIC_PIN_DIM, y1 + (MapY1 + MapX1) * NONLOGIC_PIN_DIM,
...@@ -1036,23 +1039,24 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, ...@@ -1036,23 +1039,24 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
/* Draw the pin end target (active end of the pin) /* Draw the pin end target (active end of the pin)
*/ */
BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL;
#define NCSYMB_PIN_DIM TARGET_PIN_DIAM #define NCSYMB_PIN_DIM TARGET_PIN_DIAM
if( m_type == PIN_NC ) // Draw a N.C. symbol if( m_type == PIN_NC ) // Draw a N.C. symbol
{ {
GRLine( &aPanel->m_ClipBox, aDC, GRLine( clipbox, aDC,
posX-NCSYMB_PIN_DIM, posY-NCSYMB_PIN_DIM, posX - NCSYMB_PIN_DIM, posY - NCSYMB_PIN_DIM,
posX+NCSYMB_PIN_DIM, posY+NCSYMB_PIN_DIM, posX + NCSYMB_PIN_DIM, posY + NCSYMB_PIN_DIM,
width, color); width, color );
GRLine( &aPanel->m_ClipBox, aDC, GRLine( clipbox, aDC,
posX+NCSYMB_PIN_DIM, posY-NCSYMB_PIN_DIM, posX + NCSYMB_PIN_DIM, posY - NCSYMB_PIN_DIM,
posX-NCSYMB_PIN_DIM, posY+NCSYMB_PIN_DIM, posX - NCSYMB_PIN_DIM, posY + NCSYMB_PIN_DIM,
width, color); width, color );
} }
/* Draw but do not print the pin end target 1 pixel width /* Draw but do not print the pin end target 1 pixel width
*/ */
else if( !screen->m_IsPrinting ) else if( screen == NULL || !screen->m_IsPrinting )
{ {
GRCircle( &aPanel->m_ClipBox, aDC, posX, posY, TARGET_PIN_DIAM, 0, color ); GRCircle( clipbox, aDC, posX, posY, TARGET_PIN_DIAM, 0, color );
} }
} }
...@@ -1083,10 +1087,10 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, ...@@ -1083,10 +1087,10 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
wxSize PinNameSize( m_PinNameSize, m_PinNameSize ); wxSize PinNameSize( m_PinNameSize, m_PinNameSize );
wxSize PinNumSize( m_PinNumSize, m_PinNumSize ); wxSize PinNumSize( m_PinNumSize, m_PinNumSize );
int nameLineWidth = GetPenSize( ); int nameLineWidth = GetPenSize();
nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_PinNameSize, false ); nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_PinNameSize, false );
int numLineWidth = GetPenSize( ); int numLineWidth = GetPenSize();
numLineWidth = Clamp_Text_PenSize( numLineWidth, m_PinNumSize, false ); numLineWidth = Clamp_Text_PenSize( numLineWidth, m_PinNumSize, false );
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
...@@ -1160,7 +1164,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, ...@@ -1160,7 +1164,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
{ {
DrawGraphicText( panel, DC, DrawGraphicText( panel, DC,
wxPoint( (x1 + pin_pos.x) / 2, wxPoint( (x1 + pin_pos.x) / 2,
y1 - TXTMARGE ), NumColor, y1 - TXTMARGE ), NumColor,
StringPinNum, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize, TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER,
...@@ -1278,7 +1282,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, ...@@ -1278,7 +1282,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
* If TextInside then the text is been put inside (moving from x1, y1 in * * 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. * * the opposite direction to x2,y2), otherwise all is drawn outside. *
*****************************************************************************/ *****************************************************************************/
void LIB_PIN::PlotPinTexts( PLOTTER *plotter, void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
wxPoint& pin_pos, wxPoint& pin_pos,
int orient, int orient,
int TextInside, int TextInside,
...@@ -1357,7 +1361,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter, ...@@ -1357,7 +1361,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
if( DrawPinNum ) if( DrawPinNum )
{ {
plotter->text( wxPoint( (x1 + pin_pos.x) / 2, plotter->text( wxPoint( (x1 + pin_pos.x) / 2,
y1 - TXTMARGE ), y1 - TXTMARGE ),
NumColor, StringPinNum, NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize, TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER,
...@@ -1517,7 +1521,7 @@ int LIB_PIN::ReturnPinDrawOrient( const TRANSFORM& aTransform ) ...@@ -1517,7 +1521,7 @@ int LIB_PIN::ReturnPinDrawOrient( const TRANSFORM& aTransform )
} }
// = pos of end point, according to the component orientation // = pos of end point, according to the component orientation
end = aTransform.TransformCoordinate( end ); end = aTransform.TransformCoordinate( end );
orient = PIN_UP; orient = PIN_UP;
if( end.x == 0 ) if( end.x == 0 )
...@@ -1599,11 +1603,11 @@ LIB_DRAW_ITEM* LIB_PIN::DoGenCopy() ...@@ -1599,11 +1603,11 @@ LIB_DRAW_ITEM* LIB_PIN::DoGenCopy()
{ {
LIB_PIN* newpin = new LIB_PIN( GetParent() ); LIB_PIN* newpin = new LIB_PIN( GetParent() );
newpin->m_position = m_position; newpin->m_position = m_position;
newpin->m_length = m_length; newpin->m_length = m_length;
newpin->m_orientation = m_orientation; newpin->m_orientation = m_orientation;
newpin->m_shape = m_shape; newpin->m_shape = m_shape;
newpin->m_type = m_type; newpin->m_type = m_type;
newpin->m_attributes = m_attributes; newpin->m_attributes = m_attributes;
newpin->m_number = m_number; newpin->m_number = m_number;
newpin->m_PinNumSize = m_PinNumSize; newpin->m_PinNumSize = m_PinNumSize;
...@@ -1612,11 +1616,11 @@ LIB_DRAW_ITEM* LIB_PIN::DoGenCopy() ...@@ -1612,11 +1616,11 @@ LIB_DRAW_ITEM* LIB_PIN::DoGenCopy()
newpin->m_PinNameShapeOpt = m_PinNameShapeOpt; newpin->m_PinNameShapeOpt = m_PinNameShapeOpt;
newpin->m_PinNumPositionOpt = m_PinNumPositionOpt; newpin->m_PinNumPositionOpt = m_PinNumPositionOpt;
newpin->m_PinNamePositionOpt = m_PinNamePositionOpt; newpin->m_PinNamePositionOpt = m_PinNamePositionOpt;
newpin->m_Unit = m_Unit; newpin->m_Unit = m_Unit;
newpin->m_Convert = m_Convert; newpin->m_Convert = m_Convert;
newpin->m_Flags = m_Flags; newpin->m_Flags = m_Flags;
newpin->m_width = m_width; newpin->m_width = m_width;
newpin->m_name = m_name; newpin->m_name = m_name;
return (LIB_DRAW_ITEM*) newpin; return (LIB_DRAW_ITEM*) newpin;
} }
...@@ -1626,7 +1630,7 @@ int LIB_PIN::DoCompare( const LIB_DRAW_ITEM& other ) const ...@@ -1626,7 +1630,7 @@ int LIB_PIN::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == LIB_PIN_T ); wxASSERT( other.Type() == LIB_PIN_T );
const LIB_PIN* tmp = ( LIB_PIN* ) &other; const LIB_PIN* tmp = (LIB_PIN*) &other;
if( m_number != tmp->m_number ) if( m_number != tmp->m_number )
return m_number - tmp->m_number; return m_number - tmp->m_number;
...@@ -1689,15 +1693,15 @@ void LIB_PIN::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, ...@@ -1689,15 +1693,15 @@ void LIB_PIN::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
if( m_attributes & PINNOTDRAW ) if( m_attributes & PINNOTDRAW )
return; return;
int orient = ReturnPinDrawOrient( aTransform ); int orient = ReturnPinDrawOrient( aTransform );
wxPoint pos = aTransform.TransformCoordinate( m_position ) + offset; wxPoint pos = aTransform.TransformCoordinate( m_position ) + offset;
plotter->set_current_line_width( GetPenSize() ); plotter->set_current_line_width( GetPenSize() );
PlotPinSymbol( plotter, pos, m_length, orient, m_shape ); PlotPinSymbol( plotter, pos, m_length, orient, m_shape );
PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(), PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(), GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(),
GetPenSize() ); GetPenSize() );
} }
...@@ -1734,7 +1738,7 @@ void LIB_PIN::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -1734,7 +1738,7 @@ void LIB_PIN::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "Type" ), frame->AppendMsgPanel( _( "Type" ),
wxGetTranslation( pin_electrical_type_names[ m_type ] ), wxGetTranslation( pin_electrical_type_names[ m_type ] ),
RED ); RED );
Text = wxGetTranslation(pin_style_names[ GetStyleCodeIndex( m_shape ) ]); Text = wxGetTranslation( pin_style_names[ GetStyleCodeIndex( m_shape ) ] );
frame->AppendMsgPanel( _( "Style" ), Text, BLUE ); frame->AppendMsgPanel( _( "Style" ), Text, BLUE );
if( IsVisible() ) if( IsVisible() )
Text = _( "Yes" ); Text = _( "Yes" );
...@@ -1746,7 +1750,7 @@ void LIB_PIN::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -1746,7 +1750,7 @@ void LIB_PIN::DisplayInfo( EDA_DRAW_FRAME* frame )
Text = ReturnStringFromValue( g_UserUnit, m_length, EESCHEMA_INTERNAL_UNIT, true ); Text = ReturnStringFromValue( g_UserUnit, m_length, EESCHEMA_INTERNAL_UNIT, true );
frame->AppendMsgPanel( _( "Length" ), Text, MAGENTA ); frame->AppendMsgPanel( _( "Length" ), Text, MAGENTA );
Text = wxGetTranslation(pin_orientation_names[ GetOrientationCodeIndex( m_orientation ) ]); Text = wxGetTranslation( pin_orientation_names[ GetOrientationCodeIndex( m_orientation ) ] );
frame->AppendMsgPanel( _( "Orientation" ), Text, DARKMAGENTA ); frame->AppendMsgPanel( _( "Orientation" ), Text, DARKMAGENTA );
} }
...@@ -1754,14 +1758,83 @@ void LIB_PIN::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -1754,14 +1758,83 @@ void LIB_PIN::DisplayInfo( EDA_DRAW_FRAME* frame )
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* @return the boundary box for this, in schematic coordinates * @return the boundary box for this, in schematic coordinates
* for a not rotated, not mirrored component
*/ */
EDA_RECT LIB_PIN::GetBoundingBox() const EDA_RECT LIB_PIN::GetBoundingBox() const
{ {
wxPoint pt = m_position; LIB_COMPONENT* entry = (LIB_COMPONENT*) m_Parent;
EDA_RECT bbox;
wxPoint begin;
wxPoint end;
int pinname_offset = 0;
if( entry )
pinname_offset = entry->GetPinNameOffset();
// First, calculate boundary box corners position
int pinnum_len = m_PinNumSize * GetNumberString().Len();
// Actual text height are bigger than text size
int pinname_hight = wxRound( m_PinNameSize * 1.3 );
int pinnum_hight = wxRound( m_PinNumSize * 1.3 );
// calculate top left corner position
// for the default pin orientation (PIN_RIGHT)
begin.y = pinnum_hight + TXTMARGE;
begin.x = MIN( -TARGET_PIN_DIAM, m_length - pinnum_len / 2 );
// calculate bottom right corner position and adjust top left corner position
int pinname_len = m_PinNameSize * m_name.Len();
if( pinname_offset )
{
end.y = -pinname_hight / 2;
end.x = m_length + pinname_offset + pinname_len;
}
else
{
end.y = -pinname_hight - TXTMARGE;
end.x = MAX( m_length, pinname_len / 2 );
begin.x = MIN( begin.x, m_length - pinname_len / 2 );
}
// Now, calculate boundary box corners position for the actual pin orientation
switch( m_orientation )
{
case PIN_UP:
pt.y *= -1; // Reverse the Y axis, according to the schematic orientation // Pin is rotated and texts positions are mirrored
RotatePoint( &begin, wxPoint( 0, 0 ), -900 );
RotatePoint( &end, wxPoint( 0, 0 ), -900 );
break;
return EDA_RECT( pt, wxSize( 1, 1 ) ); case PIN_DOWN:
RotatePoint( &begin, wxPoint( 0, 0 ), 900 );
RotatePoint( &end, wxPoint( 0, 0 ), 900 );
NEGATE( begin.x );
NEGATE( end.x );
break;
case PIN_LEFT:
// Pin is mirrored, not rotated by 180.0 degrees
NEGATE( begin.x );
NEGATE( end.x );
break;
case PIN_RIGHT:
break;
}
bbox.SetOrigin( m_position + begin );
bbox.SetEnd( m_position + end );
bbox.Inflate( GetPenSize() / 2 );
NEGATE( bbox.m_Pos.y ); // Reverse the Y axis, according to the schematic orientation
NEGATE( bbox.m_Size.y ); // Reverse the Y axis, according to the schematic orientation
bbox.Normalize();
return bbox;
} }
...@@ -1801,16 +1874,16 @@ int LIB_PIN::GetOrientationCodeIndex( int code ) ...@@ -1801,16 +1874,16 @@ int LIB_PIN::GetOrientationCodeIndex( int code )
void LIB_PIN::Rotate() void LIB_PIN::Rotate()
{ {
// Get the actual pin orientation index // Get the actual pin orientation index
int i = GetOrientationCodeIndex( GetOrientation() ); int i = GetOrientationCodeIndex( GetOrientation() );
// Compute the next orientation, swap lower two bits for the right order // Compute the next orientation, swap lower two bits for the right order
i = ((i & 2) >> 1) | ((i & 1) << 1); i = ( (i & 2) >> 1 ) | ( (i & 1) << 1 );
i = i + 1; i = i + 1;
i = ((i & 2) >> 1) | ((i & 1) << 1); i = ( (i & 2) >> 1 ) | ( (i & 1) << 1 );
// Set the new orientation // Set the new orientation
SetOrientation( GetOrientationCode( i ) ); SetOrientation( GetOrientationCode( i ) );
} }
...@@ -1876,6 +1949,7 @@ const char*** LIB_PIN::GetStyleSymbols() ...@@ -1876,6 +1949,7 @@ const char*** LIB_PIN::GetStyleSymbols()
return s_icons_Pins_Shapes; return s_icons_Pins_Shapes;
} }
const char** LIB_PIN::GetMenuImage() const const char** LIB_PIN::GetMenuImage() const
{ {
return s_icons_Pins_Electrical_Type[m_type]; return s_icons_Pins_Electrical_Type[m_type];
...@@ -1885,11 +1959,12 @@ const char** LIB_PIN::GetMenuImage() const ...@@ -1885,11 +1959,12 @@ const char** LIB_PIN::GetMenuImage() const
wxString LIB_PIN::GetSelectMenuText() const wxString LIB_PIN::GetSelectMenuText() const
{ {
wxString tmp; wxString tmp;
tmp.Printf( _( "Pin %s, %s, %s" ), tmp.Printf( _( "Pin %s, %s, %s" ),
GetChars( GetNumberString() ), GetChars( GetNumberString() ),
GetChars( GetTypeString() ), GetChars( GetTypeString() ),
GetChars( wxGetTranslation( pin_style_names[ GetStyleCodeIndex( m_shape ) ] ) ) GetChars( wxGetTranslation( pin_style_names[ GetStyleCodeIndex( m_shape ) ] ) )
); );
return tmp; return tmp;
} }
...@@ -1906,4 +1981,5 @@ void LIB_PIN::Show( int nestLevel, std::ostream& os ) ...@@ -1906,4 +1981,5 @@ void LIB_PIN::Show( int nestLevel, std::ostream& os )
// NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; // NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
} }
#endif #endif
...@@ -355,7 +355,7 @@ public: ...@@ -355,7 +355,7 @@ public:
/** /**
* @return the size of the "pen" that be used to draw or plot this item. * @return the size of the "pen" that be used to draw or plot this item.
*/ */
virtual int GetPenSize(); virtual int GetPenSize() const;
void DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, void DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
int aOrientation, int aDrawMode, int aColor = -1 ); int aOrientation, int aDrawMode, int aColor = -1 );
......
...@@ -233,7 +233,7 @@ void LIB_POLYLINE::AddPoint( const wxPoint& point ) ...@@ -233,7 +233,7 @@ void LIB_POLYLINE::AddPoint( const wxPoint& point )
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LIB_POLYLINE::GetPenSize() int LIB_POLYLINE::GetPenSize() const
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
} }
......
...@@ -86,7 +86,7 @@ public: ...@@ -86,7 +86,7 @@ public:
/** /**
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
virtual int GetPenSize( ); virtual int GetPenSize( ) const;
virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame ); virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame );
......
...@@ -166,7 +166,7 @@ void LIB_RECTANGLE::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFil ...@@ -166,7 +166,7 @@ void LIB_RECTANGLE::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFil
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LIB_RECTANGLE::GetPenSize() int LIB_RECTANGLE::GetPenSize() const
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
} }
......
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
/** /**
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
virtual int GetPenSize( ); virtual int GetPenSize( ) const;
virtual EDA_RECT GetBoundingBox() const; virtual EDA_RECT GetBoundingBox() const;
......
...@@ -93,7 +93,7 @@ bool LIB_TEXT::Load( char* line, wxString& errorMsg ) ...@@ -93,7 +93,7 @@ bool LIB_TEXT::Load( char* line, wxString& errorMsg )
&m_Unit, &m_Convert, buf, tmp, &thickness, &hjustify, &m_Unit, &m_Convert, buf, tmp, &thickness, &hjustify,
&vjustify ); &vjustify );
if( cnt >= 8 ) // if quoted loadng failed, load as not quoted if( cnt >= 8 ) // if quoted loadng failed, load as not quoted
{ {
m_Text = FROM_UTF8( buf ); m_Text = FROM_UTF8( buf );
...@@ -112,7 +112,7 @@ bool LIB_TEXT::Load( char* line, wxString& errorMsg ) ...@@ -112,7 +112,7 @@ bool LIB_TEXT::Load( char* line, wxString& errorMsg )
errorMsg.Printf( _( "text only had %d parameters of the required 8" ), cnt ); errorMsg.Printf( _( "text only had %d parameters of the required 8" ), cnt );
return false; return false;
} }
/* Convert '~' to spaces (only if text is not quoted). */ /* Convert '~' to spaces (only if text is not quoted). */
m_Text = FROM_UTF8( buf ); m_Text = FROM_UTF8( buf );
m_Text.Replace( wxT( "~" ), wxT( " " ) ); m_Text.Replace( wxT( "~" ), wxT( " " ) );
...@@ -286,7 +286,7 @@ void LIB_TEXT::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, ...@@ -286,7 +286,7 @@ void LIB_TEXT::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LIB_TEXT::GetPenSize( ) int LIB_TEXT::GetPenSize( ) const
{ {
int pensize = m_Thickness; int pensize = m_Thickness;
......
...@@ -94,7 +94,7 @@ public: ...@@ -94,7 +94,7 @@ public:
/** /**
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
virtual int GetPenSize( ); virtual int GetPenSize( ) const;
virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame ); virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame );
......
...@@ -46,7 +46,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) ...@@ -46,7 +46,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
int item_flags = m_drawItem->m_Flags; // save flags to restore them after editing int item_flags = m_drawItem->m_Flags; // save flags to restore them after editing
LIB_PIN* pin = (LIB_PIN*) m_drawItem; LIB_PIN* pin = (LIB_PIN*) m_drawItem;
DIALOG_LIB_EDIT_PIN dlg( this ); DIALOG_LIB_EDIT_PIN dlg( this, pin );
wxString units = GetUnitsLabel( g_UserUnit ); wxString units = GetUnitsLabel( g_UserUnit );
dlg.SetOrientationList( LIB_PIN::GetOrientationNames(), LIB_PIN::GetOrientationSymbols() ); dlg.SetOrientationList( LIB_PIN::GetOrientationNames(), LIB_PIN::GetOrientationSymbols() );
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "gr_basic.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -133,6 +134,7 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ) ...@@ -133,6 +134,7 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
scale *= 0.7; scale *= 0.7;
dc.SetUserScale( scale, scale ); dc.SetUserScale( scale, scale );
GRResetPenAndBrush( &dc );
m_dummyPad->DrawShape( NULL, &dc, drawInfo ); m_dummyPad->DrawShape( NULL, &dc, drawInfo );
event.Skip(); event.Skip();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment