# HG changeset patch
# User insilmaril
# Date 1157025333 0
# Node ID 70c41284cb48536d53367ef12573954e9716b9dc
# Parent 557239819c4584990e2655a82474233914ad95cf
More undo/redo commands. Undo debug output still enabled
diff -r 557239819c45 -r 70c41284cb48 api.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/api.cpp Thu Aug 31 11:55:33 2006 +0000
@@ -0,0 +1,147 @@
+#include "api.h"
+
+#include
+
+API::API()
+{
+ initCommand();
+}
+
+void API::initCommand()
+{
+ com="";
+ paramList.clear();
+ errorString="";
+ noErr=true;
+}
+
+void API::parseCommand (const QString &s)
+{
+ initCommand();
+ QRegExp re;
+ int pos;
+
+ // Get command
+ re.setPattern ("(.*)\\s");
+ re.setMinimal (true);
+ pos=re.search (s);
+ if (pos>=0)
+ com=re.cap(1);
+
+ // Get parameters
+ paramList.clear();
+ re.setPattern ("\\((.*)\\)");
+ pos=re.search (s);
+ if (pos>=0)
+ {
+ QString s=re.cap(1);
+ QString a;
+ bool inquote=false;
+ pos=0;
+ if (!s.isEmpty())
+ {
+ while (pos paramList.count())
+ {
+ errorString =QString("Parameter index %1 is outside of parameter list").arg(index);
+ noErr=false;
+ } else
+ {
+ paramList[index].toInt (&ok, 10);
+ if (!ok)
+ {
+ errorString=QString("Parameter %1 is not an integer").arg(index);
+ noErr=false;
+ } else
+ noErr=true;
+ }
+ return noErr;
+}
+
+int API::parInt (bool &ok,const uint &index)
+{
+ if (checkParamIsInt (index))
+ return paramList[index].toInt (&ok, 10);
+ ok=false;
+ return 0;
+}
+
+QString API::parString (bool &ok,const uint &index)
+{
+ // return the string at index, this could be also stored in
+ // a variable later
+ QString r;
+ QRegExp re("\"(.*)\"");
+ int pos=re.search (paramList[index]);
+ if (pos>=0)
+ r=re.cap (1);
+ else
+ r="";
+ ok=true;
+ return r;
+}
diff -r 557239819c45 -r 70c41284cb48 branchobj.cpp
--- a/branchobj.cpp Wed Aug 30 12:16:25 2006 +0000
+++ b/branchobj.cpp Thu Aug 31 11:55:33 2006 +0000
@@ -812,7 +812,6 @@
// Save XLinks
XLinkObj *xlo;
- //FIXME exponential increase in xlinks...
QString ol; // old link
QString cl; // current link
for (xlo=xlink.first(); xlo; xlo=xlink.next() )
@@ -882,7 +881,6 @@
calcBBoxSize();
positionBBox();
requestReposition();
- //FIXME undo needed
}
bool BranchObj::getIncludeImagesVer()
@@ -896,7 +894,6 @@
calcBBoxSize();
positionBBox();
requestReposition();
- //FIXME undo needed
}
bool BranchObj::getIncludeImagesHor()
@@ -930,7 +927,6 @@
positionBBox();
requestReposition();
return newfi;
- //FIXME undo needed
}
LinkableMapObj* BranchObj::addFloatImage (FloatImageObj *fio)
@@ -946,7 +942,6 @@
positionBBox();
requestReposition();
return newfi;
- // FIMXE undo needed
}
FloatImageObj* BranchObj::getFirstFloatImage ()
@@ -1155,7 +1150,7 @@
bool BranchObj::canMoveBranchUp()
{
- if (!parObj) return false;
+ if (!parObj || depth==1) return false;
BranchObj* par=(BranchObj*)parObj;
if (this==par->getFirstBranch())
return false;
@@ -1163,23 +1158,24 @@
return true;
}
-BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // move a branch up (modify myself)
+BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // modify my childlist
{
savePosInAngle();
int i=branch.find(bo1);
+ cout << "BO: i="<0)
{ // -1 if bo1 not found
branch.at(i)->angle--;
branch.at(i-1)->angle++;
branch.sort();
- return branch.at(i-1);
+ return branch.at(i);
} else
- return branch.at(i);
+ return NULL;
}
bool BranchObj::canMoveBranchDown()
{
- if (!parObj) return false;
+ if (!parObj|| depth==1) return false;
BranchObj* par=(BranchObj*)parObj;
if (this==par->getLastBranch())
return false;
@@ -1187,7 +1183,7 @@
return true;
}
-BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)
+BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// modify my childlist
{
savePosInAngle();
int i=branch.find(bo1);
@@ -1198,9 +1194,9 @@
branch.at(i)->angle++;
branch.at(j)->angle--;
branch.sort();
- return branch.at(j);
+ return branch.at(i);
} else
- return branch.at(i);
+ return NULL;
}
BranchObj* BranchObj::moveBranchTo (BranchObj* dst, int pos)
@@ -1253,7 +1249,7 @@
// If I am the mapcenter or a mainbranch, reposition heading
if (depth<2)
- { //FIXME ugly! optimize this move for MCO needed to initially position text in box...
+ {
if (depth==1)
// Calc angle to mapCenter if I am a mainbranch
// needed for reordering the mainbranches clockwise
@@ -1452,7 +1448,7 @@
if (!status.isEmpty()) mainWindow->statusMessage (status);
// Update Toolbar
- standardFlags->updateToolbar();
+ updateFlagsToolbar();
// Update actions in mapeditor
mapEditor->updateActions();
diff -r 557239819c45 -r 70c41284cb48 demos/todo.vym
Binary file demos/todo.vym has changed
diff -r 557239819c45 -r 70c41284cb48 exports.cpp
--- a/exports.cpp Wed Aug 30 12:16:25 2006 +0000
+++ b/exports.cpp Thu Aug 31 11:55:33 2006 +0000
@@ -120,7 +120,6 @@
QFile file (outputFile);
if ( !file.open( QIODevice::WriteOnly ) )
{
- // FIXME experimental, testing
qWarning ("ExportBase::exportXML couldn't open "+outputFile);
return;
}
diff -r 557239819c45 -r 70c41284cb48 icons/cursor.xcf
Binary file icons/cursor.xcf has changed
diff -r 557239819c45 -r 70c41284cb48 icons/cursor16.xcf
Binary file icons/cursor16.xcf has changed
diff -r 557239819c45 -r 70c41284cb48 icons/cursorcolorpicker.png
Binary file icons/cursorcolorpicker.png has changed
diff -r 557239819c45 -r 70c41284cb48 icons/cursorhandopen.png
Binary file icons/cursorhandopen.png has changed
diff -r 557239819c45 -r 70c41284cb48 icons/cursorhandopen16.png
Binary file icons/cursorhandopen16.png has changed
diff -r 557239819c45 -r 70c41284cb48 main.cpp
--- a/main.cpp Wed Aug 30 12:16:25 2006 +0000
+++ b/main.cpp Thu Aug 31 11:55:33 2006 +0000
@@ -103,7 +103,6 @@
QAction *actionSettingsAutoselectHeading;
QAction *actionSettingsAutoselectText;
-QAction *actionSettingsPasteNewHeading;
QAction *actionSettingsAutoedit;
QAction *actionSettingsUseDelKey;
QAction *actionSettingsUseFlagGroups;
@@ -152,7 +151,7 @@
"http://www.InSilmaril.de/vym\n");
if (options.parse())
{
-//FIXME QT3 cout << endl << options.getHelpText()<isOn() );
settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoselectText->isOn() );
- settings.setValue( "/mapeditor/editmode/pasteNewHeading",actionSettingsPasteNewHeading->isOn() );
settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoedit->isOn() );
settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
@@ -321,6 +319,7 @@
{
QMenu *fileMenu = menuBar()->addMenu ( tr ("&Map") );
QToolBar *tb = addToolBar( tr ("&Map") );
+ tb->setObjectName ("mapTB");
QAction *a;
a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New..." ),this);
@@ -452,6 +451,7 @@
{
QToolBar *tb = addToolBar( tr ("&Actions") );
tb->setLabel( "Edit Actions" );
+ tb->setObjectName ("actionsTB");
QMenu *editMenu = menuBar()->addMenu( tr("&Edit") );
QAction *a;
@@ -864,6 +864,7 @@
QMenu *formatMenu = menuBar()->addMenu (tr ("F&ormat"));
QToolBar *tb = addToolBar( tr("Format Actions","Toolbars"));
+ tb->setObjectName ("formatTB");
QAction *a;
QPixmap pix( 16,16);
pix.fill (Qt::black);
@@ -990,6 +991,7 @@
{
QToolBar *tb = addToolBar( tr("View Actions","Toolbars") );
tb->setLabel( "View Actions" );
+ tb->setObjectName ("viewTB");
QMenu *viewMenu = menuBar()->addMenu ( tr( "&View" ));
QAction *a;
@@ -1056,6 +1058,7 @@
//menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
QToolBar *tb = addToolBar( tr ("Modes when using modifiers","Toolbars") );
+ tb->setObjectName ("modesTB");
QAction *a;
actionGroupModModes=new QActionGroup ( this);
actionGroupModModes->setExclusive (true);
@@ -1123,13 +1126,12 @@
// Create Standard Flags
QToolBar *tb=addToolBar (tr ("Standard Flags","Standard Flag Toolbar"));
- //FIXMEtoolbars.add (tb);
+ tb->setObjectName ("standardFlagTB");
standardFlagsDefault = new FlagRowObj ();
standardFlagsDefault->setVisibility (false);
standardFlagsDefault->setName ("standardFlagsDef");
standardFlagsDefault->setToolBar (tb);
- tb->setObjectName ("standardFlagTB");
fo->load(QPixmap(flagsPath+"flag-exclamationmark.png"));
fo->setName ("exclamationmark");
@@ -1441,13 +1443,6 @@
settingsMenu->addAction (a);
actionSettingsAutoselectText=a;
- a= new QAction(tr( "pasting into new branch" ), this );
- a->setStatusTip( tr( "Pasting into new branch" ));
- a->setToggleAction(true);
- a->setOn ( settings.value ("/mapeditor/editmode/newHeadingIsEmpty",true).toBool() );
- settingsMenu->addAction (a);
- actionSettingsPasteNewHeading=a;
-
a= new QAction( tr( "Delete key" ), this);
a->setStatusTip( tr( "Delete key for deleting branches" ));
a->setToggleAction(true);
diff -r 557239819c45 -r 70c41284cb48 mapeditor.cpp
--- a/mapeditor.cpp Wed Aug 30 12:16:25 2006 +0000
+++ b/mapeditor.cpp Thu Aug 31 11:55:33 2006 +0000
@@ -123,7 +123,6 @@
extern QAction *actionSettingsAutoedit;
extern QAction *actionSettingsAutoselectHeading;
extern QAction *actionSettingsAutoselectText;
-extern QAction *actionSettingsPasteNewHeading;
extern QAction *actionSettingsUseFlagGroups;
extern QMenu* branchContextMenu;
@@ -184,14 +183,12 @@
linkcolorhint=DefaultColor;
linkstyle=StylePolyParabel;
- // Create bitmap cursors, patform dependant
+ // Create bitmap cursors, platform dependant
#if defined(Q_OS_MACX)
- handOpenCursor=QCursor ( QPixmap(iconPath+"cursorhandopen16.png") );
- // set hot spot to tip of picker
+ handOpenCursor=QCursor ( QPixmap(iconPath+"cursorhandopen16.png"),1,1 );
pickColorCursor=QCursor ( QPixmap (iconPath+"cursorcolorpicker16.png"), 1,15 );
#else
- handOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen16.png"));
- // set hot spot to tip of picker
+ handOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen.png"),1,1);
pickColorCursor=QCursor ( QPixmap(iconPath+"cursorcolorpicker.png"), 5,27 );
#endif
@@ -465,8 +462,8 @@
{
// Save complete map, Undo will replace whole map
saveState (CompleteMap,
- NULL, "",
- NULL, "",
+ "", "",
+ "", "",
comment,
mapCenter);
}
@@ -474,9 +471,12 @@
void MapEditor::saveStatePart(LinkableMapObj *undoSel, const QString &comment)
{
// save the selected part of the map, Undo will replace part of map
+ QString undoSelection="";
+ if (undoSel) undoSelection=undoSel->getSelectString();
+
saveState (PartOfMap,
- undoSel, "",
- NULL, "",
+ undoSelection, "",
+ "", "",
comment,
undoSel);
}
@@ -486,33 +486,63 @@
// selection does not change during action,
// so just save commands for undo and redo
// and use current selection
+
+ QString sel;
+ if (selection) sel=selection->getSelectString();
+
saveState (UndoCommand,
- selection, uc,
- selection, rc,
+ sel, uc,
+ sel, rc,
comment,
NULL);
}
-void MapEditor::saveStateX(LinkableMapObj *unsel, const QString &uc, const QString &comment)
+void MapEditor::saveStateComData(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment, LinkableMapObj *saveSel)
{
- // TODO Is this still needed?
+ QString redoSelection="";
+ if (redoSel) redoSelection=redoSel->getSelectString();
+ QString undoSelection="";
+ if (undoSel) undoSelection=undoSel->getSelectString();
+
saveState (UndoCommand,
- unsel, uc,
- NULL, "FIXME-redoCom", //FIXME
+ undoSelection, uc,
+ redoSelection, "FIXME-redoCom", //FIXME
+ comment,
+ saveSel);
+}
+
+void MapEditor::saveState(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment)
+{
+ // "Normal" savestate: save commands, selections and comment
+ // so just save commands for undo and redo
+ // and use current selection
+
+ QString redoSelection="";
+ if (redoSel) redoSelection=redoSel->getSelectString();
+ QString undoSelection="";
+ if (undoSel) undoSelection=undoSel->getSelectString();
+
+ saveState (UndoCommand,
+ undoSelection, uc,
+ redoSelection, rc,
comment,
NULL);
}
-void MapEditor::saveStateComData(LinkableMapObj *unSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment, LinkableMapObj *saveSel)
+void MapEditor::saveState(const QString &undoSel, const QString &uc, const QString &redoSel, const QString &rc, const QString &comment)
{
+ // "Normal" savestate: save commands, selections and comment
+ // so just save commands for undo and redo
+ // and use current selection
saveState (UndoCommand,
- unSel, uc,
- NULL, "FIXME-redoCom", //FIXME
+ undoSel, uc,
+ redoSel, rc,
comment,
- saveSel);
+ NULL);
}
-void MapEditor::saveState(const SaveMode &savemode, LinkableMapObj *undoSel, const QString &undoCom, LinkableMapObj *redoSel, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
+
+void MapEditor::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
{
// Main saveState
@@ -541,16 +571,6 @@
if (!d.exists())
makeSubDirs (bakMapDir);
- // Save current selection
- QString redoSelection="";
- if (redoSel)
- redoSelection=redoSel->getSelectString();
-
- // Save the object, which should be undone
- QString undoSelection="";
- if (undoSel)
- undoSelection=undoSel->getSelectString();
-
// Save depending on how much needs to be saved
if (!saveSel)
backupXML="";
@@ -562,7 +582,7 @@
{
undoCommand=undoCom;
}
- else if (savemode==PartOfMap && undoSel)
+ else if (savemode==PartOfMap )
{
undoCommand="undoPart (\""+ undoSelection+"\",\""+bakMapPath+"\")";
} else
@@ -630,10 +650,15 @@
if (api.checkParamCount(1) && selection )
{
s=api.parString(ok,0);
- if (ok)
- {
- if (select (s)) deleteSelection();
- }
+ if (ok &&select (s)) deleteSelection();
+ }
+ }
+ else if (com=="addBranch")
+ {
+ if (api.checkParamCount(1) && selection )
+ {
+ y=api.parInt (ok,0);
+ if (ok ) addNewBranchInt (y);
}
}
else if (com=="linkBranchToPos")
@@ -642,6 +667,9 @@
{
if (api.checkParamCount(4))
{
+ // 0 selectstring of parent
+ // 1 num in parent (for branches)
+ // 2,3 x,y of mainbranch or mapcenter
s=api.parString(ok,0);
LinkableMapObj *dst=mapCenter->findObjBySelect (s);
if (dst)
@@ -696,7 +724,12 @@
if (api.checkParamCount(1) )
{
s=api.parString(ok,0);
- if (ok) ((BranchObj*)selection)->activateStandardFlag(s);
+ if (ok)
+ {
+ BranchObj* bo=(BranchObj*)selection;
+ bo->activateStandardFlag(s);
+ bo->updateFlagsToolbar();
+ }
}
}
}
@@ -707,7 +740,12 @@
if (api.checkParamCount(1) )
{
s=api.parString(ok,0);
- if (ok) ((BranchObj*)selection)->deactivateStandardFlag(s);
+ if (ok)
+ {
+ BranchObj* bo=(BranchObj*)selection;
+ bo->deactivateStandardFlag(s);
+ bo->updateFlagsToolbar();
+ }
}
}
}
@@ -1286,12 +1324,17 @@
parseAtom (redoCommand);
mapCenter->reposition();
- //if (!redoSelection.isEmpty())
- // select (redoSelection);
-
blockSaveState=false;
-/* TODO remove testing
-*/
+
+ undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
+ undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
+ undoSet.setEntry ("/history/curStep",QString::number(curStep));
+ undoSet.writeSettings(histPath);
+
+ updateActions();
+
+ /* TODO remove testing
+*/
cout << "ME::redo() end\n";
cout << " undosAvail="<reposition();
- //if (!redoSelection.isEmpty())
- // select (redoSelection);
-
-
undosAvail--;
- if (undosAvail<1)
- // Undo not longer available now
- actionEditUndo->setEnabled (false);
- else
- curStep--; if (curStep<1) curStep=undosTotal;
+ curStep--;
+ if (curStep<1) curStep=undosTotal;
redosAvail++;
@@ -1367,7 +1397,7 @@
cout << " ---------------------------"<canMoveBranchUp()) return;
par=(BranchObj*)(bo->getParObj());
selection->unselect();
- selection=par->moveBranchUp (bo);
+ bo=par->moveBranchUp (bo); // bo will be the one below selection
selection->select();
- saveStateX(bo,"moveBranchDown ()",QString("Move up %1").arg(getName(bo)));
+ saveState (selection,"moveBranchDown ()",bo,"moveBranchUp ()",QString("Move up %1").arg(getName(bo)));
mapCenter->reposition();
ensureSelectionVisible();
}
@@ -1488,9 +1518,9 @@
if (!bo->canMoveBranchDown()) return;
par=(BranchObj*)(bo->getParObj());
selection->unselect();
- selection=par->moveBranchDown(bo);
+ bo=par->moveBranchDown(bo); // bo will be the one above selection
selection->select();
- saveStateX(bo,"moveBranchUp ()",QString("Move down %1").arg(getName(bo)));
+ saveState(selection,"moveBranchUp ()",bo,"moveBranchDown ()",QString("Move down %1").arg(getName(bo)));
mapCenter->reposition();
ensureSelectionVisible();
}
@@ -1573,68 +1603,84 @@
}
}
-void MapEditor::addNewBranch(int pos)
+BranchObj* MapEditor::addNewBranchInt(int num)
{
+ // Depending on pos:
+ // -3 insert in childs of parent above selection
+ // -2 add branch to selection
+ // -1 insert in childs of parent below selection
+ // 0..n insert in childs of parent at pos
+ BranchObj *newbo=NULL;
if (selection &&
(typeid(*selection) == typeid(BranchObj) ||
typeid(*selection) == typeid(MapCenterObj) ) )
{
- BranchObj* bo1 = (BranchObj*) selection;
-
- bool wasScrolled=false;
- BranchObj *newbo=NULL;
- if (pos==0)
+ BranchObj* bo = (BranchObj*) selection;
+ if (num==-2)
{
// save scroll state. If scrolled, automatically select
// new branch in order to tmp unscroll parent...
- wasScrolled=bo1->isScrolled();
- newbo=bo1->addBranch();
- } else
+ return bo->addBranch();
+
+ }else if (num==-1)
{
- BranchObj *parbo=(BranchObj*)(selection->getParObj());
- if (parbo)
- {
- if (pos<0)
- // add above selection
- newbo=parbo->insertBranch(bo1->getNum());
- else
- // add below selection
- newbo=parbo->insertBranch(bo1->getNum()+1);
- } else
- // This should not happen...
- // ...but it happens if CTRL-A is pressed on MCO,
- // ignore it then
- return;
- }
- saveStateX(selection,QString ("delete (\"%1\")").arg(newbo->getSelectString()),QString("Add new branch to %1").arg(getName(bo1))); //TODO undoCommand
-
- LinkableMapObj *oldselection=selection;
-
- mapCenter->reposition();
- adjustCanvasSize();
-
-
- if (actionSettingsAutoedit->isOn() ||
- actionSettingsAutoselectHeading->isOn() )
+ num=bo->getNum()+1;
+ bo=(BranchObj*)bo->getParObj();
+ }else if (num==-3)
{
- selection->unselect();
- selection=newbo;
- selection->select();
- if (actionSettingsPasteNewHeading->isOn() )
- {
- BranchObj *bo2= (BranchObj*)selection;
- bo2->setHeading("");
- }
- if (actionSettingsAutoedit->isOn() )
- mainWindow->editHeading();
- if (!actionSettingsAutoselectHeading->isOn()
- && !wasScrolled)
+ num=bo->getNum();
+ bo=(BranchObj*)bo->getParObj();
+ }
+ if (!bo) return bo;
+ newbo=bo->insertBranch(num);
+ }
+ return newbo;
+}
+
+void MapEditor::addNewBranch(int pos)
+{
+ // Different meaning than num in addNewBranchInt!
+ // -1 add above
+ // 0 add as child
+ // +1 add below
+ if (selection &&
+ (typeid(*selection) == typeid(BranchObj) ||
+ typeid(*selection) == typeid(MapCenterObj) ) )
+ {
+ BranchObj *bo = (BranchObj*) selection;
+ BranchObj *newbo;
+ newbo=addNewBranchInt (pos-2);
+
+ if (newbo)
+ {
+ saveStateConstSelection (
+ QString ("delete (\"%1\")").arg(newbo->getSelectString()),
+ QString ("addBranch (%1)").arg(pos-2),
+ QString ("Add new branch to %1").arg(getName(bo))); //TODO undoCommand
+
+ LinkableMapObj *oldselection=selection;
+
+ mapCenter->reposition();
+ adjustCanvasSize();
+
+
+ if (actionSettingsAutoedit->isOn() ||
+ actionSettingsAutoselectHeading->isOn() )
{
selection->unselect();
- selection=oldselection;
+ selection=newbo;
selection->select();
- }
- }
+ if (actionSettingsAutoedit->isOn() )
+ mainWindow->editHeading();
+ if (!actionSettingsAutoselectHeading->isOn()
+ )//&& !wasScrolled) //FIXME wasScrolled was moved to addNewBranchInt
+ {
+ selection->unselect();
+ selection=oldselection;
+ selection->select();
+ }
+ }
+ }
}
}
@@ -1667,11 +1713,6 @@
selection->unselect();
selection=newbo;
selection->select();
- if (actionSettingsPasteNewHeading->isOn() )
- {
- BranchObj *bo2= (BranchObj*)selection;
- bo2->setHeading("");
- }
if (actionSettingsAutoedit->isOn() )
mainWindow->editHeading();
if (!actionSettingsAutoselectHeading->isOn()
@@ -1784,7 +1825,6 @@
adjustCanvasSize();
}
-
}
void MapEditor::selectNextBranchInt()
@@ -3606,41 +3646,64 @@
// Reset the temporary drawn link to the original one
((LinkableMapObj*)selection)->unsetParObjTmp();
+ // For Redo we may need to save original selection
+ QString orgSel=selection->getSelectString();
copyingObj=false;
if (dst )
{
- BranchObj* bs=((BranchObj*)selection);
+ BranchObj* bsel=(BranchObj*)selection;
+ BranchObj* bdst=(BranchObj*)dst;
+
+
QString undoCom="linkBranchToPos (\""+
- (bs->getParObj())->getSelectString()+
+ (bsel->getParObj())->getSelectString()+
"\","+
- QString("%1").arg(bs->getNum())+
+ QString("%1").arg(bsel->getNum())+
","+
QString ("%1,%2").arg(movingObj_orgPos.x()).arg(movingObj_orgPos.y())+
")";
- // TODO we also could check, if dest and src are on same branch,
- // then it would be sufficient to saveState of this branch
// Modifiers allow to insert above/below dst
if (e->state() & Qt::ShiftModifier)
{
- bs->moveBranchTo ( (BranchObj*)(dst->getParObj()), ((BranchObj*)(dst))->getNum());
+ bsel->moveBranchTo ( (BranchObj*)(bdst->getParObj()), bdst->getNum());
} else
if (e->state() & Qt::ControlModifier)
{
- bs->moveBranchTo ( (BranchObj*)(dst->getParObj()), ((BranchObj*)(dst))->getNum()+1);
+ bsel->moveBranchTo ( (BranchObj*)(bdst->getParObj()), bdst->getNum()+1);
} else
{
- bs->moveBranchTo ((BranchObj*)(dst),-1);
+ bsel->moveBranchTo (bdst,-1);
if (dst->getDepth()==0)
- bs->move (savePos);
+ bsel->move (savePos);
}
- saveStateConstSelection (undoCom,bs->getSelectString(),QString("Relink %1 to %2").arg(getName(bs)).arg(getName(dst)) );
+ QString redoCom="linkBranchToPos (\""+
+ ((BranchObj*)(bsel->getParObj()))->getSelectString()+
+ "\","+
+ QString("%1").arg(bsel->getNum())+
+ ","+
+ QString ("%1,%2").arg(savePos.x()).arg(savePos.y())+
+ ")";
+
+ saveState (
+ selection->getSelectString(),undoCom,
+ orgSel,redoCom,
+ QString("Relink %1 to %2").arg(getName(bsel)).arg(getName(dst)) );
} else
if (selection->getDepth()==1)
- // If we have moved mainbranch only save endposition
- saveStateConstSelection("move "+qpointToString(movingObj_orgPos), selection->getSelectString(), QString("Move %1 to %2").arg(getName(selection)).arg(qpointToString(movingObj_orgPos)));
+ {
+ // The select string might be different _after_ moving around.
+ // Therefor reposition and then use string of old selection, too
+ mapCenter->reposition();
+
+ QString ps=qpointToString ( ((BranchObj*)selection)->getAbsPos() );
+ saveState(
+ selection->getSelectString(), "move "+qpointToString(movingObj_orgPos),
+ orgSel, "move "+ps,
+ QString("Move %1 to %2").arg(getName(selection)).arg(ps));
+ }
// Draw the original link, before selection was moved around
mapCenter->reposition();
}
diff -r 557239819c45 -r 70c41284cb48 mapeditor.h
--- a/mapeditor.h Wed Aug 30 12:16:25 2006 +0000
+++ b/mapeditor.h Thu Aug 31 11:55:33 2006 +0000
@@ -45,9 +45,10 @@
void saveStateComplete (const QString &);
void saveStatePart (LinkableMapObj *, const QString &);
void saveStateConstSelection (const QString &, const QString &, const QString &);
- void saveStateX (LinkableMapObj *, const QString &, const QString &);
void saveStateComData (LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &, LinkableMapObj *);
- void saveState(const SaveMode&, LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &, LinkableMapObj *);
+ void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
+ void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
+ void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
void parseAtom(const QString &);
void addFloatImage(const QPixmap &img);
@@ -106,6 +107,7 @@
void setHeadingInt(const QString &);
void setURLInt(const QString &); // Just set the URL for selection
void setVymLinkInt(const QString &); // Set vymLink for selection
+ BranchObj* addNewBranchInt(int); // pos allows to add above/below selection
public:
void addNewBranch(int); // pos allows to add above/below selection
void addNewBranchHere(); // insert and make selection its
@@ -180,7 +182,8 @@
void importDir();
void followXLink (int);
void editXLink (int);
- void testFunction(); // FIXME just testing
+ void testFunction(); // just testing new stuff
+ // set /mainwindo/showTestMenu=true...
protected:
void ensureSelectionVisible();
diff -r 557239819c45 -r 70c41284cb48 ornamentedobj.cpp
--- a/ornamentedobj.cpp Wed Aug 30 12:16:25 2006 +0000
+++ b/ornamentedobj.cpp Thu Aug 31 11:55:33 2006 +0000
@@ -321,6 +321,11 @@
}
}
+void OrnamentedObj::updateFlagsToolbar()
+{
+ standardFlags->updateToolbar();
+}
+
void OrnamentedObj::setHideInExport(bool b)
{
if (parObj)
diff -r 557239819c45 -r 70c41284cb48 ornamentedobj.h
--- a/ornamentedobj.h Wed Aug 30 12:16:25 2006 +0000
+++ b/ornamentedobj.h Thu Aug 31 11:55:33 2006 +0000
@@ -40,6 +40,7 @@
virtual QString getSystemFlagName (const QPoint &p);
virtual bool isActiveFlag(const QString&); // check if flag is set
virtual void updateNoteFlag();
+ virtual void updateFlagsToolbar();
virtual void setHideInExport(bool); // set export of object (and childs)
virtual bool hideInExport();
virtual bool isHidden ();
diff -r 557239819c45 -r 70c41284cb48 tex/vym.changelog
--- a/tex/vym.changelog Wed Aug 30 12:16:25 2006 +0000
+++ b/tex/vym.changelog Thu Aug 31 11:55:33 2006 +0000
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Thu Aug 31 13:54:30 CEST 2006 - uwedr
+
+- Bugfix: More undo/redo commands
+
-------------------------------------------------------------------
Wed Aug 30 14:14:56 CEST 2006 - uwedr
diff -r 557239819c45 -r 70c41284cb48 texteditor.cpp
--- a/texteditor.cpp Wed Aug 30 12:16:25 2006 +0000
+++ b/texteditor.cpp Thu Aug 31 11:55:33 2006 +0000
@@ -305,7 +305,7 @@
actionEditDeleteAll=a;
a = new QAction(QPixmap(), tr( "&Convert Paragraphs" ),this);
- /* FIXME not needed any longer? remove also from docu...
+ /* TODO not needed any longer? remove also from docu...
a->setStatusTip(tr( "Convert paragraphs to linebreaks" ));
a->setShortcut( Qt::ALT + Qt::Key_P );
connect( a, SIGNAL( activated() ), this, SLOT( textConvertPar() ) );
@@ -314,7 +314,7 @@
actionEditConvertPar=a;
a = new QAction( QPixmap(), tr( "&Join lines" ), this);
- /* FIXME not needed any longer? remove also from docu...
+ /* TODO not needed any longer? remove also from docu...
a->setStatusTip(tr( "Join all lines of a paragraph" ) );
a->setShortcut(Qt::ALT + Qt::Key_J );
connect( a, SIGNAL( activated() ), this, SLOT( textJoinLines() ) );
@@ -662,7 +662,7 @@
t.replace ("
","
");
e->setText(t);
- /* FIXME QT3 use seletion ()
+ /* TODO QT3 use seletion ()
int parFrom, parTo, indFrom, indTo;
e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
if (parFrom>-1)
@@ -692,7 +692,7 @@
void TextEditor::textJoinLines()
{
-/* FIXME QT3
+/* TODO QT3
int parFrom, parTo, indFrom, indTo;
e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
QString t;
@@ -879,7 +879,7 @@
void TextEditor::textVAlign()
{
-/* FIXME QT3
+/* FIXME QT3 alignment
if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
e->setVerticalAlignment( QTextEdit::AlignSuperScript);
} else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
@@ -923,7 +923,7 @@
void TextEditor::verticalAlignmentChanged(int a)
{
- /* FIXME QT3
+ /* FIXME QT3 alignment
if (a == QTextEdit::AlignSuperScript ) {
actionAlignSuperScript->setOn(true);
actionAlignSubScript->setOn(false);
diff -r 557239819c45 -r 70c41284cb48 version.h
--- a/version.h Wed Aug 30 12:16:25 2006 +0000
+++ b/version.h Thu Aug 31 11:55:33 2006 +0000
@@ -3,6 +3,6 @@
#define __VYM "VYM"
#define __VYM_VERSION "1.8.54"
-#define __BUILD_DATE "August 30, 2006"
+#define __BUILD_DATE "August 31, 2006"
#endif