vymmodel.cpp
changeset 786 6269016c9905
parent 785 5987f9f15bac
child 787 c6bb4fdcc55f
     1.1 --- a/vymmodel.cpp	Mon Aug 03 10:42:12 2009 +0000
     1.2 +++ b/vymmodel.cpp	Thu Aug 06 10:42:17 2009 +0000
     1.3 @@ -3,6 +3,7 @@
     1.4  
     1.5  #include "vymmodel.h"
     1.6  
     1.7 +#include "attributeitem.h"
     1.8  #include "treeitem.h"
     1.9  #include "branchitem.h"
    1.10  #include "editxlinkdialog.h"
    1.11 @@ -126,8 +127,8 @@
    1.12  	findPrevious=NULL;				
    1.13  	EOFind=false;
    1.14  
    1.15 -	// animations
    1.16 -	animationUse=settings.readBoolEntry("/animation/use",false);
    1.17 +	// animations	// FIXME-3 switch to new animation system 
    1.18 +	animationUse=settings.readBoolEntry("/animation/use",false);	// FIXME-3 add options to control _what_ is animated
    1.19  	animationTicks=settings.readNumEntry("/animation/ticks",10);
    1.20  	animationInterval=settings.readNumEntry("/animation/interval",50);
    1.21  	animObjList.clear();
    1.22 @@ -1982,6 +1983,33 @@
    1.23  	return NULL;
    1.24  }
    1.25  
    1.26 +AttributeItem* VymModel::addAttribute()
    1.27 +{
    1.28 +	cout << "VM::addAttribute\n";
    1.29 +
    1.30 +	TreeItem *selti=getSelectedItem();
    1.31 +	if (selti)
    1.32 +	{
    1.33 +		QList<QVariant> cData;
    1.34 +		cData << "new attribute" << "undef"<<"undef";
    1.35 +		AttributeItem *a=new AttributeItem (cData);
    1.36 +
    1.37 +		emit (layoutAboutToBeChanged() );
    1.38 +
    1.39 +		QModelIndex parix=index(selti);
    1.40 +		int n=selti->getRowNumAppend (a);
    1.41 +		beginInsertRows (parix,n,n+1);	
    1.42 +		selti->appendChild (a);	
    1.43 +		endInsertRows ();
    1.44 +
    1.45 +		emit (layoutChanged() );
    1.46 +
    1.47 +		reposition();
    1.48 +		return a;
    1.49 +	}
    1.50 +	return NULL;
    1.51 +}
    1.52 +
    1.53  BranchItem* VymModel::addMapCenter ()
    1.54  {
    1.55  	BranchItem *bi=addMapCenter (contextPos);
    1.56 @@ -4056,7 +4084,7 @@
    1.57  	while (cur) 
    1.58  	{
    1.59  		bo=(BranchObj*)(cur->getLMO() );
    1.60 -		bo->setLinkStyle(bo->getDefLinkStyle());
    1.61 +		bo->setLinkStyle(bo->getDefLinkStyle(cur->parent() ));	//FIXME-3 better emit dataCHanged and leave the changes to View
    1.62  		cur=next(cur,prev);
    1.63  	}
    1.64  	reposition();