From ebeb2363a259214193f59fb357dfa6b1229ee032 Mon Sep 17 00:00:00 2001 From: charras Date: Mon, 11 Aug 2008 18:21:21 +0000 Subject: [PATCH] eeschema: libedit changes (see changelog) --- change_log.txt | 7 + eeschema/libedit_onleftclick.cpp | 15 +- eeschema/pinedit-dialog.cpp | 317 +++++++++++++++++++------------ eeschema/pinedit-dialog.h | 42 ++-- eeschema/pinedit-dialog.pjd | 290 +++++++++++++++++++--------- eeschema/pinedit.cpp | 16 +- include/build_version.h | 2 +- 7 files changed, 447 insertions(+), 242 deletions(-) diff --git a/change_log.txt b/change_log.txt index 11e82353f7..04bc6d9bd3 100644 --- a/change_log.txt +++ b/change_log.txt @@ -5,6 +5,13 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2008-Aug-11 UPDATE Jean-Pierre Charras +================================================================================ ++eeschema: + libedit: + solved : a bug which can crash eeschema on a double click. + modified : pin lenght edit in pin edit dialog. The value (handle by spin control) was not editable with recent wxWidgets versions + 2008-Aug-09 UPDATE Jean-Pierre Charras ================================================================================ +pcbnew: diff --git a/eeschema/libedit_onleftclick.cpp b/eeschema/libedit_onleftclick.cpp index ce18c155f2..79fed93b5e 100644 --- a/eeschema/libedit_onleftclick.cpp +++ b/eeschema/libedit_onleftclick.cpp @@ -139,7 +139,7 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) CurrentUnit, CurrentConvert ); if( DrawEntry == NULL ) { - DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(), + DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(), GetScreen()->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert, LOCATE_ALL_DRAW_ITEM ); @@ -179,11 +179,9 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) /*************************************************************************/ -/* Appel� sur un double click: - * pour un �l�ment editable (textes, composant): - * appel de l'editeur correspondant. - * pour une connexion en cours: - * termine la connexion +/* Called on a double click: + * If an editable item (field, pin, graphic): + * Call the suitable dialog editor. */ { wxPoint pos = GetPosition(); @@ -192,9 +190,8 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) if( CurrentLibEntry == NULL ) return; - if( !m_ID_current_state // Simple localisation des elements - || (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) ) - { + if( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) ) + { // We can locate an item DrawEntry = LocatePin( GetScreen()->m_MousePosition, CurrentLibEntry, CurrentUnit, CurrentConvert ); if( DrawEntry == NULL ) diff --git a/eeschema/pinedit-dialog.cpp b/eeschema/pinedit-dialog.cpp index bcfed97c16..98deabeb81 100644 --- a/eeschema/pinedit-dialog.cpp +++ b/eeschema/pinedit-dialog.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// // Name: pinedit-dialog.cpp -// Purpose: +// Purpose: // Author: jean-pierre Charras -// Modified by: +// Modified by: // Created: 11/02/2006 13:30:59 -// RCS-ID: +// RCS-ID: // Copyright: License GNU -// Licence: +// Licence: ///////////////////////////////////////////////////////////////////////////// // Generated by DialogBlocks (unregistered), 11/02/2006 13:30:59 @@ -35,7 +35,7 @@ void InstallPineditFrame(WinEDA_LibeditFrame * parent, wxDC * DC, const wxPoint /*****************************************************************************************/ { wxPoint MousePos = parent->GetScreen()->m_Curseur; -int accept = TRUE; +int accept = TRUE; if ( (CurrentDrawItem == NULL) || (CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE) ) { LibDrawPin * Pin = (LibDrawPin *) CurrentDrawItem; @@ -65,6 +65,9 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PinPropertiesFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_PinPropertiesFrame, wxDialog ) ////@begin WinEDA_PinPropertiesFrame event table entries + EVT_SPIN_UP( ID_SPINBUTTON_INC_DEC_PINSIZE, WinEDA_PinPropertiesFrame::OnSpinbuttonIncDecPinsizeUp ) + EVT_SPIN_DOWN( ID_SPINBUTTON_INC_DEC_PINSIZE, WinEDA_PinPropertiesFrame::OnSpinbuttonIncDecPinsizeDown ) + EVT_BUTTON( wxID_CANCEL, WinEDA_PinPropertiesFrame::OnCancelClick ) EVT_BUTTON( wxID_OK, WinEDA_PinPropertiesFrame::OnOkClick ) @@ -83,96 +86,17 @@ WinEDA_PinPropertiesFrame::WinEDA_PinPropertiesFrame( ) WinEDA_PinPropertiesFrame::WinEDA_PinPropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { -wxString number; LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; -wxString msg, StringPinNum; -int tmp, ii; - + m_Parent = parent; if ( CurrentPin ) { - CurrentPin->ReturnPinStringNum(StringPinNum); m_Parent->InitEditOnePin(); } Create(parent, id, caption, pos, size, style); /* Init dialog pin name and pin name size values */ - if ( CurrentPin ) msg = CurrentPin->m_PinName; - else msg = wxEmptyString; - m_PinNameCtrl->SetValue(msg); - tmp = CurrentPin ? CurrentPin->m_PinNameSize : LastPinNameSize; - msg = ReturnStringFromValue(g_UnitMetric, tmp, m_Parent->m_InternalUnits); - m_PinNameSizeCtrl->SetValue(msg); - msg = m_PinNameSizeText->GetLabel() + ReturnUnitSymbol(); - m_PinNameSizeText->SetLabel(msg); - /* Init dialog pin num and pin num size values */ - m_PinNumCtrl->SetValue(StringPinNum); - tmp = CurrentPin ? CurrentPin->m_PinNumSize : LastPinNumSize; - msg = ReturnStringFromValue(g_UnitMetric, tmp, m_Parent->m_InternalUnits); - m_PinNumSizeCtrl->SetValue(msg); - msg = m_PinNumSizeText->GetLabel() + ReturnUnitSymbol(); - m_PinNumSizeText->SetLabel(msg); - /* init dialog pin size */ - int pinsize = CurrentPin ? CurrentPin->m_PinLen : LastPinSize; - m_PinSize->SetValue(pinsize); - /* init pin options */ - if ( CurrentPin ) - { - if ( CurrentPin->m_Unit == 0 ) m_CommonUnit->SetValue(TRUE); - } - else m_CommonUnit->SetValue(LastPinCommonUnit); - if ( CurrentPin ) - { - if ( CurrentPin->m_Convert == 0 ) m_CommonConvert->SetValue(TRUE); - } - else m_CommonConvert->SetValue(LastPinCommonConvert); - if ( CurrentPin ) - { - if ( CurrentPin->m_Attributs & PINNOTDRAW ) m_NoDraw->SetValue(TRUE); - } - else m_NoDraw->SetValue(LastPinNoDraw); - - tmp = CurrentPin ? CurrentPin->m_Orient : LastPinOrient; - switch ( tmp ) - { - case PIN_RIGHT: - m_PinOrient->SetSelection(0); - break; - - case PIN_LEFT: - m_PinOrient->SetSelection(1); - break; - - case PIN_UP: - m_PinOrient->SetSelection(2); - break; - - case PIN_DOWN: - m_PinOrient->SetSelection(3); - break; - } - - tmp = CurrentPin ? CurrentPin->m_PinShape : LastPinShape; - m_PinShape->SetSelection( 0 ); - for ( ii = 0; ii < NBSHAPES; ii++ ) - { - if ( CodeShape[ii] == tmp ) - { - m_PinShape->SetSelection( ii ); break ; - } - } - - tmp = CurrentPin ? CurrentPin->m_PinShape : LastPinShape; - m_PinShape->SetSelection( 0 ); - for ( ii = 0; ii < NBSHAPES; ii++ ) - { - if ( CodeShape[ii] == tmp ) - { - m_PinShape->SetSelection( ii ); break ; - } - } - - m_PinElectricalType->SetSelection( CurrentPin ? CurrentPin->m_PinType : LastPinType); + SetValuesInDialog( ); } /*! @@ -184,7 +108,9 @@ bool WinEDA_PinPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const w ////@begin WinEDA_PinPropertiesFrame member initialisation m_PinNameCtrl = NULL; m_PinNumCtrl = NULL; - m_PinSize = NULL; + m_PinSizeCtrl = NULL; + m_PinSizeIncDecButton = NULL; + m_PinSizeText = NULL; m_CommonUnit = NULL; m_CommonConvert = NULL; m_NoDraw = NULL; @@ -217,11 +143,11 @@ bool WinEDA_PinPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const w */ void WinEDA_PinPropertiesFrame::CreateControls() -{ +{ SetFont(*g_DialogFont); - + ////@begin WinEDA_PinPropertiesFrame content construction - // Generated by DialogBlocks, 29/04/2008 21:13:51 (unregistered) + // Generated by DialogBlocks, 11/08/2008 19:12:48 (unregistered) WinEDA_PinPropertiesFrame* itemDialog1 = this; @@ -234,13 +160,13 @@ void WinEDA_PinPropertiesFrame::CreateControls() wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pin Name :"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - m_PinNameCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); + m_PinNameCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_PINNAME, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer3->Add(m_PinNameCtrl, 0, wxGROW|wxALL, 5); wxStaticText* itemStaticText6 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pin Num :"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer3->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - m_PinNumCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); + m_PinNumCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_PINNUM, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer3->Add(m_PinNumCtrl, 0, wxGROW|wxALL, 5); itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); @@ -250,40 +176,48 @@ void WinEDA_PinPropertiesFrame::CreateControls() itemStaticBoxSizer9Static->SetForegroundColour(wxColour(64, 0, 128)); itemBoxSizer3->Add(itemStaticBoxSizer9, 0, wxGROW|wxALL, 5); - wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pin lenght :"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer9->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxHORIZONTAL); + itemStaticBoxSizer9->Add(itemBoxSizer10, 0, wxGROW, 5); - m_PinSize = new wxSpinCtrl( itemDialog1, ID_SPINCTRL, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000, 0 ); - itemStaticBoxSizer9->Add(m_PinSize, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + m_PinSizeCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_PINSIZE, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer10->Add(m_PinSizeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - m_CommonUnit = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Common to Units"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); + m_PinSizeIncDecButton = new wxSpinButton( itemDialog1, ID_SPINBUTTON_INC_DEC_PINSIZE, wxDefaultPosition, wxDefaultSize, wxSP_VERTICAL ); + m_PinSizeIncDecButton->SetRange(0, 2000); + m_PinSizeIncDecButton->SetValue(0); + itemBoxSizer10->Add(m_PinSizeIncDecButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5); + + m_PinSizeText = new wxStaticText( itemDialog1, wxID_STATIC, _("Pin Lenght"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer9->Add(m_PinSizeText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + + m_CommonUnit = new wxCheckBox( itemDialog1, ID_CHECKBOX_COMMON_UNITS, _("Common to Units"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_CommonUnit->SetValue(false); itemStaticBoxSizer9->Add(m_CommonUnit, 0, wxALIGN_LEFT|wxALL, 5); - m_CommonConvert = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Common to convert"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); + m_CommonConvert = new wxCheckBox( itemDialog1, ID_CHECKBOX_COMMON_CONVERT, _("Common to convert"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_CommonConvert->SetValue(false); itemStaticBoxSizer9->Add(m_CommonConvert, 0, wxALIGN_LEFT|wxALL, 5); - m_NoDraw = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("No Draw"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); + m_NoDraw = new wxCheckBox( itemDialog1, ID_CHECKBOX_NOT_DRAWN, _("No Draw"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_NoDraw->SetValue(false); itemStaticBoxSizer9->Add(m_NoDraw, 0, wxALIGN_LEFT|wxALL, 5); - wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer15, 0, wxGROW|wxALL, 5); + wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer2->Add(itemBoxSizer17, 0, wxGROW|wxALL, 5); m_PinNameSizeText = new wxStaticText( itemDialog1, wxID_STATIC, _("Size"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer15->Add(m_PinNameSizeText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + itemBoxSizer17->Add(m_PinNameSizeText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - m_PinNameSizeCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer15->Add(m_PinNameSizeCtrl, 0, wxALIGN_LEFT|wxALL, 5); + m_PinNameSizeCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_PINNAME_SIZE, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer17->Add(m_PinNameSizeCtrl, 0, wxALIGN_LEFT|wxALL, 5); m_PinNumSizeText = new wxStaticText( itemDialog1, wxID_STATIC, _("Size"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer15->Add(m_PinNumSizeText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + itemBoxSizer17->Add(m_PinNumSizeText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - m_PinNumSizeCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer15->Add(m_PinNumSizeCtrl, 0, wxALIGN_LEFT|wxALL, 5); + m_PinNumSizeCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_PINNUM_SIZE, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer17->Add(m_PinNumSizeCtrl, 0, wxALIGN_LEFT|wxALL, 5); - itemBoxSizer15->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemBoxSizer17->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxArrayString m_PinOrientStrings; m_PinOrientStrings.Add(_("Right")); @@ -293,25 +227,25 @@ void WinEDA_PinPropertiesFrame::CreateControls() m_PinOrient = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Pin Orient:"), wxDefaultPosition, wxDefaultSize, m_PinOrientStrings, 1, wxRA_SPECIFY_COLS ); m_PinOrient->SetSelection(0); m_PinOrient->SetForegroundColour(wxColour(41, 84, 84)); - itemBoxSizer15->Add(m_PinOrient, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemBoxSizer17->Add(m_PinOrient, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer22, 0, wxGROW|wxALL, 5); + wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer2->Add(itemBoxSizer24, 0, wxGROW|wxALL, 5); - wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer22->Add(itemBoxSizer23, 0, wxGROW|wxALL, 5); + wxBoxSizer* itemBoxSizer25 = new wxBoxSizer(wxHORIZONTAL); + itemBoxSizer24->Add(itemBoxSizer25, 0, wxGROW|wxALL, 5); m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); m_btClose->SetForegroundColour(wxColour(0, 0, 160)); - itemBoxSizer23->Add(m_btClose, 0, wxGROW|wxALL, 5); + itemBoxSizer25->Add(m_btClose, 0, wxGROW|wxALL, 5); - wxButton* itemButton25 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton25->SetDefault(); - itemButton25->SetForegroundColour(wxColour(198, 0, 0)); - itemBoxSizer23->Add(itemButton25, 0, wxGROW|wxALL, 5); + wxButton* itemButton27 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton27->SetDefault(); + itemButton27->SetForegroundColour(wxColour(198, 0, 0)); + itemBoxSizer25->Add(itemButton27, 0, wxGROW|wxALL, 5); - wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer22->Add(itemBoxSizer26, 0, wxGROW|wxALL, 5); + wxBoxSizer* itemBoxSizer28 = new wxBoxSizer(wxHORIZONTAL); + itemBoxSizer24->Add(itemBoxSizer28, 0, wxGROW|wxALL, 5); wxArrayString m_PinShapeStrings; m_PinShapeStrings.Add(_("line")); @@ -324,7 +258,7 @@ void WinEDA_PinPropertiesFrame::CreateControls() m_PinShape = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Pin Shape:"), wxDefaultPosition, wxDefaultSize, m_PinShapeStrings, 1, wxRA_SPECIFY_COLS ); m_PinShape->SetSelection(0); m_PinShape->SetForegroundColour(wxColour(0, 64, 0)); - itemBoxSizer26->Add(m_PinShape, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer28->Add(m_PinShape, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxArrayString m_PinElectricalTypeStrings; m_PinElectricalTypeStrings.Add(_("Input")); @@ -340,7 +274,7 @@ void WinEDA_PinPropertiesFrame::CreateControls() m_PinElectricalType = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("Electrical Type:"), wxDefaultPosition, wxDefaultSize, m_PinElectricalTypeStrings, 1, wxRA_SPECIFY_COLS ); m_PinElectricalType->SetSelection(0); m_PinElectricalType->SetForegroundColour(wxColour(68, 68, 34)); - itemBoxSizer26->Add(m_PinElectricalType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer28->Add(m_PinElectricalType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); ////@end WinEDA_PinPropertiesFrame content construction @@ -400,4 +334,143 @@ void WinEDA_PinPropertiesFrame::OnCancelClick( wxCommandEvent& event ) EndModal(0); } +/*******************************************************/ +void WinEDA_PinPropertiesFrame::SetValuesInDialog(void) +/*******************************************************/ +{ + wxString number; + LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; + wxString msg; + int tmp, ii; + + // Init values and texts for pin name: + if ( CurrentPin ) msg = CurrentPin->m_PinName; + else msg = wxEmptyString; + m_PinNameCtrl->SetValue(msg); + tmp = CurrentPin ? CurrentPin->m_PinNameSize : LastPinNameSize; + msg = ReturnStringFromValue(g_UnitMetric, tmp, m_Parent->m_InternalUnits); + m_PinNameSizeCtrl->SetValue(msg); + msg = m_PinNameSizeText->GetLabel() + ReturnUnitSymbol(); + m_PinNameSizeText->SetLabel(msg); + + /* Init dialog pin num and pin num size values */ + if ( CurrentPin ) CurrentPin->ReturnPinStringNum(msg); + else msg = wxEmptyString; + m_PinNumCtrl->SetValue(msg); + tmp = CurrentPin ? CurrentPin->m_PinNumSize : LastPinNumSize; + msg = ReturnStringFromValue(g_UnitMetric, tmp, m_Parent->m_InternalUnits); + m_PinNumSizeCtrl->SetValue(msg); + msg = m_PinNumSizeText->GetLabel() + ReturnUnitSymbol(); + m_PinNumSizeText->SetLabel(msg); + + /* init dialog pin size */ + msg = m_PinSizeText->GetLabel() + ReturnUnitSymbol(); + m_PinSizeText->SetLabel(msg); + + int pinsize = CurrentPin ? CurrentPin->m_PinLen : LastPinSize; + msg = ReturnStringFromValue(g_UnitMetric, pinsize, m_Parent->m_InternalUnits); + m_PinSizeCtrl->SetValue(msg); + m_PinSizeIncDecButton->SetValue(pinsize); + + /* init pin options */ + if ( CurrentPin ) + { + if ( CurrentPin->m_Unit == 0 ) m_CommonUnit->SetValue(TRUE); + } + else m_CommonUnit->SetValue(LastPinCommonUnit); + if ( CurrentPin ) + { + if ( CurrentPin->m_Convert == 0 ) m_CommonConvert->SetValue(TRUE); + } + else m_CommonConvert->SetValue(LastPinCommonConvert); + if ( CurrentPin ) + { + if ( CurrentPin->m_Attributs & PINNOTDRAW ) m_NoDraw->SetValue(TRUE); + } + else m_NoDraw->SetValue(LastPinNoDraw); + + tmp = CurrentPin ? CurrentPin->m_Orient : LastPinOrient; + switch ( tmp ) + { + case PIN_RIGHT: + m_PinOrient->SetSelection(0); + break; + + case PIN_LEFT: + m_PinOrient->SetSelection(1); + break; + + case PIN_UP: + m_PinOrient->SetSelection(2); + break; + + case PIN_DOWN: + m_PinOrient->SetSelection(3); + break; + } + + tmp = CurrentPin ? CurrentPin->m_PinShape : LastPinShape; + m_PinShape->SetSelection( 0 ); + for ( ii = 0; ii < NBSHAPES; ii++ ) + { + if ( CodeShape[ii] == tmp ) + { + m_PinShape->SetSelection( ii ); break ; + } + } + + tmp = CurrentPin ? CurrentPin->m_PinShape : LastPinShape; + m_PinShape->SetSelection( 0 ); + for ( ii = 0; ii < NBSHAPES; ii++ ) + { + if ( CodeShape[ii] == tmp ) + { + m_PinShape->SetSelection( ii ); break ; + } + } + + m_PinElectricalType->SetSelection( CurrentPin ? CurrentPin->m_PinType : LastPinType); +} + + +/*! + * wxEVT_SCROLL_LINEUP event handler for ID_SPINBUTTON_INC_DEC_PINSIZE + */ + +void WinEDA_PinPropertiesFrame::OnSpinbuttonIncDecPinsizeUp( wxSpinEvent& event ) +{ +int pinsize; +wxString msg; + + // Get the new value, which can be edited by hand, so the value can not match the spin button value + msg = m_PinSizeCtrl->GetValue(); + pinsize = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); + pinsize += 10; + if ( pinsize < 0 ) pinsize = 0; + if ( pinsize > 2000 ) pinsize = 2000; + msg = ReturnStringFromValue(g_UnitMetric, pinsize, m_Parent->m_InternalUnits); + m_PinSizeCtrl->SetValue(msg); + m_PinSizeIncDecButton->SetValue(pinsize); +} + + +/*! + * wxEVT_SCROLL_LINEDOWN event handler for ID_SPINBUTTON_INC_DEC_PINSIZE + */ + +void WinEDA_PinPropertiesFrame::OnSpinbuttonIncDecPinsizeDown( wxSpinEvent& event ) +{ +int pinsize; +wxString msg; + + // Get the new value, which can be edited by hand, so the value can not match the spin button value + msg = m_PinSizeCtrl->GetValue(); + pinsize = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); + pinsize -= 10; + if ( pinsize < 0 ) pinsize = 0; + if ( pinsize > 2000 ) pinsize = 2000; + msg = ReturnStringFromValue(g_UnitMetric, pinsize, m_Parent->m_InternalUnits); + m_PinSizeCtrl->SetValue(msg); + m_PinSizeIncDecButton->SetValue(pinsize); +} diff --git a/eeschema/pinedit-dialog.h b/eeschema/pinedit-dialog.h index a3be181eb2..d94103035b 100644 --- a/eeschema/pinedit-dialog.h +++ b/eeschema/pinedit-dialog.h @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// // Name: pinedit-dialog.h -// Purpose: +// Purpose: // Author: jean-pierre Charras -// Modified by: +// Modified by: // Created: 11/02/2006 13:30:59 -// RCS-ID: +// RCS-ID: // Copyright: License GNU -// Licence: +// Licence: ///////////////////////////////////////////////////////////////////////////// // Generated by DialogBlocks (unregistered), 11/02/2006 13:30:59 @@ -33,7 +33,7 @@ #include "protos.h" ////@begin includes -#include "wx/spinctrl.h" +#include "wx/spinbutt.h" ////@end includes /*! @@ -41,7 +41,7 @@ */ ////@begin forward declarations -class wxSpinCtrl; +class wxSpinButton; ////@end forward declarations /*! @@ -50,14 +50,15 @@ class wxSpinCtrl; ////@begin control identifiers #define ID_DIALOG 10000 -#define ID_TEXTCTRL 10001 -#define ID_TEXTCTRL1 10002 -#define ID_SPINCTRL 10003 -#define ID_CHECKBOX 10004 -#define ID_CHECKBOX1 10005 -#define ID_CHECKBOX2 10006 -#define ID_TEXTCTRL2 10007 -#define ID_TEXTCTRL3 10008 +#define ID_TEXTCTRL_PINNAME 10001 +#define ID_TEXTCTRL_PINNUM 10002 +#define ID_TEXTCTRL_PINSIZE 10003 +#define ID_SPINBUTTON_INC_DEC_PINSIZE 10010 +#define ID_CHECKBOX_COMMON_UNITS 10004 +#define ID_CHECKBOX_COMMON_CONVERT 10005 +#define ID_CHECKBOX_NOT_DRAWN 10006 +#define ID_TEXTCTRL_PINNAME_SIZE 10007 +#define ID_TEXTCTRL_PINNUM_SIZE 10008 #define ID_RADIOBOX 10009 #define ID_RADIOBOX1 10012 #define ID_RADIOBOX2 10013 @@ -81,7 +82,7 @@ class wxSpinCtrl; */ class WinEDA_PinPropertiesFrame: public wxDialog -{ +{ DECLARE_DYNAMIC_CLASS( WinEDA_PinPropertiesFrame ) DECLARE_EVENT_TABLE() @@ -98,6 +99,12 @@ public: ////@begin WinEDA_PinPropertiesFrame event handler declarations + /// wxEVT_SCROLL_LINEUP event handler for ID_SPINBUTTON_INC_DEC_PINSIZE + void OnSpinbuttonIncDecPinsizeUp( wxSpinEvent& event ); + + /// wxEVT_SCROLL_LINEDOWN event handler for ID_SPINBUTTON_INC_DEC_PINSIZE + void OnSpinbuttonIncDecPinsizeDown( wxSpinEvent& event ); + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL void OnCancelClick( wxCommandEvent& event ); @@ -118,6 +125,7 @@ public: /// Should we show tooltips? static bool ShowToolTips(); + void SetValuesInDialog(void); void PinPropertiesAccept(wxCommandEvent& event); void SetPinName(const wxString & newname, int newsize); void SetPinNum(const wxString & newnum, int newsize); @@ -130,7 +138,9 @@ public: ////@begin WinEDA_PinPropertiesFrame member variables wxTextCtrl* m_PinNameCtrl; wxTextCtrl* m_PinNumCtrl; - wxSpinCtrl* m_PinSize; + wxTextCtrl* m_PinSizeCtrl; + wxSpinButton* m_PinSizeIncDecButton; + wxStaticText* m_PinSizeText; wxCheckBox* m_CommonUnit; wxCheckBox* m_CommonConvert; wxCheckBox* m_NoDraw; diff --git a/eeschema/pinedit-dialog.pjd b/eeschema/pinedit-dialog.pjd index d9aea36041..c18a0540b7 100644 --- a/eeschema/pinedit-dialog.pjd +++ b/eeschema/pinedit-dialog.pjd @@ -136,7 +136,7 @@ 0 "" 1 - 0 + -8519680 "" "Debug" "ANSI" @@ -393,7 +393,7 @@ "" - "wxTextCtrl: ID_TEXTCTRL" + "wxTextCtrl: ID_TEXTCTRL_PINNAME" "dialog-control-document" "" "textctrl" @@ -403,7 +403,7 @@ 0 "11/5/2006" "wbTextCtrlProxy" - "ID_TEXTCTRL" + "ID_TEXTCTRL_PINNAME" 10001 "" "wxTextCtrl" @@ -473,7 +473,6 @@ 0 "" "" - 0 "wxStaticText: wxID_STATIC" @@ -546,7 +545,7 @@ "" - "wxTextCtrl: ID_TEXTCTRL1" + "wxTextCtrl: ID_TEXTCTRL_PINNUM" "dialog-control-document" "" "textctrl" @@ -556,7 +555,7 @@ 0 "11/5/2006" "wbTextCtrlProxy" - "ID_TEXTCTRL1" + "ID_TEXTCTRL_PINNUM" 10002 "" "wxTextCtrl" @@ -626,7 +625,6 @@ 0 "" "" - 0 "Spacer" @@ -688,6 +686,187 @@ 0 0 "<Any platform>" + + "wxBoxSizer H" + "dialog-control-document" + "" + "sizer" + 0 + 1 + 0 + 0 + "11/8/2008" + "wbBoxSizerProxy" + "Horizontal" + "" + "Expand" + "Centre" + 0 + 5 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "<Any platform>" + + "wxTextCtrl: ID_TEXTCTRL_PINSIZE" + "dialog-control-document" + "" + "textctrl" + 0 + 1 + 0 + 0 + "11/8/2008" + "wbTextCtrlProxy" + "ID_TEXTCTRL_PINSIZE" + 10003 + "" + "wxTextCtrl" + "wxTextCtrl" + 1 + 0 + "" + "" + "m_PinSizeCtrl" + "" + 0 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxSpinButton: ID_SPINBUTTON_INC_DEC_PINSIZE" + "dialog-control-document" + "" + "spinctrl" + 0 + 1 + 0 + 0 + "11/8/2008" + "wbSpinButtonProxy" + "wxEVT_SCROLL_LINEUP|OnSpinbuttonIncDecPinsizeUp|NONE||WinEDA_PinPropertiesFrame" + "wxEVT_SCROLL_LINEDOWN|OnSpinbuttonIncDecPinsizeDown|NONE||" + "ID_SPINBUTTON_INC_DEC_PINSIZE" + 10010 + "" + "wxSpinButton" + "wxSpinButton" + 1 + 0 + "" + "" + "m_PinSizeIncDecButton" + 0 + 2000 + 0 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Centre" + "Centre" + 0 + 5 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + "" + "" + + "wxStaticText: wxID_STATIC" "dialog-control-document" @@ -697,7 +876,7 @@ 1 0 0 - "11/5/2006" + "11/8/2008" "wbStaticTextProxy" "wxID_STATIC" 5105 @@ -708,8 +887,8 @@ 0 "" "" - "" - "Pin lenght :" + "m_PinSizeText" + "Pin Lenght" -1 "" "" @@ -759,76 +938,7 @@ "" - "wxSpinCtrl: ID_SPINCTRL" - "dialog-control-document" - "" - "spinctrl" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbSpinCtrlProxy" - "ID_SPINCTRL" - 10003 - "" - "wxSpinCtrl" - "wxSpinCtrl" - 1 - 0 - "" - "" - "m_PinSize" - 0 - 2000 - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxCheckBox: ID_CHECKBOX" + "wxCheckBox: ID_CHECKBOX_COMMON_UNITS" "dialog-control-document" "" "checkbox" @@ -838,7 +948,7 @@ 0 "11/5/2006" "wbCheckBoxProxy" - "ID_CHECKBOX" + "ID_CHECKBOX_COMMON_UNITS" 10004 "" "wxCheckBox" @@ -892,7 +1002,7 @@ "" - "wxCheckBox: ID_CHECKBOX1" + "wxCheckBox: ID_CHECKBOX_COMMON_CONVERT" "dialog-control-document" "" "checkbox" @@ -902,7 +1012,7 @@ 0 "11/5/2006" "wbCheckBoxProxy" - "ID_CHECKBOX1" + "ID_CHECKBOX_COMMON_CONVERT" 10005 "" "wxCheckBox" @@ -956,7 +1066,7 @@ "" - "wxCheckBox: ID_CHECKBOX2" + "wxCheckBox: ID_CHECKBOX_NOT_DRAWN" "dialog-control-document" "" "checkbox" @@ -966,7 +1076,7 @@ 0 "11/5/2006" "wbCheckBoxProxy" - "ID_CHECKBOX2" + "ID_CHECKBOX_NOT_DRAWN" 10006 "" "wxCheckBox" @@ -1117,7 +1227,7 @@ "" - "wxTextCtrl: ID_TEXTCTRL2" + "wxTextCtrl: ID_TEXTCTRL_PINNAME_SIZE" "dialog-control-document" "" "textctrl" @@ -1127,7 +1237,7 @@ 0 "11/5/2006" "wbTextCtrlProxy" - "ID_TEXTCTRL2" + "ID_TEXTCTRL_PINNAME_SIZE" 10007 "" "wxTextCtrl" @@ -1197,7 +1307,6 @@ 0 "" "" - 0 "wxStaticText: wxID_STATIC" @@ -1270,7 +1379,7 @@ "" - "wxTextCtrl: ID_TEXTCTRL3" + "wxTextCtrl: ID_TEXTCTRL_PINNUM_SIZE" "dialog-control-document" "" "textctrl" @@ -1280,7 +1389,7 @@ 0 "11/5/2006" "wbTextCtrlProxy" - "ID_TEXTCTRL3" + "ID_TEXTCTRL_PINNUM_SIZE" 10008 "" "wxTextCtrl" @@ -1350,7 +1459,6 @@ 0 "" "" - 0 "Spacer" diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index b1d9ddd9c7..128880a252 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -66,9 +66,13 @@ void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event ) LastPinCommonConvert = m_CommonConvert->GetValue(); LastPinCommonUnit = m_CommonUnit->GetValue(); LastPinNoDraw = m_NoDraw->GetValue(); - LastPinSize = m_PinSize->GetValue(); + + msg = m_PinSizeCtrl->GetValue(); + LastPinSize = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); + msg = m_PinNameSizeCtrl->GetValue(); LastPinNameSize = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); + msg = m_PinNumSizeCtrl->GetValue(); LastPinNumSize = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); @@ -113,7 +117,12 @@ void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event ) void WinEDA_LibeditFrame::InitEditOnePin() /*********************************************/ -/* Routine d'installation du menu d'edition d'une pin +/* Called when installing the edit pin dialog frame + * Set pins flags (.m_Flags pins member) to ensure a correctins edition: + * If 2 or more pins are on the same location (and the same orientation) they are all moved or resized. + * This is usefull for components which have more than one part per package + * In this case all parts can be edited at once. + * Note: if the option "Edit Pin per Pin" (tool of the main toolbar) is activated, only the current part is edited */ { LibDrawPin* Pin; @@ -135,7 +144,8 @@ void WinEDA_LibeditFrame::InitEditOnePin() if( (Pin->m_Pos == CurrentPin->m_Pos) && (Pin->m_Orient == CurrentPin->m_Orient) && ( !(CurrentPin->m_Flags & IS_NEW) ) - && (g_EditPinByPinIsOn == FALSE) ) + && (g_EditPinByPinIsOn == FALSE) // This is set by the tool of the main toolbar + ) Pin->m_Flags |= IS_LINKED | IN_EDIT; else Pin->m_Flags = 0; diff --git a/include/build_version.h b/include/build_version.h index 2cc961763d..655c199a12 100644 --- a/include/build_version.h +++ b/include/build_version.h @@ -9,7 +9,7 @@ COMMON_GLOBL wxString g_BuildVersion # include "config.h" (wxT(KICAD_SVN_VERSION)) # else - (wxT("(20080731.r1175")) + (wxT("(20080811.r1188)")) # endif #endif ;