ornamentedobj.cpp
changeset 771 01f2f6d6789d
parent 766 7a71a914afdb
child 773 340bc29da9a0
     1.1 --- a/ornamentedobj.cpp	Thu May 07 08:48:53 2009 +0000
     1.2 +++ b/ornamentedobj.cpp	Mon May 18 11:22:41 2009 +0000
     1.3 @@ -6,9 +6,6 @@
     1.4  #include "linkablemapobj.h"
     1.5  
     1.6  extern TextEditor *textEditor;
     1.7 -extern FlagRowObj *systemFlagsDefault;
     1.8 -extern FlagRowObj *standardFlagsDefault;
     1.9 -
    1.10  
    1.11  /////////////////////////////////////////////////////////////////
    1.12  // OrnamentedObj
    1.13 @@ -46,20 +43,9 @@
    1.14  	heading->move (absPos.x(), absPos.y());
    1.15  
    1.16  	systemFlags=new FlagRowObj(scene);
    1.17 -	systemFlags->clone(systemFlagsDefault);
    1.18 -	systemFlags->setName ("systemFlags");
    1.19 -	
    1.20  	standardFlags=new FlagRowObj(scene);
    1.21 -	standardFlags->clone(standardFlagsDefault);
    1.22 -	standardFlags->setName ("standardFlags");
    1.23 -
    1.24 -	attributes.clear();
    1.25  
    1.26  	frame = new FrameObj (scene);
    1.27 -
    1.28 -	url="";
    1.29 -	vymLink="";
    1.30 -	
    1.31  }
    1.32  
    1.33  void OrnamentedObj::copy (OrnamentedObj* other)
    1.34 @@ -72,9 +58,6 @@
    1.35  	standardFlags->copy (other->standardFlags);
    1.36  
    1.37  	ornamentsBBox=other->ornamentsBBox;
    1.38 -
    1.39 -	url=other->url;
    1.40 -	vymLink=other->vymLink;
    1.41  }
    1.42  
    1.43  void OrnamentedObj::setLinkColor()
    1.44 @@ -246,90 +229,9 @@
    1.45  	move2RelPos (p.x(),p.y());
    1.46  }
    1.47  
    1.48 -void OrnamentedObj::setURL(QString s)
    1.49 +void OrnamentedObj::activateStandardFlag(Flag *flag)
    1.50  {
    1.51 -	url=s;
    1.52 -	if (!url.isEmpty())
    1.53 -		systemFlags->activate("url");
    1.54 -	else	
    1.55 -		systemFlags->deactivate("url");
    1.56 -	calcBBoxSize();			// recalculate bbox
    1.57 -    positionBBox();			// rearrange contents
    1.58 -	forceReposition();
    1.59 -}
    1.60 -
    1.61 -QString OrnamentedObj::getURL()
    1.62 -{
    1.63 -	return url;
    1.64 -}
    1.65 -
    1.66 -void OrnamentedObj::setVymLink(QString s)
    1.67 -{
    1.68 -	if (!s.isEmpty())
    1.69 -	{
    1.70 -		// We need the relative (from loading) 
    1.71 -		// or absolute path (from User event)
    1.72 -		// and build the absolute path.
    1.73 -		// Note: If we have relative, use path of
    1.74 -		// current map to build absolute path
    1.75 -		QDir d(s);
    1.76 -		if (!d.path().startsWith ("/"))
    1.77 -		{
    1.78 -			QString p=model->getDestPath();
    1.79 -			int i=p.findRev("/",-1);
    1.80 -			d.setPath(p.left(i)+"/"+s);
    1.81 -			d.convertToAbs();
    1.82 -		}
    1.83 -		vymLink=d.path();
    1.84 -		systemFlags->activate("vymLink");
    1.85 -	}	
    1.86 -	else	
    1.87 -	{
    1.88 -		systemFlags->deactivate("vymLink");
    1.89 -		vymLink="";
    1.90 -	}	
    1.91 -	calcBBoxSize();			// recalculate bbox
    1.92 -    positionBBox();			// rearrange contents
    1.93 -	forceReposition();
    1.94 -}
    1.95 -
    1.96 -QString OrnamentedObj::getVymLink()
    1.97 -{
    1.98 -	return vymLink;
    1.99 -}
   1.100 -
   1.101 -
   1.102 -void OrnamentedObj::setAttributes (const QList <Attribute> &al)
   1.103 -{
   1.104 -	attributes=al;
   1.105 -}
   1.106 -
   1.107 -QList <Attribute> OrnamentedObj::getAttributes()
   1.108 -{
   1.109 -	return attributes;
   1.110 -}
   1.111 -
   1.112 -void OrnamentedObj::clearStandardFlags()
   1.113 -{
   1.114 -	standardFlags->deactivateAll();
   1.115 -	calcBBoxSize();
   1.116 -	positionBBox();
   1.117 -	move (absPos.x(), absPos.y() );
   1.118 -	forceReposition();
   1.119 -}
   1.120 -
   1.121 -void OrnamentedObj::toggleStandardFlag(const QString &name)
   1.122 -{
   1.123 -	standardFlags->toggle(name);
   1.124 -	calcBBoxSize();
   1.125 -	positionBBox();
   1.126 -	move (absPos.x(), absPos.y() );
   1.127 -	forceReposition();
   1.128 -}
   1.129 -
   1.130 -void OrnamentedObj::activateStandardFlag(const QString &name)
   1.131 -{
   1.132 -	standardFlags->activate(name);
   1.133 +	standardFlags->activate(flag);
   1.134  	calcBBoxSize();
   1.135  	positionBBox();
   1.136  	move (absPos.x(), absPos.y() );
   1.137 @@ -345,22 +247,12 @@
   1.138  	forceReposition();
   1.139  }
   1.140  
   1.141 -bool OrnamentedObj::isSetStandardFlag (const QString &name)
   1.142 -{
   1.143 -	return standardFlags->isActive(name);
   1.144 -}
   1.145  
   1.146  QString OrnamentedObj::getSystemFlagName(const QPointF &p)
   1.147  {
   1.148  	return systemFlags->getFlagName(p);	
   1.149  }
   1.150  
   1.151 -bool OrnamentedObj::isActiveFlag (const QString &name)
   1.152 -{
   1.153 -	if (standardFlags->isActive (name) ) return true;
   1.154 -	return false;
   1.155 -}
   1.156 -
   1.157  /* FIXME-3 should move to VymView ?!  void OrnamentedObj::getNoteFromTextEditor ()
   1.158  {
   1.159  	note.setFilenameHint (textEditor->getFilename());
   1.160 @@ -369,41 +261,7 @@
   1.161  }
   1.162  */
   1.163  
   1.164 -void OrnamentedObj::updateSystemFlags()
   1.165 -{
   1.166 -	// FIXME-3 check if note here and text in editor are still in sync!!	
   1.167 -	// Best would be to always have current text here...
   1.168 -	bool noteEmpty=treeItem->getNoteObj().isEmpty();
   1.169 -	/*
   1.170 -	if (isNoteInEditor)
   1.171 -		noteEmpty=textEditor->isEmpty();
   1.172 -	else	
   1.173 -		noteEmpty=note.isEmpty();
   1.174 -	*/	
   1.175 -
   1.176 -	if (!noteEmpty)
   1.177 -	{	
   1.178 -		if (systemFlags->isActive ("note")) return;
   1.179 -		systemFlags->activate("note");
   1.180 -	}	
   1.181 -	else		
   1.182 -	{	
   1.183 -		if (!systemFlags->isActive ("note")) return;
   1.184 -		systemFlags->deactivate("note");
   1.185 -	}	
   1.186 -	//model->setChanged();
   1.187 -	calcBBoxSize();
   1.188 -	positionBBox();	
   1.189 -	move (absPos.x(), absPos.y() );
   1.190 -	forceReposition();
   1.191 -}	
   1.192 -
   1.193 -void OrnamentedObj::updateFlagsToolbar()
   1.194 -{
   1.195 -	standardFlags->updateToolbar();
   1.196 -}
   1.197 -
   1.198 -QString OrnamentedObj::getOrnXMLAttr()
   1.199 +QString OrnamentedObj::getOrnXMLAttr()	//FIXME-2
   1.200  {
   1.201  	QString posAttr;
   1.202  
   1.203 @@ -424,20 +282,12 @@
   1.204  			posAttr="";
   1.205  	}	
   1.206  
   1.207 -	QString urlAttr;
   1.208 -	if (!url.isEmpty())
   1.209 -		urlAttr=attribut ("url",url);
   1.210 -
   1.211 -	QString vymLinkAttr;
   1.212 -	if (!vymLink.isEmpty())
   1.213 -		vymLinkAttr=attribut ("vymLink",convertToRel(model->getDestPath(),vymLink) );
   1.214 -
   1.215  /* FIXME-2 QString hideExpAttr;
   1.216  	if (hideExport)
   1.217  		hideExpAttr= attribut("hideInExport","true");
   1.218  	else	
   1.219  		hideExpAttr="";
   1.220  */
   1.221 -	return posAttr +urlAttr +vymLinkAttr +getLinkAttr() ;//+hideExpAttr;
   1.222 +	return posAttr +getLinkAttr() ;//+hideExpAttr;
   1.223  }
   1.224