X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fobject.cpp;h=4cc846028a669576f12e8545214b54f69c1a4103;hb=7f3a6b11585376eecd80979ec3da2346c5314d88;hp=93af822b8476008c2f60e6158955078cdaf38c0d;hpb=e8987f4028a1f9c0eeb33a45bd11b2e409b9c2c5;p=architektonas diff --git a/src/object.cpp b/src/object.cpp index 93af822..4cc8460 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -33,17 +33,20 @@ bool Object::dontMove = false; bool Object::selectionInProgress = false; QRectF Object::selection; double Object::gridSpacing; +int Object::currentLayer = 0; +Point Object::snapPoint; +bool Object::snapPointIsValid = false; Object::Object(): position(Vector(0, 0)), parent(0), type(OTObject), - state(OSInactive), oldState(OSInactive), needUpdate(false) + state(OSInactive), layer(0), oldState(OSInactive), needUpdate(false) //, attachedDimension(0) { } Object::Object(Vector v, Object * passedInParent/*= 0*/): position(v), - parent(passedInParent), state(OSInactive), oldState(OSInactive), + parent(passedInParent), state(OSInactive), layer(0), oldState(OSInactive), needUpdate(false)//, attachedDimension(0) { } @@ -74,8 +77,9 @@ printf("Object: Destroyed!\n"); } -/*virtual*/ void Object::PointerMoved(Vector) +/*virtual*/ bool Object::PointerMoved(Vector) { + return false; } @@ -144,22 +148,24 @@ printf("Object: Destroyed!\n"); // them here. :-) /*virtual*/ void Object::Connect(Object * obj, double parameter) { - connected.push_back(Connection(obj, parameter)); + // Check to see if this connection is already in our list... + Connection c(obj, parameter); + std::vector::iterator i; + + for(i=connected.begin(); i!=connected.end(); i++) + { + // Bail out if this connection is already present... + if (*i == c) + return; + } + + // Connection is a new one, add it in... + connected.push_back(c); } /*virtual*/ void Object::Disconnect(Object * obj, double parameter) { -#if 0 - for(uint i=0; i::iterator i; for(i=connected.begin(); i!=connected.end(); i++) @@ -170,25 +176,11 @@ printf("Object: Destroyed!\n"); return; } } -#endif } /*virtual*/ void Object::DisconnectAll(Object * obj) { -#if 0 - // According the std::vector docs, only items at position i and beyond are - // invalidated, everything before i is still valid. So we use that here. - for(uint i=0; i::iterator i; for(i=connected.begin(); i!=connected.end(); ) @@ -198,7 +190,6 @@ printf("Object: Destroyed!\n"); else i++; } -#endif } @@ -223,13 +214,30 @@ printf("Object: Destroyed!\n"); } -/*virtual*/ void Object::Rotate(Vector, double) +/*virtual*/ void Object::Rotate(Point, double) +{ +} + + +/*virtual*/ void Object::Scale(Point, double) +{ +} + + +/*virtual*/ void Object::Mirror(Point, Point) +{ +} + + +/*virtual*/ void Object::Save(void) { + oldPosition = position; } -/*virtual*/ void Object::Scale(Vector, double) +/*virtual*/ void Object::Restore(void) { + position = oldPosition; }