diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index 9141746a2d..926d2d6080 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -40,12 +40,95 @@ #include #include #include +#include -#include + +/** + * class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC + * is hand coded and implements DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP which + * is maintained by wxFormBuilder. Do not auto-generate this class or file, + * it is hand coded. + */ +class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP +{ +public: + /** Constructor */ + DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* parent ); + + /** + * Function InitBuffers + * sets up to edit the given component. + * @param aComponent The component to edit. + */ + void InitBuffers( SCH_COMPONENT* aComponent ); + +private: + + friend class SCH_EDIT_FRAME; + + SCH_EDIT_FRAME* m_Parent; + SCH_COMPONENT* m_Cmp; + LIB_COMPONENT* m_LibEntry; + bool m_skipCopyFromPanel; + + static int s_SelectedRow; + + /// a copy of the edited component's SCH_FIELDs + SCH_FIELDS m_FieldsBuf; + + void setSelectedFieldNdx( int aFieldNdx ); + + int getSelectedFieldNdx(); + + /** + * Function copySelectedFieldToPanel + * sets the values displayed on the panel according to + * the currently selected field row + */ + void copySelectedFieldToPanel(); + + + /** + * Function copyPanelToSelectedField + * copies the values displayed on the panel fields to the currently + * selected field + * @return bool - true if all fields are OK, else false if the user has put + * bad data into a field, and this value can be used to deny a row change. + */ + bool copyPanelToSelectedField(); + + void copyOptionsToPanel(); + + void copyPanelToOptions(); + + void setRowItem( int aFieldNdx, const SCH_FIELD& aField ); + + // event handlers + void OnListItemDeselected( wxListEvent& event ); + void OnListItemSelected( wxListEvent& event ); + void OnCancelButtonClick( wxCommandEvent& event ); + void OnOKButtonClick( wxCommandEvent& event ); + void SetInitCmp( wxCommandEvent& event ); + void addFieldButtonHandler( wxCommandEvent& event ); + void deleteFieldButtonHandler( wxCommandEvent& event ); + void moveUpButtonHandler( wxCommandEvent& event ); + + SCH_FIELD* findField( const wxString& aFieldName ); + + /** + * Function updateDisplay + * update the listbox showing fields, according to the fields texts + * must be called after a text change in fields, if this change is not an edition + */ + void updateDisplay( ) + { + for( unsigned ii = FIELD1; iiInitBuffers( aComponent ); - wxSize sizeNow = dlg->GetSize(); - - // this relies on wxDefaultSize being -1,-1, be careful here. - if( sizeNow.GetWidth() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetWidth() - || sizeNow.GetHeight() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetHeight() ) - { - dlg->SetSize( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize ); - } - // make sure the chipnameTextCtrl is wide enough to hold any unusually long chip names: EnsureTextCtrlWidth( dlg->chipnameTextCtrl ); dlg->ShowModal(); - // Some of the field values are long and are not always fully visible because the - // window comes up too narrow. Remember user's manual window resizing efforts here - // so it comes up wide enough next time. - DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dlg->GetSize(); - m_canvas->MoveCursorToCrossHair(); m_canvas->SetIgnoreMouseEvents( false ); dlg->Destroy(); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.h b/eeschema/dialogs/dialog_edit_component_in_schematic.h deleted file mode 100644 index 4711ed5b24..0000000000 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.h +++ /dev/null @@ -1,105 +0,0 @@ - -#ifndef __dialog_edit_component_in_schematic__ -#define __dialog_edit_component_in_schematic__ - - -#include -#include - -#include - - -class SCH_EDIT_FRAME; - - -/** - * class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC - * is hand coded and implements DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP which - * is maintained by wxFormBuilder. Do not auto-generate this class or file, - * it is hand coded. - */ -class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP -{ - friend class SCH_EDIT_FRAME; - - SCH_EDIT_FRAME* m_Parent; - SCH_COMPONENT* m_Cmp; - LIB_COMPONENT* m_LibEntry; - bool m_skipCopyFromPanel; - - static int s_SelectedRow; - - /// The size of the dialog window last time it was displayed; - static wxSize s_LastSize; - - /// a copy of the edited component's SCH_FIELDs - SCH_FIELDS m_FieldsBuf; - - void setSelectedFieldNdx( int aFieldNdx ); - - int getSelectedFieldNdx(); - - /** - * Function copySelectedFieldToPanel - * sets the values displayed on the panel according to - * the currently selected field row - */ - void copySelectedFieldToPanel(); - - - /** - * Function copyPanelToSelectedField - * copies the values displayed on the panel fields to the currently - * selected field - * @return bool - true if all fields are OK, else false if the user has put - * bad data into a field, and this value can be used to deny a row change. - */ - bool copyPanelToSelectedField(); - - void copyOptionsToPanel(); - - void copyPanelToOptions(); - - void setRowItem( int aFieldNdx, const SCH_FIELD& aField ); - - // event handlers - void OnListItemDeselected( wxListEvent& event ); - void OnListItemSelected( wxListEvent& event ); - void OnCancelButtonClick( wxCommandEvent& event ); - void OnOKButtonClick( wxCommandEvent& event ); - void SetInitCmp( wxCommandEvent& event ); - void addFieldButtonHandler( wxCommandEvent& event ); - void deleteFieldButtonHandler( wxCommandEvent& event ); - void moveUpButtonHandler( wxCommandEvent& event ); - - SCH_FIELD* findField( const wxString& aFieldName ); - - -protected: - - -public: - /** Constructor */ - DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* parent ); - - /** - * Function InitBuffers - * sets up to edit the given component. - * @param aComponent The component to edit. - */ - void InitBuffers( SCH_COMPONENT* aComponent ); - -private: - /** - * Function updateDisplay - * update the listbox showing fields, according to the fields texts - * must be called after a text change in fields, if this change is not an edition - */ - void updateDisplay( ) - { - for( unsigned ii = FIELD1; iiSetSizeHints( wxDefaultSize, wxDefaultSize ); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp index e4f7ca803d..aee5e6aa94 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp @@ -44,7 +44,7 @@ 700,496 wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU - ; + DIALOG_SHIM; dialog_shim.h Component Properties diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h index 17b5e38ec6..895d108864 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Apr 30 2013) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,6 +11,9 @@ #include #include #include +class DIALOG_SHIM; + +#include "dialog_shim.h" #include #include #include @@ -33,7 +36,7 @@ /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP /////////////////////////////////////////////////////////////////////////////// -class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog +class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM { private: diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 4e03d0fa27..24eef58c2c 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -468,9 +468,9 @@ void LIB_EDIT_FRAME::UpdatePartSelectList() { for( int i = 0; i < m_component->GetPartCount(); i++ ) { - wxString msg = LIB_COMPONENT::ReturnSubReference( i+1, false ); - msg.Printf( _( "Part %s" ), GetChars( msg ) ); - m_partSelectBox->Append( msg ); + wxString sub = LIB_COMPONENT::ReturnSubReference( i+1, false ); + wxString part = wxString::Format( _( "Part %s" ), GetChars( sub ) ); + m_partSelectBox->Append( part ); } }