1.1 --- a/branchobj.cpp Wed May 06 11:08:38 2009 +0000
1.2 +++ b/branchobj.cpp Thu May 07 08:48:53 2009 +0000
1.3 @@ -436,6 +436,7 @@
1.4 // if (isNoteInEditor) getNoteFromTextEditor(); //FIXME-2 moved to TreeItem
1.5
1.6 QString s,a;
1.7 + /*
1.8 QString scrolledAttr;
1.9 if ( ((BranchItem*)treeItem)->isScrolled() )
1.10 scrolledAttr=attribut ("scrolled","yes");
1.11 @@ -512,6 +513,7 @@
1.12 decIndent();
1.13 s+=endElement ("branch");
1.14 return s;
1.15 +*/
1.16 }
1.17
1.18 void BranchObj::addXLink (XLinkObj *xlo)
2.1 --- a/flagrowobj.cpp Wed May 06 11:08:38 2009 +0000
2.2 +++ b/flagrowobj.cpp Thu May 07 08:48:53 2009 +0000
2.3 @@ -1,8 +1,12 @@
2.4 +#include <QToolBar>
2.5 +
2.6 +#include <iostream>
2.7 +using namespace std;
2.8 +
2.9 #include "flagrowobj.h"
2.10 +
2.11 #include "geometry.h"
2.12
2.13 -#include <QToolBar>
2.14 -
2.15 /////////////////////////////////////////////////////////////////
2.16 // FlagRowObj
2.17 /////////////////////////////////////////////////////////////////
2.18 @@ -128,7 +132,7 @@
2.19 return false;
2.20 }
2.21
2.22 -void FlagRowObj::toggle (const QString &foname, bool exclusive)
2.23 +void FlagRowObj::toggle (const QString &foname)
2.24 {
2.25 FlagObj *fo=findFlag (foname);
2.26 if (fo)
2.27 @@ -146,11 +150,12 @@
2.28 {
2.29 fo=addFlag (fo);
2.30 fo->activate();
2.31 - if (exclusive)
2.32 + /*FIXME-0 move to VM if (exclusive)
2.33 {
2.34 deactivateGroup (fo);
2.35 updateToolbar();
2.36 }
2.37 + */
2.38 } else
2.39 qWarning ("FlagRowObj ("+name+")::toggle ("+foname+") failed - could not find it in parentRow");
2.40 }
2.41 @@ -160,6 +165,7 @@
2.42
2.43 void FlagRowObj::activate (const QString &foname)
2.44 {
2.45 + cout << "FRO::activate "<<foname.toStdString()<<endl;
2.46 // Note: "activate" is also called during loading of a map
2.47 // Here we do not check for exclusive flags!
2.48 FlagObj *fo=findFlag (foname);
2.49 @@ -223,7 +229,7 @@
2.50 }
2.51 }
2.52
2.53 -void FlagRowObj::deactivateGroup (FlagObj *keepfo)
2.54 +void FlagRowObj::deactivateGroup (FlagObj *keepfo) //FIXME-0 move to VM
2.55 {
2.56 // deactivate all flags in keepof, but keep keepfo [sic!]
2.57 if (keepfo)
3.1 --- a/flagrowobj.h Wed May 06 11:08:38 2009 +0000
3.2 +++ b/flagrowobj.h Thu May 07 08:48:53 2009 +0000
3.3 @@ -3,7 +3,7 @@
3.4
3.5 #include <QMainWindow>
3.6
3.7 -#include "mapobj.h"
3.8 +//#include "mapobj.h"
3.9 #include "flagobj.h"
3.10
3.11 /*! \brief A collection of flags (FlagObj).
3.12 @@ -12,7 +12,7 @@
3.13 A toolbar can be created from the flags in this row.
3.14 */
3.15
3.16 -class FlagRowObj:public MapObj {
3.17 +class FlagRowObj:public MapObj { // FIXME-0 move pixmaps to mainwindow or model in the end...
3.18 public:
3.19 FlagRowObj ();
3.20 FlagRowObj (QGraphicsScene *);
3.21 @@ -28,19 +28,19 @@
3.22 virtual void calcBBoxSize();
3.23 virtual QString getFlagName (const QPointF &p); // Find flag by position
3.24 bool isActive(const QString&);
3.25 - void toggle (const QString&,bool);
3.26 + void toggle (const QString &name);
3.27 void activate(const QString&);
3.28 void deactivate(const QString&);
3.29 void deactivateAll();
3.30 - void deactivateGroup(FlagObj *);
3.31 - void setToolBar (QToolBar *);
3.32 + void deactivateGroup(FlagObj *); //FIXME-0
3.33 + void setToolBar (QToolBar *); //FIXME-0
3.34 void setEnabled (bool);
3.35 void setShowFlags (bool);
3.36 void resetUsedCounter();
3.37 QString saveToDir (const QString &,const QString &,bool);
3.38 void setName (const QString&); // prefix for exporting flags to dir
3.39 - void makeToolbar (QMainWindow*, const QString &); // Create Toolbar buttons
3.40 - void updateToolbar(); // Update Toolbar buttons
3.41 + void makeToolbar (QMainWindow*, const QString &); // Create Toolbar buttons FIXME-0
3.42 + void updateToolbar(); // Update Toolbar buttons FIXME-0
3.43 private:
3.44 FlagRowObj* parentRow; // look for flags in this row
3.45 FlagObj* findFlag (const QString&);
4.1 --- a/mainwindow.cpp Wed May 06 11:08:38 2009 +0000
4.2 +++ b/mainwindow.cpp Thu May 07 08:48:53 2009 +0000
4.3 @@ -3815,8 +3815,8 @@
4.4
4.5 void Main::standardFlagChanged()
4.6 {
4.7 - if (currentMapEditor())
4.8 - currentMapEditor()->toggleStandardFlag(sender()->name());
4.9 + if (currentModel())
4.10 + currentModel()->toggleStandardFlag(sender()->name());
4.11 }
4.12
4.13 void Main::testFunction1()
5.1 --- a/mapcenterobj.cpp Wed May 06 11:08:38 2009 +0000
5.2 +++ b/mapcenterobj.cpp Thu May 07 08:48:53 2009 +0000
5.3 @@ -112,6 +112,7 @@
5.4 {
5.5 QString s,a;
5.6
5.7 +/*
5.8 // save area, if not scrolled
5.9 QString areaAttr=
5.10 attribut("x1",QString().setNum(absPos.x()-offset.x())) +
5.11 @@ -120,14 +121,14 @@
5.12 attribut("y2",QString().setNum(absPos.y()+height()-offset.y()));
5.13
5.14 // Providing an ID for a branch makes export to XHTML easier
5.15 - /* FIXME-3
5.16 + // FIXME-3
5.17 QString idAttr;
5.18 if (treeItem->xlinkCount()>0)
5.19 idAttr=attribut ("id",mapEditor->getModel()->getSelectString(this)); //TODO directly access model
5.20
5.21 else
5.22 idAttr="";
5.23 - */
5.24 +
5.25
5.26 QString linkAttr=getLinkAttr();
5.27
5.28 @@ -173,6 +174,7 @@
5.29
5.30 decIndent();
5.31 s+=endElement ("mapcenter");
5.32 + */
5.33 return s;
5.34 }
5.35
6.1 --- a/mapeditor.cpp Wed May 06 11:08:38 2009 +0000
6.2 +++ b/mapeditor.cpp Thu May 07 08:48:53 2009 +0000
6.3 @@ -250,35 +250,6 @@
6.4 setRenderHint(QPainter::SmoothPixmapTransform,b);
6.5 }
6.6
6.7 -void MapEditor::toggleStandardFlag(QString f)
6.8 -{
6.9 - BranchItem *bi=model->getSelectedBranchItem();
6.10 - if (bi)
6.11 - {
6.12 - QString u,r;
6.13 - /* FIXME-2 isSetStandardFlag needs to be ported
6.14 - if (bi->isSetStandardFlag(f))
6.15 - {
6.16 - r="unsetFlag";
6.17 - u="setFlag";
6.18 - }
6.19 - else
6.20 - {
6.21 - u="unsetFlag";
6.22 - r="setFlag";
6.23 - }
6.24 - */
6.25 - model->saveState(
6.26 - bi,
6.27 - QString("%1 (\"%2\")").arg(u).arg(f),
6.28 - bi,
6.29 - QString("%1 (\"%2\")").arg(r).arg(f),
6.30 - QString("Toggling standard flag \"%1\" of %2").arg(f).arg(model->getObjectName(bi)));
6.31 - // FIXME-2 bi->toggleStandardFlag (f,mainWindow->useFlagGroups());
6.32 - model->updateSelection(); // geometry has changed
6.33 - }
6.34 -}
6.35 -
6.36 TreeItem* MapEditor::findMapItem (QPointF p,TreeItem *exclude)
6.37 {
6.38 // Start with mapcenter, no images allowed at rootItem
7.1 --- a/mapeditor.h Wed May 06 11:08:38 2009 +0000
7.2 +++ b/mapeditor.h Thu May 07 08:48:53 2009 +0000
7.3 @@ -26,7 +26,6 @@
7.4 void setAntiAlias (bool); //!< Set or unset antialiasing
7.5 void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps
7.6 public:
7.7 - void toggleStandardFlag(QString); //FIXME-2 still needed?
7.8 TreeItem *findMapItem (QPointF p,TreeItem *exclude); //! find item in map at position p. Ignore item exclude
7.9
7.10 AttributeTable* attributeTable();
8.1 --- a/ornamentedobj.cpp Wed May 06 11:08:38 2009 +0000
8.2 +++ b/ornamentedobj.cpp Thu May 07 08:48:53 2009 +0000
8.3 @@ -189,13 +189,13 @@
8.4 ox=leftPad + d;
8.5 oy=topPad + d;
8.6
8.7 - //FIXME-2 systemFlags-> move (ox +x , oy + y );
8.8 + systemFlags-> move (ox +x , oy + y );
8.9
8.10 // vertical align heading to bottom
8.11 heading->move (ox + x + systemFlags->getBBox().width(),
8.12 oy + y + ornamentsBBox.height() - heading->getHeight()
8.13 );
8.14 - //FIXME-2 standardFlags->move (ox +x + heading->getWidth() + systemFlags->getBBox().width() , oy + y );
8.15 + standardFlags->move (ox +x + heading->getWidth() + systemFlags->getBBox().width() , oy + y );
8.16
8.17 ornamentsBBox.moveTopLeft ( QPointF ((int)(ox+x),(int)(oy+y)));
8.18 clickBox.moveTopLeft (QPointF ((int)(ox + x), (int)(oy + y)));
8.19 @@ -318,36 +318,36 @@
8.20 forceReposition();
8.21 }
8.22
8.23 -void OrnamentedObj::toggleStandardFlag(QString f, bool exclusive)
8.24 +void OrnamentedObj::toggleStandardFlag(const QString &name)
8.25 {
8.26 - standardFlags->toggle(f,exclusive);
8.27 + standardFlags->toggle(name);
8.28 calcBBoxSize();
8.29 positionBBox();
8.30 move (absPos.x(), absPos.y() );
8.31 forceReposition();
8.32 }
8.33
8.34 -void OrnamentedObj::activateStandardFlag(QString f)
8.35 +void OrnamentedObj::activateStandardFlag(const QString &name)
8.36 {
8.37 - standardFlags->activate(f);
8.38 + standardFlags->activate(name);
8.39 calcBBoxSize();
8.40 positionBBox();
8.41 move (absPos.x(), absPos.y() );
8.42 forceReposition();
8.43 }
8.44
8.45 -void OrnamentedObj::deactivateStandardFlag(QString f)
8.46 +void OrnamentedObj::deactivateStandardFlag(const QString &name)
8.47 {
8.48 - standardFlags->deactivate(f);
8.49 + standardFlags->deactivate(name);
8.50 calcBBoxSize();
8.51 positionBBox();
8.52 move (absPos.x(), absPos.y() );
8.53 forceReposition();
8.54 }
8.55
8.56 -bool OrnamentedObj::isSetStandardFlag (QString f)
8.57 +bool OrnamentedObj::isSetStandardFlag (const QString &name)
8.58 {
8.59 - return standardFlags->isActive(f);
8.60 + return standardFlags->isActive(name);
8.61 }
8.62
8.63 QString OrnamentedObj::getSystemFlagName(const QPointF &p)
8.64 @@ -355,9 +355,9 @@
8.65 return systemFlags->getFlagName(p);
8.66 }
8.67
8.68 -bool OrnamentedObj::isActiveFlag (const QString & fname)
8.69 +bool OrnamentedObj::isActiveFlag (const QString &name)
8.70 {
8.71 - if (standardFlags->isActive (fname) ) return true;
8.72 + if (standardFlags->isActive (name) ) return true;
8.73 return false;
8.74 }
8.75
9.1 --- a/ornamentedobj.h Wed May 06 11:08:38 2009 +0000
9.2 +++ b/ornamentedobj.h Thu May 07 08:48:53 2009 +0000
9.3 @@ -63,10 +63,10 @@
9.4 virtual QList <Attribute> getAttributes ();
9.5
9.6 virtual void clearStandardFlags();
9.7 - virtual void toggleStandardFlag(QString, bool exclusive=false);
9.8 - virtual void activateStandardFlag(QString);
9.9 - virtual void deactivateStandardFlag(QString);
9.10 - virtual bool isSetStandardFlag(QString);
9.11 + virtual void toggleStandardFlag(const QString &name);
9.12 + virtual void activateStandardFlag(const QString &name);
9.13 + virtual void deactivateStandardFlag(const QString &name);
9.14 + virtual bool isSetStandardFlag(const QString &name);
9.15 virtual QString getSystemFlagName (const QPointF &p);
9.16 virtual bool isActiveFlag(const QString&); // check if flag is set
9.17 virtual void updateSystemFlags();
10.1 --- a/treeitem.cpp Wed May 06 11:08:38 2009 +0000
10.2 +++ b/treeitem.cpp Thu May 07 08:48:53 2009 +0000
10.3 @@ -218,6 +218,35 @@
10.4 default: return -1;
10.5 }
10.6 }
10.7 +void TreeItem::setType(const Type t)
10.8 +{
10.9 + type=t;
10.10 + itemData[1]=getTypeName();
10.11 +}
10.12 +
10.13 +TreeItem::Type TreeItem::getType()
10.14 +{
10.15 + return type;
10.16 +}
10.17 +
10.18 +bool TreeItem::isBranchLikeType() const
10.19 +{
10.20 + if (type==Branch ||type==MapCenter) return true;
10.21 + return false;
10.22 +}
10.23 +
10.24 +QString TreeItem::getTypeName()
10.25 +{
10.26 + switch (type)
10.27 + {
10.28 + case Undefined: return QString ("Undefined");
10.29 + case MapCenter: return QString ("MapCenter");
10.30 + case Branch: return QString ("Branch");
10.31 + case Image: return QString ("Image");
10.32 + default: return QString ("TreeItem::getTypeName no typename defined?!");
10.33 + }
10.34 +}
10.35 +
10.36
10.37 QVariant TreeItem::data(int column) const
10.38 {
10.39 @@ -290,33 +319,35 @@
10.40 return note.getNoteOpenDoc();
10.41 }
10.42
10.43 -void TreeItem::setType(const Type t)
10.44 +void TreeItem::activateStandardFlag (const QString &name)
10.45 {
10.46 - type=t;
10.47 - itemData[1]=getTypeName();
10.48 + cout << "TI::activateStandardFlag "<<name.toStdString()<<" for item "<<getHeadingStd()<<endl;
10.49 + cout << " lmo="<<lmo<< " "<<isBranchLikeType()<<endl;
10.50 + standardFlags.activate (name);
10.51 + if (lmo &&isBranchLikeType() )
10.52 + ((BranchObj*)lmo)->activateStandardFlag (name);
10.53 }
10.54
10.55 -TreeItem::Type TreeItem::getType()
10.56 +void TreeItem::deactivateStandardFlag (const QString &name)
10.57 {
10.58 - return type;
10.59 + cout << "TI::deactivateStandardFlag "<<name.toStdString()<<" for item "<<getHeadingStd()<<endl;
10.60 + standardFlags.deactivate (name);
10.61 + if (lmo &&isBranchLikeType() )
10.62 + ((BranchObj*)lmo)->deactivateStandardFlag (name);
10.63 }
10.64
10.65 -bool TreeItem::isBranchLikeType() const
10.66 +void TreeItem::toggleStandardFlag(const QString &name)
10.67 {
10.68 - if (type==Branch ||type==MapCenter) return true;
10.69 - return false;
10.70 + cout << "TI::toggleStandardFlag "<<name.toStdString()<<" for item "<<getHeadingStd()<<endl;
10.71 + if (standardFlags.isActive (name))
10.72 + deactivateStandardFlag (name);
10.73 + else
10.74 + activateStandardFlag (name);
10.75 }
10.76
10.77 -QString TreeItem::getTypeName()
10.78 +bool TreeItem::isActiveStandardFlag (const QString &name)
10.79 {
10.80 - switch (type)
10.81 - {
10.82 - case Undefined: return QString ("Undefined");
10.83 - case MapCenter: return QString ("MapCenter");
10.84 - case Branch: return QString ("Branch");
10.85 - case Image: return QString ("Image");
10.86 - default: return QString ("TreeItem::getTypeName no typename defined?!");
10.87 - }
10.88 + return standardFlags.isActive (name);
10.89 }
10.90
10.91 void TreeItem::setID (const QString &s)
11.1 --- a/treeitem.h Wed May 06 11:08:38 2009 +0000
11.2 +++ b/treeitem.h Thu May 07 08:48:53 2009 +0000
11.3 @@ -5,6 +5,7 @@
11.4 #include <QList>
11.5 #include <QVariant>
11.6
11.7 +#include "flagrow.h"
11.8 #include "mapitem.h"
11.9 #include "noteobj.h"
11.10 #include "xmlobj.h"
11.11 @@ -53,7 +54,15 @@
11.12 virtual int num(); //! Return number of item by type
11.13 virtual int num (TreeItem *item); //! Return number of item by type
11.14
11.15 - // Accessing data
11.16 +protected:
11.17 + Type type;
11.18 +public:
11.19 + virtual void setType (const Type t);
11.20 + virtual Type getType ();
11.21 + virtual bool isBranchLikeType() const;
11.22 + virtual QString getTypeName ();
11.23 +
11.24 +// Accessing data
11.25 virtual QVariant data(int column) const;
11.26
11.27 protected:
11.28 @@ -77,12 +86,14 @@
11.29 virtual QString getNoteOpenDoc(); // returns note (OpenDoc)
11.30
11.31 protected:
11.32 - Type type;
11.33 + FlagRow standardFlags;
11.34 public:
11.35 - virtual void setType (const Type t);
11.36 - virtual Type getType ();
11.37 - virtual bool isBranchLikeType() const;
11.38 - virtual QString getTypeName ();
11.39 + virtual void activateStandardFlag(const QString &flag);
11.40 + virtual void deactivateStandardFlag(const QString &flag);
11.41 + virtual void toggleStandardFlag(const QString &flag);
11.42 + virtual bool isActiveStandardFlag (const QString &flag);
11.43 +
11.44 +
11.45
11.46 protected:
11.47 QString objID; //! id set during load/save currently used for xLinks
12.1 --- a/vym.pro Wed May 06 11:08:38 2009 +0000
12.2 +++ b/vym.pro Thu May 07 08:48:53 2009 +0000
12.3 @@ -44,6 +44,7 @@
12.4 findwindow.h \
12.5 flagobj.h \
12.6 flagrowobj.h \
12.7 + flagrow.h \
12.8 floatimageobj.h \
12.9 floatobj.h \
12.10 frameobj.h \
12.11 @@ -102,6 +103,7 @@
12.12 file.cpp \
12.13 findwindow.cpp \
12.14 flagobj.cpp \
12.15 + flagrow.cpp \
12.16 flagrowobj.cpp \
12.17 floatimageobj.cpp \
12.18 floatobj.cpp \
13.1 --- a/vymmodel.cpp Wed May 06 11:08:38 2009 +0000
13.2 +++ b/vymmodel.cpp Thu May 07 08:48:53 2009 +0000
13.3 @@ -2140,7 +2140,6 @@
13.4 parbi=selbi;
13.5 parix=index(parbi);
13.6 n=parbi->childCount();
13.7 - cout <<"n="<<n<<endl;
13.8 beginInsertRows (parix,n,n+1);
13.9 parbi->appendChild (newbi);
13.10 endInsertRows ();
13.11 @@ -2474,6 +2473,34 @@
13.12 emit (expandAll() );
13.13 }
13.14
13.15 +void VymModel::toggleStandardFlag (const QString &name)
13.16 +{
13.17 + cout << "VM::toggleStandardFlag "<<name.toStdString()<<endl;
13.18 + BranchItem *bi=getSelectedBranchItem();
13.19 + if (bi)
13.20 + {
13.21 + QString u,r;
13.22 + if (bi->isActiveStandardFlag(name))
13.23 + {
13.24 + r="unsetFlag";
13.25 + u="setFlag";
13.26 + }
13.27 + else
13.28 + {
13.29 + u="unsetFlag";
13.30 + r="setFlag";
13.31 + }
13.32 + saveState(
13.33 + bi,
13.34 + QString("%1 (\"%2\")").arg(u).arg(name),
13.35 + bi,
13.36 + QString("%1 (\"%2\")").arg(r).arg(name),
13.37 + QString("Toggling standard flag \"%1\" of %2").arg(name).arg(getObjectName(bi)));
13.38 + bi->toggleStandardFlag (name); //FIXME-0,mainWindow->useFlagGroups());
13.39 + //FIXME-0 model->updateSelection(); // geometry has changed
13.40 + }
13.41 +}
13.42 +
13.43 void VymModel::addFloatImage (const QPixmap &img) //FIXME-2
13.44 {
13.45 /*
13.46 @@ -4858,7 +4885,6 @@
13.47 // left of center
13.48 if (type == TreeItem::Branch )
13.49 {
13.50 - cout << "VM::selLeft\n";
13.51 selectLastSelectedBranch();
13.52 return;
13.53 }
13.54 @@ -4899,7 +4925,6 @@
13.55 if (type == TreeItem::Branch ||
13.56 type == TreeItem::Image)
13.57 {
13.58 - cout << "VM::selRight\n";
13.59 QModelIndex ix=index(selbi->parent());
13.60 selModel->select (ix,QItemSelectionModel::ClearAndSelect );
13.61 }
14.1 --- a/vymmodel.h Wed May 06 11:08:38 2009 +0000
14.2 +++ b/vymmodel.h Thu May 07 08:48:53 2009 +0000
14.3 @@ -328,12 +328,12 @@
14.4 public:
14.5 void toggleScroll();
14.6 void unscrollChildren();
14.7 -
14.8 void emitExpandAll();
14.9 signals:
14.10 void expandAll();
14.11
14.12 public:
14.13 + void toggleStandardFlag (const QString &name);
14.14 void addFloatImage(const QPixmap &img);
14.15
14.16 void colorBranch(QColor);
15.1 --- a/xml-vym.cpp Wed May 06 11:08:38 2009 +0000
15.2 +++ b/xml-vym.cpp Thu May 07 08:48:53 2009 +0000
15.3 @@ -326,7 +326,7 @@
15.4 break;
15.5 case StateBranch: break;
15.6 case StateStandardFlag:
15.7 - //FIXME-2 lastBranchItem->activateStandardFlag(ch_simplified);
15.8 + lastBranchItem->activateStandardFlag(ch_simplified);
15.9 break;
15.10 case StateFloatImage: break;
15.11 case StateHtmlNote: break;