1.1 --- a/branchitem.cpp Mon Aug 03 10:42:12 2009 +0000
1.2 +++ b/branchitem.cpp Thu Aug 06 10:42:17 2009 +0000
1.3 @@ -372,7 +372,7 @@
1.4 return (BranchObj*)lmo;
1.5 }
1.6
1.7 -BranchObj* BranchItem::createMapObj(QGraphicsScene *scene)
1.8 +BranchObj* BranchItem::createMapObj(QGraphicsScene *scene) // FIXME-4 maybe move this into MapEditor to get rid of scene in VymModel?
1.9 {
1.10 BranchObj *newbo;
1.11 newbo=new BranchObj(scene);
2.1 --- a/branchobj.cpp Mon Aug 03 10:42:12 2009 +0000
2.2 +++ b/branchobj.cpp Thu Aug 06 10:42:17 2009 +0000
2.3 @@ -127,7 +127,7 @@
2.4 if (!parObjTmpBuf)
2.5 parObjTmpBuf=parObj;
2.6
2.7 - // ignore mapcenter and mainbranch
2.8 + // ignore mapcenter and mainbranch //FIXME-3 MCO meanwhile also could be relinked
2.9 if (pi_depth<2) off=0;
2.10 if (off==0)
2.11 link2ParPos=false;
2.12 @@ -135,17 +135,17 @@
2.13 link2ParPos=true;
2.14 parObj=o;
2.15
2.16 - // FIXME-2 depth=parObj->getDepth()+1;
2.17 -
2.18 // setLinkStyle calls updateLinkGeometry, only set it once
2.19 - if (style!=getDefLinkStyle() ) setLinkStyle (getDefLinkStyle());
2.20 + //LinkableMapObj::Style ls=getDefLinkStyle (lmo->getTreeItem() );
2.21 + //if (style!=ls ) setLinkStyle (ls);
2.22 + setLinkStyle (lmo->getDefLinkStyle (lmo->getTreeItem()));
2.23
2.24 // Move temporary to new position at destination
2.25 // Usually the positioning would be done by reposition(),
2.26 // but then also the destination branch would "Jump" around...
2.27 // Better just do it approximately
2.28 - if (treeItem->depth()==1) // FIXME-3 needed to recursively calc depth?
2.29 - { // new parent is the mapcenter itself
2.30 + if (parObj->getTreeItem()->depth()==0)
2.31 + { // new parent is a mapcenter
2.32
2.33 QPointF p= normalise ( QPointF (m.x() - o->getChildPos().x(),
2.34 m.y() - o->getChildPos().y() ));
2.35 @@ -192,8 +192,7 @@
2.36 link2ParPos=false;
2.37 parObj=parObjTmpBuf;
2.38 parObjTmpBuf=NULL;
2.39 - //FIXME-2 depth=parObj->getDepth()+1;
2.40 - setLinkStyle (getDefLinkStyle() );
2.41 + setLinkStyle (getDefLinkStyle(treeItem->parent() ) );
2.42 updateLinkGeometry();
2.43 }
2.44 }
2.45 @@ -588,9 +587,8 @@
2.46 case 1: fontsize=12; break;
2.47 default: fontsize=10; break;
2.48 }
2.49 -
2.50 + setLinkStyle(getDefLinkStyle(treeItem->parent() ));
2.51 setLinkColor ();
2.52 - setLinkStyle(getDefLinkStyle());
2.53 QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
2.54 font.setPointSize(fontsize);
2.55 heading->setFont(font );
3.1 --- a/linkablemapobj.cpp Mon Aug 03 10:42:12 2009 +0000
3.2 +++ b/linkablemapobj.cpp Thu Aug 06 10:42:17 2009 +0000
3.3 @@ -176,7 +176,7 @@
3.4 return rightPad;
3.5 }
3.6
3.7 -LinkableMapObj::Style LinkableMapObj::getDefLinkStyle ()
3.8 +LinkableMapObj::Style LinkableMapObj::getDefLinkStyle (TreeItem *parent)
3.9 {
3.10 VymModel *model=treeItem->getModel();
3.11 if (!model)
3.12 @@ -185,7 +185,7 @@
3.13 //return UndefinedStyle;
3.14 }
3.15 Style ls=model->getMapLinkStyle();
3.16 - int depth=treeItem->depth();
3.17 + int depth=1+parent->depth();
3.18 if (depth==0) return UndefinedStyle;
3.19 switch (ls)
3.20 {
3.21 @@ -215,7 +215,7 @@
3.22
3.23 void LinkableMapObj::setLinkStyle(Style newstyle)
3.24 {
3.25 - //if (newstyle=style) return; FIXME-3
3.26 + //if (newstyle==style) return; FIXME-3
3.27 delLink();
3.28
3.29 style=newstyle;
4.1 --- a/linkablemapobj.h Mon Aug 03 10:42:12 2009 +0000
4.2 +++ b/linkablemapobj.h Thu Aug 06 10:42:17 2009 +0000
4.3 @@ -74,7 +74,7 @@
4.4 virtual qreal getTopPad();
4.5 virtual qreal getLeftPad();
4.6 virtual qreal getRightPad();
4.7 - Style getDefLinkStyle();
4.8 + Style getDefLinkStyle(TreeItem *parent);
4.9 void setLinkStyle(Style);
4.10 Style getLinkStyle();
4.11
5.1 --- a/mainwindow.cpp Mon Aug 03 10:42:12 2009 +0000
5.2 +++ b/mainwindow.cpp Thu Aug 06 10:42:17 2009 +0000
5.3 @@ -549,6 +549,15 @@
5.4 connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteSelection() ) );
5.5 actionDelete=a;
5.6
5.7 + // Shortcut to add attribute
5.8 + a= new QAction(tr( "Add attribute" ), this);
5.9 + a->setShortcut ( Qt::Key_Q);
5.10 + a->setShortcutContext (Qt::WindowShortcut);
5.11 + addAction (a);
5.12 + connect( a, SIGNAL( triggered() ), this, SLOT( editAddAttribute() ) );
5.13 + actionAddAttribute= a;
5.14 +
5.15 +
5.16 // Shortcut to add mapcenter
5.17 a= new QAction(QPixmap(iconPath+"newmapcenter.png"),tr( "Add mapcenter","Canvas context menu" ), this);
5.18 a->setShortcut ( Qt::Key_M);
5.19 @@ -2757,6 +2766,12 @@
5.20 if (m) m->unscrollChildren();
5.21 }
5.22
5.23 +void Main::editAddAttribute()
5.24 +{
5.25 + VymModel *m=currentModel();
5.26 + if (m) m->addAttribute();
5.27 +}
5.28 +
5.29 void Main::editAddMapCenter()
5.30 {
5.31 VymModel *m=currentModel();
6.1 --- a/mainwindow.h Mon Aug 03 10:42:12 2009 +0000
6.2 +++ b/mainwindow.h Thu Aug 06 10:42:17 2009 +0000
6.3 @@ -147,6 +147,7 @@
6.4 void editToggleScroll();
6.5 void editExpandAll();
6.6 void editUnscrollChildren();
6.7 + void editAddAttribute();
6.8 void editAddMapCenter();
6.9 void editNewBranch();
6.10 void editNewBranchBefore();
6.11 @@ -295,7 +296,7 @@
6.12 QAction *actionMapInfo;
6.13 QAction *actionHeading;
6.14 QAction *actionDelete;
6.15 -
6.16 + QAction *actionAddAttribute;
6.17 public:
6.18 QAction *actionAddMapCenter;
6.19
7.1 --- a/mapeditor.cpp Mon Aug 03 10:42:12 2009 +0000
7.2 +++ b/mapeditor.cpp Thu Aug 06 10:42:17 2009 +0000
7.3 @@ -1310,16 +1310,25 @@
7.4 // is not yet implemented elsewhere
7.5
7.6 // Here in MapEditor we can only select Branches and Images
7.7 + QList <TreeItem*> treeItemsNew;
7.8 + QList <TreeItem*> treeItemsOld;
7.9 +
7.10 QModelIndex ix;
7.11 foreach (ix,newsel.indexes() )
7.12 {
7.13 TreeItem *ti= static_cast<TreeItem*>(ix.internalPointer());
7.14 - if (ti->getType()!=TreeItem::Branch && ti->getType()!=TreeItem::Image )
7.15 - newsel.indexes().removeOne (ix);
7.16 + if (ti->getType()==TreeItem::Branch || ti->getType()==TreeItem::Image )
7.17 + if (!treeItemsNew.contains(ti)) treeItemsNew.append (ti);
7.18 + }
7.19 + foreach (ix,oldsel.indexes() )
7.20 + {
7.21 + TreeItem *ti= static_cast<TreeItem*>(ix.internalPointer());
7.22 + if (ti->getType()==TreeItem::Branch || ti->getType()==TreeItem::Image )
7.23 + if (!treeItemsOld.contains(ti)) treeItemsOld.append (ti);
7.24 }
7.25
7.26 // Trim list of selection rectangles
7.27 - while (newsel.indexes().count() < selboxList.count() )
7.28 + while (treeItemsNew.count() < selboxList.count() )
7.29 delete selboxList.takeFirst();
7.30
7.31 // Take care to tmp scroll/unscroll
7.32 @@ -1344,7 +1353,7 @@
7.33 }
7.34 }
7.35
7.36 - if (!newsel.isEmpty())
7.37 + if (!treeItemsNew.isEmpty())
7.38 {
7.39 QModelIndex ix=newsel.indexes().first();
7.40 if (ix.isValid() )
7.41 @@ -1365,12 +1374,12 @@
7.42 }
7.43
7.44 // Reduce rectangles
7.45 - while (newsel.indexes().count() < selboxList.count() )
7.46 + while (treeItemsNew.count() < selboxList.count() )
7.47 delete selboxList.takeFirst();
7.48
7.49 // Add additonal rectangles
7.50 QGraphicsRectItem *sb;
7.51 - while (newsel.indexes().count() > selboxList.count() )
7.52 + while (treeItemsNew.count() > selboxList.count() )
7.53 {
7.54 sb = mapScene->addRect(
7.55 QRectF(0,0,0,0),
7.56 @@ -1381,19 +1390,18 @@
7.57 selboxList.append (sb);
7.58 }
7.59
7.60 +
7.61 +
7.62 // Reposition rectangles
7.63 - int i=0;
7.64 QRectF bbox;
7.65 QModelIndex index;
7.66
7.67 - TreeItem *ti;
7.68 LinkableMapObj *lmo;
7.69 - foreach (sb,selboxList)
7.70 + for (int i=0; i<treeItemsNew.count();++i)
7.71 {
7.72 - index=newsel.indexes().at(i);
7.73 - ti= static_cast<TreeItem*>(index.internalPointer());
7.74 - lmo=((MapItem*)ti)->getLMO();
7.75 + lmo=((MapItem*)treeItemsNew.at(i) )->getLMO();
7.76 bbox=lmo->getBBox();
7.77 + sb=selboxList.at(i);
7.78 sb->setRect (
7.79 bbox.x(),bbox.y(),
7.80 bbox.width(), bbox.height());
8.1 --- a/tex/vym.tex Mon Aug 03 10:42:12 2009 +0000
8.2 +++ b/tex/vym.tex Thu Aug 06 10:42:17 2009 +0000
8.3 @@ -663,10 +663,11 @@
8.4 \subsection{RichText: Colours, paragraphs and formatted text}
8.5 \vym supports formatted text (QT Rich Text) in the noteeditor since
8.6 version 1.4.7. Colours and text attributes (e.g. italic, bold) can be
8.7 -set with the buttons above the text. The text itself is divided into
8.8 -paragraphs. For each paragraph the format can be set (e.g. centered,
8.9 -right). A paragraph is ended when a \key{Return} is entered. If you just
8.10 -want to begin a new line, press \key{CTRL-Return}.
8.11 +set with the buttons above the text.
8.12 +%The text itself is divided into
8.13 +%paragraphs. For each paragraph the format can be set (e.g. centered,
8.14 +%right). A paragraph is ended when a \key{Return} is entered. If you just
8.15 +%want to begin a new line, press \key{CTRL-Return}.
8.16
8.17 \subsection{Fonts and how to switch them quickly}
8.18 The noteeditor is designed to be used for simple notes, not really as a full
9.1 --- a/treeitem.cpp Mon Aug 03 10:42:12 2009 +0000
9.2 +++ b/treeitem.cpp Thu Aug 06 10:42:17 2009 +0000
9.3 @@ -72,8 +72,11 @@
9.4 imageOffset=0;
9.5 imageCounter=0;
9.6
9.7 + attributeCounter=0;
9.8 + attributeOffset=0;
9.9 +
9.10 note.setNote("");
9.11 - // note.setFontHint (textEditor->getFontHintDefault() ); //FIXME-2
9.12 + // note.setFontHint (textEditor->getFontHintDefault() ); //FIXME-3
9.13 // isNoteInEditor=false;
9.14
9.15 hidden=false;
9.16 @@ -87,7 +90,7 @@
9.17
9.18
9.19 /*
9.20 -void TreeItem::copy (OrnamentedObj* other) //FIXME-2 probably need deep copy of branches and data!
9.21 +void TreeItem::copy (OrnamentedObj* other) //FIXME-3 probably need deep copy of branches and data!
9.22
9.23 {
9.24 note.copy (other->note);
9.25 @@ -111,9 +114,10 @@
9.26 {
9.27 switch (item->type)
9.28 {
9.29 + case Attribute: return attributeOffset + attributeCounter;
9.30 + case Image: return imageOffset + imageCounter;
9.31 case MapCenter: return branchOffset + branchCounter;
9.32 case Branch: return branchOffset + branchCounter;
9.33 - case Image: return imageOffset + imageCounter;
9.34 default: return -1;
9.35 }
9.36 }
9.37 @@ -124,12 +128,18 @@
9.38 item->rootItem=rootItem;
9.39 item->setModel (model);
9.40
9.41 + if (item->type == Attribute)
9.42 + {
9.43 + // attribute are on top of list
9.44 + childItems.insert (attributeCounter,item);
9.45 + attributeCounter++;
9.46 + imageOffset++;
9.47 + branchOffset++;
9.48 + }
9.49 +
9.50 if (item->type == Image)
9.51 {
9.52 - childItems.insert (imageCounter,item);
9.53 - // images are on top of list
9.54 - if (imageCounter==0)
9.55 - imageOffset=0;
9.56 + childItems.insert (imageCounter+imageOffset,item);
9.57 imageCounter++;
9.58 branchOffset++;
9.59 }
9.60 @@ -138,8 +148,6 @@
9.61 {
9.62 // branches are on bottom of list
9.63 childItems.append(item);
9.64 - if (branchCounter==0)
9.65 - branchOffset=childItems.count()-1;
9.66 branchCounter++;
9.67 }
9.68 }
9.69 @@ -150,14 +158,20 @@
9.70 qWarning ("TreeItem::removeChild tried to remove non existing item?!\n");
9.71 else
9.72 {
9.73 - if (childItems.at(row)->isBranchLikeType())
9.74 - branchCounter--;
9.75 + if (childItems.at(row)->type==Attribute)
9.76 + {
9.77 + attributeCounter--;
9.78 + imageOffset--;
9.79 + branchOffset--;
9.80 + }
9.81 if (childItems.at(row)->type==Image)
9.82 {
9.83 imageCounter--;
9.84 - if (branchOffset>0)
9.85 - branchOffset--;
9.86 + branchOffset--;
9.87 }
9.88 + if (childItems.at(row)->isBranchLikeType())
9.89 + branchCounter--;
9.90 +
9.91 childItems.removeAt (row);
9.92 }
9.93 }
9.94 @@ -210,6 +224,11 @@
9.95 return xlinkCounter; // FIXME-1 xlinkCounter needs to be calculated...
9.96 }
9.97
9.98 +int TreeItem::attributeCount() const
9.99 +{
9.100 + return attributeCounter;
9.101 +}
9.102 +
9.103 int TreeItem::row() const
9.104 {
9.105 if (parentItem)
10.1 --- a/treeitem.h Mon Aug 03 10:42:12 2009 +0000
10.2 +++ b/treeitem.h Thu Aug 06 10:42:17 2009 +0000
10.3 @@ -20,7 +20,7 @@
10.4 class TreeItem:public XMLObj
10.5 {
10.6 public:
10.7 - enum Type {Undefined,MapCenter,Branch,Image}; //FIXME-3 MapCenter still needed?
10.8 + enum Type {Undefined,MapCenter,Branch,Image,Attribute}; //FIXME-3 MapCenter still needed?
10.9 enum HideTmpMode {HideNone, HideExport};
10.10
10.11 TreeItem();
10.12 @@ -48,6 +48,7 @@
10.13 virtual int branchCount() const;
10.14 virtual int imageCount() const;
10.15 virtual int xlinkCount() const;
10.16 + virtual int attributeCount() const;
10.17
10.18 virtual int row() const;
10.19 virtual int column() const;
10.20 @@ -130,7 +131,6 @@
10.21
10.22 virtual QStringList activeSystemFlagNames();
10.23
10.24 -
10.25 virtual bool canMoveDown();
10.26 virtual bool canMoveUp();
10.27
10.28 @@ -187,6 +187,9 @@
10.29 int imageOffset;
10.30 int imageCounter;
10.31
10.32 + int attributeOffset;
10.33 + int attributeCounter;
10.34 +
10.35 bool hidden; //! Hidden in export if true
10.36 };
10.37
11.1 --- a/vym.pro Mon Aug 03 10:42:12 2009 +0000
11.2 +++ b/vym.pro Thu Aug 06 10:42:17 2009 +0000
11.3 @@ -35,6 +35,7 @@
11.4 adaptormodel.h \
11.5 animpoint.h \
11.6 attribute.h \
11.7 + attributeitem.h \
11.8 # attributedelegate.h\
11.9 # attributedialog.h \
11.10 # attributewidget.h \
11.11 @@ -96,6 +97,7 @@
11.12 adaptormodel.cpp \
11.13 animpoint.cpp \
11.14 attribute.cpp \
11.15 + attributeitem.cpp \
11.16 # attributedelegate.cpp \
11.17 # attributedialog.cpp \
11.18 # attributewidget.cpp \
12.1 --- a/vymmodel.cpp Mon Aug 03 10:42:12 2009 +0000
12.2 +++ b/vymmodel.cpp Thu Aug 06 10:42:17 2009 +0000
12.3 @@ -3,6 +3,7 @@
12.4
12.5 #include "vymmodel.h"
12.6
12.7 +#include "attributeitem.h"
12.8 #include "treeitem.h"
12.9 #include "branchitem.h"
12.10 #include "editxlinkdialog.h"
12.11 @@ -126,8 +127,8 @@
12.12 findPrevious=NULL;
12.13 EOFind=false;
12.14
12.15 - // animations
12.16 - animationUse=settings.readBoolEntry("/animation/use",false);
12.17 + // animations // FIXME-3 switch to new animation system
12.18 + animationUse=settings.readBoolEntry("/animation/use",false); // FIXME-3 add options to control _what_ is animated
12.19 animationTicks=settings.readNumEntry("/animation/ticks",10);
12.20 animationInterval=settings.readNumEntry("/animation/interval",50);
12.21 animObjList.clear();
12.22 @@ -1982,6 +1983,33 @@
12.23 return NULL;
12.24 }
12.25
12.26 +AttributeItem* VymModel::addAttribute()
12.27 +{
12.28 + cout << "VM::addAttribute\n";
12.29 +
12.30 + TreeItem *selti=getSelectedItem();
12.31 + if (selti)
12.32 + {
12.33 + QList<QVariant> cData;
12.34 + cData << "new attribute" << "undef"<<"undef";
12.35 + AttributeItem *a=new AttributeItem (cData);
12.36 +
12.37 + emit (layoutAboutToBeChanged() );
12.38 +
12.39 + QModelIndex parix=index(selti);
12.40 + int n=selti->getRowNumAppend (a);
12.41 + beginInsertRows (parix,n,n+1);
12.42 + selti->appendChild (a);
12.43 + endInsertRows ();
12.44 +
12.45 + emit (layoutChanged() );
12.46 +
12.47 + reposition();
12.48 + return a;
12.49 + }
12.50 + return NULL;
12.51 +}
12.52 +
12.53 BranchItem* VymModel::addMapCenter ()
12.54 {
12.55 BranchItem *bi=addMapCenter (contextPos);
12.56 @@ -4056,7 +4084,7 @@
12.57 while (cur)
12.58 {
12.59 bo=(BranchObj*)(cur->getLMO() );
12.60 - bo->setLinkStyle(bo->getDefLinkStyle());
12.61 + bo->setLinkStyle(bo->getDefLinkStyle(cur->parent() )); //FIXME-3 better emit dataCHanged and leave the changes to View
12.62 cur=next(cur,prev);
12.63 }
12.64 reposition();
13.1 --- a/vymmodel.h Mon Aug 03 10:42:12 2009 +0000
13.2 +++ b/vymmodel.h Thu Aug 06 10:42:17 2009 +0000
13.3 @@ -15,6 +15,7 @@
13.4 #include "treeitem.h"
13.5 #include "treemodel.h"
13.6
13.7 +class AttributeItem;
13.8 class BranchItem;
13.9 class MapEditor;
13.10
13.11 @@ -290,6 +291,8 @@
13.12 BranchItem* createBranch(BranchItem *dst); //!< Create Branch
13.13 ImageItem* createImage(BranchItem *dst); //!< Create image
13.14
13.15 + AttributeItem* addAttribute();
13.16 +
13.17 /*! \brief Add new mapcenter
13.18
13.19 Disclaimer: Still experimental, not fully supported yet.
14.1 --- a/xml-vym.cpp Mon Aug 03 10:42:12 2009 +0000
14.2 +++ b/xml-vym.cpp Thu Aug 06 10:42:17 2009 +0000
14.3 @@ -366,7 +366,7 @@
14.4 lastBranch->toggleScroll();
14.5 // (interesting for import of KDE bookmarks)
14.6
14.7 -/* if (!a.value( "frameType").isEmpty() ) FIXME-2
14.8 +/* if (!a.value( "frameType").isEmpty() ) FIXME-3
14.9 lastOO->setFrameType (a.value("frameType")); //Compatibility 1.8.1
14.10
14.11 */