1.1 --- a/branchitem.cpp Tue Dec 15 09:14:59 2009 +0000
1.2 +++ b/branchitem.cpp Mon Jan 04 20:36:06 2010 +0000
1.3 @@ -178,7 +178,12 @@
1.4 {
1.5 // Needed to hide relinked branch, if parent is scrolled
1.6 if (lmo)
1.7 - lmo->setVisibility(!((BranchItem*)parentItem)->isScrolled());
1.8 + {
1.9 + if (hasScrolledParent(this) || hidden)
1.10 + lmo->setVisibility (false);
1.11 + else
1.12 + lmo->setVisibility (true);
1.13 + }
1.14 }
1.15
1.16 void BranchItem::setHeadingColor (QColor color)
2.1 --- a/branchobj.cpp Tue Dec 15 09:14:59 2009 +0000
2.2 +++ b/branchobj.cpp Mon Jan 04 20:36:06 2010 +0000
2.3 @@ -26,22 +26,6 @@
2.4 init();
2.5 }
2.6
2.7 -/*
2.8 -BranchObj::BranchObj (QGraphicsScene* s, LinkableMapObj* p):OrnamentedObj (s)// FIXME-3 needed at all?
2.9 -{
2.10 -// cout << "Const BranchObj (s,p)\n";
2.11 - scene=s;
2.12 - setParObj (p);
2.13 - if (treeItem->depth()==1) // FIXME-3 needed to recursively calc depth?
2.14 - // Calc angle to mapCenter if I am a mainbranch
2.15 - // needed for reordering the mainbranches clockwise
2.16 - // around mapcenter
2.17 - angle=getAngle (QPointF (x() - parObj->getChildPos().x() ,
2.18 - (y() - parObj->getChildPos().y() ) ) );
2.19 - init();
2.20 -}
2.21 -*/
2.22 -
2.23 BranchObj::~BranchObj ()
2.24 {
2.25 // cout << "Destr BranchObj of "<<this<<" ("<<treeItem->getHeading().toStdString()<<")"<<endl;
2.26 @@ -95,7 +79,7 @@
2.27 delete xlink.takeFirst();
2.28 }
2.29
2.30 -void BranchObj::setParObjTmp(LinkableMapObj* dst, QPointF m, int off) //FIXME-1 when moving a mainbranch to a branch it still has relPos, not moved as child
2.31 +void BranchObj::setParObjTmp(LinkableMapObj* dst, QPointF m, int off)
2.32 {
2.33 // Temporary link to dst
2.34 // m is position of mouse pointer
2.35 @@ -452,7 +436,7 @@
2.36 changed=true;
2.37 }
2.38 }
2.39 - updateContentSize();
2.40 + if (changed) updateContentSize();
2.41 }
2.42
2.43 void BranchObj::setDefAttr (BranchModification mod)
2.44 @@ -628,12 +612,13 @@
2.45 }
2.46
2.47
2.48 -QRectF BranchObj::getTotalBBox()
2.49 +QRectF BranchObj::getTotalBBox() // FIXME-2 not really needed, get rid of this
2.50 {
2.51 QRectF r=bbox;
2.52
2.53 if ( ((BranchItem*)treeItem)->isScrolled() ) return r;
2.54
2.55 +/* FIXME-2 really include children _here_ ? likely not needed anymore, but done in TreeItem */
2.56 for (int i=0; i<treeItem->branchCount(); ++i)
2.57 if (!treeItem->getBranchNum(i)->isHidden())
2.58 r=addBBox(treeItem->getBranchObjNum(i)->getTotalBBox(),r);
2.59 @@ -643,9 +628,11 @@
2.60 (have been NULL at least in calcBBoxSizeWithChilds...)
2.61 */
2.62
2.63 - for (int i=0; i<treeItem->imageCount(); ++i)
2.64 +/* FIXME-2 in
2.65 + for (int i=0; i<treeItem->imageCount(); ++i
2.66 if (!treeItem->isHidden())
2.67 r=addBBox(treeItem->getImageObjNum(i)->getTotalBBox(),r);
2.68 +*/
2.69 return r;
2.70 }
2.71
2.72 @@ -672,7 +659,7 @@
2.73 return MapObj::getBoundingPolygon();
2.74 }
2.75
2.76 - calcBBoxSizeWithChildren(); //FIXME-3 really needed?
2.77 + calcBBoxSizeWithChildren(); //FIXME-2 really needed?
2.78 QPolygonF p;
2.79 p<<bboxTotal.topLeft();
2.80 p<<bboxTotal.topRight();
2.81 @@ -749,15 +736,6 @@
2.82 bboxTotal.setHeight(max (r.height(), bbox.height()));
2.83 }
2.84
2.85 -QString BranchObj::getSelectString()
2.86 -{
2.87 - VymModel *model=treeItem->getModel();
2.88 - if (model)
2.89 - return model->getSelectString (this);
2.90 - else
2.91 - return QString();
2.92 -}
2.93 -
2.94 void BranchObj::setAnimation(const AnimPoint &ap)
2.95 {
2.96 anim=ap;
3.1 --- a/branchobj.h Tue Dec 15 09:14:59 2009 +0000
3.2 +++ b/branchobj.h Mon Jan 04 20:36:06 2010 +0000
3.3 @@ -51,7 +51,6 @@
3.4 virtual ConvexPolygon getBoundingPolygon();
3.5 virtual void calcBBoxSizeWithChildren(); // calc size of BBox including children recursivly
3.6
3.7 - virtual QString getSelectString();
3.8 virtual void setAnimation(const AnimPoint &ap);
3.9 virtual bool animate();
3.10
4.1 Binary file demos/vym-projectplan.vym has changed
5.1 --- a/exports.cpp Tue Dec 15 09:14:59 2009 +0000
5.2 +++ b/exports.cpp Mon Jan 04 20:36:06 2010 +0000
5.3 @@ -14,6 +14,23 @@
5.4
5.5 ExportBase::ExportBase()
5.6 {
5.7 + init();
5.8 +}
5.9 +
5.10 +ExportBase::ExportBase(VymModel *m)
5.11 +{
5.12 + init();
5.13 + model=m;
5.14 +}
5.15 +
5.16 +ExportBase::~ExportBase()
5.17 +{
5.18 + // Cleanup tmpdir
5.19 + removeDir (tmpDir);
5.20 +}
5.21 +
5.22 +void ExportBase::init()
5.23 +{
5.24 indentPerDepth=" ";
5.25 bool ok;
5.26 tmpDir.setPath (makeTmpDir(ok,"vym-export"));
5.27 @@ -23,12 +40,6 @@
5.28 cancelFlag=false;
5.29 }
5.30
5.31 -ExportBase::~ExportBase()
5.32 -{
5.33 - // Cleanup tmpdir
5.34 - removeDir (tmpDir);
5.35 -}
5.36 -
5.37 void ExportBase::setDir(const QDir &d)
5.38 {
5.39 outDir=d;
5.40 @@ -262,7 +273,7 @@
5.41 {
5.42 // Make indentstring
5.43 curIndent="";
5.44 - for (i=0;i<cur->depth()-1;i++) curIndent+= indentPerDepth;
5.45 + for (i=1;i<cur->depth()-1;i++) curIndent+= indentPerDepth;
5.46
5.47 if (!cur->hasHiddenExportParent() )
5.48 {
5.49 @@ -460,6 +471,176 @@
5.50 }
5.51
5.52 ////////////////////////////////////////////////////////////////////////
5.53 +ExportHTML::ExportHTML():ExportBase()
5.54 +{
5.55 + init();
5.56 +}
5.57 +
5.58 +ExportHTML::ExportHTML(VymModel *m):ExportBase(m)
5.59 +{
5.60 + init();
5.61 +}
5.62 +
5.63 +void ExportHTML::init()
5.64 +{
5.65 + singularDelimiter=": ";
5.66 + noSingulars=true;
5.67 + frameURLs=true;
5.68 + useMapColors=true;
5.69 +
5.70 + if (model &&model->getMapEditor())
5.71 + offset=model->getMapEditor()->getTotalBBox().topLeft();
5.72 +}
5.73 +
5.74 +QString ExportHTML::getBranchText(BranchItem *current)
5.75 +{
5.76 + if (current)
5.77 + {
5.78 + bool vis=false;
5.79 + QRectF hr;
5.80 + LinkableMapObj *lmo=current->getLMO();
5.81 + if (lmo)
5.82 + {
5.83 + hr=((BranchObj*)lmo)->getBBoxHeading();
5.84 + if (lmo->isVisibleObj()) vis=true;
5.85 + }
5.86 + QString col;
5.87 + QString id=model->getSelectString(current);
5.88 + if (useMapColors)
5.89 + col=QString("style='color:%1'").arg(current->getHeadingColor().name());
5.90 + QString s=QString("<span class='vym-branch%1' %2 id='%3'>")
5.91 + .arg(current->depth())
5.92 + .arg(col)
5.93 + .arg(id);
5.94 + QString url=current->getURL();
5.95 + if (!url.isEmpty())
5.96 + {
5.97 + s+=QString ("<a href=\"%1\">").arg(url);
5.98 + s+=QString ("<img src=\"flags/flag-url-16x16.png\">%1</a>").arg(quotemeta(current->getHeading()));
5.99 + s+="</a>";
5.100 +
5.101 + QRectF fbox=current->getBBoxFlag ("system-url");
5.102 + if (vis)
5.103 + imageMap+=QString(" <area shape='rect' coords='%1,%2,%3,%4' href='%5'>\n")
5.104 + .arg(fbox.left()-offset.x())
5.105 + .arg(fbox.top()-offset.y())
5.106 + .arg(fbox.right()-offset.x())
5.107 + .arg(fbox.bottom()-offset.y())
5.108 + .arg(url);
5.109 + } else
5.110 + s+=quotemeta(current->getHeading());
5.111 + s+="</span>";
5.112 +
5.113 + if (vis)
5.114 + imageMap+=QString(" <area shape='rect' coords='%1,%2,%3,%4' href='#%5'>\n")
5.115 + .arg(hr.left()-offset.x())
5.116 + .arg(hr.top()-offset.y())
5.117 + .arg(hr.right()-offset.x())
5.118 + .arg(hr.bottom()-offset.y())
5.119 + .arg(id);
5.120 +
5.121 + // Include note
5.122 + if (!current->getNoteObj().isEmpty())
5.123 + s+="<table border=1><tr><td>"+current->getNote()+"</td></tr></table>";
5.124 +
5.125 + return s;
5.126 + }
5.127 + return QString();
5.128 +}
5.129 +
5.130 +QString ExportHTML::buildList (BranchItem *current)
5.131 +{
5.132 + QString r;
5.133 +
5.134 + uint i=0;
5.135 + BranchItem *bi=current->getFirstBranch();
5.136 +
5.137 + // Only add itemized list, if we have more than one subitem.
5.138 + // For only one subitem, just add a separator to keep page more compact
5.139 + bool noSingularsHere=false;
5.140 + if (current->branchCount()<2 && noSingulars) noSingularsHere=true;
5.141 +
5.142 + if (bi)
5.143 + {
5.144 + if (!noSingularsHere)
5.145 + r+="<ul>\n";
5.146 + else
5.147 + r+=singularDelimiter;
5.148 +
5.149 + while (bi)
5.150 + {
5.151 + if (!bi->hasHiddenExportParent() )
5.152 + {
5.153 + if (!noSingularsHere) r+="<li>";
5.154 + r+=getBranchText (bi);
5.155 + if (!bi->getURL().isEmpty() && frameURLs && noSingularsHere)
5.156 + // Add frame, if we have subitems to an URL
5.157 + r+="<table border=1><tr><td>"+buildList (bi)+"</td></tr></table>"; // recursivly add deeper branches
5.158 + else
5.159 + r+=buildList (bi); // recursivly add deeper branches
5.160 + if (!noSingularsHere) r+="</li>";
5.161 + r+="\n";
5.162 + }
5.163 + i++;
5.164 + bi=current->getBranchNum(i);
5.165 + }
5.166 +
5.167 + if (!noSingularsHere) r+="</ul>\n";
5.168 + }
5.169 + return r;
5.170 +}
5.171 +
5.172 +void ExportHTML::doExport()
5.173 +{
5.174 + QFile file (outputFile);
5.175 + if ( !file.open( QIODevice::WriteOnly ) )
5.176 + {
5.177 + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not write %1").arg(outputFile));
5.178 + mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
5.179 + return;
5.180 + }
5.181 + QTextStream ts( &file ); // use LANG decoding here...
5.182 + ts.setEncoding (QTextStream::UnicodeUTF8); // Force UTF8
5.183 +
5.184 + // Write header
5.185 + ts<<"<html><title>"+model->getMapName()<<"</title><body>";
5.186 + ts<<" <link rel='stylesheet' id='css.stylesheet' href='vym.css' />\n";
5.187 +
5.188 + // Include image
5.189 + ts<<"<center><img src=\"xxx.png\" usemap='#imagemap'></center>\n";
5.190 +
5.191 +
5.192 + // Main loop over all mapcenters
5.193 + QString s;
5.194 + TreeItem *rootItem=model->getRootItem();
5.195 + BranchItem *bi;
5.196 + for (int i=0; i<rootItem->branchCount(); i++)
5.197 + {
5.198 + bi=rootItem->getBranchNum(i);
5.199 + if (!bi->hasHiddenExportParent())
5.200 + {
5.201 + ts<<getBranchText (bi);
5.202 + ts<<buildList (bi);
5.203 + }
5.204 + }
5.205 +
5.206 + // Imagemap
5.207 + ts<<"<map name='imagemap'>\n"+imageMap+"</map>\n";
5.208 +
5.209 + // Write footer
5.210 + ts<<"<hr/>\n";
5.211 + ts<<"<table class=\"vym-footer\"> \n\
5.212 + <tr> \n\
5.213 + <td class=\"vym-footerL\">"+model->getFileName()+"</td> \n\
5.214 + <td class=\"vym-footerC\">"+model->getDate()+"</td> \n\
5.215 + <td class=\"vym-footerR\"> vym "+model->getVersion()+"</td> \n\
5.216 + </tr> \n \
5.217 + </table>\n";
5.218 + ts<<"</body></html>";
5.219 + file.close();
5.220 +}
5.221 +
5.222 +////////////////////////////////////////////////////////////////////////
5.223 void ExportTaskjuggler::doExport()
5.224 {
5.225 model->exportXML(tmpDir.path(),false);
5.226 @@ -550,11 +731,11 @@
5.227 BranchItem *bi=current->getFirstBranch();
5.228 if (bi)
5.229 {
5.230 - if (!bi->hasHiddenExportParent() ) // FIXME-3 use BranchItem...
5.231 + // Start list
5.232 + r+="<text:list text:style-name=\"vym-list\">\n";
5.233 + while (bi)
5.234 {
5.235 - // Start list
5.236 - r+="<text:list text:style-name=\"vym-list\">\n";
5.237 - while (bi)
5.238 + if (!bi->hasHiddenExportParent() )
5.239 {
5.240 r+="<text:list-item><text:p >";
5.241 r+=quotemeta(bi->getHeading());
5.242 @@ -564,11 +745,11 @@
5.243 r+="</text:p>";
5.244 r+=buildList (bi); // recursivly add deeper branches
5.245 r+="</text:list-item>\n";
5.246 - i++;
5.247 - bi=current->getBranchNum(i);
5.248 }
5.249 - r+="</text:list>\n";
5.250 + i++;
5.251 + bi=current->getBranchNum(i);
5.252 }
5.253 + r+="</text:list>\n";
5.254 }
5.255 return r;
5.256 }
6.1 --- a/exports.h Tue Dec 15 09:14:59 2009 +0000
6.2 +++ b/exports.h Mon Jan 04 20:36:06 2010 +0000
6.3 @@ -18,7 +18,9 @@
6.4 {
6.5 public:
6.6 ExportBase();
6.7 + ExportBase(VymModel *m);
6.8 virtual ~ExportBase();
6.9 + virtual void init();
6.10 virtual void setDir(const QDir&);
6.11 virtual void setFile(const QString &);
6.12 virtual QString getFile ();
6.13 @@ -92,6 +94,27 @@
6.14 };
6.15
6.16 ///////////////////////////////////////////////////////////////////////
6.17 +class ExportHTML:public ExportBase
6.18 +{
6.19 +public:
6.20 + ExportHTML();
6.21 + ExportHTML(VymModel *m);
6.22 + virtual void init();
6.23 + virtual void doExport();
6.24 +private:
6.25 + QString getBranchText(BranchItem *);
6.26 + QString buildList (BranchItem *);
6.27 + QString imageMap;
6.28 +
6.29 + bool frameURLs;
6.30 + bool noSingulars;
6.31 + QString singularDelimiter;
6.32 + bool useMapColors;
6.33 +
6.34 + QPointF offset;
6.35 +};
6.36 +
6.37 +///////////////////////////////////////////////////////////////////////
6.38 class ExportTaskjuggler:public ExportXMLBase
6.39 {
6.40 public:
7.1 --- a/flagrowobj.h Tue Dec 15 09:14:59 2009 +0000
7.2 +++ b/flagrowobj.h Mon Jan 04 20:36:06 2010 +0000
7.3 @@ -32,8 +32,8 @@
7.4 void activate (Flag *flag);
7.5 void deactivate(const QString&);
7.6 void setShowFlags (bool);
7.7 + FlagObj* findFlag (const QString&);
7.8 private:
7.9 - FlagObj* findFlag (const QString&);
7.10 QList <FlagObj*> flag;
7.11 bool showFlags; // FloatObjects want to hide their flags
7.12 };
8.1 --- a/mainwindow.cpp Tue Dec 15 09:14:59 2009 +0000
8.2 +++ b/mainwindow.cpp Mon Jan 04 20:36:06 2010 +0000
8.3 @@ -411,9 +411,15 @@
8.4 connect( a, SIGNAL( triggered() ), this, SLOT( fileExportOOPresentation() ) );
8.5 fileExportMenu->addAction (a);
8.6
8.7 - a = new QAction( "Webpage (XHTML)...",this );
8.8 - a->setShortcut (Qt::ALT + Qt::Key_X); //Export XHTML
8.9 + a = new QAction( "Webpage (HTML)...",this );
8.10 + a->setShortcut (Qt::ALT + Qt::Key_X); //Export HTML
8.11 a->setStatusTip ( tr( "Export as %1","status tip file menu").arg(tr(" webpage (XHTML)","status tip file menu")));
8.12 + connect( a, SIGNAL( triggered() ), this, SLOT( fileExportHTML() ) );
8.13 + fileExportMenu->addAction (a);
8.14 +
8.15 + a = new QAction( "Webpage (XHTML)...",this ); //Export XHTML
8.16 +
8.17 + //a->setShortcut (Qt::ALT + Qt::SHIFT + Qt::Key_X); a->setStatusTip ( tr( "Export as %1","status tip file menu").arg(tr(" webpage (XHTML)","status tip file menu")));
8.18 connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXHTML() ) );
8.19 fileExportMenu->addAction (a);
8.20
8.21 @@ -1040,7 +1046,7 @@
8.22 tb->setObjectName ("viewTB");
8.23 QMenu *viewMenu = menuBar()->addMenu ( tr( "&View" ));
8.24
8.25 - Switchboard switchboard; //FIXME-1 testing...
8.26 + Switchboard switchboard; //FIXME-2 testing...
8.27
8.28 QAction *a;
8.29 a = new QAction(QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom","View action" ), this);
8.30 @@ -2218,6 +2224,12 @@
8.31 if (m) m->exportXML();
8.32 }
8.33
8.34 +void Main::fileExportHTML()
8.35 +{
8.36 + VymModel *m=currentModel();
8.37 + if (m) m->exportHTML();
8.38 +}
8.39 +
8.40
8.41 void Main::fileExportXHTML()
8.42 {
8.43 @@ -2833,7 +2845,11 @@
8.44 void Main::editAddAttribute()
8.45 {
8.46 VymModel *m=currentModel();
8.47 - if (m) m->addAttribute();
8.48 + if (m)
8.49 + {
8.50 +
8.51 + m->addAttribute();
8.52 + }
8.53 }
8.54
8.55 void Main::editAddMapCenter()
9.1 --- a/mainwindow.h Tue Dec 15 09:14:59 2009 +0000
9.2 +++ b/mainwindow.h Mon Jan 04 20:36:06 2010 +0000
9.3 @@ -94,6 +94,7 @@
9.4 void fileImportMM();
9.5 void fileImportDir();
9.6 void fileExportXML();
9.7 + void fileExportHTML();
9.8 void fileExportXHTML();
9.9 void fileExportImage();
9.10 void fileExportAO();
10.1 --- a/mapeditor.cpp Tue Dec 15 09:14:59 2009 +0000
10.2 +++ b/mapeditor.cpp Mon Jan 04 20:36:06 2010 +0000
10.3 @@ -113,10 +113,7 @@
10.4
10.5 // Action to embed LineEdit for heading in Scene
10.6 editingHeading=false;
10.7 - lineEdit=new QLineEdit;
10.8 - lineEdit->hide();
10.9 - QGraphicsProxyWidget *pw=scene()->addWidget (lineEdit);
10.10 - pw->setZValue (Z_LINEEDIT);
10.11 + lineEdit=NULL;
10.12
10.13 a = new QAction( tr( "Edit heading","MapEditor" ), this);
10.14 a->setShortcut ( Qt::Key_Return ); //Edit heading
10.15 @@ -405,35 +402,55 @@
10.16
10.17 QRectF MapEditor::getTotalBBox()
10.18 {
10.19 - QRectF r;
10.20 + QPen pen;
10.21 + pen.setWidth (1);
10.22 + pen.setCapStyle ( Qt::RoundCap );
10.23 +
10.24 + QRectF rt;
10.25 BranchObj *bo;
10.26 - for (int i=0;i<model->getRootItem()->branchCount(); i++)
10.27 + BranchItem *cur=NULL;
10.28 + BranchItem *prev=NULL;
10.29 + model->nextBranch(cur,prev);
10.30 + while (cur)
10.31 {
10.32 - bo=(BranchObj*)(model->getRootItem()->getBranchNum(i)->getLMO());
10.33 - if (bo) r=addBBox (bo->getTotalBBox(), r);
10.34 + if (!cur->hasHiddenExportParent())
10.35 + {
10.36 + bo=(BranchObj*)(cur->getLMO());
10.37 + if (bo && bo->isVisibleObj())
10.38 + {
10.39 + bo->calcBBoxSizeWithChildren();
10.40 + // FIXME-3 testing
10.41 + //QRectF r1=bo->getBBoxSizeWithChildren();
10.42 + QRectF r1=bo->getBBox();
10.43 + //pen.setColor ( QColor(qrand()%32*8,qrand()%32*8,qrand()%32*8));
10.44 + //mapScene->addRect (r1,pen);
10.45 +
10.46 + if (rt.isNull()) rt=r1;
10.47 + rt=addBBox (r1, rt);
10.48 + //FIXME-2 cout <<"ME: r1="<<r1<<" "<<cur->getHeadingStd()<<endl;
10.49 + //cout <<" rt="<<rt<<endl;
10.50 + }
10.51 + }
10.52 + model->nextBranch(cur,prev);
10.53 }
10.54 - return r;
10.55 + return rt;
10.56 }
10.57
10.58
10.59 -QPixmap MapEditor::getPixmap()
10.60 +QImage MapEditor::getImage()
10.61 {
10.62 QRectF mapRect=getTotalBBox();
10.63 - QPixmap pix((int)mapRect.width()+2,(int)mapRect.height()+2);
10.64 + int w=mapRect.width()+2;
10.65 + int h=mapRect.height()+2;
10.66 +
10.67 + QImage pix (w,h,QImage::Format_RGB32);
10.68 +
10.69 QPainter pp (&pix);
10.70 -
10.71 +
10.72 pp.setRenderHints(renderHints());
10.73 -
10.74 - // Don't print the visualisation of selection
10.75 - model->unselect();
10.76 -
10.77 mapScene->render ( &pp,
10.78 - QRectF(0,0,mapRect.width()+2,mapRect.height()+2),
10.79 + QRectF(0,0,w,h),
10.80 QRectF(mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height() ));
10.81 -
10.82 - // Restore selection
10.83 - model->reselect();
10.84 -
10.85 return pix;
10.86 }
10.87
10.88 @@ -448,6 +465,42 @@
10.89 setRenderHint(QPainter::SmoothPixmapTransform,b);
10.90 }
10.91
10.92 +void MapEditor::setHideTmp (bool b) // FIXME-4 better use signals
10.93 +{
10.94 +/*
10.95 + if (b)
10.96 + {
10.97 + setHideTmpMode (HideExport);
10.98 + mapCenter->calcBBoxSizeWithChilds();
10.99 + QRectF totalBBox=mapCenter->getTotalBBox();
10.100 + //QRectF mapRect=totalBBox;
10.101 + cout << " map has =("<<totalBBox.x()<<","<<totalBBox.y()<<","<<totalBBox.width()<<","<<totalBBox.height()<<")\n";
10.102 +
10.103 + mapRect.setRect (totalBBox.x(), totalBBox.y(),
10.104 + totalBBox.width(), totalBBox.height());
10.105 +
10.106 + QCanvasRectangle *frame=new QCanvasRectangle (mapRect,mapScene);
10.107 + frame->setBrush (QColor(white));
10.108 + frame->setPen (QColor(black));
10.109 + frame->setZValue(0);
10.110 + frame->show();
10.111 +
10.112 + }
10.113 + else
10.114 + {
10.115 + setHideTmpMode (HideNone);
10.116 + }
10.117 + cout <<" hidemode="<<hidemode<<endl;
10.118 +*/
10.119 +/*
10.120 + // Toggle hidemode
10.121 + if (hidemode==HideExport)
10.122 + setHideTmpMode (HideNone);
10.123 + else
10.124 + setHideTmpMode (HideExport);
10.125 +*/
10.126 +}
10.127 +
10.128 TreeItem* MapEditor::findMapItem (QPointF p,TreeItem *exclude)
10.129 {
10.130 // Start with mapcenter, no images allowed at rootItem
10.131 @@ -472,9 +525,7 @@
10.132 void MapEditor::testFunction1()
10.133 {
10.134 cout << "ME::test1 selected TI="<<model->getSelectedItem()<<endl;
10.135 -
10.136 - for (int i=0; i<200;i++)
10.137 - model->addNewBranch();
10.138 + model->setExportMode (true);
10.139
10.140 /*
10.141 // Code copied from Qt sources
10.142 @@ -543,44 +594,13 @@
10.143 animation->start();
10.144 */
10.145
10.146 -/* FIXME-4 Hide hidden stuff temporary, maybe add this as regular function somewhere
10.147 - if (hidemode==HideNone)
10.148 - {
10.149 - setHideTmpMode (HideExport);
10.150 - mapCenter->calcBBoxSizeWithChilds();
10.151 - QRectF totalBBox=mapCenter->getTotalBBox();
10.152 - QRectF mapRect=totalBBox;
10.153 - QCanvasRectangle *frame=NULL;
10.154 -
10.155 - cout << " map has =("<<totalBBox.x()<<","<<totalBBox.y()<<","<<totalBBox.width()<<","<<totalBBox.height()<<")\n";
10.156 -
10.157 - mapRect.setRect (totalBBox.x(), totalBBox.y(),
10.158 - totalBBox.width(), totalBBox.height());
10.159 - frame=new QCanvasRectangle (mapRect,mapScene);
10.160 - frame->setBrush (QColor(white));
10.161 - frame->setPen (QColor(black));
10.162 - frame->setZValue(0);
10.163 - frame->show();
10.164 - }
10.165 - else
10.166 - {
10.167 - setHideTmpMode (HideNone);
10.168 - }
10.169 - cout <<" hidemode="<<hidemode<<endl;
10.170 - */
10.171 -
10.172 -/*
10.173 - // Toggle hidemode
10.174 - if (hidemode==HideExport)
10.175 - setHideTmpMode (HideNone);
10.176 - else
10.177 - setHideTmpMode (HideExport);
10.178 -*/
10.179 -
10.180 }
10.181
10.182 void MapEditor::testFunction2()
10.183 {
10.184 + model->setExportMode (false);
10.185 + return;
10.186 +
10.187 // Create list with all bounding polygons
10.188 QList <LinkableMapObj*> mapobjects;
10.189 QList <ConvexPolygon> polys;
10.190 @@ -899,6 +919,10 @@
10.191 {
10.192 model->setSelectionBlocked(true);
10.193
10.194 + lineEdit=new QLineEdit;
10.195 + QGraphicsProxyWidget *pw=scene()->addWidget (lineEdit);
10.196 + pw->setZValue (Z_LINEEDIT);
10.197 +
10.198 lineEdit->setText (bi->getHeading());
10.199 QPoint p = mapTo (this,bo->getAbsPos().toPoint() );
10.200 lineEdit->setGeometry(p.x(),p.y(),230,25);
10.201 @@ -915,9 +939,10 @@
10.202 {
10.203 editingHeading=false;
10.204 lineEdit->releaseKeyboard();
10.205 + lineEdit->clearFocus();
10.206 model->setHeading (lineEdit->text() );
10.207 model->setSelectionBlocked(false);
10.208 - lineEdit->hide();
10.209 + delete (lineEdit);
10.210
10.211 // Maybe reselect previous branch
10.212 mainWindow->editHeadingFinished (model);
10.213 @@ -1281,7 +1306,7 @@
10.214
10.215 } // depth>0
10.216 // Maybe we can relink temporary?
10.217 - if (dsti) // FIXME-1 check if dsti is ancestor of myself!
10.218 + if (dsti)
10.219 {
10.220 if (e->modifiers()==Qt::ControlModifier)
10.221 {
11.1 --- a/mapeditor.h Tue Dec 15 09:14:59 2009 +0000
11.2 +++ b/mapeditor.h Mon Jan 04 20:36:06 2010 +0000
11.3 @@ -52,9 +52,10 @@
11.4 public:
11.5 void print(); //!< Print the map
11.6 QRectF getTotalBBox(); //!< Bounding box of all items in map
11.7 - QPixmap getPixmap(); //!< Get a pixmap of the map
11.8 + QImage getImage (); //!< Get a pixmap of the map
11.9 void setAntiAlias (bool); //!< Set or unset antialiasing
11.10 void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps
11.11 + void setHideTmp (bool); //!< Hide parts temporary
11.12 public:
11.13 TreeItem *findMapItem (QPointF p,TreeItem *exclude); //! find item in map at position p. Ignore item exclude
11.14
12.1 --- a/mapitem.cpp Tue Dec 15 09:14:59 2009 +0000
12.2 +++ b/mapitem.cpp Mon Jan 04 20:36:06 2010 +0000
12.3 @@ -104,6 +104,14 @@
12.4 return s;
12.5 }
12.6
12.7 +QRectF MapItem::getBBoxFlag (const QString &fname)
12.8 +{
12.9 + if (lmo)
12.10 + return ((OrnamentedObj*)lmo)->getBBoxFlag (fname);
12.11 + else
12.12 + return QRectF ();
12.13 +}
12.14 +
12.15 LinkableMapObj* MapItem::getLMO()
12.16 {
12.17 return lmo;
13.1 --- a/mapitem.h Tue Dec 15 09:14:59 2009 +0000
13.2 +++ b/mapitem.h Mon Jan 04 20:36:06 2010 +0000
13.3 @@ -54,6 +54,7 @@
13.4
13.5 virtual QString getMapAttr(); //! Get attributes for saving as XML
13.6
13.7 + virtual QRectF getBBoxFlag (const QString &fname); //! get bbox of flag
13.8
13.9
13.10 protected:
14.1 --- a/misc.cpp Tue Dec 15 09:14:59 2009 +0000
14.2 +++ b/misc.cpp Mon Jan 04 20:36:06 2010 +0000
14.3 @@ -30,7 +30,7 @@
14.4
14.5 ostream &operator<< (ostream &stream, QRectF const &r)
14.6 {
14.7 - stream << "tL="<<r.topLeft()<<" - bR="<<r.bottomRight();
14.8 + stream << "tL="<<r.topLeft()<<" - (w,h)="<<r.width()<<","<<r.height()<<" bR="<<r.bottomRight();
14.9 return stream;
14.10 }
14.11
15.1 --- a/ornamentedobj.cpp Tue Dec 15 09:14:59 2009 +0000
15.2 +++ b/ornamentedobj.cpp Mon Jan 04 20:36:06 2010 +0000
15.3 @@ -71,6 +71,11 @@
15.4 return heading->getColor();
15.5 }
15.6
15.7 +QRectF OrnamentedObj::getBBoxHeading()
15.8 +{
15.9 + return heading->getBBox();
15.10 +}
15.11 +
15.12 FrameObj* OrnamentedObj::getFrame()
15.13 {
15.14 return frame;
15.15 @@ -248,13 +253,22 @@
15.16 standardFlags->deactivate(name);
15.17 calcBBoxSize();
15.18 positionBBox();
15.19 - move (absPos.x(), absPos.y() );
15.20 + move (absPos.x(),absPos.y() );
15.21 forceReposition();
15.22 }
15.23
15.24
15.25 -QString OrnamentedObj::getSystemFlagName(const QPointF &p) //FIXME-3
15.26 +QString OrnamentedObj::getSystemFlagName(const QPointF &p)
15.27 {
15.28 return systemFlags->getFlagName(p);
15.29 }
15.30
15.31 +QRectF OrnamentedObj::getBBoxFlag (const QString &s)
15.32 +{
15.33 + FlagObj *fo=systemFlags->findFlag (s);
15.34 + if (fo) return fo->getBBox();
15.35 + fo=standardFlags->findFlag (s);
15.36 + if (fo) return fo->getBBox();
15.37 + return QRectF();
15.38 +}
15.39 +
16.1 --- a/ornamentedobj.h Tue Dec 15 09:14:59 2009 +0000
16.2 +++ b/ornamentedobj.h Mon Jan 04 20:36:06 2010 +0000
16.3 @@ -30,6 +30,7 @@
16.4 virtual void setLinkColor(); // sets color according to colorhint, overloaded
16.5 virtual void setColor(QColor); // set the color of text and link
16.6 QColor getColor (); // get color of heading
16.7 + QRectF getBBoxHeading();
16.8
16.9 virtual FrameObj* getFrame();
16.10 virtual FrameObj::FrameType getFrameType ();
16.11 @@ -56,6 +57,7 @@
16.12 virtual void activateStandardFlag(Flag *flag);
16.13 virtual void deactivateStandardFlag(const QString &name);
16.14 virtual QString getSystemFlagName (const QPointF &p);
16.15 + virtual QRectF getBBoxFlag (const QString &name);
16.16
16.17 protected:
16.18 HeadingObj *heading; // Heading
17.1 --- a/tex/vym.changelog Tue Dec 15 09:14:59 2009 +0000
17.2 +++ b/tex/vym.changelog Mon Jan 04 20:36:06 2010 +0000
17.3 @@ -1,3 +1,9 @@
17.4 +-------------------------------------------------------------------
17.5 +Mon Jan 4 09:36:24 CET 2010 - vym@insilmaril.de
17.6 +
17.7 +- Bugfix: Branch didn't unscroll when deleting last child
17.8 +- Feature: URL icons in image map of HTML export work now
17.9 +
17.10 -------------------------------------------------------------------
17.11 Tue Dec 15 10:14:11 CET 2009 - vym@insilmaril.de
17.12
18.1 --- a/treeitem.cpp Tue Dec 15 09:14:59 2009 +0000
18.2 +++ b/treeitem.cpp Mon Jan 04 20:36:06 2010 +0000
18.3 @@ -625,45 +625,30 @@
18.4 }
18.5
18.6
18.7 -void TreeItem::setHideTmp (HideTmpMode mode) //FIXME-2 update visibility in derived objects...
18.8 +void TreeItem::setHideTmp (HideTmpMode mode) //FIXME-2 update visibility in derived objects
18.9 {
18.10 - /*
18.11 - if (type==Image)
18.12 - ((ImageItem*)this)->updateVisibility();
18.13 - */
18.14 + if (type==Image || type==Branch || type==MapCenter)
18.15 +// ((ImageItem*)this)->updateVisibility();
18.16 + {
18.17 + LinkableMapObj* lmo=((MapItem*)this)->getLMO();
18.18
18.19 - if (mode==HideExport && (hideExport || hasHiddenExportParent() ) )
18.20 + if (mode==HideExport && (hideExport || hasHiddenExportParent() ) ) // FIXME-2 try to avoid calling hasScrolledParent repeatedly
18.21 +
18.22 {
18.23 // Hide stuff according to hideExport flag and parents
18.24 - // if (lmo) lmo->setVisibility (false);
18.25 hidden=true;
18.26 + //if (lmo) lmo->setVisibility (false);
18.27 + updateVisibility(); // FIXME-3 missing for images
18.28 }else
18.29 {
18.30 // Do not hide, but still take care of scrolled status
18.31 hidden=false;
18.32 -/*
18.33 - XXXXXXXX treeItem should be THIS
18.34 -
18.35 - move visible to TreeItem???
18.36 -
18.37 - BranchObj now has updateContents
18.38 -*/
18.39 -/*
18.40 - if (isBranchLikeType() )
18.41 - ((BranchItem*)this)->updateVisibility();
18.42 -
18.43 - if ( ((BranchItem*)treeItem)->hasScrolledParent((BranchItem*)treeItem))
18.44 - setVisibility (false);
18.45 - else
18.46 - setVisibility (true);
18.47 -*/
18.48 - }
18.49 -
18.50 -/*
18.51 + updateVisibility();
18.52 + }
18.53 // And take care of my children
18.54 for (int i=0; i<branchCount(); ++i)
18.55 - getBranchNum(i)->setHideTmp (mode); // FIXME-4 maybe also consider images and other types
18.56 -*/
18.57 + getBranchNum(i)->setHideTmp (mode);
18.58 + }
18.59 }
18.60
18.61 bool TreeItem::hasHiddenExportParent()
18.62 @@ -682,7 +667,7 @@
18.63
18.64 void TreeItem::setHideInExport(bool b)
18.65 {
18.66 - if (type==Branch || type==Image)
18.67 + if (type==MapCenter ||type==Branch || type==Image)
18.68 {
18.69 hideExport=b;
18.70 if (b)
19.1 --- a/version.h Tue Dec 15 09:14:59 2009 +0000
19.2 +++ b/version.h Mon Jan 04 20:36:06 2010 +0000
19.3 @@ -7,7 +7,7 @@
19.4 #define __VYM_VERSION "1.13.0"
19.5 //#define __VYM_CODENAME "Codename: RC-1"
19.6 #define __VYM_CODENAME "Codename: development version, not for production!"
19.7 -#define __VYM_BUILD_DATE "2009-12-15"
19.8 +#define __VYM_BUILD_DATE "2010-01-04"
19.9
19.10
19.11 bool checkVersion(const QString &);
20.1 --- a/vymmodel.cpp Tue Dec 15 09:14:59 2009 +0000
20.2 +++ b/vymmodel.cpp Mon Jan 04 20:36:06 2010 +0000
20.3 @@ -1458,6 +1458,11 @@
20.4 version=s;
20.5 }
20.6
20.7 +QString VymModel::getVersion()
20.8 +{
20.9 + return version;
20.10 +}
20.11 +
20.12 void VymModel::setAuthor (const QString &s)
20.13 {
20.14 saveState (
20.15 @@ -1493,7 +1498,7 @@
20.16 return QDate::currentDate().toString ("yyyy-MM-dd");
20.17 }
20.18
20.19 -int VymModel::branchCount() // FIXME-4 Optimize this: use internal counter instead of going through whole map each time...
20.20 +int VymModel::branchCount()
20.21 {
20.22 int c=0;
20.23 BranchItem *cur=NULL;
20.24 @@ -2143,7 +2148,7 @@
20.25 return NULL;
20.26 }
20.27
20.28 -AttributeItem* VymModel::addAttribute() // FIXME-2 savestate missing
20.29 +AttributeItem* VymModel::addAttribute()
20.30 {
20.31 BranchItem *selbi=getSelectedBranch();
20.32 if (selbi)
20.33 @@ -2151,19 +2156,28 @@
20.34 QList<QVariant> cData;
20.35 cData << "new attribute" << "undef";
20.36 AttributeItem *a=new AttributeItem (cData);
20.37 -
20.38 + if (addAttribute (a)) return a;
20.39 + }
20.40 + return NULL;
20.41 +}
20.42 +
20.43 +AttributeItem* VymModel::addAttribute(AttributeItem *ai) // FIXME-2 savestate missing
20.44 +{
20.45 + BranchItem *selbi=getSelectedBranch();
20.46 + if (selbi)
20.47 + {
20.48 emit (layoutAboutToBeChanged() );
20.49
20.50 QModelIndex parix=index(selbi);
20.51 - int n=selbi->getRowNumAppend (a);
20.52 + int n=selbi->getRowNumAppend (ai);
20.53 beginInsertRows (parix,n,n);
20.54 - selbi->appendChild (a);
20.55 + selbi->appendChild (ai);
20.56 endInsertRows ();
20.57
20.58 emit (layoutChanged() );
20.59
20.60 reposition();
20.61 - return a;
20.62 + return ai;
20.63 }
20.64 return NULL;
20.65 }
20.66 @@ -2435,9 +2449,14 @@
20.67 unselect();
20.68 saveStateRemovingPart (selbi, QString ("Delete %1").arg(getObjectName(selbi)));
20.69
20.70 - TreeItem *pi=deleteItem (selbi);
20.71 + BranchItem *pi=(BranchItem*)(deleteItem (selbi));
20.72 if (pi)
20.73 {
20.74 + if (pi->isScrolled() && pi->branchCount()==0)
20.75 + {
20.76 + pi->unScroll();
20.77 + emitDataHasChanged(pi);
20.78 + }
20.79 select (pi);
20.80 emitShowSelection();
20.81 }
20.82 @@ -4074,8 +4093,9 @@
20.83 }
20.84
20.85 setExportMode (true);
20.86 - QPixmap pix (mapEditor->getPixmap());
20.87 - pix.save(fname, format);
20.88 + mapEditor->getScene()->update(); // FIXME-2 check this...
20.89 + QImage img (mapEditor->getImage()); //FIXME-2 calls getTotalBBox, but also in ExportHTML::doExport()
20.90 + img.save(fname, format);
20.91 setExportMode (false);
20.92 }
20.93
20.94 @@ -4167,6 +4187,62 @@
20.95 }
20.96 }
20.97
20.98 +void VymModel::exportHTML (const QString &dir, bool askForName)
20.99 +{
20.100 + ExportXHTMLDialog dia(NULL);
20.101 + dia.setFilePath (filePath );
20.102 + dia.setMapName (mapName );
20.103 + dia.readSettings();
20.104 + if (dir!="") dia.setDir (dir);
20.105 +
20.106 + bool ok=true;
20.107 +
20.108 + /*
20.109 + if (askForName)
20.110 + {
20.111 + if (dia.exec()!=QDialog::Accepted)
20.112 + ok=false;
20.113 + else
20.114 + {
20.115 + QDir d (dia.getDir());
20.116 + // Check, if warnings should be used before overwriting
20.117 + // the output directory
20.118 + if (d.exists() && d.count()>0)
20.119 + {
20.120 + WarningDialog warn;
20.121 + warn.showCancelButton (true);
20.122 + warn.setText(QString(
20.123 + "The directory %1 is not empty.\n"
20.124 + "Do you risk to overwrite some of its contents?").arg(d.path() ));
20.125 + warn.setCaption("Warning: Directory not empty");
20.126 + warn.setShowAgainName("mainwindow/overwrite-dir-xhtml");
20.127 +
20.128 + if (warn.exec()!=QDialog::Accepted) ok=false;
20.129 + }
20.130 + }
20.131 + }
20.132 +*/
20.133 + ok=true;
20.134 + if (ok)
20.135 + {
20.136 + // Hide stuff during export, if settings want this
20.137 + setExportMode (true);
20.138 +
20.139 + ExportHTML ex (this);
20.140 + ex.setFile ("x/xxx.html");
20.141 + ex.doExport();
20.142 + setExportMode (false);
20.143 +
20.144 + //exportXML (dia.getDir(),false );
20.145 + //dia.doExport(mapName );
20.146 + //if (dia.hasChanged()) setChanged();
20.147 +
20.148 + // Write image, too
20.149 + exportImage ("x/xxx.png",false,"PNG");
20.150 +
20.151 + }
20.152 +}
20.153 +
20.154 void VymModel::exportXHTML (const QString &dir, bool askForName)
20.155 {
20.156 ExportXHTMLDialog dia(NULL);
20.157 @@ -4795,10 +4871,13 @@
20.158 void VymModel::setHideTmpMode (TreeItem::HideTmpMode mode)
20.159 {
20.160 hidemode=mode;
20.161 - for (int i=0;i<rootItem->childCount();i++)
20.162 - rootItem->child(i)->setHideTmp (mode);
20.163 + for (int i=0;i<rootItem->branchCount();i++)
20.164 + rootItem->getBranchNum(i)->setHideTmp (mode);
20.165 reposition();
20.166 - // FIXME-3 needed? scene()->update();
20.167 + if (mode==TreeItem::HideExport)
20.168 + unselect();
20.169 + else
20.170 + reselect();
20.171 }
20.172
20.173 //////////////////////////////////////////////
21.1 --- a/vymmodel.h Tue Dec 15 09:14:59 2009 +0000
21.2 +++ b/vymmodel.h Mon Jan 04 20:36:06 2010 +0000
21.3 @@ -237,6 +237,7 @@
21.4 ////////////////////////////////////////////
21.5 public:
21.6 void setVersion(const QString &);
21.7 + QString getVersion();
21.8 void setAuthor (const QString &);
21.9 QString getAuthor ();
21.10 void setComment (const QString &);
21.11 @@ -316,6 +317,7 @@
21.12 XLinkItem* createXLink(BranchItem *dst,bool createMO=false); //!< Create XLink starting at dst
21.13
21.14 AttributeItem* addAttribute();
21.15 + AttributeItem* addAttribute(AttributeItem* );
21.16
21.17 /*! \brief Add new mapcenter
21.18
21.19 @@ -438,7 +440,8 @@
21.20 /*! Export as ASCII text to file */
21.21 void exportASCII (QString fname="",bool askForName=true);
21.22
21.23 - /*! Export as XHTML to directory */
21.24 + /*! Export as HTML to directory */
21.25 + void exportHTML(const QString& dir="", bool askForName=true);
21.26 void exportXHTML(const QString& dir="", bool askForName=true);
21.27
21.28 /*! Export as OpenOfficeOrg presentation */