Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
41b7ae72
Commit
41b7ae72
authored
Jan 08, 2009
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sort card list by identifying column if value in selected column is equal
parent
9a9b6e82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
src/gui/control/card_list.cpp
src/gui/control/card_list.cpp
+16
-2
src/gui/control/card_list.hpp
src/gui/control/card_list.hpp
+2
-1
No files found.
src/gui/control/card_list.cpp
View file @
41b7ae72
...
...
@@ -199,12 +199,17 @@ bool CardListBase::compareItems(void* a, void* b) const {
FieldP
sort_field
=
column_fields
[
sort_by_column
];
ValueP
va
=
reinterpret_cast
<
Card
*>
(
a
)
->
data
[
sort_field
];
ValueP
vb
=
reinterpret_cast
<
Card
*>
(
b
)
->
data
[
sort_field
];
if
(
!
va
||
!
vb
)
return
va
<
vb
;
// got to do something, compare pointers
assert
(
va
&&
vb
);
// compare sort keys
int
cmp
=
smart_compare
(
va
->
getSortKey
(),
vb
->
getSortKey
()
);
if
(
cmp
!=
0
)
return
cmp
<
0
;
// equal values, compare alternate sort key
// TODO: sort by a second column
if
(
alternate_sort_field
)
{
ValueP
va
=
reinterpret_cast
<
Card
*>
(
a
)
->
data
[
alternate_sort_field
];
ValueP
vb
=
reinterpret_cast
<
Card
*>
(
b
)
->
data
[
alternate_sort_field
];
int
cmp
=
smart_compare
(
va
->
getSortKey
(),
vb
->
getSortKey
()
);
if
(
cmp
!=
0
)
return
cmp
<
0
;
}
return
false
;
}
...
...
@@ -250,6 +255,15 @@ void CardListBase::rebuild() {
}
++
i
;
}
// determine alternate sortImageFieldP ImageCardList::findImageField() {
alternate_sort_field
=
FieldP
();
FOR_EACH
(
f
,
set
->
game
->
card_fields
)
{
if
(
f
->
identifying
)
{
alternate_sort_field
=
f
;
break
;
}
}
// refresh
refreshList
();
}
...
...
src/gui/control/card_list.hpp
View file @
41b7ae72
...
...
@@ -125,7 +125,8 @@ class CardListBase : public ItemList, public SetView {
private:
// display stuff
vector
<
FieldP
>
column_fields
;
///< The field to use for each column (by column index)
FieldP
alternate_sort_field
;
///< Second field to sort by, if the column doesn't suffice
mutable
wxListItemAttr
item_attr
;
// for OnGetItemAttr
public:
...
...
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