#include <ophist.h>
Inheritance diagram for OpUndo:
Public Member Functions | |
OpUndo () | |
Constructs an OpUndo object. | |
void | Do (OpDescriptor *) |
Actually "DO" the undo operation. | |
Static Public Member Functions | |
static BOOL | Init () |
Create an OpDescriptor for the Undo operation. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
Find the state of the OpUndo operation. |
Definition at line 247 of file ophist.h.
|
Constructs an OpUndo object.
Definition at line 1225 of file ophist.cpp. 01225 : Operation() 01226 { 01227 }
|
|
Actually "DO" the undo operation.
Reimplemented from Operation. Definition at line 1244 of file ophist.cpp. 01245 { 01246 // Remember our document, because in debug builds we need to access it after End() 01247 // has been called, and End() deletes the operation. 01248 Document *pDoc = pOurDoc; 01249 01250 // #ifdef _DEBUG 01251 // // Ensure that the size of the operation history is valid before the undo 01252 // pDoc->GetOpHistory().DebugSizeCheck(); 01253 // #endif 01254 01255 pDoc->GetOpHistory().UndoPrev(); // Undo the previous operation 01256 End(); 01257 01258 // if there are no more actions to undo and the operation history has not been reduced 01259 // then mark the document as un-modified. 01260 if ( (!(pDoc->GetOpHistory().CanUndo())) && (!(pDoc->GetOpHistory().IsReduced())) ) 01261 { 01262 pDoc->SetModified(FALSE); 01263 } 01264 01265 #ifdef _DEBUG 01266 // Ensure that the size of the operation history is valid after the undo 01267 pDoc->GetOpHistory().DebugSizeCheck(); 01268 #endif 01269 }
|
|
Find the state of the OpUndo operation.
Definition at line 1287 of file ophist.cpp. 01288 { 01289 OpState OpSt; 01290 01291 // Undo always works on the selected document... 01292 Document *pDocument = Document::GetSelected(); 01293 01294 if (pDocument) 01295 { 01296 OperationHistory *pOpHist = &(pDocument->GetOpHistory()); 01297 01298 // Is there an Operation History? 01299 if (pOpHist) 01300 { 01301 // The Undo operation can only be invoked if there are any operations to undo. 01302 if (pOpHist->CanUndo()) 01303 { 01304 // Temporary String used for Operation Name 01305 String_256 OpName; 01306 01307 // Get the name of operation to be undone 01308 pOpHist->GetUndoOpName(&OpName); 01309 01310 //Concatenate The Menu Description with the operation name 01311 String Space = _T(" "); 01312 *UIDescription += Space; 01313 *UIDescription += OpName; 01314 01315 return OpSt; 01316 } 01317 } 01318 } 01319 01320 //ELSE set to state to disabled 01321 01322 OpSt.Greyed = TRUE; 01323 01324 // Load reason why operation is disabled 01325 String_256 DisableReason(_R(IDS_UNDO_DISABLED)); 01326 01327 *UIDescription = DisableReason; 01328 01329 return(OpSt); 01330 }
|
|
Create an OpDescriptor for the Undo operation.
Reimplemented from SimpleCCObject. Definition at line 1348 of file ophist.cpp. 01349 { 01350 return( 01351 Operation::RegisterOpDescriptor( 01352 0, 01353 _R(IDS_EDIT_UNDO), 01354 CC_RUNTIME_CLASS(OpUndo), 01355 OPTOKEN_UNDO, 01356 OpUndo::GetState, 01357 HID_EDIT_UNDO, 01358 _R(IDBBL_UNDOOP), 01359 _R(IDD_BARCONTROLSTORE), 01360 _R(IDC_BTN_EDITUNDO), 01361 SYSTEMBAR_EDIT 01362 ) 01363 ); 01364 01365 }
|