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
7d6fc3eb
Commit
7d6fc3eb
authored
Aug 11, 2008
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed GalleryList member column -> subcolumn, so we can have proper columns later on as well.
parent
51ca47e4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
79 deletions
+82
-79
src/gui/control/card_editor.cpp
src/gui/control/card_editor.cpp
+3
-1
src/gui/control/gallery_list.cpp
src/gui/control/gallery_list.cpp
+32
-32
src/gui/control/gallery_list.hpp
src/gui/control/gallery_list.hpp
+15
-15
src/gui/control/package_list.cpp
src/gui/control/package_list.cpp
+3
-3
src/gui/control/package_list.hpp
src/gui/control/package_list.hpp
+1
-1
src/gui/set/stats_panel.cpp
src/gui/set/stats_panel.cpp
+28
-27
No files found.
src/gui/control/card_editor.cpp
View file @
7d6fc3eb
...
@@ -325,8 +325,10 @@ void DataEditor::selectField(wxMouseEvent& ev, bool (ValueEditor::*event)(const
...
@@ -325,8 +325,10 @@ void DataEditor::selectField(wxMouseEvent& ev, bool (ValueEditor::*event)(const
}
}
void
DataEditor
::
selectFieldNoEvents
(
const
wxMouseEvent
&
ev
)
{
void
DataEditor
::
selectFieldNoEvents
(
const
wxMouseEvent
&
ev
)
{
FOR_EACH_EDITOR_REVERSE
{
// find high z index fields first
FOR_EACH_EDITOR_REVERSE
{
// find high z index fields first
int
y
;
if
(
v
->
getField
()
->
editable
&&
(
v
->
containsPoint
(
mousePoint
(
ev
,
*
v
))
||
if
(
v
->
getField
()
->
editable
&&
(
v
->
containsPoint
(
mousePoint
(
ev
,
*
v
))
||
(
nativeLook
()
&&
ev
.
GetY
()
>=
v
->
getStyle
()
->
top
&&
ev
.
GetY
()
<
v
->
getStyle
()
->
bottom
)
))
{
(
nativeLook
()
&&
(
y
=
ev
.
GetY
()
+
GetScrollPos
(
wxVERTICAL
))
>=
v
->
getStyle
()
->
top
&&
y
<
v
->
getStyle
()
->
bottom
)
))
{
current_viewer
=
v
.
get
();
current_viewer
=
v
.
get
();
current_editor
=
e
;
current_editor
=
e
;
return
;
return
;
...
...
src/gui/control/gallery_list.cpp
View file @
7d6fc3eb
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#include <gfx/gfx.hpp>
#include <gfx/gfx.hpp>
#include <wx/dcbuffer.h>
#include <wx/dcbuffer.h>
DECLARE_TYPEOF_COLLECTION
(
GalleryList
::
Column_for_typeof
);
DECLARE_TYPEOF_COLLECTION
(
GalleryList
::
Sub
Column_for_typeof
);
// ----------------------------------------------------------------------------- : Events
// ----------------------------------------------------------------------------- : Events
...
@@ -22,35 +22,35 @@ DEFINE_EVENT_TYPE(EVENT_GALLERY_ACTIVATE);
...
@@ -22,35 +22,35 @@ DEFINE_EVENT_TYPE(EVENT_GALLERY_ACTIVATE);
GalleryList
::
GalleryList
(
Window
*
parent
,
int
id
,
int
direction
,
bool
always_focused
)
GalleryList
::
GalleryList
(
Window
*
parent
,
int
id
,
int
direction
,
bool
always_focused
)
:
wxPanel
(
parent
,
id
,
wxDefaultPosition
,
wxDefaultSize
,
wxSUNKEN_BORDER
|
wxWANTS_CHARS
|
(
direction
==
wxHORIZONTAL
?
wxHSCROLL
:
wxVSCROLL
)
)
:
wxPanel
(
parent
,
id
,
wxDefaultPosition
,
wxDefaultSize
,
wxSUNKEN_BORDER
|
wxWANTS_CHARS
|
(
direction
==
wxHORIZONTAL
?
wxHSCROLL
:
wxVSCROLL
)
)
,
active_column
(
0
)
,
active_
sub
column
(
0
)
,
direction
(
direction
)
,
direction
(
direction
)
,
always_focused
(
always_focused
)
,
always_focused
(
always_focused
)
,
visible_start
(
0
)
,
visible_start
(
0
)
{
{
Column
col
;
Sub
Column
col
;
col
.
can_select
=
true
;
col
.
can_select
=
true
;
col
.
selection
=
NO_SELECTION
;
col
.
selection
=
NO_SELECTION
;
columns
.
push_back
(
col
);
sub
columns
.
push_back
(
col
);
}
}
void
GalleryList
::
select
Column
(
size_t
column
)
{
void
GalleryList
::
select
SubColumn
(
size_t
subcol
)
{
if
(
column
>=
columns
.
size
())
return
;
if
(
subcol
>=
sub
columns
.
size
())
return
;
if
(
!
columns
[
column
].
can_select
)
return
;
if
(
!
subcolumns
[
subcol
].
can_select
)
return
;
if
(
active_
column
==
column
)
return
;
if
(
active_
subcolumn
==
subcol
)
return
;
RefreshItem
(
columns
[
active_
column
].
selection
);
RefreshItem
(
subcolumns
[
active_sub
column
].
selection
);
RefreshItem
(
columns
[
column
].
selection
);
RefreshItem
(
subcolumns
[
subcol
].
selection
);
active_
column
=
column
;
active_
subcolumn
=
subcol
;
}
}
void
GalleryList
::
select
(
size_t
item
,
size_t
column
,
bool
event
)
{
void
GalleryList
::
select
(
size_t
item
,
size_t
sub
column
,
bool
event
)
{
if
(
item
>=
itemCount
())
return
;
if
(
item
>=
itemCount
())
return
;
// select column
// select column
size_t
old_active_
column
=
active_
column
;
size_t
old_active_
subcolumn
=
active_sub
column
;
select
Column
(
column
);
select
SubColumn
(
sub
column
);
Column
&
col
=
columns
[
active_
column
];
SubColumn
&
col
=
subcolumns
[
active_sub
column
];
// filter?
// filter?
bool
changes
=
col
.
selection
!=
item
;
bool
changes
=
col
.
selection
!=
item
;
onSelect
(
item
,
old_active_column
,
changes
);
onSelect
(
item
,
old_active_
sub
column
,
changes
);
// select
// select
size_t
old_sel
=
col
.
selection
;
size_t
old_sel
=
col
.
selection
;
col
.
selection
=
item
;
col
.
selection
=
item
;
...
@@ -71,7 +71,7 @@ void GalleryList::select(size_t item, size_t column, bool event) {
...
@@ -71,7 +71,7 @@ void GalleryList::select(size_t item, size_t column, bool event) {
}
}
void
GalleryList
::
update
()
{
void
GalleryList
::
update
()
{
select
(
columns
[
active_
column
].
selection
);
select
(
subcolumns
[
active_sub
column
].
selection
);
updateScrollbar
();
updateScrollbar
();
Refresh
(
false
);
Refresh
(
false
);
}
}
...
@@ -122,7 +122,7 @@ void GalleryList::RefreshItem(size_t item) {
...
@@ -122,7 +122,7 @@ void GalleryList::RefreshItem(size_t item) {
RefreshRect
(
wxRect
(
itemPos
(
item
),
item_size
).
Inflate
(
BORDER
,
BORDER
),
false
);
RefreshRect
(
wxRect
(
itemPos
(
item
),
item_size
).
Inflate
(
BORDER
,
BORDER
),
false
);
}
}
void
GalleryList
::
RefreshSelection
()
{
void
GalleryList
::
RefreshSelection
()
{
FOR_EACH
(
col
,
columns
)
RefreshItem
(
col
.
selection
);
FOR_EACH
(
col
,
sub
columns
)
RefreshItem
(
col
.
selection
);
}
}
void
GalleryList
::
onScroll
(
wxScrollWinEvent
&
ev
)
{
void
GalleryList
::
onScroll
(
wxScrollWinEvent
&
ev
)
{
...
@@ -162,16 +162,16 @@ void GalleryList::onLeftDown(wxMouseEvent& ev) {
...
@@ -162,16 +162,16 @@ void GalleryList::onLeftDown(wxMouseEvent& ev) {
wxPoint
pos
=
itemPos
(
item
);
wxPoint
pos
=
itemPos
(
item
);
int
x
=
ev
.
GetX
()
-
pos
.
x
;
int
x
=
ev
.
GetX
()
-
pos
.
x
;
int
y
=
ev
.
GetY
()
-
pos
.
y
;
int
y
=
ev
.
GetY
()
-
pos
.
y
;
size_t
column
=
active_
column
;
size_t
subcolumn
=
active_sub
column
;
for
(
size_t
j
=
0
;
columns
.
size
()
;
++
j
)
{
for
(
size_t
j
=
0
;
sub
columns
.
size
()
;
++
j
)
{
Column
&
col
=
columns
[
j
];
SubColumn
&
col
=
sub
columns
[
j
];
if
(
x
>=
col
.
offset
.
x
&&
y
>=
col
.
offset
.
y
&&
x
<
col
.
size
.
x
+
col
.
offset
.
x
&&
y
<
col
.
size
.
y
+
col
.
offset
.
y
)
{
if
(
x
>=
col
.
offset
.
x
&&
y
>=
col
.
offset
.
y
&&
x
<
col
.
size
.
x
+
col
.
offset
.
x
&&
y
<
col
.
size
.
y
+
col
.
offset
.
y
)
{
// clicked on this column
// clicked on this column
column
=
j
;
sub
column
=
j
;
break
;
break
;
}
}
}
}
select
(
item
,
column
);
select
(
item
,
sub
column
);
}
}
ev
.
Skip
();
// focus
ev
.
Skip
();
// focus
}
}
...
@@ -181,34 +181,34 @@ void GalleryList::onLeftDClick(wxMouseEvent& ev) {
...
@@ -181,34 +181,34 @@ void GalleryList::onLeftDClick(wxMouseEvent& ev) {
}
}
void
GalleryList
::
onChar
(
wxKeyEvent
&
ev
)
{
void
GalleryList
::
onChar
(
wxKeyEvent
&
ev
)
{
Column
&
col
=
columns
[
active_
column
];
SubColumn
&
col
=
subcolumns
[
active_sub
column
];
switch
(
ev
.
GetKeyCode
())
{
switch
(
ev
.
GetKeyCode
())
{
case
WXK_LEFT
:
case
WXK_LEFT
:
if
(
direction
==
wxHORIZONTAL
)
{
if
(
direction
==
wxHORIZONTAL
)
{
select
(
col
.
selection
-
1
);
select
(
col
.
selection
-
1
);
}
else
{
}
else
{
select
Column
(
active_
column
-
1
);
select
SubColumn
(
active_sub
column
-
1
);
}
}
break
;
break
;
case
WXK_RIGHT
:
case
WXK_RIGHT
:
if
(
direction
==
wxHORIZONTAL
)
{
if
(
direction
==
wxHORIZONTAL
)
{
select
(
col
.
selection
+
1
);
select
(
col
.
selection
+
1
);
}
else
{
}
else
{
select
Column
(
active_
column
+
1
);
select
SubColumn
(
active_sub
column
+
1
);
}
}
break
;
break
;
case
WXK_UP
:
case
WXK_UP
:
if
(
direction
==
wxVERTICAL
)
{
if
(
direction
==
wxVERTICAL
)
{
select
(
col
.
selection
-
1
);
select
(
col
.
selection
-
1
);
}
else
{
}
else
{
select
Column
(
active_
column
-
1
);
select
SubColumn
(
active_sub
column
-
1
);
}
}
break
;
break
;
case
WXK_DOWN
:
case
WXK_DOWN
:
if
(
direction
==
wxVERTICAL
)
{
if
(
direction
==
wxVERTICAL
)
{
select
(
col
.
selection
+
1
);
select
(
col
.
selection
+
1
);
}
else
{
}
else
{
select
Column
(
active_
column
+
1
);
select
SubColumn
(
active_sub
column
+
1
);
}
}
break
;
break
;
case
WXK_TAB
:
{
case
WXK_TAB
:
{
...
@@ -263,13 +263,13 @@ void GalleryList::OnDraw(DC& dc) {
...
@@ -263,13 +263,13 @@ void GalleryList::OnDraw(DC& dc) {
for
(
size_t
i
=
start
;
i
<
end
;
++
i
)
{
for
(
size_t
i
=
start
;
i
<
end
;
++
i
)
{
wxPoint
pos
=
itemPos
(
i
);
wxPoint
pos
=
itemPos
(
i
);
// draw selection rectangle
// draw selection rectangle
for
(
size_t
j
=
0
;
j
<
columns
.
size
()
;
++
j
)
{
for
(
size_t
j
=
0
;
j
<
sub
columns
.
size
()
;
++
j
)
{
const
Column
&
col
=
columns
[
j
];
const
SubColumn
&
col
=
sub
columns
[
j
];
bool
selected
=
i
==
col
.
selection
;
bool
selected
=
i
==
col
.
selection
;
Color
c
=
selected
?
(
has_focus
&&
j
==
active_column
Color
c
=
selected
?
(
has_focus
&&
j
==
active_
sub
column
?
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_HIGHLIGHT
)
?
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_HIGHLIGHT
)
:
lerp
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
),
:
lerp
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
),
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOWTEXT
),
columnActivity
(
j
))
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOWTEXT
),
sub
columnActivity
(
j
))
)
)
:
unselected
;
:
unselected
;
dc
.
SetPen
(
c
);
dc
.
SetPen
(
c
);
...
...
src/gui/control/gallery_list.hpp
View file @
7d6fc3eb
...
@@ -32,14 +32,14 @@ class GalleryList : public wxPanel {
...
@@ -32,14 +32,14 @@ class GalleryList : public wxPanel {
GalleryList
(
Window
*
parent
,
int
id
,
int
direction
=
wxHORIZONTAL
,
bool
always_focused
=
true
);
GalleryList
(
Window
*
parent
,
int
id
,
int
direction
=
wxHORIZONTAL
,
bool
always_focused
=
true
);
/// Select the given column
/// Select the given column
void
select
Column
(
size_t
column
);
void
select
SubColumn
(
size_t
subcol
);
/// Select the given item in the given column (or in the active column)
/// Select the given item in the given column (or in the active column)
void
select
(
size_t
item
,
size_t
column
=
NO_SELECTION
,
bool
event
=
true
);
void
select
(
size_t
item
,
size_t
subcol
=
NO_SELECTION
,
bool
event
=
true
);
/// Is there an item selected?
/// Is there an item selected?
inline
bool
hasSelection
(
size_t
column
=
0
)
const
{
return
columns
[
column
].
selection
<
itemCount
();
}
inline
bool
hasSelection
(
size_t
subcol
=
0
)
const
{
return
subcolumns
[
subcol
].
selection
<
itemCount
();
}
/// Is the given item selected?
/// Is the given item selected?
inline
bool
isSelected
(
size_t
item
,
size_t
column
=
0
)
const
{
inline
bool
isSelected
(
size_t
item
,
size_t
subcol
=
0
)
const
{
return
column
<
columns
.
size
()
&&
columns
[
column
].
selection
==
item
;
return
subcol
<
subcolumns
.
size
()
&&
subcolumns
[
subcol
].
selection
==
item
;
}
}
/// Redraw only the selected items
/// Redraw only the selected items
...
@@ -47,10 +47,10 @@ class GalleryList : public wxPanel {
...
@@ -47,10 +47,10 @@ class GalleryList : public wxPanel {
protected:
protected:
static
const
size_t
NO_SELECTION
=
(
size_t
)
-
1
;
static
const
size_t
NO_SELECTION
=
(
size_t
)
-
1
;
size_t
active_
column
;
///< The active
column
size_t
active_
subcolumn
;
///< The active sub
column
wxSize
item_size
;
///< The total size of a single item (over all columns)
wxSize
item_size
;
///< The total size of a single item (over all columns)
int
direction
;
///< Direction of the list, can be wxHORIZONTAL or wxVERTICAL
int
direction
;
///< Direction of the list, can be wxHORIZONTAL or wxVERTICAL
bool
always_focused
;
///< Always draw as if focused
bool
always_focused
;
///< Always draw as if focused
/// Redraw the list after changing the selection or the number of items
/// Redraw the list after changing the selection or the number of items
void
update
();
void
update
();
...
@@ -59,8 +59,8 @@ class GalleryList : public wxPanel {
...
@@ -59,8 +59,8 @@ class GalleryList : public wxPanel {
virtual
size_t
itemCount
()
const
=
0
;
virtual
size_t
itemCount
()
const
=
0
;
/// Draw an item
/// Draw an item
virtual
void
drawItem
(
DC
&
dc
,
int
x
,
int
y
,
size_t
item
)
=
0
;
virtual
void
drawItem
(
DC
&
dc
,
int
x
,
int
y
,
size_t
item
)
=
0
;
/// How 'salient' should the selection in the given column be?
/// How 'salient' should the selection in the given
sub
column be?
virtual
double
columnActivity
(
size_t
col
)
const
{
return
0.7
;
}
virtual
double
sub
columnActivity
(
size_t
col
)
const
{
return
0.7
;
}
/// Filter calls to select, or apply some extra operaions
/// Filter calls to select, or apply some extra operaions
virtual
void
onSelect
(
size_t
item
,
size_t
col
,
bool
&
changes
)
{}
virtual
void
onSelect
(
size_t
item
,
size_t
col
,
bool
&
changes
)
{}
...
@@ -68,14 +68,14 @@ class GalleryList : public wxPanel {
...
@@ -68,14 +68,14 @@ class GalleryList : public wxPanel {
/// Return the desired size of control
/// Return the desired size of control
virtual
wxSize
DoGetBestSize
()
const
;
virtual
wxSize
DoGetBestSize
()
const
;
/// Information on the
column
s
/// Information on the
subcolumns. These are columns inside item
s
struct
Column
{
struct
Sub
Column
{
wxPoint
offset
;
wxPoint
offset
;
wxSize
size
;
wxSize
size
;
bool
can_select
;
bool
can_select
;
size_t
selection
;
size_t
selection
;
};
};
vector
<
Column
>
columns
;
vector
<
SubColumn
>
sub
columns
;
private:
private:
DECLARE_EVENT_TABLE
();
DECLARE_EVENT_TABLE
();
...
@@ -121,7 +121,7 @@ class GalleryList : public wxPanel {
...
@@ -121,7 +121,7 @@ class GalleryList : public wxPanel {
}
}
public:
public:
typedef
Column
Column_for_typeof
;
typedef
SubColumn
Sub
Column_for_typeof
;
protected:
protected:
/// Send an event
/// Send an event
void
sendEvent
(
WXTYPE
type
);
void
sendEvent
(
WXTYPE
type
);
...
...
src/gui/control/package_list.cpp
View file @
7d6fc3eb
...
@@ -18,7 +18,7 @@ DECLARE_TYPEOF_COLLECTION(PackagedP);
...
@@ -18,7 +18,7 @@ DECLARE_TYPEOF_COLLECTION(PackagedP);
PackageList
::
PackageList
(
Window
*
parent
,
int
id
,
int
direction
,
bool
always_focused
)
PackageList
::
PackageList
(
Window
*
parent
,
int
id
,
int
direction
,
bool
always_focused
)
:
GalleryList
(
parent
,
id
,
direction
,
always_focused
)
:
GalleryList
(
parent
,
id
,
direction
,
always_focused
)
{
{
item_size
=
columns
[
0
].
size
=
wxSize
(
108
,
150
);
item_size
=
sub
columns
[
0
].
size
=
wxSize
(
108
,
150
);
SetThemeEnabled
(
true
);
SetThemeEnabled
(
true
);
}
}
...
@@ -88,7 +88,7 @@ void PackageList::clear() {
...
@@ -88,7 +88,7 @@ void PackageList::clear() {
void
PackageList
::
select
(
const
String
&
name
,
bool
send_event
)
{
void
PackageList
::
select
(
const
String
&
name
,
bool
send_event
)
{
for
(
vector
<
PackageData
>::
const_iterator
it
=
packages
.
begin
()
;
it
!=
packages
.
end
()
;
++
it
)
{
for
(
vector
<
PackageData
>::
const_iterator
it
=
packages
.
begin
()
;
it
!=
packages
.
end
()
;
++
it
)
{
if
(
it
->
package
->
name
()
==
name
)
{
if
(
it
->
package
->
name
()
==
name
)
{
columns
[
0
].
selection
=
it
-
packages
.
begin
();
sub
columns
[
0
].
selection
=
it
-
packages
.
begin
();
update
();
update
();
if
(
send_event
)
{
if
(
send_event
)
{
sendEvent
(
EVENT_GALLERY_SELECT
);
sendEvent
(
EVENT_GALLERY_SELECT
);
...
@@ -96,7 +96,7 @@ void PackageList::select(const String& name, bool send_event) {
...
@@ -96,7 +96,7 @@ void PackageList::select(const String& name, bool send_event) {
return
;
return
;
}
}
}
}
columns
[
0
].
selection
=
NO_SELECTION
;
sub
columns
[
0
].
selection
=
NO_SELECTION
;
update
();
update
();
return
;
return
;
}
}
src/gui/control/package_list.hpp
View file @
7d6fc3eb
...
@@ -39,7 +39,7 @@ class PackageList : public GalleryList {
...
@@ -39,7 +39,7 @@ class PackageList : public GalleryList {
* Throws if the selection is not of type T */
* Throws if the selection is not of type T */
template
<
typename
T
>
template
<
typename
T
>
intrusive_ptr
<
T
>
getSelection
(
bool
load_fully
=
true
)
const
{
intrusive_ptr
<
T
>
getSelection
(
bool
load_fully
=
true
)
const
{
intrusive_ptr
<
T
>
ret
=
dynamic_pointer_cast
<
T
>
(
packages
.
at
(
columns
[
0
].
selection
).
package
);
intrusive_ptr
<
T
>
ret
=
dynamic_pointer_cast
<
T
>
(
packages
.
at
(
sub
columns
[
0
].
selection
).
package
);
if
(
!
ret
)
throw
InternalError
(
_
(
"PackageList: Selected package has the wrong type"
));
if
(
!
ret
)
throw
InternalError
(
_
(
"PackageList: Selected package has the wrong type"
));
if
(
load_fully
)
ret
->
loadFully
();
if
(
load_fully
)
ret
->
loadFully
();
return
ret
;
return
ret
;
...
...
src/gui/set/stats_panel.cpp
View file @
7d6fc3eb
...
@@ -38,14 +38,14 @@ class StatCategoryList : public GalleryList {
...
@@ -38,14 +38,14 @@ class StatCategoryList : public GalleryList {
StatCategoryList
(
Window
*
parent
,
int
id
)
StatCategoryList
(
Window
*
parent
,
int
id
)
:
GalleryList
(
parent
,
id
,
wxVERTICAL
)
:
GalleryList
(
parent
,
id
,
wxVERTICAL
)
{
{
item_size
=
columns
[
0
].
size
=
wxSize
(
150
,
23
);
item_size
=
sub
columns
[
0
].
size
=
wxSize
(
150
,
23
);
}
}
void
show
(
const
GameP
&
);
void
show
(
const
GameP
&
);
/// The selected category
/// The selected category
inline
StatsCategory
&
getSelection
()
{
inline
StatsCategory
&
getSelection
()
{
return
*
categories
.
at
(
columns
[
0
].
selection
);
return
*
categories
.
at
(
sub
columns
[
0
].
selection
);
}
}
protected:
protected:
...
@@ -69,7 +69,7 @@ void StatCategoryList::show(const GameP& game) {
...
@@ -69,7 +69,7 @@ void StatCategoryList::show(const GameP& game) {
stable_sort
(
categories
.
begin
(),
categories
.
end
(),
ComparePositionHint
());
stable_sort
(
categories
.
begin
(),
categories
.
end
(),
ComparePositionHint
());
update
();
update
();
// select first item
// select first item
columns
[
0
].
selection
=
itemCount
()
>
0
?
0
:
NO_SELECTION
;
sub
columns
[
0
].
selection
=
itemCount
()
>
0
?
0
:
NO_SELECTION
;
}
}
size_t
StatCategoryList
::
itemCount
()
const
{
size_t
StatCategoryList
::
itemCount
()
const
{
...
@@ -114,20 +114,20 @@ class StatDimensionList : public GalleryList {
...
@@ -114,20 +114,20 @@ class StatDimensionList : public GalleryList {
,
prefered_dimension_count
(
dimension_count
)
,
prefered_dimension_count
(
dimension_count
)
{
{
//item_size = wxSize(150, 23);
//item_size = wxSize(150, 23);
columns
[
0
].
size
=
wxSize
(
140
,
23
);
sub
columns
[
0
].
size
=
wxSize
(
140
,
23
);
if
(
dimension_count
>
0
)
{
if
(
dimension_count
>
0
)
{
columns
[
0
].
selection
=
NO_SELECTION
;
sub
columns
[
0
].
selection
=
NO_SELECTION
;
columns
[
0
].
can_select
=
false
;
sub
columns
[
0
].
can_select
=
false
;
active_column
=
1
;
active_
sub
column
=
1
;
}
}
// additional columns
// additional columns
Column
col
;
Sub
Column
col
;
col
.
selection
=
show_empty
?
NO_SELECTION
:
0
;
col
.
selection
=
show_empty
?
NO_SELECTION
:
0
;
col
.
can_select
=
true
;
col
.
can_select
=
true
;
col
.
offset
.
x
=
columns
[
0
].
size
.
x
+
SPACING
;
col
.
offset
.
x
=
sub
columns
[
0
].
size
.
x
+
SPACING
;
col
.
size
=
wxSize
(
18
,
23
);
col
.
size
=
wxSize
(
18
,
23
);
for
(
int
i
=
0
;
i
<
dimension_count
;
++
i
)
{
for
(
int
i
=
0
;
i
<
dimension_count
;
++
i
)
{
columns
.
push_back
(
col
);
sub
columns
.
push_back
(
col
);
col
.
offset
.
x
+=
col
.
size
.
x
+
SPACING
;
col
.
offset
.
x
+=
col
.
size
.
x
+
SPACING
;
}
}
// total
// total
...
@@ -137,8 +137,8 @@ class StatDimensionList : public GalleryList {
...
@@ -137,8 +137,8 @@ class StatDimensionList : public GalleryList {
void
show
(
const
GameP
&
);
void
show
(
const
GameP
&
);
/// The selected category
/// The selected category
StatsDimensionP
getSelection
(
size_t
column
=
(
size_t
)
-
1
)
{
StatsDimensionP
getSelection
(
size_t
subcol
=
(
size_t
)
-
1
)
{
size_t
sel
=
columns
[
column
+
1
].
selection
-
show_empty
;
size_t
sel
=
subcolumns
[
subcol
+
1
].
selection
-
show_empty
;
if
(
sel
>=
itemCount
())
return
StatsDimensionP
();
if
(
sel
>=
itemCount
())
return
StatsDimensionP
();
else
return
dimensions
.
at
(
sel
);
else
return
dimensions
.
at
(
sel
);
}
}
...
@@ -149,7 +149,7 @@ class StatDimensionList : public GalleryList {
...
@@ -149,7 +149,7 @@ class StatDimensionList : public GalleryList {
void
restrictDimensions
(
size_t
dims
)
{
void
restrictDimensions
(
size_t
dims
)
{
prefered_dimension_count
=
dims
;
prefered_dimension_count
=
dims
;
active_
column
=
min
(
active_
column
,
dims
);
active_
subcolumn
=
min
(
active_sub
column
,
dims
);
RefreshSelection
();
RefreshSelection
();
}
}
...
@@ -157,33 +157,34 @@ class StatDimensionList : public GalleryList {
...
@@ -157,33 +157,34 @@ class StatDimensionList : public GalleryList {
virtual
size_t
itemCount
()
const
;
virtual
size_t
itemCount
()
const
;
virtual
void
drawItem
(
DC
&
dc
,
int
x
,
int
y
,
size_t
item
);
virtual
void
drawItem
(
DC
&
dc
,
int
x
,
int
y
,
size_t
item
);
virtual
double
columnActivity
(
size_t
col
)
const
{
virtual
double
sub
columnActivity
(
size_t
col
)
const
{
return
col
-
1
>=
prefered_dimension_count
?
0.2
:
0.7
;
return
col
-
1
>=
prefered_dimension_count
?
0.2
:
0.7
;
}
}
virtual
void
onSelect
(
size_t
item
,
size_t
old_col
,
bool
&
changes
)
{
virtual
void
onSelect
(
size_t
item
,
size_t
old_col
,
bool
&
changes
)
{
// swap selection with another column?
// swap selection with another subcolumn?
for
(
size_t
j
=
1
;
j
<
columns
.
size
()
;
++
j
)
{
for
(
size_t
j
=
1
;
j
<
subcolumns
.
size
()
;
++
j
)
{
if
(
j
!=
active_column
&&
columns
[
j
].
selection
==
item
&&
columns
[
active_column
].
selection
!=
item
)
{
if
(
j
!=
active_subcolumn
&&
subcolumns
[
j
].
selection
==
item
&&
columns
[
j
].
selection
=
columns
[
active_column
].
selection
;
subcolumns
[
active_subcolumn
].
selection
!=
item
)
{
subcolumns
[
j
].
selection
=
subcolumns
[
active_subcolumn
].
selection
;
changes
=
true
;
changes
=
true
;
break
;
break
;
}
}
}
}
// update prefered dimension count?
// update prefered dimension count?
if
(
active_column
>
prefered_dimension_count
)
{
if
(
active_
sub
column
>
prefered_dimension_count
)
{
prefered_dimension_count
=
active_column
;
prefered_dimension_count
=
active_
sub
column
;
changes
=
true
;
changes
=
true
;
RefreshSelection
();
RefreshSelection
();
}
}
// decrease dimension count? (toggle last dimension)
// decrease dimension count? (toggle last dimension)
if
(
!
changes
&&
old_col
==
active_column
)
{
if
(
!
changes
&&
old_col
==
active_
sub
column
)
{
if
(
active_column
==
prefered_dimension_count
&&
prefered_dimension_count
>
1
)
{
if
(
active_
sub
column
==
prefered_dimension_count
&&
prefered_dimension_count
>
1
)
{
prefered_dimension_count
-=
1
;
prefered_dimension_count
-=
1
;
selectColumn
(
prefered_dimension_count
);
select
Sub
Column
(
prefered_dimension_count
);
changes
=
true
;
changes
=
true
;
}
else
if
(
active_column
!=
prefered_dimension_count
)
{
}
else
if
(
active_
sub
column
!=
prefered_dimension_count
)
{
active_
column
=
prefered_dimension_count
=
active_
column
;
active_
subcolumn
=
prefered_dimension_count
=
active_sub
column
;
RefreshSelection
();
RefreshSelection
();
changes
=
true
;
changes
=
true
;
}
}
...
@@ -210,11 +211,11 @@ void StatDimensionList::show(const GameP& game) {
...
@@ -210,11 +211,11 @@ void StatDimensionList::show(const GameP& game) {
// select first item
// select first item
if
(
dimension_count
>
0
)
{
if
(
dimension_count
>
0
)
{
for
(
int
j
=
0
;
j
<
dimension_count
;
++
j
)
{
for
(
int
j
=
0
;
j
<
dimension_count
;
++
j
)
{
columns
[
j
+
1
].
selection
=
itemCount
()
>
0
?
0
:
NO_SELECTION
;
sub
columns
[
j
+
1
].
selection
=
itemCount
()
>
0
?
0
:
NO_SELECTION
;
}
}
prefered_dimension_count
=
1
;
prefered_dimension_count
=
1
;
}
else
{
}
else
{
columns
[
0
].
selection
=
itemCount
()
>
0
?
0
:
NO_SELECTION
;
sub
columns
[
0
].
selection
=
itemCount
()
>
0
?
0
:
NO_SELECTION
;
}
}
}
}
...
...
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