1.1 Binary file demos/todo.vym has changed
2.1 --- a/exports.cpp Tue Jul 19 15:57:49 2005 +0000
2.2 +++ b/exports.cpp Fri Jul 22 15:38:06 2005 +0000
2.3 @@ -1,6 +1,9 @@
2.4 #include "exports.h"
2.5
2.6 +#include <qregexp.h>
2.7 +
2.8 #include "linkablemapobj.h"
2.9 +#include "texteditor.h"
2.10
2.11
2.12 Export::Export()
2.13 @@ -8,24 +11,6 @@
2.14 indentPerDepth=" ";
2.15 }
2.16
2.17 -bool Export::setOutputDir(QString dirname)
2.18 -{
2.19 - outdir.setPath (dirname);
2.20 - if ( outdir.exists() )
2.21 - {
2.22 - // FIXME
2.23 - // ask for confirmation
2.24 - // then delete outdir
2.25 - return true;
2.26 - } else
2.27 - {
2.28 - // try to create directory
2.29 - //return outdir.mkdir (outdir.absPath());
2.30 - // FIXME
2.31 - return true;
2.32 - }
2.33 -}
2.34 -
2.35 void Export::setPath (const QString &p)
2.36 {
2.37 filepath=p;
2.38 @@ -41,7 +26,7 @@
2.39 QFile file (filepath);
2.40 if ( !file.open( IO_WriteOnly ) )
2.41 {
2.42 - // FIXME
2.43 + // FIXME experimental, testing
2.44 cout << "Export::exportMap couldn't open "<<filepath<<endl;
2.45 return;
2.46 }
2.47 @@ -50,7 +35,7 @@
2.48 // Main loop over all branches
2.49 QString s;
2.50 QString actIndent("");
2.51 - int i;
2.52 + uint i;
2.53 BranchObj *bo;
2.54 bo=mapCenter->first();
2.55 while (bo)
2.56 @@ -60,18 +45,24 @@
2.57
2.58 // Write heading
2.59 // write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
2.60 - if (bo->getDepth()==1)
2.61 - ts << (getSectionString(bo) + bo->getHeading()+ "\n");
2.62 + if (bo->getDepth()==0)
2.63 + {
2.64 + ts << (bo->getHeading()+ "\n");
2.65 + for (i=0;i<bo->getHeading().length();i++) ts<<"=";
2.66 + ts << "\n";
2.67 + } else if (bo->getDepth()==1)
2.68 + ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
2.69 + else if (bo->getDepth()==2)
2.70 + ts << (actIndent + " o " + bo->getHeading()+ "\n");
2.71 else
2.72 ts << (actIndent + " - " + bo->getHeading()+ "\n");
2.73
2.74 // If necessary, write note
2.75 if (!bo->getNote().isEmpty())
2.76 {
2.77 - ts << ("-------------------Begin of Note-----------------\n");
2.78 - ts << (bo->getNote());
2.79 - ts << ("\n");
2.80 - ts << ("-------------------End of Note-------------------\n");
2.81 + s =textConvertToASCII(bo->getNote());
2.82 + s=s.replace ("\n","\n"+actIndent);
2.83 + ts << (s+"\n\n");
2.84 }
2.85
2.86 bo=bo->next();
2.87 @@ -97,36 +88,3 @@
2.88 return r + " ";
2.89 }
2.90
2.91 -void Export::exportAsHTML()
2.92 -{
2.93 - // FIXME just testing...
2.94 - // Main loop over all branches
2.95 - QString s;
2.96 - QString actIndent("");
2.97 - int i;
2.98 - BranchObj *bo;
2.99 - bo=mapCenter->first();
2.100 - while (bo)
2.101 - {
2.102 - // Make indentstring
2.103 - for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
2.104 -
2.105 - // Write heading
2.106 - write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
2.107 -
2.108 - // If necessary, write note
2.109 - if (!bo->getNote().isEmpty())
2.110 - {
2.111 - write (bo->getNote());
2.112 - }
2.113 -
2.114 - bo=bo->next();
2.115 - actIndent="";
2.116 - }
2.117 -}
2.118 -
2.119 -void Export::write(QString s)
2.120 -{
2.121 - cout << s;
2.122 -}
2.123 -
3.1 --- a/exports.h Tue Jul 19 15:57:49 2005 +0000
3.2 +++ b/exports.h Fri Jul 22 15:38:06 2005 +0000
3.3 @@ -14,15 +14,12 @@
3.4 {
3.5 public:
3.6 Export();
3.7 - bool setOutputDir (QString);
3.8 void setPath(const QString &);
3.9 void setMapCenter (MapCenterObj*);
3.10 void setIndentPerDepth (QString);
3.11 void exportMap();
3.12 - void exportAsHTML();
3.13 protected:
3.14 QString getSectionString (BranchObj*);
3.15 - void write (QString);
3.16
3.17 private:
3.18 QDir outdir;
4.1 --- a/mainwindow.cpp Tue Jul 19 15:57:49 2005 +0000
4.2 +++ b/mainwindow.cpp Fri Jul 22 15:38:06 2005 +0000
4.3 @@ -967,8 +967,9 @@
4.4
4.5 a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" ), 0, this, "exportASCII" );
4.6 connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
4.7 - // TODO deactivated, doesn't work with QRichtext anyway
4.8 - // a->addTo( exportMenu );
4.9 + // FIXME Usually deactivated, still experimental
4.10 + if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) ;
4.11 + a->addTo( exportMenu );
4.12
4.13 a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ), 0, this, "exportXML" );
4.14 connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
5.1 --- a/mapeditor.cpp Tue Jul 19 15:57:49 2005 +0000
5.2 +++ b/mapeditor.cpp Fri Jul 22 15:38:06 2005 +0000
5.3 @@ -592,6 +592,7 @@
5.4
5.5 void MapEditor::saveState(const SaveMode &savemode, LinkableMapObj *undoSel, const QString &undoCom)
5.6 {
5.7 + setChanged();
5.8 if (savemode==UndoCommand)
5.9 {
5.10 undoCommand=undoCom;
5.11 @@ -832,7 +833,6 @@
5.12 // (map state is set later at end of load...)
5.13 } else
5.14 {
5.15 - setChanged();
5.16 saveState(selection);
5.17 }
5.18
5.19 @@ -1029,7 +1029,7 @@
5.20 l->setPen (QPen(QColor(black), 1));
5.21 l->setZ (200);
5.22 l->show();
5.23 - */
5.24 + */
5.25
5.26 if (printFooter)
5.27 {
5.28 @@ -1137,6 +1137,9 @@
5.29 void MapEditor::exportASCII()
5.30 {
5.31 // FIXME still experimental
5.32 + Export ex;
5.33 + ex.setMapCenter(mapCenter);
5.34 +
5.35 QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (ASCII)"));
5.36 fd->addFilter ("TXT (*.txt)");
5.37 fd->setCaption("VYM - Export (ASCII) (still experimental)");
5.38 @@ -1162,21 +1165,14 @@
5.39 {
5.40 case QMessageBox::Yes:
5.41 // save
5.42 - if (!ex.setOutputDir ("out"))
5.43 - {
5.44 - QMessageBox::critical (0,tr("Critical Export Error "),tr("Couldn't create directory ") + "out");
5.45 - return;
5.46 - }
5.47 break;;
5.48 case QMessageBox::Cancel:
5.49 - // do nothing
5.50 + // return, do nothing
5.51 return;
5.52 break;
5.53 }
5.54 }
5.55 - Export ex;
5.56 ex.setPath (fd->selectedFile() );
5.57 - ex.setMapCenter(mapCenter);
5.58 ex.exportMap();
5.59 }
5.60 }
5.61 @@ -1288,15 +1284,6 @@
5.62 // Finish open lineEdits
5.63 if (lineedit) finishedLineEditNoSave();
5.64
5.65 - // Unselect
5.66 - /*FIXME testing
5.67 - if (selection)
5.68 - {
5.69 - selection->unselect();
5.70 - selection=NULL;
5.71 - }
5.72 - */
5.73 -
5.74 parseAtom (undoCommand);
5.75 mapCenter->reposition();
5.76
5.77 @@ -1414,7 +1401,6 @@
5.78
5.79 void MapEditor::paste()
5.80 {
5.81 - setChanged();
5.82 saveState(selection);
5.83 pasteNoSave();
5.84 mapCenter->reposition();
5.85 @@ -1423,7 +1409,6 @@
5.86
5.87 void MapEditor::cut()
5.88 {
5.89 - setChanged();
5.90 saveState(selection->getParObj());
5.91 copy();
5.92 cutNoSave();
5.93 @@ -1448,7 +1433,6 @@
5.94 BranchObj* par;
5.95 if (typeid(*selection) == typeid(BranchObj) )
5.96 {
5.97 - setChanged();
5.98 saveState("moveBranchDown ()");
5.99 bo=(BranchObj*)(selection);
5.100 par=(BranchObj*)(bo->getParObj());
5.101 @@ -1469,7 +1453,6 @@
5.102 BranchObj* par;
5.103 if (typeid(*selection) == typeid(BranchObj) )
5.104 {
5.105 - setChanged();
5.106 saveState("moveBranchUp ()");
5.107 bo=(BranchObj*)(selection);
5.108 par=(BranchObj*)(bo->getParObj());
5.109 @@ -1490,7 +1473,6 @@
5.110 (typeid(*selection) == typeid(BranchObj) ||
5.111 typeid(*selection) == typeid(MapCenterObj) ) )
5.112 {
5.113 - setChanged();
5.114 saveState("setHeading (\""+((BranchObj*)(selection))->getHeading()+"\")");
5.115
5.116 ensureSelectionVisible();
5.117 @@ -1532,7 +1514,6 @@
5.118 (typeid(*selection) == typeid(BranchObj) ||
5.119 typeid(*selection) == typeid(MapCenterObj) ) )
5.120 {
5.121 - setChanged();
5.122 saveState(selection);
5.123
5.124 BranchObj* bo1 = (BranchObj*) (selection);
5.125 @@ -1598,7 +1579,6 @@
5.126 if (selection &&
5.127 (typeid(*selection) == typeid(BranchObj) ) )
5.128 {
5.129 - setChanged();
5.130 saveState(selection);
5.131
5.132 BranchObj* bo1 = (BranchObj*) (selection);
5.133 @@ -1647,7 +1627,6 @@
5.134
5.135 if (selection && typeid(*selection) ==typeid(BranchObj) )
5.136 {
5.137 - setChanged();
5.138 saveState(selection->getParObj());
5.139 BranchObj* bo=dynamic_cast <BranchObj*> (selection);
5.140 BranchObj* par=(BranchObj*)(bo->getParObj());
5.141 @@ -1662,7 +1641,6 @@
5.142 }
5.143 if (selection && typeid(*selection) ==typeid(FloatImageObj) )
5.144 {
5.145 - setChanged();
5.146 saveState(selection->getParObj());
5.147 FloatImageObj* fio=dynamic_cast <FloatImageObj*> (selection);
5.148 BranchObj* par=(BranchObj*)(fio->getParObj());
5.149 @@ -2104,7 +2082,7 @@
5.150 QColor col = QColorDialog::getColor( mapCanvas->backgroundColor(), this );
5.151 if ( !col.isValid() ) return;
5.152 setBackgroundColor( col );
5.153 - setChanged();
5.154 + saveState();
5.155 }
5.156
5.157 void MapEditor::setBackgroundColor(QColor c)
5.158 @@ -2133,7 +2111,6 @@
5.159 if (typeid(*selection) == typeid(BranchObj) ||
5.160 typeid(*selection) == typeid(MapCenterObj))
5.161 {
5.162 - setChanged();
5.163 saveState(selection);
5.164 BranchObj *bo=(BranchObj*)(selection);
5.165 bo->setColor(actColor, false); // color links, color childs
5.166 @@ -2148,7 +2125,6 @@
5.167 if (typeid(*selection) == typeid(BranchObj) ||
5.168 typeid(*selection) == typeid(MapCenterObj))
5.169 {
5.170 - setChanged();
5.171 saveState(selection);
5.172 BranchObj *bo=(BranchObj*)(selection);
5.173 bo->setColor(actColor, true); // color links, color childs
5.174 @@ -2161,7 +2137,6 @@
5.175 {
5.176 if (selection)
5.177 {
5.178 - setChanged();
5.179 saveState(selection);
5.180 ((BranchObj*)(selection))->toggleStandardFlag (f,actionSettingsUseFlagGroups);
5.181 }
5.182 @@ -2280,7 +2255,7 @@
5.183 // user entered something and pressed OK
5.184 ((BranchObj*)(selection))->setURL (text);
5.185 updateActions();
5.186 - setChanged();
5.187 + saveState(); //FIXME undoCommand
5.188 }
5.189 }
5.190 }
5.191 @@ -2293,7 +2268,7 @@
5.192 BranchObj *b=(BranchObj*)(selection);
5.193 b->setURL (b->getHeading());
5.194 updateActions();
5.195 - setChanged();
5.196 + saveState(); //FIXME undoCommand
5.197 }
5.198 }
5.199
5.200 @@ -2305,7 +2280,7 @@
5.201 BranchObj *b=(BranchObj*)(selection);
5.202 b->setURL ("https://bugzilla.novell.com/show_bug.cgi?id="+b->getHeading());
5.203 updateActions();
5.204 - setChanged();
5.205 + saveState(); //FIXME undoCommand
5.206 }
5.207 }
5.208
5.209 @@ -2328,7 +2303,7 @@
5.210 mapCenter->reposition();
5.211 adjustCanvasSize();
5.212 canvas()->update();
5.213 - setChanged();
5.214 + saveState(); //FIXME undoCommand
5.215 }
5.216 }
5.217
5.218 @@ -2342,7 +2317,7 @@
5.219 mapCenter->reposition();
5.220 adjustCanvasSize();
5.221 canvas()->update();
5.222 - setChanged();
5.223 + saveState(); //FIXME undoCommand
5.224 }
5.225 }
5.226
5.227 @@ -2361,7 +2336,6 @@
5.228 {
5.229 if (selection && (typeid(*selection) == typeid(BranchObj) ))
5.230 {
5.231 - setChanged();
5.232 saveState(selection->getParObj());
5.233 QString sel=selection->getSelectString();
5.234 BranchObj* bo=(BranchObj*)(selection);
5.235 @@ -2377,7 +2351,6 @@
5.236 {
5.237 if (selection && (typeid(*selection) == typeid(BranchObj) ))
5.238 {
5.239 - setChanged();
5.240 saveState(selection->getParObj());
5.241 ((BranchObj*)(selection))->removeChilds();
5.242 mapCenter->reposition();
5.243 @@ -2424,7 +2397,7 @@
5.244 {
5.245 mapCenter->setAuthor (dia.getAuthor() );
5.246 mapCenter->setComment (dia.getComment() );
5.247 - setChanged();
5.248 + saveState(); //FIXME undoCommand
5.249 }
5.250 }
5.251
5.252 @@ -2577,7 +2550,6 @@
5.253 {
5.254 linkstyle=ls;
5.255
5.256 - setChanged();
5.257 saveState();
5.258 BranchObj *bo;
5.259 bo=mapCenter->first();
5.260 @@ -2672,7 +2644,8 @@
5.261 QColor col = QColorDialog::getColor( defLinkColor, this );
5.262 if ( !col.isValid() ) return;
5.263 setLinkColor( col );
5.264 - setChanged();
5.265 + saveState(); //FIXME undoCommand
5.266 +
5.267 }
5.268
5.269 void MapEditor::toggleScroll()
5.270 @@ -2682,7 +2655,6 @@
5.271 BranchObj *bo=((BranchObj*)(selection));
5.272 if (bo->countBranches()==0) return;
5.273 if (bo->getDepth()==0) return;
5.274 - setChanged();
5.275 saveState(selection);
5.276 bo->toggleScroll();
5.277 adjustCanvasSize();
5.278 @@ -2722,7 +2694,6 @@
5.279 QString fn;
5.280 if ( fd->exec() == QDialog::Accepted )
5.281 {
5.282 - setChanged();
5.283 saveState(selection);
5.284 QString fn=fd->selectedFile();
5.285 lastImageDir=fn.left(fn.findRev ("/"));
5.286 @@ -2929,7 +2900,7 @@
5.287 }
5.288 if (dia.deleteXLink())
5.289 ((BranchObj*)(selection))->deleteXLinkAt(i);
5.290 - setChanged();
5.291 + saveState(); //FIXME undoCommand
5.292 }
5.293 }
5.294 }
5.295 @@ -3163,7 +3134,6 @@
5.296
5.297 if (typeid(*selection) == typeid(FloatImageObj))
5.298 {
5.299 - setChanged();
5.300 saveState("move "+qpointToString(movingObj_orgPos));
5.301 FloatObj *fo=(FloatObj*)(selection);
5.302 if (fo->getLinkStyle()==StyleUndef)
5.303 @@ -3185,6 +3155,7 @@
5.304 {
5.305 if (typeid(*fo) == typeid(FloatImageObj))
5.306 {
5.307 + saveState();
5.308 FloatImageObj *fio=(FloatImageObj*)(fo);
5.309 ((BranchObj*)(lmo))->addFloatImage (fio);
5.310 fio->unselect();
5.311 @@ -3215,7 +3186,6 @@
5.312 if (lmosel->getDepth()==1)
5.313 {
5.314 // depth==1, mainbranch
5.315 - setChanged();
5.316 saveState("move "+qpointToString(movingObj_orgPos));
5.317 lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );
5.318 } else
5.319 @@ -3324,8 +3294,7 @@
5.320 tmpXLink->setEnd ( ((BranchObj*)(dst)) );
5.321 tmpXLink->updateXLink();
5.322 tmpXLink->activate();
5.323 - setChanged();
5.324 -
5.325 + saveState(); //FIXME undoCommand
5.326 } else
5.327 {
5.328 delete(tmpXLink);
5.329 @@ -3362,7 +3331,6 @@
5.330 if (dst )
5.331 {
5.332 BranchObj* bs=((BranchObj*)(selection));
5.333 - setChanged();
5.334 saveState ("linkBranchToPos (\""+
5.335 (bs->getParObj())->getSelectString()+
5.336 "\","+
5.337 @@ -3415,7 +3383,6 @@
5.338 if (selection) selection->unselect();
5.339 selection=lmo;
5.340 selection->select();
5.341 - setChanged();
5.342 saveState(selection);
5.343 editHeading();
5.344 }
5.345 @@ -3588,7 +3555,7 @@
5.346
5.347 if (update)
5.348 {
5.349 - setChanged();
5.350 + saveState(); //FIXME undo Command
5.351 mapCenter->reposition();
5.352 adjustCanvasSize();
5.353 canvas()->update();
5.354 @@ -3603,7 +3570,6 @@
5.355 (typeid(*selection) == typeid(MapCenterObj)) )
5.356 {
5.357 BranchObj *bo=((BranchObj*)(selection));
5.358 - setChanged();
5.359 saveState(selection);
5.360 //QString fn=fd->selectedFile();
5.361 //lastImageDir=fn.left(fn.findRev ("/"));
6.1 --- a/texteditor.cpp Tue Jul 19 15:57:49 2005 +0000
6.2 +++ b/texteditor.cpp Fri Jul 22 15:38:06 2005 +0000
6.3 @@ -678,7 +678,7 @@
6.4 e->setText(t);
6.5 }
6.6
6.7 -QString TextEditor::textConvertToASCII(const QString &t)
6.8 +QString textConvertToASCII(const QString &t)
6.9 {
6.10 QString r=t;
6.11
6.12 @@ -687,8 +687,8 @@
6.13 re.setMinimal(true);
6.14 r.replace (re,"\n");
6.15
6.16 - // convert all "</p>" to "\n"
6.17 - re.setPattern ("/p");
6.18 + // convert all "<p>" to "\n"
6.19 + re.setPattern ("<p>");
6.20 r.replace (re,"\n");
6.21
6.22 // remove all remaining tags
6.23 @@ -702,6 +702,8 @@
6.24 r.replace (re,"<");
6.25 re.setPattern ("&");
6.26 r.replace (re,"&");
6.27 + re.setPattern (""");
6.28 + r.replace (re,"\"");
6.29 return r;
6.30 }
6.31
7.1 --- a/texteditor.h Tue Jul 19 15:57:49 2005 +0000
7.2 +++ b/texteditor.h Fri Jul 22 15:38:06 2005 +0000
7.3 @@ -10,6 +10,8 @@
7.4
7.5 enum EditorState {inactiveEditor,emptyEditor,filledEditor};
7.6
7.7 +QString textConvertToASCII(const QString &);
7.8 +
7.9 class TextEditor : public QMainWindow {
7.10 Q_OBJECT
7.11 public:
7.12 @@ -56,7 +58,6 @@
7.13 void textSave();
7.14 void textConvertPar();
7.15 void textJoinLines();
7.16 - QString textConvertToASCII(const QString &);
7.17 void textExportAsASCII();
7.18 void textPrint();
7.19 void textEditUndo();
8.1 --- a/version.h Tue Jul 19 15:57:49 2005 +0000
8.2 +++ b/version.h Fri Jul 22 15:38:06 2005 +0000
8.3 @@ -2,6 +2,6 @@
8.4 #define VERSION_H
8.5
8.6 #define __VYM_VERSION__ "1.7.1"
8.7 -#define __BUILD_DATE__ "July 19, 2005"
8.8 +#define __BUILD_DATE__ "July 22, 2005"
8.9
8.10 #endif