Click here to Skip to main content
15,886,724 members
Articles / Programming Languages / C++

Undo and Redo the "Easy" Way

Rate me:
Please Sign up or sign in to vote.
4.95/5 (42 votes)
20 Jun 2004CPOL22 min read 289.8K   8.6K   114  
This article introduces a simple approach to in-memory transactions that can be used to implement Undo and Redo. The technique uses SEH and Virtual Memory and requires only STL and Win32.
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by DrawIt.rc
//
#define IDD_ABOUTBOX                    100
#define IDR_MAINFRAME                   128
#define IDR_DRAWITTYPE                  129
#define IDR_HTML1                       130
#define IDR_ABOUT_CONTENT               130
#define IDC_CONTENT                     1001
#define ID_EDIT_ABUSE                   32771
#define ID_EDIT_ABUSE2                  32772
#define ID_INSERT_LINE                  32773
#define ID_INSERT_SPLINE                32774
#define ID_INSERT_RECT                  32775
#define ID_INSERT_CIRCLE                32776
#define ID_INSERT_ELLIPSE               32777
#define ID_VIEW_DRAWOBJECTS             32783
#define ID_VIEW_                        32784
#define ID_EDIT_OPENLONGTRANSACTION     32785
#define ID_EDIT_COMMITTRANSACTION       32786
#define ID_EDIT_CANCELTRANSACTION       32787
#define ID_BUTTON_LONGTRANSACTION       32792

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS                     1
#define _APS_NEXT_RESOURCE_VALUE        131
#define _APS_NEXT_COMMAND_VALUE         32793
#define _APS_NEXT_CONTROL_VALUE         1002
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
A compiler warns of bogasity, ignore it at your peril. Unless you've done the compiler's job yourself, don't criticize it.

Comments and Discussions