30 changed files with 4436 additions and 2138 deletions
-
7.bzrignore
-
26CHANGELOG.txt
-
35CMakeModules/TokenList2DsnLexer.cmake
-
42common/dsnlexer.cpp
-
24eeschema/CMakeLists.txt
-
168eeschema/class_libentry.cpp
-
28eeschema/class_libentry.h
-
84eeschema/class_libentry_fields.cpp
-
36eeschema/class_libentry_fields.h
-
11eeschema/class_sch_cmp_field.h
-
108eeschema/class_sch_component.cpp
-
40eeschema/class_sch_component.h
-
2eeschema/cmp_library_lexer.cpp
-
168eeschema/dialog_edit_component_in_schematic.cpp
-
8eeschema/dialog_edit_component_in_schematic.h
-
272eeschema/dialog_edit_libentry_fields_in_lib.cpp
-
86eeschema/dialog_eeschema_options.cpp
-
9eeschema/dialog_eeschema_options.h
-
424eeschema/dialog_eeschema_options_base.cpp
-
4143eeschema/dialog_eeschema_options_base.fbp
-
191eeschema/dialog_eeschema_options_base.h
-
77eeschema/eeschema_config.cpp
-
3eeschema/read_from_file_schematic_items_descriptions.cpp
-
179eeschema/template_fieldnames.cpp
-
149eeschema/template_fieldnames.h
-
5eeschema/template_fieldnames.lst
-
44include/dsnlexer.h
-
140include/param_config.h
-
47include/wxEeschemaStruct.h
-
18pcbnew/specctra.cpp
@ -1,162 +1,262 @@ |
|||
///////////////////////////////////////////////////////////////////////////
|
|||
// C++ code generated with wxFormBuilder (version Apr 16 2008)
|
|||
// http://www.wxformbuilder.org/
|
|||
//
|
|||
// PLEASE DO "NOT" EDIT THIS FILE!
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
#include "dialog_eeschema_options_base.h"
|
|||
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
BEGIN_EVENT_TABLE( DIALOG_EESCHEMA_OPTIONS_BASE, wxDialog ) |
|||
EVT_CHOICE( wxID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnChooseUnits ) |
|||
END_EVENT_TABLE() |
|||
|
|||
DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_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 ); |
|||
|
|||
wxBoxSizer* mainSizer; |
|||
mainSizer = new wxBoxSizer( wxHORIZONTAL ); |
|||
|
|||
wxBoxSizer* bSizer3; |
|||
bSizer3 = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
wxFlexGridSizer* fgSizer1; |
|||
fgSizer1 = new wxFlexGridSizer( 7, 3, 0, 0 ); |
|||
fgSizer1->AddGrowableCol( 0 ); |
|||
fgSizer1->AddGrowableCol( 1 ); |
|||
fgSizer1->AddGrowableCol( 2 ); |
|||
fgSizer1->SetFlexibleDirection( wxHORIZONTAL ); |
|||
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); |
|||
|
|||
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Mesurement &units:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText2->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText2, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
wxArrayString m_choiceUnitsChoices; |
|||
m_choiceUnits = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceUnitsChoices, 0 ); |
|||
m_choiceUnits->SetSelection( 0 ); |
|||
fgSizer1->Add( m_choiceUnits, 1, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
|
|||
fgSizer1->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 3 ); |
|||
|
|||
m_staticText3 = new wxStaticText( this, wxID_ANY, _("&Grid size:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText3->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText3, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
wxArrayString m_choiceGridSizeChoices; |
|||
m_choiceGridSize = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceGridSizeChoices, 0 ); |
|||
m_choiceGridSize->SetSelection( 0 ); |
|||
fgSizer1->Add( m_choiceGridSize, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticGridUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticGridUnits->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticGridUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_staticText5 = new wxStaticText( this, wxID_ANY, _("Default &line width:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText5->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_spinLineWidth = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 100, 0 ); |
|||
fgSizer1->Add( m_spinLineWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticLineWidthUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticLineWidthUnits->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticLineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_staticText7 = new wxStaticText( this, wxID_ANY, _("Default text &size:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText7->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText7, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_spinTextSize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 1000, 0 ); |
|||
fgSizer1->Add( m_spinTextSize, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticTextSizeUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticTextSizeUnits->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticTextSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_staticText9 = new wxStaticText( this, wxID_ANY, _("Repeat draw item &horizontal displacement:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText9->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText9, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_spinRepeatHorizontal = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 500, 0 ); |
|||
fgSizer1->Add( m_spinRepeatHorizontal, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticRepeatXUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticRepeatXUnits->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticRepeatXUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_staticText12 = new wxStaticText( this, wxID_ANY, _("Repeat draw item &vertical displacement:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText12->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText12, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_spinRepeatVertical = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 500, 100 ); |
|||
fgSizer1->Add( m_spinRepeatVertical, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticRepeatYUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticRepeatYUnits->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticRepeatYUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_staticText16 = new wxStaticText( this, wxID_ANY, _("&Repeat label increment:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText16->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText16, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_spinRepeatLabel = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 10, 1 ); |
|||
fgSizer1->Add( m_spinRepeatLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
|
|||
fgSizer1->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 3 ); |
|||
|
|||
bSizer3->Add( fgSizer1, 0, wxALIGN_CENTER|wxEXPAND, 0 ); |
|||
|
|||
wxBoxSizer* bSizer2; |
|||
bSizer2 = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
m_checkShowGrid = new wxCheckBox( this, wxID_ANY, _("Show g&rid"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
|
|||
bSizer2->Add( m_checkShowGrid, 0, wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_checkShowHiddenPins = new wxCheckBox( this, wxID_ANY, _("Show hi&dden pins"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
|
|||
bSizer2->Add( m_checkShowHiddenPins, 0, wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_checkAutoPan = new wxCheckBox( this, wxID_ANY, _("Enable automatic &panning"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
|
|||
bSizer2->Add( m_checkAutoPan, 0, wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_checkHVOrientation = new wxCheckBox( this, wxID_ANY, _("Allow buses and wires to be placed in H or V &orientation only"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
|
|||
bSizer2->Add( m_checkHVOrientation, 0, wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_checkPageLimits = new wxCheckBox( this, wxID_ANY, _("Show p&age limits"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
|
|||
bSizer2->Add( m_checkPageLimits, 0, wxALL|wxEXPAND, 3 ); |
|||
|
|||
bSizer3->Add( bSizer2, 0, wxEXPAND, 0 ); |
|||
|
|||
|
|||
bSizer3->Add( 0, 0, 1, wxALL|wxEXPAND, 10 ); |
|||
|
|||
m_sdbSizer1 = new wxStdDialogButtonSizer(); |
|||
m_sdbSizer1OK = new wxButton( this, wxID_OK ); |
|||
m_sdbSizer1->AddButton( m_sdbSizer1OK ); |
|||
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); |
|||
m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); |
|||
m_sdbSizer1->Realize(); |
|||
bSizer3->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 0 ); |
|||
|
|||
mainSizer->Add( bSizer3, 1, wxALL|wxEXPAND, 12 ); |
|||
|
|||
this->SetSizer( mainSizer ); |
|||
this->Layout(); |
|||
mainSizer->Fit( this ); |
|||
|
|||
this->Centre( wxBOTH ); |
|||
} |
|||
|
|||
DIALOG_EESCHEMA_OPTIONS_BASE::~DIALOG_EESCHEMA_OPTIONS_BASE() |
|||
{ |
|||
} |
|||
///////////////////////////////////////////////////////////////////////////
|
|||
// C++ code generated with wxFormBuilder (version Dec 21 2009)
|
|||
// http://www.wxformbuilder.org/
|
|||
//
|
|||
// PLEASE DO "NOT" EDIT THIS FILE!
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
#include "dialog_eeschema_options_base.h"
|
|||
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
BEGIN_EVENT_TABLE( DIALOG_EESCHEMA_OPTIONS_BASE, wxDialog ) |
|||
EVT_CHOICE( wxID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnChooseUnits ) |
|||
END_EVENT_TABLE() |
|||
|
|||
DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_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 ); |
|||
|
|||
wxBoxSizer* mainSizer; |
|||
mainSizer = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
wxBoxSizer* bSizer5; |
|||
bSizer5 = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_panel1 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); |
|||
wxBoxSizer* p1mainSizer; |
|||
p1mainSizer = new wxBoxSizer( wxHORIZONTAL ); |
|||
|
|||
wxBoxSizer* bSizer3; |
|||
bSizer3 = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
wxFlexGridSizer* fgSizer1; |
|||
fgSizer1 = new wxFlexGridSizer( 7, 3, 0, 0 ); |
|||
fgSizer1->AddGrowableCol( 0 ); |
|||
fgSizer1->AddGrowableCol( 1 ); |
|||
fgSizer1->AddGrowableCol( 2 ); |
|||
fgSizer1->SetFlexibleDirection( wxHORIZONTAL ); |
|||
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); |
|||
|
|||
m_staticText2 = new wxStaticText( m_panel1, wxID_ANY, _("Measurement &units:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText2->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText2, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
wxArrayString m_choiceUnitsChoices; |
|||
m_choiceUnits = new wxChoice( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceUnitsChoices, 0 ); |
|||
m_choiceUnits->SetSelection( 0 ); |
|||
fgSizer1->Add( m_choiceUnits, 1, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
|
|||
fgSizer1->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 3 ); |
|||
|
|||
m_staticText3 = new wxStaticText( m_panel1, wxID_ANY, _("&Grid size:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText3->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText3, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
wxArrayString m_choiceGridSizeChoices; |
|||
m_choiceGridSize = new wxChoice( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceGridSizeChoices, 0 ); |
|||
m_choiceGridSize->SetSelection( 0 ); |
|||
fgSizer1->Add( m_choiceGridSize, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticGridUnits = new wxStaticText( m_panel1, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticGridUnits->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticGridUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_staticText5 = new wxStaticText( m_panel1, wxID_ANY, _("Default &line width:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText5->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_spinLineWidth = new wxSpinCtrl( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 100, 0 ); |
|||
fgSizer1->Add( m_spinLineWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticLineWidthUnits = new wxStaticText( m_panel1, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticLineWidthUnits->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticLineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_staticText7 = new wxStaticText( m_panel1, wxID_ANY, _("Default text &size:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText7->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText7, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_spinTextSize = new wxSpinCtrl( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 1000, 0 ); |
|||
fgSizer1->Add( m_spinTextSize, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticTextSizeUnits = new wxStaticText( m_panel1, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticTextSizeUnits->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticTextSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_staticText9 = new wxStaticText( m_panel1, wxID_ANY, _("Repeat draw item &horizontal displacement:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText9->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText9, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_spinRepeatHorizontal = new wxSpinCtrl( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 500, 0 ); |
|||
fgSizer1->Add( m_spinRepeatHorizontal, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticRepeatXUnits = new wxStaticText( m_panel1, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticRepeatXUnits->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticRepeatXUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_staticText12 = new wxStaticText( m_panel1, wxID_ANY, _("Repeat draw item &vertical displacement:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText12->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText12, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_spinRepeatVertical = new wxSpinCtrl( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 500, 100 ); |
|||
fgSizer1->Add( m_spinRepeatVertical, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticRepeatYUnits = new wxStaticText( m_panel1, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticRepeatYUnits->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticRepeatYUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_staticText16 = new wxStaticText( m_panel1, wxID_ANY, _("&Repeat label increment:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText16->Wrap( -1 ); |
|||
fgSizer1->Add( m_staticText16, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); |
|||
|
|||
m_spinRepeatLabel = new wxSpinCtrl( m_panel1, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 10, 1 ); |
|||
fgSizer1->Add( m_spinRepeatLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
|
|||
fgSizer1->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 3 ); |
|||
|
|||
bSizer3->Add( fgSizer1, 0, wxALIGN_CENTER|wxEXPAND, 0 ); |
|||
|
|||
wxBoxSizer* bSizer2; |
|||
bSizer2 = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
m_checkShowGrid = new wxCheckBox( m_panel1, wxID_ANY, _("Show g&rid"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
bSizer2->Add( m_checkShowGrid, 0, wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_checkShowHiddenPins = new wxCheckBox( m_panel1, wxID_ANY, _("Show hi&dden pins"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
bSizer2->Add( m_checkShowHiddenPins, 0, wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_checkAutoPan = new wxCheckBox( m_panel1, wxID_ANY, _("Enable automatic &panning"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
bSizer2->Add( m_checkAutoPan, 0, wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_checkHVOrientation = new wxCheckBox( m_panel1, wxID_ANY, _("Allow buses and wires to be placed in H or V &orientation only"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
bSizer2->Add( m_checkHVOrientation, 0, wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_checkPageLimits = new wxCheckBox( m_panel1, wxID_ANY, _("Show p&age limits"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
bSizer2->Add( m_checkPageLimits, 0, wxALL|wxEXPAND, 3 ); |
|||
|
|||
bSizer3->Add( bSizer2, 0, wxEXPAND, 0 ); |
|||
|
|||
|
|||
bSizer3->Add( 0, 0, 1, wxALL|wxEXPAND, 10 ); |
|||
|
|||
p1mainSizer->Add( bSizer3, 1, wxALL|wxEXPAND, 12 ); |
|||
|
|||
m_panel1->SetSizer( p1mainSizer ); |
|||
m_panel1->Layout(); |
|||
p1mainSizer->Fit( m_panel1 ); |
|||
m_notebook1->AddPage( m_panel1, _("General Options"), true ); |
|||
m_panel2 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); |
|||
m_panel2->SetToolTip( _("User defined field names for schematic components. ") ); |
|||
|
|||
wxBoxSizer* bSizer6; |
|||
bSizer6 = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
wxBoxSizer* bSizer8; |
|||
bSizer8 = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
m_staticText211 = new wxStaticText( m_panel2, wxID_ANY, _("Please enter fieldnames which you want presented in the component fieldname (property) editors. Names may not include (, ), or \" characters."), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText211->Wrap( 400 ); |
|||
bSizer8->Add( m_staticText211, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); |
|||
|
|||
bSizer6->Add( bSizer8, 0, wxEXPAND, 5 ); |
|||
|
|||
wxBoxSizer* bSizer7; |
|||
bSizer7 = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
wxFlexGridSizer* fgSizer2; |
|||
fgSizer2 = new wxFlexGridSizer( 2, 2, 0, 0 ); |
|||
fgSizer2->AddGrowableCol( 1 ); |
|||
fgSizer2->SetFlexibleDirection( wxHORIZONTAL ); |
|||
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); |
|||
|
|||
m_staticText15 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 1"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText15->Wrap( -1 ); |
|||
fgSizer2->Add( m_staticText15, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); |
|||
|
|||
m_fieldName1 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
fgSizer2->Add( m_fieldName1, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticText161 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 2"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText161->Wrap( -1 ); |
|||
fgSizer2->Add( m_staticText161, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); |
|||
|
|||
m_fieldName2 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
fgSizer2->Add( m_fieldName2, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticText17 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 3"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText17->Wrap( -1 ); |
|||
fgSizer2->Add( m_staticText17, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); |
|||
|
|||
m_fieldName3 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
fgSizer2->Add( m_fieldName3, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticText18 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 4"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText18->Wrap( -1 ); |
|||
fgSizer2->Add( m_staticText18, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); |
|||
|
|||
m_fieldName4 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
fgSizer2->Add( m_fieldName4, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticText19 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 5"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText19->Wrap( -1 ); |
|||
fgSizer2->Add( m_staticText19, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); |
|||
|
|||
m_fieldName5 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
fgSizer2->Add( m_fieldName5, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticText20 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 6"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText20->Wrap( -1 ); |
|||
fgSizer2->Add( m_staticText20, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); |
|||
|
|||
m_fieldName6 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
fgSizer2->Add( m_fieldName6, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticText21 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 7"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText21->Wrap( -1 ); |
|||
fgSizer2->Add( m_staticText21, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); |
|||
|
|||
m_fieldName7 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
fgSizer2->Add( m_fieldName7, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
m_staticText22 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 8"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText22->Wrap( -1 ); |
|||
fgSizer2->Add( m_staticText22, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); |
|||
|
|||
m_fieldName8 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
fgSizer2->Add( m_fieldName8, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); |
|||
|
|||
bSizer7->Add( fgSizer2, 1, wxALIGN_CENTER|wxEXPAND, 5 ); |
|||
|
|||
bSizer6->Add( bSizer7, 1, wxALL|wxEXPAND, 12 ); |
|||
|
|||
m_panel2->SetSizer( bSizer6 ); |
|||
m_panel2->Layout(); |
|||
bSizer6->Fit( m_panel2 ); |
|||
m_notebook1->AddPage( m_panel2, _("Template Field Names"), false ); |
|||
|
|||
bSizer5->Add( m_notebook1, 1, wxEXPAND, 0 ); |
|||
|
|||
m_sdbSizer1 = new wxStdDialogButtonSizer(); |
|||
m_sdbSizer1OK = new wxButton( this, wxID_OK ); |
|||
m_sdbSizer1->AddButton( m_sdbSizer1OK ); |
|||
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); |
|||
m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); |
|||
m_sdbSizer1->Realize(); |
|||
bSizer5->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 ); |
|||
|
|||
mainSizer->Add( bSizer5, 1, 0, 12 ); |
|||
|
|||
this->SetSizer( mainSizer ); |
|||
this->Layout(); |
|||
mainSizer->Fit( this ); |
|||
|
|||
this->Centre( wxBOTH ); |
|||
} |
|||
|
|||
DIALOG_EESCHEMA_OPTIONS_BASE::~DIALOG_EESCHEMA_OPTIONS_BASE() |
|||
{ |
|||
} |
4143
eeschema/dialog_eeschema_options_base.fbp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,82 +1,109 @@ |
|||
/////////////////////////////////////////////////////////////////////////// |
|||
// C++ code generated with wxFormBuilder (version Apr 16 2008) |
|||
// http://www.wxformbuilder.org/ |
|||
// |
|||
// PLEASE DO "NOT" EDIT THIS FILE! |
|||
/////////////////////////////////////////////////////////////////////////// |
|||
|
|||
#ifndef __dialog_eeschema_options_base__ |
|||
#define __dialog_eeschema_options_base__ |
|||
|
|||
#include <wx/intl.h> |
|||
|
|||
#include <wx/string.h> |
|||
#include <wx/stattext.h> |
|||
#include <wx/gdicmn.h> |
|||
#include <wx/font.h> |
|||
#include <wx/colour.h> |
|||
#include <wx/settings.h> |
|||
#include <wx/choice.h> |
|||
#include <wx/spinctrl.h> |
|||
#include <wx/sizer.h> |
|||
#include <wx/checkbox.h> |
|||
#include <wx/button.h> |
|||
#include <wx/dialog.h> |
|||
|
|||
/////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
/// Class DIALOG_EESCHEMA_OPTIONS_BASE |
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog |
|||
{ |
|||
DECLARE_EVENT_TABLE() |
|||
private: |
|||
|
|||
// Private event handlers |
|||
void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); } |
|||
|
|||
|
|||
protected: |
|||
wxStaticText* m_staticText2; |
|||
wxChoice* m_choiceUnits; |
|||
|
|||
wxStaticText* m_staticText3; |
|||
wxChoice* m_choiceGridSize; |
|||
wxStaticText* m_staticGridUnits; |
|||
wxStaticText* m_staticText5; |
|||
wxSpinCtrl* m_spinLineWidth; |
|||
wxStaticText* m_staticLineWidthUnits; |
|||
wxStaticText* m_staticText7; |
|||
wxSpinCtrl* m_spinTextSize; |
|||
wxStaticText* m_staticTextSizeUnits; |
|||
wxStaticText* m_staticText9; |
|||
wxSpinCtrl* m_spinRepeatHorizontal; |
|||
wxStaticText* m_staticRepeatXUnits; |
|||
wxStaticText* m_staticText12; |
|||
wxSpinCtrl* m_spinRepeatVertical; |
|||
wxStaticText* m_staticRepeatYUnits; |
|||
wxStaticText* m_staticText16; |
|||
wxSpinCtrl* m_spinRepeatLabel; |
|||
|
|||
wxCheckBox* m_checkShowGrid; |
|||
wxCheckBox* m_checkShowHiddenPins; |
|||
wxCheckBox* m_checkAutoPan; |
|||
wxCheckBox* m_checkHVOrientation; |
|||
wxCheckBox* m_checkPageLimits; |
|||
|
|||
wxStdDialogButtonSizer* m_sdbSizer1; |
|||
wxButton* m_sdbSizer1OK; |
|||
wxButton* m_sdbSizer1Cancel; |
|||
|
|||
// Virtual event handlers, overide them in your derived class |
|||
virtual void OnChooseUnits( wxCommandEvent& event ){ event.Skip(); } |
|||
|
|||
|
|||
public: |
|||
DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); |
|||
~DIALOG_EESCHEMA_OPTIONS_BASE(); |
|||
|
|||
}; |
|||
|
|||
#endif //__dialog_eeschema_options_base__ |
|||
/////////////////////////////////////////////////////////////////////////// |
|||
// C++ code generated with wxFormBuilder (version Dec 21 2009) |
|||
// http://www.wxformbuilder.org/ |
|||
// |
|||
// PLEASE DO "NOT" EDIT THIS FILE! |
|||
/////////////////////////////////////////////////////////////////////////// |
|||
|
|||
#ifndef __dialog_eeschema_options_base__ |
|||
#define __dialog_eeschema_options_base__ |
|||
|
|||
#include <wx/intl.h> |
|||
|
|||
#include <wx/string.h> |
|||
#include <wx/stattext.h> |
|||
#include <wx/gdicmn.h> |
|||
#include <wx/font.h> |
|||
#include <wx/colour.h> |
|||
#include <wx/settings.h> |
|||
#include <wx/choice.h> |
|||
#include <wx/spinctrl.h> |
|||
#include <wx/sizer.h> |
|||
#include <wx/checkbox.h> |
|||
#include <wx/panel.h> |
|||
#include <wx/bitmap.h> |
|||
#include <wx/image.h> |
|||
#include <wx/icon.h> |
|||
#include <wx/textctrl.h> |
|||
#include <wx/notebook.h> |
|||
#include <wx/button.h> |
|||
#include <wx/dialog.h> |
|||
|
|||
/////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
/// Class DIALOG_EESCHEMA_OPTIONS_BASE |
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog |
|||
{ |
|||
DECLARE_EVENT_TABLE() |
|||
private: |
|||
|
|||
// Private event handlers |
|||
void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); } |
|||
|
|||
|
|||
protected: |
|||
wxNotebook* m_notebook1; |
|||
wxPanel* m_panel1; |
|||
wxStaticText* m_staticText2; |
|||
wxChoice* m_choiceUnits; |
|||
|
|||
wxStaticText* m_staticText3; |
|||
wxChoice* m_choiceGridSize; |
|||
wxStaticText* m_staticGridUnits; |
|||
wxStaticText* m_staticText5; |
|||
wxSpinCtrl* m_spinLineWidth; |
|||
wxStaticText* m_staticLineWidthUnits; |
|||
wxStaticText* m_staticText7; |
|||
wxSpinCtrl* m_spinTextSize; |
|||
wxStaticText* m_staticTextSizeUnits; |
|||
wxStaticText* m_staticText9; |
|||
wxSpinCtrl* m_spinRepeatHorizontal; |
|||
wxStaticText* m_staticRepeatXUnits; |
|||
wxStaticText* m_staticText12; |
|||
wxSpinCtrl* m_spinRepeatVertical; |
|||
wxStaticText* m_staticRepeatYUnits; |
|||
wxStaticText* m_staticText16; |
|||
wxSpinCtrl* m_spinRepeatLabel; |
|||
|
|||
wxCheckBox* m_checkShowGrid; |
|||
wxCheckBox* m_checkShowHiddenPins; |
|||
wxCheckBox* m_checkAutoPan; |
|||
wxCheckBox* m_checkHVOrientation; |
|||
wxCheckBox* m_checkPageLimits; |
|||
|
|||
wxPanel* m_panel2; |
|||
wxStaticText* m_staticText211; |
|||
wxStaticText* m_staticText15; |
|||
wxTextCtrl* m_fieldName1; |
|||
wxStaticText* m_staticText161; |
|||
wxTextCtrl* m_fieldName2; |
|||
wxStaticText* m_staticText17; |
|||
wxTextCtrl* m_fieldName3; |
|||
wxStaticText* m_staticText18; |
|||
wxTextCtrl* m_fieldName4; |
|||
wxStaticText* m_staticText19; |
|||
wxTextCtrl* m_fieldName5; |
|||
wxStaticText* m_staticText20; |
|||
wxTextCtrl* m_fieldName6; |
|||
wxStaticText* m_staticText21; |
|||
wxTextCtrl* m_fieldName7; |
|||
wxStaticText* m_staticText22; |
|||
wxTextCtrl* m_fieldName8; |
|||
wxStdDialogButtonSizer* m_sdbSizer1; |
|||
wxButton* m_sdbSizer1OK; |
|||
wxButton* m_sdbSizer1Cancel; |
|||
|
|||
// Virtual event handlers, overide them in your derived class |
|||
virtual void OnChooseUnits( wxCommandEvent& event ) { event.Skip(); } |
|||
|
|||
|
|||
public: |
|||
|
|||
DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); |
|||
~DIALOG_EESCHEMA_OPTIONS_BASE(); |
|||
|
|||
}; |
|||
|
|||
#endif //__dialog_eeschema_options_base__ |
@ -0,0 +1,179 @@ |
|||
|
|||
|
|||
#include "template_fieldnames.h"
|
|||
//#include "class_sch_component.h"
|
|||
#include "dsnlexer.h"
|
|||
#include "macros.h"
|
|||
|
|||
using namespace DSN; // enum TFIELD_T is in this namespace
|
|||
|
|||
|
|||
wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx ) |
|||
{ |
|||
// Fixed values for the first few default fields used by EESCHEMA
|
|||
static const wxString fixedNames[] = { |
|||
_( "Reference" ), // The component reference, R1, C1, etc.
|
|||
_( "Value" ), // The component value + name
|
|||
_( "Footprint" ), // The footprint for use with PCBNEW
|
|||
_( "Datasheet" ), // Link to a datasheet for component
|
|||
}; |
|||
|
|||
if ( (unsigned) aFieldNdx < DIM(fixedNames) ) |
|||
return fixedNames[aFieldNdx]; |
|||
|
|||
else |
|||
{ |
|||
wxString fieldName = _("Field"); |
|||
|
|||
fieldName << aFieldNdx; |
|||
|
|||
return fieldName; |
|||
} |
|||
} |
|||
|
|||
void TEMPLATE_FIELDNAME::Format( OUTPUTFORMATTER* out, int nestLevel ) const throw( IOError ) |
|||
{ |
|||
// user may want spaces in his field name, ug, so quote them for the parser.
|
|||
out->Print( nestLevel, "(field (name \"%s\")", CONV_TO_UTF8(m_Name) ); |
|||
|
|||
if( !m_Value.IsEmpty() ) |
|||
out->Print( 0, "(value \"%s\")", CONV_TO_UTF8(m_Value) ); |
|||
|
|||
if( m_Visible ) |
|||
out->Print( 0, " visible" ); |
|||
|
|||
out->Print( 0, ")\n" ); |
|||
} |
|||
|
|||
|
|||
void TEMPLATE_FIELDNAME::Parse( DSNLEXER* in ) throw( IOError ) |
|||
{ |
|||
TFIELD_T tok; |
|||
|
|||
if( (tok = (TFIELD_T) in->NextTok()) != T_LEFT ) |
|||
in->Expecting( T_LEFT ); |
|||
|
|||
if( (tok = (TFIELD_T) in->NextTok()) != T_name ) |
|||
in->Expecting( T_name ); |
|||
|
|||
if( (tok = (TFIELD_T) in->NextTok()) != T_SYMBOL && tok!=T_STRING ) |
|||
in->Expecting( _("field's name") ); |
|||
|
|||
m_Name = CONV_FROM_UTF8( in->CurText() ); |
|||
|
|||
if( (tok = (TFIELD_T) in->NextTok()) != T_RIGHT ) |
|||
in->Expecting( T_RIGHT ); |
|||
|
|||
while( (tok = (TFIELD_T) in->NextTok() ) != T_RIGHT && tok != T_EOF ) |
|||
{ |
|||
if( tok == T_LEFT ) |
|||
tok = (TFIELD_T) in->NextTok(); |
|||
|
|||
switch( tok ) |
|||
{ |
|||
case T_value: |
|||
if( (tok = (TFIELD_T) in->NextTok()) != T_SYMBOL && tok!=T_STRING ) |
|||
in->Expecting( _("field's value") ); |
|||
|
|||
m_Value = CONV_FROM_UTF8( in->CurText() ); |
|||
|
|||
if( (tok = (TFIELD_T) in->NextTok()) != T_RIGHT ) |
|||
in->Expecting( T_RIGHT ); |
|||
break; |
|||
|
|||
case T_visible: |
|||
m_Visible = true; |
|||
break; |
|||
|
|||
default: |
|||
in->Unexpected( CONV_FROM_UTF8( in->CurText() ) ); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
void TEMPLATES::Format( OUTPUTFORMATTER* out, int nestLevel ) const throw( IOError ) |
|||
{ |
|||
// We'll keep this general even though the only know use at this time
|
|||
// will not want the newlines or the indentation.
|
|||
out->Print( nestLevel, "(templatefields" ); |
|||
for( unsigned i=0; i<m_Fields.size(); ++i ) |
|||
m_Fields[i].Format( out, nestLevel+1 ); |
|||
out->Print( 0, ")\n" ); |
|||
} |
|||
|
|||
void TEMPLATES::Parse( DSNLEXER* in ) throw( IOError ) |
|||
{ |
|||
TFIELD_T tok; |
|||
|
|||
while( (tok = (TFIELD_T) in->NextTok() ) != T_RIGHT && tok != T_EOF ) |
|||
{ |
|||
if( tok == T_LEFT ) |
|||
tok = (TFIELD_T) in->NextTok(); |
|||
|
|||
switch( tok ) |
|||
{ |
|||
case T_templatefields: // a token indicating class TEMPLATES.
|
|||
|
|||
// Be flexible regarding the starting point of the DSNLEXER
|
|||
// stream. Caller may not have read the first two tokens out of the
|
|||
// stream: T_LEFT and T_templatefields, so ignore them if seen here.
|
|||
break; |
|||
|
|||
case T_field: |
|||
{ |
|||
// instantiate on stack, so if exception is thrown,
|
|||
// destructor runs
|
|||
TEMPLATE_FIELDNAME field; |
|||
|
|||
field.Parse( in ); |
|||
|
|||
// add the field
|
|||
AddTemplateFieldName( field ); |
|||
} |
|||
break; |
|||
|
|||
default: |
|||
in->Unexpected( CONV_FROM_UTF8( in->CurText() ) ); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
D(printf("tok:%d\n", tok);) |
|||
} |
|||
|
|||
|
|||
int TEMPLATES::AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName ) |
|||
{ |
|||
// Ensure that the template fieldname does not match a fixed fieldname.
|
|||
for( int i=0; i<MANDATORY_FIELDS; ++i ) |
|||
{ |
|||
if( TEMPLATE_FIELDNAME::GetDefaultFieldName(i) == aFieldName.m_Name ) |
|||
{ |
|||
return -1; |
|||
} |
|||
} |
|||
|
|||
// ensure uniqueness, overwrite any template fieldname by the same name.
|
|||
for( unsigned i=0; i<m_Fields.size(); ++i ) |
|||
{ |
|||
if( m_Fields[i].m_Name == aFieldName.m_Name ) |
|||
{ |
|||
D(printf("inserting template fieldname:'%s' at %d\n", |
|||
CONV_TO_UTF8(aFieldName.m_Name), i );) |
|||
|
|||
m_Fields[i] = aFieldName; |
|||
return i; // return the container index
|
|||
} |
|||
} |
|||
|
|||
// D(printf("appending template fieldname:'%s'\n", CONV_TO_UTF8(aFieldName.m_Name) );)
|
|||
|
|||
// the name is legal and not previously added to the config container, append
|
|||
// it and return its index within the container.
|
|||
m_Fields.push_back( aFieldName ); |
|||
|
|||
return m_Fields.size() - 1; // return the index of insertion.
|
|||
} |
|||
|
@ -0,0 +1,149 @@ |
|||
|
|||
#ifndef _TEMPLATE_FIELDNAME_H_ |
|||
#define _TEMPLATE_FIELDNAME_H_ |
|||
|
|||
#include "richio.h" |
|||
#include "wxstruct.h" |
|||
#include "macros.h" |
|||
#include "template_fieldnames_keywords.h" |
|||
|
|||
class DSNLEXER; |
|||
|
|||
|
|||
/** |
|||
* Enum NumFieldType |
|||
* is the set of all field indices assuming an array like sequence that a |
|||
* SCH_COMPONENT or LIB_COMPONENT can hold. |
|||
* The first fields are called fixed fields and the quantity of them is |
|||
* given by MANDATORY_FIELDS. After that come an unlimited number of |
|||
* user defined fields, only some of which have indices defined here. |
|||
*/ |
|||
enum NumFieldType { |
|||
REFERENCE = 0, ///< Field Reference of part, i.e. "IC21" |
|||
VALUE, ///< Field Value of part, i.e. "3.3K" |
|||
FOOTPRINT, ///< Field Name Module PCB, i.e. "16DIP300" |
|||
DATASHEET, ///< name of datasheet |
|||
|
|||
MANDATORY_FIELDS, ///< the first 4 are mandatory or fixed, and instantiated in FIELD constructors |
|||
|
|||
FIELD1 = MANDATORY_FIELDS, |
|||
FIELD2, |
|||
FIELD3, |
|||
FIELD4, |
|||
FIELD5, |
|||
FIELD6, |
|||
FIELD7, |
|||
FIELD8, |
|||
}; |
|||
|
|||
|
|||
/** |
|||
* Struct TEMPLATE_FIELDNAME |
|||
* holds a name of a component's field, field value, and default visibility. |
|||
* Template fieldnames are wanted fieldnames for use in the symbol/component |
|||
* property editors. |
|||
*/ |
|||
struct TEMPLATE_FIELDNAME |
|||
{ |
|||
wxString m_Name; ///< The field name |
|||
wxString m_Value; ///< The default value or empty |
|||
bool m_Visible; ///< If first appearance of the field's editor has as visible. |
|||
|
|||
TEMPLATE_FIELDNAME() : |
|||
m_Visible( false ) |
|||
{ |
|||
} |
|||
|
|||
TEMPLATE_FIELDNAME( const wxString& aName ) : |
|||
m_Name( aName ), |
|||
m_Visible( false ) |
|||
{ |
|||
} |
|||
|
|||
/** |
|||
* Function Format |
|||
* serializes this object out as text into the given OUTPUTFORMATTER. |
|||
*/ |
|||
void Format( OUTPUTFORMATTER* out, int nestLevel ) const throw( IOError ); |
|||
|
|||
/** |
|||
* Function Parse |
|||
* fills this object from information in the input stream \a aSpec, which |
|||
* is a DSNLEXER. The entire textual element spec is <br> |
|||
* (field (name _yourfieldname_)(value _yourvalue_) visible)) <br> |
|||
* The presence of value is optional, the presence of visible is optional. |
|||
* When this function is called, the input token stream given by \a aSpec |
|||
* is assumed to be positioned at the '^' in the following example, i.e. just after the |
|||
* identifying keyword and before the content specifying stuff.<br> |
|||
* (field ^ (....) ) |
|||
* |
|||
* @param aSpec is the input token stream of keywords and symbols. |
|||
*/ |
|||
void Parse( DSNLEXER* aSpec ) throw( IOError ); |
|||
|
|||
/** |
|||
* Function GetDefaultFieldName |
|||
* returns a default symbol field name for field \a aFieldNdx for all components. |
|||
* These fieldnames are not modifiable, but template fieldnames are. |
|||
* @param aFieldNdx The field number index, > 0 |
|||
*/ |
|||
static wxString GetDefaultFieldName( int aFieldNdx ); |
|||
}; |
|||
|
|||
typedef std::vector< TEMPLATE_FIELDNAME > TEMPLATE_FIELDNAMES; |
|||
|
|||
|
|||
class TEMPLATES |
|||
{ |
|||
private: |
|||
TEMPLATE_FIELDNAMES m_Fields; |
|||
|
|||
public: |
|||
|
|||
/** |
|||
* Function Format |
|||
* serializes this object out as text into the given OUTPUTFORMATTER. |
|||
*/ |
|||
void Format( OUTPUTFORMATTER* out, int nestLevel ) const throw( IOError ); |
|||
|
|||
/** |
|||
* Function Parse |
|||
* fills this object from information in the input stream handled by DSNLEXER |
|||
*/ |
|||
void Parse( DSNLEXER* in ) throw( IOError ); |
|||
|
|||
|
|||
/** |
|||
* Function AddTemplateFieldName |
|||
* inserts or appends a wanted symbol field name into the fieldnames |
|||
* template. Should be used for any symbol property editor. If the name |
|||
* already exists, it overwrites the same name. |
|||
* |
|||
* @param aFieldName is a full description of the wanted field, and it must not match |
|||
* any of the default fieldnames. |
|||
* @return int - the index within the config container at which aFieldName was |
|||
* added, or -1 if the name is illegal because it matches a default fieldname. |
|||
*/ |
|||
int AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName ); |
|||
|
|||
/** |
|||
* Function DeleteAllTemplateFieldNames |
|||
* deletes the entire contents. |
|||
*/ |
|||
void DeleteAllTemplateFieldNames() |
|||
{ |
|||
m_Fields.clear(); |
|||
} |
|||
|
|||
/** |
|||
* Function GetTemplateFieldName |
|||
* returns a template fieldnames list for read only access. |
|||
*/ |
|||
const TEMPLATE_FIELDNAMES& GetTemplateFieldNames() |
|||
{ |
|||
return m_Fields; |
|||
} |
|||
}; |
|||
|
|||
#endif // _TEMPLATE_FIELDNAME_H_ |
|||
|
@ -0,0 +1,5 @@ |
|||
field |
|||
name |
|||
templatefields |
|||
value |
|||
visible |
Write
Preview
Loading…
Cancel
Save
Reference in new issue