mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 05:36:59 -04:00
fixed rotation bug
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@143 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -208,7 +208,7 @@ IMPLEMENT_REFLECTION(ChoiceStyle) {
|
|||||||
REFLECT(combine);
|
REFLECT(combine);
|
||||||
REFLECT(alignment);
|
REFLECT(alignment);
|
||||||
REFLECT(colors_card_list);
|
REFLECT(colors_card_list);
|
||||||
// REFLECT(font);
|
REFLECT(font);
|
||||||
REFLECT(choice_images);
|
REFLECT(choice_images);
|
||||||
// if (tag.reading() && choice_colors.empty())
|
// if (tag.reading() && choice_colors.empty())
|
||||||
REFLECT(choice_colors);
|
REFLECT(choice_colors);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include <util/prec.hpp>
|
#include <util/prec.hpp>
|
||||||
#include <util/defaultable.hpp>
|
#include <util/defaultable.hpp>
|
||||||
#include <data/field.hpp>
|
#include <data/field.hpp>
|
||||||
|
#include <data/font.hpp>
|
||||||
#include <gfx/gfx.hpp> // for ImageCombine
|
#include <gfx/gfx.hpp> // for ImageCombine
|
||||||
#include <script/scriptable.hpp>
|
#include <script/scriptable.hpp>
|
||||||
#include <script/image.hpp>
|
#include <script/image.hpp>
|
||||||
@@ -117,7 +118,7 @@ class ChoiceStyle : public Style {
|
|||||||
|
|
||||||
ChoicePopupStyle popup_style; ///< Style of popups/menus
|
ChoicePopupStyle popup_style; ///< Style of popups/menus
|
||||||
ChoiceRenderStyle render_style; ///< Style of rendering
|
ChoiceRenderStyle render_style; ///< Style of rendering
|
||||||
// FontInfo font; ///< Font for drawing text (when RENDER_TEXT)
|
Font font; ///< Font for drawing text (when RENDER_TEXT)
|
||||||
map<String,ScriptableImage> choice_images; ///< Images for the various choices (when RENDER_IMAGE)
|
map<String,ScriptableImage> choice_images; ///< Images for the various choices (when RENDER_IMAGE)
|
||||||
map<String,Color> choice_colors; ///< Colors for the various choices (when color_cardlist)
|
map<String,Color> choice_colors; ///< Colors for the various choices (when color_cardlist)
|
||||||
bool colors_card_list;///< Does this field determine colors of the rows in the card list?
|
bool colors_card_list;///< Does this field determine colors of the rows in the card list?
|
||||||
|
|||||||
@@ -82,12 +82,14 @@ void PackageList::clear() {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackageList::select(const String& name) {
|
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) {
|
||||||
selection = it - packages.begin();
|
selection = it - packages.begin();
|
||||||
update();
|
update();
|
||||||
sendEvent(EVENT_GALLERY_SELECT);
|
if (send_event) {
|
||||||
|
sendEvent(EVENT_GALLERY_SELECT);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class PackageList : public GalleryList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Select the package with the given name, if it is not found, selects nothing
|
/// Select the package with the given name, if it is not found, selects nothing
|
||||||
void select(const String& name);
|
void select(const String& name, bool send_event = true);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Return how many items there are in the list
|
/// Return how many items there are in the list
|
||||||
|
|||||||
@@ -402,8 +402,8 @@ void TextValueEditor::showCaret() {
|
|||||||
cursor = rot.tr(cursor);
|
cursor = rot.tr(cursor);
|
||||||
// set size
|
// set size
|
||||||
wxSize size = cursor.size();
|
wxSize size = cursor.size();
|
||||||
size.SetWidth (max(1, size.GetWidth()));
|
if (size.GetWidth() == 0) size.SetWidth (1);
|
||||||
size.SetHeight(max(1, size.GetHeight()));
|
if (size.GetHeight() == 0) size.SetHeight(1);
|
||||||
// resize, move, show
|
// resize, move, show
|
||||||
if (size != caret->GetSize()) {
|
if (size != caret->GetSize()) {
|
||||||
caret->SetSize(size);
|
caret->SetSize(size);
|
||||||
|
|||||||
@@ -80,6 +80,14 @@ RealPoint Rotation::trInv(const RealPoint& p) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RealSize Rotation::trInvNoNeg(const RealSize& s) const {
|
||||||
|
if (sideways()) {
|
||||||
|
return RealSize(s.height, s.width) / zoom;
|
||||||
|
} else {
|
||||||
|
return RealSize(s.width, s.height) / zoom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : Rotater
|
// ----------------------------------------------------------------------------- : Rotater
|
||||||
|
|
||||||
Rotater::Rotater(Rotation& rot, const Rotation& by)
|
Rotater::Rotater(Rotation& rot, const Rotation& by)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class Rotation {
|
|||||||
/// Change the angle
|
/// Change the angle
|
||||||
void setAngle(int a);
|
void setAngle(int a);
|
||||||
/// The internal size
|
/// The internal size
|
||||||
inline RealSize getInternalSize() const { return trInv(size); }
|
inline RealSize getInternalSize() const { return trInvNoNeg(size); }
|
||||||
/// The intarnal rectangle (origin at (0,0))
|
/// The intarnal rectangle (origin at (0,0))
|
||||||
inline RealRect getInternalRect() const { return RealRect(RealPoint(0,0), getInternalSize()); }
|
inline RealRect getInternalRect() const { return RealRect(RealPoint(0,0), getInternalSize()); }
|
||||||
/// The external rectangle (as passed to the constructor) == trNoNeg(getInternalRect())
|
/// The external rectangle (as passed to the constructor) == trNoNeg(getInternalRect())
|
||||||
@@ -64,6 +64,8 @@ class Rotation {
|
|||||||
RealPoint trInv(const RealPoint& p) const;
|
RealPoint trInv(const RealPoint& p) const;
|
||||||
/// Translate a size back to internal coordinates
|
/// Translate a size back to internal coordinates
|
||||||
RealSize trInv(const RealSize& s) const;
|
RealSize trInv(const RealSize& s) const;
|
||||||
|
/// Translate a size back to internal coordinates, that are not negative
|
||||||
|
RealSize trInvNoNeg(const RealSize& s) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int angle; ///< The angle of rotation in degrees (counterclockwise)
|
int angle; ///< The angle of rotation in degrees (counterclockwise)
|
||||||
|
|||||||
Reference in New Issue
Block a user