Added support for custom colors for graphs;

Moved 'choice colors' from styel to field, split into 'choice colors' and 'choice colors cardlist';
Added support for pie graphs (no gui to use them, though);
Fixed bugs caused by selecting a card before the set was changed on all panels.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@336 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-11 14:10:29 +00:00
parent f9eade95eb
commit 3b6743b110
33 changed files with 634 additions and 186 deletions
+25
View File
@@ -172,6 +172,31 @@ void RotatedDC::DrawRoundedRectangle(const RealRect& r, double radius) {
dc.DrawRoundedRectangle(r_ext.x, r_ext.y, r_ext.width, r_ext.height, trS(radius));
}
/// Convert radians to degrees
double rad_to_deg(double rad) { return rad * (180.0 / M_PI); }
/// Convert degrees to radians
double deg_to_rad(double deg) { return deg * (M_PI / 180.0); }
void RotatedDC::DrawEllipticArc(const RealPoint& center, const RealSize& size, double start, double end) {
wxPoint c_ext = tr(center - size/2);
wxSize s_ext = trNoNeg(size);
dc.DrawEllipticArc(c_ext.x, c_ext.y, s_ext.x, s_ext.y, rad_to_deg(start) + angle, rad_to_deg(end) + angle);
}
void RotatedDC::DrawEllipticSpoke(const RealPoint& center, const RealSize& size, double angle) {
wxPoint c_ext = tr(center - size/2);
wxSize s_ext = trNoNeg(size);
double rot_angle = angle + deg_to_rad(this->angle);
double sin_angle = sin(rot_angle), cos_angle = cos(rot_angle);
// position of center and of point on the boundary can vary because of rounding errors,
// this code matches DrawEllipticArc (at least on windows xp).
dc.DrawLine(
c_ext.x + int( 0.5 * (s_ext.x + cos_angle) ), // center
c_ext.y + int( 0.5 * (s_ext.y - sin_angle) ),
c_ext.x + int( 0.5 + 0.5 * (s_ext.x-1) * (1 + cos_angle) ), // boundary
c_ext.y + int( 0.5 + 0.5 * (s_ext.y-1) * (1 - sin_angle) )
);
}
// ----------------------------------------------------------------------------- : Forwarded properties
void RotatedDC::SetPen(const wxPen& pen) { dc.SetPen(pen); }
+4
View File
@@ -146,6 +146,10 @@ class RotatedDC : public Rotation {
void DrawLine (const RealPoint& p1, const RealPoint& p2);
void DrawRectangle(const RealRect& r);
void DrawRoundedRectangle(const RealRect& r, double radius);
/// Draw an arc of an ellipse, angles are in radians
void DrawEllipticArc(const RealPoint& center, const RealSize& size, double start, double end);
/// Draw spokes of an ellipse
void DrawEllipticSpoke(const RealPoint& center, const RealSize& size, double start);
// Fill the dc with the color of the current brush
void Fill();
+5 -5
View File
@@ -57,11 +57,11 @@ enum MenuID {
// Window menu (MainWindow)
, ID_WINDOW_NEW = 201
, ID_WINDOW_MIN = 202
, ID_WINDOW_CARDS = ID_WINDOW_MIN + 4 // see SetWindow::SetWindow
, ID_WINDOW_SET = ID_WINDOW_MIN + 0
, ID_WINDOW_STYLE = ID_WINDOW_MIN + 1
, ID_WINDOW_KEYWORDS = ID_WINDOW_MIN + 2
, ID_WINDOW_STATS = ID_WINDOW_MIN + 3
, ID_WINDOW_CARDS = ID_WINDOW_MIN + 0
, ID_WINDOW_SET = ID_WINDOW_MIN + 1
, ID_WINDOW_STYLE = ID_WINDOW_MIN + 2
, ID_WINDOW_KEYWORDS = ID_WINDOW_MIN + 3
, ID_WINDOW_STATS = ID_WINDOW_MIN + 4
, ID_WINDOW_MAX = 220
// Help menu (MainWindow)