mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
Implemented rotation and reflection
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@536 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -235,7 +235,7 @@ void SymbolControl::onChar(wxKeyEvent& ev) {
|
||||
|
||||
void SymbolControl::onSize(wxSizeEvent& ev) {
|
||||
wxSize s = GetClientSize();
|
||||
rotation.setZoom(min(s.GetWidth(), s.GetHeight()));
|
||||
setZoom(min(s.GetWidth(), s.GetHeight()));
|
||||
Refresh(false);
|
||||
}
|
||||
void SymbolControl::onUpdateUI(wxUpdateUIEvent& ev) {
|
||||
@@ -248,6 +248,9 @@ void SymbolControl::onUpdateUI(wxUpdateUIEvent& ev) {
|
||||
// can only edit points when a shape is available
|
||||
ev.Enable(selected_parts.getAShape());
|
||||
}
|
||||
if (ev.GetId() == ID_MODE_SYMMETRY) {
|
||||
ev.Enable(!selected_parts.empty());
|
||||
}
|
||||
break;
|
||||
case ID_MODE_PAINT:
|
||||
ev.Enable(false); // TODO
|
||||
|
||||
@@ -24,10 +24,11 @@ void SymbolPartsSelection::clear() {
|
||||
}
|
||||
|
||||
bool SymbolPartsSelection::select(const SymbolPartP& part, SelectMode mode) {
|
||||
assert(part);
|
||||
// make sure part is not the decendent of a part that is already selected
|
||||
if (mode != SELECT_OVERRIDE) {
|
||||
FOR_EACH(s, selection) {
|
||||
if (isAncestor(s.get(), part.get())) return false;
|
||||
if (s != part && s->isAncestor(*part)) return false;
|
||||
}
|
||||
}
|
||||
// select
|
||||
@@ -70,15 +71,6 @@ void SymbolPartsSelection::clearChildren(SymbolPart* part) {
|
||||
}
|
||||
}
|
||||
|
||||
bool SymbolPartsSelection::isAncestor(SymbolPart* ancestor, SymbolPart* part) {
|
||||
if (SymbolGroup* g = ancestor->isSymbolGroup()) {
|
||||
FOR_EACH(p, g->parts) {
|
||||
if (part == p.get()) return true;
|
||||
if (isAncestor(p.get(), part)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Position based
|
||||
|
||||
@@ -116,7 +108,7 @@ bool SymbolPartsSelection::selectRect(const Vector2D& a, const Vector2D& b, cons
|
||||
}
|
||||
bool SymbolPartsSelection::selectRect(const SymbolGroup& parent, const Vector2D& a, const Vector2D& b, const Vector2D& c) {
|
||||
bool changes = false;
|
||||
FOR_EACH_CONST(p, root->parts) {
|
||||
FOR_EACH_CONST(p, parent.parts) {
|
||||
bool in_ab = (p->min_pos.x >= min(a.x, b.x) && p->min_pos.y >= min(a.y, b.y) && p->max_pos.x <= max(a.x, b.x) && p->max_pos.y <= max(a.y, b.y));
|
||||
bool in_bc = (p->min_pos.x >= min(a.x, c.x) && p->min_pos.y >= min(a.y, c.y) && p->max_pos.x <= max(a.x, c.x) && p->max_pos.y <= max(a.y, c.y));
|
||||
if (in_ab != in_bc) {
|
||||
|
||||
@@ -73,8 +73,6 @@ class SymbolPartsSelection {
|
||||
|
||||
/// Make sure not both a parent and its child/decendant are selected
|
||||
void clearChildren (SymbolPart* part);
|
||||
/// Is a part another's ancestor?
|
||||
static bool isAncestor(SymbolPart* ancestor, SymbolPart* part);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
/// Editor for adding symmetries
|
||||
class SymbolSymmetryEditor : public SymbolEditorBase {
|
||||
public:
|
||||
/** The symmetry parameter is optional, if it is not set, then only new ones can be created */
|
||||
//%SymbolSymmetryEditor(SymbolControl* control, SymbolSymmetryP symmetry);
|
||||
SymbolSymmetryEditor(SymbolControl* control);
|
||||
|
||||
// --------------------------------------------------- : Drawing
|
||||
|
||||
@@ -29,7 +29,7 @@ SymbolWindow::SymbolWindow(Window* parent) {
|
||||
|
||||
SymbolWindow::SymbolWindow(Window* parent, const String& filename) {
|
||||
// open file
|
||||
Reader reader(filename);
|
||||
Reader reader(new_shared1<wxFileInputStream>(filename), filename);
|
||||
SymbolP symbol;
|
||||
reader.handle_greedy(symbol);
|
||||
init(parent, symbol);
|
||||
|
||||
Reference in New Issue
Block a user