X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fobject.cpp;h=4cc846028a669576f12e8545214b54f69c1a4103;hb=7f3a6b11585376eecd80979ec3da2346c5314d88;hp=dd80007d1998cc4c4772848c35580a53fe2f9859;hpb=a42277d4d950d32459b16b3ec8ee8287c9c0afab;p=architektonas diff --git a/src/object.cpp b/src/object.cpp index dd80007..4cc8460 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -34,6 +34,8 @@ 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), @@ -75,8 +77,9 @@ printf("Object: Destroyed!\n"); } -/*virtual*/ void Object::PointerMoved(Vector) +/*virtual*/ bool Object::PointerMoved(Vector) { + return false; } @@ -145,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++) @@ -171,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(); ) @@ -199,7 +190,6 @@ printf("Object: Destroyed!\n"); else i++; } -#endif } @@ -224,19 +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::Scale(Vector, double) +/*virtual*/ void Object::Save(void) { + oldPosition = position; } -/*virtual*/ Object * Object::Mirror(Vector, Vector) +/*virtual*/ void Object::Restore(void) { - return NULL; + position = oldPosition; }