diff -r 310f1d82cf89 -r c585be63ec69 mapeditor.cpp --- a/mapeditor.cpp Mon Mar 05 23:22:51 2007 +0000 +++ b/mapeditor.cpp Tue Mar 06 19:37:39 2007 +0000 @@ -489,7 +489,7 @@ if (QDir::isRelativePath(t)) t=QDir::convertSeparators (tmpMapDir + "/"+t); addMapReplaceInt(selb->getSelectString(),t); } - } else if (com==QString("addMparsernsert")) + } else if (com==QString("addMapInsert")) { if (xelection.isEmpty()) { @@ -552,9 +552,9 @@ if (xelection.isEmpty()) { parser.setError (Aborted,"Nothing selected"); - } else if (! selb ) + } else if (xelection.type() != Branch && xelection.type() != FloatImage ) { - parser.setError (Aborted,"Type of selection is not a branch"); + parser.setError (Aborted,"Type of selection is wrong."); } else if (parser.checkParamCount(0)) { deleteSelection(); @@ -722,6 +722,21 @@ { paste(); } + } else if (com=="saveImage") + { + FloatImageObj *fio=xelection.getFloatImage(); + if (!fio) + { + parser.setError (Aborted,"Type of selection is not an image"); + } else if (parser.checkParamCount(2)) + { + s=parser.parString(ok,0); + if (ok) + { + t=parser.parString(ok,1); + if (ok) saveFloatImageInt (fio,t,s); + } + } } else if (com=="scroll") { if (xelection.isEmpty() ) @@ -758,6 +773,22 @@ selectInt (bo); } + } else if (com=="selectLastImage") + { + if (xelection.isEmpty() ) + { + parser.setError (Aborted,"Nothing selected"); + } else if (! selb ) + { + parser.setError (Aborted,"Type of selection is not a branch"); + } else if (parser.checkParamCount(0)) + { + FloatImageObj *fio=selb->getLastFloatImage(); + if (!fio) + parser.setError (Aborted,"Could not select last image"); + selectInt (fio); + + } } else if (com=="setMapAuthor") { if (parser.checkParamCount(1)) @@ -827,11 +858,38 @@ } else if (! selb) { parser.setError (Aborted,"Type of selection is not a branch or floatimage"); + //FIXME selb is never a floatimage!! } else if (parser.checkParamCount(1)) { b=parser.parBool(ok,0); if (ok) setHideExport (b); } + } else if (com=="setIncludeImagesHorizontally") + { + if (xelection.isEmpty() ) + { + parser.setError (Aborted,"Nothing selected"); + } else if (! selb) + { + parser.setError (Aborted,"Type of selection is not a branch"); + } else if (parser.checkParamCount(1)) + { + b=parser.parBool(ok,0); + if (ok) setIncludeImagesHor(b); + } + } else if (com=="setIncludeImagesVertically") + { + if (xelection.isEmpty() ) + { + parser.setError (Aborted,"Nothing selected"); + } else if (! selb) + { + parser.setError (Aborted,"Type of selection is not a branch"); + } else if (parser.checkParamCount(1)) + { + b=parser.parBool(ok,0); + if (ok) setIncludeImagesVer(b); + } } else if (com=="setURL") { if (xelection.isEmpty() ) @@ -3130,6 +3188,11 @@ } } +void MapEditor::saveFloatImageInt (FloatImageObj *fio, const QString &type, const QString &fn) +{ + fio->save (fn,type); +} + void MapEditor::saveFloatImage () { FloatImageObj *fio=xelection.getFloatImage(); @@ -3144,13 +3207,14 @@ fd->show(); QString fn; - if ( fd->exec() == QDialog::Accepted ) + if ( fd->exec() == QDialog::Accepted && fd->selectedFiles().count()==1) { - if (QFile (fd->selectedFile()).exists() ) + fn=fd->selectedFiles().at(0); + if (QFile (fn).exists() ) { QMessageBox mb( vymName, tr("The file %1 exists already.\n" - "Do you want to overwrite it?").arg(fd->selectedFile()), + "Do you want to overwrite it?").arg(fn), QMessageBox::Warning, QMessageBox::Yes | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape, @@ -3170,7 +3234,7 @@ break; } } - fio->save (fd->selectedFile(),imageIO.getType (fd->selectedFilter() ) ); + saveFloatImageInt (fio,fd->selectedFilter(),fn ); } delete (fd); } @@ -3192,6 +3256,16 @@ BranchObj *bo=xelection.getBranch(); if (bo) { + QString u= b ? "false" : "true"; + QString r=!b ? "false" : "true"; + + saveState( + bo, + QString("setIncludeImagesVertically (%1)").arg(u), + bo, + QString("setIncludeImagesVertically (%1)").arg(r), + QString("Include images vertically in %1").arg(getName(bo)) + ); bo->setIncludeImagesVer(b); mapCenter->reposition(); } @@ -3202,6 +3276,16 @@ BranchObj *bo=xelection.getBranch(); if (bo) { + QString u= b ? "false" : "true"; + QString r=!b ? "false" : "true"; + + saveState( + bo, + QString("setIncludeImagesHorizontally (%1)").arg(u), + bo, + QString("setIncludeImagesHorizontally (%1)").arg(r), + QString("Include images horizontally in %1").arg(getName(bo)) + ); bo->setIncludeImagesHor(b); mapCenter->reposition(); }