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
ecab9f8b
Commit
ecab9f8b
authored
Apr 02, 2010
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eeschema library config dialog enhancements: multi selection of lib names and up/down command
parent
50f5eb37
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
221 additions
and
25 deletions
+221
-25
dialog_eeschema_config.cpp
eeschema/dialog_eeschema_config.cpp
+82
-9
dialog_eeschema_config_fbp.cpp
eeschema/dialog_eeschema_config_fbp.cpp
+21
-7
dialog_eeschema_config_fbp.fbp
eeschema/dialog_eeschema_config_fbp.fbp
+113
-9
dialog_eeschema_config_fbp.h
eeschema/dialog_eeschema_config_fbp.h
+5
-0
No files found.
eeschema/dialog_eeschema_config.cpp
View file @
ecab9f8b
...
...
@@ -43,6 +43,8 @@ private:
void
OnOkClick
(
wxCommandEvent
&
event
);
void
OnCancelClick
(
wxCommandEvent
&
event
);
void
OnRemoveUserPath
(
wxCommandEvent
&
event
);
void
OnButtonUpClick
(
wxCommandEvent
&
event
);
void
OnButtonDownClick
(
wxCommandEvent
&
event
);
public
:
...
...
@@ -127,6 +129,72 @@ void DIALOG_EESCHEMA_CONFIG::Init()
}
/********************************************************************/
void
DIALOG_EESCHEMA_CONFIG
::
OnButtonUpClick
(
wxCommandEvent
&
event
)
/********************************************************************/
{
wxArrayInt
selections
;
m_ListLibr
->
GetSelections
(
selections
);
if
(
selections
.
GetCount
()
<=
0
)
// No selection.
return
;
if
(
selections
[
0
]
==
0
)
// The first lib is selected. cannot move up it
return
;
wxArrayString
libnames
=
m_ListLibr
->
GetStrings
();
for
(
size_t
ii
=
0
;
ii
<
selections
.
GetCount
();
ii
++
)
{
int
jj
=
selections
[
ii
];
EXCHG
(
libnames
[
jj
],
libnames
[
jj
-
1
]);
}
m_ListLibr
->
Set
(
libnames
);
// Reselect previously selected names
for
(
size_t
ii
=
0
;
ii
<
selections
.
GetCount
();
ii
++
)
{
int
jj
=
selections
[
ii
];
m_ListLibr
->
SetSelection
(
jj
-
1
);
}
m_LibListChanged
=
TRUE
;
}
/*********************************************************************/
void
DIALOG_EESCHEMA_CONFIG
::
OnButtonDownClick
(
wxCommandEvent
&
event
)
/*********************************************************************/
{
wxArrayInt
selections
;
m_ListLibr
->
GetSelections
(
selections
);
if
(
selections
.
GetCount
()
<=
0
)
// No selection.
return
;
// The last lib is selected. cannot move down it
if
(
selections
.
Last
()
==
(
int
)(
m_ListLibr
->
GetCount
()
-
1
)
)
return
;
wxArrayString
libnames
=
m_ListLibr
->
GetStrings
();
for
(
int
ii
=
selections
.
GetCount
()
-
1
;
ii
>=
0
;
ii
--
)
{
int
jj
=
selections
[
ii
];
EXCHG
(
libnames
[
jj
],
libnames
[
jj
+
1
]);
}
m_ListLibr
->
Set
(
libnames
);
// Reselect previously selected names
for
(
size_t
ii
=
0
;
ii
<
selections
.
GetCount
();
ii
++
)
{
int
jj
=
selections
[
ii
];
m_ListLibr
->
SetSelection
(
jj
+
1
);
}
m_LibListChanged
=
TRUE
;
}
/******************************************************************/
void
DIALOG_EESCHEMA_CONFIG
::
OnCancelClick
(
wxCommandEvent
&
event
)
/******************************************************************/
...
...
@@ -196,14 +264,14 @@ void DIALOG_EESCHEMA_CONFIG::OnRemoveLibClick( wxCommandEvent& event )
* The real list (m_Parent->m_ComponentLibFiles) is not changed, so the change can be cancelled
*/
{
int
ii
;
wxArrayInt
selections
;
ii
=
m_ListLibr
->
GetSelection
(
);
if
(
ii
<
0
)
return
;
m_ListLibr
->
Delete
(
ii
)
;
m_LibListChanged
=
TRUE
;
m_ListLibr
->
GetSelections
(
selections
);
for
(
int
ii
=
selections
.
GetCount
()
-
1
;
ii
>=
0
;
ii
--
)
{
m_ListLibr
->
Delete
(
selections
[
ii
]
);
m_LibListChanged
=
TRUE
;
}
}
...
...
@@ -222,9 +290,14 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
wxString
libfilename
;
wxFileName
fn
;
ii
=
m_ListLibr
->
GetSelection
();
if
(
ii
==
wxNOT_FOUND
&&
event
.
GetId
()
!=
ID_ADD_LIB
)
wxArrayInt
selections
;
m_ListLibr
->
GetSelections
(
selections
);
ii
=
selections
.
GetCount
();
if
(
ii
<=
0
&&
event
.
GetId
()
!=
ID_ADD_LIB
)
ii
=
0
;
else
ii
=
selections
[
0
];
wxString
libpath
;
libpath
=
m_DefaultLibraryPathslistBox
->
GetStringSelection
();
...
...
eeschema/dialog_eeschema_config_fbp.cpp
View file @
ecab9f8b
...
...
@@ -19,7 +19,7 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
wxStaticBoxSizer
*
sbLibsChoiceSizer
;
sbLibsChoiceSizer
=
new
wxStaticBoxSizer
(
new
wxStaticBox
(
this
,
wxID_ANY
,
_
(
"Component library files"
)
),
wxHORIZONTAL
);
m_ListLibr
=
new
wxListBox
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
0
,
NULL
,
wxLB_HSCROLL
|
wxLB_NEEDED_SB
|
wxLB_SINGLE
);
m_ListLibr
=
new
wxListBox
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
0
,
NULL
,
wxLB_
EXTENDED
|
wxLB_
HSCROLL
|
wxLB_NEEDED_SB
|
wxLB_SINGLE
);
m_ListLibr
->
SetToolTip
(
_
(
"List of active library files.
\n
Only library files in this list are loaded by Eeschema.
\n
The order of this list is important:
\n
Eeschema searchs for a given component using this list order priority."
)
);
m_ListLibr
->
SetMinSize
(
wxSize
(
400
,
250
)
);
...
...
@@ -31,17 +31,23 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
m_buttonAddLib
=
new
wxButton
(
this
,
ID_ADD_LIB
,
_
(
"Add"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_buttonAddLib
->
SetToolTip
(
_
(
"Add a new library after the selected library, and load it"
)
);
bRightSizer
->
Add
(
m_buttonAddLib
,
0
,
wxALIGN_CENTER_HORIZONTAL
|
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
bRightSizer
->
Add
(
m_buttonAddLib
,
0
,
wxALIGN_CENTER_HORIZONTAL
|
wxLEFT
|
wxRIGHT
|
wxTOP
|
wxEXPAND
,
5
);
m_buttonIns
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"Insert"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_buttonIns
->
SetToolTip
(
_
(
"Add a new library before the selected library, and load it"
)
);
bRightSizer
->
Add
(
m_buttonIns
,
0
,
wxALIGN_CENTER_HORIZONTAL
|
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
bRightSizer
->
Add
(
m_buttonIns
,
0
,
wxALIGN_CENTER_HORIZONTAL
|
wxLEFT
|
wxRIGHT
|
wxTOP
|
wxEXPAND
,
5
);
m_buttonRemoveLib
=
new
wxButton
(
this
,
ID_REMOVE_LIB
,
_
(
"Remove"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_buttonRemoveLib
->
SetToolTip
(
_
(
"Unload the selected library"
)
);
bRightSizer
->
Add
(
m_buttonRemoveLib
,
0
,
wxALL
|
wxALIGN_CENTER_HORIZONTAL
,
5
);
bRightSizer
->
Add
(
m_buttonRemoveLib
,
0
,
wxALL
|
wxALIGN_CENTER_HORIZONTAL
|
wxEXPAND
,
5
);
m_buttonUp
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"Up"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bRightSizer
->
Add
(
m_buttonUp
,
0
,
wxEXPAND
|
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
m_buttonDown
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"Down"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bRightSizer
->
Add
(
m_buttonDown
,
0
,
wxALL
|
wxEXPAND
,
5
);
sbLibsChoiceSizer
->
Add
(
bRightSizer
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
...
...
@@ -60,13 +66,13 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
bUserPathsButtonsSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
m_buttonAddPath
=
new
wxButton
(
this
,
ID_LIB_PATH_SEL
,
_
(
"Add"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bUserPathsButtonsSizer
->
Add
(
m_buttonAddPath
,
0
,
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
bUserPathsButtonsSizer
->
Add
(
m_buttonAddPath
,
0
,
wxLEFT
|
wxRIGHT
|
wxTOP
|
wxEXPAND
,
5
);
m_buttonInsPath
=
new
wxButton
(
this
,
wxID_INSERT_PATH
,
_
(
"Insert"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bUserPathsButtonsSizer
->
Add
(
m_buttonInsPath
,
0
,
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
bUserPathsButtonsSizer
->
Add
(
m_buttonInsPath
,
0
,
wxLEFT
|
wxRIGHT
|
wxTOP
|
wxEXPAND
,
5
);
m_buttonRemovePath
=
new
wxButton
(
this
,
wxID_REMOVE_PATH
,
_
(
"Remove"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bUserPathsButtonsSizer
->
Add
(
m_buttonRemovePath
,
0
,
wxALL
,
5
);
bUserPathsButtonsSizer
->
Add
(
m_buttonRemovePath
,
0
,
wxALL
|
wxEXPAND
,
5
);
sbSizer4
->
Add
(
bUserPathsButtonsSizer
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
...
...
@@ -102,9 +108,13 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
// Connect Events
this
->
Connect
(
wxEVT_CLOSE_WINDOW
,
wxCloseEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnCloseWindow
)
);
m_ListLibr
->
Connect
(
wxEVT_COMMAND_LISTBOX_SELECTED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnFilesListClick
),
NULL
,
this
);
m_ListLibr
->
Connect
(
wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnFilesListClick
),
NULL
,
this
);
m_buttonAddLib
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertLibClick
),
NULL
,
this
);
m_buttonIns
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertLibClick
),
NULL
,
this
);
m_buttonRemoveLib
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnRemoveLibClick
),
NULL
,
this
);
m_buttonUp
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnButtonUpClick
),
NULL
,
this
);
m_buttonDown
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnButtonDownClick
),
NULL
,
this
);
m_buttonAddPath
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertPath
),
NULL
,
this
);
m_buttonInsPath
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertPath
),
NULL
,
this
);
m_buttonRemovePath
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnRemoveUserPath
),
NULL
,
this
);
...
...
@@ -116,9 +126,13 @@ DIALOG_EESCHEMA_CONFIG_FBP::~DIALOG_EESCHEMA_CONFIG_FBP()
{
// Disconnect Events
this
->
Disconnect
(
wxEVT_CLOSE_WINDOW
,
wxCloseEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnCloseWindow
)
);
m_ListLibr
->
Disconnect
(
wxEVT_COMMAND_LISTBOX_SELECTED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnFilesListClick
),
NULL
,
this
);
m_ListLibr
->
Disconnect
(
wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnFilesListClick
),
NULL
,
this
);
m_buttonAddLib
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertLibClick
),
NULL
,
this
);
m_buttonIns
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertLibClick
),
NULL
,
this
);
m_buttonRemoveLib
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnRemoveLibClick
),
NULL
,
this
);
m_buttonUp
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnButtonUpClick
),
NULL
,
this
);
m_buttonDown
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnButtonDownClick
),
NULL
,
this
);
m_buttonAddPath
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertPath
),
NULL
,
this
);
m_buttonInsPath
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertPath
),
NULL
,
this
);
m_buttonRemovePath
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnRemoveUserPath
),
NULL
,
this
);
...
...
eeschema/dialog_eeschema_config_fbp.fbp
View file @
ecab9f8b
This diff is collapsed.
Click to expand it.
eeschema/dialog_eeschema_config_fbp.h
View file @
ecab9f8b
...
...
@@ -45,6 +45,8 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog
wxButton
*
m_buttonAddLib
;
wxButton
*
m_buttonIns
;
wxButton
*
m_buttonRemoveLib
;
wxButton
*
m_buttonUp
;
wxButton
*
m_buttonDown
;
wxListBox
*
m_listUserPaths
;
wxButton
*
m_buttonAddPath
;
wxButton
*
m_buttonInsPath
;
...
...
@@ -54,8 +56,11 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog
// Virtual event handlers, overide them in your derived class
virtual
void
OnCloseWindow
(
wxCloseEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnFilesListClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnAddOrInsertLibClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnRemoveLibClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnButtonUpClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnButtonDownClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnAddOrInsertPath
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnRemoveUserPath
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnCancelClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
...
...
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