]> Shamusworld >> Repos - architektonas/blobdiff - src/object.cpp
Added Architektonas drawing file loading/saving infrastructure.
[architektonas] / src / object.cpp
index 3820d7ee374bafe8c860395fd046302615222d1f..ab95c0ea16fb5a35cf56af5074671b17cf8377b2 100644 (file)
@@ -5,7 +5,7 @@
 // (C) 2011 Underground Software
 // See the README and GPLv3 files for licensing and warranty information
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  ------------------------------------------------------------
@@ -13,6 +13,7 @@
 // JLH  04/01/2011  Added constructor to allow derived objects to have empty
 //                  constructor bodies, added state querying
 // JLH  04/02/2001  Added static methods for global states (fixed angle, etc)
+//
 
 #include "object.h"
 
@@ -23,6 +24,7 @@ QFont * Object::font = 0;
 int Object::viewportHeight = 0;
 bool Object::deleteActive = false;
 bool Object::dimensionActive = false;
+bool Object::snapToGrid = true;
 
 
 Object::Object(): position(Vector(0, 0)), parent(0), state(OSInactive), oldState(OSInactive),
@@ -39,7 +41,7 @@ Object::~Object()
 {
 }
 
-/*virtual*/ void Object::Draw(QPainter *)
+/*virtual*/ void Object::Draw(Painter *)
 {
 }
 
@@ -80,11 +82,27 @@ Object::~Object()
 {
 }
 
+// This returns a pointer to the point passed in, if it coincides. Otherwise returns NULL.
+/*virtual*/ Vector * Object::GetPointAt(Vector)
+{
+       return 0;
+}
+
 ObjectState Object::GetState(void)
 {
        return state;
 }
 
+void Object::Reparent(Object * newParent)
+{
+       parent = newParent;
+}
+
+Dimension * Object::GetAttachedDimension(void)
+{
+       return attachedDimension;
+}
+
 // Class methods...
 
 void Object::SetFixedAngle(bool state/*= true*/)
@@ -116,3 +134,8 @@ void Object::SetDimensionActive(bool state/*= true*/)
 {
        dimensionActive = state;
 }
+
+void Object::SetSnapMode(bool state/*= true*/)
+{
+       snapToGrid = state;
+}