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
56615d16
Commit
56615d16
authored
Nov 26, 2013
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIX: work around for wx 2.8 bug affecting wxListCtrl column resizing.
parent
96c2bee8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
22 deletions
+42
-22
displlst.cpp
common/displlst.cpp
+40
-21
dialog_helpers.h
include/dialog_helpers.h
+2
-1
No files found.
common/displlst.cpp
View file @
56615d16
...
...
@@ -56,15 +56,39 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
InsertItems
(
aItemList
,
0
);
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
);
}
for
(
unsigned
col
=
0
;
col
<
aItemHeaders
.
Count
();
++
col
)
{
m_listBox
->
SetColumnWidth
(
col
,
wxLIST_AUTOSIZE
);
#if !wxCHECK_VERSION( 2, 9, 0 )
// include the column header in the width decision, wx 2.8 forgets this:
wxListItem
col_info
;
m_listBox
->
GetColumn
(
col
,
col_info
);
wxString
header
=
col_info
.
GetText
();
int
headerz
=
GetTextSize
(
header
,
m_listBox
).
x
;
// A reasonable column header has about 14 pixels of whitespace
// in addition to the width of the text itself.
headerz
+=
14
;
if
(
headerz
>
col_info
.
GetWidth
()
)
{
col_info
.
SetWidth
(
headerz
);
m_listBox
->
SetColumn
(
col
,
col_info
);
}
#endif
}
#if !wxCHECK_VERSION( 2, 9, 0 )
// wx 2.8.x has bug in wxListCtrl WRT honoring the omission of wxHSCROLL, at least
// on gtk2. Fix by setting minimum width so horizontal wxListCtrl scrolling is
...
...
@@ -77,8 +101,6 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
width
+=
m_listBox
->
GetColumnWidth
(
col
)
+
2
;
}
//width += 40; // vert scroll bar.
wxSize
sz
=
m_listBox
->
GetSize
();
sz
.
SetWidth
(
width
);
...
...
@@ -112,11 +134,6 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
}
EDA_LIST_DIALOG
::~
EDA_LIST_DIALOG
()
{
}
void
EDA_LIST_DIALOG
::
textChangeInFilterBox
(
wxCommandEvent
&
event
)
{
wxString
filter
;
...
...
@@ -143,22 +160,24 @@ void EDA_LIST_DIALOG::textChangeInFilterBox( wxCommandEvent& event )
wxString
EDA_LIST_DIALOG
::
GetTextSelection
(
int
aColumn
)
{
wxCHECK_MSG
(
aColumn
<
m_listBox
->
GetColumnCount
(
),
wxEmptyString
,
wxCHECK_MSG
(
unsigned
(
aColumn
)
<
unsigned
(
m_listBox
->
GetColumnCount
()
),
wxEmptyString
,
wxT
(
"Invalid list control column."
)
);
wxListItem
info
;
wxString
text
;
long
item
=
-
1
;
item
=
m_listBox
->
GetNextItem
(
item
,
wxLIST_NEXT_ALL
,
wxLIST_STATE_SELECTED
);
long
item
=
m_listBox
->
GetNextItem
(
-
1
,
wxLIST_NEXT_ALL
,
wxLIST_STATE_SELECTED
);
info
.
m_mask
=
wxLIST_MASK_TEXT
;
info
.
m_itemId
=
item
;
info
.
m_col
=
aColumn
;
if
(
item
>=
0
)
// if something is selected.
{
wxListItem
info
;
info
.
m_mask
=
wxLIST_MASK_TEXT
;
info
.
m_itemId
=
item
;
info
.
m_col
=
aColumn
;
if
(
!
m_listBox
->
GetItem
(
info
)
)
return
wxEmptyString
;
if
(
m_listBox
->
GetItem
(
info
)
)
return
info
.
m_text
;
}
return
info
.
m_text
;
return
wxEmptyString
;
}
...
...
include/dialog_helpers.h
View file @
56615d16
...
...
@@ -74,7 +74,8 @@ public:
const
wxString
&
aRefText
,
void
(
*
aCallBackFunction
)(
wxString
&
Text
)
=
NULL
,
bool
aSortList
=
false
);
~
EDA_LIST_DIALOG
();
// ~EDA_LIST_DIALOG() {}
void
Append
(
const
wxArrayString
&
aItemStr
);
void
InsertItems
(
const
std
::
vector
<
wxArrayString
>&
aItemList
,
int
aPosition
=
0
);
...
...
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