Loading eeschema/dialogs/dialog_lib_edit_pin.cpp +65 −2 Original line number Diff line number Diff line #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" Loading @@ -7,17 +12,24 @@ wxPoint DIALOG_LIB_EDIT_PIN::s_LastPos( -1, -1 ); 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 ) { m_dummyPin = new LIB_PIN( *aPin ); m_panelShowPin->SetBackgroundColour( MakeColour( g_DrawBgColor ) ); /* Required to make escape key work correctly in wxGTK. */ SetFocus(); // Set tab order m_textPinName-> MoveAfterInTabOrder(this); m_textPadName-> MoveAfterInTabOrder(m_textPinName); m_sdbSizerButtonsOK->SetDefault(); } DIALOG_LIB_EDIT_PIN::~DIALOG_LIB_EDIT_PIN() { delete m_dummyPin; } void DIALOG_LIB_EDIT_PIN::SetLastSizeAndPosition() { if( s_LastPos.x != -1 ) Loading @@ -32,6 +44,37 @@ void DIALOG_LIB_EDIT_PIN::SetLastSizeAndPosition() 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 ) { // Save the dialog's position Loading @@ -56,6 +99,26 @@ void DIALOG_LIB_EDIT_PIN::OnOKButtonClick( wxCommandEvent& event ) 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, Loading eeschema/dialogs/dialog_lib_edit_pin.h +8 −3 Original line number Diff line number Diff line Loading @@ -16,14 +16,19 @@ class DIALOG_LIB_EDIT_PIN : public DIALOG_LIB_EDIT_PIN_BASE static wxSize s_LastSize; ///< last position and size static wxPoint s_LastPos; LIB_PIN * m_dummyPin; // a working copy used to show changes public: /** Constructor */ DIALOG_LIB_EDIT_PIN( wxWindow* parent ); DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ); ~DIALOG_LIB_EDIT_PIN(); void SetLastSizeAndPosition(); void OnCloseDialog( wxCloseEvent& event ); void OnCancelButtonClick( wxCommandEvent& event ); void OnOKButtonClick( wxCommandEvent& event ); void OnPaintShowPanel( wxPaintEvent& event ); void OnPropertiesChange( wxCommandEvent& event ); void SetOrientationList( const wxArrayString& list, const char *** aBitmaps ); void SetOrientation( int orientation ) Loading eeschema/dialogs/dialog_lib_edit_pin_base.cpp +115 −89 Original line number Diff line number Diff line Loading @@ -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 ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); Loading @@ -25,135 +18,140 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID wxBoxSizer* mainSizer; mainSizer = new wxBoxSizer( wxVERTICAL ); wxFlexGridSizer* fgSizer1; fgSizer1 = new wxFlexGridSizer( 5, 6, 0, 0 ); fgSizer1->AddGrowableCol( 1 ); fgSizer1->AddGrowableCol( 4 ); fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL ); wxBoxSizer* bUpperSizer; bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* bLeftSizer; bLeftSizer = new wxBoxSizer( wxVERTICAL ); 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->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 ); fgSizer1->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 ); fgSizerPins->Add( m_textPinName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 ); m_staticTextPadName = new wxStaticText( this, ID_M_STATICTEXTPADNAME, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPadName->Wrap( -1 ); 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 ); fgSizer1->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 ); fgSizerPins->Add( m_textPadName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 ); m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("&Orientation:"), wxDefaultPosition, wxDefaultSize, 0 ); 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 ); 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_staticTextPinLen->Wrap( -1 ); fgSizer1->Add( m_staticTextPinLen, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_choiceElectricalType = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); fgSizerPins->Add( m_choiceElectricalType, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); m_textLength = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer1->Add( m_textLength, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 ); m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic &Style:"), wxDefaultPosition, wxDefaultSize, 0 ); 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_staticLengthUnits->Wrap( -1 ); fgSizer1->Add( m_staticLengthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_choiceStyle = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); fgSizerPins->Add( m_choiceStyle, 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.") ); bLeftSizer->Add( fgSizerPins, 0, wxALL|wxEXPAND, 5 ); 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 ); fgSizer1->Add( m_choiceElectricalType, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); wxStaticBoxSizer* sbSizerPinSharing; 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 ); m_staticTextGstyle->Wrap( -1 ); fgSizer1->Add( m_staticTextGstyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); wxBoxSizer* bRightSizer; bRightSizer = new wxBoxSizer( wxVERTICAL ); m_choiceStyle = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); fgSizer1->Add( m_choiceStyle, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); wxFlexGridSizer* fgSizerTextsSizes; 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; boarderSizer = new wxBoxSizer( wxVERTICAL ); m_textLength = new wxTextCtrl( this, ID_M_TEXTLENGTH, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); 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 ); boarderSizer->Add( m_checkApplyToAllParts, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_staticLengthUnits = new wxStaticText( this, ID_M_STATICLENGTHUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); 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 ); boarderSizer->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); bRightSizer->Add( fgSizerTextsSizes, 0, wxALL|wxEXPAND, 5 ); m_checkShow = new wxCheckBox( this, wxID_ANY, _("&Visible"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkShow->SetValue(true); boarderSizer->Add( m_checkShow, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_panelShowPin = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); bRightSizer->Add( m_panelShowPin, 1, wxEXPAND | wxALL, 5 ); 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 ); 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_sdbSizerButtonsOK = new wxButton( this, wxID_OK ); Loading @@ -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_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel ); m_sdbSizerButtons->Realize(); boarderSizer->Add( m_sdbSizerButtons, 0, wxALL|wxALIGN_RIGHT, 0 ); mainSizer->Add( boarderSizer, 0, wxALL|wxEXPAND, 12 ); mainSizer->Add( m_sdbSizerButtons, 0, wxALL|wxALIGN_RIGHT, 5 ); this->SetSizer( mainSizer ); this->Layout(); 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() { // 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 ); } Loading
eeschema/dialogs/dialog_lib_edit_pin.cpp +65 −2 Original line number Diff line number Diff line #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" Loading @@ -7,17 +12,24 @@ wxPoint DIALOG_LIB_EDIT_PIN::s_LastPos( -1, -1 ); 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 ) { m_dummyPin = new LIB_PIN( *aPin ); m_panelShowPin->SetBackgroundColour( MakeColour( g_DrawBgColor ) ); /* Required to make escape key work correctly in wxGTK. */ SetFocus(); // Set tab order m_textPinName-> MoveAfterInTabOrder(this); m_textPadName-> MoveAfterInTabOrder(m_textPinName); m_sdbSizerButtonsOK->SetDefault(); } DIALOG_LIB_EDIT_PIN::~DIALOG_LIB_EDIT_PIN() { delete m_dummyPin; } void DIALOG_LIB_EDIT_PIN::SetLastSizeAndPosition() { if( s_LastPos.x != -1 ) Loading @@ -32,6 +44,37 @@ void DIALOG_LIB_EDIT_PIN::SetLastSizeAndPosition() 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 ) { // Save the dialog's position Loading @@ -56,6 +99,26 @@ void DIALOG_LIB_EDIT_PIN::OnOKButtonClick( wxCommandEvent& event ) 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, Loading
eeschema/dialogs/dialog_lib_edit_pin.h +8 −3 Original line number Diff line number Diff line Loading @@ -16,14 +16,19 @@ class DIALOG_LIB_EDIT_PIN : public DIALOG_LIB_EDIT_PIN_BASE static wxSize s_LastSize; ///< last position and size static wxPoint s_LastPos; LIB_PIN * m_dummyPin; // a working copy used to show changes public: /** Constructor */ DIALOG_LIB_EDIT_PIN( wxWindow* parent ); DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ); ~DIALOG_LIB_EDIT_PIN(); void SetLastSizeAndPosition(); void OnCloseDialog( wxCloseEvent& event ); void OnCancelButtonClick( wxCommandEvent& event ); void OnOKButtonClick( wxCommandEvent& event ); void OnPaintShowPanel( wxPaintEvent& event ); void OnPropertiesChange( wxCommandEvent& event ); void SetOrientationList( const wxArrayString& list, const char *** aBitmaps ); void SetOrientation( int orientation ) Loading
eeschema/dialogs/dialog_lib_edit_pin_base.cpp +115 −89 Original line number Diff line number Diff line Loading @@ -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 ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); Loading @@ -25,135 +18,140 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID wxBoxSizer* mainSizer; mainSizer = new wxBoxSizer( wxVERTICAL ); wxFlexGridSizer* fgSizer1; fgSizer1 = new wxFlexGridSizer( 5, 6, 0, 0 ); fgSizer1->AddGrowableCol( 1 ); fgSizer1->AddGrowableCol( 4 ); fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL ); wxBoxSizer* bUpperSizer; bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* bLeftSizer; bLeftSizer = new wxBoxSizer( wxVERTICAL ); 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->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 ); fgSizer1->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 ); fgSizerPins->Add( m_textPinName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 ); m_staticTextPadName = new wxStaticText( this, ID_M_STATICTEXTPADNAME, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPadName->Wrap( -1 ); 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 ); fgSizer1->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 ); fgSizerPins->Add( m_textPadName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 ); m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("&Orientation:"), wxDefaultPosition, wxDefaultSize, 0 ); 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 ); 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_staticTextPinLen->Wrap( -1 ); fgSizer1->Add( m_staticTextPinLen, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_choiceElectricalType = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); fgSizerPins->Add( m_choiceElectricalType, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); m_textLength = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer1->Add( m_textLength, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 ); m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic &Style:"), wxDefaultPosition, wxDefaultSize, 0 ); 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_staticLengthUnits->Wrap( -1 ); fgSizer1->Add( m_staticLengthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_choiceStyle = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); fgSizerPins->Add( m_choiceStyle, 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.") ); bLeftSizer->Add( fgSizerPins, 0, wxALL|wxEXPAND, 5 ); 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 ); fgSizer1->Add( m_choiceElectricalType, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); wxStaticBoxSizer* sbSizerPinSharing; 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 ); m_staticTextGstyle->Wrap( -1 ); fgSizer1->Add( m_staticTextGstyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); wxBoxSizer* bRightSizer; bRightSizer = new wxBoxSizer( wxVERTICAL ); m_choiceStyle = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); fgSizer1->Add( m_choiceStyle, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); wxFlexGridSizer* fgSizerTextsSizes; 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; boarderSizer = new wxBoxSizer( wxVERTICAL ); m_textLength = new wxTextCtrl( this, ID_M_TEXTLENGTH, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); 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 ); boarderSizer->Add( m_checkApplyToAllParts, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_staticLengthUnits = new wxStaticText( this, ID_M_STATICLENGTHUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); 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 ); boarderSizer->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); bRightSizer->Add( fgSizerTextsSizes, 0, wxALL|wxEXPAND, 5 ); m_checkShow = new wxCheckBox( this, wxID_ANY, _("&Visible"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkShow->SetValue(true); boarderSizer->Add( m_checkShow, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_panelShowPin = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); bRightSizer->Add( m_panelShowPin, 1, wxEXPAND | wxALL, 5 ); 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 ); 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_sdbSizerButtonsOK = new wxButton( this, wxID_OK ); Loading @@ -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_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel ); m_sdbSizerButtons->Realize(); boarderSizer->Add( m_sdbSizerButtons, 0, wxALL|wxALIGN_RIGHT, 0 ); mainSizer->Add( boarderSizer, 0, wxALL|wxEXPAND, 12 ); mainSizer->Add( m_sdbSizerButtons, 0, wxALL|wxALIGN_RIGHT, 5 ); this->SetSizer( mainSizer ); this->Layout(); 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() { // 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 ); }