mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 21:27:01 -04:00
Added 'angle' property for choice fields
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@315 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -165,6 +165,7 @@ ChoiceStyle::ChoiceStyle(const ChoiceFieldP& field)
|
|||||||
, colors_card_list(false)
|
, colors_card_list(false)
|
||||||
, combine(COMBINE_NORMAL)
|
, combine(COMBINE_NORMAL)
|
||||||
, alignment(ALIGN_STRETCH)
|
, alignment(ALIGN_STRETCH)
|
||||||
|
, angle(0)
|
||||||
, thumbnails(nullptr)
|
, thumbnails(nullptr)
|
||||||
, thumbnail_age(1) // thumbnails were made before the beginning of time
|
, thumbnail_age(1) // thumbnails were made before the beginning of time
|
||||||
, invalidated_images(false)
|
, invalidated_images(false)
|
||||||
@@ -231,6 +232,7 @@ IMPLEMENT_REFLECTION(ChoiceStyle) {
|
|||||||
REFLECT_N("mask",mask_filename);
|
REFLECT_N("mask",mask_filename);
|
||||||
REFLECT(combine);
|
REFLECT(combine);
|
||||||
REFLECT(alignment);
|
REFLECT(alignment);
|
||||||
|
REFLECT(angle);
|
||||||
REFLECT(colors_card_list);
|
REFLECT(colors_card_list);
|
||||||
REFLECT(font);
|
REFLECT(font);
|
||||||
REFLECT(choice_images);
|
REFLECT(choice_images);
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ class ChoiceStyle : public Style {
|
|||||||
ImageCombine combine; ///< Combining mode for drawing the images
|
ImageCombine combine; ///< Combining mode for drawing the images
|
||||||
Alignment alignment; ///< Alignment of images
|
Alignment alignment; ///< Alignment of images
|
||||||
Image mask; ///< The actual mask image
|
Image mask; ///< The actual mask image
|
||||||
|
int angle; ///< Angle by which the images are rotated
|
||||||
wxImageList* thumbnails; ///< Thumbnails for the choices
|
wxImageList* thumbnails; ///< Thumbnails for the choices
|
||||||
Age thumbnail_age; ///< Age the thumbnails were generated
|
Age thumbnail_age; ///< Age the thumbnails were generated
|
||||||
bool invalidated_images; ///< Have the images been invalidated?
|
bool invalidated_images; ///< Have the images been invalidated?
|
||||||
|
|||||||
@@ -83,13 +83,10 @@ struct Rotate270 {
|
|||||||
// ----------------------------------------------------------------------------- : Interface
|
// ----------------------------------------------------------------------------- : Interface
|
||||||
|
|
||||||
Image rotate_image(const Image& image, int angle) {
|
Image rotate_image(const Image& image, int angle) {
|
||||||
if (angle == 90) {
|
switch (angle % 360) {
|
||||||
return rotate_image_impl<Rotate90>(image);
|
case 90: return rotate_image_impl<Rotate90> (image);
|
||||||
} else if (angle == 180){
|
case 180: return rotate_image_impl<Rotate180>(image);
|
||||||
return rotate_image_impl<Rotate180>(image);
|
case 270: return rotate_image_impl<Rotate270>(image);
|
||||||
} else if (angle == 270){
|
default: return image;
|
||||||
return rotate_image_impl<Rotate270>(image);
|
|
||||||
} else{
|
|
||||||
return image;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ void ChoiceValueViewer::draw(RotatedDC& dc) {
|
|||||||
// draw
|
// draw
|
||||||
dc.DrawImage(i->image,
|
dc.DrawImage(i->image,
|
||||||
align_in_rect(style().alignment, RealSize(i->image.GetWidth(), i->image.GetHeight()), style().getRect()),
|
align_in_rect(style().alignment, RealSize(i->image.GetWidth(), i->image.GetHeight()), style().getRect()),
|
||||||
i->combine == COMBINE_NORMAL ? style().combine : i->combine
|
i->combine == COMBINE_NORMAL ? style().combine : i->combine,
|
||||||
|
style().angle
|
||||||
);
|
);
|
||||||
margin = dc.trInvS(i->image.GetWidth()) + 1;
|
margin = dc.trInvS(i->image.GetWidth()) + 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,8 +151,8 @@ void RotatedDC::DrawBitmap(const Bitmap& bitmap, const RealPoint& pos) {
|
|||||||
DrawImage(bitmap.ConvertToImage(), pos);
|
DrawImage(bitmap.ConvertToImage(), pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void RotatedDC::DrawImage (const Image& image, const RealPoint& pos, ImageCombine combine) {
|
void RotatedDC::DrawImage (const Image& image, const RealPoint& pos, ImageCombine combine, int angle) {
|
||||||
Image rotated = rotate_image(image, angle);
|
Image rotated = rotate_image(image, angle + this->angle);
|
||||||
wxRect r = trNoNegNoZoom(RealRect(pos, RealSize(image.GetWidth(), image.GetHeight())));
|
wxRect r = trNoNegNoZoom(RealRect(pos, RealSize(image.GetWidth(), image.GetHeight())));
|
||||||
draw_combine_image(dc, r.x, r.y, rotated, combine);
|
draw_combine_image(dc, r.x, r.y, rotated, combine);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ class RotatedDC : public Rotation {
|
|||||||
/// Draw abitmap, it must already be zoomed!
|
/// Draw abitmap, it must already be zoomed!
|
||||||
void DrawBitmap(const Bitmap& bitmap, const RealPoint& pos);
|
void DrawBitmap(const Bitmap& bitmap, const RealPoint& pos);
|
||||||
/// Draw an image using the given combining mode, the image must already be zoomed!
|
/// Draw an image using the given combining mode, the image must already be zoomed!
|
||||||
void DrawImage (const Image& image, const RealPoint& pos, ImageCombine combine = COMBINE_NORMAL);
|
void DrawImage (const Image& image, const RealPoint& pos, ImageCombine combine = COMBINE_NORMAL, int angle = 0);
|
||||||
void DrawLine (const RealPoint& p1, const RealPoint& p2);
|
void DrawLine (const RealPoint& p1, const RealPoint& p2);
|
||||||
void DrawRectangle(const RealRect& r);
|
void DrawRectangle(const RealRect& r);
|
||||||
void DrawRoundedRectangle(const RealRect& r, double radius);
|
void DrawRoundedRectangle(const RealRect& r, double radius);
|
||||||
|
|||||||
Reference in New Issue
Block a user