1.1 --- a/highlighter.cpp Tue Jun 19 14:20:29 2007 +0000
1.2 +++ b/highlighter.cpp Tue Jun 19 14:20:30 2007 +0000
1.3 @@ -47,6 +47,7 @@
1.4 << "\\bdelete\\b"
1.5 << "\\bdeleteKeepChilds\\b"
1.6 << "\\bdeleteChilds\\b"
1.7 + << "\\bexport\\b"
1.8 << "\\bimportDir\\b"
1.9 << "\\blinkTo\\b"
1.10 << "\\bloadImage\\b"
2.1 --- a/main.cpp Tue Jun 19 14:20:29 2007 +0000
2.2 +++ b/main.cpp Tue Jun 19 14:20:30 2007 +0000
2.3 @@ -164,7 +164,7 @@
2.4 script= ts.read();
2.5 f.close();
2.6 m.setScript (script);
2.7 - m.runScript (script);
2.8 + m.runScriptEverywhere (script);
2.9 }
2.10 }
2.11
3.1 --- a/mainwindow.cpp Tue Jun 19 14:20:29 2007 +0000
3.2 +++ b/mainwindow.cpp Tue Jun 19 14:20:30 2007 +0000
3.3 @@ -2341,39 +2341,13 @@
3.4 void Main::fileExportImage()
3.5 {
3.6 MapEditor *me=currentMapEditor();
3.7 - if (me)
3.8 - {
3.9 - QStringList fl;
3.10 - QFileDialog *fd=new QFileDialog (this);
3.11 - fd->setCaption (tr("Export map as image"));
3.12 - fd->setDirectory (lastImageDir);
3.13 - fd->setFileMode(QFileDialog::AnyFile);
3.14 - fd->setFilters (imageIO.getFilters() );
3.15 - if (fd->exec())
3.16 - {
3.17 - fl=fd->selectedFiles();
3.18 - me->exportImage (fl.first(), imageIO.getType (fd->selectedFilter() ) );
3.19 - }
3.20 - }
3.21 + if (me) me->exportImage();
3.22 }
3.23
3.24 void Main::fileExportASCII()
3.25 {
3.26 MapEditor *me=currentMapEditor();
3.27 - if (me)
3.28 - {
3.29 - ExportASCII ex;
3.30 - ex.setMapCenter(me->getMapCenter());
3.31 - ex.addFilter ("TXT (*.txt)");
3.32 - ex.setDir(lastImageDir);
3.33 - ex.setCaption(vymName+ " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
3.34 - if (ex.execDialog() )
3.35 - {
3.36 - me->setExportMode(true);
3.37 - ex.doExport();
3.38 - me->setExportMode(false);
3.39 - }
3.40 - }
3.41 + if (me) me->exportASCII();
3.42 }
3.43
3.44 void Main::fileExportCSV()
3.45 @@ -3638,6 +3612,16 @@
3.46 currentMapEditor()->runScript (script);
3.47 }
3.48
3.49 +void Main::runScriptEverywhere (const QString &script)
3.50 +{
3.51 + MapEditor *me;
3.52 + for (int i=0;i<=tabWidget->count() -1;i++)
3.53 + {
3.54 + me=(MapEditor*)tabWidget->page(i);
3.55 + if (me) me->runScript (script);
3.56 + }
3.57 +}
3.58 +
3.59 void Main::windowNextEditor()
3.60 {
3.61 if (tabWidget->currentPageIndex() < tabWidget->count())
4.1 --- a/mainwindow.h Tue Jun 19 14:20:29 2007 +0000
4.2 +++ b/mainwindow.h Tue Jun 19 14:20:30 2007 +0000
4.3 @@ -191,6 +191,7 @@
4.4 bool useFlagGroups();
4.5 void setScript(const QString &);
4.6 void runScript(const QString &);
4.7 + void runScriptEverywhere (const QString &);
4.8
4.9 private slots:
4.10 void windowNextEditor();
5.1 --- a/mapeditor.cpp Tue Jun 19 14:20:29 2007 +0000
5.2 +++ b/mapeditor.cpp Tue Jun 19 14:20:30 2007 +0000
5.3 @@ -483,6 +483,7 @@
5.4 QString com=parser.getCommand();
5.5
5.6 // External commands
5.7 + /////////////////////////////////////////////////////////////////////
5.8 if (com=="addBranch")
5.9 {
5.10 if (xelection.isEmpty())
5.11 @@ -495,9 +496,9 @@
5.12 {
5.13 QList <int> pl;
5.14 pl << 0 <<1;
5.15 - if (parser.checkParamCount(pl))
5.16 + if (parser.checkParCount(pl))
5.17 {
5.18 - if (parser.paramCount()==0)
5.19 + if (parser.parCount()==0)
5.20 addNewBranchInt (-2);
5.21 else
5.22 {
5.23 @@ -506,6 +507,7 @@
5.24 }
5.25 }
5.26 }
5.27 + /////////////////////////////////////////////////////////////////////
5.28 } else if (com=="addBranchBefore")
5.29 {
5.30 if (xelection.isEmpty())
5.31 @@ -516,11 +518,12 @@
5.32 parser.setError (Aborted,"Type of selection is not a branch");
5.33 } else
5.34 {
5.35 - if (parser.paramCount()==0)
5.36 + if (parser.parCount()==0)
5.37 {
5.38 addNewBranchBefore ();
5.39 }
5.40 }
5.41 + /////////////////////////////////////////////////////////////////////
5.42 } else if (com==QString("addMapReplace"))
5.43 {
5.44 if (xelection.isEmpty())
5.45 @@ -529,13 +532,14 @@
5.46 } else if (! selb )
5.47 {
5.48 parser.setError (Aborted,"Type of selection is not a branch");
5.49 - } else if (parser.checkParamCount(1))
5.50 + } else if (parser.checkParCount(1))
5.51 {
5.52 //s=parser.parString (ok,0); // selection
5.53 t=parser.parString (ok,0); // path to map
5.54 if (QDir::isRelativePath(t)) t=QDir::convertSeparators (tmpMapDir + "/"+t);
5.55 addMapReplaceInt(selb->getSelectString(),t);
5.56 }
5.57 + /////////////////////////////////////////////////////////////////////
5.58 } else if (com==QString("addMapInsert"))
5.59 {
5.60 if (xelection.isEmpty())
5.61 @@ -546,7 +550,7 @@
5.62 parser.setError (Aborted,"Type of selection is not a branch");
5.63 } else
5.64 {
5.65 - if (parser.checkParamCount(2))
5.66 + if (parser.checkParCount(2))
5.67 {
5.68 t=parser.parString (ok,0); // path to map
5.69 y=parser.parInt(ok,1); // position
5.70 @@ -554,6 +558,7 @@
5.71 addMapInsertInt(t,y);
5.72 }
5.73 }
5.74 + /////////////////////////////////////////////////////////////////////
5.75 } else if (com=="clearFlags")
5.76 {
5.77 if (xelection.isEmpty() )
5.78 @@ -562,11 +567,12 @@
5.79 } else if (! selb )
5.80 {
5.81 parser.setError (Aborted,"Type of selection is not a branch");
5.82 - } else if (parser.checkParamCount(0))
5.83 + } else if (parser.checkParCount(0))
5.84 {
5.85 selb->clearStandardFlags();
5.86 selb->updateFlagsToolbar();
5.87 }
5.88 + /////////////////////////////////////////////////////////////////////
5.89 } else if (com=="colorBranch")
5.90 {
5.91 if (xelection.isEmpty())
5.92 @@ -575,11 +581,12 @@
5.93 } else if (! selb )
5.94 {
5.95 parser.setError (Aborted,"Type of selection is not a branch");
5.96 - } else if (parser.checkParamCount(1))
5.97 + } else if (parser.checkParCount(1))
5.98 {
5.99 QColor c=parser.parColor (ok,0);
5.100 if (ok) colorBranch (c);
5.101 }
5.102 + /////////////////////////////////////////////////////////////////////
5.103 } else if (com=="colorSubtree")
5.104 {
5.105 if (xelection.isEmpty())
5.106 @@ -588,11 +595,12 @@
5.107 } else if (! selb )
5.108 {
5.109 parser.setError (Aborted,"Type of selection is not a branch");
5.110 - } else if (parser.checkParamCount(1))
5.111 + } else if (parser.checkParCount(1))
5.112 {
5.113 QColor c=parser.parColor (ok,0);
5.114 if (ok) colorSubtree (c);
5.115 }
5.116 + /////////////////////////////////////////////////////////////////////
5.117 } else if (com=="copy")
5.118 {
5.119 if (xelection.isEmpty())
5.120 @@ -601,10 +609,11 @@
5.121 } else if (! selb )
5.122 {
5.123 parser.setError (Aborted,"Type of selection is not a branch");
5.124 - } else if (parser.checkParamCount(0))
5.125 + } else if (parser.checkParCount(0))
5.126 {
5.127 //FIXME missing action for copy
5.128 }
5.129 + /////////////////////////////////////////////////////////////////////
5.130 } else if (com=="cut")
5.131 {
5.132 if (xelection.isEmpty())
5.133 @@ -615,10 +624,11 @@
5.134 xelection.type()!=Selection::FloatImage )
5.135 {
5.136 parser.setError (Aborted,"Type of selection is not a branch or floatimage");
5.137 - } else if (parser.checkParamCount(0))
5.138 + } else if (parser.checkParCount(0))
5.139 {
5.140 cut();
5.141 }
5.142 + /////////////////////////////////////////////////////////////////////
5.143 } else if (com=="delete")
5.144 {
5.145 if (xelection.isEmpty())
5.146 @@ -627,10 +637,11 @@
5.147 } else if (xelection.type() != Selection::Branch && xelection.type() != Selection::FloatImage )
5.148 {
5.149 parser.setError (Aborted,"Type of selection is wrong.");
5.150 - } else if (parser.checkParamCount(0))
5.151 + } else if (parser.checkParCount(0))
5.152 {
5.153 deleteSelection();
5.154 }
5.155 + /////////////////////////////////////////////////////////////////////
5.156 } else if (com=="deleteKeepChilds")
5.157 {
5.158 if (xelection.isEmpty())
5.159 @@ -639,10 +650,11 @@
5.160 } else if (! selb )
5.161 {
5.162 parser.setError (Aborted,"Type of selection is not a branch");
5.163 - } else if (parser.checkParamCount(0))
5.164 + } else if (parser.checkParCount(0))
5.165 {
5.166 deleteKeepChilds();
5.167 }
5.168 + /////////////////////////////////////////////////////////////////////
5.169 } else if (com=="deleteChilds")
5.170 {
5.171 if (xelection.isEmpty())
5.172 @@ -651,10 +663,63 @@
5.173 } else if (! selb)
5.174 {
5.175 parser.setError (Aborted,"Type of selection is not a branch");
5.176 - } else if (parser.checkParamCount(0))
5.177 + } else if (parser.checkParCount(0))
5.178 {
5.179 deleteChilds();
5.180 }
5.181 + /////////////////////////////////////////////////////////////////////
5.182 + } else if (com=="export")
5.183 + {
5.184 + /*
5.185 + if (xelection.isEmpty())
5.186 + {
5.187 + parser.setError (Aborted,"Nothing selected");
5.188 + } else if (! selb)
5.189 + {
5.190 + parser.setError (Aborted,"Type of selection is not a branch");
5.191 + } else
5.192 + */
5.193 + if (parser.parCount()==0)
5.194 + {
5.195 + parser.setError (Aborted,"No output format given");
5.196 + } else
5.197 + {
5.198 + // At least one parameter, which is the outFormat
5.199 + QString outFormat=parser.parString (ok,0);
5.200 + if (!ok)
5.201 + {
5.202 + parser.setError (Aborted,QString("Unknown export type: %1").arg(outFormat));
5.203 + } else
5.204 + {
5.205 + QString fname="";
5.206 + ok=true;
5.207 + if (parser.parCount()>=2)
5.208 + // Hey, we even have a filename
5.209 + fname=parser.parString(ok,1);
5.210 + if (!ok)
5.211 + {
5.212 + parser.setError (Aborted,"Could not read filename");
5.213 + } else
5.214 + {
5.215 + if (outFormat == "ascii")
5.216 + {
5.217 + exportASCII (fname,false);
5.218 + } else if (outFormat == "image")
5.219 + {
5.220 + QString format="PNG";
5.221 + if (parser.parCount()>2)
5.222 + {
5.223 + format=parser.parString(ok,2);
5.224 + }
5.225 + exportImage (fname,false,format);
5.226 + } else
5.227 + {
5.228 + parser.setError (Aborted,QString("Unknown export type: %1").arg(outFormat));
5.229 + }
5.230 + }
5.231 + }
5.232 + }
5.233 + /////////////////////////////////////////////////////////////////////
5.234 } else if (com=="importDir")
5.235 {
5.236 if (xelection.isEmpty())
5.237 @@ -663,11 +728,12 @@
5.238 } else if (! selb )
5.239 {
5.240 parser.setError (Aborted,"Type of selection is not a branch");
5.241 - } else if (parser.checkParamCount(1))
5.242 + } else if (parser.checkParCount(1))
5.243 {
5.244 s=parser.parString(ok,0);
5.245 if (ok) importDirInt(s);
5.246 }
5.247 + /////////////////////////////////////////////////////////////////////
5.248 } else if (com=="linkTo")
5.249 {
5.250 if (xelection.isEmpty())
5.251 @@ -675,7 +741,7 @@
5.252 parser.setError (Aborted,"Nothing selected");
5.253 } else if ( selb)
5.254 {
5.255 - if (parser.checkParamCount(4))
5.256 + if (parser.checkParCount(4))
5.257 {
5.258 // 0 selectstring of parent
5.259 // 1 num in parent (for branches)
5.260 @@ -705,7 +771,7 @@
5.261 }
5.262 } else if ( xelection.type() == Selection::FloatImage)
5.263 {
5.264 - if (parser.checkParamCount(1))
5.265 + if (parser.checkParCount(1))
5.266 {
5.267 // 0 selectstring of parent
5.268 s=parser.parString(ok,0);
5.269 @@ -720,6 +786,7 @@
5.270 }
5.271 } else
5.272 parser.setError (Aborted,"Type of selection is not a floatimage or branch");
5.273 + /////////////////////////////////////////////////////////////////////
5.274 } else if (com=="loadImage")
5.275 {
5.276 if (xelection.isEmpty())
5.277 @@ -728,11 +795,12 @@
5.278 } else if (! selb )
5.279 {
5.280 parser.setError (Aborted,"Type of selection is not a branch");
5.281 - } else if (parser.checkParamCount(1))
5.282 + } else if (parser.checkParCount(1))
5.283 {
5.284 s=parser.parString(ok,0);
5.285 if (ok) loadFloatImageInt (s);
5.286 }
5.287 + /////////////////////////////////////////////////////////////////////
5.288 } else if (com=="moveBranchUp")
5.289 {
5.290 if (xelection.isEmpty() )
5.291 @@ -741,10 +809,11 @@
5.292 } else if (! selb )
5.293 {
5.294 parser.setError (Aborted,"Type of selection is not a branch");
5.295 - } else if (parser.checkParamCount(0))
5.296 + } else if (parser.checkParCount(0))
5.297 {
5.298 moveBranchUp();
5.299 }
5.300 + /////////////////////////////////////////////////////////////////////
5.301 } else if (com=="moveBranchDown")
5.302 {
5.303 if (xelection.isEmpty() )
5.304 @@ -753,10 +822,11 @@
5.305 } else if (! selb )
5.306 {
5.307 parser.setError (Aborted,"Type of selection is not a branch");
5.308 - } else if (parser.checkParamCount(0))
5.309 + } else if (parser.checkParCount(0))
5.310 {
5.311 moveBranchDown();
5.312 }
5.313 + /////////////////////////////////////////////////////////////////////
5.314 } else if (com=="move")
5.315 {
5.316 if (xelection.isEmpty() )
5.317 @@ -767,7 +837,7 @@
5.318 xelection.type()!=Selection::FloatImage )
5.319 {
5.320 parser.setError (Aborted,"Type of selection is not a branch or floatimage");
5.321 - } else if (parser.checkParamCount(2))
5.322 + } else if (parser.checkParCount(2))
5.323 {
5.324 x=parser.parInt (ok,0);
5.325 if (ok)
5.326 @@ -776,6 +846,7 @@
5.327 if (ok) move (x,y);
5.328 }
5.329 }
5.330 + /////////////////////////////////////////////////////////////////////
5.331 } else if (com=="moveRel")
5.332 {
5.333 if (xelection.isEmpty() )
5.334 @@ -786,7 +857,7 @@
5.335 xelection.type()!=Selection::Selection::FloatImage )
5.336 {
5.337 parser.setError (Aborted,"Type of selection is not a branch or floatimage");
5.338 - } else if (parser.checkParamCount(2))
5.339 + } else if (parser.checkParCount(2))
5.340 {
5.341 x=parser.parInt (ok,0);
5.342 if (ok)
5.343 @@ -795,8 +866,10 @@
5.344 if (ok) moveRel (x,y);
5.345 }
5.346 }
5.347 + /////////////////////////////////////////////////////////////////////
5.348 } else if (com=="nop")
5.349 {
5.350 + /////////////////////////////////////////////////////////////////////
5.351 } else if (com=="paste")
5.352 {
5.353 if (xelection.isEmpty() )
5.354 @@ -805,7 +878,7 @@
5.355 } else if (! selb )
5.356 {
5.357 parser.setError (Aborted,"Type of selection is not a branch");
5.358 - } else if (parser.checkParamCount(1))
5.359 + } else if (parser.checkParCount(1))
5.360 {
5.361 x=parser.parInt (ok,0);
5.362 if (ok) pasteNoSave(x);
5.363 @@ -819,7 +892,7 @@
5.364 } else if (! selb )
5.365 {
5.366 parser.setError (Aborted,"Type of selection is not a branch");
5.367 - } else if (parser.checkParamCount(4))
5.368 + } else if (parser.checkParCount(4))
5.369 {
5.370 QString c,u;
5.371 c=parser.parString (ok,0);
5.372 @@ -876,13 +949,14 @@
5.373 }
5.374 }
5.375 }
5.376 + /////////////////////////////////////////////////////////////////////
5.377 } else if (com=="saveImage")
5.378 {
5.379 FloatImageObj *fio=xelection.getFloatImage();
5.380 if (!fio)
5.381 {
5.382 parser.setError (Aborted,"Type of selection is not an image");
5.383 - } else if (parser.checkParamCount(2))
5.384 + } else if (parser.checkParCount(2))
5.385 {
5.386 s=parser.parString(ok,0);
5.387 if (ok)
5.388 @@ -891,6 +965,7 @@
5.389 if (ok) saveFloatImageInt (fio,t,s);
5.390 }
5.391 }
5.392 + /////////////////////////////////////////////////////////////////////
5.393 } else if (com=="scroll")
5.394 {
5.395 if (xelection.isEmpty() )
5.396 @@ -899,18 +974,20 @@
5.397 } else if (! selb )
5.398 {
5.399 parser.setError (Aborted,"Type of selection is not a branch");
5.400 - } else if (parser.checkParamCount(0))
5.401 + } else if (parser.checkParCount(0))
5.402 {
5.403 if (!scrollBranch (selb))
5.404 parser.setError (Aborted,"Could not scroll branch");
5.405 }
5.406 + /////////////////////////////////////////////////////////////////////
5.407 } else if (com=="select")
5.408 {
5.409 - if (parser.checkParamCount(1))
5.410 + if (parser.checkParCount(1))
5.411 {
5.412 s=parser.parString(ok,0);
5.413 if (ok) select (s);
5.414 }
5.415 + /////////////////////////////////////////////////////////////////////
5.416 } else if (com=="selectLastBranch")
5.417 {
5.418 if (xelection.isEmpty() )
5.419 @@ -919,7 +996,7 @@
5.420 } else if (! selb )
5.421 {
5.422 parser.setError (Aborted,"Type of selection is not a branch");
5.423 - } else if (parser.checkParamCount(0))
5.424 + } else if (parser.checkParCount(0))
5.425 {
5.426 BranchObj *bo=selb->getLastBranch();
5.427 if (!bo)
5.428 @@ -927,6 +1004,7 @@
5.429 selectInt (bo);
5.430
5.431 }
5.432 + /////////////////////////////////////////////////////////////////////
5.433 } else if (com=="selectLastImage")
5.434 {
5.435 if (xelection.isEmpty() )
5.436 @@ -935,7 +1013,7 @@
5.437 } else if (! selb )
5.438 {
5.439 parser.setError (Aborted,"Type of selection is not a branch");
5.440 - } else if (parser.checkParamCount(0))
5.441 + } else if (parser.checkParCount(0))
5.442 {
5.443 FloatImageObj *fio=selb->getLastFloatImage();
5.444 if (!fio)
5.445 @@ -943,75 +1021,83 @@
5.446 selectInt (fio);
5.447
5.448 }
5.449 + /////////////////////////////////////////////////////////////////////
5.450 } else if (com=="setFrameType")
5.451 {
5.452 if ( xelection.type()!=Selection::Branch && xelection.type()!= Selection::MapCenter && xelection.type()!=Selection::FloatImage)
5.453 {
5.454 parser.setError (Aborted,"Type of selection does not allow setting frame type");
5.455 }
5.456 - else if (parser.checkParamCount(1))
5.457 + else if (parser.checkParCount(1))
5.458 {
5.459 s=parser.parString(ok,0);
5.460 if (ok) setFrameType (s);
5.461 }
5.462 + /////////////////////////////////////////////////////////////////////
5.463 } else if (com=="setFramePenColor")
5.464 {
5.465 if ( xelection.type()!=Selection::Branch && xelection.type()!= Selection::MapCenter && xelection.type()!=Selection::FloatImage)
5.466 {
5.467 parser.setError (Aborted,"Type of selection does not allow setting of pen color");
5.468 }
5.469 - else if (parser.checkParamCount(1))
5.470 + else if (parser.checkParCount(1))
5.471 {
5.472 QColor c=parser.parColor(ok,0);
5.473 if (ok) setFramePenColor (c);
5.474 }
5.475 + /////////////////////////////////////////////////////////////////////
5.476 } else if (com=="setFrameBrushColor")
5.477 {
5.478 if ( xelection.type()!=Selection::Branch && xelection.type()!= Selection::MapCenter && xelection.type()!=Selection::FloatImage)
5.479 {
5.480 parser.setError (Aborted,"Type of selection does not allow setting brush color");
5.481 }
5.482 - else if (parser.checkParamCount(1))
5.483 + else if (parser.checkParCount(1))
5.484 {
5.485 QColor c=parser.parColor(ok,0);
5.486 if (ok) setFrameBrushColor (c);
5.487 }
5.488 + /////////////////////////////////////////////////////////////////////
5.489 } else if (com=="setFramePadding")
5.490 {
5.491 if ( xelection.type()!=Selection::Branch && xelection.type()!= Selection::MapCenter && xelection.type()!=Selection::FloatImage)
5.492 {
5.493 parser.setError (Aborted,"Type of selection does not allow setting frame padding");
5.494 }
5.495 - else if (parser.checkParamCount(1))
5.496 + else if (parser.checkParCount(1))
5.497 {
5.498 x=parser.parInt(ok,0);
5.499 if (ok) setFramePadding(x);
5.500 }
5.501 + /////////////////////////////////////////////////////////////////////
5.502 } else if (com=="setFrameBorderWidth")
5.503 {
5.504 if ( xelection.type()!=Selection::Branch && xelection.type()!= Selection::MapCenter && xelection.type()!=Selection::FloatImage)
5.505 {
5.506 parser.setError (Aborted,"Type of selection does not allow setting frame border width");
5.507 }
5.508 - else if (parser.checkParamCount(1))
5.509 + else if (parser.checkParCount(1))
5.510 {
5.511 x=parser.parInt(ok,0);
5.512 if (ok) setFrameBorderWidth (x);
5.513 }
5.514 + /////////////////////////////////////////////////////////////////////
5.515 } else if (com=="setMapAuthor")
5.516 {
5.517 - if (parser.checkParamCount(1))
5.518 + if (parser.checkParCount(1))
5.519 {
5.520 s=parser.parString(ok,0);
5.521 if (ok) setMapAuthor (s);
5.522 }
5.523 + /////////////////////////////////////////////////////////////////////
5.524 } else if (com=="setMapComment")
5.525 {
5.526 - if (parser.checkParamCount(1))
5.527 + if (parser.checkParCount(1))
5.528 {
5.529 s=parser.parString(ok,0);
5.530 if (ok) setMapComment(s);
5.531 }
5.532 + /////////////////////////////////////////////////////////////////////
5.533 } else if (com=="setMapBackgroundColor")
5.534 {
5.535 if (xelection.isEmpty() )
5.536 @@ -1020,11 +1106,12 @@
5.537 } else if (! xelection.getBranch() )
5.538 {
5.539 parser.setError (Aborted,"Type of selection is not a branch");
5.540 - } else if (parser.checkParamCount(1))
5.541 + } else if (parser.checkParCount(1))
5.542 {
5.543 QColor c=parser.parColor (ok,0);
5.544 if (ok) setMapBackgroundColor (c);
5.545 }
5.546 + /////////////////////////////////////////////////////////////////////
5.547 } else if (com=="setMapDefLinkColor")
5.548 {
5.549 if (xelection.isEmpty() )
5.550 @@ -1033,18 +1120,20 @@
5.551 } else if (! selb )
5.552 {
5.553 parser.setError (Aborted,"Type of selection is not a branch");
5.554 - } else if (parser.checkParamCount(1))
5.555 + } else if (parser.checkParCount(1))
5.556 {
5.557 QColor c=parser.parColor (ok,0);
5.558 if (ok) setMapDefLinkColor (c);
5.559 }
5.560 + /////////////////////////////////////////////////////////////////////
5.561 } else if (com=="setMapLinkStyle")
5.562 {
5.563 - if (parser.checkParamCount(1))
5.564 + if (parser.checkParCount(1))
5.565 {
5.566 s=parser.parString (ok,0);
5.567 if (ok) setMapLinkStyle(s);
5.568 }
5.569 + /////////////////////////////////////////////////////////////////////
5.570 } else if (com=="setHeading")
5.571 {
5.572 if (xelection.isEmpty() )
5.573 @@ -1053,12 +1142,13 @@
5.574 } else if (! selb )
5.575 {
5.576 parser.setError (Aborted,"Type of selection is not a branch");
5.577 - } else if (parser.checkParamCount(1))
5.578 + } else if (parser.checkParCount(1))
5.579 {
5.580 s=parser.parString (ok,0);
5.581 if (ok)
5.582 setHeading (s);
5.583 }
5.584 + /////////////////////////////////////////////////////////////////////
5.585 } else if (com=="setHideExport")
5.586 {
5.587 if (xelection.isEmpty() )
5.588 @@ -1067,11 +1157,12 @@
5.589 } else if (xelection.type()!=Selection::Branch && xelection.type() != Selection::MapCenter &&xelection.type()!=Selection::FloatImage)
5.590 {
5.591 parser.setError (Aborted,"Type of selection is not a branch or floatimage");
5.592 - } else if (parser.checkParamCount(1))
5.593 + } else if (parser.checkParCount(1))
5.594 {
5.595 b=parser.parBool(ok,0);
5.596 if (ok) setHideExport (b);
5.597 }
5.598 + /////////////////////////////////////////////////////////////////////
5.599 } else if (com=="setIncludeImagesHorizontally")
5.600 {
5.601 if (xelection.isEmpty() )
5.602 @@ -1080,11 +1171,12 @@
5.603 } else if (! selb)
5.604 {
5.605 parser.setError (Aborted,"Type of selection is not a branch");
5.606 - } else if (parser.checkParamCount(1))
5.607 + } else if (parser.checkParCount(1))
5.608 {
5.609 b=parser.parBool(ok,0);
5.610 if (ok) setIncludeImagesHor(b);
5.611 }
5.612 + /////////////////////////////////////////////////////////////////////
5.613 } else if (com=="setIncludeImagesVertically")
5.614 {
5.615 if (xelection.isEmpty() )
5.616 @@ -1093,11 +1185,12 @@
5.617 } else if (! selb)
5.618 {
5.619 parser.setError (Aborted,"Type of selection is not a branch");
5.620 - } else if (parser.checkParamCount(1))
5.621 + } else if (parser.checkParCount(1))
5.622 {
5.623 b=parser.parBool(ok,0);
5.624 if (ok) setIncludeImagesVer(b);
5.625 }
5.626 + /////////////////////////////////////////////////////////////////////
5.627 } else if (com=="setHideLinkUnselected")
5.628 {
5.629 if (xelection.isEmpty() )
5.630 @@ -1106,18 +1199,20 @@
5.631 } else if ( xelection.type()!=Selection::Branch && xelection.type()!= Selection::MapCenter && xelection.type()!=Selection::FloatImage)
5.632 {
5.633 parser.setError (Aborted,"Type of selection does not allow hiding the link");
5.634 - } else if (parser.checkParamCount(1))
5.635 + } else if (parser.checkParCount(1))
5.636 {
5.637 b=parser.parBool(ok,0);
5.638 if (ok) setHideLinkUnselected(b);
5.639 }
5.640 + /////////////////////////////////////////////////////////////////////
5.641 } else if (com=="setSelectionColor")
5.642 {
5.643 - if (parser.checkParamCount(1))
5.644 + if (parser.checkParCount(1))
5.645 {
5.646 QColor c=parser.parColor (ok,0);
5.647 if (ok) setSelectionColorInt (c);
5.648 }
5.649 + /////////////////////////////////////////////////////////////////////
5.650 } else if (com=="setURL")
5.651 {
5.652 if (xelection.isEmpty() )
5.653 @@ -1126,11 +1221,12 @@
5.654 } else if (! selb )
5.655 {
5.656 parser.setError (Aborted,"Type of selection is not a branch");
5.657 - } else if (parser.checkParamCount(1))
5.658 + } else if (parser.checkParCount(1))
5.659 {
5.660 s=parser.parString (ok,0);
5.661 if (ok) setURL(s);
5.662 }
5.663 + /////////////////////////////////////////////////////////////////////
5.664 } else if (com=="setVymLink")
5.665 {
5.666 if (xelection.isEmpty() )
5.667 @@ -1139,12 +1235,13 @@
5.668 } else if (! selb )
5.669 {
5.670 parser.setError (Aborted,"Type of selection is not a branch");
5.671 - } else if (parser.checkParamCount(1))
5.672 + } else if (parser.checkParCount(1))
5.673 {
5.674 s=parser.parString (ok,0);
5.675 if (ok) setVymLinkInt(s);
5.676 }
5.677 }
5.678 + /////////////////////////////////////////////////////////////////////
5.679 else if (com=="setFlag")
5.680 {
5.681 if (xelection.isEmpty() )
5.682 @@ -1153,7 +1250,7 @@
5.683 } else if (! selb )
5.684 {
5.685 parser.setError (Aborted,"Type of selection is not a branch");
5.686 - } else if (parser.checkParamCount(1))
5.687 + } else if (parser.checkParCount(1))
5.688 {
5.689 s=parser.parString(ok,0);
5.690 if (ok)
5.691 @@ -1162,6 +1259,7 @@
5.692 selb->updateFlagsToolbar();
5.693 }
5.694 }
5.695 + /////////////////////////////////////////////////////////////////////
5.696 } else if (com=="setFrameType")
5.697 {
5.698 if (xelection.isEmpty() )
5.699 @@ -1170,12 +1268,13 @@
5.700 } else if (! selb )
5.701 {
5.702 parser.setError (Aborted,"Type of selection is not a branch");
5.703 - } else if (parser.checkParamCount(1))
5.704 + } else if (parser.checkParCount(1))
5.705 {
5.706 s=parser.parString(ok,0);
5.707 if (ok)
5.708 setFrameType (s);
5.709 }
5.710 + /////////////////////////////////////////////////////////////////////
5.711 } else if (com=="toggleFlag")
5.712 {
5.713 if (xelection.isEmpty() )
5.714 @@ -1184,7 +1283,7 @@
5.715 } else if (! selb )
5.716 {
5.717 parser.setError (Aborted,"Type of selection is not a branch");
5.718 - } else if (parser.checkParamCount(1))
5.719 + } else if (parser.checkParCount(1))
5.720 {
5.721 s=parser.parString(ok,0);
5.722 if (ok)
5.723 @@ -1193,6 +1292,7 @@
5.724 selb->updateFlagsToolbar();
5.725 }
5.726 }
5.727 + /////////////////////////////////////////////////////////////////////
5.728 } else if (com=="unscroll")
5.729 {
5.730 if (xelection.isEmpty() )
5.731 @@ -1201,11 +1301,12 @@
5.732 } else if (! selb )
5.733 {
5.734 parser.setError (Aborted,"Type of selection is not a branch");
5.735 - } else if (parser.checkParamCount(0))
5.736 + } else if (parser.checkParCount(0))
5.737 {
5.738 if (!unscrollBranch (selb))
5.739 parser.setError (Aborted,"Could not unscroll branch");
5.740 }
5.741 + /////////////////////////////////////////////////////////////////////
5.742 } else if (com=="unscrollChilds")
5.743 {
5.744 if (xelection.isEmpty() )
5.745 @@ -1214,10 +1315,11 @@
5.746 } else if (! selb )
5.747 {
5.748 parser.setError (Aborted,"Type of selection is not a branch");
5.749 - } else if (parser.checkParamCount(0))
5.750 + } else if (parser.checkParCount(0))
5.751 {
5.752 unscrollChilds ();
5.753 }
5.754 + /////////////////////////////////////////////////////////////////////
5.755 } else if (com=="unsetFlag")
5.756 {
5.757 if (xelection.isEmpty() )
5.758 @@ -1226,7 +1328,7 @@
5.759 } else if (! selb )
5.760 {
5.761 parser.setError (Aborted,"Type of selection is not a branch");
5.762 - } else if (parser.checkParamCount(1))
5.763 + } else if (parser.checkParCount(1))
5.764 {
5.765 s=parser.parString(ok,0);
5.766 if (ok)
5.767 @@ -1616,14 +1718,6 @@
5.768 return hidemode;
5.769 }
5.770
5.771 -void MapEditor::exportImage(QString fn)
5.772 -{
5.773 - setExportMode (true);
5.774 - QPixmap pix (getPixmap());
5.775 - pix.save(fn, "PNG");
5.776 - setExportMode (false);
5.777 -}
5.778 -
5.779 void MapEditor::setExportMode (bool b)
5.780 {
5.781 // should be called before and after exports
5.782 @@ -1634,11 +1728,57 @@
5.783 setHideTmpMode (BranchObj::HideNone);
5.784 }
5.785
5.786 -void MapEditor::exportImage(QString fn, QString format)
5.787 +void MapEditor::exportASCII(QString fname,bool askName)
5.788 {
5.789 + ExportASCII ex;
5.790 + ex.setMapCenter(mapCenter);
5.791 + if (fname=="")
5.792 + ex.setFile (mapName+".txt");
5.793 + else
5.794 + ex.setFile (fname);
5.795 +
5.796 + if (askName)
5.797 + {
5.798 + //ex.addFilter ("TXT (*.txt)");
5.799 + ex.setDir(lastImageDir);
5.800 + //ex.setCaption(vymName+ " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
5.801 + ex.execDialog() ;
5.802 + }
5.803 + if (!ex.canceled())
5.804 + {
5.805 + setExportMode(true);
5.806 + ex.doExport();
5.807 + setExportMode(false);
5.808 + }
5.809 +}
5.810 +
5.811 +void MapEditor::exportImage(QString fname, bool askName, QString format)
5.812 +{
5.813 + if (fname=="")
5.814 + {
5.815 + fname=mapName+".png";
5.816 + format="PNG";
5.817 + }
5.818 +
5.819 + if (askName)
5.820 + {
5.821 + QStringList fl;
5.822 + QFileDialog *fd=new QFileDialog (this);
5.823 + fd->setCaption (tr("Export map as image"));
5.824 + fd->setDirectory (lastImageDir);
5.825 + fd->setFileMode(QFileDialog::AnyFile);
5.826 + fd->setFilters (imageIO.getFilters() );
5.827 + if (fd->exec())
5.828 + {
5.829 + fl=fd->selectedFiles();
5.830 + fname=fl.first();
5.831 + format=imageIO.getType(fd->selectedFilter());
5.832 + }
5.833 + }
5.834 +
5.835 setExportMode (true);
5.836 QPixmap pix (getPixmap());
5.837 - pix.save(fn, format);
5.838 + pix.save(fname, format);
5.839 setExportMode (false);
5.840 }
5.841
5.842 @@ -1684,7 +1824,7 @@
5.843 file.close();
5.844
5.845 // Now write image, too
5.846 - exportImage (dir+"/images/"+mapName+".png");
5.847 + exportImage (dir+"/images/"+mapName+".png","PNG");
5.848
5.849 setExportMode (false);
5.850 }
6.1 --- a/mapeditor.h Tue Jun 19 14:20:29 2007 +0000
6.2 +++ b/mapeditor.h Tue Jun 19 14:20:30 2007 +0000
6.3 @@ -136,8 +136,10 @@
6.4 BranchObj::HideTmpMode getHideTmpMode(); // temporary hide stuff
6.5 public:
6.6 void setExportMode (bool); //!< Set or unset temporary hiding of objects during export
6.7 - void exportImage (QString fn); //!< Export as PNG
6.8 - void exportImage (QString fn, QString); //!< Export in given format
6.9 + void exportASCII (QString fname="",bool askForName=true); //!< Export as ASCII
6.10 +
6.11 + /*! Save as image */
6.12 + void exportImage (QString fname="",bool askForName=true,QString format="PNG");
6.13 void exportOOPresentation(const QString &,const QString &); //!< Export as OpenOfficeOrg presentation
6.14 void exportXML(const QString&); //!< Export as XML to directory
6.15 void clear(); //!< Clear map
7.1 --- a/parser.cpp Tue Jun 19 14:20:29 2007 +0000
7.2 +++ b/parser.cpp Tue Jun 19 14:20:30 2007 +0000
7.3 @@ -98,7 +98,7 @@
7.4 return paramList;
7.5 }
7.6
7.7 -int Parser::paramCount()
7.8 +int Parser::parCount()
7.9 {
7.10 return paramList.count();
7.11 }
7.12 @@ -141,13 +141,13 @@
7.13 }
7.14
7.15
7.16 -bool Parser::checkParamCount (QList <int> plist)
7.17 +bool Parser::checkParCount (QList <int> plist)
7.18 {
7.19 QStringList expList;
7.20 QString expected;
7.21 for (int i=0; i<plist.count();i++)
7.22 {
7.23 - if (checkParamCount (plist[i]))
7.24 + if (checkParCount (plist[i]))
7.25 {
7.26 resetError();
7.27 return true;
7.28 @@ -159,7 +159,7 @@
7.29 return false;
7.30 }
7.31
7.32 -bool Parser::checkParamCount (const int &expected)
7.33 +bool Parser::checkParCount (const int &expected)
7.34 {
7.35 if (paramList.count()!=expected)
7.36 {
7.37 @@ -170,7 +170,7 @@
7.38 return true;
7.39 }
7.40
7.41 -bool Parser::checkParamIsInt(const int &index)
7.42 +bool Parser::checkParIsInt(const int &index)
7.43 {
7.44 bool ok;
7.45 if (index > paramList.count())
7.46 @@ -193,7 +193,7 @@
7.47
7.48 int Parser::parInt (bool &ok,const uint &index)
7.49 {
7.50 - if (checkParamIsInt (index))
7.51 + if (checkParIsInt (index))
7.52 return paramList[index].toInt (&ok, 10);
7.53 ok=false;
7.54 return 0;
8.1 --- a/parser.h Tue Jun 19 14:20:29 2007 +0000
8.2 +++ b/parser.h Tue Jun 19 14:20:30 2007 +0000
8.3 @@ -14,15 +14,15 @@
8.4 QString getAtom();
8.5 QString getCommand();
8.6 QStringList getParameters();
8.7 - int paramCount();
8.8 + int parCount();
8.9 QString errorMessage();
8.10 QString errorDescription();
8.11 ErrorLevel errorLevel();
8.12 void setError (ErrorLevel level,const QString &description);
8.13 void resetError();
8.14 - bool checkParamCount (QList <int> plist);
8.15 - bool checkParamCount (const int &index);
8.16 - bool checkParamIsInt (const int &index);
8.17 + bool checkParCount (QList <int> plist);
8.18 + bool checkParCount (const int &index);
8.19 + bool checkParIsInt (const int &index);
8.20 int parInt (bool &,const uint &index);
8.21 QString parString(bool &ok,const int &index);
8.22 bool parBool (bool &ok, const int &index);
9.1 --- a/tex/vym.tex Tue Jun 19 14:20:29 2007 +0000
9.2 +++ b/tex/vym.tex Tue Jun 19 14:20:30 2007 +0000
9.3 @@ -24,12 +24,12 @@
9.4 \end{center}
9.5 }
9.6 \newcommand{\hint}[1]{
9.7 - \begin{center}
9.8 + \begin{center}
9.9 \begin{tabular}{|rp{12cm}|} \hline
9.10 -
9.11 {\bf Hint}:& #1\\ \hline
9.12 \end{tabular}
9.13 - \end{center}
9.14 + \marginpar{\Huge !}
9.15 + \end{center}
9.16 }
9.17
9.18 \newcommand{\vym}{{\sc vym }}
9.19 @@ -39,6 +39,8 @@
9.20 \newcommand{\da}{$\downarrow$}
9.21 \newcommand{\key}[1]{[#1]}
9.22
9.23 +\newenvironment{code}[1] { \verbatim #1}{\endverbatim }
9.24 +
9.25 \hypersetup{bookmarks, bookmarksopen,
9.26 pdftitle={VYM - a tool for visual thinking },
9.27 pdfauthor={Uwe Drechsel},
9.28 @@ -1078,11 +1080,21 @@
9.29 several maps at once.
9.30
9.31
9.32 - \section{Scripts} \label{scripts}
9.33 - %FIXME
9.34 +\section{Scripts} \label{scripts} %FIXME
9.35
9.36 +TODO: This section of the \vym manual is not complete yet, sorry.
9.37
9.38 -
9.39 +\subsection{Example scripts}
9.40 +\subsubsection{Export a set of maps}
9.41 +\begin{code}
9.42 +\# Simple vym script to export images of various maps simultanously
9.43 +export ("image");
9.44 +\end{code}
9.45 +The script above can be used to export all maps in a directory
9.46 +automatically. If the script is named {\tt export-image.vys}, call \vym with
9.47 +\begin{code}
9.48 +\$ vym --quit --run export-image.vys *.vym
9.49 +\end{code}
9.50
9.51
9.52 \section{Contributing to \vym}
9.53 @@ -1163,11 +1175,11 @@
9.54 Make sure you have installed your Qt environment properly, see the Qt
9.55 documentation for details. You need to have the Qt command {\tt qmake}
9.56 in your {\tt PATH}-environment, then run
9.57 -\begin{verbatim}
9.58 -qmake
9.59 -make
9.60 -make install
9.61 -\end{verbatim}
9.62 +\begin{code}
9.63 +\$ qmake
9.64 +$ make
9.65 +$ make install
9.66 +\end{code}
9.67 The last command {\tt make install} needs root-permissions. Of course it
9.68 may be omitted, if you just want to test \vym.
9.69
9.70 @@ -1179,9 +1191,9 @@
9.71 compressed archive of data. If you want to have a
9.72 closer look into the data structure map called "mapname.vym",
9.73 just uncompress the map manually using
9.74 -\begin{verbatim}
9.75 - unzip mapname.vym
9.76 -\end{verbatim}
9.77 +\begin{code}
9.78 +\$ unzip mapname.vym
9.79 +\end{code}
9.80 This will create directories named {\tt images} and {\tt flags} in your
9.81 current directory and also the map itself, usually named {\tt
9.82 mapname.xml}.
9.83 @@ -1190,22 +1202,18 @@
9.84
9.85 This XML file can be loaded directly into \vym, it does not have to be
9.86 compressed. If you want to compress all the data yourself, use
9.87 -\begin{verbatim}
9.88 - zip -r mapname.vym .
9.89 -\end{verbatim}
9.90 +\begin{code}
9.91 +\$ zip -r mapname.vym .
9.92 +\end{code}
9.93 to compress all data in your current directory.
9.94
9.95 \subsection{New features}
9.96 There are lots of features which might find their way into \vym.
9.97 Together with \vym you should have received a directory with several
9.98 -maps e.g. on SUSE~LINUX this is
9.99 -\begin{center}
9.100 - {\tt /usr/share/doc/packages/vym/demos}
9.101 -\end{center}
9.102 -where you find the map {\tt todo.vym}. It lists quite a lot of things to
9.103 -be done in future. If you have more ideas, contact the development team
9.104 -at
9.105 -{\tt vym-devel@lists.sourceforge.net}.
9.106 +example maps. You find them by clicking Help \ra Open~vym~example~maps.
9.107 +There you will find the map {\tt vym-projectplan.vym}. It lists quite a
9.108 +lot of things to be done in future. If you have more ideas, contact the
9.109 +development team at {\tt vym-devel@lists.sourceforge.net}.
9.110
9.111
9.112 \subsection{New languages support}
9.113 @@ -1216,12 +1224,11 @@
9.114 needed.
9.115
9.116 In some Linux distributions the development tools are in an extra package, e.g. on SUSE LINUX you should have installed:
9.117 -\begin{verbatim}
9.118 - qt3-devel.rpm
9.119 - qt3-devel-doc.rpm
9.120 - qt3-devel-tools.rpm
9.121 - qt3-man.rpm
9.122 -\end{verbatim}
9.123 +\begin{code}
9.124 +libqt4-devel.rpm
9.125 +libqt4-devel-doc.rpm
9.126 +libqt4-devel-tools.rpm
9.127 +\end{code}
9.128 If you don't have QT in your system, you can get it from
9.129 \href{http://www.trolltech.com}{http://www.trolltech.com} Once you
9.130 are able to compile vym yourself, you can translate the text in vym
10.1 --- a/version.h Tue Jun 19 14:20:29 2007 +0000
10.2 +++ b/version.h Tue Jun 19 14:20:30 2007 +0000
10.3 @@ -5,9 +5,9 @@
10.4
10.5 #define __VYM_NAME "VYM"
10.6 #define __VYM_VERSION "1.8.73"
10.7 -#define __VYM_CODENAME "Codename: 1.9.0-beta-1"
10.8 -//#define __VYM_CODENAME "Codename: development version"
10.9 -#define __VYM_BUILD_DATE "June 18, 2007"
10.10 +//#define __VYM_CODENAME "Codename: 1.9.0-beta-1"
10.11 +#define __VYM_CODENAME "Codename: development version"
10.12 +#define __VYM_BUILD_DATE "June 19, 2007"
10.13
10.14
10.15 bool checkVersion(const QString &);