X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fundo.cpp;h=441545505dec02f7b9778b17370cc2a8285ab807;hb=e1d1cacbb43055988d0d9db632fdf05c0bea9543;hp=703449320e813cc0d2c9332eb444cbbe072e9966;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/undo.cpp b/src/base/undo.cpp index 7034493..4415455 100644 --- a/src/base/undo.cpp +++ b/src/base/undo.cpp @@ -22,7 +22,7 @@ /** * Default constructor. */ -RS_Undo::RS_Undo() +Undo::Undo() { #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // undoList.setAutoDelete(true); @@ -30,7 +30,7 @@ RS_Undo::RS_Undo() currentCycle = NULL; } -/*virtual*/ RS_Undo::~RS_Undo() +/*virtual*/ Undo::~Undo() { while (!undoList.isEmpty()) delete undoList.takeFirst(); @@ -39,9 +39,9 @@ RS_Undo::RS_Undo() /** * @return Number of Cycles that can be undone. */ -int RS_Undo::countUndoCycles() +int Undo::countUndoCycles() { - RS_DEBUG->print("RS_Undo::countUndoCycles"); + DEBUG->print("Undo::countUndoCycles"); return undoPointer + 1; } @@ -49,9 +49,9 @@ int RS_Undo::countUndoCycles() /** * @return Number of Cycles that can be redone. */ -int RS_Undo::countRedoCycles() +int Undo::countRedoCycles() { - RS_DEBUG->print("RS_Undo::countRedoCycles"); + DEBUG->print("Undo::countRedoCycles"); return (int)undoList.count() - 1 - undoPointer; } @@ -61,32 +61,32 @@ int RS_Undo::countRedoCycles() * All Cycles after the new one are removed and the Undoabels * on them deleted. */ -void RS_Undo::addUndoCycle(RS_UndoCycle * i) +void Undo::addUndoCycle(UndoCycle * i) { - RS_DEBUG->print("RS_Undo::addUndoCycle"); + DEBUG->print("Undo::addUndoCycle"); undoList.insert(++undoPointer, i); - RS_DEBUG->print("RS_Undo::addUndoCycle: ok"); + DEBUG->print("Undo::addUndoCycle: ok"); } /** * Starts a new cycle for one undo step. Every undoable that is * added after calling this method goes into this cycle. */ -void RS_Undo::startUndoCycle() +void Undo::startUndoCycle() { - RS_DEBUG->print("RS_Undo::startUndoCycle"); + DEBUG->print("Undo::startUndoCycle"); // definitely delete Undo Cycles and all Undoables in them // that cannot be redone now: while ((int)undoList.count() > undoPointer + 1 && (int)undoList.count() > 0) { - RS_UndoCycle * l = undoList.last(); + UndoCycle * l = undoList.last(); if (l != NULL) { - RS_Undoable * u = NULL; + Undoable * u = NULL; bool done = false; do @@ -96,7 +96,7 @@ void RS_Undo::startUndoCycle() if (u != NULL) { // Remove the pointer from _all_ cycles: -// for(RS_UndoCycle * l2=undoList.first(); l2!=NULL; l2=undoList.next()) +// for(UndoCycle * l2=undoList.first(); l2!=NULL; l2=undoList.next()) // l2->removeUndoable(u); for(int i=0; iremoveUndoable(u); @@ -119,15 +119,15 @@ void RS_Undo::startUndoCycle() undoList.removeLast(); } - currentCycle = new RS_UndoCycle(); + currentCycle = new UndoCycle(); } /** * Adds an undoable to the current undo cycle. */ -void RS_Undo::addUndoable(RS_Undoable * u) +void Undo::addUndoable(Undoable * u) { - RS_DEBUG->print("RS_Undo::addUndoable"); + DEBUG->print("Undo::addUndoable"); if (currentCycle != NULL) { @@ -135,14 +135,14 @@ void RS_Undo::addUndoable(RS_Undoable * u) } else { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Undo::addUndoable(): No undo cycle active."); + DEBUG->print(Debug::D_WARNING, "Undo::addUndoable(): No undo cycle active."); } } /** * Ends the current undo cycle. */ -void RS_Undo::endUndoCycle() +void Undo::endUndoCycle() { addUndoCycle(currentCycle); currentCycle = NULL; @@ -151,17 +151,17 @@ void RS_Undo::endUndoCycle() /** * Undoes the last undo cycle. */ -void RS_Undo::undo() +void Undo::undo() { - RS_DEBUG->print("RS_Undo::undo"); + DEBUG->print("Undo::undo"); if (undoPointer >= 0) { - RS_UndoCycle * i = undoList.at(undoPointer); + UndoCycle * i = undoList.at(undoPointer); if (i != NULL) { -// for(RS_Undoable * u=i->undoables.first(); u!=NULL; u=i->undoables.next()) +// for(Undoable * u=i->undoables.first(); u!=NULL; u=i->undoables.next()) // u->changeUndoState(); for(int j=0; jundoables.size(); j++) i->undoables[j]->changeUndoState(); @@ -174,18 +174,18 @@ void RS_Undo::undo() /** * Redoes the undo cycle which was at last undone. */ -void RS_Undo::redo() +void Undo::redo() { - RS_DEBUG->print("RS_Undo::redo"); + DEBUG->print("Undo::redo"); if (undoPointer + 1 < (int)undoList.count()) { undoPointer++; - RS_UndoCycle * i = undoList.at(undoPointer); + UndoCycle * i = undoList.at(undoPointer); if (i != NULL) { -// for(RS_Undoable * u=i->undoables.first(); u!=NULL; u=i->undoables.next()) +// for(Undoable * u=i->undoables.first(); u!=NULL; u=i->undoables.next()) // u->changeUndoState(); for(int j=0; jundoables.size(); j++) i->undoables[j]->changeUndoState(); @@ -197,16 +197,16 @@ void RS_Undo::redo() * @return The undo item that is next if we're about to undo * or NULL. */ -RS_UndoCycle * RS_Undo::getUndoCycle() +UndoCycle * Undo::getUndoCycle() { - RS_UndoCycle * ret = NULL; + UndoCycle * ret = NULL; - RS_DEBUG->print("RS_Undo::getUndoCycle"); + DEBUG->print("Undo::getUndoCycle"); if (undoPointer >= 0 && undoPointer < (int)undoList.count()) ret = undoList.at(undoPointer); - RS_DEBUG->print("RS_Undo::getUndoCycle: OK"); + DEBUG->print("Undo::getUndoCycle: OK"); return ret; } @@ -215,9 +215,9 @@ RS_UndoCycle * RS_Undo::getUndoCycle() * @return The redo item that is next if we're about to redo * or NULL. */ -RS_UndoCycle * RS_Undo::getRedoCycle() +UndoCycle * Undo::getRedoCycle() { - RS_DEBUG->print("RS_Undo::getRedoCycle"); + DEBUG->print("Undo::getRedoCycle"); if (undoPointer + 1 >= 0 && undoPointer + 1 < (int)undoList.count()) return undoList.at(undoPointer + 1); @@ -228,15 +228,15 @@ RS_UndoCycle * RS_Undo::getRedoCycle() /** * Dumps the undo list to stdout. */ -std::ostream & operator<<(std::ostream & os, RS_Undo & l) +std::ostream & operator<<(std::ostream & os, Undo & l) { os << "Undo List: " << "\n"; os << " Pointer is at: " << l.undoPointer << "\n"; -// for(RS_UndoCycle * i=l.undoList.first(); i!=NULL; i=l.undoList.next()) +// for(UndoCycle * i=l.undoList.first(); i!=NULL; i=l.undoList.next()) for(int j=0; j undo.addUndoable(u1); } @@ -325,12 +325,12 @@ std::ostream & operator<<(std::ostream & os, RS_Undo & l) for(i=1; i<=10; ++i) { - //c1 = new RS_UndoCycle(); + //c1 = new UndoCycle(); undo.startUndoCycle(); for(k=1; k<=10; ++k) { - u1 = new RS_Undoable(); + u1 = new Undoable(); //c1->addUndoable(u1); undo.addUndoable(u1); } @@ -378,12 +378,12 @@ std::ostream & operator<<(std::ostream & os, RS_Undo & l) for(i=1; i<=1; ++i) { - //c1 = new RS_UndoCycle(); + //c1 = new UndoCycle(); undo.startUndoCycle(); for(k=1; k<=10; ++k) { - u1 = new RS_Undoable(); + u1 = new Undoable(); //c1->addUndoable(u1); undo.addUndoable(u1); }