More undo/redo commands. Undo debug output still enabled
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/api.cpp Thu Aug 31 11:55:33 2006 +0000
1.3 @@ -0,0 +1,147 @@
1.4 +#include "api.h"
1.5 +
1.6 +#include <qregexp.h>
1.7 +
1.8 +API::API()
1.9 +{
1.10 + initCommand();
1.11 +}
1.12 +
1.13 +void API::initCommand()
1.14 +{
1.15 + com="";
1.16 + paramList.clear();
1.17 + errorString="";
1.18 + noErr=true;
1.19 +}
1.20 +
1.21 +void API::parseCommand (const QString &s)
1.22 +{
1.23 + initCommand();
1.24 + QRegExp re;
1.25 + int pos;
1.26 +
1.27 + // Get command
1.28 + re.setPattern ("(.*)\\s");
1.29 + re.setMinimal (true);
1.30 + pos=re.search (s);
1.31 + if (pos>=0)
1.32 + com=re.cap(1);
1.33 +
1.34 + // Get parameters
1.35 + paramList.clear();
1.36 + re.setPattern ("\\((.*)\\)");
1.37 + pos=re.search (s);
1.38 + if (pos>=0)
1.39 + {
1.40 + QString s=re.cap(1);
1.41 + QString a;
1.42 + bool inquote=false;
1.43 + pos=0;
1.44 + if (!s.isEmpty())
1.45 + {
1.46 + while (pos<s.length())
1.47 + {
1.48 + if (s.at(pos)=='\"')
1.49 + {
1.50 + if (inquote)
1.51 + inquote=false;
1.52 + else
1.53 + inquote=true;
1.54 + }
1.55 +
1.56 + if (s.at(pos)==',' && !inquote)
1.57 + {
1.58 + a=s.left(pos);
1.59 + paramList.append(a);
1.60 + s=s.right(s.length()-pos-1);
1.61 + pos=0;
1.62 + } else
1.63 + pos++;
1.64 +
1.65 + }
1.66 + paramList.append (s);
1.67 + }
1.68 + }
1.69 +}
1.70 +
1.71 +QString API::command()
1.72 +{
1.73 + return com;
1.74 +}
1.75 +
1.76 +QStringList API::parameters()
1.77 +{
1.78 + return paramList;
1.79 +}
1.80 +
1.81 +QString API::errorDesc()
1.82 +{
1.83 + return errorString;
1.84 +}
1.85 +
1.86 +bool API::error()
1.87 +{
1.88 + // invert noErr
1.89 + return (noErr) ?false:true;
1.90 +}
1.91 +
1.92 +void API::setError(const QString &e)
1.93 +{
1.94 + noErr=false;
1.95 + errorString=e;
1.96 +}
1.97 +
1.98 +bool API::checkParamCount (const uint &expected)
1.99 +{
1.100 + if (paramList.count()!=expected)
1.101 + {
1.102 + errorString=QString("expected %1 parameters, but got %2").arg(expected).arg(paramList.count());
1.103 + noErr=false;
1.104 + } else
1.105 + noErr=true;
1.106 + return noErr;
1.107 +}
1.108 +
1.109 +bool API::checkParamIsInt(const uint &index)
1.110 +{
1.111 + bool ok;
1.112 + if (index > paramList.count())
1.113 + {
1.114 + errorString =QString("Parameter index %1 is outside of parameter list").arg(index);
1.115 + noErr=false;
1.116 + } else
1.117 + {
1.118 + paramList[index].toInt (&ok, 10);
1.119 + if (!ok)
1.120 + {
1.121 + errorString=QString("Parameter %1 is not an integer").arg(index);
1.122 + noErr=false;
1.123 + } else
1.124 + noErr=true;
1.125 + }
1.126 + return noErr;
1.127 +}
1.128 +
1.129 +int API::parInt (bool &ok,const uint &index)
1.130 +{
1.131 + if (checkParamIsInt (index))
1.132 + return paramList[index].toInt (&ok, 10);
1.133 + ok=false;
1.134 + return 0;
1.135 +}
1.136 +
1.137 +QString API::parString (bool &ok,const uint &index)
1.138 +{
1.139 + // return the string at index, this could be also stored in
1.140 + // a variable later
1.141 + QString r;
1.142 + QRegExp re("\"(.*)\"");
1.143 + int pos=re.search (paramList[index]);
1.144 + if (pos>=0)
1.145 + r=re.cap (1);
1.146 + else
1.147 + r="";
1.148 + ok=true;
1.149 + return r;
1.150 +}
2.1 --- a/branchobj.cpp Wed Aug 30 12:16:25 2006 +0000
2.2 +++ b/branchobj.cpp Thu Aug 31 11:55:33 2006 +0000
2.3 @@ -812,7 +812,6 @@
2.4
2.5 // Save XLinks
2.6 XLinkObj *xlo;
2.7 - //FIXME exponential increase in xlinks...
2.8 QString ol; // old link
2.9 QString cl; // current link
2.10 for (xlo=xlink.first(); xlo; xlo=xlink.next() )
2.11 @@ -882,7 +881,6 @@
2.12 calcBBoxSize();
2.13 positionBBox();
2.14 requestReposition();
2.15 - //FIXME undo needed
2.16 }
2.17
2.18 bool BranchObj::getIncludeImagesVer()
2.19 @@ -896,7 +894,6 @@
2.20 calcBBoxSize();
2.21 positionBBox();
2.22 requestReposition();
2.23 - //FIXME undo needed
2.24 }
2.25
2.26 bool BranchObj::getIncludeImagesHor()
2.27 @@ -930,7 +927,6 @@
2.28 positionBBox();
2.29 requestReposition();
2.30 return newfi;
2.31 - //FIXME undo needed
2.32 }
2.33
2.34 LinkableMapObj* BranchObj::addFloatImage (FloatImageObj *fio)
2.35 @@ -946,7 +942,6 @@
2.36 positionBBox();
2.37 requestReposition();
2.38 return newfi;
2.39 - // FIMXE undo needed
2.40 }
2.41
2.42 FloatImageObj* BranchObj::getFirstFloatImage ()
2.43 @@ -1155,7 +1150,7 @@
2.44
2.45 bool BranchObj::canMoveBranchUp()
2.46 {
2.47 - if (!parObj) return false;
2.48 + if (!parObj || depth==1) return false;
2.49 BranchObj* par=(BranchObj*)parObj;
2.50 if (this==par->getFirstBranch())
2.51 return false;
2.52 @@ -1163,23 +1158,24 @@
2.53 return true;
2.54 }
2.55
2.56 -BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // move a branch up (modify myself)
2.57 +BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // modify my childlist
2.58 {
2.59 savePosInAngle();
2.60 int i=branch.find(bo1);
2.61 + cout << "BO: i="<<i<<endl;
2.62 if (i>0)
2.63 { // -1 if bo1 not found
2.64 branch.at(i)->angle--;
2.65 branch.at(i-1)->angle++;
2.66 branch.sort();
2.67 - return branch.at(i-1);
2.68 + return branch.at(i);
2.69 } else
2.70 - return branch.at(i);
2.71 + return NULL;
2.72 }
2.73
2.74 bool BranchObj::canMoveBranchDown()
2.75 {
2.76 - if (!parObj) return false;
2.77 + if (!parObj|| depth==1) return false;
2.78 BranchObj* par=(BranchObj*)parObj;
2.79 if (this==par->getLastBranch())
2.80 return false;
2.81 @@ -1187,7 +1183,7 @@
2.82 return true;
2.83 }
2.84
2.85 -BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)
2.86 +BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// modify my childlist
2.87 {
2.88 savePosInAngle();
2.89 int i=branch.find(bo1);
2.90 @@ -1198,9 +1194,9 @@
2.91 branch.at(i)->angle++;
2.92 branch.at(j)->angle--;
2.93 branch.sort();
2.94 - return branch.at(j);
2.95 + return branch.at(i);
2.96 } else
2.97 - return branch.at(i);
2.98 + return NULL;
2.99 }
2.100
2.101 BranchObj* BranchObj::moveBranchTo (BranchObj* dst, int pos)
2.102 @@ -1253,7 +1249,7 @@
2.103
2.104 // If I am the mapcenter or a mainbranch, reposition heading
2.105 if (depth<2)
2.106 - { //FIXME ugly! optimize this move for MCO needed to initially position text in box...
2.107 + {
2.108 if (depth==1)
2.109 // Calc angle to mapCenter if I am a mainbranch
2.110 // needed for reordering the mainbranches clockwise
2.111 @@ -1452,7 +1448,7 @@
2.112 if (!status.isEmpty()) mainWindow->statusMessage (status);
2.113
2.114 // Update Toolbar
2.115 - standardFlags->updateToolbar();
2.116 + updateFlagsToolbar();
2.117
2.118 // Update actions in mapeditor
2.119 mapEditor->updateActions();
3.1 Binary file demos/todo.vym has changed
4.1 --- a/exports.cpp Wed Aug 30 12:16:25 2006 +0000
4.2 +++ b/exports.cpp Thu Aug 31 11:55:33 2006 +0000
4.3 @@ -120,7 +120,6 @@
4.4 QFile file (outputFile);
4.5 if ( !file.open( QIODevice::WriteOnly ) )
4.6 {
4.7 - // FIXME experimental, testing
4.8 qWarning ("ExportBase::exportXML couldn't open "+outputFile);
4.9 return;
4.10 }
5.1 Binary file icons/cursor.xcf has changed
6.1 Binary file icons/cursor16.xcf has changed
7.1 Binary file icons/cursorcolorpicker.png has changed
8.1 Binary file icons/cursorhandopen.png has changed
9.1 Binary file icons/cursorhandopen16.png has changed
10.1 --- a/main.cpp Wed Aug 30 12:16:25 2006 +0000
10.2 +++ b/main.cpp Thu Aug 31 11:55:33 2006 +0000
10.3 @@ -103,7 +103,6 @@
10.4
10.5 QAction *actionSettingsAutoselectHeading;
10.6 QAction *actionSettingsAutoselectText;
10.7 -QAction *actionSettingsPasteNewHeading;
10.8 QAction *actionSettingsAutoedit;
10.9 QAction *actionSettingsUseDelKey;
10.10 QAction *actionSettingsUseFlagGroups;
10.11 @@ -152,7 +151,7 @@
10.12 "http://www.InSilmaril.de/vym\n");
10.13 if (options.parse())
10.14 {
10.15 -//FIXME QT3 cout << endl << options.getHelpText()<<endl;
10.16 + cout << endl << options.getHelpText().ascii()<<endl;
10.17 return 1;
10.18 }
10.19
10.20 @@ -200,12 +199,6 @@
10.21 return 0;
10.22 }
10.23
10.24 - if (options.isOn ("test"))
10.25 - {
10.26 - // FIXME testing string option only
10.27 - cout << "Testing: "<<options.getArg("test").ascii()<< endl;
10.28 - }
10.29 -
10.30 q3InitNetworkProtocols();
10.31
10.32
11.1 --- a/mainwindow.cpp Wed Aug 30 12:16:25 2006 +0000
11.2 +++ b/mainwindow.cpp Thu Aug 31 11:55:33 2006 +0000
11.3 @@ -122,7 +122,6 @@
11.4 extern QAction* actionSettingsAutoselectHeading;
11.5 extern QAction* actionSettingsAutoselectHeading;
11.6 extern QAction* actionSettingsAutoselectText;
11.7 -extern QAction* actionSettingsPasteNewHeading;
11.8 extern QAction* actionSettingsUseDelKey;
11.9 extern QAction* actionSettingsUseFlagGroups;
11.10 extern QAction* actionSettingsUseHideExport;
11.11 @@ -263,7 +262,6 @@
11.12
11.13 settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoselectHeading->isOn() );
11.14 settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoselectText->isOn() );
11.15 - settings.setValue( "/mapeditor/editmode/pasteNewHeading",actionSettingsPasteNewHeading->isOn() );
11.16 settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoedit->isOn() );
11.17 settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
11.18 settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
11.19 @@ -321,6 +319,7 @@
11.20 {
11.21 QMenu *fileMenu = menuBar()->addMenu ( tr ("&Map") );
11.22 QToolBar *tb = addToolBar( tr ("&Map") );
11.23 + tb->setObjectName ("mapTB");
11.24
11.25 QAction *a;
11.26 a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New..." ),this);
11.27 @@ -452,6 +451,7 @@
11.28 {
11.29 QToolBar *tb = addToolBar( tr ("&Actions") );
11.30 tb->setLabel( "Edit Actions" );
11.31 + tb->setObjectName ("actionsTB");
11.32 QMenu *editMenu = menuBar()->addMenu( tr("&Edit") );
11.33
11.34 QAction *a;
11.35 @@ -864,6 +864,7 @@
11.36 QMenu *formatMenu = menuBar()->addMenu (tr ("F&ormat"));
11.37
11.38 QToolBar *tb = addToolBar( tr("Format Actions","Toolbars"));
11.39 + tb->setObjectName ("formatTB");
11.40 QAction *a;
11.41 QPixmap pix( 16,16);
11.42 pix.fill (Qt::black);
11.43 @@ -990,6 +991,7 @@
11.44 {
11.45 QToolBar *tb = addToolBar( tr("View Actions","Toolbars") );
11.46 tb->setLabel( "View Actions" );
11.47 + tb->setObjectName ("viewTB");
11.48 QMenu *viewMenu = menuBar()->addMenu ( tr( "&View" ));
11.49
11.50 QAction *a;
11.51 @@ -1056,6 +1058,7 @@
11.52 //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
11.53
11.54 QToolBar *tb = addToolBar( tr ("Modes when using modifiers","Toolbars") );
11.55 + tb->setObjectName ("modesTB");
11.56 QAction *a;
11.57 actionGroupModModes=new QActionGroup ( this);
11.58 actionGroupModModes->setExclusive (true);
11.59 @@ -1123,13 +1126,12 @@
11.60
11.61 // Create Standard Flags
11.62 QToolBar *tb=addToolBar (tr ("Standard Flags","Standard Flag Toolbar"));
11.63 - //FIXMEtoolbars.add (tb);
11.64 + tb->setObjectName ("standardFlagTB");
11.65
11.66 standardFlagsDefault = new FlagRowObj ();
11.67 standardFlagsDefault->setVisibility (false);
11.68 standardFlagsDefault->setName ("standardFlagsDef");
11.69 standardFlagsDefault->setToolBar (tb);
11.70 - tb->setObjectName ("standardFlagTB");
11.71
11.72 fo->load(QPixmap(flagsPath+"flag-exclamationmark.png"));
11.73 fo->setName ("exclamationmark");
11.74 @@ -1441,13 +1443,6 @@
11.75 settingsMenu->addAction (a);
11.76 actionSettingsAutoselectText=a;
11.77
11.78 - a= new QAction(tr( "pasting into new branch" ), this );
11.79 - a->setStatusTip( tr( "Pasting into new branch" ));
11.80 - a->setToggleAction(true);
11.81 - a->setOn ( settings.value ("/mapeditor/editmode/newHeadingIsEmpty",true).toBool() );
11.82 - settingsMenu->addAction (a);
11.83 - actionSettingsPasteNewHeading=a;
11.84 -
11.85 a= new QAction( tr( "Delete key" ), this);
11.86 a->setStatusTip( tr( "Delete key for deleting branches" ));
11.87 a->setToggleAction(true);
12.1 --- a/mapeditor.cpp Wed Aug 30 12:16:25 2006 +0000
12.2 +++ b/mapeditor.cpp Thu Aug 31 11:55:33 2006 +0000
12.3 @@ -123,7 +123,6 @@
12.4 extern QAction *actionSettingsAutoedit;
12.5 extern QAction *actionSettingsAutoselectHeading;
12.6 extern QAction *actionSettingsAutoselectText;
12.7 -extern QAction *actionSettingsPasteNewHeading;
12.8 extern QAction *actionSettingsUseFlagGroups;
12.9
12.10 extern QMenu* branchContextMenu;
12.11 @@ -184,14 +183,12 @@
12.12 linkcolorhint=DefaultColor;
12.13 linkstyle=StylePolyParabel;
12.14
12.15 - // Create bitmap cursors, patform dependant
12.16 + // Create bitmap cursors, platform dependant
12.17 #if defined(Q_OS_MACX)
12.18 - handOpenCursor=QCursor ( QPixmap(iconPath+"cursorhandopen16.png") );
12.19 - // set hot spot to tip of picker
12.20 + handOpenCursor=QCursor ( QPixmap(iconPath+"cursorhandopen16.png"),1,1 );
12.21 pickColorCursor=QCursor ( QPixmap (iconPath+"cursorcolorpicker16.png"), 1,15 );
12.22 #else
12.23 - handOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen16.png"));
12.24 - // set hot spot to tip of picker
12.25 + handOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen.png"),1,1);
12.26 pickColorCursor=QCursor ( QPixmap(iconPath+"cursorcolorpicker.png"), 5,27 );
12.27 #endif
12.28
12.29 @@ -465,8 +462,8 @@
12.30 {
12.31 // Save complete map, Undo will replace whole map
12.32 saveState (CompleteMap,
12.33 - NULL, "",
12.34 - NULL, "",
12.35 + "", "",
12.36 + "", "",
12.37 comment,
12.38 mapCenter);
12.39 }
12.40 @@ -474,9 +471,12 @@
12.41 void MapEditor::saveStatePart(LinkableMapObj *undoSel, const QString &comment)
12.42 {
12.43 // save the selected part of the map, Undo will replace part of map
12.44 + QString undoSelection="";
12.45 + if (undoSel) undoSelection=undoSel->getSelectString();
12.46 +
12.47 saveState (PartOfMap,
12.48 - undoSel, "",
12.49 - NULL, "",
12.50 + undoSelection, "",
12.51 + "", "",
12.52 comment,
12.53 undoSel);
12.54 }
12.55 @@ -486,33 +486,63 @@
12.56 // selection does not change during action,
12.57 // so just save commands for undo and redo
12.58 // and use current selection
12.59 +
12.60 + QString sel;
12.61 + if (selection) sel=selection->getSelectString();
12.62 +
12.63 saveState (UndoCommand,
12.64 - selection, uc,
12.65 - selection, rc,
12.66 + sel, uc,
12.67 + sel, rc,
12.68 comment,
12.69 NULL);
12.70 }
12.71
12.72 -void MapEditor::saveStateX(LinkableMapObj *unsel, const QString &uc, const QString &comment)
12.73 +void MapEditor::saveStateComData(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment, LinkableMapObj *saveSel)
12.74 {
12.75 - // TODO Is this still needed?
12.76 + QString redoSelection="";
12.77 + if (redoSel) redoSelection=redoSel->getSelectString();
12.78 + QString undoSelection="";
12.79 + if (undoSel) undoSelection=undoSel->getSelectString();
12.80 +
12.81 saveState (UndoCommand,
12.82 - unsel, uc,
12.83 - NULL, "FIXME-redoCom", //FIXME
12.84 + undoSelection, uc,
12.85 + redoSelection, "FIXME-redoCom", //FIXME
12.86 + comment,
12.87 + saveSel);
12.88 +}
12.89 +
12.90 +void MapEditor::saveState(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment)
12.91 +{
12.92 + // "Normal" savestate: save commands, selections and comment
12.93 + // so just save commands for undo and redo
12.94 + // and use current selection
12.95 +
12.96 + QString redoSelection="";
12.97 + if (redoSel) redoSelection=redoSel->getSelectString();
12.98 + QString undoSelection="";
12.99 + if (undoSel) undoSelection=undoSel->getSelectString();
12.100 +
12.101 + saveState (UndoCommand,
12.102 + undoSelection, uc,
12.103 + redoSelection, rc,
12.104 comment,
12.105 NULL);
12.106 }
12.107
12.108 -void MapEditor::saveStateComData(LinkableMapObj *unSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment, LinkableMapObj *saveSel)
12.109 +void MapEditor::saveState(const QString &undoSel, const QString &uc, const QString &redoSel, const QString &rc, const QString &comment)
12.110 {
12.111 + // "Normal" savestate: save commands, selections and comment
12.112 + // so just save commands for undo and redo
12.113 + // and use current selection
12.114 saveState (UndoCommand,
12.115 - unSel, uc,
12.116 - NULL, "FIXME-redoCom", //FIXME
12.117 + undoSel, uc,
12.118 + redoSel, rc,
12.119 comment,
12.120 - saveSel);
12.121 + NULL);
12.122 }
12.123
12.124 -void MapEditor::saveState(const SaveMode &savemode, LinkableMapObj *undoSel, const QString &undoCom, LinkableMapObj *redoSel, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
12.125 +
12.126 +void MapEditor::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
12.127 {
12.128 // Main saveState
12.129
12.130 @@ -541,16 +571,6 @@
12.131 if (!d.exists())
12.132 makeSubDirs (bakMapDir);
12.133
12.134 - // Save current selection
12.135 - QString redoSelection="";
12.136 - if (redoSel)
12.137 - redoSelection=redoSel->getSelectString();
12.138 -
12.139 - // Save the object, which should be undone
12.140 - QString undoSelection="";
12.141 - if (undoSel)
12.142 - undoSelection=undoSel->getSelectString();
12.143 -
12.144 // Save depending on how much needs to be saved
12.145 if (!saveSel)
12.146 backupXML="";
12.147 @@ -562,7 +582,7 @@
12.148 {
12.149 undoCommand=undoCom;
12.150 }
12.151 - else if (savemode==PartOfMap && undoSel)
12.152 + else if (savemode==PartOfMap )
12.153 {
12.154 undoCommand="undoPart (\""+ undoSelection+"\",\""+bakMapPath+"\")";
12.155 } else
12.156 @@ -630,10 +650,15 @@
12.157 if (api.checkParamCount(1) && selection )
12.158 {
12.159 s=api.parString(ok,0);
12.160 - if (ok)
12.161 - {
12.162 - if (select (s)) deleteSelection();
12.163 - }
12.164 + if (ok &&select (s)) deleteSelection();
12.165 + }
12.166 + }
12.167 + else if (com=="addBranch")
12.168 + {
12.169 + if (api.checkParamCount(1) && selection )
12.170 + {
12.171 + y=api.parInt (ok,0);
12.172 + if (ok ) addNewBranchInt (y);
12.173 }
12.174 }
12.175 else if (com=="linkBranchToPos")
12.176 @@ -642,6 +667,9 @@
12.177 {
12.178 if (api.checkParamCount(4))
12.179 {
12.180 + // 0 selectstring of parent
12.181 + // 1 num in parent (for branches)
12.182 + // 2,3 x,y of mainbranch or mapcenter
12.183 s=api.parString(ok,0);
12.184 LinkableMapObj *dst=mapCenter->findObjBySelect (s);
12.185 if (dst)
12.186 @@ -696,7 +724,12 @@
12.187 if (api.checkParamCount(1) )
12.188 {
12.189 s=api.parString(ok,0);
12.190 - if (ok) ((BranchObj*)selection)->activateStandardFlag(s);
12.191 + if (ok)
12.192 + {
12.193 + BranchObj* bo=(BranchObj*)selection;
12.194 + bo->activateStandardFlag(s);
12.195 + bo->updateFlagsToolbar();
12.196 + }
12.197 }
12.198 }
12.199 }
12.200 @@ -707,7 +740,12 @@
12.201 if (api.checkParamCount(1) )
12.202 {
12.203 s=api.parString(ok,0);
12.204 - if (ok) ((BranchObj*)selection)->deactivateStandardFlag(s);
12.205 + if (ok)
12.206 + {
12.207 + BranchObj* bo=(BranchObj*)selection;
12.208 + bo->deactivateStandardFlag(s);
12.209 + bo->updateFlagsToolbar();
12.210 + }
12.211 }
12.212 }
12.213 }
12.214 @@ -1286,12 +1324,17 @@
12.215 parseAtom (redoCommand);
12.216 mapCenter->reposition();
12.217
12.218 - //if (!redoSelection.isEmpty())
12.219 - // select (redoSelection);
12.220 -
12.221 blockSaveState=false;
12.222 -/* TODO remove testing
12.223 -*/
12.224 +
12.225 + undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
12.226 + undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
12.227 + undoSet.setEntry ("/history/curStep",QString::number(curStep));
12.228 + undoSet.writeSettings(histPath);
12.229 +
12.230 + updateActions();
12.231 +
12.232 + /* TODO remove testing
12.233 +*/
12.234 cout << "ME::redo() end\n";
12.235 cout << " undosAvail="<<undosAvail<<endl;
12.236 cout << " redosAvail="<<redosAvail<<endl;
12.237 @@ -1299,12 +1342,6 @@
12.238 cout << " ---------------------------"<<endl<<endl;
12.239
12.240
12.241 - undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
12.242 - undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
12.243 - undoSet.setEntry ("/history/curStep",QString::number(curStep));
12.244 - undoSet.writeSettings(histPath);
12.245 -
12.246 - updateActions();
12.247 }
12.248
12.249 void MapEditor::undo()
12.250 @@ -1344,16 +1381,9 @@
12.251 parseAtom (undoCommand);
12.252 mapCenter->reposition();
12.253
12.254 - //if (!redoSelection.isEmpty())
12.255 - // select (redoSelection);
12.256 -
12.257 -
12.258 undosAvail--;
12.259 - if (undosAvail<1)
12.260 - // Undo not longer available now
12.261 - actionEditUndo->setEnabled (false);
12.262 - else
12.263 - curStep--; if (curStep<1) curStep=undosTotal;
12.264 + curStep--;
12.265 + if (curStep<1) curStep=undosTotal;
12.266
12.267 redosAvail++;
12.268
12.269 @@ -1367,7 +1397,7 @@
12.270 cout << " ---------------------------"<<endl<<endl;
12.271
12.272 undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
12.273 - undoSet.setEntry ("/history/redosAvail",QString::number(undosAvail));
12.274 + undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
12.275 undoSet.setEntry ("/history/curStep",QString::number(curStep));
12.276 undoSet.writeSettings(histPath);
12.277
12.278 @@ -1470,9 +1500,9 @@
12.279 if (!bo->canMoveBranchUp()) return;
12.280 par=(BranchObj*)(bo->getParObj());
12.281 selection->unselect();
12.282 - selection=par->moveBranchUp (bo);
12.283 + bo=par->moveBranchUp (bo); // bo will be the one below selection
12.284 selection->select();
12.285 - saveStateX(bo,"moveBranchDown ()",QString("Move up %1").arg(getName(bo)));
12.286 + saveState (selection,"moveBranchDown ()",bo,"moveBranchUp ()",QString("Move up %1").arg(getName(bo)));
12.287 mapCenter->reposition();
12.288 ensureSelectionVisible();
12.289 }
12.290 @@ -1488,9 +1518,9 @@
12.291 if (!bo->canMoveBranchDown()) return;
12.292 par=(BranchObj*)(bo->getParObj());
12.293 selection->unselect();
12.294 - selection=par->moveBranchDown(bo);
12.295 + bo=par->moveBranchDown(bo); // bo will be the one above selection
12.296 selection->select();
12.297 - saveStateX(bo,"moveBranchUp ()",QString("Move down %1").arg(getName(bo)));
12.298 + saveState(selection,"moveBranchUp ()",bo,"moveBranchDown ()",QString("Move down %1").arg(getName(bo)));
12.299 mapCenter->reposition();
12.300 ensureSelectionVisible();
12.301 }
12.302 @@ -1573,68 +1603,84 @@
12.303 }
12.304 }
12.305
12.306 -void MapEditor::addNewBranch(int pos)
12.307 +BranchObj* MapEditor::addNewBranchInt(int num)
12.308 {
12.309 + // Depending on pos:
12.310 + // -3 insert in childs of parent above selection
12.311 + // -2 add branch to selection
12.312 + // -1 insert in childs of parent below selection
12.313 + // 0..n insert in childs of parent at pos
12.314 + BranchObj *newbo=NULL;
12.315 if (selection &&
12.316 (typeid(*selection) == typeid(BranchObj) ||
12.317 typeid(*selection) == typeid(MapCenterObj) ) )
12.318 {
12.319 - BranchObj* bo1 = (BranchObj*) selection;
12.320 -
12.321 - bool wasScrolled=false;
12.322 - BranchObj *newbo=NULL;
12.323 - if (pos==0)
12.324 + BranchObj* bo = (BranchObj*) selection;
12.325 + if (num==-2)
12.326 {
12.327 // save scroll state. If scrolled, automatically select
12.328 // new branch in order to tmp unscroll parent...
12.329 - wasScrolled=bo1->isScrolled();
12.330 - newbo=bo1->addBranch();
12.331 - } else
12.332 + return bo->addBranch();
12.333 +
12.334 + }else if (num==-1)
12.335 {
12.336 - BranchObj *parbo=(BranchObj*)(selection->getParObj());
12.337 - if (parbo)
12.338 - {
12.339 - if (pos<0)
12.340 - // add above selection
12.341 - newbo=parbo->insertBranch(bo1->getNum());
12.342 - else
12.343 - // add below selection
12.344 - newbo=parbo->insertBranch(bo1->getNum()+1);
12.345 - } else
12.346 - // This should not happen...
12.347 - // ...but it happens if CTRL-A is pressed on MCO,
12.348 - // ignore it then
12.349 - return;
12.350 - }
12.351 - saveStateX(selection,QString ("delete (\"%1\")").arg(newbo->getSelectString()),QString("Add new branch to %1").arg(getName(bo1))); //TODO undoCommand
12.352 -
12.353 - LinkableMapObj *oldselection=selection;
12.354 -
12.355 - mapCenter->reposition();
12.356 - adjustCanvasSize();
12.357 -
12.358 -
12.359 - if (actionSettingsAutoedit->isOn() ||
12.360 - actionSettingsAutoselectHeading->isOn() )
12.361 + num=bo->getNum()+1;
12.362 + bo=(BranchObj*)bo->getParObj();
12.363 + }else if (num==-3)
12.364 {
12.365 - selection->unselect();
12.366 - selection=newbo;
12.367 - selection->select();
12.368 - if (actionSettingsPasteNewHeading->isOn() )
12.369 - {
12.370 - BranchObj *bo2= (BranchObj*)selection;
12.371 - bo2->setHeading("");
12.372 - }
12.373 - if (actionSettingsAutoedit->isOn() )
12.374 - mainWindow->editHeading();
12.375 - if (!actionSettingsAutoselectHeading->isOn()
12.376 - && !wasScrolled)
12.377 + num=bo->getNum();
12.378 + bo=(BranchObj*)bo->getParObj();
12.379 + }
12.380 + if (!bo) return bo;
12.381 + newbo=bo->insertBranch(num);
12.382 + }
12.383 + return newbo;
12.384 +}
12.385 +
12.386 +void MapEditor::addNewBranch(int pos)
12.387 +{
12.388 + // Different meaning than num in addNewBranchInt!
12.389 + // -1 add above
12.390 + // 0 add as child
12.391 + // +1 add below
12.392 + if (selection &&
12.393 + (typeid(*selection) == typeid(BranchObj) ||
12.394 + typeid(*selection) == typeid(MapCenterObj) ) )
12.395 + {
12.396 + BranchObj *bo = (BranchObj*) selection;
12.397 + BranchObj *newbo;
12.398 + newbo=addNewBranchInt (pos-2);
12.399 +
12.400 + if (newbo)
12.401 + {
12.402 + saveStateConstSelection (
12.403 + QString ("delete (\"%1\")").arg(newbo->getSelectString()),
12.404 + QString ("addBranch (%1)").arg(pos-2),
12.405 + QString ("Add new branch to %1").arg(getName(bo))); //TODO undoCommand
12.406 +
12.407 + LinkableMapObj *oldselection=selection;
12.408 +
12.409 + mapCenter->reposition();
12.410 + adjustCanvasSize();
12.411 +
12.412 +
12.413 + if (actionSettingsAutoedit->isOn() ||
12.414 + actionSettingsAutoselectHeading->isOn() )
12.415 {
12.416 selection->unselect();
12.417 - selection=oldselection;
12.418 + selection=newbo;
12.419 selection->select();
12.420 - }
12.421 - }
12.422 + if (actionSettingsAutoedit->isOn() )
12.423 + mainWindow->editHeading();
12.424 + if (!actionSettingsAutoselectHeading->isOn()
12.425 + )//&& !wasScrolled) //FIXME wasScrolled was moved to addNewBranchInt
12.426 + {
12.427 + selection->unselect();
12.428 + selection=oldselection;
12.429 + selection->select();
12.430 + }
12.431 + }
12.432 + }
12.433 }
12.434 }
12.435
12.436 @@ -1667,11 +1713,6 @@
12.437 selection->unselect();
12.438 selection=newbo;
12.439 selection->select();
12.440 - if (actionSettingsPasteNewHeading->isOn() )
12.441 - {
12.442 - BranchObj *bo2= (BranchObj*)selection;
12.443 - bo2->setHeading("");
12.444 - }
12.445 if (actionSettingsAutoedit->isOn() )
12.446 mainWindow->editHeading();
12.447 if (!actionSettingsAutoselectHeading->isOn()
12.448 @@ -1784,7 +1825,6 @@
12.449
12.450 adjustCanvasSize();
12.451 }
12.452 -
12.453 }
12.454
12.455 void MapEditor::selectNextBranchInt()
12.456 @@ -3606,41 +3646,64 @@
12.457 // Reset the temporary drawn link to the original one
12.458 ((LinkableMapObj*)selection)->unsetParObjTmp();
12.459
12.460 + // For Redo we may need to save original selection
12.461 + QString orgSel=selection->getSelectString();
12.462
12.463 copyingObj=false;
12.464 if (dst )
12.465 {
12.466 - BranchObj* bs=((BranchObj*)selection);
12.467 + BranchObj* bsel=(BranchObj*)selection;
12.468 + BranchObj* bdst=(BranchObj*)dst;
12.469 +
12.470 +
12.471 QString undoCom="linkBranchToPos (\""+
12.472 - (bs->getParObj())->getSelectString()+
12.473 + (bsel->getParObj())->getSelectString()+
12.474 "\","+
12.475 - QString("%1").arg(bs->getNum())+
12.476 + QString("%1").arg(bsel->getNum())+
12.477 ","+
12.478 QString ("%1,%2").arg(movingObj_orgPos.x()).arg(movingObj_orgPos.y())+
12.479 ")";
12.480 - // TODO we also could check, if dest and src are on same branch,
12.481 - // then it would be sufficient to saveState of this branch
12.482
12.483 // Modifiers allow to insert above/below dst
12.484 if (e->state() & Qt::ShiftModifier)
12.485 {
12.486 - bs->moveBranchTo ( (BranchObj*)(dst->getParObj()), ((BranchObj*)(dst))->getNum());
12.487 + bsel->moveBranchTo ( (BranchObj*)(bdst->getParObj()), bdst->getNum());
12.488 } else
12.489 if (e->state() & Qt::ControlModifier)
12.490 {
12.491 - bs->moveBranchTo ( (BranchObj*)(dst->getParObj()), ((BranchObj*)(dst))->getNum()+1);
12.492 + bsel->moveBranchTo ( (BranchObj*)(bdst->getParObj()), bdst->getNum()+1);
12.493 } else
12.494 {
12.495 - bs->moveBranchTo ((BranchObj*)(dst),-1);
12.496 + bsel->moveBranchTo (bdst,-1);
12.497 if (dst->getDepth()==0)
12.498 - bs->move (savePos);
12.499 + bsel->move (savePos);
12.500 }
12.501 - saveStateConstSelection (undoCom,bs->getSelectString(),QString("Relink %1 to %2").arg(getName(bs)).arg(getName(dst)) );
12.502 + QString redoCom="linkBranchToPos (\""+
12.503 + ((BranchObj*)(bsel->getParObj()))->getSelectString()+
12.504 + "\","+
12.505 + QString("%1").arg(bsel->getNum())+
12.506 + ","+
12.507 + QString ("%1,%2").arg(savePos.x()).arg(savePos.y())+
12.508 + ")";
12.509 +
12.510 + saveState (
12.511 + selection->getSelectString(),undoCom,
12.512 + orgSel,redoCom,
12.513 + QString("Relink %1 to %2").arg(getName(bsel)).arg(getName(dst)) );
12.514 } else
12.515 if (selection->getDepth()==1)
12.516 - // If we have moved mainbranch only save endposition
12.517 - saveStateConstSelection("move "+qpointToString(movingObj_orgPos), selection->getSelectString(), QString("Move %1 to %2").arg(getName(selection)).arg(qpointToString(movingObj_orgPos)));
12.518 + {
12.519 + // The select string might be different _after_ moving around.
12.520 + // Therefor reposition and then use string of old selection, too
12.521 + mapCenter->reposition();
12.522 +
12.523 + QString ps=qpointToString ( ((BranchObj*)selection)->getAbsPos() );
12.524 + saveState(
12.525 + selection->getSelectString(), "move "+qpointToString(movingObj_orgPos),
12.526 + orgSel, "move "+ps,
12.527 + QString("Move %1 to %2").arg(getName(selection)).arg(ps));
12.528
12.529 + }
12.530 // Draw the original link, before selection was moved around
12.531 mapCenter->reposition();
12.532 }
13.1 --- a/mapeditor.h Wed Aug 30 12:16:25 2006 +0000
13.2 +++ b/mapeditor.h Thu Aug 31 11:55:33 2006 +0000
13.3 @@ -45,9 +45,10 @@
13.4 void saveStateComplete (const QString &);
13.5 void saveStatePart (LinkableMapObj *, const QString &);
13.6 void saveStateConstSelection (const QString &, const QString &, const QString &);
13.7 - void saveStateX (LinkableMapObj *, const QString &, const QString &);
13.8 void saveStateComData (LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &, LinkableMapObj *);
13.9 - void saveState(const SaveMode&, LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &, LinkableMapObj *);
13.10 + void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
13.11 + void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
13.12 + void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
13.13 void parseAtom(const QString &);
13.14
13.15 void addFloatImage(const QPixmap &img);
13.16 @@ -106,6 +107,7 @@
13.17 void setHeadingInt(const QString &);
13.18 void setURLInt(const QString &); // Just set the URL for selection
13.19 void setVymLinkInt(const QString &); // Set vymLink for selection
13.20 + BranchObj* addNewBranchInt(int); // pos allows to add above/below selection
13.21 public:
13.22 void addNewBranch(int); // pos allows to add above/below selection
13.23 void addNewBranchHere(); // insert and make selection its
13.24 @@ -180,7 +182,8 @@
13.25 void importDir();
13.26 void followXLink (int);
13.27 void editXLink (int);
13.28 - void testFunction(); // FIXME just testing
13.29 + void testFunction(); // just testing new stuff
13.30 + // set /mainwindo/showTestMenu=true...
13.31
13.32 protected:
13.33 void ensureSelectionVisible();
14.1 --- a/ornamentedobj.cpp Wed Aug 30 12:16:25 2006 +0000
14.2 +++ b/ornamentedobj.cpp Thu Aug 31 11:55:33 2006 +0000
14.3 @@ -321,6 +321,11 @@
14.4 }
14.5 }
14.6
14.7 +void OrnamentedObj::updateFlagsToolbar()
14.8 +{
14.9 + standardFlags->updateToolbar();
14.10 +}
14.11 +
14.12 void OrnamentedObj::setHideInExport(bool b)
14.13 {
14.14 if (parObj)
15.1 --- a/ornamentedobj.h Wed Aug 30 12:16:25 2006 +0000
15.2 +++ b/ornamentedobj.h Thu Aug 31 11:55:33 2006 +0000
15.3 @@ -40,6 +40,7 @@
15.4 virtual QString getSystemFlagName (const QPoint &p);
15.5 virtual bool isActiveFlag(const QString&); // check if flag is set
15.6 virtual void updateNoteFlag();
15.7 + virtual void updateFlagsToolbar();
15.8 virtual void setHideInExport(bool); // set export of object (and childs)
15.9 virtual bool hideInExport();
15.10 virtual bool isHidden ();
16.1 --- a/tex/vym.changelog Wed Aug 30 12:16:25 2006 +0000
16.2 +++ b/tex/vym.changelog Thu Aug 31 11:55:33 2006 +0000
16.3 @@ -1,3 +1,8 @@
16.4 +-------------------------------------------------------------------
16.5 +Thu Aug 31 13:54:30 CEST 2006 - uwedr
16.6 +
16.7 +- Bugfix: More undo/redo commands
16.8 +
16.9 -------------------------------------------------------------------
16.10 Wed Aug 30 14:14:56 CEST 2006 - uwedr
16.11
17.1 --- a/texteditor.cpp Wed Aug 30 12:16:25 2006 +0000
17.2 +++ b/texteditor.cpp Thu Aug 31 11:55:33 2006 +0000
17.3 @@ -305,7 +305,7 @@
17.4 actionEditDeleteAll=a;
17.5
17.6 a = new QAction(QPixmap(), tr( "&Convert Paragraphs" ),this);
17.7 - /* FIXME not needed any longer? remove also from docu...
17.8 + /* TODO not needed any longer? remove also from docu...
17.9 a->setStatusTip(tr( "Convert paragraphs to linebreaks" ));
17.10 a->setShortcut( Qt::ALT + Qt::Key_P );
17.11 connect( a, SIGNAL( activated() ), this, SLOT( textConvertPar() ) );
17.12 @@ -314,7 +314,7 @@
17.13 actionEditConvertPar=a;
17.14
17.15 a = new QAction( QPixmap(), tr( "&Join lines" ), this);
17.16 - /* FIXME not needed any longer? remove also from docu...
17.17 + /* TODO not needed any longer? remove also from docu...
17.18 a->setStatusTip(tr( "Join all lines of a paragraph" ) );
17.19 a->setShortcut(Qt::ALT + Qt::Key_J );
17.20 connect( a, SIGNAL( activated() ), this, SLOT( textJoinLines() ) );
17.21 @@ -662,7 +662,7 @@
17.22 t.replace ("</p>","<br />");
17.23 e->setText(t);
17.24
17.25 - /* FIXME QT3 use seletion ()
17.26 + /* TODO QT3 use seletion ()
17.27 int parFrom, parTo, indFrom, indTo;
17.28 e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
17.29 if (parFrom>-1)
17.30 @@ -692,7 +692,7 @@
17.31
17.32 void TextEditor::textJoinLines()
17.33 {
17.34 -/* FIXME QT3
17.35 +/* TODO QT3
17.36 int parFrom, parTo, indFrom, indTo;
17.37 e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
17.38 QString t;
17.39 @@ -879,7 +879,7 @@
17.40
17.41 void TextEditor::textVAlign()
17.42 {
17.43 -/* FIXME QT3
17.44 +/* FIXME QT3 alignment
17.45 if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
17.46 e->setVerticalAlignment( QTextEdit::AlignSuperScript);
17.47 } else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
17.48 @@ -923,7 +923,7 @@
17.49
17.50 void TextEditor::verticalAlignmentChanged(int a)
17.51 {
17.52 - /* FIXME QT3
17.53 + /* FIXME QT3 alignment
17.54 if (a == QTextEdit::AlignSuperScript ) {
17.55 actionAlignSuperScript->setOn(true);
17.56 actionAlignSubScript->setOn(false);
18.1 --- a/version.h Wed Aug 30 12:16:25 2006 +0000
18.2 +++ b/version.h Thu Aug 31 11:55:33 2006 +0000
18.3 @@ -3,6 +3,6 @@
18.4
18.5 #define __VYM "VYM"
18.6 #define __VYM_VERSION "1.8.54"
18.7 -#define __BUILD_DATE "August 30, 2006"
18.8 +#define __BUILD_DATE "August 31, 2006"
18.9
18.10 #endif