# HG changeset patch # User insilmaril # Date 1122924765 0 # Node ID 56c57552f1d2429df3486f21877962e930233a0c # Parent 3590c3490789d6f44dd8ce6f3026b98b8f4152dd Added a few more undo commands in mapeditor diff -r 3590c3490789 -r 56c57552f1d2 mainwindow.cpp --- a/mainwindow.cpp Sun Jul 31 12:24:53 2005 +0000 +++ b/mainwindow.cpp Mon Aug 01 19:32:45 2005 +0000 @@ -967,9 +967,7 @@ a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" ), 0, this, "exportASCII" ); connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) ); - // FIXME Usually deactivated, still experimental - if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) ; - a->addTo( exportMenu ); + a->addTo( exportMenu ); a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ), 0, this, "exportXML" ); connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) ); diff -r 3590c3490789 -r 56c57552f1d2 mapeditor.cpp --- a/mapeditor.cpp Sun Jul 31 12:24:53 2005 +0000 +++ b/mapeditor.cpp Mon Aug 01 19:32:45 2005 +0000 @@ -706,7 +706,22 @@ s=api.parString (ok,0); if (ok) setHeading (s); } - } + } else if (com=="setURL") + { + if (api.checkParamCount(1)) + { + s=api.parString (ok,0); + if (ok) setURL(s); + } + } else if (com=="setVymLink") + { + if (api.checkParamCount(1)) + { + s=api.parString (ok,0); + if (ok) setVymLink(s); + } + } + // Internal commands, used for undo etc. else if (com==QString("undoMap")) { @@ -1548,6 +1563,34 @@ } } +void MapEditor::setURL (const QString &s) +{ + // Internal function, no saveState needed + if (selection && + (typeid(*selection) == typeid(BranchObj) || + typeid(*selection) == typeid(MapCenterObj) ) ) + { + ((BranchObj*)(selection))->setURL(s); + mapCenter->reposition(); + adjustCanvasSize(); + ensureSelectionVisible(); + } +} + +void MapEditor::setVymLink (const QString &s) +{ + // Internal function, no saveState needed + if (selection && + (typeid(*selection) == typeid(BranchObj) || + typeid(*selection) == typeid(MapCenterObj) ) ) + { + ((BranchObj*)(selection))->setVymLink(s); + mapCenter->reposition(); + adjustCanvasSize(); + ensureSelectionVisible(); + } +} + void MapEditor::addNewBranch(int pos) { // Finish open lineEdits @@ -1557,7 +1600,7 @@ (typeid(*selection) == typeid(BranchObj) || typeid(*selection) == typeid(MapCenterObj) ) ) { - saveState(selection); + saveState(selection); //FIXME undoCommand BranchObj* bo1 = (BranchObj*) (selection); bool wasScrolled=false; @@ -2161,7 +2204,7 @@ if (typeid(*selection) == typeid(BranchObj) || typeid(*selection) == typeid(MapCenterObj)) { - saveState(selection); + saveState(selection); //FIXME undoCommand BranchObj *bo=(BranchObj*)(selection); bo->setColor(actColor, false); // color links, color childs } @@ -2187,7 +2230,7 @@ { if (selection) { - saveState(selection); + saveState(selection);// FIXME undoCommand ((BranchObj*)(selection))->toggleStandardFlag (f,actionSettingsUseFlagGroups); } } @@ -2297,15 +2340,16 @@ typeid(*selection) == typeid(MapCenterObj)) ) { bool ok; + BranchObj *bo=(BranchObj*)(selection); QString text = QInputDialog::getText( "VYM", tr("Enter URL:"), QLineEdit::Normal, - ((BranchObj*)(selection))->getURL(), &ok, this ); + bo->getURL(), &ok, this ); if ( ok) { // user entered something and pressed OK - ((BranchObj*)(selection))->setURL (text); + saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+text+"\")"); + bo->setURL (text); updateActions(); - saveState(); //FIXME undoCommand } } } @@ -2315,10 +2359,10 @@ if (selection && (typeid(*selection) == typeid(BranchObj) || typeid(*selection) == typeid(MapCenterObj)) ) { - BranchObj *b=(BranchObj*)(selection); - b->setURL (b->getHeading()); + BranchObj *bo=(BranchObj*)(selection); + saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+bo->getHeading()+"\")"); + bo->setURL (bo->getHeading()); updateActions(); - saveState(); //FIXME undoCommand } } @@ -2327,10 +2371,11 @@ if (selection && (typeid(*selection) == typeid(BranchObj) || typeid(*selection) == typeid(MapCenterObj)) ) { - BranchObj *b=(BranchObj*)(selection); - b->setURL ("https://bugzilla.novell.com/show_bug.cgi?id="+b->getHeading()); + BranchObj *bo=(BranchObj*)(selection); + QString url= "https://bugzilla.novell.com/show_bug.cgi?id="+bo->getHeading(); + saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")"); + bo->setURL (url); updateActions(); - saveState(); //FIXME undoCommand } } @@ -2339,21 +2384,24 @@ if (selection && (typeid(*selection) == typeid(BranchObj) || typeid(*selection) == typeid(MapCenterObj)) ) { + BranchObj *bo=(BranchObj*)(selection); QFileDialog *fd=new QFileDialog( this,tr("VYM - Link to another map")); fd->addFilter (QString (tr("vym map") + " (*.vym)")); fd->setCaption(tr("VYM - Link to another map")); - if (! ((BranchObj*)(selection))->getVymLink().isEmpty() ) - fd->setSelection( ((BranchObj*)(selection))->getVymLink() ); + if (! bo->getVymLink().isEmpty() ) + fd->setSelection( bo->getVymLink() ); fd->show(); QString fn; if ( fd->exec() == QDialog::Accepted ) - ((BranchObj*)(selection))->setVymLink (fd->selectedFile() ); - updateActions(); - mapCenter->reposition(); - adjustCanvasSize(); - canvas()->update(); - saveState(); //FIXME undoCommand + { + saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\""+fd->selectedFile()+"\")"); + bo->setVymLink (fd->selectedFile() ); + updateActions(); + mapCenter->reposition(); + adjustCanvasSize(); + canvas()->update(); + } } } @@ -2362,12 +2410,13 @@ if (selection && (typeid(*selection) == typeid(BranchObj) || typeid(*selection) == typeid(MapCenterObj)) ) { - ((BranchObj*)(selection))->setVymLink ("" ); + BranchObj *bo=(BranchObj*)(selection); + saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\"\")"); + bo->setVymLink ("" ); updateActions(); mapCenter->reposition(); adjustCanvasSize(); canvas()->update(); - saveState(); //FIXME undoCommand } } diff -r 3590c3490789 -r 56c57552f1d2 mapeditor.h --- a/mapeditor.h Sun Jul 31 12:24:53 2005 +0000 +++ b/mapeditor.h Mon Aug 01 19:32:45 2005 +0000 @@ -88,6 +88,8 @@ void editHeading(); // Start editing heading private: void setHeading(const QString &); // Just set the heading for selection + void setURL(const QString &); // Just set the URL for selection + void setVymLink(const QString &); // Set vymLink for selection public: void addNewBranch(int); // pos allows to add above/below selection void addNewBranchHere(); // insert and make selection its diff -r 3590c3490789 -r 56c57552f1d2 tex/vym.tex --- a/tex/vym.tex Sun Jul 31 12:24:53 2005 +0000 +++ b/tex/vym.tex Mon Aug 01 19:32:45 2005 +0000 @@ -725,7 +725,7 @@ zip -r vymfile.vym . \end{verbatim} -\subsubsection*{Importa part of a map} +\subsubsection*{Importing a part of a map} Select a branch where you want to add a previously save part of a map ({\tt .vyp}), then open the context menu and choose {\em Add \ra Import}. For the import you can diff -r 3590c3490789 -r 56c57552f1d2 version.h --- a/version.h Sun Jul 31 12:24:53 2005 +0000 +++ b/version.h Mon Aug 01 19:32:45 2005 +0000 @@ -2,6 +2,6 @@ #define VERSION_H #define __VYM_VERSION__ "1.7.3" -#define __BUILD_DATE__ "July 28, 2005" +#define __BUILD_DATE__ "August 1, 2005" #endif