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
79f45db2
Commit
79f45db2
authored
May 14, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some more statistics tweaks;
Another minor fix for alignment of sorted columns
parent
c06e2254
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
26 deletions
+66
-26
data/magic.mse-game/game
data/magic.mse-game/game
+12
-0
src/gui/control/card_list.cpp
src/gui/control/card_list.cpp
+1
-4
src/gui/control/graph.cpp
src/gui/control/graph.cpp
+51
-20
src/gui/control/item_list.hpp
src/gui/control/item_list.hpp
+2
-2
No files found.
data/magic.mse-game/game
View file @
79f45db2
...
@@ -1044,6 +1044,18 @@ statistics category:
...
@@ -1044,6 +1044,18 @@ statistics category:
dimension: card color
dimension: card color
dimension: converted mana cost
dimension: converted mana cost
statistics category:
name: color / colored cost
type: scatter
dimension: card color
dimension: colored mana cost
statistics category:
name: cost / colored cost
type: scatter
dimension: converted mana cost
dimension: colored mana cost
#statistics field:
#statistics field:
# name: creature type
# name: creature type
# data 1:
# data 1:
...
...
src/gui/control/card_list.cpp
View file @
79f45db2
...
@@ -209,10 +209,7 @@ void CardListBase::rebuild() {
...
@@ -209,10 +209,7 @@ void CardListBase::rebuild() {
// we are sorting by this column
// we are sorting by this column
sort_by_column
=
i
;
sort_by_column
=
i
;
// and display an arrow in the header
// and display an arrow in the header
wxListItem
li
;
SetColumnImage
(
i
,
sort_ascending
?
0
:
1
);
li
.
m_mask
=
wxLIST_MASK_IMAGE
;
li
.
m_image
=
sort_ascending
?
0
:
1
;
// arrow up/down
SetColumn
(
i
,
li
);
}
}
++
i
;
++
i
;
}
}
...
...
src/gui/control/graph.cpp
View file @
79f45db2
...
@@ -224,9 +224,9 @@ void BarGraph::draw(RotatedDC& dc, int current, DrawLayer layer) const {
...
@@ -224,9 +224,9 @@ void BarGraph::draw(RotatedDC& dc, int current, DrawLayer layer) const {
RealRect
bar
=
bar_graph_bar
(
rect
,
current
,
count
,
0
,
group
.
size
,
axis
.
max
);
RealRect
bar
=
bar_graph_bar
(
rect
,
current
,
count
,
0
,
group
.
size
,
axis
.
max
);
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
dc
.
SetBrush
(
lerp
(
bg
,
group
.
color
,
0.25
));
dc
.
SetBrush
(
lerp
(
bg
,
group
.
color
,
0.25
));
dc
.
DrawRectangle
(
bar
.
move
(
-
5
,
-
5
,
10
,
10
));
dc
.
DrawRectangle
(
bar
.
move
(
-
5
,
-
5
,
10
,
5
));
dc
.
SetBrush
(
lerp
(
bg
,
group
.
color
,
0.5
));
dc
.
SetBrush
(
lerp
(
bg
,
group
.
color
,
0.5
));
dc
.
DrawRectangle
(
bar
.
move
(
-
2
,
-
2
,
4
,
4
));
dc
.
DrawRectangle
(
bar
.
move
(
-
2
,
-
2
,
4
,
2
));
}
}
}
else
if
(
layer
==
LAYER_VALUES
)
{
}
else
if
(
layer
==
LAYER_VALUES
)
{
// Draw bars
// Draw bars
...
@@ -406,8 +406,8 @@ void ScatterGraph::draw(RotatedDC& dc, const vector<int>& current, DrawLayer lay
...
@@ -406,8 +406,8 @@ void ScatterGraph::draw(RotatedDC& dc, const vector<int>& current, DrawLayer lay
RealSize
size
(
rect
.
width
/
axis1
.
groups
.
size
(),
rect
.
height
/
axis2
.
groups
.
size
());
// size for a single cell
RealSize
size
(
rect
.
width
/
axis1
.
groups
.
size
(),
rect
.
height
/
axis2
.
groups
.
size
());
// size for a single cell
double
step
=
min
(
size
.
width
,
size
.
height
)
/
sqrt
((
double
)
max_value
)
/
2.01
;
double
step
=
min
(
size
.
width
,
size
.
height
)
/
sqrt
((
double
)
max_value
)
/
2.01
;
// Draw
// Draw
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
if
(
layer
==
LAYER_SELECTION
)
{
if
(
layer
==
LAYER_SELECTION
)
{
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
Color
bg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
);
Color
bg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
);
int
cur1
=
this
->
axis1
<
current
.
size
()
?
current
[
this
->
axis1
]
:
-
1
;
int
cur1
=
this
->
axis1
<
current
.
size
()
?
current
[
this
->
axis1
]
:
-
1
;
int
cur2
=
this
->
axis2
<
current
.
size
()
?
current
[
this
->
axis2
]
:
-
1
;
int
cur2
=
this
->
axis2
<
current
.
size
()
?
current
[
this
->
axis2
]
:
-
1
;
...
@@ -425,6 +425,8 @@ void ScatterGraph::draw(RotatedDC& dc, const vector<int>& current, DrawLayer lay
...
@@ -425,6 +425,8 @@ void ScatterGraph::draw(RotatedDC& dc, const vector<int>& current, DrawLayer lay
dc
.
DrawRectangle
(
RealRect
(
rect
.
x
,
rect
.
bottom
()
-
(
cur2
+
1
)
*
size
.
height
,
rect
.
width
,
size
.
height
));
dc
.
DrawRectangle
(
RealRect
(
rect
.
x
,
rect
.
bottom
()
-
(
cur2
+
1
)
*
size
.
height
,
rect
.
width
,
size
.
height
));
}
}
}
else
{
}
else
{
Color
fg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOWTEXT
);
dc
.
SetPen
(
fg
);
size_t
i
=
0
;
size_t
i
=
0
;
double
x
=
rect
.
left
();
double
x
=
rect
.
left
();
FOR_EACH_CONST
(
g1
,
axis1
.
groups
)
{
FOR_EACH_CONST
(
g1
,
axis1
.
groups
)
{
...
@@ -475,9 +477,24 @@ void GraphLabelAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
...
@@ -475,9 +477,24 @@ void GraphLabelAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
int
count
=
int
(
axis
.
groups
.
size
());
int
count
=
int
(
axis
.
groups
.
size
());
// Draw
// Draw
dc
.
SetFont
(
*
wxNORMAL_FONT
);
dc
.
SetFont
(
*
wxNORMAL_FONT
);
if
(
layer
==
LAYER_SELECTION
)
{
Color
bg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
);
Color
fg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOWTEXT
);
if
(
layer
==
LAYER_SELECTION
&&
current
>=
0
)
{
// highlight selection
// highlight selection
}
else
if
(
layer
!=
LAYER_AXES
)
{
GraphGroup
&
group
=
axis
.
groups
[
current
];
if
(
direction
==
HORIZONTAL
)
{
double
width
=
rect
.
width
/
count
;
// width of an item
dc
.
SetBrush
(
lerp
(
bg
,
group
.
color
,
0.5
));
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
RealSize
text_size
=
dc
.
GetTextExtent
(
group
.
name
);
dc
.
DrawRectangle
(
RealRect
(
rect
.
x
+
current
*
width
,
rect
.
bottom
(),
width
,
text_size
.
height
+
5
));
}
else
{
double
height
=
rect
.
height
/
count
;
dc
.
SetBrush
(
lerp
(
bg
,
group
.
color
,
0.5
));
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
dc
.
DrawRectangle
(
RealRect
(
rect
.
x
,
rect
.
bottom
()
-
(
current
+
1
)
*
height
,
-
78
,
height
));
}
}
else
if
(
layer
==
LAYER_AXES
)
{
if
(
direction
==
HORIZONTAL
)
{
if
(
direction
==
HORIZONTAL
)
{
double
width
=
rect
.
width
/
count
;
// width of an item
double
width
=
rect
.
width
/
count
;
// width of an item
// Draw labels
// Draw labels
...
@@ -491,11 +508,9 @@ void GraphLabelAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
...
@@ -491,11 +508,9 @@ void GraphLabelAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
x
+=
width
;
x
+=
width
;
}
}
// Draw lines
// Draw lines
Color
bg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
);
Color
fg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOWTEXT
);
if
(
draw_lines
)
{
if
(
draw_lines
)
{
dc
.
SetPen
(
lerp
(
bg
,
fg
,
0.5
));
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
dc
.
SetPen
(
i
==
current
?
fg
:
lerp
(
bg
,
fg
,
0.3
));
if
(
draw_lines
==
DRAW_LINES_BETWEEN
)
{
if
(
draw_lines
==
DRAW_LINES_BETWEEN
)
{
dc
.
DrawLine
(
RealPoint
(
rect
.
x
+
(
i
+
1.0
)
*
width
,
rect
.
top
()),
RealPoint
(
rect
.
x
+
(
i
+
1.0
)
*
width
,
rect
.
bottom
()));
dc
.
DrawLine
(
RealPoint
(
rect
.
x
+
(
i
+
1.0
)
*
width
,
rect
.
top
()),
RealPoint
(
rect
.
x
+
(
i
+
1.0
)
*
width
,
rect
.
bottom
()));
}
else
{
}
else
{
...
@@ -507,11 +522,11 @@ void GraphLabelAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
...
@@ -507,11 +522,11 @@ void GraphLabelAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
dc
.
SetPen
(
fg
);
dc
.
SetPen
(
fg
);
dc
.
DrawLine
(
rect
.
topLeft
(),
rect
.
bottomLeft
());
dc
.
DrawLine
(
rect
.
topLeft
(),
rect
.
bottomLeft
());
}
else
{
}
else
{
double
height
=
rect
.
height
/
count
;
// width of an item
double
height
=
rect
.
height
/
count
;
// Draw labels
// Draw labels
double
y
=
rect
.
bottom
();
double
y
=
rect
.
bottom
();
FOR_EACH_CONST
(
g
,
axis
.
groups
)
{
FOR_EACH_CONST
(
g
,
axis
.
groups
)
{
// draw label, aligned
bottom center
// draw label, aligned
middle right
RealSize
text_size
=
dc
.
GetTextExtent
(
g
.
name
);
RealSize
text_size
=
dc
.
GetTextExtent
(
g
.
name
);
//dc.SetClippingRegion(RealRect(x + 2, rect.bottom() + 3, width - 4, text_size.height));
//dc.SetClippingRegion(RealRect(x + 2, rect.bottom() + 3, width - 4, text_size.height));
dc
.
DrawText
(
g
.
name
,
align_in_rect
(
ALIGN_MIDDLE_RIGHT
,
text_size
,
RealRect
(
-
4
,
y
,
0
,
-
height
)));
dc
.
DrawText
(
g
.
name
,
align_in_rect
(
ALIGN_MIDDLE_RIGHT
,
text_size
,
RealRect
(
-
4
,
y
,
0
,
-
height
)));
...
@@ -519,11 +534,9 @@ void GraphLabelAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
...
@@ -519,11 +534,9 @@ void GraphLabelAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
y
-=
height
;
y
-=
height
;
}
}
// Draw lines
// Draw lines
Color
bg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
);
Color
fg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOWTEXT
);
if
(
draw_lines
)
{
if
(
draw_lines
)
{
dc
.
SetPen
(
lerp
(
bg
,
fg
,
0.5
));
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
dc
.
SetPen
(
i
==
current
?
fg
:
lerp
(
bg
,
fg
,
0.3
));
if
(
draw_lines
==
DRAW_LINES_BETWEEN
)
{
if
(
draw_lines
==
DRAW_LINES_BETWEEN
)
{
dc
.
DrawLine
(
RealPoint
(
rect
.
left
(),
rect
.
bottom
()
-
(
i
+
1.0
)
*
height
),
RealPoint
(
rect
.
right
(),
rect
.
bottom
()
-
(
i
+
1.0
)
*
height
));
dc
.
DrawLine
(
RealPoint
(
rect
.
left
(),
rect
.
bottom
()
-
(
i
+
1.0
)
*
height
),
RealPoint
(
rect
.
right
(),
rect
.
bottom
()
-
(
i
+
1.0
)
*
height
));
}
else
{
}
else
{
...
@@ -561,20 +574,38 @@ void GraphValueAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
...
@@ -561,20 +574,38 @@ void GraphValueAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
GraphAxis
&
axis
=
axis_data
();
GraphAxis
&
axis
=
axis_data
();
double
step_height
=
rect
.
height
/
axis
.
max
;
// height of a single value
double
step_height
=
rect
.
height
/
axis
.
max
;
// height of a single value
dc
.
SetFont
(
*
wxNORMAL_FONT
);
dc
.
SetFont
(
*
wxNORMAL_FONT
);
UInt
label_step
=
(
UInt
)
floor
(
max
(
1.0
,
(
dc
.
GetCharHeight
()
+
1
)
/
step_height
));
// values per labeled line
int
label_step
=
ceil
(
max
(
1.0
,
(
dc
.
GetCharHeight
()
)
/
step_height
));
// values per labeled line
// Colors
// Colors
Color
bg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
);
Color
bg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
);
Color
fg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOWTEXT
);
Color
fg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOWTEXT
);
// Draw backlines (horizontal) and value labels
// Draw backlines (horizontal) and value labels
dc
.
SetPen
(
lerp
(
bg
,
fg
,
0.5
));
dc
.
SetPen
(
lerp
(
bg
,
fg
,
0.3
));
for
(
UInt
i
=
0
;
i
<=
axis
.
max
;
++
i
)
{
int
highlight
=
current
>=
0
?
(
int
)
axis
.
groups
[
current
].
size
:
-
1
;
if
(
i
%
label_step
==
0
)
{
for
(
int
i
=
0
;
i
<=
(
int
)
axis
.
max
;
++
i
)
{
if
(
i
%
label_step
==
0
||
i
==
highlight
)
{
// highlight?
if
(
i
==
highlight
)
{
wxFont
font
(
*
wxNORMAL_FONT
);
font
.
SetWeight
(
wxBOLD
);
dc
.
SetFont
(
font
);
dc
.
SetPen
(
fg
);
}
// draw line
int
y
=
rect
.
bottom
()
-
i
*
step_height
;
int
y
=
rect
.
bottom
()
-
i
*
step_height
;
dc
.
DrawLine
(
RealPoint
(
rect
.
left
()
-
2
,
y
),
RealPoint
(
rect
.
right
(),
y
));
dc
.
DrawLine
(
RealPoint
(
rect
.
left
()
-
2
,
y
),
RealPoint
(
rect
.
right
(),
y
));
// draw label, aligned middle right
// draw label, aligned middle right
String
label
;
label
<<
i
;
if
(
!
((
i
<
highlight
&&
i
+
label_step
>
highlight
)
||
RealSize
text_size
=
dc
.
GetTextExtent
(
label
);
(
i
>
highlight
&&
i
-
label_step
<
highlight
))
||
current
==
-
1
)
{
dc
.
DrawText
(
label
,
align_in_rect
(
ALIGN_MIDDLE_RIGHT
,
text_size
,
RealRect
(
rect
.
x
-
4
,
y
,
0
,
0
)));
// don't draw labels before/after current to make room
String
label
;
label
<<
i
;
RealSize
text_size
=
dc
.
GetTextExtent
(
label
);
dc
.
DrawText
(
label
,
align_in_rect
(
ALIGN_MIDDLE_RIGHT
,
text_size
,
RealRect
(
rect
.
x
-
4
,
y
,
0
,
0
)));
}
// restore font/pen
if
(
i
==
highlight
)
{
dc
.
SetFont
(
*
wxNORMAL_FONT
);
dc
.
SetPen
(
lerp
(
bg
,
fg
,
0.5
));
}
}
}
}
}
// Draw axis
// Draw axis
...
...
src/gui/control/item_list.hpp
View file @
79f45db2
...
@@ -69,6 +69,8 @@ class ItemList : public wxListView {
...
@@ -69,6 +69,8 @@ class ItemList : public wxListView {
void
sortBy
(
long
column
,
bool
ascending
);
void
sortBy
(
long
column
,
bool
ascending
);
/// Refresh the card list (resort, refresh and reselect current item)
/// Refresh the card list (resort, refresh and reselect current item)
void
refreshList
();
void
refreshList
();
/// Set the image of a column header (fixes wx bug)
void
SetColumnImage
(
int
col
,
int
image
);
/// Select an item, send an event to the parent
/// Select an item, send an event to the parent
/** If focus then the item is also focused and selected in the actual control.
/** If focus then the item is also focused and selected in the actual control.
...
@@ -92,8 +94,6 @@ class ItemList : public wxListView {
...
@@ -92,8 +94,6 @@ class ItemList : public wxListView {
private:
private:
struct
ItemComparer
;
// for comparing items
struct
ItemComparer
;
// for comparing items
void
SetColumnImage
(
int
col
,
int
image
);
// --------------------------------------------------- : Window events
// --------------------------------------------------- : Window events
DECLARE_EVENT_TABLE
();
DECLARE_EVENT_TABLE
();
...
...
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