#include <ops.h>
Inheritance diagram for Operation:
Public Member Functions | |
virtual void | OnClickWhileDragging (OilCoord PointerPos, ClickType Click, ClickModifiers Mods, BOOL bSolidDrag) |
This virtual function handles clicks with one mouse button while another mouse button is dragging. For example, the user drags with the left mouse button and clicks the right button during the drag. | |
Operation (CCRuntimeClass *MsgHandlerClass=CC_RUNTIME_CLASS(Operation)) | |
Constructs a new operation object: setting default operation flags, and adding it to the Operation message list. Note that the routines which create operations must create an instance for every seperate input that they receive. They must not re-use an existing instance because operation objects have to be submitted to the undo system to represent user operations on a 1 to 1 basis. | |
virtual | ~Operation () |
Operation destructor. | |
virtual void | End () |
This function calls EndOp which performs the main end of operation processing. see Operation::EndOp. | |
virtual Matrix | GetCurrentMatrix () |
UINT32 | GetSize () |
To calculate the size of the operation, i.e the sum of the sizes of the operation's actions. | |
virtual BOOL | SnappingDrag () |
virtual void | DragPointerMove (DocCoord PointerPos, ClickModifiers ClickMods, Spread *pSpread, BOOL bSolidDrag) |
Pure virtual function which tells the operation that the mouse has moved. | |
virtual void | DragPointerIdle (DocCoord PointerPos, ClickModifiers ClickMods, Spread *pSpread, BOOL bSolidDrag) |
Pure virtual function which tells the operation that nothing is going on so that it has time to do background jobs. | |
virtual void | DragFinished (DocCoord PointerPos, ClickModifiers ClickMods, Spread *pSpread, BOOL Success, BOOL bSolidDrag) |
Pure virtual function which tells the operation that a drag has finished. Once the operation knows the drag has finished it should call EndDrag() to terminate the drag. | |
virtual BOOL | DragKeyPress (KeyPress *pKeyPress, BOOL bSolidDrag) |
Keyboard interface for operations. | |
virtual void | DragModeChanged (BOOL bSolidDrag) |
Notify drag handler of change in drag mode. | |
DocCoord | MakeRelativeToSpread (Spread *Dest, Spread *Src, DocCoord) |
This function converts a coordinate relative to one spread so that it is then relative to another spread. | |
virtual void | RenderDragBlobs (DocRect, Spread *, BOOL bSolidDrag) |
This function is called by other parts of the operation to put on and take off drag EORing. It will also be called as part of the main redraw loop in the case where part of the window has become invalid (due to scrolling maybe). The function should contain a RenderOnTop loop as described in DocView::RenderOnTop. This function can make no assumptions about where it is being called from. | |
virtual BOOL | OnIdleEvent () |
Called on idle events if an operation has tegistered to recieve them. | |
void | FailAndExecute () |
This fail function will cause the following to occur when the operation ends. | |
void | FailAndExecuteAllButLast () |
This fail function will cause the following to occur when the operation ends. | |
void | FailAndDiscard () |
This fail function will cause the following to occur when the operation ends. | |
void | FailAndExecuteIgnoreSelActions () |
void | SucceedAndDiscard () |
This function can be called to discard the operation when it ends. Any hidden nodes which have been generated will remain in the tree. | |
virtual BOOL | Undo () |
To execute the operation's undo action list. | |
virtual BOOL | Redo () |
To execute the operation's redo action list. | |
virtual void | DoSmart () |
virtual void | Do (OpDescriptor *) |
This function should be over-ridden to perform an operation without passing a parameter. | |
virtual void | DoWithParam (OpDescriptor *, OpParam *pOpParam) |
This function should be over-ridden to perform an operation which requires parameters. | |
OpFlgsStr | GetOpFlgs () |
For finding the status of the operations flags. | |
BOOL | OpHasFailed () const |
void | DeleteOnEnd () |
Sets the DeleteOnEnd OpFlag telling the operation to delete itself at the very end of EndOp. This is used in place of calling delete(this) for safety reasons. | |
void | KeepOnEnd () |
ActionList * | GetUndoActionList () |
To find the UNDO action list of the operation. | |
ActionList * | GetRedoActionList () |
To find the REDO action list of the operation. | |
BOOL | UserWantsToDeleteUndoOps () |
void | OperationMemoryFailure () |
Document * | GetWorkingDoc () |
View * | GetWorkingView () |
DocView * | GetWorkingDocView () |
Find out which document this operation is working on. This will remain constant throughout the life of most operations with the exception of DialogOps. (The File open operation also changes its working document but this is a very rare exception). Returns the View that is associated with this operation. Note that the majority of operations don't care what view they work on - most of them are document-based, and cause all views attached to a document to be updated. However, some operations such as zooming, changing the quality etc. only work on a particular view. Returns the DocView that is associated with this operation. This will return NULL if the View the operation is attached to is not actually a DocView (e.g. it may be a PrintView). Note that the majority of operations don't care what view they work on - most of them are document-based, and cause all views attached to a document to be updated. However, some operations such as zooming, changing the quality etc. only work on a particular view. | |
virtual void | GetOpName (String_256 *) |
To get the name of the operation. | |
virtual BOOL | GetStatusLineText (String_256 *pText, Spread *pSpread, DocCoord DocPos, ClickModifiers ClickMods) |
Each DragOp should override this function to return valid status line text. | |
virtual BOOL | UpdateChangedNodes (ObjChangeParam *pParam, Spread *pSpread=NULL) |
This calls OnChildChange() on all nodes that were effected by the op. This includes all parents of all effect nodes too. It calls the effected nodes in a depth-first traversal. | |
virtual BOOL | UpdateChangedNode (ObjChangeParam *pParam, Node *pNode) |
Helper function for UpdateChangedNodes() (which calls this for each layer in a spread). This will call itself recursively for all children, to ensure a depth-first traversal of the tree. | |
virtual BOOL | UpdateAllChangedNodes (ObjChangeParam *pParam) |
This calls the Document version of this func for all documents in the application. | |
virtual BOOL | UpdateChangedNodes (ObjChangeParam *pParam, Document *pDoc) |
This calls the Spread version of this func for all spreads in the given doc. | |
virtual void | Dump () |
Displays information on this operation, and its two action lists. Override to display information specific to your operation. | |
ActionList * | GetUndoActions () |
ActionList * | GetRedoActions () |
ActionList * | GetSmartActions () |
void | InformDocComponentsOfOperationsOutcome (BaseDocument *pDoc) |
Static Public Member Functions | |
static BOOL | Initialise () |
Does any Operation initialisation necessary. Declares an Operation INI setting. | |
static Operation * | GetCurrentDragOp () |
To check if there is a drag currently going on, and if there is to return the operation involved in the drag. | |
static BOOL | RegisterOpDescriptor (UINT32 toolID, UINT32 txID, CCRuntimeClass *RuntimeClass, TCHAR *tok, pfnGetState gs, UINT32 helpId=0, UINT32 bubbleID=0, UINT32 resourceID=0, UINT32 controlID=0, SystemBarType GroupBarID=SYSTEMBAR_ILLEGAL, BOOL ReceiveMessages=TRUE, BOOL Smart=FALSE, BOOL Clean=TRUE, OpDescriptor *pVertOpDesc=NULL, UINT32 OneOpenInstID=0, UINT32 AutoStateFlags=0, BOOL fCheckable=FALSE) |
This function should be called from the operations Init method. It creates an OpDescriptor for the operation. | |
static BOOL | GetQuickRender (Node *pNode) |
Gets the QuickRender state (composed of CurrentDragOp or quick render flag). | |
static void | SetQuickRender (BOOL bNewState, Operation *pQROp=NULL) |
Sets the QuickRender flag. | |
Public Attributes | |
OperationStatus | OpStatus |
Protected Member Functions | |
BOOL | StartDrag (DragType type, DocRect *MoveBBox=NULL, DocCoord *StartPos=NULL, BOOL KeepAccuracy=TRUE, BOOL bSolidDragSupported=FALSE) |
To start a drag. | |
BOOL | EndDrag (void) |
To end a drag. | |
void | EndOp () |
This function is called by End(), to end an operation. It removes the operation from the live list and then does various things depending on the state of the operation's flags. It is normally called by the operation's Do function. The way the operation flags are interpreted by EndOp are described by the following algorithm. | |
Protected Attributes | |
OpFlgsStr | OpFlags |
Document * | pOurDoc |
View * | pOurView |
ActionList | UndoActions |
ActionList | RedoActions |
ActionList | SmartActions |
Private Attributes | |
BOOL | DeleteUndoOpsToMakeSpace |
BaseDocument * | pDocToInformOfOpStatus |
Static Private Attributes | |
static Operation * | CurrentDragOp = NULL |
static INT32 | CurKeyboardSpeed |
static BOOL | ResetKeyboardSpeed = FALSE |
static BOOL | KeyboardRepeatOffDuringDrags = FALSE |
static BOOL | s_bQuickRender = FALSE |
Definition at line 323 of file ops.h.
|
Constructs a new operation object: setting default operation flags, and adding it to the Operation message list. Note that the routines which create operations must create an instance for every seperate input that they receive. They must not re-use an existing instance because operation objects have to be submitted to the undo system to represent user operations on a 1 to 1 basis.
Definition at line 509 of file ops.cpp. 00509 : 00510 MessageHandler(MessageHandlerClass, TRUE) 00511 { 00512 //Set default operation flag states. The defaults are for a clean non undoable operation 00513 00514 OpFlags.Failed = FALSE; 00515 OpFlags.ExecuteOnEnd = FALSE; 00516 OpFlags.AllButLast = FALSE; 00517 OpFlags.KeepOnEnd = FALSE; 00518 OpFlags.UnwindingActions = FALSE; 00519 OpFlags.HasOwnTimeIndicator = FALSE; 00520 OpFlags.SucceedAndDiscard = FALSE; 00521 OpFlags.DeleteOnEnd = FALSE; 00522 OpFlags.IgnoreSelectActions = FALSE; 00523 00524 DeleteUndoOpsToMakeSpace = FALSE; 00525 pDocToInformOfOpStatus = NULL; 00526 00527 // Let the system know that we are currently doing the operation for the first time 00528 OpStatus = DO; 00529 00530 // The only time Operations get created is when they are to be put on the "live ops" 00531 // list, and the only time they get put on the "live ops" lists is when they will 00532 // affect whatever is the current document. 00533 pOurDoc = Document::GetCurrent(); 00534 pOurView = View::GetCurrent(); 00535 00536 }
|
|
Operation destructor.
Definition at line 554 of file ops.cpp. 00555 { 00556 // The destructors of the Operations action lists will automatically be called 00557 00558 // However, we must ensure the REDO action list is slaughtered in the correct 00559 // (reverse) direction... the UNDO list will slaughter its items in the correct 00560 // direction in its destructor 00561 00562 // Removed by Simon 19/04 All action lists now slaughter themselves backwards 00563 //RedoActions.SlaughterBackwards(); 00564 }
|
|
Sets the DeleteOnEnd OpFlag telling the operation to delete itself at the very end of EndOp. This is used in place of calling delete(this) for safety reasons.
Definition at line 1658 of file ops.cpp. 01659 { 01660 ERROR3IF(this==NULL, "DeleteOnEnd passed NULL this"); 01661 01662 OpFlags.DeleteOnEnd = TRUE; 01663 }
|
|
|
Definition at line 1561 of file ops.cpp.
|
|
This function should be over-ridden to perform an operation which requires parameters.
Reimplemented in OpAlign, OpApplyAttribToSelected, OpApplyAttribsToSelected, OpRepeatApplyAttribToSelected, OpApplyAttribToNode, OpReplaceAttributes, OpBackground, BarCreationDlg, BarStatesDlg, BarRedefineStateDlg, BfxOp, BfxDlg, BfxPlugInDlg, CBiasGainDlg, BmapPrevDlg, BmpPrefsDlg, PhotoCDDlg, BmpDlg, CBaseBrushNameDlg, CBrushEditDlg, OpChangeBrushDefinition, OpDeactivateBrush, ColourEditDlg, OpMakeColourLocalToFrame, OpHideColours, OpColourChange, OpRedrawColours, OpPaste, DaveDlg, ExtendSetsDlg, ImagemapDlg, OpGrabFrame, OpGuideline, WebAddressDlg, OpMenuExport, OpDroppedFile, DownloadOp, OpThumbDownload, OpAsynchClipartImport, OpAddWebFolders, OpAddWebLibrary, OpLayerGalChange, LayerNameDlg, OpRegister, OpUpdate, OpMakeNodesShapes, NameDialog, OpMenuLoad, OpMenuSave, NewColourDlg, OpSelectSet, OpApplyNamesToSel, OpApplyNamesToOne, OpApplyNameToNone, OpRenameAll, OpChangeSetProperty, OpChangeBarProperty, OpChangeBarExtends, OpCreateNodeBitmap, OpBarCreation, OpDuplicateBar, OpShortenBar, OpDelBar, OpShowState, OpChangeFeatherSize, OpChangeFeatherProfile, OpRemoveAttributeFromSelection, OpGridResize, OpPageResize, SepsDlg, UnitPropertiesDlg, OpCloseNodePaths, OpMovePathPoint, PreviewDialog, OpChangeLayerColour, SelMediaDlg, SGalleryOptionsDlg, SGallerySortDlg, SGallerySearchDlg, ColourNameDlg, NameObjectsDlg, OpEditRegularShape, TraceOp, TraceDlg, TransOperation, URLImportDlg, NativePrefsDlg, OpCombineLayersToFrameLayer, OpChangeBlendSteps, OpChangeBlend, OpChangeBlendDistance, OpChangeFillProfile, OpChangeTranspFillProfile, OpCreateNewMould, OpRemoveFloater, OpInsertFloater, OpCreateContour, OpRemoveContour, OpChangeContourWidth, OpChangeContourToInner, OpChangeContourToOuter, OpChangeContourSteps, OpChangeContourColourType, OpChangeContourAttributeProfile, OpChangeContourObjectProfile, OpChangeContourStepDistance, OpToggleContourInsetPath, OpChangeBrush, OpLiveEffect, OpApplyLiveEffect, OpApplyFeatherEffect, OpEditLegacyEffect, TabStopDragOp, OpTextKern, OpTextAutoKern, OpDeleteTextStory, OpClipboardExport, OpClipboardImport, PasteSpecialDlg, OpClipartImport, OpBitmapImport, and SGalleryLinePropertiesDlg. Definition at line 1613 of file ops.cpp.
|
|
Pure virtual function which tells the operation that a drag has finished. Once the operation knows the drag has finished it should call EndDrag() to terminate the drag. virtual void Operation::DragFinished( DocCoord PointerPos, ClickModifiers ClickMods, Spread *pSpread, BOOL Success, BOOL bSolidDrag)
Reimplemented in OpApplyAttrInteractive, OpGuideline, OpSpreadOrigin, OpDragOrigin, OpDragBox, OpCreateFill, OpEditFill, OpEditRectangle, OpNodePathEditBlob, OpNodePathAddEndpoint, OpReshapeOrAddPoint, OpNewPath, OpPenDragBlobs, OpPenCreateInternal, OpPenEditInternal, OpPenEditPath, OpPenCreatePath, OpPenAddElement, OpPenClosePath, OpDragRegularShape, OpReformShapeEdge, TransOperation, BevelInfoBarOp, OpBlendNodes, OpEditBlendEndObject, OpContourNodes, OpGridNewResize, OpGridSelection, OpSelectPathPoints, OpDrawBrush, OpFreeHand, OpNewRegShape, OpPush, OpSelectorDragBox, OpDragRotateCentre, OpSliceDragBox, OpSliceTranslate, TabStopDragOp, OpCreateTextObject, OpTextSelection, and OpDragStoryIndent. Definition at line 1212 of file ops.cpp.
|
|
Keyboard interface for operations.
Reimplemented in OpGuideline, OpEditFill, TransOperation, OpFreeHand, and OpDragRotateCentre. Definition at line 1235 of file ops.cpp. 01236 { 01237 return FALSE; 01238 }
|
|
Notify drag handler of change in drag mode.
Reimplemented in OpEditFill, and TransOperation. Definition at line 1255 of file ops.cpp.
|
|
Pure virtual function which tells the operation that nothing is going on so that it has time to do background jobs. virtual void Operation::DragPointerIdle( DocCoord PointerPos, ClickModifiers ClickMods, Spread *pSpread, BOOL bSolidDrag)
Reimplemented in OpDragBox, OpEditFill, TransOperation, OpEditBlendEndObject, OpDrawBrush, and OpFreeHand. Definition at line 1182 of file ops.cpp.
|
|
Pure virtual function which tells the operation that the mouse has moved. virtual void Operation::DragPointerMove( DocCoord PointerPos, ClickModifiers ClickMods, Spread *pSpread, BOOL bSolidDrag)
Reimplemented in OpGuideline, OpSpreadOrigin, OpDragOrigin, OpDragBox, OpCreateFill, OpEditFill, OpEditRectangle, OpNodePathEditBlob, OpNodePathEditControlBlob, OpReshapeOrAddPoint, OpPenDragBlobs, OpPenEditPath, OpPenClosePath, OpDragRegularShape, OpReformShapeEdge, TransOperation, BevelInfoBarOp, OpBlendNodes, OpEditBlendEndObject, OpContourNodes, OpGridNewResize, OpGridSelection, OpSelectPathPoints, OpDrawBrush, OpFreeHand, OpNewRegShape, OpPush, OpSelectorDragBox, OpDragRotateCentre, TabStopDragOp, OpCreateTextObject, OpTextSelection, and OpDragStoryIndent. Definition at line 1158 of file ops.cpp.
|
|
Displays information on this operation, and its two action lists. Override to display information specific to your operation.
Definition at line 2259 of file ops.cpp. 02260 { 02261 #if DEBUG_TREE 02262 // Display ops name 02263 TRACEALL( _T("\nOperation : %s\n"), GetRuntimeClass()->GetClassName() ); 02264 02265 // Display undo actions 02266 if (UndoActions.IsEmpty()) 02267 { 02268 TRACEALL( _T(" No Undo actions\n") ); 02269 } 02270 else 02271 { 02272 TRACEALL( _T(" %d Undo actions\n"), UndoActions.GetCount() ); 02273 ListItem* pAction = UndoActions.GetHead(); 02274 02275 while (pAction != NULL) 02276 { 02277 ((Action*)pAction)->Dump(); 02278 pAction = UndoActions.GetNext(pAction); 02279 } 02280 } 02281 02282 // Display redo actions 02283 if (RedoActions.IsEmpty()) 02284 { 02285 TRACEALL( _T(" No Redo actions\n") ); 02286 } 02287 else 02288 { 02289 TRACEALL( _T(" %d Redo actions\n"), RedoActions.GetCount() ); 02290 ListItem* pAction = RedoActions.GetHead(); 02291 02292 while (pAction != NULL) 02293 { 02294 ((Action*)pAction)->Dump(); 02295 pAction = RedoActions.GetNext(pAction); 02296 } 02297 } 02298 #endif 02299 }
|
|
This function calls EndOp which performs the main end of operation processing. see Operation::EndOp.
Reimplemented in DownloadOp, OpThumbDownload, OpAsynchClipartImport, SelOperation, and TransOperation. Definition at line 894 of file ops.cpp. 00895 { 00896 // When an operation is ending all sorts of scary stuff is going on with nodes, so we 00897 // do not want to be rendering at the time !.. 00898 PORTNOTE("other","Removed RalphCriticalSection usage") 00899 #ifndef EXCLUDE_FROM_XARALX 00900 // RalphCriticalSection rcs; 00901 if ( (OpFlags.SystemUndo) && (OpStatus == DO) && (!(OpFlags.ExecuteOnEnd)) ) 00902 { 00903 // A call to StartUndoOperation is made which creates a RestoreSelections action 00904 // which when executed will restore the selection state to the state which existed 00905 // just after performing the operation. 00906 StartUndoOperation(); 00907 } 00908 #endif 00909 00910 // Slight bodge to ensure that all op permission flags of all nodes are set to 00911 // PERMISSION_UNDEFINED regardless whether the op succeeded or failed. 00912 if (this->IS_KIND_OF(UndoableOperation)) 00913 { 00914 UndoableOperation* pOp = (UndoableOperation*)this; 00915 ObjChangeFlags cFlags; 00916 ObjChangeParam ObjChange(OBJCHANGE_IGNORE,cFlags,NULL,pOp); 00917 pOp->UpdateChangedNodes(&ObjChange); 00918 } 00919 00920 EndOp(); 00921 00922 }
|
|
To end a drag.
Definition at line 1797 of file ops.cpp. 01798 { 01799 ERROR3IF(CurrentDragOp == NULL, "Trying to end a drag which is not taking place !"); 01800 01801 // I've taken out the ability to switch auto-repeats off during drags (Markn - 19/10/95) 01802 /* 01803 // If we set the keyboard repeat rate to 0, reset it to the previous setting 01804 if (KeyboardRepeatOffDuringDrags && ResetKeyboardSpeed) 01805 { 01806 ::SystemParametersInfo(SPI_SETKEYBOARDSPEED, CurKeyboardSpeed, NULL, 0); 01807 ResetKeyboardSpeed = FALSE; 01808 } 01809 */ 01810 01811 // Rewritten so it won't blow up on OLE drags. Keeping the kernel drag running during 01812 // the end of an OLE drag outside Camelot is a very risky business! 01813 BOOL fOK = FALSE; 01814 if (pDraggingDocView) 01815 { 01816 fOK = pDraggingDocView->EndDrag(this); 01817 pDraggingDocView = 0; 01818 } 01819 #ifdef _DEBUG 01820 else 01821 { 01822 ERROR3("No dragging DocView in Operation::EndDrag"); 01823 } 01824 #endif 01825 01826 CurrentDragOp = 0; 01827 return fOK; 01828 01829 /* 01830 DocView *pDocView = DocView::GetSelected(); 01831 01832 ERROR3IF(pDocView == NULL, "No selected DocView in Operation::EndDrag()"); 01833 01834 if ((pDocView != NULL) && (pDocView->EndDrag(this))) // Tell OS to end drag 01835 { 01836 CurrentDragOp = NULL; 01837 01838 return (TRUE); // Ended drag successfully 01839 } 01840 else 01841 return (FALSE); // Failed to end the drag (and don't bother resetting CurrentDragOp!?!?) 01842 */ 01843 }
|
|
This function is called by End(), to end an operation. It removes the operation from the live list and then does various things depending on the state of the operation's flags. It is normally called by the operation's Do function. The way the operation flags are interpreted by EndOp are described by the following algorithm.
IF the Failed flag is TRUE IF the ExecuteOnEndFlag is TRUE IF the AllButLast flag is TRUE Execute all but the last action in the operations UNDO/REDO action list. ELSE Execute all actions in the operation's UNDO/REDO action list ELSE IF we are undoing Delete the operation and all redo operations ELSE IF we are doing or redoing Delete the operation and all undo operations IF the OperationStatus is DO Delete the operation ELSE IF the SystemUndo flag is TRUE and we are doing the operation Add operation to the operation history ELSE IF the keepOnEnd flag is FALSE delete the operation IF the Clean flag is FALSE Inform the document that it has been modified MonoOff Scope: private
Definition at line 614 of file ops.cpp. 00615 { 00616 OpFlags.DeleteOnEnd = FALSE; // Set to TRUE if the operation should be deleted 00617 00618 // Some static attribute apply flags, added by Will 00619 AttributeManager::HaveAskedAboutContoneColours = FALSE; 00620 AttributeManager::UserCancelledContoneColours = FALSE; 00621 00622 Document *pDocument = GetWorkingDoc(); 00623 00624 // if (pDocument != NULL) 00625 // pDocument->FlushRedraw(); 00626 00627 Document *pDoc = (Document *) Camelot.Documents.GetHead(); 00628 00629 while (pDoc != NULL) 00630 { 00631 // Force any pending redraw to be done now 00632 if (pDoc == pDocument) 00633 pDocument->FlushRedraw(); 00634 00635 pDoc = (Document *) Camelot.Documents.GetNext(pDoc); 00636 } 00637 00638 // Remember that it is valid now for pOpDesc to be NULL (eg. for InformationBarOps 00639 // which don't have OpDescriptors) 00640 /*OpDescriptor* pOpDesc =*/ OpDescriptor::FindOpDescriptor(this->GetRuntimeClass()); 00641 00642 OperationHistory* OpHist; 00643 00644 // if there is not a current document and the operation in progress is undoable 00645 // then ensure 00646 PORTNOTE("other","Removed OpAsynchClipartImport usage") 00647 if( IsKindOf( CC_RUNTIME_CLASS(UndoableOperation) ) 00648 #ifndef EXCLUDE_FROM_XARALX 00649 && !IsKindOf(CC_RUNTIME_CLASS(OpAsynchClipartImport))) 00650 #endif 00651 ) 00652 ENSURE( (pDocument != NULL), "Document has been destroyed before operation has ended"); 00653 00654 // The operation is ending so don't send any more messages to it 00655 if (OpStatus == DO) 00656 { 00657 SendNoMoreMessages(this); 00658 } 00659 00660 // Has the operation copied any component data between documents 00661 if (pDocToInformOfOpStatus != NULL) 00662 { 00663 if (OpFlags.Failed) 00664 { 00665 // We may have copied data accross but because the operation has failed 00666 // we must discard this. 00667 pDocToInformOfOpStatus->AbortComponentCopy(); 00668 } 00669 else 00670 { 00671 // Call EndComponentCopy to commit the new data 00672 if (!pDocToInformOfOpStatus->EndComponentCopy()) 00673 { 00674 // Note that AbortComponentCopy has been called 00675 // Unable to complete the op so it must fail I'm afraid 00676 OpFlags.Failed = TRUE; 00677 } 00678 00679 } 00680 } 00681 00682 // if the operation is not undoable then dispose of it and exit. 00683 if (!IsKindOf(CC_RUNTIME_CLASS(UndoableOperation))) 00684 { 00685 00686 if (!OpFlags.KeepOnEnd) 00687 { 00688 OpFlags.DeleteOnEnd = TRUE; 00689 } 00690 goto End; 00691 } 00692 else 00693 { 00694 // If the operation has been done but does not have any Undo actions then 00695 // dispose of the operation and then exit. 00696 if ((UndoActions.GetHead() == NULL) && (OpStatus == DO)) 00697 { 00698 if (!OpFlags.KeepOnEnd) 00699 { 00700 OpFlags.DeleteOnEnd = TRUE; 00701 } 00702 goto End; 00703 } 00704 } 00705 00706 OpHist = &(pDocument->GetOpHistory()); 00707 00708 // Check if the operation failed 00709 if (OpFlags.Failed || OpFlags.SucceedAndDiscard) 00710 { 00711 if (OpFlags.ExecuteOnEnd) 00712 { 00713 // Set the unwindingActions flag so that no actions are created in further 00714 // calls to the Action::Init function. 00715 OpFlags.UnwindingActions = TRUE; 00716 00717 // Determine which action list to execute 00718 00719 // If we are UNDOING then the failure must have occured when trying to create 00720 // REDO actions for the operation, so execute the RedoActions list (which will 00721 // restore the UNDO actions list). 00722 00723 00724 BOOL bOK = FALSE; 00725 if (OpStatus == UNDO) 00726 { 00727 bOK = RedoActions.ExecuteBackwards(OpFlags.AllButLast, OpFlags.IgnoreSelectActions); 00728 ERROR3IF(!bOK, "An operation failed whilst unwinding"); 00729 } 00730 // If we are DOING or REDOING then the failure must have occured when trying to 00731 // create UNDO actions, so execute the UndoActions list. 00732 00733 else 00734 { 00735 bOK = UndoActions.ExecuteBackwards(OpFlags.AllButLast, OpFlags.IgnoreSelectActions); 00736 ERROR3IF(!bOK, "An operation failed whilst unwinding"); 00737 } 00738 } 00739 else if (OpFlags.Failed) // Discard 00740 { 00741 if (OpStatus == UNDO) 00742 { 00743 // Delete the operation and all redo operations 00744 00745 // One step back in time 00746 OpHist->NowPtr = OpHist->OpHistoryList.GetPrev(OpHist->NowPtr); 00747 // Delete all Redo operations including the current operation 00748 OpHist->DeleteRedoableOps(); 00749 goto End; 00750 } 00751 else // REDO and DO 00752 { 00753 // Delete all Undo records including the current operation 00754 OpHist->NowPtr = OpHist->OpHistoryList.GetNext(OpHist->NowPtr); 00755 OpHist->DeleteUndoableOps(); 00756 00757 // In the case of a REDO we can return because the operation has been deleted. 00758 if (OpStatus == REDO) 00759 goto End; 00760 } 00761 00762 } 00763 // If we are DOING the operation for the first time delete the operation 00764 if (OpStatus == DO) 00765 { 00766 if (!OpFlags.KeepOnEnd) 00767 { 00768 OpHist->DecSize(this->GetSize()); // The size total in the operation history 00769 // will include the current size of the 00770 // operation. 00771 OpFlags.DeleteOnEnd = TRUE; 00772 } 00773 goto End; 00774 } 00775 } 00776 00777 if (!OpFlags.Failed) // Operation has not failed 00778 { 00779 // Decide if the operation should be added to the documents operation history 00780 if (OpStatus == DO && !OpFlags.SucceedAndDiscard) 00781 { 00782 // The undo action list should contain actions, the redo action list should not 00783 ENSURE(UndoActions.GetHead() != NULL, "The undo action list is empty"); 00784 ENSURE(RedoActions.GetHead() == NULL, "The redo action list is not empty"); 00785 00786 // Add operation to document's operation history 00787 pOurDoc->GetOpHistory().Add(this); 00788 } 00789 00790 // If the Operation has no OpDescriptor then we assume that the operation is clean 00791 //if (pOpDesc != NULL) 00792 //{ 00793 //if (!(pOpDesc->GetOpFlags().Clean)) 00794 //{ 00795 // BODGE We do not inspect the Clean flag, cos not everyone has set it correctly. 00796 // We know this is an undoable operation so it must have affected the document. 00797 // Therefore we set the documents modified flag. 00798 00799 // Any operation with a FALSE clean flag has indicated that it 00800 // will or may have modified the document in some way. Therefore 00801 // inform the document that it has been modified. 00802 00803 #if !defined(EXCLUDE_FROM_RALPH) 00804 // The only exception to this is OpCopy IS_A 00805 if (!(GetRuntimeClass() == CC_RUNTIME_CLASS(OpCopy))) 00806 pOurDoc->SetModified(TRUE); 00807 #endif 00808 //} 00809 //} 00810 } 00811 00812 End: 00813 00814 EndSlowJob(); 00815 00816 #if !defined(EXCLUDE_FROM_RALPH) 00817 // Inform the world that the operation has ended 00818 // We don't want to do it at the end of an OpExit though 00819 if (GetRuntimeClass() != CC_RUNTIME_CLASS(OpExit)) 00820 { 00821 BROADCAST_TO_ALL(OpMsg(this, OpMsg::END)); 00822 } 00823 #endif 00824 00825 // The Operation which has just been performed has probably changed the state 00826 // of the system in some way so we update the state of all the bars. We don't 00827 // do this if the operation has failed however because: 00828 // A. When an operation has failed the state of the system should be restored 00829 // to the state it was in prior to the operation being performed. So it 00830 // will not be necessary. 00831 // B. The fact that the operation has failed implies that we are probably low on 00832 // memory so it's probably safer not to update it anyway. Note that if the 00833 // bar state is ever incorrect this should not be disastrous because the 00834 // GetState fn of the operation is always called prior to Invoking an operation 00835 // anyway. 00836 00837 if (!OpFlags.Failed && !OpFlags.SucceedAndDiscard) 00838 { 00839 00840 // Call the virtual PerformMergeProcessing function. This gives the operation a chance 00841 // to merge itself with the previous operation if appropriate. 00842 if(IS_KIND_OF(UndoableOperation) && !(OpFlags.DeleteOnEnd)) 00843 { 00844 if (OpStatus == DO) // We only want to merge ops when Doing the operation 00845 { 00846 // Note that the PerformMergeProcessing fn could delete this op (so be careful !) 00847 ((UndoableOperation*)this)->PerformMergeProcessing(); 00848 } 00849 } 00850 } 00851 00852 00853 // If there was any sort of error during that Op which hasn't been reported to the user yet 00854 // then we'd better report it now! 00855 InformLastError(); 00856 00857 // If the operation has survived all that then reset all failure and control 00858 // flags. 00859 OpFlags.Failed = FALSE; 00860 OpFlags.ExecuteOnEnd = FALSE; 00861 OpFlags.AllButLast = FALSE; 00862 OpFlags.UnwindingActions = FALSE; 00863 OpFlags.SucceedAndDiscard = FALSE; 00864 OpFlags.IgnoreSelectActions = FALSE; 00865 DeleteUndoOpsToMakeSpace = FALSE; 00866 00867 00868 // Be careful what is after this 00869 if (OpFlags.DeleteOnEnd) 00870 delete (this); 00871 // The bar state will be refreshed during idle time 00872 DialogBarOp::SetSystemStateChanged(); 00873 }
|
|
This fail function will cause the following to occur when the operation ends.
Note: This fail function can be called several times on the same operation, however only the first call will have any effect on the operation's flags.
Definition at line 1424 of file ops.cpp. 01425 { 01426 // Because the fail functions can be called several times on the same operation their 01427 // implementation has to ensure that only the flags set by the FIRST call are used 01428 01429 if (!OpFlags.Failed) 01430 { 01431 OpFlags.Failed = TRUE; 01432 } 01433 }
|
|
This fail function will cause the following to occur when the operation ends.
Definition at line 1354 of file ops.cpp.
|
|
This fail function will cause the following to occur when the operation ends.
Definition at line 1391 of file ops.cpp. 01392 { 01393 OpFlags.Failed = TRUE; 01394 OpFlags.ExecuteOnEnd = TRUE; 01395 OpFlags.AllButLast = TRUE; 01396 }
|
|
Definition at line 1360 of file ops.cpp. 01361 { 01362 OpFlags.Failed = TRUE; 01363 OpFlags.ExecuteOnEnd = TRUE; 01364 OpFlags.IgnoreSelectActions = TRUE; 01365 }
|
|
To check if there is a drag currently going on, and if there is to return the operation involved in the drag.
Definition at line 1064 of file ops.cpp. 01065 { 01066 return (CurrentDragOp); 01067 }
|
|
Reimplemented in TransOperation. Definition at line 338 of file ops.h. 00338 { return Matrix(); };
|
|
For finding the status of the operations flags.
Definition at line 1633 of file ops.cpp. 01634 { 01635 return (OpFlags); 01636 }
|
|
To get the name of the operation.
Reimplemented in OpApplyAttribToSelected, OpApplyAttrInteractive, OpApplyAttribsToSelected, OpRepeatApplyAttribToSelected, OpApplyAttribToNode, OpReplaceAttributes, OpBackground, OpChangeBrushDefinition, OpSelectBrush, OpDeactivateBrush, OpHideColours, OpCombineShapes, OpFillNudge, OpGuideline, OpLayerGalChange, OpDragOrigin, OpCreateNodeBitmap, OpBreakAtPoints, OpRemoveAttributeFromSelection, OpNudge, OpSmoothSelection, OpPathNudge, OpAddNewPath, OpAddPathToPath, OpClosePathWithPath, PlugInUndoOp, OpChangeLayerColour, OpRetroSmooth, OpBlendNodes, OpAddBlendPath, OpDetachBlendPath, OpRemoveBlend, OpChangeBlendSteps, OpChangeBlend, OpEditBlendEndObject, OpChangeBlendDistance, OpContourNodes, OpGridNewResize, OpGridSelection, OpGridChange, OpGridDelete, OpGridDuplicate, OpCreateNewMould, OpRemoveMould, OpCopyMouldShape, OpPasteEnvelope, OpPastePerspective, OpDetachMould, OpRotateMould, OpRectangularEnvelope, OpRectangularPerspective, OpApplyClipView, OpRemoveClipView, OpChangeContourWidth, OpChangeContourSteps, OpChangeContourColourType, OpChangeContourAttributeProfile, OpChangeContourObjectProfile, OpChangeContourStepDistance, OpConvertPathToShapes, OpToggleContourInsetPath, OpChangeBrush, OpApplyLiveEffect, OpApplyFeatherEffect, OpEditLiveEffect, OpDeleteLiveEffect, OpDeleteAllLiveEffect, OpEffectRes, OpEffectLock, OpEffectLockAll, OpEditLegacyEffect, OpCreateTextObject, and OpTextFormat. Definition at line 1856 of file ops.cpp. 01857 { 01858 OpDescriptor *Operation = OpDescriptor::FindOpDescriptor(this->GetRuntimeClass()); 01859 01860 if (Operation) 01861 Operation->GetText(OpName, OP_UNDO_TEXT); 01862 01863 }
|
|
Gets the QuickRender state (composed of CurrentDragOp or quick render flag).
Definition at line 1088 of file ops.cpp. 01089 { 01090 if (pNode==NULL) 01091 return (CurrentDragOp!=NULL || s_bQuickRender); 01092 else 01093 return ((CurrentDragOp!=NULL && pNode->IsDragged()) || s_bQuickRender); 01094 }
|
|
To find the REDO action list of the operation.
Definition at line 1704 of file ops.cpp. 01705 { 01706 return (&RedoActions); 01707 }
|
|
Definition at line 500 of file ops.h. 00500 { return &RedoActions; }
|
|
To calculate the size of the operation, i.e the sum of the sizes of the operation's actions.
Definition at line 1001 of file ops.cpp. 01002 { 01003 UINT32 TotalOfActionSizes = 0; 01004 01005 // Do we really need this ensure? It appears to run fine without it (sjk 29/3/00) 01006 // ENSURE((RedoActions.IsEmpty() || UndoActions.IsEmpty()), 01007 // "An operation's UNDO and REDO action lists both contained actions"); 01008 01009 // Calculate size of all Undo actions 01010 01011 // Get first action of operation 01012 ListItem* pAc = (UndoActions.GetHead()); 01013 01014 while (pAc != NULL) // For each action 01015 { 01016 TotalOfActionSizes += ((Action*)pAc)->GetSize(); 01017 pAc = UndoActions.GetNext(pAc); 01018 } 01019 01020 // Calculate size of all Redo actions 01021 01022 pAc = (RedoActions.GetHead()); 01023 01024 while (pAc != NULL) // For each action 01025 { 01026 TotalOfActionSizes += ((Action*)pAc)->GetSize(); 01027 pAc = RedoActions.GetNext(pAc); 01028 } 01029 01030 // Calculate size of all Smart actions 01031 01032 pAc = (SmartActions.GetHead()); 01033 01034 while (pAc != NULL) // For each action 01035 { 01036 TotalOfActionSizes += ((Action*)pAc)->GetSize(); 01037 pAc = SmartActions.GetNext(pAc); 01038 } 01039 01040 return (TotalOfActionSizes); 01041 }
|
|
Definition at line 501 of file ops.h. 00501 { return &SmartActions; }
|
|
Each DragOp should override this function to return valid status line text.
Reimplemented in OpCreateFill, OpEditFill, TransOperation, OpPush, and OpZoom. Definition at line 2050 of file ops.cpp. 02051 { 02052 *ptext=""; // defaults to a null string 02053 return TRUE; 02054 }
|
|
To find the UNDO action list of the operation.
Definition at line 1683 of file ops.cpp. 01684 { 01685 return (&UndoActions); 01686 }
|
|
Definition at line 499 of file ops.h. 00499 { return &UndoActions; }
|
|
Definition at line 410 of file ops.h. 00410 { return pOurDoc; }
|
|
Find out which document this operation is working on. This will remain constant throughout the life of most operations with the exception of DialogOps. (The File open operation also changes its working document but this is a very rare exception). Returns the View that is associated with this operation. Note that the majority of operations don't care what view they work on - most of them are document-based, and cause all views attached to a document to be updated. However, some operations such as zooming, changing the quality etc. only work on a particular view. Returns the DocView that is associated with this operation. This will return NULL if the View the operation is attached to is not actually a DocView (e.g. it may be a PrintView). Note that the majority of operations don't care what view they work on - most of them are document-based, and cause all views attached to a document to be updated. However, some operations such as zooming, changing the quality etc. only work on a particular view.
Definition at line 975 of file ops.cpp. 00976 { 00977 // Return the DocView if we are attached to one, otherwise just return NULL. 00978 if (pOurView->IS_KIND_OF(DocView)) 00979 return (DocView *) pOurView; 00980 else 00981 return NULL; 00982 }
|
|
Definition at line 411 of file ops.h. 00411 { return pOurView; }
|
|
Definition at line 538 of file ops.h. 00538 { pDocToInformOfOpStatus = pDoc; };
|
|
Does any Operation initialisation necessary. Declares an Operation INI setting.
Reimplemented in DebugTreeDlg. Definition at line 473 of file ops.cpp. 00474 { 00475 BOOL ok = TRUE; 00476 00477 // I've taken out the ability to switch auto-repeats off during drags (Markn - 19/10/95) 00478 /* 00479 // Declare the section that the preferences for Operations will live in 00480 if (ok) ok= Camelot.DeclareSection(TEXT("Dragging"), 1); 00481 00482 // declare the var 00483 if (ok) ok= Camelot.DeclarePref(TEXT("Dragging"), TEXT("KeyboardRepeatOffDuringDrags "), &Operation::KeyboardRepeatOffDuringDrags, 0, 1); 00484 */ 00485 return ok; 00486 }
|
|
Definition at line 396 of file ops.h.
|
|
This function converts a coordinate relative to one spread so that it is then relative to another spread.
Definition at line 1276 of file ops.cpp. 01277 { 01278 // Translate the Spread Coord 'Pos' into Document coordinates, and thence to logical coords 01279 Src->SpreadCoordToDocCoord(&Pos); 01280 WorkCoord LogicalPos = Pos.ToLogical(Src, GetWorkingView()); 01281 01282 // and get the dest spread origin in logical coords 01283 DocCoord DestSpreadOrigin = Dest->GetSpreadCoordOrigin(TRUE, GetWorkingView()); 01284 WorkCoord LogicalDest = DestSpreadOrigin.ToLogical(Dest, GetWorkingView()); 01285 01286 // Work out the difference between the two 01287 XLONG OffsetX = LogicalPos.x - LogicalDest.x; 01288 XLONG OffsetY = LogicalPos.y - LogicalDest.y; 01289 DocCoord Result( OffsetX, OffsetY ); 01290 01291 // and return the result 01292 return Result; 01293 }
|
|
This virtual function handles clicks with one mouse button while another mouse button is dragging. For example, the user drags with the left mouse button and clicks the right button during the drag.
Feel free to add other overriding function to handle clicks-while- dragging for other operations.
Reimplemented in TransOperation. Definition at line 4893 of file ops.cpp. 04894 { 04895 //This function does nothing. It's overridden by TransOperation::OnClickWhileDragging. 04896 }
|
|
Called on idle events if an operation has tegistered to recieve them.
Reimplemented in ColourEditDlg, DownloadOp, OpThumbDownload, OpAsynchClipartImport, OpAddWebFolders, OpAddWebLibrary, ViewOps, NameGallery, PreviewDialog, SuperGallery, NameGallery, StatusLine, and DragManagerOp. Definition at line 2031 of file ops.cpp. 02032 { 02033 return FALSE; 02034 }
|
|
Definition at line 2008 of file ops.cpp. 02009 { 02010 02011 // Inform the user that the operation has failed 02012 InformWarning(_R(IDS_UNDO_MEMORY_FAILURE), 02013 _R(IDS_OK)); 02014 FailAndExecute(); 02015 }
|
|
Definition at line 394 of file ops.h.
|
|
To execute the operation's redo action list.
Reimplemented in OpMakeColourLocalToFrame, OpHideColours, OpColourChange, OpGuideline, OpLayerGalChange, OpLayerChange, and OpBlendNodes. Definition at line 1531 of file ops.cpp. 01532 { 01533 ERROR2IF(RedoActions.IsEmpty(), FALSE, "Trying to execute an empty REDO action list"); 01534 01535 OpStatus = REDO; 01536 RedoActions.ExecuteBackwards(FALSE); 01537 BOOL fSuccess = !OpFlags.Failed; 01538 if (fSuccess) 01539 { 01540 PORTNOTE("other","Removed OpChangeBarProperty usage") 01541 #ifndef EXCLUDE_FROM_XARALX 01542 NameGallery* pNameGallery = NameGallery::Instance(); 01543 if (pNameGallery != 0) 01544 { 01545 pNameGallery->PreTriggerEdit((UndoableOperation*) this, 0, (Node*) 0); 01546 if (IS_A(this, OpChangeBarProperty)) 01547 pNameGallery->m_TouchedBar = ((OpChangeBarProperty*) this)->m_BarIndex; 01548 } 01549 #endif 01550 } 01551 01552 End(); 01553 return fSuccess; 01554 }
|
|
This function should be called from the operations Init method. It creates an OpDescriptor for the operation.
Definition at line 1948 of file ops.cpp. 01966 { 01967 BOOL ok = TRUE; 01968 01969 // tok is going into a string which turns out to be a string 32, so do a sanity check (Neville 26/6/97) 01970 size_t len = camStrclen(tok); 01971 ERROR2IF(len > 32,FALSE,"Operation::RegisterOpDescriptor token buffer overflow!"); 01972 01973 // Try to create the OpDescriptor 01974 OpDescriptor* pHorzOpDesc = new OpDescriptor( 01975 toolID, 01976 txID, 01977 RuntimeClass, 01978 tok, 01979 gs, 01980 helpId, 01981 bubbleID, 01982 resourceID, 01983 controlID, 01984 ReceiveMessages, 01985 Smart, 01986 Clean, 01987 OneOpenInstID, 01988 AutoStateFlags, 01989 fCheckable 01990 ); 01991 01992 ok = (pHorzOpDesc != NULL); 01993 01994 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX) 01995 // If a hidden group bar has been specified try to connect the new OpDescriptor to 01996 // a group bar... 01997 if (GroupBarID && ok) 01998 { 01999 ok = SystemBarOp::Connect(GroupBarID,pHorzOpDesc,pVertOpDesc); 02000 } 02001 #endif 02002 02003 ERRORIF(!pHorzOpDesc, _R(IDE_NOMORE_MEMORY), FALSE); 02004 return TRUE; 02005 }
|
|
This function is called by other parts of the operation to put on and take off drag EORing. It will also be called as part of the main redraw loop in the case where part of the window has become invalid (due to scrolling maybe). The function should contain a RenderOnTop loop as described in DocView::RenderOnTop. This function can make no assumptions about where it is being called from.
Reimplemented in OpGuideline, OpSpreadOrigin, OpDragOrigin, OpDragBox, OpCreateFill, OpEditFill, OpEditRectangle, OpNodePathEditBlob, OpNodePathEditControlBlob, OpPenDragBlobs, OpPenEditPath, OpDragRegularShape, OpReformShapeEdge, TransOperation, OpBlendNodes, OpContourNodes, OpGridNewResize, OpGridSelection, OpSelectPathPoints, OpDrawBrush, OpFreeHand, OpNewRegShape, OpSelectorDragBox, OpDragRotateCentre, OpCreateTextObject, and OpDragStoryIndent. Definition at line 1314 of file ops.cpp. 01315 { 01316 // This function will do nothing. It should exist in derived classes of those 01317 // operations that want to render things during a drag. 01318 }
|
|
Sets the QuickRender flag.
Definition at line 1114 of file ops.cpp. 01115 { 01116 if (s_bQuickRender && !bNewState) 01117 { 01118 // Flush any pending renders now, before we reset the quickrender flag 01119 DocView* pDocView = DocView::GetCurrent(); 01120 if (pDocView) 01121 { 01122 pDocView->FlushRedraw(); 01123 GetApplication()->ServiceRendering(TRUE); 01124 } 01125 } 01126 01127 // Now reset the flag 01128 s_bQuickRender = bNewState; 01129 if (bNewState && CurrentDragOp==NULL) 01130 CurrentDragOp = pQROp; 01131 if (!bNewState && CurrentDragOp==pQROp) 01132 CurrentDragOp = NULL; 01133 }
|
|
Reimplemented in OpDragRegularShape, OpBlendNodes, OpContourNodes, OpFreeHand, OpPush, OpSelectorDragBox, OpTextSelection, and OpZoom. Definition at line 343 of file ops.h. 00343 { return TRUE; }
|
|
To start a drag.
Definition at line 1739 of file ops.cpp. 01744 { 01745 if (CurrentDragOp == NULL) // Check if any other operations are currently performing a 01746 // drag 01747 { 01748 // No other operations are performing a drag 01749 01750 // Tell the OS to start dragging 01751 pDraggingDocView = DocView::GetCurrent(); 01752 if (pDraggingDocView->StartDrag(this, 01753 type, 01754 MoveBBox, 01755 StartPos, 01756 KeepAccuracy, 01757 bSolidDragSupported)) 01758 { 01759 CurrentDragOp = this; // Record the operation 01760 01761 // I've taken out the ability to switch auto-repeats off during drags (Markn - 19/10/95) 01762 /* 01763 if (KeyboardRepeatOffDuringDrags && !ResetKeyboardSpeed) 01764 { 01765 // Get the current keyboard repeat rate 01766 ::SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &CurKeyboardSpeed, 0); 01767 01768 // Reset the repeat rate to 0 (i.e. no repeat) 01769 ResetKeyboardSpeed = ::SystemParametersInfo(SPI_SETKEYBOARDSPEED, 0, NULL, 0); 01770 } 01771 */ 01772 01773 return (TRUE); 01774 } 01775 else 01776 pDraggingDocView = 0; 01777 } 01778 return (FALSE); 01779 }
|
|
This function can be called to discard the operation when it ends. Any hidden nodes which have been generated will remain in the tree.
Definition at line 1454 of file ops.cpp. 01455 { 01456 OpFlags.SucceedAndDiscard = TRUE; 01457 }
|
|
To execute the operation's undo action list.
Reimplemented in OpMakeColourLocalToFrame, OpHideColours, OpColourChange, OpGuideline, OpLayerGalChange, OpLayerChange, and OpBlendNodes. Definition at line 1487 of file ops.cpp. 01488 { 01489 ERROR2IF(UndoActions.IsEmpty(), FALSE, "Trying to execute an empty UNDO action list"); 01490 01491 OpStatus = UNDO; 01492 UndoActions.ExecuteBackwards(FALSE); 01493 BOOL fSuccess = !OpFlags.Failed; 01494 PORTNOTE("other","Removed OpChangeBarProperty usage") 01495 #ifndef EXCLUDE_FROM_XARALX 01496 if (fSuccess) 01497 { 01498 NameGallery* pNameGallery = NameGallery::Instance(); 01499 if (pNameGallery) 01500 { 01501 pNameGallery->PreTriggerEdit((UndoableOperation*) this, 0, (Node*) 0); 01502 if (IS_A(this, OpChangeBarProperty)) 01503 pNameGallery->m_TouchedBar = ((OpChangeBarProperty*) this)->m_BarIndex; 01504 } 01505 } 01506 #endif 01507 01508 End(); // End the operation properly, remember that this may delete the operation 01509 return fSuccess; 01510 }
|
|
This calls the Document version of this func for all documents in the application.
Definition at line 2227 of file ops.cpp. 02228 { 02229 ERROR2IF(pParam == NULL,FALSE,"pParam == NULL"); 02230 02231 BOOL ok = TRUE; 02232 Document* pDoc = (Document*)GetApplication()->Documents.GetHead(); 02233 while (pDoc != NULL && ok) 02234 { 02235 ok = UpdateChangedNodes(pParam,pDoc); 02236 pDoc = (Document*)GetApplication()->Documents.GetNext(pDoc); 02237 } 02238 return ok; 02239 }
|
|
Helper function for UpdateChangedNodes() (which calls this for each layer in a spread). This will call itself recursively for all children, to ensure a depth-first traversal of the tree.
Definition at line 2132 of file ops.cpp. 02133 { 02134 if (pNode == NULL) return TRUE; 02135 if (pParam == NULL) return FALSE; 02136 02137 BOOL ok = TRUE; 02138 02139 while (pNode != NULL) 02140 { 02141 // Get the op permission state for this node 02142 OpPermissionState OpState = pNode->GetOpPermission(); 02143 02144 // if NOT undefined, we are dealing with a node that's been involved in the op, so update children of node 02145 if (OpState != PERMISSION_UNDEFINED) 02146 ok = ok && UpdateChangedNode(pParam,pNode->FindFirstChild()); 02147 02148 // If the node allowed the op to happen, and the change type is NOT one to ignore, 02149 // inform the node via OnChildChange 02150 if (ok && OpState == PERMISSION_ALLOWED && pParam->GetChangeType() != OBJCHANGE_IGNORE) 02151 ok = (pNode->OnChildChange(pParam) == CC_OK); 02152 else 02153 { 02154 // BODGE TEXT - this is HORRIBLE but the safest way to clear flags in text story on failure 02155 if (IS_A(pNode,TextStory)) 02156 ((TextStory*)pNode)->ClearNodeAndDescendantsFlags(); 02157 } 02158 02159 // Set the op permission to undefined, as we've finished with this node now 02160 pNode->SetOpPermission(PERMISSION_UNDEFINED); 02161 02162 // get the next sibling node 02163 pNode = pNode->FindNext(); 02164 } 02165 02166 return ok; 02167 }
|
|
This calls the Spread version of this func for all spreads in the given doc.
Definition at line 2185 of file ops.cpp. 02186 { 02187 ERROR2IF(pParam == NULL,FALSE,"pParam == NULL"); 02188 ERROR2IF(pDoc == NULL,FALSE,"pDoc == NULL"); 02189 02190 BOOL ok = TRUE; 02191 Chapter* pChapter = Node::FindFirstChapter(pDoc); 02192 while (pChapter != NULL && ok) 02193 { 02194 // Now find the first child of the Chapter, because this is the level at which Spreads hang out 02195 Node* pNode = pChapter->FindFirstChild(); 02196 02197 // Update changed nodes in each of the chapter's spreads 02198 while (pNode != NULL && ok) 02199 { 02200 if (pNode->IsSpread()) 02201 ok = UpdateChangedNodes(pParam,(Spread*)pNode); 02202 02203 pNode = pNode->FindNext(); 02204 } 02205 02206 pChapter = pChapter->FindNextChapter(); 02207 } 02208 02209 return ok; 02210 }
|
|
This calls OnChildChange() on all nodes that were effected by the op. This includes all parents of all effect nodes too. It calls the effected nodes in a depth-first traversal.
It is specified that even if this func returns FALSE, all nodes that were asked (i.e. all nodes that have an op permission state of either PERMISSION_ALLOWED or PERMISSION_DENIED) will have their permission state reset to PERMISSION_UNDEFINED. This function updates all nodes on the spread's layers. Only effected nodes up to the layer level have their OnChildChange() function called. EXCEPTION: If pParam's ObjChangeType is OBJCHANGE_IGNORE, the effected nodes do NOT have their OnChildChange() param called, but everything else applies, i.e. all effected nodes will have their op permission state reset to PERMISSION_UNDEFINED. This OBJCHANGE_IGNORE type is used by Operation::End() so that it can ensure the tree is in a safe state, even if an op fails, and/or an op is not implemented correctly.
Reimplemented in UndoableOperation. Definition at line 2093 of file ops.cpp. 02094 { 02095 ERROR2IF(pParam == NULL,FALSE,"pParam == NULL"); 02096 if (pSpread == NULL) pSpread = Document::GetSelectedSpread(); 02097 //ERROR2IF(pSpread == NULL,FALSE,"Can't find a spread to work on"); 02098 02099 if (pSpread == NULL) 02100 return TRUE; 02101 02102 // We need to invalidate the sel range just in case it's been cached in the middle of an op. 02103 // If the sel range is cached when nodes in the tree have op permission state that's PERMISSION_DENIED 02104 // then nodes that should potentially be included in the range will be excluded. 02105 // And as the thing's cached all hell breaks loose, so yet another independent system has to know 02106 // about sel ranges and the fact they're cached, and yes it does scare me. 02107 // SelRange* pRange = GetApplication()->FindSelection(); 02108 // if (pRange != NULL) 02109 // pRange->Update(FALSE,NULL); 02110 02111 return UpdateChangedNode(pParam,pSpread->FindFirstChild()); 02112 }
|
|
Definition at line 1865 of file ops.cpp. 01866 { 01867 if (!DeleteUndoOpsToMakeSpace) 01868 { 01869 // Inform the user that there is not enough system memory. Give them the option of 01870 // trying to make room for the action object by deleting undo records. 01871 if (InformWarning(_R(IDS_DELETE_UNDO), 01872 _R(IDS_OK), 01873 _R(IDS_CANCEL)) == 2) 01874 { 01875 FailAndExecute(); 01876 return (FALSE); 01877 } 01878 } 01879 DeleteUndoOpsToMakeSpace = TRUE; 01880 return (TRUE); 01881 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reimplemented in OpMakeColourLocalToFrame. |
|
|
|
|
|
|
|
|
|
|
|
|