X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fobject.cpp;h=fc8d834cf08fddeac06add6323008458647f26c8;hb=bb8d0671717bac2c5350e34024273381be1d8175;hp=03d1f70eb47565271e7ac94070e29ea0834c2eed;hpb=043ecf4d074909ba2f7f53237962f9eaa72f19c2;p=architektonas diff --git a/src/object.cpp b/src/object.cpp index 03d1f70..fc8d834 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -16,6 +16,7 @@ // #include "object.h" +#include // Initialize static variables bool Object::fixedAngle = false; @@ -24,73 +25,204 @@ QFont * Object::font = 0; int Object::viewportHeight = 0; bool Object::deleteActive = false; bool Object::dimensionActive = false; +bool Object::snapToGrid = true; +//snapToPoints all well here? +bool Object::ignoreClicks = false; +bool Object::dontMove = false; +bool Object::selectionInProgress = false; +QRectF Object::selection; -Object::Object(): position(Vector(0, 0)), parent(0), state(OSInactive), oldState(OSInactive), - needUpdate(false), attachedDimension(0) +Object::Object(): position(Vector(0, 0)), parent(0), type(OTObject), + state(OSInactive), oldState(OSInactive), needUpdate(false) + //, attachedDimension(0) { } + Object::Object(Vector v, Object * passedInParent/*= 0*/): position(v), parent(passedInParent), - state(OSInactive), oldState(OSInactive), needUpdate(false), attachedDimension(0) + state(OSInactive), oldState(OSInactive), needUpdate(false)//, attachedDimension(0) { } + Object::~Object() { +printf("Object: Destroyed!\n"); + for(uint i=0; iDisconnectAll(this); } + /*virtual*/ void Object::Draw(Painter *) { } + /*virtual*/ Vector Object::Center(void) { return Vector(); } + /*virtual*/ bool Object::Collided(Vector) { return false; } + /*virtual*/ void Object::PointerMoved(Vector) { } + /*virtual*/ void Object::PointerReleased(void) { } + /*virtual*/ bool Object::NeedsUpdate(void) { return needUpdate; } + +/*virtual*/ bool Object::HitTest(Point) +{ + return false; +} + + // This is intended to be overridden by the Container class, for object morphing /*virtual*/ void Object::Transmute(Object *, Object *) { } + /*virtual*/ Object * Object::GetParent(void) { return parent; } + /*virtual*/ void Object::Add(Object *) { } + +// This returns a pointer to the point passed in, if it coincides. Otherwise returns NULL. +/*virtual*/ Vector * Object::GetPointAt(Vector) +{ + return 0; +} + + +// This is meant for writing object data to a file. +/*virtual*/ void Object::Enumerate(FILE *) +{ +} + + +/*virtual*/ Object * Object::Copy(void) +{ + return new Object(position, parent); +} + + +// This returns a point on the object at 'parameter', which is between 0 and 1. +// Default is to return the object's position. +/*virtual*/ Vector Object::GetPointAtParameter(double) +{ + return position; +} + + +// Since these functions are pretty much non-object specific, we can implement +// them here. :-) +/*virtual*/ void Object::Connect(Object * obj, double parameter) +{ + connected.push_back(Connection(obj, parameter)); +} + + +/*virtual*/ void Object::Disconnect(Object * obj, double parameter) +{ + for(uint i=0; i