Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
24aa7aa5
Commit
24aa7aa5
authored
Sep 16, 2014
by
Brian Sidebotham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Temporary changes
parent
56f44e2f
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
673 additions
and
102 deletions
+673
-102
dialog_eeschema_options.cpp
eeschema/dialogs/dialog_eeschema_options.cpp
+78
-15
dialog_eeschema_options.h
eeschema/dialogs/dialog_eeschema_options.h
+5
-3
dialog_eeschema_options_base.cpp
eeschema/dialogs/dialog_eeschema_options_base.cpp
+105
-79
dialog_eeschema_options_base.fbp
eeschema/dialogs/dialog_eeschema_options_base.fbp
+453
-3
dialog_eeschema_options_base.h
eeschema/dialogs/dialog_eeschema_options_base.h
+14
-1
eeschema_config.cpp
eeschema/eeschema_config.cpp
+11
-1
template_fieldnames.h
eeschema/template_fieldnames.h
+7
-0
No files found.
eeschema/dialogs/dialog_eeschema_options.cpp
View file @
24aa7aa5
...
...
@@ -40,18 +40,18 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ) :
wxListItem
col0
;
col0
.
SetId
(
0
);
col0
.
SetText
(
_
(
"
ID
"
)
);
col0
.
SetWidth
(
50
);
col0
.
SetText
(
_
(
"
Field Name
"
)
);
col0
.
SetWidth
(
1
50
);
wxListItem
col1
;
col1
.
SetId
(
1
);
col1
.
SetText
(
_
(
"
Nam
e"
)
);
col1
.
SetWidth
(
1
50
);
col1
.
SetText
(
_
(
"
Default Valu
e"
)
);
col1
.
SetWidth
(
2
50
);
wxListItem
col2
;
col2
.
SetId
(
2
);
col2
.
SetText
(
_
(
"
Default Valu
e"
)
);
col2
.
SetWidth
(
25
0
);
col2
.
SetText
(
_
(
"
Visibl
e"
)
);
col2
.
SetWidth
(
10
0
);
templateFieldListCtrl
->
InsertColumn
(
0
,
col0
);
templateFieldListCtrl
->
InsertColumn
(
1
,
col1
);
...
...
@@ -142,29 +142,92 @@ void DIALOG_EESCHEMA_OPTIONS::SetGridSizes( const GRIDS& grid_sizes, int grid_id
void
DIALOG_EESCHEMA_OPTIONS
::
OnAddButtonClick
(
wxCommandEvent
&
event
)
{
long
itemindex
=
templateFieldListCtrl
->
InsertItem
(
0
,
wxT
(
"ID
"
)
);
templateFieldListCtrl
->
SetItem
(
itemindex
,
1
,
wxT
(
"
Next Fieldnam
e"
)
);
templateFieldListCtrl
->
SetItem
(
itemindex
,
2
,
wxT
(
"
A Default value
"
)
);
long
itemindex
=
templateFieldListCtrl
->
InsertItem
(
templateFieldListCtrl
->
GetItemCount
(),
wxT
(
"New Fieldname
"
)
);
templateFieldListCtrl
->
SetItem
(
itemindex
,
1
,
wxT
(
"
Default Valu
e"
)
);
templateFieldListCtrl
->
SetItem
(
itemindex
,
2
,
wxT
(
"
Hidden
"
)
);
event
.
Skip
();
}
void
DIALOG_EESCHEMA_OPTIONS
::
copyPanelToSelected
(
void
)
{
wxListItem
iteminfo
;
iteminfo
.
m_itemId
=
selectedField
;
iteminfo
.
m_mask
=
wxLIST_MASK_TEXT
;
iteminfo
.
m_col
=
0
;
iteminfo
.
m_text
=
fieldNameTextCtrl
->
GetValue
();
templateFieldListCtrl
->
SetItem
(
iteminfo
);
iteminfo
.
m_col
=
1
;
iteminfo
.
m_text
=
fieldDefaultValueTextCtrl
->
GetValue
();
templateFieldListCtrl
->
SetItem
(
iteminfo
);
/* TODO: Fixme! */
iteminfo
.
m_col
=
2
;
iteminfo
.
m_text
=
fieldNameTextCtrl
->
GetValue
();
templateFieldListCtrl
->
SetItem
(
iteminfo
);
}
void
DIALOG_EESCHEMA_OPTIONS
::
copySelectedToPanel
(
void
)
{
wxListItem
iteminfo
;
iteminfo
.
m_itemId
=
selectedField
;
iteminfo
.
m_mask
=
wxLIST_MASK_TEXT
;
iteminfo
.
m_col
=
0
;
if
(
!
templateFieldListCtrl
->
GetItem
(
iteminfo
)
)
return
;
fieldNameTextCtrl
->
SetValue
(
iteminfo
.
m_text
);
iteminfo
.
m_col
=
1
;
if
(
!
templateFieldListCtrl
->
GetItem
(
iteminfo
)
)
return
;
fieldDefaultValueTextCtrl
->
SetValue
(
iteminfo
.
m_text
);
iteminfo
.
m_col
=
2
;
if
(
!
templateFieldListCtrl
->
GetItem
(
iteminfo
)
)
return
;
if
(
iteminfo
.
m_text
==
wxT
(
"Hidden"
)
)
fieldVisibleCheckbox
->
SetValue
(
false
);
else
fieldVisibleCheckbox
->
SetValue
(
true
);
}
void
DIALOG_EESCHEMA_OPTIONS
::
OnTemplateFieldSelected
(
wxListEvent
&
event
)
{
selectedField
=
event
.
GetIndex
();
printf
(
"selectedField = %d
\n
"
,
selectedField
);
copySelectedToPanel
();
event
.
Skip
();
}
void
DIALOG_EESCHEMA_OPTIONS
::
OnTemplateFieldDeselected
(
wxListEvent
&
event
)
{
event
.
Skip
();
}
void
DIALOG_EESCHEMA_OPTIONS
::
SetTemplateFields
(
const
TEMPLATE_FIELDNAMES
&
aFields
)
{
printf
(
"SetTemplateFields %d
\n
"
,
aFields
.
size
()
)
;
templateFields
=
aFields
;
for
(
size_t
i
=
0
;
i
<
aFields
.
size
();
i
++
)
for
(
TEMPLATE_FIELDNAMES
::
iterator
fld
=
templateFields
.
begin
();
fld
!=
templateFields
.
end
();
++
fld
)
{
long
itemindex
=
templateFieldListCtrl
->
InsertItem
(
0
,
wxT
(
"?"
)
);
templateFieldListCtrl
->
SetItem
(
itemindex
,
1
,
aFields
[
i
].
m_Name
);
templateFieldListCtrl
->
SetItem
(
itemindex
,
2
,
aFields
[
i
].
m_Value
);
templateFieldListCtrl
->
SetItem
(
itemindex
,
1
,
fld
->
m_Name
);
templateFieldListCtrl
->
SetItem
(
itemindex
,
2
,
fld
->
m_Value
);
printf
(
"Parsed new templateField
\n
"
);
}
}
TEMPLATE_FIELDNAMES
*
DIALOG_EESCHEMA_OPTIONS
::
GetTemplateFields
(
void
)
TEMPLATE_FIELDNAMES
DIALOG_EESCHEMA_OPTIONS
::
GetTemplateFields
(
void
)
{
return
&
templateFields
;
return
templateFields
;
}
eeschema/dialogs/dialog_eeschema_options.h
View file @
24aa7aa5
...
...
@@ -38,9 +38,11 @@ class DIALOG_EESCHEMA_OPTIONS : public DIALOG_EESCHEMA_OPTIONS_BASE
{
protected
:
TEMPLATE_FIELDNAMES
templateFields
;
int
selectedField
;
void
OnAddButtonClick
(
wxCommandEvent
&
event
);
void
copySelectedToPanel
(
void
);
void
OnTemplateFieldSelected
(
wxListEvent
&
event
);
void
OnTemplateFieldDeselected
(
wxListEvent
&
event
);
public
:
DIALOG_EESCHEMA_OPTIONS
(
wxWindow
*
parent
);
...
...
@@ -131,7 +133,7 @@ public:
bool
GetShowPageLimits
(
void
)
{
return
m_checkPageLimits
->
GetValue
();
}
void
SetTemplateFields
(
const
TEMPLATE_FIELDNAMES
&
aFields
);
TEMPLATE_FIELDNAMES
*
GetTemplateFields
(
void
);
TEMPLATE_FIELDNAMES
GetTemplateFields
(
void
);
private
:
void
OnMiddleBtnPanEnbl
(
wxCommandEvent
&
event
)
...
...
eeschema/dialogs/dialog_eeschema_options_base.cpp
View file @
24aa7aa5
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Apr 10
2012)
// C++ code generated with wxFormBuilder (version
Oct 8
2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
...
...
@@ -12,6 +12,8 @@
BEGIN_EVENT_TABLE
(
DIALOG_EESCHEMA_OPTIONS_BASE
,
DIALOG_SHIM
)
EVT_CHOICE
(
wxID_ANY
,
DIALOG_EESCHEMA_OPTIONS_BASE
::
_wxFB_OnChooseUnits
)
EVT_CHECKBOX
(
xwID_ANY
,
DIALOG_EESCHEMA_OPTIONS_BASE
::
_wxFB_OnMiddleBtnPanEnbl
)
EVT_LIST_ITEM_DESELECTED
(
wxID_ANY
,
DIALOG_EESCHEMA_OPTIONS_BASE
::
_wxFB_OnTemplateFieldDeselected
)
EVT_LIST_ITEM_SELECTED
(
wxID_ANY
,
DIALOG_EESCHEMA_OPTIONS_BASE
::
_wxFB_OnTemplateFieldSelected
)
EVT_BUTTON
(
wxID_ADD_FIELD
,
DIALOG_EESCHEMA_OPTIONS_BASE
::
_wxFB_OnAddButtonClick
)
EVT_BUTTON
(
wxID_DELETE_FIELD
,
DIALOG_EESCHEMA_OPTIONS_BASE
::
_wxFB_OnDeleteButtonClick
)
END_EVENT_TABLE
()
...
...
@@ -225,17 +227,41 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
wxBoxSizer
*
bSizer6
;
bSizer6
=
new
wxBoxSizer
(
wxVERTICAL
);
templateFieldListCtrl
=
new
wxListCtrl
(
m_panel2
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxLC_HRULES
|
wxLC_REPORT
|
wxLC_VRULES
);
templateFieldListCtrl
=
new
wxListCtrl
(
m_panel2
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxLC_HRULES
|
wxLC_REPORT
|
wxLC_
SINGLE_SEL
|
wxLC_
VRULES
);
templateFieldListCtrl
->
SetMinSize
(
wxSize
(
220
,
-
1
)
);
bSizer6
->
Add
(
templateFieldListCtrl
,
1
,
wxALIGN_TOP
|
wxBOTTOM
|
wxEXPAND
|
wxLEFT
|
wxRIGHT
|
wxTOP
,
8
);
wxStaticBoxSizer
*
fieldSizer
;
fieldSizer
=
new
wxStaticBoxSizer
(
new
wxStaticBox
(
m_panel2
,
wxID_ANY
,
_
(
"Field"
)
),
wxVERTICAL
);
fieldNameLabel
=
new
wxStaticText
(
m_panel2
,
wxID_ANY
,
_
(
"Name"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
fieldNameLabel
->
Wrap
(
-
1
);
fieldSizer
->
Add
(
fieldNameLabel
,
0
,
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
fieldNameTextCtrl
=
new
wxTextCtrl
(
m_panel2
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
fieldSizer
->
Add
(
fieldNameTextCtrl
,
0
,
wxBOTTOM
|
wxEXPAND
|
wxLEFT
|
wxRIGHT
,
5
);
fieldDefaultValueLabel
=
new
wxStaticText
(
m_panel2
,
wxID_ANY
,
_
(
"Default Value"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
fieldDefaultValueLabel
->
Wrap
(
-
1
);
fieldSizer
->
Add
(
fieldDefaultValueLabel
,
0
,
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
fieldDefaultValueTextCtrl
=
new
wxTextCtrl
(
m_panel2
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
fieldSizer
->
Add
(
fieldDefaultValueTextCtrl
,
0
,
wxBOTTOM
|
wxEXPAND
|
wxLEFT
|
wxRIGHT
,
5
);
fieldVisibleCheckbox
=
new
wxCheckBox
(
m_panel2
,
wxID_ANY
,
_
(
"Visible"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
fieldSizer
->
Add
(
fieldVisibleCheckbox
,
0
,
wxALL
,
5
);
bSizer6
->
Add
(
fieldSizer
,
1
,
wxEXPAND
,
5
);
addFieldButton
=
new
wxButton
(
m_panel2
,
wxID_ADD_FIELD
,
_
(
"Add"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bSizer6
->
Add
(
addFieldButton
,
0
,
wxALL
|
wxEXPAND
,
5
);
deleteFieldButton
=
new
wxButton
(
m_panel2
,
wxID_DELETE_FIELD
,
_
(
"Delete"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bSizer6
->
Add
(
deleteFieldButton
,
0
,
wxALL
|
wxEXPAND
,
5
);
m_panel2
->
SetSizer
(
bSizer6
);
m_panel2
->
Layout
();
bSizer6
->
Fit
(
m_panel2
);
...
...
eeschema/dialogs/dialog_eeschema_options_base.fbp
View file @
24aa7aa5
This diff is collapsed.
Click to expand it.
eeschema/dialogs/dialog_eeschema_options_base.h
View file @
24aa7aa5
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Apr 10
2012)
// C++ code generated with wxFormBuilder (version
Oct 8
2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
...
...
@@ -11,6 +11,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class
DIALOG_SHIM
;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
...
...
@@ -28,6 +30,8 @@
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/listctrl.h>
#include <wx/textctrl.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/notebook.h>
#include <wx/dialog.h>
...
...
@@ -45,6 +49,8 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
// Private event handlers
void
_wxFB_OnChooseUnits
(
wxCommandEvent
&
event
){
OnChooseUnits
(
event
);
}
void
_wxFB_OnMiddleBtnPanEnbl
(
wxCommandEvent
&
event
){
OnMiddleBtnPanEnbl
(
event
);
}
void
_wxFB_OnTemplateFieldDeselected
(
wxListEvent
&
event
){
OnTemplateFieldDeselected
(
event
);
}
void
_wxFB_OnTemplateFieldSelected
(
wxListEvent
&
event
){
OnTemplateFieldSelected
(
event
);
}
void
_wxFB_OnAddButtonClick
(
wxCommandEvent
&
event
){
OnAddButtonClick
(
event
);
}
void
_wxFB_OnDeleteButtonClick
(
wxCommandEvent
&
event
){
OnDeleteButtonClick
(
event
);
}
...
...
@@ -101,6 +107,11 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
wxCheckBox
*
m_checkPageLimits
;
wxPanel
*
m_panel2
;
wxListCtrl
*
templateFieldListCtrl
;
wxStaticText
*
fieldNameLabel
;
wxTextCtrl
*
fieldNameTextCtrl
;
wxStaticText
*
fieldDefaultValueLabel
;
wxTextCtrl
*
fieldDefaultValueTextCtrl
;
wxCheckBox
*
fieldVisibleCheckbox
;
wxButton
*
addFieldButton
;
wxButton
*
deleteFieldButton
;
wxStdDialogButtonSizer
*
m_sdbSizer1
;
...
...
@@ -110,6 +121,8 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class
virtual
void
OnChooseUnits
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnMiddleBtnPanEnbl
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnTemplateFieldDeselected
(
wxListEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnTemplateFieldSelected
(
wxListEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnAddButtonClick
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnDeleteButtonClick
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
...
...
eeschema/eeschema_config.cpp
View file @
24aa7aa5
...
...
@@ -366,6 +366,16 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
// look like the component field property editor, showing visibility and value also
DeleteAllTemplateFieldNames
();
TEMPLATE_FIELDNAMES
newFieldNames
=
dlg
.
GetTemplateFields
();
for
(
TEMPLATE_FIELDNAMES
::
iterator
dlgfld
=
newFieldNames
.
begin
();
dlgfld
!=
newFieldNames
.
end
();
++
dlgfld
)
{
TEMPLATE_FIELDNAME
fld
=
*
dlgfld
;
/* fld.m_Name = dlgfld->m_Name;
fld.m_Value = dlgfld->m_Value;
fld.m_Visible = dlgfld->m_Visible; */
AddTemplateFieldName
(
fld
);
}
/*
for( int i=0; i<8; ++i ) // no. fields in this dialog window
{
...
...
@@ -786,7 +796,7 @@ void SCH_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
m_TemplateFieldNames
.
Format
(
&
sf
,
0
);
DBG
(
printf
(
"saving formatted template fieldnames:'%s'
\n
"
,
sf
.
GetString
().
c_str
()
);)
printf
(
"saving formatted template fieldnames:'%s'
\n
"
,
sf
.
GetString
().
c_str
()
);
wxString
record
=
FROM_UTF8
(
sf
.
GetString
().
c_str
()
);
record
.
Replace
(
wxT
(
"
\n
"
),
wxT
(
""
),
true
);
// strip all newlines
...
...
eeschema/template_fieldnames.h
View file @
24aa7aa5
...
...
@@ -62,6 +62,13 @@ struct TEMPLATE_FIELDNAME
{
}
TEMPLATE_FIELDNAME
(
const
TEMPLATE_FIELDNAME
&
ref
)
{
m_Name
=
ref
.
m_Name
;
m_Value
=
ref
.
m_Value
;
m_Visible
=
ref
.
m_Visible
;
}
/**
* Function Format
* serializes this object out as text into the given OUTPUTFORMATTER.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment