#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 |