diff -r 192e1392ba6a -r 12958f987bcf linkablemapobj.cpp --- a/linkablemapobj.cpp Wed Jul 16 10:44:44 2008 +0000 +++ b/linkablemapobj.cpp Wed Jul 16 10:46:14 2008 +0000 @@ -1,8 +1,12 @@ +#include #include #include "linkablemapobj.h" #include "branchobj.h" -#include "mapeditor.h" +#include "mapeditor.h" // FIXME needed? +#include "vymmodel.h" + +using namespace std; ///////////////////////////////////////////////////////////////// // LinkableMapObj @@ -54,6 +58,8 @@ void LinkableMapObj::init () { + model=NULL; + depth=-1; mapEditor=NULL; childObj=NULL; @@ -99,6 +105,7 @@ void LinkableMapObj::copy (LinkableMapObj* other) { MapObj::copy(other); + model=other->model; bboxTotal=other->bboxTotal; setLinkStyle(other->style); setLinkColor (other->linkcolor); @@ -107,6 +114,16 @@ objID=other->objID; } +void LinkableMapObj::setModel (VymModel *vm) +{ + model=vm; +} + +VymModel* LinkableMapObj::getModel() +{ + return model; +} + void LinkableMapObj::setChildObj(LinkableMapObj* o) { childObj=o; @@ -116,13 +133,14 @@ { parObj=o; mapEditor=parObj->getMapEditor(); + model=parObj->getModel(); // FIXME makes painting slow, but that's obvious because there are no links to paint, hmmm.... } -void LinkableMapObj::setParObjTmp(LinkableMapObj*,QPointF,int) +void LinkableMapObj::setParObjTmp(LinkableMapObj*,QPointF,int) // FIXME make pure virtual { } -void LinkableMapObj::unsetParObjTmp() +void LinkableMapObj::unsetParObjTmp() // FIXME make pure virtual { } @@ -180,8 +198,12 @@ LinkableMapObj::Style LinkableMapObj::getDefLinkStyle () { - if (!mapEditor) return UndefinedStyle; - Style ls=mapEditor->getMapLinkStyle(); + if (!model) + { + qWarning ("LMO::getDefLinkStyle model=NULL"); + return UndefinedStyle; + } + Style ls=model->getMapLinkStyle(); switch (ls) { case Line: @@ -309,10 +331,10 @@ void LinkableMapObj::setLinkColor() { - // Overloaded in BranchObj and childs + // Overloaded in BranchObj and children // here only set default color - if (mapEditor) - setLinkColor (mapEditor->getMapDefLinkColor()); + if (model) + setLinkColor (model->getMapDefLinkColor()); } void LinkableMapObj::setLinkColor(QColor col) @@ -606,6 +628,7 @@ void LinkableMapObj::setMapEditor (MapEditor *me) { mapEditor=me; + model=mapEditor->getModel(); } MapEditor* LinkableMapObj::getMapEditor () @@ -646,7 +669,7 @@ // we want to block expensive repositioning, but just do it once at // the end, thus check first: - if (mapEditor->isRepositionBlocked()) return; + if (mapEditor->getModel()->isRepositionBlocked()) return; // FIXME better go to model directly, maybe via a signal // Pass on the request to parental objects, if this hasn't been done yet