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
300a047f
Commit
300a047f
authored
Nov 18, 2013
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more EDA_LIST_DIALOG usability enhancements, compiler warning, coding standards
parent
7cf34678
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
48 deletions
+58
-48
dialog_list_selector_base.cpp
common/dialogs/dialog_list_selector_base.cpp
+2
-0
dialog_list_selector_base.fbp
common/dialogs/dialog_list_selector_base.fbp
+1
-1
displlst.cpp
common/displlst.cpp
+22
-18
loadcmp.cpp
pcbnew/loadcmp.cpp
+29
-25
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+4
-4
No files found.
common/dialogs/dialog_list_selector_base.cpp
View file @
300a047f
...
@@ -30,6 +30,8 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con
...
@@ -30,6 +30,8 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con
bSizerMain
->
Add
(
m_staticText2
,
0
,
wxRIGHT
|
wxLEFT
,
5
);
bSizerMain
->
Add
(
m_staticText2
,
0
,
wxRIGHT
|
wxLEFT
,
5
);
m_listBox
=
new
wxListCtrl
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxLC_REPORT
|
wxLC_SINGLE_SEL
|
wxALWAYS_SHOW_SB
|
wxVSCROLL
);
m_listBox
=
new
wxListCtrl
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxLC_REPORT
|
wxLC_SINGLE_SEL
|
wxALWAYS_SHOW_SB
|
wxVSCROLL
);
m_listBox
->
SetMinSize
(
wxSize
(
-
1
,
200
)
);
bSizerMain
->
Add
(
m_listBox
,
3
,
wxBOTTOM
|
wxRIGHT
|
wxLEFT
|
wxEXPAND
,
5
);
bSizerMain
->
Add
(
m_listBox
,
3
,
wxBOTTOM
|
wxRIGHT
|
wxLEFT
|
wxEXPAND
,
5
);
m_staticTextMsg
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"Messages:"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticTextMsg
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"Messages:"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
...
...
common/dialogs/dialog_list_selector_base.fbp
View file @
300a047f
...
@@ -387,7 +387,7 @@
...
@@ -387,7 +387,7 @@
<property
name=
"maximum_size"
></property>
<property
name=
"maximum_size"
></property>
<property
name=
"min_size"
></property>
<property
name=
"min_size"
></property>
<property
name=
"minimize_button"
>
0
</property>
<property
name=
"minimize_button"
>
0
</property>
<property
name=
"minimum_size"
>
-1,
-1
</property>
<property
name=
"minimum_size"
>
-1,
200
</property>
<property
name=
"moveable"
>
1
</property>
<property
name=
"moveable"
>
1
</property>
<property
name=
"name"
>
m_listBox
</property>
<property
name=
"name"
>
m_listBox
</property>
<property
name=
"pane_border"
>
1
</property>
<property
name=
"pane_border"
>
1
</property>
...
...
common/displlst.cpp
View file @
300a047f
...
@@ -35,8 +35,8 @@
...
@@ -35,8 +35,8 @@
EDA_LIST_DIALOG
::
EDA_LIST_DIALOG
(
EDA_DRAW_FRAME
*
aParent
,
const
wxString
&
aTitle
,
EDA_LIST_DIALOG
::
EDA_LIST_DIALOG
(
EDA_DRAW_FRAME
*
aParent
,
const
wxString
&
aTitle
,
const
wxArrayString
&
aItemHeaders
,
const
wxArrayString
&
aItemHeaders
,
const
std
::
vector
<
wxArrayString
>&
aItemList
,
const
std
::
vector
<
wxArrayString
>&
aItemList
,
const
wxString
&
a
RefText
,
const
wxString
&
a
Selection
,
void
(
*
aCallBackFunction
)(
wxString
&
Text
),
void
(
*
aCallBackFunction
)(
wxString
&
),
bool
aSortList
)
:
bool
aSortList
)
:
EDA_LIST_DIALOG_BASE
(
aParent
,
wxID_ANY
,
aTitle
)
EDA_LIST_DIALOG_BASE
(
aParent
,
wxID_ANY
,
aTitle
)
{
{
...
@@ -47,41 +47,45 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
...
@@ -47,41 +47,45 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
for
(
unsigned
i
=
0
;
i
<
aItemHeaders
.
Count
();
i
++
)
for
(
unsigned
i
=
0
;
i
<
aItemHeaders
.
Count
();
i
++
)
{
{
wxListItem
column
;
wxListItem
column
;
column
.
SetId
(
i
);
column
.
SetId
(
i
);
column
.
SetText
(
aItemHeaders
.
Item
(
i
)
);
column
.
SetText
(
aItemHeaders
.
Item
(
i
)
);
m_listBox
->
InsertColumn
(
i
,
column
);
m_listBox
->
InsertColumn
(
i
,
column
);
}
}
InsertItems
(
aItemList
,
0
);
InsertItems
(
aItemList
,
0
);
if
(
!
aRefText
.
IsEmpty
()
)
// try to select the item matching aRefText
for
(
unsigned
i
=
0
;
i
<
aItemHeaders
.
Count
();
i
++
)
m_listBox
->
SetColumnWidth
(
i
,
wxLIST_AUTOSIZE
);
if
(
m_callBackFct
==
NULL
)
{
m_messages
->
Show
(
false
);
m_staticTextMsg
->
Show
(
false
);
}
Fit
();
if
(
!!
aSelection
)
{
{
for
(
unsigned
ii
=
0
;
ii
<
aItemList
.
size
();
ii
++
)
for
(
unsigned
row
=
0
;
row
<
aItemList
.
size
();
++
row
)
{
{
if
(
aItemList
[
ii
][
0
]
==
aRefText
)
if
(
aItemList
[
row
][
0
]
==
aSelection
)
{
{
m_listBox
->
SetItemState
(
ii
,
wxLIST_STATE_SELECTED
,
wxLIST_STATE_SELECTED
);
m_listBox
->
SetItemState
(
row
,
wxLIST_STATE_SELECTED
,
wxLIST_STATE_SELECTED
);
m_listBox
->
EnsureVisible
(
row
);
break
;
break
;
}
}
}
}
}
}
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient
// because so many dialogs share this same class.
// because so many dialogs share this same class, with different numbers of
// columns, different column names, and column widths.
m_hash_key
=
TO_UTF8
(
aTitle
);
m_hash_key
=
TO_UTF8
(
aTitle
);
for
(
unsigned
i
=
0
;
i
<
aItemHeaders
.
Count
();
i
++
)
m_listBox
->
SetColumnWidth
(
i
,
wxLIST_AUTOSIZE
);
if
(
m_callBackFct
==
NULL
)
{
m_messages
->
Show
(
false
);
m_staticTextMsg
->
Show
(
false
);
}
m_filterBox
->
SetFocus
();
m_filterBox
->
SetFocus
();
Fit
();
}
}
...
...
pcbnew/loadcmp.cpp
View file @
300a047f
...
@@ -470,11 +470,13 @@ wxString PCB_BASE_FRAME::SelectFootprint( EDA_DRAW_FRAME* aWindow,
...
@@ -470,11 +470,13 @@ wxString PCB_BASE_FRAME::SelectFootprint( EDA_DRAW_FRAME* aWindow,
const
wxString
&
aKeyWord
,
const
wxString
&
aKeyWord
,
FP_LIB_TABLE
*
aTable
)
FP_LIB_TABLE
*
aTable
)
{
{
static
wxString
OldName
;
// Save the name of the last module loaded.
static
wxString
oldName
;
// Save the name of the last module loaded.
wxString
CmpName
;
wxString
fpname
;
wxString
msg
;
wxString
msg
;
wxArrayString
libraries
;
wxArrayString
libraries
;
FP_LIB_TABLE
libTable
;
FP_LIB_TABLE
libTable
;
std
::
vector
<
wxArrayString
>
rows
;
std
::
vector
<
wxArrayString
>
rows
;
#if !defined( USE_FP_LIB_TABLE )
#if !defined( USE_FP_LIB_TABLE )
...
@@ -581,33 +583,33 @@ wxString PCB_BASE_FRAME::SelectFootprint( EDA_DRAW_FRAME* aWindow,
...
@@ -581,33 +583,33 @@ wxString PCB_BASE_FRAME::SelectFootprint( EDA_DRAW_FRAME* aWindow,
msg
.
Printf
(
_
(
"Modules [%d items]"
),
(
int
)
rows
.
size
()
);
msg
.
Printf
(
_
(
"Modules [%d items]"
),
(
int
)
rows
.
size
()
);
EDA_LIST_DIALOG
dlg
(
aWindow
,
msg
,
headers
,
rows
,
O
ldName
,
DisplayCmpDoc
);
EDA_LIST_DIALOG
dlg
(
aWindow
,
msg
,
headers
,
rows
,
o
ldName
,
DisplayCmpDoc
);
if
(
dlg
.
ShowModal
()
==
wxID_OK
)
if
(
dlg
.
ShowModal
()
==
wxID_OK
)
{
{
CmpN
ame
=
dlg
.
GetTextSelection
();
fpn
ame
=
dlg
.
GetTextSelection
();
#if defined( USE_FP_LIB_TABLE )
#if defined( USE_FP_LIB_TABLE )
CmpName
=
dlg
.
GetTextSelection
(
1
)
+
wxT
(
":"
)
+
CmpN
ame
;
fpname
=
dlg
.
GetTextSelection
(
1
)
+
wxT
(
":"
)
+
fpn
ame
;
#endif
#endif
SkipNextLeftButtonReleaseEvent
();
SkipNextLeftButtonReleaseEvent
();
}
}
else
else
CmpN
ame
.
Empty
();
fpn
ame
.
Empty
();
}
}
else
else
{
{
DisplayError
(
aWindow
,
_
(
"No footprint found."
)
);
DisplayError
(
aWindow
,
_
(
"No footprint found."
)
);
CmpN
ame
.
Empty
();
fpn
ame
.
Empty
();
}
}
if
(
CmpN
ame
!=
wxEmptyString
)
if
(
fpn
ame
!=
wxEmptyString
)
OldName
=
CmpN
ame
;
oldName
=
fpn
ame
;
wxLogDebug
(
wxT
(
"Footprint '%s' was selected."
),
GetChars
(
CmpN
ame
)
);
wxLogDebug
(
wxT
(
"Footprint '%s' was selected."
),
GetChars
(
fpn
ame
)
);
return
CmpN
ame
;
return
fpn
ame
;
}
}
...
@@ -628,27 +630,29 @@ static void DisplayCmpDoc( wxString& Name )
...
@@ -628,27 +630,29 @@ static void DisplayCmpDoc( wxString& Name )
MODULE
*
FOOTPRINT_EDIT_FRAME
::
SelectFootprint
(
BOARD
*
aPcb
)
MODULE
*
FOOTPRINT_EDIT_FRAME
::
SelectFootprint
(
BOARD
*
aPcb
)
{
{
MODULE
*
module
;
static
wxString
oldName
;
// Save name of last module selected.
static
wxString
OldName
;
// Save name of last module selected.
wxString
CmpName
,
msg
;
wxString
fpname
;
wxString
msg
;
wxArrayString
listnames
;
wxArrayString
listnames
;
MODULE
*
module
=
aPcb
->
m_Modules
;
module
=
aPcb
->
m_Modules
;
for
(
;
module
;
module
=
module
->
Next
()
)
for
(
;
module
!=
NULL
;
module
=
(
MODULE
*
)
module
->
Next
()
)
listnames
.
Add
(
module
->
GetReference
()
);
listnames
.
Add
(
module
->
GetReference
()
);
msg
.
Printf
(
_
(
"Modules [%d items]"
),
listnames
.
GetCount
()
);
msg
.
Printf
(
_
(
"Modules [%d items]"
),
listnames
.
GetCount
()
);
wxArrayString
headers
;
wxArrayString
headers
;
headers
.
Add
(
_
(
"Module"
)
);
headers
.
Add
(
_
(
"Module"
)
);
std
::
vector
<
wxArrayString
>
itemsToDisplay
;
std
::
vector
<
wxArrayString
>
itemsToDisplay
;
// Conversion from wxArrayString to vector of ArrayString
// Conversion from wxArrayString to vector of ArrayString
for
(
unsigned
i
=
0
;
i
<
listnames
.
GetCount
();
i
++
)
for
(
unsigned
i
=
0
;
i
<
listnames
.
GetCount
();
i
++
)
{
{
wxArrayString
item
;
wxArrayString
item
;
item
.
Add
(
listnames
[
i
]
);
item
.
Add
(
listnames
[
i
]
);
itemsToDisplay
.
push_back
(
item
);
itemsToDisplay
.
push_back
(
item
);
}
}
...
@@ -656,17 +660,17 @@ MODULE* FOOTPRINT_EDIT_FRAME::SelectFootprint( BOARD* aPcb )
...
@@ -656,17 +660,17 @@ MODULE* FOOTPRINT_EDIT_FRAME::SelectFootprint( BOARD* aPcb )
EDA_LIST_DIALOG
dlg
(
this
,
msg
,
headers
,
itemsToDisplay
,
wxEmptyString
,
NULL
,
SORT_LIST
);
EDA_LIST_DIALOG
dlg
(
this
,
msg
,
headers
,
itemsToDisplay
,
wxEmptyString
,
NULL
,
SORT_LIST
);
if
(
dlg
.
ShowModal
()
==
wxID_OK
)
if
(
dlg
.
ShowModal
()
==
wxID_OK
)
CmpN
ame
=
dlg
.
GetTextSelection
();
fpn
ame
=
dlg
.
GetTextSelection
();
else
else
return
NULL
;
return
NULL
;
OldName
=
CmpN
ame
;
oldName
=
fpn
ame
;
module
=
aPcb
->
m_Modules
;
module
=
aPcb
->
m_Modules
;
for
(
;
module
!=
NULL
;
module
=
(
MODULE
*
)
module
->
Next
()
)
for
(
;
module
;
module
=
module
->
Next
()
)
{
{
if
(
CmpN
ame
==
module
->
GetReference
()
)
if
(
fpn
ame
==
module
->
GetReference
()
)
break
;
break
;
}
}
...
...
pcbnew/tools/selection_tool.cpp
View file @
300a047f
...
@@ -81,9 +81,9 @@ void SELECTION_TOOL::Reset()
...
@@ -81,9 +81,9 @@ void SELECTION_TOOL::Reset()
int
SELECTION_TOOL
::
Main
(
TOOL_EVENT
&
aEvent
)
int
SELECTION_TOOL
::
Main
(
TOOL_EVENT
&
aEvent
)
{
{
BOARD
*
board
=
getModel
<
BOARD
>
(
PCB_T
);
VIEW
*
view
=
getView
();
VIEW
*
view
=
getView
();
assert
(
board
!=
NULL
);
assert
(
getModel
<
BOARD
>
(
PCB_T
)
!=
NULL
);
view
->
Add
(
m_selection
.
group
);
view
->
Add
(
m_selection
.
group
);
...
...
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