Undo/Redo help required...
-
hi, i have a dialog based application in which i am loading images and editing it..for this i need the undo and the redo functions ... any idea how do i go about it. Any help is warmly welcomed. Thanking you. Satadru.
Look at the command pattern here: http://www.codeproject.com/cpp/undoredo\_cpp.asp?target=undo|command
-
Look at the command pattern here: http://www.codeproject.com/cpp/undoredo\_cpp.asp?target=undo|command
[http://www.codeproject.com/cpp/undoredo\_cpp.asp](Correct link)
-
[http://www.codeproject.com/cpp/undoredo\_cpp.asp](Correct link)
While both of your replies contained the right text, the underlying links were wrong. Did you try them out?
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
-
hi, i have a dialog based application in which i am loading images and editing it..for this i need the undo and the redo functions ... any idea how do i go about it. Any help is warmly welcomed. Thanking you. Satadru.
One way that I've seen it done is to keep a list of each changed document. In other words, each time the document is changed, a copy is kept in a list. When an undo is requested, the latest document in the list is "copied" over the current document, and the view is notified to do a redraw. This is very simplistic but I think you get the general idea.
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
-
hi, i have a dialog based application in which i am loading images and editing it..for this i need the undo and the redo functions ... any idea how do i go about it. Any help is warmly welcomed. Thanking you. Satadru.
step 1. firstly identify the type of operations for which you like to have undo facility. step 2. create a CUndo class and add to it all the necessary variables for each type of opeations. step 3. create a vector of CUndo pointers . step 4 .save all the CUndo object pointers in this particular vector. always save the previous state of the image when the user performs certain action. for example if the image is changed from state1 to state2 then create an undo object storing all necessary information of state1 and add to vector. if the user clicks undo menu then again create an undo object of state 2. then read the last object in the vector, refresh the image with the information retrieved from vector, delete this state1 undo object from the vector, and add the state 2 undo object information.