1.1 --- a/aboutdialog.cpp Thu May 07 08:48:53 2009 +0000
1.2 +++ b/aboutdialog.cpp Wed May 13 08:26:27 2009 +0000
1.3 @@ -91,7 +91,7 @@
1.4 license->setText (
1.5 "<center>"
1.6 "<h3>VYM - View Your Mind</h3>"
1.7 - "<p>Copyright (C) 2004-2007 Uwe Drechsel</p>"
1.8 + "<p>Copyright (C) 2004-2009 Uwe Drechsel</p>"
1.9 "</center>"
1.10
1.11 "<p>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.</p>"
2.1 --- a/animpoint.cpp Thu May 07 08:48:53 2009 +0000
2.2 +++ b/animpoint.cpp Wed May 13 08:26:27 2009 +0000
2.3 @@ -115,7 +115,7 @@
2.4 return animated;
2.5 }
2.6
2.7 - // Some math slow down the movement
2.8 + // Some math to slow down the movement in the end
2.9 qreal f=1-n/animTicks;
2.10 qreal ff=1-f*f*f;
2.11 setX (startPos.x() + vector.x()*ff );
3.1 --- a/attribute.h Thu May 07 08:48:53 2009 +0000
3.2 +++ b/attribute.h Wed May 13 08:26:27 2009 +0000
3.3 @@ -6,8 +6,8 @@
3.4
3.5 #include "xmlobj.h"
3.6
3.7 -class AttributeTable;
3.8 -class AttributeDef;
3.9 +class AttributeTable; //FIXME-3 remove from CVS
3.10 +class AttributeDef; //FIXME-3 remove from CVS
3.11
3.12 enum AttributeType {
3.13 Undefined, //!< Undefined type
4.1 --- a/branchitem.cpp Thu May 07 08:48:53 2009 +0000
4.2 +++ b/branchitem.cpp Wed May 13 08:26:27 2009 +0000
4.3 @@ -202,38 +202,38 @@
4.4 if (scrolled) toggleScroll();
4.5 }
4.6
4.7 -void BranchItem::toggleScroll()
4.8 +bool BranchItem::toggleScroll()
4.9 {
4.10 - BranchItem *bi=getFirstBranch();
4.11
4.12 + if (!branchCount()>0) return false;
4.13 BranchObj *bo=NULL;
4.14 if (scrolled)
4.15 {
4.16 scrolled=false;
4.17 - //FIXME-1 systemFlags->deactivate("scrolledright");
4.18 - while (bi)
4.19 + systemFlags.deactivate("system-scrolledright");
4.20 + if (branchCounter>0)
4.21 {
4.22 - bo=(BranchObj*)(bi->getLMO());
4.23 - if (bo) bo->setVisibility(true);
4.24 - bi=getNextBranch(bi);
4.25 + for (int i=0;i<branchCounter;++i)
4.26 + {
4.27 + bo=(BranchObj*)(getBranchNum(i)->getLMO());
4.28 + if (bo) bo->setVisibility(true);
4.29 + }
4.30 }
4.31 + model->reposition();
4.32 } else
4.33 {
4.34 scrolled=true;
4.35 - //FIXME-1 systemFlags->activate("scrolledright");
4.36 - while (bi)
4.37 + systemFlags.activate("system-scrolledright");
4.38 + if (branchCounter>0)
4.39 {
4.40 - bo=(BranchObj*)(bi->getLMO());
4.41 - if (bo) bo->setVisibility(false);
4.42 - bi=getNextBranch(bi);
4.43 + for (int i=0;i<branchCounter;++i)
4.44 + {
4.45 + bo=(BranchObj*)(getBranchNum(i)->getLMO());
4.46 + if (bo) bo->setVisibility(false);
4.47 + }
4.48 }
4.49 }
4.50 - if (bo)
4.51 - {
4.52 - bo->calcBBoxSize();
4.53 - bo->positionBBox();
4.54 - bo->forceReposition();
4.55 - }
4.56 + return true;
4.57 }
4.58
4.59 bool BranchItem::isScrolled()
4.60 @@ -357,7 +357,7 @@
4.61
4.62 if (!getHeading().isEmpty() )
4.63 {
4.64 - newbo->updateHeading();
4.65 + newbo->updateData(); //FIXME-3 maybe better model->emitDataHasChanged()?
4.66 newbo->setColor (headingColor);
4.67 }
4.68
5.1 --- a/branchitem.h Thu May 07 08:48:53 2009 +0000
5.2 +++ b/branchitem.h Wed May 13 08:26:27 2009 +0000
5.3 @@ -34,7 +34,7 @@
5.4 bool tmpUnscrolled; // can only be true (temporary) for a scrolled subtree
5.5 public:
5.6 virtual void unScroll();
5.7 - virtual void toggleScroll(); // scroll or unscroll
5.8 + virtual bool toggleScroll(); // scroll or unscroll
5.9 virtual bool isScrolled(); // returns scroll state
5.10 virtual bool hasScrolledParent(BranchItem*); // true, if any of the parents is scrolled
5.11 virtual void tmpUnscroll(); // unscroll scrolled parents temporary e.g. during "find" process
6.1 --- a/branchobj.cpp Thu May 07 08:48:53 2009 +0000
6.2 +++ b/branchobj.cpp Wed May 13 08:26:27 2009 +0000
6.3 @@ -6,12 +6,8 @@
6.4 #include "mainwindow.h"
6.5 #include "misc.h"
6.6
6.7 -//class TextEditor; //FIXME-3
6.8 -
6.9 -//extern TextEditor *textEditor;
6.10 -//extern Main *mainWindow;
6.11 -//extern FlagRowObj *standardFlagsDefault;
6.12 -
6.13 +extern FlagRow *standardFlagsMaster;
6.14 +extern FlagRow *systemFlagsMaster;
6.15
6.16 /////////////////////////////////////////////////////////////////
6.17 // BranchObj
6.18 @@ -325,12 +321,12 @@
6.19 QSizeF heading_r=heading->getSize();
6.20 qreal heading_w=(qreal) heading_r.width() ;
6.21 qreal heading_h=(qreal) heading_r.height() ;
6.22 - QSizeF sysflags_r; //FIXME-1 =systemFlags->getSize();
6.23 - qreal sysflags_h=0;//sysflags_r.height();
6.24 - qreal sysflags_w=0;//sysflags_r.width();
6.25 - QSizeF stanflags_r; //FIXME-1 =standardFlags->getSize();
6.26 - qreal stanflags_h=0; //stanflags_r.height();
6.27 - qreal stanflags_w=0; //stanflags_r.width();
6.28 + QSizeF sysflags_r=systemFlags->getSize();
6.29 + qreal sysflags_h=sysflags_r.height();
6.30 + qreal sysflags_w=sysflags_r.width();
6.31 + QSizeF stanflags_r=standardFlags->getSize();
6.32 + qreal stanflags_h=stanflags_r.height();
6.33 + qreal stanflags_w=stanflags_r.width();
6.34 qreal w;
6.35 qreal h;
6.36
6.37 @@ -416,105 +412,67 @@
6.38 }
6.39 }
6.40
6.41 -void BranchObj::updateHeading()
6.42 +void BranchObj::updateData()
6.43 {
6.44 + bool changed=false;
6.45 if (!treeItem)
6.46 {
6.47 qWarning ("BranchObj::udpateHeading treeItem==NULL");
6.48 return;
6.49 }
6.50 - heading->setText (treeItem->getHeading() );
6.51 - updateContentSize();
6.52 + QString s=treeItem->getHeading();
6.53 + if (s!=heading->text())
6.54 + {
6.55 + heading->setText (s);
6.56 + changed=true;
6.57 + }
6.58 + QStringList TIactiveFlags=treeItem->activeStandardFlagNames();
6.59 +
6.60 + // Add missing standard flags active in TreeItem
6.61 + for (int i=0;i<=TIactiveFlags.size()-1;i++)
6.62 + {
6.63 + if (!standardFlags->isActive (TIactiveFlags.at(i) ))
6.64 + {
6.65 + Flag *f=standardFlagsMaster->getFlag(TIactiveFlags.at(i));
6.66 + if (f) standardFlags->activate (f);
6.67 + changed=true;
6.68 + }
6.69 + }
6.70 + // Remove standard flags no longer active in TreeItem
6.71 + QStringList BOactiveFlags=standardFlags->activeFlagNames();
6.72 + for (int i=0;i<BOactiveFlags.size();++i)
6.73 + if (!TIactiveFlags.contains (BOactiveFlags.at(i)))
6.74 + {
6.75 + standardFlags->deactivate (BOactiveFlags.at(i));
6.76 + changed=true;
6.77 + }
6.78 +
6.79 + // Add missing system flags active in TreeItem
6.80 + TIactiveFlags=treeItem->activeSystemFlagNames();
6.81 + for (int i=0;i<TIactiveFlags.size();++i)
6.82 + {
6.83 + if (!systemFlags->isActive (TIactiveFlags.at(i) ))
6.84 + {
6.85 + Flag *f=systemFlagsMaster->getFlag(TIactiveFlags.at(i));
6.86 + if (f) systemFlags->activate (f);
6.87 + changed=true;
6.88 + }
6.89 + }
6.90 + // Remove system flags no longer active in TreeItem
6.91 + BOactiveFlags=systemFlags->activeFlagNames();
6.92 + for (int i=0;i<BOactiveFlags.size();++i)
6.93 + {
6.94 + if (!TIactiveFlags.contains (BOactiveFlags.at(i)))
6.95 + {
6.96 + systemFlags->deactivate (BOactiveFlags.at(i));
6.97 + changed=true;
6.98 + }
6.99 + }
6.100 +
6.101 + if (changed)
6.102 + updateContentSize();
6.103 }
6.104
6.105 -QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
6.106 -{
6.107 - // Cloudy stuff can be hidden during exports
6.108 - // FIXME-1 if (hidden) return "";
6.109 -
6.110 - // Update of note is usually done while unselecting a branch
6.111 - // if (isNoteInEditor) getNoteFromTextEditor(); //FIXME-2 moved to TreeItem
6.112 -
6.113 - QString s,a;
6.114 - /*
6.115 - QString scrolledAttr;
6.116 - if ( ((BranchItem*)treeItem)->isScrolled() )
6.117 - scrolledAttr=attribut ("scrolled","yes");
6.118 - else
6.119 - scrolledAttr="";
6.120 -
6.121 - // save area, if not scrolled
6.122 - QString areaAttr;
6.123 - if (!((BranchItem*) (treeItem->parent()) )->isScrolled() )
6.124 - {
6.125 - areaAttr=
6.126 - attribut("x1",QString().setNum(absPos.x()-offset.x())) +
6.127 - attribut("y1",QString().setNum(absPos.y()-offset.y())) +
6.128 - attribut("x2",QString().setNum(absPos.x()+width()-offset.x())) +
6.129 - attribut("y2",QString().setNum(absPos.y()+height()-offset.y()));
6.130 -
6.131 - } else
6.132 - areaAttr="";
6.133 -
6.134 - // Providing an ID for a branch makes export to XHTML easier
6.135 - QString idAttr;
6.136 - if (treeItem->xlinkCount()>0)
6.137 - idAttr=attribut ("id",model->getSelectString(this)); //TODO directly access model
6.138 - else
6.139 - idAttr="";
6.140 -
6.141 - s=beginElement ("branch"
6.142 - +getOrnXMLAttr()
6.143 - +scrolledAttr
6.144 - +areaAttr
6.145 - +idAttr
6.146 - +getIncludeImageAttr() );
6.147 - incIndent();
6.148 -
6.149 - // save heading
6.150 - s+=valueElement("heading", treeItem->getHeading(),
6.151 - attribut ("textColor",QColor(heading->getColor()).name()));
6.152 -
6.153 - // Save frame
6.154 - if (frame->getFrameType()!=FrameObj::NoFrame)
6.155 - s+=frame->saveToDir ();
6.156 -
6.157 - // save names of flags set
6.158 - s+=standardFlags->saveToDir(tmpdir,prefix,0);
6.159 -
6.160 - // Save FloatImages
6.161 - for (int i=0; i<floatimage.size(); ++i)
6.162 - s+=floatimage.at(i)->saveToDir (tmpdir,prefix);
6.163 -
6.164 - // save note
6.165 - if (!treeItem->getNoteObj().isEmpty() )
6.166 - s+=treeItem->getNoteObj().saveToDir();
6.167 -
6.168 - // Save branches
6.169 - for (int i=0; i<treeItem->branchCount(); ++i)
6.170 - s+=treeItem->getBranchObjNum(i)->saveToDir(tmpdir,prefix,offset);
6.171 -
6.172 - // Save XLinks
6.173 - QString ol; // old link
6.174 - QString cl; // current link
6.175 - for (int i=0; i<xlink.size(); ++i)
6.176 - {
6.177 - cl=xlink.at(i)->saveToDir();
6.178 - if (cl!=ol)
6.179 - {
6.180 - s+=cl;
6.181 - ol=cl;
6.182 - } else
6.183 - {
6.184 - qWarning (QString("Ignoring of duplicate xLink in %1").arg(treeItem->getHeading()));
6.185 - }
6.186 - }
6.187 -
6.188 - decIndent();
6.189 - s+=endElement ("branch");
6.190 - return s;
6.191 -*/
6.192 -}
6.193
6.194 void BranchObj::addXLink (XLinkObj *xlo)
6.195 {
6.196 @@ -732,66 +690,6 @@
6.197 */
6.198 }
6.199
6.200 -bool BranchObj::canMoveBranchUp() // FIXME-1 move to BranchItem
6.201 -{
6.202 -/*
6.203 - if (!parObj || depth==1) return false;
6.204 - BranchObj* par=(BranchObj*)parObj;
6.205 - if (this==par->getTreeItem()->getFirstBranch())
6.206 - return false;
6.207 - else
6.208 - return true;
6.209 - */
6.210 -return false;
6.211 -}
6.212 -
6.213 -BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // FIXME-1
6.214 -{
6.215 -/*
6.216 - savePosInAngle();
6.217 - int i=branch.indexOf(bo1);
6.218 - if (i>0)
6.219 - { // -1 if bo1 not found
6.220 - treeItem->getBranchObjNum(i)->angle--;
6.221 - treeItem->getBranchObjNum(i-1)->angle++;
6.222 - qSort (branch.begin(),branch.end(), isAbove);
6.223 - return treeItem->getBranchObjNum(i);
6.224 - } else
6.225 -*/
6.226 - return NULL;
6.227 -}
6.228 -
6.229 -bool BranchObj::canMoveBranchDown() //FIXME-1 move to BranchItem
6.230 -{
6.231 - /*
6.232 - if (!parObj|| depth==1) return false;
6.233 - BranchObj* par=(BranchObj*)parObj;
6.234 - if (this==par->getTreeItem()->getLastBranch())
6.235 - return false;
6.236 - else
6.237 - return true;
6.238 - */
6.239 -return false;
6.240 -}
6.241 -
6.242 -BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// FIXME-1
6.243 -{
6.244 -/*
6.245 - savePosInAngle();
6.246 - int i=branch.indexOf(bo1);
6.247 - int j;
6.248 - if (i <treeItem->branchCount())
6.249 - {
6.250 - j = i+1;
6.251 - treeItem->getBranchObjNum(i)->angle++;
6.252 - treeItem->getBranchObjNum(j)->angle--;
6.253 - qSort (branch.begin(),branch.end(), isAbove);
6.254 - return treeItem->getBranchObjNum(i);
6.255 - } else
6.256 -*/
6.257 - return NULL;
6.258 -}
6.259 -
6.260 void BranchObj::sortChildren() //FIXME-2
6.261 {
6.262 /*
6.263 @@ -1070,65 +968,6 @@
6.264 bboxTotal.setHeight(max (r.height(), bbox.height()));
6.265 }
6.266
6.267 -/*
6.268 -void BranchObj::select() // FIXME-4 try to get rid of this in BO completely
6.269 -{
6.270 - cout << "BO::select()\n";
6.271 - textEditor->setText(treeItem->getNoteObj().getNote() );
6.272 - QString fnh=treeItem->getNoteObj().getFilenameHint();
6.273 - if (fnh!="")
6.274 - textEditor->setFilenameHint(treeItem->getNoteObj().getFilenameHint() );
6.275 - else
6.276 - textEditor->setFilenameHint(getHeading() );
6.277 - textEditor->setFontHint (treeItem->getNoteObj().getFontHint() );
6.278 - //isNoteInEditor=true;
6.279 -
6.280 - // set selected and visible
6.281 - LinkableMapObj::select();
6.282 -
6.283 - //if (po) po->setLastSelectedBranch(this); needed?
6.284 -
6.285 - // temporary unscroll, if we have scrolled parents somewhere
6.286 - if (parObj) ((BranchObj*)(parObj))->tmpUnscroll();
6.287 -
6.288 - //moved to vymmodel or vymview...
6.289 - // Show URL and link in statusbar
6.290 - QString status;
6.291 - if (!url.isEmpty()) status+="URL: "+url+" ";
6.292 - if (!vymLink.isEmpty()) status+="Link: "+vymLink;
6.293 - if (!status.isEmpty()) mainWindow->statusMessage (status);
6.294 -
6.295 - // Update Toolbar
6.296 - updateFlagsToolbar();
6.297 -
6.298 - // Update actions
6.299 - model->updateActions();
6.300 -}
6.301 - */
6.302 -
6.303 -/*
6.304 -void BranchObj::unselect() //FIXME-4 should not be needed
6.305 -{
6.306 - cout << "BO::unselect()\n";
6.307 - LinkableMapObj::unselect();
6.308 - // Delete any messages like vymLink in StatusBar
6.309 - mainWindow->statusMessage (""); //this causes segfault, when MainWindow is already gone in global destructor on quitting vym
6.310 -
6.311 - // Save current note
6.312 - if (isNoteInEditor) getNoteFromTextEditor();
6.313 - isNoteInEditor=false;
6.314 -
6.315 - // reset temporary unscroll, if we have scrolled parents somewhere
6.316 - if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll();
6.317 -
6.318 - // Erase content of editor
6.319 - textEditor->setInactive();
6.320 -
6.321 - // unselect all buttons in toolbar
6.322 - standardFlagsDefault->updateToolbar();
6.323 -}
6.324 -*/
6.325 -
6.326 QString BranchObj::getSelectString()
6.327 {
6.328 return model->getSelectString (this);
7.1 --- a/branchobj.h Thu May 07 08:48:53 2009 +0000
7.2 +++ b/branchobj.h Wed May 13 08:26:27 2009 +0000
7.3 @@ -46,9 +46,7 @@
7.4 virtual void calcBBoxSize();
7.5 virtual void setDockPos();
7.6
7.7 - virtual void updateHeading ();
7.8 -
7.9 - virtual QString saveToDir (const QString&,const QString&, const QPointF&);// Save data recursivly to tempdir
7.10 + virtual void updateData(); //! Update represantatio of heading, flags, etc.
7.11
7.12 virtual void addXLink (XLinkObj*);
7.13 virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
7.14 @@ -79,11 +77,6 @@
7.15 virtual void removeBranch(BranchObj*);
7.16 virtual void removeBranchPtr (BranchObj*);
7.17
7.18 - virtual bool canMoveBranchUp();
7.19 - virtual BranchObj* moveBranchUp(BranchObj*);
7.20 - virtual bool canMoveBranchDown();
7.21 - virtual BranchObj* moveBranchDown(BranchObj*);
7.22 -
7.23 virtual void sortChildren();
7.24 virtual void alignRelativeTo(const QPointF, bool alignSelf=false );
7.25 virtual void reposition();
7.26 @@ -107,8 +100,6 @@
7.27 public:
7.28 float angle; // used in mainbranch to reorder mainbranches
7.29 protected:
7.30 -// bool scrolled; // true if all children are scrolled and thus invisible
7.31 -// bool tmpUnscrolled; // can only be true (temporary) for a scrolled subtree
7.32 bool includeImagesVer; // include floatimages in bbox vertically
7.33 bool includeImagesHor; // include floatimages in bbox horizontally
7.34 };
8.1 --- a/branchpropwindow.cpp Thu May 07 08:48:53 2009 +0000
8.2 +++ b/branchpropwindow.cpp Wed May 13 08:26:27 2009 +0000
8.3 @@ -27,13 +27,14 @@
8.4 ui.framePenColorButton->setPixmap (pix);
8.5 ui.frameBrushColorButton->setPixmap (pix);
8.6
8.7 - // Create Model and View to hold attributes
8.8 + // Create Model and View to hold attributes
8.9 + /*
8.10 attributeModel = new QStandardItemModel (1,3,this);
8.11 attributeModel->setHeaderData(0, Qt::Horizontal, tr("Name","Branchprop window: Attribute name"));
8.12 attributeModel->setHeaderData(1, Qt::Horizontal, tr("Value","Branchprop window: Attribute value"));
8.13 attributeModel->setHeaderData(2, Qt::Horizontal, tr("Type","Branchprop window: Attribute type"));
8.14 ui.attributeTableView->setModel (attributeModel);
8.15 -
8.16 + */
8.17
8.18 // Load Settings
8.19 resize (settings.value ( "/satellite/propertywindow/geometry/size", QSize(450,600)).toSize());
8.20 @@ -56,7 +57,7 @@
8.21 settings.setValue( "/satellite/propertywindow/showWithMain",isVisible() );
8.22 }
8.23
8.24 -void BranchPropertyWindow::setBranch (BranchObj *bo)
8.25 +void BranchPropertyWindow::setBranch (BranchObj *bo) //FIXME-2 maybe do this via signals emitted anyway from model?
8.26 {
8.27 disconnectSignals();
8.28 branch=bo;
8.29 @@ -122,10 +123,10 @@
8.30 else
8.31 ui.incImgHor->setCheckState (Qt::Unchecked);
8.32
8.33 +/*
8.34 // Attributes
8.35 attributeModel->removeRows(0, attributeModel->rowCount(), QModelIndex());
8.36
8.37 -/*
8.38 // FIXME-3 some samples for attribute testing
8.39 QStringList attrTypes=mapEditor->attributeTable()->getTypes();
8.40 for (int i=0; i<attrTypes.count()-1;i++)
8.41 @@ -241,6 +242,7 @@
8.42 return;
8.43 }
8.44
8.45 +/*
8.46 void BranchPropertyWindow::addAttributeClicked()
8.47 {
8.48 // Add empty line for adding attributes
8.49 @@ -265,6 +267,7 @@
8.50 {
8.51 //FIXME-3 cout << "BPW::delete\n";
8.52 }
8.53 +*/
8.54
8.55 void BranchPropertyWindow::connectSignals()
8.56 {
8.57 @@ -299,6 +302,7 @@
8.58 ui.incImgHor, SIGNAL (stateChanged( int)),
8.59 this, SLOT (incImgHorChanged (int)));
8.60
8.61 +/*
8.62 // Attributes
8.63 connect (
8.64 ui.addAttributeButton, SIGNAL (clicked()),
8.65 @@ -306,6 +310,7 @@
8.66 connect (
8.67 ui.deleteAttributeButton, SIGNAL (clicked()),
8.68 this, SLOT (deleteAttributeClicked()));
8.69 +*/
8.70 }
8.71
8.72
8.73 @@ -326,8 +331,10 @@
8.74 disconnect ( ui.incImgHor, 0,0,0);
8.75
8.76 // Attributes
8.77 + /*
8.78 disconnect ( ui.addAttributeButton, 0,0,0);
8.79 disconnect ( ui.deleteAttributeButton, 0,0,0);
8.80 + */
8.81 }
8.82
8.83
9.1 --- a/branchpropwindow.h Thu May 07 08:48:53 2009 +0000
9.2 +++ b/branchpropwindow.h Wed May 13 08:26:27 2009 +0000
9.3 @@ -8,7 +8,7 @@
9.4 #include <QtGui>
9.5
9.6
9.7 -#include "attributedelegate.h"
9.8 +//#include "attributedelegate.h"
9.9 #include "branchobj.h"
9.10 #include "vymmodel.h"
9.11
9.12 @@ -32,8 +32,8 @@
9.13 void linkHideUnselectedChanged (int);
9.14 void incImgVerChanged (int);
9.15 void incImgHorChanged (int);
9.16 - void addAttributeClicked();
9.17 - void deleteAttributeClicked();
9.18 +// void addAttributeClicked();
9.19 +// void deleteAttributeClicked();
9.20
9.21 signals:
9.22 void windowClosed();
9.23 @@ -53,9 +53,9 @@
9.24 QColor penColor;
9.25 QColor brushColor;
9.26
9.27 - QAbstractItemModel *attributeModel;
9.28 +// QAbstractItemModel *attributeModel;
9.29
9.30 - AttributeDelegate delegate;
9.31 +// AttributeDelegate delegate;
9.32 };
9.33
9.34 #endif //
10.1 --- a/flagobj.cpp Thu May 07 08:48:53 2009 +0000
10.2 +++ b/flagobj.cpp Wed May 13 08:26:27 2009 +0000
10.3 @@ -20,6 +20,13 @@
10.4 copy (io);
10.5 }
10.6
10.7 +FlagObj::FlagObj (Flag* f)
10.8 +{
10.9 + init();
10.10 + name=f->getName();
10.11 + icon->load(f->getPixmap());
10.12 +}
10.13 +
10.14 FlagObj::~FlagObj()
10.15 {
10.16 // cout << "Destr FlagObj this="<<this <<" " << qPrintable(name) << "\n";
10.17 @@ -30,27 +37,20 @@
10.18 void FlagObj::init ()
10.19 {
10.20 name="undefined";
10.21 - unsetGroup();
10.22
10.23 icon=new ImageObj (scene);
10.24 icon->setPos (absPos.x(), absPos.y() );
10.25 state=false;
10.26 - used=false;
10.27 avis=true;
10.28 - action=NULL;
10.29 }
10.30
10.31 void FlagObj::copy (FlagObj* other)
10.32 {
10.33 MapObj::copy(other);
10.34 name=other->name;
10.35 - group=other->group;
10.36 - tooltip=other->tooltip;
10.37 state=other->state;
10.38 avis=other->avis;
10.39 - used=other->used;
10.40 icon->copy(other->icon);
10.41 - action=other->action;
10.42 setVisibility (other->isVisibleObj() );
10.43 }
10.44
10.45 @@ -99,51 +99,6 @@
10.46 return name;
10.47 }
10.48
10.49 -void FlagObj::setGroup (const QString &n)
10.50 -{
10.51 - group=n;
10.52 -}
10.53 -
10.54 -const QString FlagObj::getGroup()
10.55 -{
10.56 - return group;
10.57 -}
10.58 -
10.59 -void FlagObj::unsetGroup()
10.60 -{
10.61 - group="undefined";
10.62 -}
10.63 -
10.64 -void FlagObj::setToolTip(const QString &n)
10.65 -{
10.66 - tooltip=n;
10.67 -}
10.68 -
10.69 -const QString FlagObj::getToolTip()
10.70 -{
10.71 - return tooltip;
10.72 -}
10.73 -
10.74 -QPixmap FlagObj::getPixmap()
10.75 -{
10.76 - return icon->pixmap();
10.77 -}
10.78 -
10.79 -void FlagObj::setAction (QAction* a)
10.80 -{
10.81 - action=a;
10.82 -}
10.83 -
10.84 -void FlagObj::updateAction ()
10.85 -{
10.86 - if (action)
10.87 - {
10.88 - action->setChecked(state);
10.89 - if (!avis)
10.90 - action->setVisible(state);
10.91 - }
10.92 -}
10.93 -
10.94 void FlagObj::setAlwaysVisible(bool b)
10.95 {
10.96 avis=b;
10.97 @@ -189,16 +144,6 @@
10.98 }
10.99 }
10.100
10.101 -void FlagObj::setUsed (bool b)
10.102 -{
10.103 - used=b;
10.104 -}
10.105 -
10.106 -bool FlagObj::isUsed()
10.107 -{
10.108 - return used;
10.109 -}
10.110 -
10.111 void FlagObj::saveToDir (const QString &tmpdir, const QString &prefix)
10.112 {
10.113 QString fn=tmpdir + prefix + name + ".png";
11.1 --- a/flagobj.h Thu May 07 08:48:53 2009 +0000
11.2 +++ b/flagobj.h Wed May 13 08:26:27 2009 +0000
11.3 @@ -5,6 +5,7 @@
11.4 #include <QAction>
11.5 #include <QPixmap>
11.6
11.7 +#include "flag.h"
11.8 #include "mapobj.h"
11.9 #include "imageobj.h"
11.10
11.11 @@ -20,6 +21,7 @@
11.12 FlagObj ();
11.13 FlagObj (QGraphicsScene*);
11.14 FlagObj (FlagObj*);
11.15 + FlagObj (Flag*);
11.16 ~FlagObj ();
11.17 virtual void init ();
11.18 virtual void copy (FlagObj*);
11.19 @@ -30,36 +32,24 @@
11.20 void load (const QPixmap&);
11.21 void setName (const QString&);
11.22 const QString getName ();
11.23 - void setGroup (const QString&);
11.24 - const QString getGroup();
11.25 - void unsetGroup ();
11.26 - void setToolTip(const QString&);
11.27 - const QString getToolTip();
11.28 QPixmap getPixmap();
11.29 void setAction(QAction*);
11.30 - void updateAction ();
11.31 void setAlwaysVisible (bool b);
11.32 bool isAlwaysVisible ();
11.33 bool isActive();
11.34 void toggle();
11.35 void activate();
11.36 void deactivate();
11.37 - void setUsed (bool);
11.38 - bool isUsed();
11.39 void saveToDir (const QString&, const QString&);
11.40
11.41 protected:
11.42 QString name;
11.43 - QString group;
11.44 - QString tooltip;
11.45 bool state;
11.46 bool avis;
11.47 - bool used;
11.48 virtual void positionBBox();
11.49 virtual void calcBBoxSize();
11.50 private:
11.51 ImageObj* icon;
11.52 - QAction* action;
11.53 };
11.54
11.55 #endif
12.1 --- a/flagrowobj.cpp Thu May 07 08:48:53 2009 +0000
12.2 +++ b/flagrowobj.cpp Wed May 13 08:26:27 2009 +0000
12.3 @@ -3,6 +3,7 @@
12.4 #include <iostream>
12.5 using namespace std;
12.6
12.7 +#include "flag.h"
12.8 #include "flagrowobj.h"
12.9
12.10 #include "geometry.h"
12.11 @@ -31,30 +32,17 @@
12.12
12.13 void FlagRowObj::init ()
12.14 {
12.15 - parentRow=NULL;
12.16 showFlags=true;
12.17 }
12.18
12.19 void FlagRowObj::copy (FlagRowObj* other)
12.20 {
12.21 MapObj::copy(other);
12.22 - parentRow=other->parentRow;
12.23 flag.clear();
12.24 for (int i=0; i<flag.size(); ++i)
12.25 addFlag (flag.at(i));
12.26 }
12.27
12.28 -void FlagRowObj::clone (FlagRowObj* pr)
12.29 -{
12.30 - // Difference to copy:
12.31 - // We don't copy the flags here, they
12.32 - // are created on the fly by toggle and activate
12.33 - // This saves lots of canvas objects.
12.34 - MapObj::copy(pr);
12.35 - flag.clear();
12.36 - parentRow=pr;
12.37 -}
12.38 -
12.39 void FlagRowObj::move(double x, double y)
12.40 {
12.41 MapObj::move(x,y);
12.42 @@ -89,6 +77,14 @@
12.43 return newfo;
12.44 }
12.45
12.46 +QStringList FlagRowObj::activeFlagNames()
12.47 +{
12.48 + QStringList list;
12.49 + for (int i=0; i<flag.size(); ++i)
12.50 + list.append (flag.at(i)->getName());
12.51 + return list;
12.52 +}
12.53 +
12.54 void FlagRowObj::positionBBox()
12.55 {
12.56 bbox.moveTopLeft(absPos );
12.57 @@ -124,84 +120,28 @@
12.58
12.59 bool FlagRowObj::isActive (const QString &foname)
12.60 {
12.61 +
12.62 FlagObj *fo=findFlag (foname);
12.63 - if (parentRow && fo)
12.64 - return fo->isActive();
12.65 + if (fo)
12.66 + return true;
12.67 else
12.68 - if (fo) return true;
12.69 - return false;
12.70 + return false;
12.71 }
12.72
12.73 -void FlagRowObj::toggle (const QString &foname)
12.74 +void FlagRowObj::activate (Flag *flag)
12.75 {
12.76 - FlagObj *fo=findFlag (foname);
12.77 - if (fo)
12.78 + if (flag)
12.79 {
12.80 - // FlagObj is here, it will be active, too.
12.81 - // Deactivate it by removing it from this row.
12.82 - flag.remove (fo);
12.83 - delete (fo);
12.84 - } else
12.85 - {
12.86 - // FlagObj is not present in this row.
12.87 - // Copy it from parentRow
12.88 - fo=parentRow->findFlag (foname);
12.89 - if (fo)
12.90 - {
12.91 - fo=addFlag (fo);
12.92 - fo->activate();
12.93 - /*FIXME-0 move to VM if (exclusive)
12.94 - {
12.95 - deactivateGroup (fo);
12.96 - updateToolbar();
12.97 - }
12.98 - */
12.99 - } else
12.100 - qWarning ("FlagRowObj ("+name+")::toggle ("+foname+") failed - could not find it in parentRow");
12.101 - }
12.102 - calcBBoxSize();
12.103 - positionBBox();
12.104 -}
12.105 -
12.106 -void FlagRowObj::activate (const QString &foname)
12.107 -{
12.108 - cout << "FRO::activate "<<foname.toStdString()<<endl;
12.109 - // Note: "activate" is also called during loading of a map
12.110 - // Here we do not check for exclusive flags!
12.111 - FlagObj *fo=findFlag (foname);
12.112 - if (parentRow)
12.113 - {
12.114 - if (!fo)
12.115 - {
12.116 - // FlagObj is not present in this row.
12.117 - // Copy it from parentRow and activate there
12.118 - fo=parentRow->findFlag (foname);
12.119 - if (fo)
12.120 - {
12.121 - fo=addFlag (fo);
12.122 - fo->activate();
12.123 - if (showFlags)
12.124 - fo->setVisibility (visible);
12.125 - else
12.126 - fo->setVisibility (false);
12.127 - calcBBoxSize();
12.128 - } else
12.129 - qWarning ("FlagRowObj ("+name+")::activate ("+foname+") failed - could not find it in parentRow");
12.130 - }
12.131 - } else
12.132 - {
12.133 - // I am the parentRow, mark flag as used
12.134 - if (fo)
12.135 - {
12.136 - fo->setUsed(true);
12.137 - fo->activate();
12.138 - }
12.139 + FlagObj *fo=addFlag (new FlagObj (flag));
12.140 + fo->activate();
12.141 + if (showFlags) // FIXME-3 necessary? only called from FIO::init
12.142 + fo->setVisibility (visible);
12.143 else
12.144 - qWarning ("FlagRowObj::activate no FlagObj \""+foname+"\" found in parentRow");
12.145 + fo->setVisibility (false);
12.146 + calcBBoxSize();
12.147 }
12.148 }
12.149
12.150 -
12.151 void FlagRowObj::deactivate (const QString &foname)
12.152 {
12.153 FlagObj *fo=findFlag (foname);
12.154 @@ -214,116 +154,11 @@
12.155 positionBBox();
12.156 }
12.157
12.158 -void FlagRowObj::deactivateAll ()
12.159 -{
12.160 - if (!parentRow)
12.161 - {
12.162 - for (int i=0; i<flag.size(); ++i)
12.163 - if (flag.at(i)->isActive()) flag.at(i)->deactivate();
12.164 - } else
12.165 - {
12.166 - while (!flag.isEmpty())
12.167 - delete flag.takeFirst();
12.168 - calcBBoxSize();
12.169 - positionBBox();
12.170 - }
12.171 -}
12.172 -
12.173 -void FlagRowObj::deactivateGroup (FlagObj *keepfo) //FIXME-0 move to VM
12.174 -{
12.175 - // deactivate all flags in keepof, but keep keepfo [sic!]
12.176 - if (keepfo)
12.177 - {
12.178 - QString g=keepfo->getGroup();
12.179 - if (g!="undefined")
12.180 - {
12.181 - for (int i=0; i<flag.size(); ++i)
12.182 - if (g==flag.at(i)->getGroup() && keepfo!=flag.at(i))
12.183 - {
12.184 - FlagObj *fo=flag.at(i);
12.185 - flag.remove (fo);
12.186 - delete (fo);
12.187 - }
12.188 - }
12.189 - }
12.190 -}
12.191 -
12.192 -void FlagRowObj::setToolBar(QToolBar *tb)
12.193 -{
12.194 - toolbar=tb;
12.195 -}
12.196 -
12.197 -void FlagRowObj::setEnabled (bool b)
12.198 -{
12.199 - if (toolbar)
12.200 - {
12.201 - toolbar->setEnabled (b);
12.202 - }
12.203 -}
12.204 -
12.205 void FlagRowObj::setShowFlags (bool b)
12.206 {
12.207 showFlags=b;
12.208 }
12.209
12.210 -void FlagRowObj::resetUsedCounter()
12.211 -{
12.212 - for (int i=0; i<flag.size(); ++i)
12.213 - flag.at(i)->setUsed (false);
12.214 -}
12.215 -
12.216 -QString FlagRowObj::saveToDir (const QString &tmpdir,const QString &prefix, bool writeflags)
12.217 -{
12.218 - // Build xml string
12.219 - QString s;
12.220 - if (parentRow)
12.221 - for (int i=0; i<flag.size(); ++i)
12.222 - {
12.223 - // save flag to xml, if flag is set
12.224 - s+=valueElement("standardflag",flag.at(i)->getName() );
12.225 -
12.226 - // and tell parentRow, that this flag is used
12.227 - parentRow->activate(flag.at(i)->getName() );
12.228 - }
12.229 - else
12.230 - // Save icons to dir, if verbose is set (xml export)
12.231 - // and I am a parentRow
12.232 - // and this flag is really used somewhere
12.233 - if (writeflags)
12.234 - for (int i=0; i<flag.size(); ++i)
12.235 - if (flag.at(i)->isUsed()) flag.at(i)->saveToDir (tmpdir,prefix);
12.236 - return s;
12.237 -
12.238 -}
12.239 -
12.240 -void FlagRowObj::setName (const QString &n)
12.241 -{
12.242 - name=n;
12.243 -}
12.244 -
12.245 -void FlagRowObj::updateToolbar() //FIXME-2 this needs to be changed with VM
12.246 -{
12.247 - if (parentRow)
12.248 - {
12.249 - // We are just a branch, not the toolbar default
12.250 - // but state has to be copied from ourselves to parentrow!
12.251 - parentRow->deactivateAll();
12.252 - // In parentRow activate all existing (==active) flags
12.253 - for (int i=0; i<flag.size(); ++i)
12.254 - parentRow->activate(flag.at(i)->getName());
12.255 - parentRow->updateToolbar();
12.256 - } else
12.257 - {
12.258 - // We are the toolbar default
12.259 - if (toolbar)
12.260 - {
12.261 - // Update state of actions in toolbar
12.262 - for (int i=0; i<flag.size(); ++i)
12.263 - flag.at(i)->updateAction();
12.264 - }
12.265 - }
12.266 -}
12.267 -
12.268 FlagObj* FlagRowObj::findFlag (const QString &name)
12.269 {
12.270 for (int i=0; i<flag.size(); ++i)
13.1 --- a/flagrowobj.h Thu May 07 08:48:53 2009 +0000
13.2 +++ b/flagrowobj.h Wed May 13 08:26:27 2009 +0000
13.3 @@ -6,47 +6,35 @@
13.4 //#include "mapobj.h"
13.5 #include "flagobj.h"
13.6
13.7 -/*! \brief A collection of flags (FlagObj).
13.8 +class Flag;
13.9 +
13.10 +/*! \brief A collection of flags (FlagObj) in a map.
13.11
13.12 The flags are aligned horizontally in a row on the map.
13.13 - A toolbar can be created from the flags in this row.
13.14 */
13.15
13.16 -class FlagRowObj:public MapObj { // FIXME-0 move pixmaps to mainwindow or model in the end...
13.17 +class FlagRowObj:public MapObj {
13.18 public:
13.19 FlagRowObj ();
13.20 FlagRowObj (QGraphicsScene *);
13.21 ~FlagRowObj ();
13.22 virtual void init ();
13.23 virtual void copy (FlagRowObj*);
13.24 - virtual void clone(FlagRowObj*);
13.25 virtual void move (double,double);
13.26 virtual void moveBy (double,double);
13.27 virtual void setVisibility(bool);
13.28 virtual FlagObj* addFlag (FlagObj *fo); // make deep copy of FlagObj
13.29 + virtual QStringList activeFlagNames();
13.30 virtual void positionBBox();
13.31 virtual void calcBBoxSize();
13.32 virtual QString getFlagName (const QPointF &p); // Find flag by position
13.33 bool isActive(const QString&);
13.34 - void toggle (const QString &name);
13.35 - void activate(const QString&);
13.36 + void activate (Flag *flag);
13.37 void deactivate(const QString&);
13.38 - void deactivateAll();
13.39 - void deactivateGroup(FlagObj *); //FIXME-0
13.40 - void setToolBar (QToolBar *); //FIXME-0
13.41 - void setEnabled (bool);
13.42 void setShowFlags (bool);
13.43 - void resetUsedCounter();
13.44 - QString saveToDir (const QString &,const QString &,bool);
13.45 - void setName (const QString&); // prefix for exporting flags to dir
13.46 - void makeToolbar (QMainWindow*, const QString &); // Create Toolbar buttons FIXME-0
13.47 - void updateToolbar(); // Update Toolbar buttons FIXME-0
13.48 private:
13.49 - FlagRowObj* parentRow; // look for flags in this row
13.50 FlagObj* findFlag (const QString&);
13.51 QList <FlagObj*> flag;
13.52 - QToolBar *toolbar;
13.53 - QString name;
13.54 bool showFlags; // FloatObjects want to hide their flags
13.55 };
13.56 #endif
14.1 --- a/main.cpp Thu May 07 08:48:53 2009 +0000
14.2 +++ b/main.cpp Wed May 13 08:26:27 2009 +0000
14.3 @@ -3,6 +3,7 @@
14.4 #include <iostream>
14.5 using namespace std;
14.6
14.7 +#include "flagrow.h"
14.8 #include "flagrowobj.h"
14.9 #include "mainwindow.h"
14.10 #include "options.h"
14.11 @@ -36,9 +37,8 @@
14.12 QString flagsPath; // Pointing to flags
14.13 bool clipboardEmpty;
14.14 bool debug; // global debugging flag
14.15 -FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
14.16 -FlagRowObj *standardFlagsDefault;
14.17 -
14.18 +FlagRow *systemFlagsMaster;
14.19 +FlagRow *standardFlagsMaster;
14.20
14.21 Settings settings ("InSilmaril","vym"); // Organization, Application name
14.22
14.23 @@ -158,11 +158,12 @@
14.24 translator.load( QString("vym_")+QTextCodec::locale(), vymBaseDir.path() + "/lang");
14.25 app.installTranslator( &translator );
14.26
14.27 - // Initializing the row of system flags
14.28 - // is done in first call to MapEditor(),
14.29 - // because we need at least one canvas first
14.30 - systemFlagsDefault=NULL;
14.31 - standardFlagsDefault=NULL;
14.32 + // Initializing the master rows of flags
14.33 + systemFlagsMaster=new FlagRow;
14.34 + systemFlagsMaster->setName ("systemFlagsMaster");
14.35 + standardFlagsMaster=new FlagRow;
14.36 + standardFlagsMaster->setName ("standardFlagsMaster");
14.37 +
14.38
14.39 // Initialize window of TextEditor
14.40 textEditor = new TextEditor();
15.1 --- a/mainwindow.cpp Thu May 07 08:48:53 2009 +0000
15.2 +++ b/mainwindow.cpp Wed May 13 08:26:27 2009 +0000
15.3 @@ -12,7 +12,7 @@
15.4 #include "exportoofiledialog.h"
15.5 #include "exports.h"
15.6 #include "file.h"
15.7 -#include "flagrowobj.h"
15.8 +#include "flagrow.h"
15.9 #include "historywindow.h"
15.10 #include "imports.h"
15.11 #include "mapeditor.h"
15.12 @@ -43,8 +43,8 @@
15.13 extern QString clipboardFile;
15.14 extern bool clipboardEmpty;
15.15 extern int statusbarTime;
15.16 -extern FlagRowObj* standardFlagsDefault;
15.17 -extern FlagRowObj* systemFlagsDefault;
15.18 +extern FlagRow *standardFlagsMaster;
15.19 +extern FlagRow *systemFlagsMaster;
15.20 extern QString vymName;
15.21 extern QString vymVersion;
15.22 extern QString vymBuildDate;
15.23 @@ -1187,229 +1187,217 @@
15.24 {
15.25 // Create System Flags
15.26 QToolBar *tb=NULL;
15.27 - bool avis=true;
15.28 -
15.29 - systemFlagsDefault = new FlagRowObj ();
15.30 - systemFlagsDefault->setVisibility (false);
15.31 - systemFlagsDefault->setName ("systemFlagsDef");
15.32 -
15.33 - FlagObj *fo = new FlagObj ();
15.34 - fo->load(QPixmap(flagsPath+"flag-note.png"));
15.35 - setupFlag (fo,tb,avis,"note",tr("Note","SystemFlag"));
15.36 -
15.37 - fo->load(QPixmap(flagsPath+"flag-url.png"));
15.38 - setupFlag (fo,tb,avis,"url",tr("URL to Document ","SystemFlag"));
15.39 +
15.40 + Flag *flag=new Flag;;
15.41 +
15.42 + flag->load(QPixmap(flagsPath+"flag-note.png"));
15.43 + setupFlag (flag,tb,"system-note",tr("Note","SystemFlag"));
15.44 +
15.45 + flag->load(QPixmap(flagsPath+"flag-url.png"));
15.46 + setupFlag (flag,tb,"system-url",tr("URL to Document ","SystemFlag"));
15.47
15.48 - fo->load(QPixmap(flagsPath+"flag-vymlink.png"));
15.49 - setupFlag (fo,tb,avis,"vymLink",tr("Link to another vym map","SystemFlag"));
15.50 -
15.51 - fo->load(QPixmap(flagsPath+"flag-scrolled-right.png"));
15.52 - setupFlag (fo,tb,avis,"scrolledright",tr("subtree is scrolled","SystemFlag"));
15.53 + flag->load(QPixmap(flagsPath+"flag-vymlink.png"));
15.54 + setupFlag (flag,tb,"system-vymLink",tr("Link to another vym map","SystemFlag"));
15.55 +
15.56 + flag->load(QPixmap(flagsPath+"flag-scrolled-right.png"));
15.57 + setupFlag (flag,tb,"system-scrolledright",tr("subtree is scrolled","SystemFlag"));
15.58
15.59 - fo->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png"));
15.60 - setupFlag (fo,tb,avis,"tmpUnscrolledright",tr("subtree is temporary scrolled","SystemFlag"));
15.61 -
15.62 - fo->load(QPixmap(flagsPath+"flag-hideexport.png"));
15.63 - setupFlag (fo,tb,avis,"hideInExport",tr("Hide object in exported maps","SystemFlag"));
15.64 + flag->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png"));
15.65 + setupFlag (flag,tb,"system-tmpUnscrolledright",tr("subtree is temporary scrolled","SystemFlag"));
15.66 +
15.67 + flag->load(QPixmap(flagsPath+"flag-hideexport.png"));
15.68 + setupFlag (flag,tb,"system-hideInExport",tr("Hide object in exported maps","SystemFlag"));
15.69
15.70 // Create Standard Flags
15.71 tb=addToolBar (tr ("Standard Flags","Standard Flag Toolbar"));
15.72 tb->setObjectName ("standardFlagTB");
15.73
15.74 - standardFlagsDefault = new FlagRowObj ();
15.75 - standardFlagsDefault->setVisibility (false);
15.76 - standardFlagsDefault->setName ("standardFlagsDef");
15.77 - standardFlagsDefault->setToolBar (tb);
15.78 -
15.79 - fo->load(flagsPath+"flag-exclamationmark.png");
15.80 - fo->setGroup("standard-mark");
15.81 - setupFlag (fo,tb,avis,"exclamationmark",tr("Take care!","Standardflag"));
15.82
15.83 - fo->load(flagsPath+"flag-questionmark.png");
15.84 - fo->setGroup("standard-mark");
15.85 - setupFlag (fo,tb,avis,"questionmark",tr("Really?","Standardflag"));
15.86 -
15.87 - fo->load(flagsPath+"flag-hook-green.png");
15.88 - fo->setGroup("standard-hook");
15.89 - setupFlag (fo,tb,avis,"hook-green",tr("ok!","Standardflag"));
15.90 -
15.91 - fo->load(flagsPath+"flag-cross-red.png");
15.92 - fo->setGroup("standard-hook");
15.93 - setupFlag (fo,tb,avis,"cross-red",tr("Not ok!","Standardflag"));
15.94 - fo->unsetGroup();
15.95 -
15.96 - fo->load(flagsPath+"flag-stopsign.png");
15.97 - setupFlag (fo,tb,avis,"stopsign",tr("This won't work!","Standardflag"));
15.98 -
15.99 - fo->load(flagsPath+"flag-smiley-good.png");
15.100 - fo->setGroup("standard-smiley");
15.101 - setupFlag (fo,tb,avis,"smiley-good",tr("Good","Standardflag"));
15.102 -
15.103 - fo->load(flagsPath+"flag-smiley-sad.png");
15.104 - fo->setGroup("standard-smiley");
15.105 - setupFlag (fo,tb,avis,"smiley-sad",tr("Bad","Standardflag"));
15.106 -
15.107 - fo->load(flagsPath+"flag-smiley-omg.png");
15.108 - fo->setGroup("standard-smiley");
15.109 - setupFlag (fo,tb,avis,"smiley-omb",tr("Oh no!","Standardflag"));
15.110 + flag->load(flagsPath+"flag-exclamationmark.png");
15.111 + flag->setGroup("standard-mark");
15.112 + setupFlag (flag,tb,"exclamationmark",tr("Take care!","Standardflag"));
15.113 +
15.114 + flag->load(flagsPath+"flag-questionmark.png");
15.115 + flag->setGroup("standard-mark");
15.116 + setupFlag (flag,tb,"questionmark",tr("Really?","Standardflag"));
15.117 +
15.118 + flag->load(flagsPath+"flag-hook-green.png");
15.119 + flag->setGroup("standard-hook");
15.120 + setupFlag (flag,tb,"hook-green",tr("ok!","Standardflag"));
15.121 +
15.122 + flag->load(flagsPath+"flag-cross-red.png");
15.123 + flag->setGroup("standard-hook");
15.124 + setupFlag (flag,tb,"cross-red",tr("Not ok!","Standardflag"));
15.125 + flag->unsetGroup();
15.126 +
15.127 + flag->load(flagsPath+"flag-stopsign.png");
15.128 + setupFlag (flag,tb,"stopsign",tr("This won't work!","Standardflag"));
15.129 +
15.130 + flag->load(flagsPath+"flag-smiley-good.png");
15.131 + flag->setGroup("standard-smiley");
15.132 + setupFlag (flag,tb,"smiley-good",tr("Good","Standardflag"));
15.133 +
15.134 + flag->load(flagsPath+"flag-smiley-sad.png");
15.135 + flag->setGroup("standard-smiley");
15.136 + setupFlag (flag,tb,"smiley-sad",tr("Bad","Standardflag"));
15.137 +
15.138 + flag->load(flagsPath+"flag-smiley-omg.png");
15.139 + flag->setGroup("standard-smiley");
15.140 + setupFlag (flag,tb,"smiley-omb",tr("Oh no!","Standardflag"));
15.141 // Original omg.png (in KDE emoticons)
15.142 - fo->unsetGroup();
15.143 -
15.144 - fo->load(flagsPath+"flag-kalarm.png");
15.145 - setupFlag (fo,tb,avis,"clock",tr("Time critical","Standardflag"));
15.146 -
15.147 - fo->load(flagsPath+"flag-phone.png");
15.148 - setupFlag (fo,tb,avis,"phone",tr("Call...","Standardflag"));
15.149 -
15.150 - fo->load(flagsPath+"flag-lamp.png");
15.151 - setupFlag (fo,tb,avis,"lamp",tr("Idea!","Standardflag"));
15.152 -
15.153 - fo->load(flagsPath+"flag-arrow-up.png");
15.154 - fo->setGroup("standard-arrow");
15.155 - setupFlag (fo,tb,avis,"arrow-up",tr("Important","Standardflag"));
15.156 -
15.157 - fo->load(flagsPath+"flag-arrow-down.png");
15.158 - fo->setGroup("standard-arrow");
15.159 - setupFlag (fo,tb,avis,"arrow-down",tr("Unimportant","Standardflag"));
15.160 -
15.161 - fo->load(flagsPath+"flag-arrow-2up.png");
15.162 - fo->setGroup("standard-arrow");
15.163 - setupFlag (fo,tb,avis,"2arrow-up",tr("Very important!","Standardflag"));
15.164 -
15.165 - fo->load(flagsPath+"flag-arrow-2down.png");
15.166 - fo->setGroup("standard-arrow");
15.167 - setupFlag (fo,tb,avis,"2arrow-down",tr("Very unimportant!","Standardflag"));
15.168 - fo->unsetGroup();
15.169 -
15.170 - fo->load(flagsPath+"flag-thumb-up.png");
15.171 - fo->setGroup("standard-thumb");
15.172 - setupFlag (fo,tb,avis,"thumb-up",tr("I like this","Standardflag"));
15.173 -
15.174 - fo->load(flagsPath+"flag-thumb-down.png");
15.175 - fo->setGroup("standard-thumb");
15.176 - setupFlag (fo,tb,avis,"thumb-down",tr("I do not like this","Standardflag"));
15.177 - fo->unsetGroup();
15.178 + flag->unsetGroup();
15.179 +
15.180 + flag->load(flagsPath+"flag-kalarm.png");
15.181 + setupFlag (flag,tb,"clock",tr("Time critical","Standardflag"));
15.182 +
15.183 + flag->load(flagsPath+"flag-phone.png");
15.184 + setupFlag (flag,tb,"phone",tr("Call...","Standardflag"));
15.185 +
15.186 + flag->load(flagsPath+"flag-lamp.png");
15.187 + setupFlag (flag,tb,"lamp",tr("Idea!","Standardflag"));
15.188 +
15.189 + flag->load(flagsPath+"flag-arrow-up.png");
15.190 + flag->setGroup("standard-arrow");
15.191 + setupFlag (flag,tb,"arrow-up",tr("Important","Standardflag"));
15.192 +
15.193 + flag->load(flagsPath+"flag-arrow-down.png");
15.194 + flag->setGroup("standard-arrow");
15.195 + setupFlag (flag,tb,"arrow-down",tr("Unimportant","Standardflag"));
15.196 +
15.197 + flag->load(flagsPath+"flag-arrow-2up.png");
15.198 + flag->setGroup("standard-arrow");
15.199 + setupFlag (flag,tb,"2arrow-up",tr("Very important!","Standardflag"));
15.200 +
15.201 + flag->load(flagsPath+"flag-arrow-2down.png");
15.202 + flag->setGroup("standard-arrow");
15.203 + setupFlag (flag,tb,"2arrow-down",tr("Very unimportant!","Standardflag"));
15.204 + flag->unsetGroup();
15.205 +
15.206 + flag->load(flagsPath+"flag-thumb-up.png");
15.207 + flag->setGroup("standard-thumb");
15.208 + setupFlag (flag,tb,"thumb-up",tr("I like this","Standardflag"));
15.209 +
15.210 + flag->load(flagsPath+"flag-thumb-down.png");
15.211 + flag->setGroup("standard-thumb");
15.212 + setupFlag (flag,tb,"thumb-down",tr("I do not like this","Standardflag"));
15.213 + flag->unsetGroup();
15.214
15.215 - fo->load(flagsPath+"flag-rose.png");
15.216 - setupFlag (fo,tb,avis,"rose",tr("Rose","Standardflag"));
15.217 -
15.218 - fo->load(flagsPath+"flag-heart.png");
15.219 - setupFlag (fo,tb,avis,"heart",tr("I just love...","Standardflag"));
15.220 -
15.221 - fo->load(flagsPath+"flag-present.png");
15.222 - setupFlag (fo,tb,avis,"present",tr("Surprise!","Standardflag"));
15.223 -
15.224 - fo->load(flagsPath+"flag-flash.png");
15.225 - setupFlag (fo,tb,avis,"flash",tr("Dangerous","Standardflag"));
15.226 + flag->load(flagsPath+"flag-rose.png");
15.227 + setupFlag (flag,tb,"rose",tr("Rose","Standardflag"));
15.228 +
15.229 + flag->load(flagsPath+"flag-heart.png");
15.230 + setupFlag (flag,tb,"heart",tr("I just love...","Standardflag"));
15.231 +
15.232 + flag->load(flagsPath+"flag-present.png");
15.233 + setupFlag (flag,tb,"present",tr("Surprise!","Standardflag"));
15.234 +
15.235 + flag->load(flagsPath+"flag-flash.png");
15.236 + setupFlag (flag,tb,"flash",tr("Dangerous","Standardflag"));
15.237
15.238 // Original: xsldbg_output.png
15.239 - fo->load(flagsPath+"flag-info.png");
15.240 - setupFlag (fo,tb,avis,"info",tr("Info","Standardflag"));
15.241 + flag->load(flagsPath+"flag-info.png");
15.242 + setupFlag (flag,tb,"inflag",tr("Info","Standardflag"));
15.243
15.244 // Original khelpcenter.png
15.245 - fo->load(flagsPath+"flag-lifebelt.png");
15.246 - setupFlag (fo,tb,avis,"lifebelt",tr("This will help","Standardflag"));
15.247 + flag->load(flagsPath+"flag-lifebelt.png");
15.248 + setupFlag (flag,tb,"lifebelt",tr("This will help","Standardflag"));
15.249
15.250 // Freemind flags
15.251
15.252 - avis=false;
15.253 -
15.254 - fo->load(flagsPath+"freemind/warning.png");
15.255 - setupFlag (fo,tb, avis, "freemind-warning",tr("Important","Freemind-Flag"));
15.256 + flag->load(flagsPath+"freemind/warning.png");
15.257 + setupFlag (flag,tb, "freemind-warning",tr("Important","Freemind-Flag"));
15.258
15.259 for (int i=1; i<8; i++)
15.260 {
15.261 - fo->load(flagsPath+QString("freemind/priority-%1.png").arg(i));
15.262 - setupFlag (fo,tb, avis,QString("freemind-priority-%1").arg(i),tr("Priority","Freemind-Flag"));
15.263 + flag->load(flagsPath+QString("freemind/priority-%1.png").arg(i));
15.264 + setupFlag (flag,tb, QString("freemind-priority-%1").arg(i),tr("Priority","Freemind-Flag"));
15.265 }
15.266
15.267 - fo->load(flagsPath+"freemind/back.png");
15.268 - setupFlag (fo,tb,avis,"freemind-back",tr("Back","Freemind-Flag"));
15.269 -
15.270 - fo->load(flagsPath+"freemind/forward.png");
15.271 - setupFlag (fo,tb,avis,"freemind-forward",tr("Forward","Freemind-Flag"));
15.272 -
15.273 - fo->load(flagsPath+"freemind/attach.png");
15.274 - setupFlag (fo,tb,avis,"freemind-attach",tr("Look here","Freemind-Flag"));
15.275 -
15.276 - fo->load(flagsPath+"freemind/clanbomber.png");
15.277 - setupFlag (fo,tb,avis,"freemind-clanbomber",tr("Dangerous","Freemind-Flag"));
15.278 -
15.279 - fo->load(flagsPath+"freemind/desktopnew.png");
15.280 - setupFlag (fo,tb,avis,"freemind-desktopnew",tr("Don't forget","Freemind-Flag"));
15.281 -
15.282 - fo->load(flagsPath+"freemind/flag.png");
15.283 - setupFlag (fo,tb,avis,"freemind-flag",tr("Flag","Freemind-Flag"));
15.284 -
15.285 -
15.286 - fo->load(flagsPath+"freemind/gohome.png");
15.287 - setupFlag (fo,tb,avis,"freemind-gohome",tr("Home","Freemind-Flag"));
15.288 -
15.289 -
15.290 - fo->load(flagsPath+"freemind/kaddressbook.png");
15.291 - setupFlag (fo,tb,avis,"freemind-kaddressbook",tr("Telephone","Freemind-Flag"));
15.292 -
15.293 - fo->load(flagsPath+"freemind/knotify.png");
15.294 - setupFlag (fo,tb,avis,"freemind-knotify",tr("Music","Freemind-Flag"));
15.295 -
15.296 - fo->load(flagsPath+"freemind/korn.png");
15.297 - setupFlag (fo,tb,avis,"freemind-korn",tr("Mailbox","Freemind-Flag"));
15.298 -
15.299 - fo->load(flagsPath+"freemind/mail.png");
15.300 - setupFlag (fo,tb,avis,"freemind-mail",tr("Maix","Freemind-Flag"));
15.301 -
15.302 - fo->load(flagsPath+"freemind/password.png");
15.303 - setupFlag (fo,tb,avis,"freemind-password",tr("Password","Freemind-Flag"));
15.304 -
15.305 - fo->load(flagsPath+"freemind/pencil.png");
15.306 - setupFlag (fo,tb,avis,"freemind-pencil",tr("To be improved","Freemind-Flag"));
15.307 -
15.308 - fo->load(flagsPath+"freemind/stop.png");
15.309 - setupFlag (fo,tb,avis,"freemind-stop",tr("Stop","Freemind-Flag"));
15.310 -
15.311 - fo->load(flagsPath+"freemind/wizard.png");
15.312 - setupFlag (fo,tb,avis,"freemind-wizard",tr("Magic","Freemind-Flag"));
15.313 -
15.314 - fo->load(flagsPath+"freemind/xmag.png");
15.315 - setupFlag (fo,tb,avis,"freemind-xmag",tr("To be discussed","Freemind-Flag"));
15.316 -
15.317 - fo->load(flagsPath+"freemind/bell.png");
15.318 - setupFlag (fo,tb,avis,"freemind-bell",tr("Reminder","Freemind-Flag"));
15.319 -
15.320 - fo->load(flagsPath+"freemind/bookmark.png");
15.321 - setupFlag (fo,tb,avis,"freemind-bookmark",tr("Excellent","Freemind-Flag"));
15.322 -
15.323 - fo->load(flagsPath+"freemind/penguin.png");
15.324 - setupFlag (fo,tb,avis,"freemind-penguin",tr("Linux","Freemind-Flag"));
15.325 -
15.326 - fo->load(flagsPath+"freemind/licq.png");
15.327 - setupFlag (fo,tb,avis,"freemind-licq",tr("Sweet","Freemind-Flag"));
15.328 -
15.329 - delete (fo);
15.330 + flag->load(flagsPath+"freemind/back.png");
15.331 + setupFlag (flag,tb,"freemind-back",tr("Back","Freemind-Flag"));
15.332 +
15.333 + flag->load(flagsPath+"freemind/forward.png");
15.334 + setupFlag (flag,tb,"freemind-forward",tr("forward","Freemind-Flag"));
15.335 +
15.336 + flag->load(flagsPath+"freemind/attach.png");
15.337 + setupFlag (flag,tb,"freemind-attach",tr("Look here","Freemind-Flag"));
15.338 +
15.339 + flag->load(flagsPath+"freemind/clanbomber.png");
15.340 + setupFlag (flag,tb,"freemind-clanbomber",tr("Dangerous","Freemind-Flag"));
15.341 +
15.342 + flag->load(flagsPath+"freemind/desktopnew.png");
15.343 + setupFlag (flag,tb,"freemind-desktopnew",tr("Don't flagrget","Freemind-Flag"));
15.344 +
15.345 + flag->load(flagsPath+"freemind/flag.png");
15.346 + setupFlag (flag,tb,"freemind-flag",tr("Flag","Freemind-Flag"));
15.347 +
15.348 +
15.349 + flag->load(flagsPath+"freemind/gohome.png");
15.350 + setupFlag (flag,tb,"freemind-gohome",tr("Home","Freemind-Flag"));
15.351 +
15.352 +
15.353 + flag->load(flagsPath+"freemind/kaddressbook.png");
15.354 + setupFlag (flag,tb,"freemind-kaddressbook",tr("Telephone","Freemind-Flag"));
15.355 +
15.356 + flag->load(flagsPath+"freemind/knotify.png");
15.357 + setupFlag (flag,tb,"freemind-knotify",tr("Music","Freemind-Flag"));
15.358 +
15.359 + flag->load(flagsPath+"freemind/korn.png");
15.360 + setupFlag (flag,tb,"freemind-korn",tr("Mailbox","Freemind-Flag"));
15.361 +
15.362 + flag->load(flagsPath+"freemind/mail.png");
15.363 + setupFlag (flag,tb,"freemind-mail",tr("Maix","Freemind-Flag"));
15.364 +
15.365 + flag->load(flagsPath+"freemind/password.png");
15.366 + setupFlag (flag,tb,"freemind-password",tr("Password","Freemind-Flag"));
15.367 +
15.368 + flag->load(flagsPath+"freemind/pencil.png");
15.369 + setupFlag (flag,tb,"freemind-pencil",tr("To be improved","Freemind-Flag"));
15.370 +
15.371 + flag->load(flagsPath+"freemind/stop.png");
15.372 + setupFlag (flag,tb,"freemind-stop",tr("Stop","Freemind-Flag"));
15.373 +
15.374 + flag->load(flagsPath+"freemind/wizard.png");
15.375 + setupFlag (flag,tb,"freemind-wizard",tr("Magic","Freemind-Flag"));
15.376 +
15.377 + flag->load(flagsPath+"freemind/xmag.png");
15.378 + setupFlag (flag,tb,"freemind-xmag",tr("To be discussed","Freemind-Flag"));
15.379 +
15.380 + flag->load(flagsPath+"freemind/bell.png");
15.381 + setupFlag (flag,tb,"freemind-bell",tr("Reminder","Freemind-Flag"));
15.382 +
15.383 + flag->load(flagsPath+"freemind/bookmark.png");
15.384 + setupFlag (flag,tb,"freemind-bookmark",tr("Excellent","Freemind-Flag"));
15.385 +
15.386 + flag->load(flagsPath+"freemind/penguin.png");
15.387 + setupFlag (flag,tb,"freemind-penguin",tr("Linux","Freemind-Flag"));
15.388 +
15.389 + flag->load(flagsPath+"freemind/licq.png");
15.390 + setupFlag (flag,tb,"freemind-licq",tr("Sweet","Freemind-Flag"));
15.391 }
15.392
15.393 -void Main::setupFlag (FlagObj *fo, QToolBar *tb, bool aw, const QString &name, const QString &tooltip)
15.394 +void Main::setupFlag (Flag *flag, QToolBar *tb, const QString &name, const QString &tooltip)
15.395 {
15.396 - fo->setName(name);
15.397 - fo->setToolTip (tooltip);
15.398 - QAction *a=new QAction (fo->getPixmap(),fo->getName(),this);
15.399 + flag->setName(name);
15.400 + flag->setToolTip (tooltip);
15.401 + QAction *a;
15.402 if (tb)
15.403 {
15.404 + a=new QAction (flag->getPixmap(),name,this);
15.405 // StandardFlag
15.406 tb->addAction (a);
15.407 - fo->setAction (a);
15.408 - fo->setAlwaysVisible(aw);
15.409 a->setCheckable(true);
15.410 - a->setObjectName(fo->getName());
15.411 + a->setObjectName(name);
15.412 a->setToolTip(tooltip);
15.413 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
15.414 - standardFlagsDefault->addFlag (fo);
15.415 + standardFlagsMaster->addFlag (flag);
15.416 } else
15.417 {
15.418 // SystemFlag
15.419 - systemFlagsDefault->addFlag (fo);
15.420 + systemFlagsMaster->addFlag (flag);
15.421 }
15.422 }
15.423 +
15.424 // Network Actions
15.425 void Main::setupNetworkActions()
15.426 {
15.427 @@ -2692,107 +2680,6 @@
15.428 }
15.429 }
15.430
15.431 -
15.432 -void Main::editAttributeFinished()
15.433 -{
15.434 - // only called from editHeading(), so there is a currentME
15.435 -
15.436 - /*
15.437 - MapEditor *me=currentMapEditor();
15.438 - if (me)
15.439 - {
15.440 - me->setStateEditHeading (false);
15.441 - QPoint p; //Not used here, only to find out pos of branch
15.442 - bool ok;
15.443 - QString s=me->getHeading(ok,p);
15.444 -
15.445 -#if defined(Q_OS_MACX)
15.446 -#else
15.447 - if (ok && s!=lineedit->text())
15.448 - me->setHeading(lineedit->text());
15.449 -
15.450 - lineedit->releaseKeyboard();
15.451 - lineedit->hide();
15.452 - setFocus();
15.453 -#endif
15.454 - if (!actionSettingsAutoSelectNewBranch->isOn() &&
15.455 - !prevSelection.isEmpty())
15.456 - me->select(prevSelection);
15.457 - prevSelection="";
15.458 - }
15.459 - */
15.460 -}
15.461 -
15.462 -#include "attribute.h"
15.463 -#include "attributedialog.h"
15.464 -void Main::editAttribute()
15.465 -{
15.466 -/*
15.467 - MapEditor *me=currentMapEditor();
15.468 - if (me)
15.469 - {
15.470 - BranchObj *bo=me->getModel()->getSelectedBranch();
15.471 - if (bo)
15.472 - {
15.473 - AttributeDialog dia(this);
15.474 - dia.setTable (me->attributeTable() );
15.475 - dia.setBranch (bo);
15.476 - dia.setMode (Definition);
15.477 - dia.updateTable();
15.478 - dia.exec();
15.479 - }
15.480 - }
15.481 - */
15.482 - /*
15.483 - if (currentMapEditor())
15.484 - {
15.485 - MapEditor *me=currentMapEditor();
15.486 - QString oldSel=me->getSelectString();
15.487 -
15.488 - if (lineedit->isVisible())
15.489 - editAttributeFinished();
15.490 - else
15.491 - {
15.492 - bool ok;
15.493 - QPoint p;
15.494 - QString s=me->getHeading(ok,p);
15.495 -
15.496 - if (ok)
15.497 - {
15.498 - me->setStateEditHeading (true);
15.499 -#if defined(Q_OS_MACX)
15.500 - p=me->mapToGlobal (p);
15.501 - QDialog *d =new QDialog(NULL);
15.502 - QLineEdit *le=new QLineEdit (d);
15.503 - d->setWindowFlags (Qt::FramelessWindowHint);
15.504 - d->setGeometry(p.x(),p.y(),230,25);
15.505 - le->resize (d->width()-10,d->height());
15.506 - le->setText (s);
15.507 - le->selectAll();
15.508 - connect (le, SIGNAL (returnPressed()), d, SLOT (accept()));
15.509 - d->activateWindow();
15.510 - d->exec();
15.511 - me->setHeading (le->text());
15.512 - delete (le);
15.513 - delete (d);
15.514 - editHeadingFinished();
15.515 -#else
15.516 - p=me->mapTo (this,p);
15.517 - lineedit->setGeometry(p.x(),p.y(),230,25);
15.518 - lineedit->setText(s);
15.519 - lineedit->setCursorPosition(1);
15.520 - lineedit->selectAll();
15.521 - lineedit->show();
15.522 - lineedit->grabKeyboard();
15.523 - lineedit->setFocus();
15.524 -#endif
15.525 - }
15.526 - }
15.527 - } // currentMapEditor()
15.528 -
15.529 - */
15.530 -}
15.531 -
15.532 void Main::openVymLinks(const QStringList &vl)
15.533 {
15.534 for (int j=0; j<vl.size(); j++)
15.535 @@ -2912,13 +2799,13 @@
15.536 void Main::editMoveUp()
15.537 {
15.538 VymModel *m=currentModel();
15.539 - if (m) m->moveBranchUp();
15.540 + if (m) m->moveUp();
15.541 }
15.542
15.543 void Main::editMoveDown()
15.544 {
15.545 VymModel *m=currentModel();
15.546 - if (m) m->moveBranchDown();
15.547 + if (m) m->moveDown();
15.548 }
15.549
15.550 void Main::editSortChildren()
15.551 @@ -3266,32 +3153,20 @@
15.552
15.553 void Main::viewZoomReset()
15.554 {
15.555 - if (currentMapEditor())
15.556 - {
15.557 - QMatrix m;
15.558 - m.reset();
15.559 - currentMapEditor()->setMatrix( m );
15.560 - }
15.561 + MapEditor *me=currentMapEditor();
15.562 + if (me) me->setZoomFactorTarget (1);
15.563 }
15.564
15.565 void Main::viewZoomIn()
15.566 {
15.567 - if (currentMapEditor())
15.568 - {
15.569 - QMatrix m = currentMapEditor()->matrix();
15.570 - m.scale( 1.25, 1.25 );
15.571 - currentMapEditor()->setMatrix( m );
15.572 - }
15.573 + MapEditor *me=currentMapEditor();
15.574 + if (me) me->setZoomFactorTarget (me->getZoomFactorTarget()*1.25);
15.575 }
15.576
15.577 void Main::viewZoomOut()
15.578 {
15.579 - if (currentMapEditor())
15.580 - {
15.581 - QMatrix m = currentMapEditor()->matrix();
15.582 - m.scale( 0.8, 0.8 );
15.583 - currentMapEditor()->setMatrix( m );
15.584 - }
15.585 + MapEditor *me=currentMapEditor();
15.586 + if (me) me->setZoomFactorTarget (me->getZoomFactorTarget()*0.75);
15.587 }
15.588
15.589 void Main::viewCenter()
15.590 @@ -3523,7 +3398,7 @@
15.591 if (!status.isEmpty() ) statusMessage (status);
15.592 */
15.593
15.594 - // Update Toolbar // FIXME-1, was so far in BranchObj
15.595 + // Update Toolbar // FIXME-0, was so far in BranchObj
15.596 //updateFlagsToolbar();
15.597
15.598 updateActions();
15.599 @@ -3640,15 +3515,13 @@
15.600 }
15.601 */
15.602
15.603 - standardFlagsDefault->setEnabled (true);
15.604 -
15.605 actionToggleScroll->setEnabled (true);
15.606 if ( selbi->isScrolled() )
15.607 actionToggleScroll->setOn(true);
15.608 else
15.609 actionToggleScroll->setOn(false);
15.610
15.611 -/* FIXME-1 if ( selti->getURL().isEmpty() )
15.612 + if ( selti->getURL().isEmpty() )
15.613 {
15.614 actionOpenURL->setEnabled (false);
15.615 actionOpenURLTab->setEnabled (false);
15.616 @@ -3667,16 +3540,16 @@
15.617 actionOpenVymLink->setEnabled (true);
15.618 actionDeleteVymLink->setEnabled (true);
15.619 }
15.620 -*/
15.621 -/* FIXME-1 if (selbi->canMoveBranchUp())
15.622 +
15.623 + if (selbi->canMoveUp())
15.624 actionMoveUp->setEnabled (true);
15.625 else
15.626 actionMoveUp->setEnabled (false);
15.627 - if (selbi->canMoveBranchDown())
15.628 + if (selbi->canMoveDown())
15.629 actionMoveDown->setEnabled (true);
15.630 else
15.631 actionMoveDown->setEnabled (false);
15.632 -*/
15.633 +
15.634 actionSortChildren->setEnabled (true);
15.635
15.636 actionToggleHideExport->setEnabled (true);
15.637 @@ -3709,7 +3582,7 @@
15.638
15.639 actionCopy->setEnabled (true);
15.640 actionCut->setEnabled (true);
15.641 - actionPaste->setEnabled (false);
15.642 + actionPaste->setEnabled (false); //FIXME-4 why not allowing copy of images?
15.643 for (int i=0; i<actionListBranches.size(); ++i)
15.644 actionListBranches.at(i)->setEnabled(false);
15.645 actionDelete->setEnabled (true);
15.646 @@ -3722,7 +3595,6 @@
15.647
15.648 } else
15.649 {
15.650 - standardFlagsDefault->setEnabled (false);
15.651 actionFileSave->setEnabled (false);
15.652 actionCopy->setEnabled (false);
15.653 actionCut->setEnabled (false);
15.654 @@ -3761,11 +3633,6 @@
15.655 return actionSettingsAutoSelectNewBranch->isOn();
15.656 }
15.657
15.658 -bool Main::useFlagGroups()
15.659 -{
15.660 - return actionSettingsUseFlagGroups->isOn();
15.661 -}
15.662 -
15.663 void Main::windowShowNoteEditor()
15.664 {
15.665 textEditor->setShowWithMain(true);
15.666 @@ -3816,13 +3683,18 @@
15.667 void Main::standardFlagChanged()
15.668 {
15.669 if (currentModel())
15.670 - currentModel()->toggleStandardFlag(sender()->name());
15.671 + {
15.672 + if ( actionSettingsUseFlagGroups->isOn() )
15.673 + currentModel()->toggleStandardFlag(sender()->name(),standardFlagsMaster);
15.674 + else
15.675 + currentModel()->toggleStandardFlag(sender()->name());
15.676 + }
15.677 }
15.678
15.679 void Main::testFunction1()
15.680 {
15.681 - //if (!currentMapEditor()) return;
15.682 - //currentMapEditor()->testFunction1();
15.683 + if (!currentMapEditor()) return;
15.684 + currentMapEditor()->testFunction1();
15.685 //editAttribute();
15.686 }
15.687
16.1 --- a/mainwindow.h Thu May 07 08:48:53 2009 +0000
16.2 +++ b/mainwindow.h Wed May 13 08:26:27 2009 +0000
16.3 @@ -5,6 +5,7 @@
16.4
16.5 #include "branchpropwindow.h"
16.6 #include "extrainfodialog.h"
16.7 +#include "flag.h"
16.8 #include "file.h"
16.9 #include "findwindow.h"
16.10 #include "historywindow.h"
16.11 @@ -58,7 +59,7 @@
16.12 void setupViewActions();
16.13 void setupModeActions();
16.14 void setupWindowActions();
16.15 - void setupFlag(FlagObj *fo, QToolBar *tb, bool aw, const QString &name, const QString &tooltip);
16.16 + void setupFlag(Flag *flag, QToolBar *tb, const QString &name, const QString &tooltip);
16.17 void setupFlagActions();
16.18 void setupNetworkActions();
16.19 void setupSettingsActions();
16.20 @@ -133,11 +134,9 @@
16.21 void openVymLinks(const QStringList &);
16.22 void editVymLink();
16.23 void editOpenMultipleVymLinks();
16.24 - void editAttributeFinished();
16.25 public slots:
16.26 void editHeadingFinished(VymModel *m);
16.27 // void editHeading();
16.28 - void editAttribute();
16.29 void editOpenVymLink();
16.30 private slots:
16.31 void editDeleteVymLink();
16.32 @@ -223,7 +222,6 @@
16.33 ModMode getModMode();
16.34 bool autoEditNewBranch();
16.35 bool autoSelectNewBranch();
16.36 - bool useFlagGroups();
16.37 void setScript(const QString &);
16.38 void runScript(const QString &);
16.39 void runScriptEverywhere (const QString &);
17.1 --- a/mapcenteritem.cpp Thu May 07 08:48:53 2009 +0000
17.2 +++ b/mapcenteritem.cpp Wed May 13 08:26:27 2009 +0000
17.3 @@ -135,7 +135,7 @@
17.4
17.5 if (!getHeading().isEmpty() )
17.6 {
17.7 - mco->updateHeading();
17.8 + mco->updateData(); //FIXME-3 better call model->emitDataHasChanged(treeItem);
17.9 mco->setColor (headingColor);
17.10 }
17.11
18.1 --- a/mapcenterobj.cpp Thu May 07 08:48:53 2009 +0000
18.2 +++ b/mapcenterobj.cpp Wed May 13 08:26:27 2009 +0000
18.3 @@ -108,103 +108,3 @@
18.4 if (repositionRequest) reposition();
18.5 }
18.6
18.7 -QString MapCenterObj::saveToDir (const QString &tmpdir,const QString &prefix, int verbose, const QPointF &offset)
18.8 -{
18.9 - QString s,a;
18.10 -
18.11 -/*
18.12 - // save area, if not scrolled
18.13 - QString areaAttr=
18.14 - attribut("x1",QString().setNum(absPos.x()-offset.x())) +
18.15 - attribut("y1",QString().setNum(absPos.y()-offset.y())) +
18.16 - attribut("x2",QString().setNum(absPos.x()+width()-offset.x())) +
18.17 - attribut("y2",QString().setNum(absPos.y()+height()-offset.y()));
18.18 -
18.19 - // Providing an ID for a branch makes export to XHTML easier
18.20 - // FIXME-3
18.21 - QString idAttr;
18.22 - if (treeItem->xlinkCount()>0)
18.23 - idAttr=attribut ("id",mapEditor->getModel()->getSelectString(this)); //TODO directly access model
18.24 -
18.25 - else
18.26 - idAttr="";
18.27 -
18.28 -
18.29 - QString linkAttr=getLinkAttr();
18.30 -
18.31 - s=beginElement ("mapcenter"
18.32 - +getOrnXMLAttr()
18.33 - +areaAttr
18.34 -// +idAttr
18.35 - +getIncludeImageAttr() );
18.36 - incIndent();
18.37 - if (heading->getColor()!=QColor("black"))
18.38 - a=attribut ("textColor",QColor(heading->getColor()).name() );
18.39 - else
18.40 - a="";
18.41 -
18.42 - // Save flags. If verbose is set (export to xml dir), also write
18.43 - // the flags as picture
18.44 - s+=standardFlags->saveToDir(tmpdir+"/flags", "/standardFlag-", verbose);
18.45 -
18.46 - // Save heading
18.47 - s+=valueElement("heading", treeItem->getHeading(),a);
18.48 -
18.49 - // Save frame
18.50 - s+=frame->saveToDir ();
18.51 -
18.52 - // Update of note is usually done while unselecting a branch
18.53 - //if (isNoteInEditor) getNoteFromTextEditor(); FIXME-3
18.54 -
18.55 - // save note
18.56 - if (!treeItem->getNoteObj().isEmpty() )
18.57 - s+=treeItem->getNoteObj().saveToDir();
18.58 -
18.59 - // Save branches
18.60 - for (int i=0; i<treeItem->branchCount(); ++i)
18.61 - s+=treeItem->getBranchObjNum(i)->saveToDir(tmpdir,prefix, offset);
18.62 -
18.63 - // Save FloatImages
18.64 - for (int i=0; i<floatimage.size(); ++i)
18.65 - s+=floatimage.at(i)->saveToDir (tmpdir,prefix);
18.66 -
18.67 - // Save XLinks
18.68 - for (int i=0;i<xlink.size(); ++i)
18.69 - s+=xlink.at(i)->saveToDir();
18.70 -
18.71 - decIndent();
18.72 - s+=endElement ("mapcenter");
18.73 - */
18.74 - return s;
18.75 -}
18.76 -
18.77 -void MapCenterObj::setVersion (const QString &s)
18.78 -{
18.79 - version=s;
18.80 -}
18.81 -
18.82 -void MapCenterObj::setAuthor (const QString &s)
18.83 -{
18.84 - author=s;
18.85 -}
18.86 -
18.87 -QString MapCenterObj::getAuthor()
18.88 -{
18.89 - return author;
18.90 -}
18.91 -
18.92 -void MapCenterObj::setComment (const QString &s)
18.93 -{
18.94 - comment=s;
18.95 -}
18.96 -
18.97 -QString MapCenterObj::getComment ()
18.98 -{
18.99 - return comment;
18.100 -}
18.101 -
18.102 -QString MapCenterObj::getDate ()
18.103 -{
18.104 - return QDate::currentDate().toString ("yyyy-MM-dd");
18.105 -}
18.106 -
19.1 --- a/mapcenterobj.h Thu May 07 08:48:53 2009 +0000
19.2 +++ b/mapcenterobj.h Wed May 13 08:26:27 2009 +0000
19.3 @@ -27,17 +27,5 @@
19.4 virtual void moveAllBy (double,double);
19.5 virtual void updateLink();
19.6 virtual void updateRelPositions();
19.7 - virtual QString saveToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir
19.8 - void setVersion(const QString &);
19.9 - void setAuthor (const QString &);
19.10 - QString getAuthor ();
19.11 - void setComment (const QString &);
19.12 - QString getComment ();
19.13 - QString getDate();
19.14 -private:
19.15 - QString version; //!< version string saved in vym file
19.16 - QString author;
19.17 - QString comment;
19.18 - QDate date;
19.19 };
19.20 #endif
20.1 --- a/mapeditor.cpp Thu May 07 08:48:53 2009 +0000
20.2 +++ b/mapeditor.cpp Wed May 13 08:26:27 2009 +0000
20.3 @@ -19,7 +19,6 @@
20.4 extern QString clipboardFile;
20.5 extern bool clipboardEmpty;
20.6 extern bool debug;
20.7 -extern FlagRowObj *standardFlagsDefault;
20.8
20.9 extern QMenu* branchContextMenu;
20.10 extern QMenu* branchAddContextMenu;
20.11 @@ -41,6 +40,8 @@
20.12 mapScene= new QGraphicsScene(NULL);
20.13 mapScene->setBackgroundBrush (QBrush(Qt::white, Qt::SolidPattern));
20.14
20.15 + zoomFactor=zoomFactorTarget=1;
20.16 +
20.17 model=vm;
20.18 model->setScene (mapScene);
20.19 model->registerEditor(this);
20.20 @@ -147,6 +148,105 @@
20.21 return mapScene;
20.22 }
20.23
20.24 +void MapEditor::setScrollBarPosTarget (const QRectF &rect)
20.25 +{
20.26 + // Code copied from Qt sources
20.27 + int xmargin=50;
20.28 + int ymargin=50;
20.29 +
20.30 + qreal width = viewport()->width();
20.31 + qreal height = viewport()->height();
20.32 + QRectF viewRect = matrix().mapRect(rect);
20.33 +
20.34 + qreal left = horizontalScrollBar()->value();
20.35 + qreal right = left + width;
20.36 + qreal top = verticalScrollBar()->value();
20.37 + qreal bottom = top + height;
20.38 +
20.39 + if (viewRect.left() <= left + xmargin) {
20.40 + // need to scroll from the left
20.41 + // if (!d->leftIndent)
20.42 + scrollBarPosTarget.setX(int(viewRect.left() - xmargin - 0.5));
20.43 + }
20.44 + if (viewRect.right() >= right - xmargin) {
20.45 + // need to scroll from the right
20.46 +// if (!d->leftIndent)
20.47 + scrollBarPosTarget.setX(int(viewRect.right() - width + xmargin + 0.5));
20.48 + }
20.49 + if (viewRect.top() <= top + ymargin) {
20.50 + // need to scroll from the top
20.51 + // if (!d->topIndent)
20.52 + scrollBarPosTarget.setY(int(viewRect.top() - ymargin - 0.5));
20.53 + }
20.54 + if (viewRect.bottom() >= bottom - ymargin) {
20.55 + // need to scroll from the bottom
20.56 +// if (!d->topIndent)
20.57 + scrollBarPosTarget.setY(int(viewRect.bottom() - height + ymargin + 0.5));
20.58 + }
20.59 +
20.60 + if (scrollBarPosAnimation.state()==QtAbstractAnimation::Running)
20.61 + scrollBarPosAnimation.stop();
20.62 + scrollBarPosAnimation.setTargetObject (this);
20.63 + scrollBarPosAnimation.setPropertyName ("scrollBarPos");
20.64 + scrollBarPosAnimation.setDuration(1000);
20.65 + scrollBarPosAnimation.setEasingCurve ( QtEasingCurve::OutQuint);
20.66 + scrollBarPosAnimation.setStartValue(
20.67 + QPointF (horizontalScrollBar()->value() ,
20.68 + verticalScrollBar()->value() ) );
20.69 + scrollBarPosAnimation.setEndValue(scrollBarPosTarget);
20.70 + scrollBarPosAnimation.start();
20.71 +}
20.72 +
20.73 +QPointF MapEditor::getScrollBarPosTarget()
20.74 +{
20.75 + return scrollBarPosTarget;
20.76 +}
20.77 +
20.78 +
20.79 +void MapEditor::setScrollBarPos(const QPointF &p)
20.80 +{
20.81 + scrollBarPos=p;
20.82 + horizontalScrollBar()->setValue(int(p.x()));
20.83 + verticalScrollBar()->setValue(int(p.y()));
20.84 +}
20.85 +
20.86 +QPointF MapEditor::getScrollBarPos()
20.87 +{
20.88 + return scrollBarPos;
20.89 +}
20.90 +
20.91 +void MapEditor::setZoomFactorTarget (const qreal &zft)
20.92 +{
20.93 + zoomFactorTarget=zft;
20.94 + if (zoomAnimation.state()==QtAbstractAnimation::Running)
20.95 + zoomAnimation.stop();
20.96 + //zoomAnimation=QtPropertyAnimation(this, "zoomFactor");
20.97 + zoomAnimation.setTargetObject (this);
20.98 + zoomAnimation.setPropertyName ("zoomFactor");
20.99 + zoomAnimation.setDuration(1000);
20.100 + zoomAnimation.setEasingCurve ( QtEasingCurve::OutQuint);
20.101 + zoomAnimation.setStartValue(zoomFactor);
20.102 + zoomAnimation.setEndValue(zft);
20.103 + zoomAnimation.start();
20.104 +}
20.105 +
20.106 +qreal MapEditor::getZoomFactorTarget()
20.107 +{
20.108 + return zoomFactorTarget;
20.109 +}
20.110 +
20.111 +
20.112 +void MapEditor::setZoomFactor(const qreal &zf)
20.113 +{
20.114 + zoomFactor=zf;
20.115 + setMatrix (QMatrix(zf, 0, 0, zf, 0, 0),false );
20.116 +}
20.117 +
20.118 +qreal MapEditor::getZoomFactor()
20.119 +{
20.120 + return zoomFactor;
20.121 +}
20.122 +
20.123 void MapEditor::print()
20.124 {
20.125 if ( !printer )
20.126 @@ -273,42 +373,70 @@
20.127
20.128 void MapEditor::testFunction1()
20.129 {
20.130 - BranchItem *cur=NULL;
20.131 - BranchItem *prev=NULL;
20.132 - int d;
20.133 - cout << "ME::testFunction1 starting to walk the map...\n";
20.134 - while (model->next (cur,prev,d) )
20.135 - cout << "*** " <<cur->getHeading().toStdString()<<endl;
20.136 +
20.137 + // Code copied from Qt sources
20.138 + QRectF rect=model->getSelectedBranchObj()->getBBox();
20.139 + int xmargin=50;
20.140 + int ymargin=50;
20.141
20.142 + qreal width = viewport()->width();
20.143 + qreal height = viewport()->height();
20.144 + QRectF viewRect = matrix().mapRect(rect);
20.145
20.146 - //BranchObj *bo=model->getSelectedBranchObj();
20.147 - //if (bo) model->moveAway (bo);
20.148 - //if (bo) bo->setLinkStyle (LinkableMapObj::Line);
20.149 -
20.150 + qreal left = horizontalScrollBar()->value();
20.151 + qreal right = left + width;
20.152 + qreal top = verticalScrollBar()->value();
20.153 + qreal bottom = top + height;
20.154
20.155 + if (viewRect.left() <= left + xmargin) {
20.156 + // need to scroll from the left
20.157 + // if (!d->leftIndent)
20.158 + horizontalScrollBar()->setValue(int(viewRect.left() - xmargin - 0.5));
20.159 + }
20.160 + if (viewRect.right() >= right - xmargin) {
20.161 + // need to scroll from the right
20.162 +// if (!d->leftIndent)
20.163 + horizontalScrollBar()->setValue(int(viewRect.right() - width + xmargin + 0.5));
20.164 + }
20.165 + if (viewRect.top() <= top + ymargin) {
20.166 + // need to scroll from the top
20.167 + // if (!d->topIndent)
20.168 + verticalScrollBar()->setValue(int(viewRect.top() - ymargin - 0.5));
20.169 + }
20.170 + if (viewRect.bottom() >= bottom - ymargin) {
20.171 + // need to scroll from the bottom
20.172 +// if (!d->topIndent)
20.173 + verticalScrollBar()->setValue(int(viewRect.bottom() - height + ymargin + 0.5));
20.174 + }
20.175 + cout << "test1: hor="<<horizontalScrollBar()->value()<<endl;
20.176 + cout << "test1: ver="<<verticalScrollBar()->value()<<endl;
20.177 +}
20.178 /*
20.179 - // Displacement and animation of all non-mainbranches
20.180 - QPointF p;
20.181 - QPointF q;
20.182 - BranchObj *bo;
20.183 - TreeItem *cur=NULL;
20.184 - TreeItem *prev=NULL;
20.185 - int d;
20.186 - while (cur)
20.187 - {
20.188 - bo=(BranchObj*)(cur->getLMO());
20.189 + QtPropertyAnimation *animation=new QtPropertyAnimation(this, "sceneRect");
20.190 + animation->setDuration(5000);
20.191 + //animation->setEasingCurve ( QtEasingCurve::OutElastic);
20.192 + animation->setEasingCurve ( QtEasingCurve::OutQuint);
20.193 + animation->setStartValue(sceneRect() );
20.194 + animation->setEndValue(QRectF(50, 50, 1000, 1000));
20.195
20.196 - if (cur->depth() >0 && !bo->hasScrolledParent(bo) )
20.197 - {
20.198 - p=QPointF (qrand() %600-300, qrand () %600-300);
20.199 - bo->setRelPos();
20.200 - q=bo->getRelPos();
20.201 - model->startAnimation (bo,p, q);
20.202 - }
20.203 - model->next(cur,prev,d);
20.204 - }
20.205 -*/
20.206 + animation->start();
20.207 +*/
20.208 +/*
20.209 + QDialog *dia= new QDialog (this);
20.210 + dia->setGeometry (50,50,10,10);
20.211
20.212 + dia->show();
20.213 + dia ->raise();
20.214 +
20.215 + QtPropertyAnimation *animation=new QtPropertyAnimation(dia, "geometry");
20.216 + animation->setDuration(1000);
20.217 + //animation->setEasingCurve ( QtEasingCurve::OutElastic);
20.218 + animation->setEasingCurve ( QtEasingCurve::OutQuint);
20.219 + animation->setStartValue(QRect(50, 50, 10, 10));
20.220 + animation->setEndValue(QRect(250, 250, 100, 100));
20.221 +
20.222 + animation->start();
20.223 + */
20.224
20.225 /* TODO Hide hidden stuff temporary, maybe add this as regular function somewhere
20.226 if (hidemode==HideNone)
20.227 @@ -335,7 +463,6 @@
20.228 }
20.229 cout <<" hidemode="<<hidemode<<endl;
20.230 */
20.231 -}
20.232
20.233 void MapEditor::testFunction2()
20.234 {
20.235 @@ -885,40 +1012,43 @@
20.236 QString preParStr=model->getSelectString (bsel->getParObj());
20.237 QString preNum=QString::number (seli->num(),10);
20.238 QString preDstParStr;
20.239 + bool relinked;
20.240
20.241 if (e->state() & Qt::ShiftModifier && dst->getParObj())
20.242 { // Link above dst
20.243 preDstParStr=model->getSelectString (dst->getParObj());
20.244 - model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti->parent(),((BranchItem*)dsti)->num());
20.245 + relinked=model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti->parent(),((BranchItem*)dsti)->num());
20.246 } else
20.247 if (e->state() & Qt::ControlModifier && dst->getParObj())
20.248 {
20.249 // Link below dst
20.250 preDstParStr=model->getSelectString (dst->getParObj());
20.251 - model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti->parent(),((BranchItem*)seli)->num()+1);
20.252 + relinked=model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti->parent(),((BranchItem*)dsti)->num()+1);
20.253 } else
20.254 { // Append to dst
20.255 preDstParStr=model->getSelectString(dst);
20.256 - model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti);
20.257 + relinked=model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti);
20.258 if (dsti->depth()==0) bsel->move (savePos);
20.259 }
20.260 - QString postSelStr=model->getSelectString(lmosel);
20.261 - QString postNum=QString::number (seli->num(),10);
20.262 + if (relinked)
20.263 + {
20.264 + QString postSelStr=model->getSelectString(lmosel);
20.265 + QString postNum=QString::number (seli->num(),10);
20.266
20.267 - QString undoCom="linkTo (\""+
20.268 - preParStr+ "\"," + preNum +"," +
20.269 - QString ("%1,%2").arg(movingObj_orgPos.x()).arg(movingObj_orgPos.y())+ ")";
20.270 + QString undoCom="linkTo (\""+
20.271 + preParStr+ "\"," + preNum +"," +
20.272 + QString ("%1,%2").arg(movingObj_orgPos.x()).arg(movingObj_orgPos.y())+ ")";
20.273
20.274 - QString redoCom="linkTo (\""+
20.275 - preDstParStr + "\"," + postNum + "," +
20.276 - QString ("%1,%2").arg(savePos.x()).arg(savePos.y())+ ")";
20.277 + QString redoCom="linkTo (\""+
20.278 + preDstParStr + "\"," + postNum + "," +
20.279 + QString ("%1,%2").arg(savePos.x()).arg(savePos.y())+ ")";
20.280
20.281 - model->saveState (
20.282 - postSelStr,undoCom,
20.283 - preSelStr, redoCom,
20.284 - QString("Relink %1 to %2").arg(model->getObjectName(bsel)).arg(model->getObjectName(dst)) );
20.285 + model->saveState (
20.286 + postSelStr,undoCom,
20.287 + preSelStr, redoCom,
20.288 + QString("Relink %1 to %2").arg(model->getObjectName(bsel)).arg(model->getObjectName(dst)) );
20.289
20.290 - model->reposition(); // not necessary if we undo temporary move below
20.291 + }
20.292 } else
20.293 {
20.294 // No destination, undo temporary move
20.295 @@ -1135,7 +1265,7 @@
20.296 if (ti->isBranchLikeType())
20.297 {
20.298 BranchObj *bo=(BranchObj*)ti->getLMO();
20.299 - bo->updateHeading();
20.300 + bo->updateData();
20.301 }
20.302
20.303 }
21.1 --- a/mapeditor.h Thu May 07 08:48:53 2009 +0000
21.2 +++ b/mapeditor.h Wed May 13 08:26:27 2009 +0000
21.3 @@ -4,6 +4,8 @@
21.4 #include <QGraphicsView>
21.5 #include <QItemSelectionModel>
21.6
21.7 +#include <QtPropertyAnimation> //! Not yet officially in Qt!
21.8 +
21.9 #include "attribute.h"
21.10 #include "ornamentedobj.h"
21.11 #include "settings.h"
21.12 @@ -12,8 +14,11 @@
21.13
21.14 /*! \brief Main widget in vym to display and edit a map */
21.15
21.16 -class MapEditor : public QGraphicsView {
21.17 +
21.18 +class MapEditor : public QGraphicsView {
21.19 Q_OBJECT
21.20 + Q_PROPERTY(qreal zoomFactor READ getZoomFactor WRITE setZoomFactor)
21.21 + Q_PROPERTY(QPointF scrollBarPos READ getScrollBarPos WRITE setScrollBarPos)
21.22
21.23 public:
21.24 MapEditor(VymModel *vm);
21.25 @@ -21,6 +26,26 @@
21.26 VymModel* getModel();
21.27 QGraphicsScene * getScene();
21.28
21.29 +protected:
21.30 + QPointF scrollBarPos;
21.31 + QPointF scrollBarPosTarget;
21.32 + QtPropertyAnimation scrollBarPosAnimation;
21.33 +public:
21.34 + void setScrollBarPosTarget (const QRectF &rect); //! ensureVisible of rect
21.35 + QPointF getScrollBarPosTarget ();
21.36 + void setScrollBarPos (const QPointF &p);
21.37 + QPointF getScrollBarPos();
21.38 +
21.39 +protected:
21.40 + qreal zoomFactor;
21.41 + qreal zoomFactorTarget;
21.42 + QtPropertyAnimation zoomAnimation;
21.43 +public:
21.44 + void setZoomFactorTarget (const qreal &zf);
21.45 + qreal getZoomFactorTarget();
21.46 + void setZoomFactor (const qreal &zf);
21.47 + qreal getZoomFactor();
21.48 +
21.49 public:
21.50 void print(); //!< Print the map
21.51 void setAntiAlias (bool); //!< Set or unset antialiasing
22.1 --- a/ornamentedobj.cpp Thu May 07 08:48:53 2009 +0000
22.2 +++ b/ornamentedobj.cpp Wed May 13 08:26:27 2009 +0000
22.3 @@ -6,9 +6,6 @@
22.4 #include "linkablemapobj.h"
22.5
22.6 extern TextEditor *textEditor;
22.7 -extern FlagRowObj *systemFlagsDefault;
22.8 -extern FlagRowObj *standardFlagsDefault;
22.9 -
22.10
22.11 /////////////////////////////////////////////////////////////////
22.12 // OrnamentedObj
22.13 @@ -46,20 +43,9 @@
22.14 heading->move (absPos.x(), absPos.y());
22.15
22.16 systemFlags=new FlagRowObj(scene);
22.17 - systemFlags->clone(systemFlagsDefault);
22.18 - systemFlags->setName ("systemFlags");
22.19 -
22.20 standardFlags=new FlagRowObj(scene);
22.21 - standardFlags->clone(standardFlagsDefault);
22.22 - standardFlags->setName ("standardFlags");
22.23 -
22.24 - attributes.clear();
22.25
22.26 frame = new FrameObj (scene);
22.27 -
22.28 - url="";
22.29 - vymLink="";
22.30 -
22.31 }
22.32
22.33 void OrnamentedObj::copy (OrnamentedObj* other)
22.34 @@ -72,9 +58,6 @@
22.35 standardFlags->copy (other->standardFlags);
22.36
22.37 ornamentsBBox=other->ornamentsBBox;
22.38 -
22.39 - url=other->url;
22.40 - vymLink=other->vymLink;
22.41 }
22.42
22.43 void OrnamentedObj::setLinkColor()
22.44 @@ -246,90 +229,9 @@
22.45 move2RelPos (p.x(),p.y());
22.46 }
22.47
22.48 -void OrnamentedObj::setURL(QString s)
22.49 +void OrnamentedObj::activateStandardFlag(Flag *flag)
22.50 {
22.51 - url=s;
22.52 - if (!url.isEmpty())
22.53 - systemFlags->activate("url");
22.54 - else
22.55 - systemFlags->deactivate("url");
22.56 - calcBBoxSize(); // recalculate bbox
22.57 - positionBBox(); // rearrange contents
22.58 - forceReposition();
22.59 -}
22.60 -
22.61 -QString OrnamentedObj::getURL()
22.62 -{
22.63 - return url;
22.64 -}
22.65 -
22.66 -void OrnamentedObj::setVymLink(QString s)
22.67 -{
22.68 - if (!s.isEmpty())
22.69 - {
22.70 - // We need the relative (from loading)
22.71 - // or absolute path (from User event)
22.72 - // and build the absolute path.
22.73 - // Note: If we have relative, use path of
22.74 - // current map to build absolute path
22.75 - QDir d(s);
22.76 - if (!d.path().startsWith ("/"))
22.77 - {
22.78 - QString p=model->getDestPath();
22.79 - int i=p.findRev("/",-1);
22.80 - d.setPath(p.left(i)+"/"+s);
22.81 - d.convertToAbs();
22.82 - }
22.83 - vymLink=d.path();
22.84 - systemFlags->activate("vymLink");
22.85 - }
22.86 - else
22.87 - {
22.88 - systemFlags->deactivate("vymLink");
22.89 - vymLink="";
22.90 - }
22.91 - calcBBoxSize(); // recalculate bbox
22.92 - positionBBox(); // rearrange contents
22.93 - forceReposition();
22.94 -}
22.95 -
22.96 -QString OrnamentedObj::getVymLink()
22.97 -{
22.98 - return vymLink;
22.99 -}
22.100 -
22.101 -
22.102 -void OrnamentedObj::setAttributes (const QList <Attribute> &al)
22.103 -{
22.104 - attributes=al;
22.105 -}
22.106 -
22.107 -QList <Attribute> OrnamentedObj::getAttributes()
22.108 -{
22.109 - return attributes;
22.110 -}
22.111 -
22.112 -void OrnamentedObj::clearStandardFlags()
22.113 -{
22.114 - standardFlags->deactivateAll();
22.115 - calcBBoxSize();
22.116 - positionBBox();
22.117 - move (absPos.x(), absPos.y() );
22.118 - forceReposition();
22.119 -}
22.120 -
22.121 -void OrnamentedObj::toggleStandardFlag(const QString &name)
22.122 -{
22.123 - standardFlags->toggle(name);
22.124 - calcBBoxSize();
22.125 - positionBBox();
22.126 - move (absPos.x(), absPos.y() );
22.127 - forceReposition();
22.128 -}
22.129 -
22.130 -void OrnamentedObj::activateStandardFlag(const QString &name)
22.131 -{
22.132 - standardFlags->activate(name);
22.133 + standardFlags->activate(flag);
22.134 calcBBoxSize();
22.135 positionBBox();
22.136 move (absPos.x(), absPos.y() );
22.137 @@ -345,22 +247,12 @@
22.138 forceReposition();
22.139 }
22.140
22.141 -bool OrnamentedObj::isSetStandardFlag (const QString &name)
22.142 -{
22.143 - return standardFlags->isActive(name);
22.144 -}
22.145
22.146 QString OrnamentedObj::getSystemFlagName(const QPointF &p)
22.147 {
22.148 return systemFlags->getFlagName(p);
22.149 }
22.150
22.151 -bool OrnamentedObj::isActiveFlag (const QString &name)
22.152 -{
22.153 - if (standardFlags->isActive (name) ) return true;
22.154 - return false;
22.155 -}
22.156 -
22.157 /* FIXME-3 should move to VymView ?! void OrnamentedObj::getNoteFromTextEditor ()
22.158 {
22.159 note.setFilenameHint (textEditor->getFilename());
22.160 @@ -369,41 +261,7 @@
22.161 }
22.162 */
22.163
22.164 -void OrnamentedObj::updateSystemFlags()
22.165 -{
22.166 - // FIXME-3 check if note here and text in editor are still in sync!!
22.167 - // Best would be to always have current text here...
22.168 - bool noteEmpty=treeItem->getNoteObj().isEmpty();
22.169 - /*
22.170 - if (isNoteInEditor)
22.171 - noteEmpty=textEditor->isEmpty();
22.172 - else
22.173 - noteEmpty=note.isEmpty();
22.174 - */
22.175 -
22.176 - if (!noteEmpty)
22.177 - {
22.178 - if (systemFlags->isActive ("note")) return;
22.179 - systemFlags->activate("note");
22.180 - }
22.181 - else
22.182 - {
22.183 - if (!systemFlags->isActive ("note")) return;
22.184 - systemFlags->deactivate("note");
22.185 - }
22.186 - //model->setChanged();
22.187 - calcBBoxSize();
22.188 - positionBBox();
22.189 - move (absPos.x(), absPos.y() );
22.190 - forceReposition();
22.191 -}
22.192 -
22.193 -void OrnamentedObj::updateFlagsToolbar()
22.194 -{
22.195 - standardFlags->updateToolbar();
22.196 -}
22.197 -
22.198 -QString OrnamentedObj::getOrnXMLAttr()
22.199 +QString OrnamentedObj::getOrnXMLAttr() //FIXME-2
22.200 {
22.201 QString posAttr;
22.202
22.203 @@ -424,20 +282,12 @@
22.204 posAttr="";
22.205 }
22.206
22.207 - QString urlAttr;
22.208 - if (!url.isEmpty())
22.209 - urlAttr=attribut ("url",url);
22.210 -
22.211 - QString vymLinkAttr;
22.212 - if (!vymLink.isEmpty())
22.213 - vymLinkAttr=attribut ("vymLink",convertToRel(model->getDestPath(),vymLink) );
22.214 -
22.215 /* FIXME-2 QString hideExpAttr;
22.216 if (hideExport)
22.217 hideExpAttr= attribut("hideInExport","true");
22.218 else
22.219 hideExpAttr="";
22.220 */
22.221 - return posAttr +urlAttr +vymLinkAttr +getLinkAttr() ;//+hideExpAttr;
22.222 + return posAttr +getLinkAttr() ;//+hideExpAttr;
22.223 }
22.224
23.1 --- a/ornamentedobj.h Thu May 07 08:48:53 2009 +0000
23.2 +++ b/ornamentedobj.h Wed May 13 08:26:27 2009 +0000
23.3 @@ -11,8 +11,6 @@
23.4 - frame
23.5 - note
23.6 - references
23.7 - - URL
23.8 - -vymLink
23.9 - flags
23.10 - standard flags
23.11 - system flags
23.12 @@ -53,24 +51,9 @@
23.13 virtual void move2RelPos (QPointF); // move relativly to parent^
23.14 virtual void move2RelPos (double,double);
23.15
23.16 - virtual void setURL (QString);
23.17 - virtual QString getURL ();
23.18 -
23.19 - virtual void setVymLink (QString);
23.20 - virtual QString getVymLink ();
23.21 -
23.22 - virtual void setAttributes (const QList <Attribute> &al);
23.23 - virtual QList <Attribute> getAttributes ();
23.24 -
23.25 - virtual void clearStandardFlags();
23.26 - virtual void toggleStandardFlag(const QString &name);
23.27 - virtual void activateStandardFlag(const QString &name);
23.28 + virtual void activateStandardFlag(Flag *flag);
23.29 virtual void deactivateStandardFlag(const QString &name);
23.30 - virtual bool isSetStandardFlag(const QString &name);
23.31 virtual QString getSystemFlagName (const QPointF &p);
23.32 - virtual bool isActiveFlag(const QString&); // check if flag is set
23.33 - virtual void updateSystemFlags();
23.34 - virtual void updateFlagsToolbar();
23.35
23.36 //virtual void getNoteFromTextEditor ();// FIXME-3 should move to vymview?!
23.37 virtual QString getOrnXMLAttr(); // get attributes for saveToDir
23.38 @@ -81,9 +64,6 @@
23.39 FlagRowObj *standardFlags; // Standard Flags
23.40 FrameObj *frame; // frame around object
23.41 QRectF ornamentsBBox; // bbox of flags and heading
23.42 - QString url; // url to external doc
23.43 - QString vymLink; // path to another map // FIXME-3 remove this
23.44 - QList <Attribute> attributes; // List with attributes
23.45 };
23.46
23.47 #endif
24.1 --- a/treeitem.cpp Thu May 07 08:48:53 2009 +0000
24.2 +++ b/treeitem.cpp Wed May 13 08:26:27 2009 +0000
24.3 @@ -278,20 +278,72 @@
24.4 return headingColor;
24.5 }
24.6
24.7 -void TreeItem::setNote(const QString s)
24.8 +void TreeItem::setURL (const QString &u)
24.9 {
24.10 - note.setNote(s);
24.11 - // updateNoteFlag(); FIXME-2 needed?
24.12 - if (model)
24.13 - model->emitNoteHasChanged (this);
24.14 + url=u;
24.15 + if (!url.isEmpty())
24.16 + systemFlags.activate ("system-url");
24.17 + else
24.18 + systemFlags.deactivate ("system-url");
24.19 +}
24.20 +
24.21 +QString TreeItem::getURL ()
24.22 +{
24.23 + return url;
24.24 +}
24.25 +
24.26 +void TreeItem::setVymLink (const QString &vl)
24.27 +{
24.28 + if (!vl.isEmpty())
24.29 + {
24.30 + // We need the relative (from loading)
24.31 + // or absolute path (from User event)
24.32 + // and build the absolute path.
24.33 + // Note: If we have relative, use path of
24.34 + // current map to build absolute path
24.35 + QDir d(vl);
24.36 + if (!d.path().startsWith ("/"))
24.37 + {
24.38 + QString p=model->getDestPath();
24.39 + int i=p.findRev("/",-1);
24.40 + d.setPath(p.left(i)+"/"+vl);
24.41 + d.convertToAbs();
24.42 + }
24.43 + vymLink=d.path();
24.44 + systemFlags.activate("system-vymLink");
24.45 + }
24.46 + else
24.47 + {
24.48 + systemFlags.deactivate("system-vymLink");
24.49 + vymLink.clear();
24.50 + }
24.51 +}
24.52 +
24.53 +QString TreeItem::getVymLink ()
24.54 +{
24.55 + return vymLink;
24.56 +}
24.57 +
24.58 +void TreeItem::setNote(const QString &s)
24.59 +{
24.60 + NoteObj n;
24.61 + n.setNote(s);
24.62 + setNoteObj (n,false);
24.63 +}
24.64 +
24.65 +void TreeItem::clearNote()
24.66 +{
24.67 + note.clear();
24.68 + systemFlags.deactivate ("system-note");
24.69 }
24.70
24.71 void TreeItem::setNoteObj(const NoteObj &n, bool updateNoteEditor)
24.72 {
24.73 note=n;
24.74 - // updateNoteFlag(); FIXME-2 needed?
24.75 - if (model && updateNoteEditor)
24.76 - model->emitNoteHasChanged (this);
24.77 + if (!note.isEmpty() && !systemFlags.isActive ("system-note"))
24.78 + systemFlags.activate ("system-note");
24.79 + if (note.isEmpty() && systemFlags.isActive ("system-note"))
24.80 + systemFlags.deactivate ("system-note");
24.81 }
24.82
24.83 QString TreeItem::getNote()
24.84 @@ -321,28 +373,26 @@
24.85
24.86 void TreeItem::activateStandardFlag (const QString &name)
24.87 {
24.88 - cout << "TI::activateStandardFlag "<<name.toStdString()<<" for item "<<getHeadingStd()<<endl;
24.89 - cout << " lmo="<<lmo<< " "<<isBranchLikeType()<<endl;
24.90 standardFlags.activate (name);
24.91 - if (lmo &&isBranchLikeType() )
24.92 - ((BranchObj*)lmo)->activateStandardFlag (name);
24.93 + model->emitDataHasChanged(this);
24.94 }
24.95
24.96 void TreeItem::deactivateStandardFlag (const QString &name)
24.97 {
24.98 - cout << "TI::deactivateStandardFlag "<<name.toStdString()<<" for item "<<getHeadingStd()<<endl;
24.99 standardFlags.deactivate (name);
24.100 - if (lmo &&isBranchLikeType() )
24.101 - ((BranchObj*)lmo)->deactivateStandardFlag (name);
24.102 + model->emitDataHasChanged(this);
24.103 }
24.104
24.105 -void TreeItem::toggleStandardFlag(const QString &name)
24.106 +void TreeItem::deactivateAllStandardFlags ()
24.107 {
24.108 - cout << "TI::toggleStandardFlag "<<name.toStdString()<<" for item "<<getHeadingStd()<<endl;
24.109 - if (standardFlags.isActive (name))
24.110 - deactivateStandardFlag (name);
24.111 - else
24.112 - activateStandardFlag (name);
24.113 + standardFlags.deactivateAll ();
24.114 + model->emitDataHasChanged(this);
24.115 +}
24.116 +
24.117 +void TreeItem::toggleStandardFlag(const QString &name, FlagRow *master)
24.118 +{
24.119 + standardFlags.toggle (name,master);
24.120 + model->emitDataHasChanged(this);
24.121 }
24.122
24.123 bool TreeItem::isActiveStandardFlag (const QString &name)
24.124 @@ -350,6 +400,52 @@
24.125 return standardFlags.isActive (name);
24.126 }
24.127
24.128 +QStringList TreeItem::activeStandardFlagNames ()
24.129 +{
24.130 + return standardFlags.activeFlagNames();
24.131 +}
24.132 +
24.133 +QStringList TreeItem::activeSystemFlagNames () //FIXME-1 missing: scrolled-tmp,hideInExport
24.134 +{
24.135 + return systemFlags.activeFlagNames();
24.136 +}
24.137 +
24.138 +bool TreeItem::canMoveDown()
24.139 +{
24.140 + switch (type)
24.141 + {
24.142 + case Undefined: return false;
24.143 + case MapCenter:
24.144 + case Branch:
24.145 + if (!parentItem) return false;
24.146 + if (parentItem->num (this) < parentItem->branchCount()-1)
24.147 + return true;
24.148 + else
24.149 + return false;
24.150 + break;
24.151 + case Image: return false;
24.152 + default: return false;
24.153 + }
24.154 +}
24.155 +
24.156 +bool TreeItem::canMoveUp()
24.157 +{
24.158 + switch (type)
24.159 + {
24.160 + case Undefined: return false;
24.161 + case MapCenter:
24.162 + case Branch:
24.163 + if (!parentItem) return false;
24.164 + if (parentItem->num (this) > 0)
24.165 + return true;
24.166 + else
24.167 + return false;
24.168 + break;
24.169 + case Image: return false;
24.170 + default: return false;
24.171 + }
24.172 +}
24.173 +
24.174 void TreeItem::setID (const QString &s)
24.175 {
24.176 objID=s;
25.1 --- a/treeitem.h Thu May 07 08:48:53 2009 +0000
25.2 +++ b/treeitem.h Wed May 13 08:26:27 2009 +0000
25.3 @@ -25,7 +25,8 @@
25.4 ~TreeItem();
25.5 void init();
25.6
25.7 - virtual QString saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset);
25.8 + virtual QString saveToDir (const QString &tmpdir=QString(),const
25.9 + QString &prefix=QString(), const QPointF& offset=QPointF());
25.10
25.11
25.12 // General housekeeping
25.13 @@ -65,6 +66,7 @@
25.14 // Accessing data
25.15 virtual QVariant data(int column) const;
25.16
25.17 +
25.18 protected:
25.19 QColor headingColor;
25.20 public:
25.21 @@ -74,10 +76,26 @@
25.22 virtual void setHeadingColor(QColor color); //! Set color of heading. In BranchItem overloaded to update QGraphicsView
25.23 virtual QColor getHeadingColor(); //! Returns color of heading
25.24
25.25 +
25.26 +protected:
25.27 + QString url;
25.28 +public:
25.29 + void setURL (const QString &url); //! Set URL
25.30 + QString getURL (); //! Get URL
25.31 +
25.32 +
25.33 +protected:
25.34 + QString vymLink;
25.35 +public:
25.36 + void setVymLink (const QString &url); //! Set URL
25.37 + QString getVymLink (); //! Get URL
25.38 +
25.39 +
25.40 protected:
25.41 NoteObj note;
25.42 public:
25.43 - virtual void setNote(const QString s);
25.44 + virtual void setNote(const QString &s);
25.45 + virtual void clearNote();
25.46 virtual QString getNote();
25.47 virtual void setNoteObj(const NoteObj &, bool updateNoteEditor=true);
25.48 virtual NoteObj getNoteObj();
25.49 @@ -85,15 +103,27 @@
25.50 virtual QString getNoteASCII(); // returns note (ASCII)
25.51 virtual QString getNoteOpenDoc(); // returns note (OpenDoc)
25.52
25.53 +
25.54 protected:
25.55 FlagRow standardFlags;
25.56 + FlagRow systemFlags;
25.57 public:
25.58 virtual void activateStandardFlag(const QString &flag);
25.59 virtual void deactivateStandardFlag(const QString &flag);
25.60 - virtual void toggleStandardFlag(const QString &flag);
25.61 + virtual void deactivateAllStandardFlags();
25.62 +
25.63 + /*! \brief Toggle a Flag
25.64 + If master is not NULL,, only one Flag from FlagRow master may
25.65 + be active simultanously, the others get deactivated.
25.66 + */
25.67 + virtual void toggleStandardFlag(const QString &flag, FlagRow *master=NULL);
25.68 virtual bool isActiveStandardFlag (const QString &flag);
25.69 + virtual QStringList activeStandardFlagNames();
25.70 + virtual QStringList activeSystemFlagNames();
25.71
25.72
25.73 + virtual bool canMoveDown();
25.74 + virtual bool canMoveUp();
25.75
25.76 protected:
25.77 QString objID; //! id set during load/save currently used for xLinks
26.1 --- a/version.h Thu May 07 08:48:53 2009 +0000
26.2 +++ b/version.h Wed May 13 08:26:27 2009 +0000
26.3 @@ -7,7 +7,7 @@
26.4 #define __VYM_VERSION "1.13.0"
26.5 //#define __VYM_CODENAME "Codename: RC-1"
26.6 #define __VYM_CODENAME "Codename: development version, not for production!"
26.7 -#define __VYM_BUILD_DATE "2009-05-01"
26.8 +#define __VYM_BUILD_DATE "2009-05-13"
26.9
26.10
26.11 bool checkVersion(const QString &);
27.1 --- a/vym.pro Thu May 07 08:48:53 2009 +0000
27.2 +++ b/vym.pro Wed May 13 08:26:27 2009 +0000
27.3 @@ -4,6 +4,12 @@
27.4 CONFIG += qt warn_on release debug
27.5 CONFIG += x86 ppc
27.6
27.7 +
27.8 +include (/data/qtanimationframework-2.3-opensource/src/gui-animation.pri)
27.9 +include (/data/qtanimationframework-2.3-opensource/src/corelib-animation.pri)
27.10 +include (/data/qtanimationframework-2.3-opensource/src/qtanimationframework.pri)
27.11 +
27.12 +
27.13 TRANSLATIONS += lang/vym_de.ts
27.14 TRANSLATIONS += lang/vym_en.ts
27.15 TRANSLATIONS += lang/vym_es.ts
27.16 @@ -29,9 +35,9 @@
27.17 aboutdialog.h \
27.18 animpoint.h \
27.19 attribute.h \
27.20 - attributedelegate.h\
27.21 - attributedialog.h \
27.22 - attributewidget.h \
27.23 +# attributedelegate.h\
27.24 +# attributedialog.h \
27.25 +# attributewidget.h \
27.26 branchitem.h \
27.27 branchobj.h \
27.28 branchpropwindow.h\
27.29 @@ -42,6 +48,7 @@
27.30 extrainfodialog.h \
27.31 file.h \
27.32 findwindow.h \
27.33 + flag.h \
27.34 flagobj.h \
27.35 flagrowobj.h \
27.36 flagrow.h \
27.37 @@ -89,9 +96,9 @@
27.38 aboutdialog.cpp \
27.39 animpoint.cpp \
27.40 attribute.cpp \
27.41 - attributedelegate.cpp \
27.42 - attributedialog.cpp \
27.43 - attributewidget.cpp \
27.44 +# attributedelegate.cpp \
27.45 +# attributedialog.cpp \
27.46 +# attributewidget.cpp \
27.47 branchitem.cpp \
27.48 branchobj.cpp \
27.49 branchpropwindow.cpp \
27.50 @@ -102,6 +109,7 @@
27.51 extrainfodialog.cpp \
27.52 file.cpp \
27.53 findwindow.cpp \
27.54 + flag.cpp \
27.55 flagobj.cpp \
27.56 flagrow.cpp \
27.57 flagrowobj.cpp \
28.1 --- a/vymmodel.cpp Thu May 07 08:48:53 2009 +0000
28.2 +++ b/vymmodel.cpp Wed May 13 08:26:27 2009 +0000
28.3 @@ -44,8 +44,6 @@
28.4 extern QDir lastImageDir;
28.5 extern QDir lastFileDir;
28.6
28.7 -extern FlagRowObj *standardFlagsDefault;
28.8 -
28.9 extern Settings settings;
28.10
28.11
28.12 @@ -234,7 +232,7 @@
28.13 xml.incIndent();
28.14
28.15 // Find the used flags while traversing the tree // FIXME-2 this can be done local to vymmodel maybe...
28.16 - standardFlagsDefault->resetUsedCounter();
28.17 + //FIXME-2 not used any longer: standardFlagsDefault->resetUsedCounter();
28.18
28.19 // Reset the counters before saving
28.20 // TODO constr. of FIO creates lots of objects, better do this in some other way...
28.21 @@ -267,8 +265,7 @@
28.22 xml.decIndent();
28.23 s+=xml.endElement("vymmap");
28.24
28.25 - if (writeflags)
28.26 - standardFlagsDefault->saveToDir (tmpdir+"/flags/","",writeflags);
28.27 + // FIXME-2 if (writeflags) standardFlagsDefault->saveToDir (tmpdir+"/flags/","",writeflags);
28.28 return s;
28.29 }
28.30
28.31 @@ -1514,14 +1511,11 @@
28.32 "setHeading (\""+s+"\")",
28.33 QString("Set heading of %1 to \"%2\"").arg(getObjectName(selbi)).arg(s) );
28.34 selbi->setHeading(s );
28.35 - QModelIndex ix2=index (selbi);
28.36 - emit (dataChanged ( ix2,ix2));
28.37 - /* FIXME-3 testing only
28.38 - */
28.39 + emitDataHasChanged ( selbi); //FIXME-3 maybe emit signal from TreeItem?
28.40
28.41 reposition();
28.42 // selection.update(); //FIXME-4
28.43 - emitShowSelection();
28.44 + updateSelection();
28.45 }
28.46 }
28.47
28.48 @@ -1597,38 +1591,33 @@
28.49 // which is (still) needed to create MapCenters
28.50 }
28.51
28.52 -void VymModel::setURL(const QString &url) //FIXME-2
28.53 -{
28.54 -/*
28.55 - BranchObj *bo=getSelectedBranch();
28.56 - if (bo)
28.57 +void VymModel::setURL(const QString &url)
28.58 +{
28.59 + TreeItem *selti=getSelectedItem();
28.60 + if (selti)
28.61 {
28.62 - QString oldurl=bo->getURL();
28.63 - bo->setURL (url);
28.64 + QString oldurl=selti->getURL();
28.65 + selti->setURL (url);
28.66 saveState (
28.67 - bo,
28.68 + selti,
28.69 QString ("setURL (\"%1\")").arg(oldurl),
28.70 - bo,
28.71 + selti,
28.72 QString ("setURL (\"%1\")").arg(url),
28.73 - QString ("set URL of %1 to %2").arg(getObjectName(bo)).arg(url)
28.74 + QString ("set URL of %1 to %2").arg(getObjectName(selti)).arg(url)
28.75 );
28.76 - updateActions();
28.77 reposition();
28.78 - selection.update();
28.79 + emitDataHasChanged (selti);
28.80 emitShowSelection();
28.81 }
28.82 -*/
28.83 }
28.84
28.85 -QString VymModel::getURL() //FIXME-2
28.86 -{
28.87 -/*
28.88 - BranchObj *bo=getSelectedBranch();
28.89 - if (bo)
28.90 - return bo->getURL();
28.91 - else
28.92 - return "";
28.93 -*/
28.94 +QString VymModel::getURL()
28.95 +{
28.96 + TreeItem *selti=getSelectedItem();
28.97 + if (selti)
28.98 + return selti->getURL();
28.99 + else
28.100 + return QString();
28.101 }
28.102
28.103 QStringList VymModel::getURLs() // FIXME-1 first, next moved to vymmodel
28.104 @@ -1864,20 +1853,19 @@
28.105 }
28.106
28.107
28.108 -void VymModel::copy() //FIXME-2
28.109 -{
28.110 -/*
28.111 - LinkableMapObj *sel=getSelectedLMO();
28.112 - if (sel &&
28.113 - (selectionType() == TreeItem::Branch ||
28.114 - selectionType() == TreeItem::MapCenter ||
28.115 - selectionType() == TreeItem::Image ))
28.116 +void VymModel::copy()
28.117 +{
28.118 + TreeItem *selti=getSelectedItem();
28.119 + if (selti &&
28.120 + (selti->getType() == TreeItem::Branch ||
28.121 + selti->getType() == TreeItem::MapCenter ||
28.122 + selti->getType() == TreeItem::Image ))
28.123 {
28.124 if (redosAvail == 0)
28.125 {
28.126 // Copy to history
28.127 - QString s=getSelectString(sel);
28.128 - saveState (PartOfMap, s, "nop ()", s, "copy ()","Copy selection to clipboard",sel );
28.129 + QString s=getSelectString(selti);
28.130 + saveState (PartOfMap, s, "nop ()", s, "copy ()","Copy selection to clipboard",selti );
28.131 curClipboard=curStep;
28.132 }
28.133
28.134 @@ -1889,13 +1877,11 @@
28.135 clipboardEmpty=false;
28.136 updateActions();
28.137 }
28.138 -*/
28.139 }
28.140
28.141
28.142 -void VymModel::pasteNoSave(const int &n) //FIXME-2
28.143 -{
28.144 -/*
28.145 +void VymModel::pasteNoSave(const int &n)
28.146 +{
28.147 bool old=blockSaveState;
28.148 blockSaveState=true;
28.149 bool zippedOrg=zipped;
28.150 @@ -1910,87 +1896,59 @@
28.151 load (clipboardDir+"/"+clipboardFile,ImportAdd, VymMap);
28.152 zipped=zippedOrg;
28.153 blockSaveState=old;
28.154 -*/
28.155 }
28.156
28.157 -void VymModel::paste() //FIXME-2
28.158 +void VymModel::paste()
28.159 {
28.160 -/*
28.161 - BranchObj *sel=getSelectedBranch();
28.162 - if (sel)
28.163 + BranchItem *selbi=getSelectedBranchItem();
28.164 + if (selbi)
28.165 {
28.166 saveStateChangingPart(
28.167 - sel,
28.168 - sel,
28.169 + selbi,
28.170 + selbi,
28.171 QString ("paste (%1)").arg(curClipboard),
28.172 - QString("Paste to %1").arg( getObjectName(sel))
28.173 + QString("Paste to %1").arg( getObjectName(selbi))
28.174 );
28.175 pasteNoSave(0);
28.176 reposition();
28.177 }
28.178 -*/
28.179 }
28.180
28.181 -void VymModel::cut() //FIXME-2
28.182 -{
28.183 -/*
28.184 - LinkableMapObj *sel=getSelectedLMO();
28.185 - if ( sel && (selectionType() == TreeItem::Branch ||
28.186 - selectionType()==TreeItem::MapCenter ||
28.187 - selectionType()==TreeItem::Image))
28.188 +void VymModel::cut()
28.189 +{
28.190 + TreeItem *selti=getSelectedItem();
28.191 + if ( selti && (selti->isBranchLikeType() ||selti->getType()==TreeItem::Image))
28.192 {
28.193 -*/
28.194 - /* No savestate! savestate is called in cutNoSave
28.195 - saveStateChangingPart(
28.196 - sel->getParObj(),
28.197 - sel,
28.198 - "cut ()",
28.199 - QString("Cut %1").arg(getObjectName(sel ))
28.200 - );
28.201 - */
28.202 -/*
28.203 copy();
28.204 deleteSelection();
28.205 reposition();
28.206 }
28.207 -*/}
28.208 -
28.209 -void VymModel::moveBranchUp() //FIXME-2
28.210 -{
28.211 -/*
28.212 - BranchObj* bo=getSelectedBranch();
28.213 - BranchObj* par;
28.214 - if (bo)
28.215 +}
28.216 +
28.217 +void VymModel::moveUp()
28.218 +{
28.219 + BranchItem *selbi=getSelectedBranchItem();
28.220 + if (selbi)
28.221 {
28.222 - if (!bo->canMoveBranchUp()) return;
28.223 - par=(BranchObj*)(bo->getParObj());
28.224 - BranchObj *obo=par->moveBranchUp (bo); // bo will be the one below selection
28.225 - saveState (getSelectString(bo),"moveBranchDown ()",getSelectString(obo),"moveBranchUp ()",QString("Move up %1").arg(getObjectName(bo)));
28.226 - reposition();
28.227 - //FIXME-3 VM needed? scene()->update();
28.228 - selection.update();
28.229 - emitShowSelection();
28.230 + if (!selbi->canMoveUp()) return;
28.231 + QString oldsel=getSelectString();
28.232 + if (relinkBranch (selbi,(BranchItem*)selbi->parent(),selbi->num()-1) )
28.233 +
28.234 + saveState (getSelectString(),"moveDown ()",oldsel,"moveUp ()",QString("Move up %1").arg(getObjectName(selbi)));
28.235 }
28.236 - */
28.237 }
28.238
28.239 -void VymModel::moveBranchDown() //FIXME-2
28.240 -{
28.241 -/*
28.242 - BranchObj* bo=getSelectedBranch();
28.243 - BranchObj* par;
28.244 - if (bo)
28.245 +void VymModel::moveDown()
28.246 +{
28.247 + BranchItem *selbi=getSelectedBranchItem();
28.248 + if (selbi)
28.249 {
28.250 - if (!bo->canMoveBranchDown()) return;
28.251 - par=(BranchObj*)(bo->getParObj());
28.252 - BranchObj *obo=par->moveBranchDown(bo); // bo will be the one above selection
28.253 - saveState(getSelectString(bo),"moveBranchUp ()",getSelectString(obo),"moveBranchDown ()",QString("Move down %1").arg(getObjectName(bo)));
28.254 - reposition();
28.255 - //FIXME-3 VM needed? scene()->update();
28.256 - selection.update();
28.257 - emitShowSelection();
28.258 - }
28.259 -*/
28.260 + if (!selbi->canMoveDown()) return;
28.261 + QString oldsel=getSelectString();
28.262 + if ( relinkBranch (selbi,(BranchItem*)selbi->parent(),selbi->num()+1) )
28.263 +
28.264 + saveState (getSelectString(),"moveUp ()",oldsel,"moveDown ()",QString("Move down %1").arg(getObjectName(selbi)));
28.265 + }
28.266 }
28.267
28.268 void VymModel::sortChildren() // FIXME-2 not implemented yet
28.269 @@ -2084,7 +2042,6 @@
28.270 rootItem->appendChild (mci);
28.271
28.272 endInsertRows();
28.273 - emit (newChildObject (parix));
28.274 emit (layoutChanged() );
28.275
28.276 // Create MapObj
28.277 @@ -2162,7 +2119,6 @@
28.278 parbi->insertBranch(n,newbi);
28.279 endInsertRows ();
28.280 }
28.281 - emit (newChildObject (parix));
28.282 emit (layoutChanged() );
28.283
28.284 // save scroll state. If scrolled, automatically select
28.285 @@ -2251,10 +2207,11 @@
28.286 return NULL;
28.287 }
28.288
28.289 -BranchItem* VymModel::relinkBranch (BranchItem *branch, BranchItem *dst, int pos)
28.290 +bool VymModel::relinkBranch (BranchItem *branch, BranchItem *dst, int pos)
28.291 {
28.292 if (branch && dst)
28.293 {
28.294 + cout << "VM::relinkBranch "<<branch->getHeadingStd()<<" to "<<dst->getHeadingStd()<<" at "<<pos<<endl;
28.295 emit (layoutAboutToBeChanged() );
28.296 BranchItem *branchpi=(BranchItem*)branch->parent();
28.297 // Remove at current position
28.298 @@ -2276,8 +2233,11 @@
28.299
28.300 branch->getLMO()->setParObj(dst->getLMO()); //FIXME-5 update parObj in View
28.301 emit (layoutChanged() );
28.302 + reposition(); // both for moveUp/Down and relinking
28.303 select (branch);
28.304 + return true;
28.305 }
28.306 + return false;
28.307 }
28.308
28.309 void VymModel::deleteSelection()
28.310 @@ -2393,21 +2353,23 @@
28.311 if (bi->isScrolled()) return false;
28.312 if (bi->branchCount()==0) return false;
28.313 if (bi->depth()==0) return false;
28.314 - QString u,r;
28.315 - r="scroll";
28.316 - u="unscroll";
28.317 - /* FIXME-3 no savestate yet
28.318 - saveState(
28.319 - bo,
28.320 - QString ("%1 ()").arg(u),
28.321 - bo,
28.322 - QString ("%1 ()").arg(r),
28.323 - QString ("%1 %2").arg(r).arg(getObjectName(bo))
28.324 - );
28.325 - */
28.326 - bi->toggleScroll();
28.327 - mapScene->update(); //Needed for _quick_ update
28.328 - return true;
28.329 + if (bi->toggleScroll())
28.330 + {
28.331 + QString u,r;
28.332 + r="scroll";
28.333 + u="unscroll";
28.334 + saveState(
28.335 + bi,
28.336 + QString ("%1 ()").arg(u),
28.337 + bi,
28.338 + QString ("%1 ()").arg(r),
28.339 + QString ("%1 %2").arg(r).arg(getObjectName(bi))
28.340 + );
28.341 + emitDataHasChanged(bi);
28.342 + updateSelection();
28.343 + mapScene->update(); //Needed for _quick_ update, even in 1.13.x //FIXME-3 force update via signal...
28.344 + return true;
28.345 + }
28.346 }
28.347 return false;
28.348 }
28.349 @@ -2423,32 +2385,34 @@
28.350 QString u,r;
28.351 u="scroll";
28.352 r="unscroll";
28.353 - /* FIXME-3 no savestate yet
28.354 saveState(
28.355 - bo,
28.356 + bi,
28.357 QString ("%1 ()").arg(u),
28.358 - bo,
28.359 + bi,
28.360 QString ("%1 ()").arg(r),
28.361 - QString ("%1 %2").arg(r).arg(getObjectName(bo))
28.362 + QString ("%1 %2").arg(r).arg(getObjectName(bi))
28.363 );
28.364 - */
28.365 bi->toggleScroll();
28.366 - mapScene->update(); // Needed for _quick_ update
28.367 + emitDataHasChanged(bi);
28.368 + updateSelection();
28.369 +
28.370 + mapScene->update(); //Needed for _quick_ update, even in 1.13.x //FIXME-3 force update via signal...
28.371 return true;
28.372 }
28.373 return false;
28.374 }
28.375
28.376 -void VymModel::toggleScroll()
28.377 +void VymModel::toggleScroll()
28.378 {
28.379 BranchItem *bi=(BranchItem*)getSelectedBranchItem();
28.380 - if (bi && bi->getType()==TreeItem::Branch )
28.381 + if (bi && bi->isBranchLikeType() )
28.382 {
28.383 if (bi->isScrolled())
28.384 unscrollBranch (bi);
28.385 else
28.386 scrollBranch (bi);
28.387 }
28.388 + // saveState is called in above functions
28.389 }
28.390
28.391 void VymModel::unscrollChildren() // FIXME-2 first, next moved to vymmodel
28.392 @@ -2473,9 +2437,8 @@
28.393 emit (expandAll() );
28.394 }
28.395
28.396 -void VymModel::toggleStandardFlag (const QString &name)
28.397 -{
28.398 - cout << "VM::toggleStandardFlag "<<name.toStdString()<<endl;
28.399 +void VymModel::toggleStandardFlag (const QString &name, FlagRow *master)
28.400 +{
28.401 BranchItem *bi=getSelectedBranchItem();
28.402 if (bi)
28.403 {
28.404 @@ -2496,8 +2459,9 @@
28.405 bi,
28.406 QString("%1 (\"%2\")").arg(r).arg(name),
28.407 QString("Toggling standard flag \"%1\" of %2").arg(name).arg(getObjectName(bi)));
28.408 - bi->toggleStandardFlag (name); //FIXME-0,mainWindow->useFlagGroups());
28.409 - //FIXME-0 model->updateSelection(); // geometry has changed
28.410 + bi->toggleStandardFlag (name, master);
28.411 + reposition();
28.412 + updateSelection();
28.413 }
28.414 }
28.415
28.416 @@ -2568,28 +2532,25 @@
28.417
28.418
28.419
28.420 -void VymModel::editURL() //FIXME-2
28.421 -{
28.422 -/*
28.423 - BranchObj *bo=getSelectedBranch();
28.424 - if (bo)
28.425 +void VymModel::editURL()
28.426 +{
28.427 + TreeItem *selti=getSelectedItem();
28.428 + if (selti)
28.429 {
28.430 bool ok;
28.431 QString text = QInputDialog::getText(
28.432 "VYM", tr("Enter URL:"), QLineEdit::Normal,
28.433 - bo->getURL(), &ok, NULL);
28.434 + selti->getURL(), &ok, NULL);
28.435 if ( ok)
28.436 // user entered something and pressed OK
28.437 setURL(text);
28.438 }
28.439 -*/
28.440 }
28.441
28.442 -void VymModel::editLocalURL() //FIXME-2
28.443 -{
28.444 -/*
28.445 - BranchObj *bo=getSelectedBranch();
28.446 - if (bo)
28.447 +void VymModel::editLocalURL()
28.448 +{
28.449 + TreeItem *selti=getSelectedItem();
28.450 + if (selti)
28.451 {
28.452 QStringList filters;
28.453 filters <<"All files (*)";
28.454 @@ -2601,8 +2562,8 @@
28.455 fd->setFilters (filters);
28.456 fd->setCaption(vymName+" - " +tr("Set URL to a local file"));
28.457 fd->setDirectory (lastFileDir);
28.458 - if (! bo->getVymLink().isEmpty() )
28.459 - fd->selectFile( bo->getURL() );
28.460 + if (! selti->getVymLink().isEmpty() )
28.461 + fd->selectFile( selti->getURL() );
28.462 fd->show();
28.463
28.464 if ( fd->exec() == QDialog::Accepted )
28.465 @@ -2611,49 +2572,42 @@
28.466 setURL (fd->selectedFile() );
28.467 }
28.468 }
28.469 - */
28.470 }
28.471
28.472
28.473 -void VymModel::editHeading2URL() //FIXME-2
28.474 -{
28.475 -/*
28.476 - BranchObj *bo=getSelectedBranch();
28.477 - if (bo)
28.478 - setURL (bo->getHeading());
28.479 -*/
28.480 +void VymModel::editHeading2URL()
28.481 +{
28.482 + TreeItem *selti=getSelectedItem();
28.483 + if (selti)
28.484 + setURL (selti->getHeading());
28.485 }
28.486
28.487 -void VymModel::editBugzilla2URL() //FIXME-2
28.488 -{
28.489 -/*
28.490 - BranchObj *bo=getSelectedBranch();
28.491 - if (bo)
28.492 +void VymModel::editBugzilla2URL()
28.493 +{
28.494 + TreeItem *selti=getSelectedItem();
28.495 + if (selti)
28.496 {
28.497 - QString url= "https://bugzilla.novell.com/show_bug.cgi?id="+bo->getHeading();
28.498 + QString url= "https://bugzilla.novell.com/show_bug.cgi?id="+selti->getHeading();
28.499 setURL (url);
28.500 }
28.501 -*/
28.502 }
28.503
28.504 -void VymModel::editFATE2URL() //FIXME-2
28.505 -{
28.506 -/*
28.507 - BranchObj *bo=getSelectedBranch();
28.508 - if (bo)
28.509 +void VymModel::editFATE2URL()
28.510 +{
28.511 + TreeItem *selti=getSelectedItem();
28.512 + if (selti)
28.513 {
28.514 - QString url= "http://keeper.suse.de:8080/webfate/match/id?value=ID"+bo->getHeading();
28.515 + QString url= "http://keeper.suse.de:8080/webfate/match/id?value=ID"+selti->getHeading();
28.516 saveState(
28.517 - bo,
28.518 - "setURL (\""+bo->getURL()+"\")",
28.519 - bo,
28.520 + selti,
28.521 + "setURL (\""+selti->getURL()+"\")",
28.522 + selti,
28.523 "setURL (\""+url+"\")",
28.524 - QString("Use heading of %1 as link to FATE").arg(getObjectName(bo))
28.525 + QString("Use heading of %1 as link to FATE").arg(getObjectName(selti))
28.526 );
28.527 - bo->setURL (url);
28.528 - updateActions();
28.529 + selti->setURL (url);
28.530 + // FIXME-4 updateActions();
28.531 }
28.532 -*/
28.533 }
28.534
28.535 void VymModel::editVymLink()
28.536 @@ -2693,7 +2647,7 @@
28.537 BranchItem *bi=getSelectedBranchItem();
28.538 if (bi)
28.539 {
28.540 - bi->getBranchObj()->setVymLink(s); //FIXME-3 check getBO
28.541 + bi->setVymLink(s);
28.542 reposition();
28.543 updateActions();
28.544 //selection.update();
28.545 @@ -2708,16 +2662,14 @@
28.546 {
28.547 saveState(
28.548 bi,
28.549 - "setVymLink (\""+bi->getBranchObj()->getVymLink()+"\")", //FIXME-3 check getBO
28.550 -
28.551 + "setVymLink (\""+bi->getVymLink()+"\")",
28.552 bi,
28.553 "setVymLink (\"\")",
28.554 QString("Unset vymlink of %1").arg(getObjectName(bi))
28.555 );
28.556 - bi->getBranchObj()->setVymLink ("" ); //FIXME-3 check getBO
28.557 + bi->setVymLink ("" );
28.558 updateActions();
28.559 reposition();
28.560 - // FIXME-3 VM needed? scene()->update();
28.561 }
28.562 }
28.563
28.564 @@ -2725,7 +2677,7 @@
28.565 {
28.566 BranchItem *bi=getSelectedBranchItem();
28.567 if (bi)
28.568 - return bi->getBranchObj()->getVymLink(); //FIXME-3 check getBO here...
28.569 + return bi->getVymLink();
28.570 else
28.571 return "";
28.572
28.573 @@ -2907,7 +2859,7 @@
28.574 }
28.575 }
28.576 /////////////////////////////////////////////////////////////////////
28.577 - } else /*if (com=="clearFlags") // FIXME-2
28.578 + } else if (com=="clearFlags")
28.579 {
28.580 if (!selti )
28.581 {
28.582 @@ -2917,11 +2869,10 @@
28.583 parser.setError (Aborted,"Type of selection is not a branch");
28.584 } else if (parser.checkParCount(0))
28.585 {
28.586 - selb->clearStandardFlags();
28.587 - selb->updateFlagsToolbar();
28.588 + selbi->deactivateAllStandardFlags();
28.589 }
28.590 /////////////////////////////////////////////////////////////////////
28.591 - } else */ if (com=="colorBranch")
28.592 + } else if (com=="colorBranch")
28.593 {
28.594 if (!selti)
28.595 {
28.596 @@ -3172,7 +3123,7 @@
28.597 if (ok) loadFloatImageInt (s);
28.598 }
28.599 /////////////////////////////////////////////////////////////////////
28.600 - } else if (com=="moveBranchUp")
28.601 + } else if (com=="moveUp")
28.602 {
28.603 if (!selti )
28.604 {
28.605 @@ -3182,10 +3133,10 @@
28.606 parser.setError (Aborted,"Type of selection is not a branch");
28.607 } else if (parser.checkParCount(0))
28.608 {
28.609 - moveBranchUp();
28.610 + moveUp();
28.611 }
28.612 /////////////////////////////////////////////////////////////////////
28.613 - } else if (com=="moveBranchDown")
28.614 + } else if (com=="moveDown")
28.615 {
28.616 if (!selti )
28.617 {
28.618 @@ -3195,7 +3146,7 @@
28.619 parser.setError (Aborted,"Type of selection is not a branch");
28.620 } else if (parser.checkParCount(0))
28.621 {
28.622 - moveBranchDown();
28.623 + moveDown();
28.624 }
28.625 /////////////////////////////////////////////////////////////////////
28.626 } else if (com=="move")
28.627 @@ -3624,7 +3575,7 @@
28.628 }
28.629 }
28.630 /////////////////////////////////////////////////////////////////////
28.631 - else /* FIXME-2 if (com=="setFlag")
28.632 + else if (com=="setFlag")
28.633 {
28.634 if (!selti )
28.635 {
28.636 @@ -3636,13 +3587,10 @@
28.637 {
28.638 s=parser.parString(ok,0);
28.639 if (ok)
28.640 - {
28.641 - selb->activateStandardFlag(s);
28.642 - selb->updateFlagsToolbar();
28.643 - }
28.644 + selbi->activateStandardFlag(s);
28.645 }
28.646 /////////////////////////////////////////////////////////////////////
28.647 - } else */ /* FIXME-2 if (com=="setFrameType")
28.648 + } else /* FIXME-2 if (com=="setFrameType")
28.649 {
28.650 if (!selti )
28.651 {
28.652 @@ -3670,7 +3618,7 @@
28.653 sortChildren();
28.654 }
28.655 /////////////////////////////////////////////////////////////////////
28.656 - } else /* FIXME-2 if (com=="toggleFlag")
28.657 + } else if (com=="toggleFlag")
28.658 {
28.659 if (!selti )
28.660 {
28.661 @@ -3682,13 +3630,10 @@
28.662 {
28.663 s=parser.parString(ok,0);
28.664 if (ok)
28.665 - {
28.666 selbi->toggleStandardFlag(s);
28.667 - selb->updateFlagsToolbar();
28.668 - }
28.669 }
28.670 /////////////////////////////////////////////////////////////////////
28.671 - } else */ if (com=="unscroll")
28.672 + } else if (com=="unscroll")
28.673 {
28.674 if (!selti)
28.675 {
28.676 @@ -3715,9 +3660,9 @@
28.677 unscrollChildren ();
28.678 }
28.679 /////////////////////////////////////////////////////////////////////
28.680 - } else /* FIXME-2 if (com=="unsetFlag")
28.681 + } else if (com=="unsetFlag")
28.682 {
28.683 - if (selection.isEmpty() )
28.684 + if (!selti)
28.685 {
28.686 parser.setError (Aborted,"Nothing selected");
28.687 } else if (! selbi )
28.688 @@ -3727,12 +3672,9 @@
28.689 {
28.690 s=parser.parString(ok,0);
28.691 if (ok)
28.692 - {
28.693 - selb->deactivateStandardFlag(s);
28.694 - selb->updateFlagsToolbar();
28.695 - }
28.696 + selbi->deactivateStandardFlag(s);
28.697 }
28.698 - } else */
28.699 + } else
28.700 parser.setError (Aborted,"Unknown command");
28.701
28.702 // Any errors?
28.703 @@ -3946,18 +3888,20 @@
28.704 void VymModel::updateNoteFlag()
28.705 {
28.706 setChanged();
28.707 - cout << "VM::updateNoteFlag()\n";
28.708 - /* FIXME-1 modify note flag
28.709 - BranchObj *bo=getSelectedBranch();
28.710 - if (bo)
28.711 + TreeItem *selti=getSelectedItem();
28.712 + if (selti)
28.713 {
28.714 - bo->updateNoteFlag();
28.715 - mainWindow->updateActions();
28.716 - }
28.717 - */
28.718 + if (textEditor->isEmpty())
28.719 + selti->clearNote();
28.720 + else
28.721 + selti->setNote (textEditor->getText());
28.722 + emitDataHasChanged(selti);
28.723 + updateSelection();
28.724 +
28.725 + }
28.726 }
28.727
28.728 -void VymModel::updateRelPositions() //FIXME-2 VM should have no need to updateRelPos
28.729 +void VymModel::updateRelPositions() //FIXME-3 VM should have no need to updateRelPos
28.730 {
28.731 //cout << "VM::updateRelPos...\n";
28.732 for (int i=0; i<rootItem->branchCount(); i++)
28.733 @@ -4694,7 +4638,7 @@
28.734 void VymModel::emitDataHasChanged (TreeItem *ti)
28.735 {
28.736 QModelIndex ix=index(ti);
28.737 - emit (dataHasChanged (ix) );
28.738 + emit (dataChanged (ix,ix) );
28.739 }
28.740
28.741
29.1 --- a/vymmodel.h Thu May 07 08:48:53 2009 +0000
29.2 +++ b/vymmodel.h Wed May 13 08:26:27 2009 +0000
29.3 @@ -277,8 +277,8 @@
29.4 void paste(); //!< Paste clipboard to branch and backup
29.5 void cut(); //!< Cut to clipboard (and copy)
29.6
29.7 - void moveBranchUp(); //!< Move branch up
29.8 - void moveBranchDown(); //!< Move branch down
29.9 + void moveUp(); //!< Move branch up
29.10 + void moveDown(); //!< Move branch down
29.11 void sortChildren(); //!< Sort children lexically
29.12
29.13 // The create methods are used to quickly parse a XML file
29.14 @@ -317,7 +317,14 @@
29.15 */
29.16 BranchItem* addNewBranch(int pos);
29.17 BranchItem* addNewBranchBefore(); //!< Insert branch between selection and its parent
29.18 - BranchItem* relinkBranch (BranchItem* branch, BranchItem* dst, int pos =-1); //! Relink branch to dst at position pos
29.19 + /*! \brief Relink a branch to a new destination dst
29.20 + Relinks branch to dst at branch position pos. There is no saveState
29.21 + here, as for example moveUp or moving in MapEditor have
29.22 + different needs to call saveState
29.23 + Returns true if relinking was successful.
29.24 + */
29.25 + bool relinkBranch (BranchItem* branch, BranchItem* dst, int pos =-1);
29.26 +
29.27 void deleteSelection(); //!< Delete selection
29.28 void deleteKeepChildren(); //!< remove branch, but keep children
29.29 void deleteChildren(); //!< keep branch, but remove children
29.30 @@ -333,7 +340,7 @@
29.31 void expandAll();
29.32
29.33 public:
29.34 - void toggleStandardFlag (const QString &name);
29.35 + void toggleStandardFlag (const QString &name, FlagRow *master=NULL);
29.36 void addFloatImage(const QPixmap &img);
29.37
29.38 void colorBranch(QColor);
29.39 @@ -426,7 +433,6 @@
29.40
29.41 signals:
29.42 void noteHasChanged (QModelIndex ix);
29.43 - void dataHasChanged (QModelIndex ix); //FIXME-3 necessary? There is dataChanged in AbstractModel
29.44 void newChildObject(QModelIndex ix);
29.45
29.46 private:
29.47 @@ -477,7 +483,7 @@
29.48 uint animationTicks;
29.49 uint animationInterval;
29.50 int timerId; // animation timer
29.51 - QList <MapObj*> animObjList;// list with animated objects
29.52 + QList <MapObj*> animObjList;// list with animated objects //FIXME-2 should go to MapEditor
29.53
29.54 private slots:
29.55 void animate(); //!< Called by timer to animate stuff
30.1 --- a/vymview.cpp Thu May 07 08:48:53 2009 +0000
30.2 +++ b/vymview.cpp Wed May 13 08:26:27 2009 +0000
30.3 @@ -49,12 +49,6 @@
30.4 model, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
30.5 mapEditor,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
30.6
30.7 - /*
30.8 - connect (
30.9 - model, SIGNAL (newChildObject(QModelIndex) ),
30.10 - this,SLOT (updateChilds (QModelIndex) ) );
30.11 -*/
30.12 -
30.13 connect (
30.14 model, SIGNAL (noteHasChanged(QModelIndex) ),
30.15 mainWindow, SLOT (updateNoteEditor (QModelIndex) ) );
30.16 @@ -91,13 +85,6 @@
30.17 return NULL;
30.18 }
30.19
30.20 -
30.21 -void VymView::updateChilds (QModelIndex ix) //FIXME-4 not needed?
30.22 -{
30.23 - cout << "VV::updateChilds \n";
30.24 - //treeview->setExpanded (ix,true); // This is expensive...
30.25 -}
30.26 -
30.27 void VymView::changeSelection (const QItemSelection &newsel, const QItemSelection &oldsel)
30.28 {
30.29 /*
30.30 @@ -112,6 +99,7 @@
30.31
30.32 // Notify mainwindow to update satellites like NoteEditor, if needed (model==currenModel...)
30.33 mainWindow->changeSelection (model,newsel,oldsel); // FIXME-3 maybe connect VymModel <-> MainWindow directly?
30.34 + showSelection();
30.35 }
30.36
30.37 void VymView::expandAll()
30.38 @@ -128,7 +116,7 @@
30.39 );
30.40
30.41 LinkableMapObj* lmo=model->getSelectedLMO();
30.42 - if (lmo)
30.43 - mapEditor->ensureVisible(lmo->getBBox() );
30.44 + if (lmo)
30.45 + mapEditor->setScrollBarPosTarget (lmo->getBBox() );
30.46 }
30.47
31.1 --- a/vymview.h Thu May 07 08:48:53 2009 +0000
31.2 +++ b/vymview.h Wed May 13 08:26:27 2009 +0000
31.3 @@ -17,7 +17,6 @@
31.4 QItemSelectionModel* selectionModel();
31.5
31.6 public slots:
31.7 - void updateChilds (QModelIndex ix);
31.8 void changeSelection (const QItemSelection &newSel, const QItemSelection &delSel);
31.9 void expandAll ();
31.10 void showSelection ();