Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Undo/Redo help required...

Undo/Redo help required...

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    satadru
    wrote on last edited by
    #1

    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.

    A D 3 Replies Last reply
    0
    • S satadru

      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.

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      Look at the command pattern here: http://www.codeproject.com/cpp/undoredo\_cpp.asp?target=undo|command

      A 1 Reply Last reply
      0
      • A Anonymous

        Look at the command pattern here: http://www.codeproject.com/cpp/undoredo\_cpp.asp?target=undo|command

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        [http://www.codeproject.com/cpp/undoredo\_cpp.asp](Correct link)

        D 1 Reply Last reply
        0
        • A Anonymous

          [http://www.codeproject.com/cpp/undoredo\_cpp.asp](Correct link)

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          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?

          1 Reply Last reply
          0
          • S satadru

            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.

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            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?

            1 Reply Last reply
            0
            • S satadru

              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.

              A Offline
              A Offline
              Anonymous
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups