2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
#ifndef __dialog_edit_component_in_schematic__
|
|
|
|
#define __dialog_edit_component_in_schematic__
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_field.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
#include "template_fieldnames.h"
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
#include "dialog_edit_component_in_schematic_fbp.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
/**
|
|
|
|
* class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
|
2009-12-02 21:44:03 +00:00
|
|
|
* 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.
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
2008-11-24 06:53:43 +00:00
|
|
|
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
|
|
|
|
{
|
2010-12-08 20:12:46 +00:00
|
|
|
friend void InstallCmpeditFrame( SCH_EDIT_FRAME* parent,
|
|
|
|
wxPoint& pos,
|
|
|
|
SCH_COMPONENT* aComponent );
|
2009-01-29 08:58:48 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
SCH_EDIT_FRAME* m_Parent;
|
|
|
|
SCH_COMPONENT* m_Cmp;
|
|
|
|
LIB_COMPONENT* m_LibEntry;
|
|
|
|
bool m_skipCopyFromPanel;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
static int s_SelectedRow;
|
2008-11-24 21:06:50 +00:00
|
|
|
|
2009-01-29 17:30:38 +00:00
|
|
|
/// The size of the dialog window last time it was displayed;
|
2010-12-08 20:12:46 +00:00
|
|
|
static wxSize s_LastSize;
|
2009-01-29 17:30:38 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
/// a copy of the edited component's SCH_FIELDs
|
2010-12-08 20:12:46 +00:00
|
|
|
SCH_FIELDS m_FieldsBuf;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
void setSelectedFieldNdx( int aFieldNdx );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
int getSelectedFieldNdx();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
/**
|
2008-11-24 21:06:50 +00:00
|
|
|
* Function copySelectedFieldToPanel
|
2008-11-24 06:53:43 +00:00
|
|
|
* sets the values displayed on the panel according to
|
2008-11-24 21:06:50 +00:00
|
|
|
* the currently selected field row
|
2008-11-24 06:53:43 +00:00
|
|
|
*/
|
2008-11-24 21:06:50 +00:00
|
|
|
void copySelectedFieldToPanel();
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function copyPanelToSelectedField
|
2009-12-02 21:44:03 +00:00
|
|
|
* copies the values displayed on the panel fields to the currently
|
|
|
|
* selected field
|
2008-11-26 00:20:16 +00:00
|
|
|
* @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.
|
2008-11-24 21:06:50 +00:00
|
|
|
*/
|
2008-11-26 00:20:16 +00:00
|
|
|
bool copyPanelToSelectedField();
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
void copyOptionsToPanel();
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
void copyPanelToOptions();
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
void setRowItem( int aFieldNdx, const SCH_FIELD& aField );
|
2008-11-24 21:06:50 +00:00
|
|
|
|
|
|
|
// event handlers
|
|
|
|
void OnListItemDeselected( wxListEvent& event );
|
|
|
|
void OnListItemSelected( wxListEvent& event );
|
2008-11-26 00:20:16 +00:00
|
|
|
void OnCancelButtonClick( wxCommandEvent& event );
|
|
|
|
void OnOKButtonClick( wxCommandEvent& event );
|
|
|
|
void SetInitCmp( wxCommandEvent& event );
|
2008-11-26 06:25:20 +00:00
|
|
|
void addFieldButtonHandler( wxCommandEvent& event );
|
|
|
|
void deleteFieldButtonHandler( wxCommandEvent& event );
|
|
|
|
void moveUpButtonHandler( wxCommandEvent& event );
|
2008-11-24 21:06:50 +00:00
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
SCH_FIELD* findField( const wxString& aFieldName );
|
|
|
|
|
2008-11-24 21:06:50 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
protected:
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2008-11-24 06:53:43 +00:00
|
|
|
/** 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 );
|
|
|
|
|
2008-12-31 15:01:29 +00:00
|
|
|
private:
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function updateDisplay
|
2008-12-31 15:01:29 +00:00
|
|
|
* 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; ii<m_FieldsBuf.size(); ii++ )
|
|
|
|
setRowItem( ii, m_FieldsBuf[ii] );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
#endif // __dialog_edit_component_in_schematic__
|