Commit 671fabe1 authored by dickelbeck's avatar dickelbeck

edit component in schematic work

parent a1659e41
...@@ -5,6 +5,12 @@ Started 2007-June-11 ...@@ -5,6 +5,12 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Nov-25 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+eeschema
edit component in schematic editor. works except for field add, remove, move up.
2008-Nov-24 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Nov-24 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+eeschema +eeschema
......
This diff is collapsed.
...@@ -683,7 +683,8 @@ int SCH_COMPONENT::GetRotationMiroir() ...@@ -683,7 +683,8 @@ int SCH_COMPONENT::GetRotationMiroir()
{ {
if( memcmp( TempMat, m_Transform, sizeof(MatNormal) ) == 0 ) if( memcmp( TempMat, m_Transform, sizeof(MatNormal) ) == 0 )
{ {
found = TRUE; break; found = TRUE;
break;
} }
SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE ); SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE );
} }
...@@ -697,7 +698,8 @@ int SCH_COMPONENT::GetRotationMiroir() ...@@ -697,7 +698,8 @@ int SCH_COMPONENT::GetRotationMiroir()
{ {
if( memcmp( TempMat, m_Transform, sizeof(MatNormal) ) == 0 ) if( memcmp( TempMat, m_Transform, sizeof(MatNormal) ) == 0 )
{ {
found = TRUE; break; found = TRUE;
break;
} }
SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE ); SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE );
} }
...@@ -712,7 +714,8 @@ int SCH_COMPONENT::GetRotationMiroir() ...@@ -712,7 +714,8 @@ int SCH_COMPONENT::GetRotationMiroir()
{ {
if( memcmp( TempMat, m_Transform, sizeof(MatNormal) ) == 0 ) if( memcmp( TempMat, m_Transform, sizeof(MatNormal) ) == 0 )
{ {
found = TRUE; break; found = TRUE;
break;
} }
SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE ); SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE );
} }
...@@ -726,7 +729,8 @@ int SCH_COMPONENT::GetRotationMiroir() ...@@ -726,7 +729,8 @@ int SCH_COMPONENT::GetRotationMiroir()
} }
else else
{ {
wxBell(); return CMP_NORMAL; wxBell();
return CMP_NORMAL;
} }
} }
......
...@@ -193,6 +193,12 @@ public: ...@@ -193,6 +193,12 @@ public:
*/ */
void AddField( const SCH_CMP_FIELD& aField ); void AddField( const SCH_CMP_FIELD& aField );
void SetFields( const SCH_CMP_FIELDS& aFields )
{
m_Fields = aFields; // vector copying, length is changed possibly
}
/** /**
* Function GetFieldCount * Function GetFieldCount
* returns the number of fields in this component. * returns the number of fields in this component.
......
...@@ -16,7 +16,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM ...@@ -16,7 +16,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM
SCH_COMPONENT* m_Cmp; SCH_COMPONENT* m_Cmp;
EDA_LibComponentStruct* m_LibEntry; EDA_LibComponentStruct* m_LibEntry;
int m_SelectedRow; static int s_SelectedRow;
/// a copy of the edited component's SCH_CMP_FIELDs /// a copy of the edited component's SCH_CMP_FIELDs
SCH_CMP_FIELDS m_FieldsBuf; SCH_CMP_FIELDS m_FieldsBuf;
...@@ -36,17 +36,24 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM ...@@ -36,17 +36,24 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM
/** /**
* Function copyPanelToSelectedField * Function copyPanelToSelectedField
* copies the values displayed on the panel fields to the currently selected field * 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.
*/ */
void copyPanelToSelectedField(); bool copyPanelToSelectedField();
void copyOptionsToPanel();
void fillTableModel(); void copyPanelToOptions();
void setRowItem( int aFieldNdx, const SCH_CMP_FIELD& aField ); void setRowItem( int aFieldNdx, const SCH_CMP_FIELD& aField );
// event handlers // event handlers
void OnListItemDeselected( wxListEvent& event ); void OnListItemDeselected( wxListEvent& event );
void OnListItemSelected( wxListEvent& event ); void OnListItemSelected( wxListEvent& event );
void OnCancelButtonClick( wxCommandEvent& event );
void OnOKButtonClick( wxCommandEvent& event );
void SetInitCmp( wxCommandEvent& event );
protected: protected:
......
...@@ -39,7 +39,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -39,7 +39,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
wxString orientationRadioBoxChoices[] = { _("0"), _("+90"), _("180"), _("-90") }; wxString orientationRadioBoxChoices[] = { _("0"), _("+90"), _("180"), _("-90") };
int orientationRadioBoxNChoices = sizeof( orientationRadioBoxChoices ) / sizeof( wxString ); int orientationRadioBoxNChoices = sizeof( orientationRadioBoxChoices ) / sizeof( wxString );
orientationRadioBox = new wxRadioBox( this, wxID_ANY, _("Orientation (Degrees)"), wxDefaultPosition, wxDefaultSize, orientationRadioBoxNChoices, orientationRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); orientationRadioBox = new wxRadioBox( this, wxID_ANY, _("Orientation (Degrees)"), wxDefaultPosition, wxDefaultSize, orientationRadioBoxNChoices, orientationRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
orientationRadioBox->SetSelection( 0 ); orientationRadioBox->SetSelection( 3 );
orientationRadioBox->SetToolTip( _("Select if the component is to be rotated when drawn") ); orientationRadioBox->SetToolTip( _("Select if the component is to be rotated when drawn") );
orientationSizer->Add( orientationRadioBox, 1, wxALL, 8 ); orientationSizer->Add( orientationRadioBox, 1, wxALL, 8 );
...@@ -52,7 +52,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -52,7 +52,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
wxString mirrorRadioBoxChoices[] = { _("Normal"), _("Mirror ---"), _("Mirror |") }; wxString mirrorRadioBoxChoices[] = { _("Normal"), _("Mirror ---"), _("Mirror |") };
int mirrorRadioBoxNChoices = sizeof( mirrorRadioBoxChoices ) / sizeof( wxString ); int mirrorRadioBoxNChoices = sizeof( mirrorRadioBoxChoices ) / sizeof( wxString );
mirrorRadioBox = new wxRadioBox( this, wxID_ANY, _("Mirror"), wxDefaultPosition, wxDefaultSize, mirrorRadioBoxNChoices, mirrorRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); mirrorRadioBox = new wxRadioBox( this, wxID_ANY, _("Mirror"), wxDefaultPosition, wxDefaultSize, mirrorRadioBoxNChoices, mirrorRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
mirrorRadioBox->SetSelection( 1 ); mirrorRadioBox->SetSelection( 0 );
mirrorRadioBox->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") ); mirrorRadioBox->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") );
mirrorSizer->Add( mirrorRadioBox, 1, wxALL, 8 ); mirrorSizer->Add( mirrorRadioBox, 1, wxALL, 8 );
...@@ -62,18 +62,22 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -62,18 +62,22 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
wxStaticBoxSizer* chipnameSizer; wxStaticBoxSizer* chipnameSizer;
chipnameSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Chip Name") ), wxHORIZONTAL ); chipnameSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Chip Name") ), wxHORIZONTAL );
chipnameTxtControl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); chipnameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
chipnameTxtControl->SetMaxLength( 32 ); chipnameTextCtrl->SetMaxLength( 32 );
chipnameTxtControl->SetToolTip( _("The name of the symbol in the library from which this component came") ); chipnameTextCtrl->SetToolTip( _("The name of the symbol in the library from which this component came") );
chipnameSizer->Add( chipnameTxtControl, 1, wxALL|wxEXPAND, 5 ); chipnameSizer->Add( chipnameTextCtrl, 1, wxALL|wxEXPAND, 5 );
optionsSizer->Add( chipnameSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 8 ); optionsSizer->Add( chipnameSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 8 );
convertCheckBox = new wxCheckBox( this, wxID_ANY, _("Convert"), wxDefaultPosition, wxDefaultSize, 0 ); convertCheckBox = new wxCheckBox( this, wxID_ANY, _("Convert"), wxDefaultPosition, wxDefaultSize, 0 );
convertCheckBox->SetToolTip( _("No Friggin Idea what this is!") ); convertCheckBox->SetToolTip( _("No Friggin Idea what this is!") );
optionsSizer->Add( convertCheckBox, 0, wxALL, 12 ); optionsSizer->Add( convertCheckBox, 0, wxALL, 8 );
partsAreLockedLabel = new wxStaticText( this, wxID_ANY, _("Parts are locked"), wxDefaultPosition, wxDefaultSize, 0 );
partsAreLockedLabel->Wrap( -1 );
optionsSizer->Add( partsAreLockedLabel, 0, wxALL|wxEXPAND, 8 );
upperSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 ); upperSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 );
...@@ -101,7 +105,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -101,7 +105,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
gridStaticBoxSizer->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 ); gridStaticBoxSizer->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 );
fieldsSizer->Add( gridStaticBoxSizer, 4, wxALL|wxEXPAND, 8 ); fieldsSizer->Add( gridStaticBoxSizer, 5, wxALL|wxEXPAND, 8 );
wxBoxSizer* fieldEditBoxSizer; wxBoxSizer* fieldEditBoxSizer;
fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL ); fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL );
...@@ -223,6 +227,9 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -223,6 +227,9 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
// Connect Events // Connect Events
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this ); fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this ); fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
defaultsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnOKButtonClick ), NULL, this );
} }
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP() DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP()
...@@ -230,4 +237,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -230,4 +237,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
// Disconnect Events // Disconnect Events
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this ); fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this ); fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
defaultsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnOKButtonClick ), NULL, this );
} }
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
#include <wx/radiobox.h> #include <wx/radiobox.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/stattext.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -40,8 +40,9 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog ...@@ -40,8 +40,9 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
wxChoice* unitChoice; wxChoice* unitChoice;
wxRadioBox* orientationRadioBox; wxRadioBox* orientationRadioBox;
wxRadioBox* mirrorRadioBox; wxRadioBox* mirrorRadioBox;
wxTextCtrl* chipnameTxtControl; wxTextCtrl* chipnameTextCtrl;
wxCheckBox* convertCheckBox; wxCheckBox* convertCheckBox;
wxStaticText* partsAreLockedLabel;
wxListCtrl* fieldListCtrl; wxListCtrl* fieldListCtrl;
wxButton* addFieldButton; wxButton* addFieldButton;
wxButton* deleteFieldButton; wxButton* deleteFieldButton;
...@@ -68,6 +69,9 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog ...@@ -68,6 +69,9 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnListItemDeselected( wxListEvent& event ){ event.Skip(); } virtual void OnListItemDeselected( wxListEvent& event ){ event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); } virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); }
virtual void SetInitCmp( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ){ event.Skip(); }
public: public:
......
...@@ -469,6 +469,14 @@ public: ...@@ -469,6 +469,14 @@ public:
void SetFocus() { m_FrameText->SetFocus(); } void SetFocus() { m_FrameText->SetFocus(); }
void SetValue( const wxString& value ); void SetValue( const wxString& value );
void SetValue( int value ); void SetValue( int value );
/**
* Function FormatSize
* formats a string containing the size in the desired units.
*/
static wxString FormatSize( int internalUnit, int units, int textSize );
static int ParseSize( const wxString& sizeText, int internalUnit, int units );
}; };
......
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