#include <docview.h>
Inheritance diagram for DocView:

Public Member Functions | |
| DocView (Document *) | |
| DocView class constructor A DocView object is usually created by the Document and is linked into a list of DocViews owned by the Document. So the DocView constructor takes and stores a pointer to the Document object so that it can get to it quickly. | |
| virtual | ~DocView () |
| DocView class destructor. | |
| BOOL | Init () |
| Init a doc view. | |
| void | OnNewView () |
| Called by CCamView as part of its "initial update" function provided that this view onto a document has not been previously saved and reloaded. Sets the defaults, eg. scroll offset, for newly created views. | |
| void | OnLoadedView () |
| Called by CCamView as part of its "initial update" function provided that this view onto a document has been previously saved and reloaded. Currently does nothing, but one day - who knows. | |
| BOOL | SetCurrent () |
| Make this object be the 'current' DocView. | |
| virtual void | SetViewPixelSize () |
| Sets up the normal and scaled pixel sizes according to this view. | |
| virtual CNativeWnd * | GetRenderWindow () |
| Get a pointer to a CNativeWnd window object associated with a DocView. | |
| BOOL | StartDrag (Operation *, DragType, DocRect *pMoveBBox, DocCoord *StartPos, BOOL KeepAccuracy, BOOL bSolidDragSupported=FALSE) |
| Tells the world that a drag is starting. | |
| BOOL | EndDrag (Operation *) |
| Tell the oil layer that the drag has finished. | |
| BOOL | ChangeDragType (DragType Type) |
| Change the type of drag during the middle of a drag. This can only be called if there is a drag already happening (ie between calls to StartDrag and EndDrag). | |
| void | DragPointerMove (Operation *, OilCoord, ClickModifiers) |
| Tell the current dragging operation that the pointer has moved. This function is ony called when a drag has been started in CCamView by calling its StartDrag function and should not be called after EndDrag has been called. | |
| void | DragPointerIdle (Operation *, OilCoord, ClickModifiers) |
| Tell the current dragging operation that the pointer has NOT moved and that there is idle CPU time to be used. This function is only called when a drag has been started in CCamView by calling its StartDrag function and should not be called after EndDrag has been called. | |
| void | DragFinished (Operation *, OilCoord, ClickModifiers, BOOL) |
| Tell the current dragging operation that the drag has ended either because the pointer buttons have all been released or the drag has been aborted in some way (Escape was pressed?). This function is ony called when a drag has been started in CCamView by calling its StartDrag function and should not be called after EndDrag has been called. | |
| BOOL | IsSingleClickReallyTriple () const |
| For determining wether the current single click event is really a triple click It only makes sense to call this when you are processing a click event! | |
| BOOL | IsSingleClickReallyQuad () const |
| For determining wether the current single click event is really a quad click It only makes sense to call this when you are processing a click event! | |
| void | OnMouseMove (OilCoord, ClickModifiers) |
| Converts the mouse position into document coordinates, then calls the OnMouseMove() function of the currently selected tool with this information. | |
| void | OnClick (OilCoord, ClickType, ClickModifiers) |
| Convert click coordinates into DocCoords and pass them on to the current tool. | |
| void | RenderSelectBlobs (DocRect Rect, Spread *pSpread) |
| Renders the Selection blobs of all the currently selected objects. | |
| BOOL | IsMouseMoved () |
| This function finds out if the mouse has moved yet. This is only really useful if you are doing some processing as a result of a mouse move event. If, in the middle of your processing, you discover that the mouse has moved again, you may be able to stop processing immediatly and wait for the next mouse event to arrive in the not too distant future. | |
| WorkCoord | GetClickWorkCoord () |
| To let people know where the last click was in Work Coordinates. | |
| ObjectDragTarget | IsPointerOverNode (NodeRenderableInk **ThisNode, INT32 Range, BOOL Interrupt=TRUE, BOOL bColourDrag=FALSE) |
| to determine whether pointer is over 1 - an objects outline 2 - any visible fill blobs 3 - a simple (non grouped) object | |
| BOOL | DM_DragFinished (DragInformation *DragInfo, ViewDragTarget *pDragTarget) |
| act at the end of a general drag according to the drag type. | |
| void | SetSolidDragState (BOOL bNewState) |
| BOOL | GetCurrentSolidDragAbility () |
| BOOL | GetCurrentSolidDragState () |
| void | ClearClickState () |
| Allows click handlers to reset the click logic if they are doing things that would break it. | |
| virtual BOOL | HandleKeyPress (KeyPress *pKeyPress) |
| Passes keystroke events to the current drag op, if dragging, or the current tool, if not. | |
| void | ResetRenderingStartTime () |
| BOOL | GetShowPrintBorders () |
| void | SetShowPrintBorders (BOOL State) |
| Spread * | FindEnclosingSpread (OilCoord) |
| Given a chapter and an OilCoord, finds the spread that contains the coordinate. | |
| Spread * | OilToSpreadCoord (OilCoord, DocCoord *) |
| Combines the functions of FindEnclosingSpread and OilCoord::ToDoc. Finds which spread an OilCoord is in and then computes the DocCoord of that position within the spread. | |
| virtual BOOL | RenderPageMarks (RenderRegion *, Matrix &, DocRect &, Spread *) |
| Performs the rendering of page marks, ie crop marks, registration marks etc to the screen and printer. This base class version does nothing. All mark rendering technology is held in DocView and PrintView. Performs the rendering of page marks, ie crop marks, registration marks etc to the screen and printer. This base class version does nothing. All mark rendering technology is held in DocView and PrintView. | |
| void | ContinueRenderView (RenderRegion *pRegion, Spread *pSpread, BOOL fRenderPaper=TRUE, BOOL fDeleteRegionAfter=TRUE, BOOL bForceImmediate=FALSE) |
| To re-start rendering a Document through a given RenderRegion. This call is different from RenderView because it may need to re-compute the Doc to OS matrix. | |
| void | RenderEntireView (RenderRegion *pRender, Spread *pSpread) |
| To render a Document through a given RenderRegion. This differs from your regular RenderView service in that it pays no mind as to how long things take. Once you start this function off it will run until it renders the lot. The reason for this is that it is designed for use with the brush tool. Here we will need to render the entire view into an offscreen bitmap which is then used to with the brush. It serves as an alternative when we cannot simply blit the contents of the screen. I don't really recommend using this function in other circumstances as if you have a complex document it will probably lock up for a while. | |
| virtual BOOL | GetForeBackMode () |
| To find out if background rendering is on. | |
| virtual void | SetForeBackMode (BOOL) |
| Set the background render flag for this view. Also sets the new value to be used as the default preference. | |
| void | ForceRedraw (BOOL ForcePaper=FALSE) |
| Force the entire view to be redrawn. NB. If you are redrawing because you have changed the zoom or scroll offsets, then you must pass in TRUE for ForcePaper!!! (Because (a) Otherwise our scroll offsets are invalid and the next time we scroll it gets mucked up, and (b) Scrolling or zooming should give instant feedback to the user.). | |
| void | ForceRedraw (WorkRect &) |
| Force a specific rectangle of the view to be redrawn. | |
| void | ForceRedraw (Spread *, DocRect, BOOL Accumulate=FALSE, Node *pInvalidNode=NULL) |
| Force redraw of an area of a spread. | |
| void | FlushRedraw () |
| Intelligently invalidate all the regions gathered so far for this DocView. This performs smart invalidation depending on the number and nature of the regions. | |
| void | HandleNodeDeletion (Node *pNode) |
| Intelligently invalidate all the regions gathered so far for this DocView. This performs smart invalidation depending on the number and nature of the regions. | |
| RenderRegion * | GetFirstRenderRegion (DocRect &, Spread *, OnTopCode Reason) |
| RenderRegion's cannt span Spreads, because different Matrices are needed for the Coordinate transforms. This Function (Along with GetNext...) is used to Split a DocRect area into a number of RenderRegions depending on the number of spreads the DocRect spans. First call this function to return the first RenderRegion (there will always be at least one for a valid DocRect), and then call GetNextRenderRegion until it returns NULL (which may be immediately). Repeat the Rendering process for each RenderRegion returned. You do NOT need to call Init/Exit Render as they will be set up for Immediate rendering. | |
| RenderRegion * | GetNextRenderRegion (DocRect &, Spread *, OnTopCode Reason) |
| Used to split a DocRect to be redrawn into one or more RenderRegions. See DocView::GetFirstRenderRegion(DocRect& ClipRect) for more details. | |
| void | ShowViewScrollers (BOOL fIsVisible) |
| Pass on Show Hide Scrollers Message to CamView. | |
| void | ShowViewRulers (BOOL fIsVisible) |
| Pass on Show Hide Rulers Message to CamView. | |
| BOOL | AreRulersVisible () |
| BOOL | AreScrollersVisible () |
| BOOL | SetViewScale (FIXED16 NewScale) |
| Set the viewing scale factor for this view. (Also, sets up the scaled pixel size in DocCoord if this View is current. | |
| BOOL | SetScrollOffsets (WorkCoord NewTopLeft, BOOL RedrawNeeded) |
| To scroll this view to a new position over the document. The coordinate supplied is the coordinate of the top left corner of the viewport onto the document. The RedrawNeeded flag is TRUE when any invalid areas created should be redrawn immediately and FALSE if they should be ignored. | |
| void | ScrollToShow (DocCoord *pCoord) |
| Scrolls the currently selected document view to bring this coord into view. If this coord is already visible then we do nothing. | |
| void | ScrollToShow (DocRect *RectToShow) |
| Scrolls the currently selected view to ensure that as much as possible of RectToShow is visible. If the entire rect cannot be seen, then it will scroll the minimum distance in order to make a part of it visible. | |
| void | ScrollToShow (DocRect *pBoundingBox, DocCoord Direction) |
| Scrolls the currently selected view to ensure that edge(s) of pBoundingBox are visible. The Direction argument tells us which edges. If the movement was towards the top of the screen then we need to make the top edge of the DocRect visible. | |
| void | ScrollToShowWithMargin (DocCoord *pCoord) |
| Scrolls the currently selected view to show the coord; if the coord in already in view then we do nothing. | |
| void | ScrollToShowWithMargin (DocRect *RectToShow) |
| Scrolls the currently selected view to ensure that as much as possible of RectToShow is visible. If the entire rect cannot be seen, then it will scroll the minimum distance in order to make a part of it visible. | |
| void | ScrollToShowWithMargin (DocRect *pBoundingBox, DocCoord Direction) |
| Scrolls the current view to show parts of pBoundingBox. The edge(s) of pBoundingBox are determined by Direction, if we have moved objects towards the top of the screen then we need to ensure that the top edge of the DocRect is visible. | |
| BOOL | ViewStateChanged () |
| Inform the DocView that the ViewState has been changed in some way. When this function detects a new ViewState object (IsNewView = TRUE) it sets the scroll offsets to the top left hand corner of the first page in the document. | |
| DocRect | GetDocViewRect (Spread *) |
| To find the rectangle describing the viewport onto the document. | |
| void | SetExtent (DocCoord, DocCoord) |
| Informs the DocView that the extent of the document has changed in some way and that the view must be altered to take this into account (namely the scrollbars). | |
| WorkRect | GetViewRect () |
| To find the rectangle describing the viewport onto the document. | |
| INT32 | GetZoomTableIndex () const |
| void | SetZoomTableIndex (INT32 nIndex) |
| INT32 | GetPrevZoomIndex () const |
| Returns the index into the zoom tool's tabel of a previous zoom on this DocView. | |
| void | SetPrevZoomIndex (INT32 nIndex) |
| Sets the zoom table index of a previous zoom onto this DocView. | |
| FIXED16 | GetPrevZoomScale () const |
| void | SetPrevZoomScale (FIXED16 fxScale) |
| Sets the scale factor this DocView will "remember" as a previous zoom. | |
| WorkCoord | GetPrevZoomOffset () const |
| void | SetPrevZoomOffset (const WorkCoord &wcOffset) |
| Sets the scroll offset this DocView will "remember" as a previous zoom. | |
| BOOL | Snap (Spread *pSpread, DocCoord *pDocCoord, BOOL TryMagSnap=TRUE, BOOL TryGridSnap=TRUE) |
| Allows you to easily snap a coord to something relevant in the given spread (e.g. to a grid, magnetic object, etc). | |
| BOOL | Snap (Spread *pSpread, DocRect *pDocRect, const DocCoord &PrevCoord, const DocCoord &CurCoord) |
| Allows you to easily snap a rectangle to something relevant in the given spread (e.g. to a grid, magnetic object, etc). | |
| BOOL | GetSnapToGridState () |
| To find the "Snap to grid" state of a DocView. | |
| void | SetSnapToGridState (BOOL SnapToGrid) |
| Allow you to change the "snap to grid" state of a DocView. | |
| BOOL | GetShowGridState () |
| To find the "Show grid" state of a DocView. | |
| void | SetShowGridState (BOOL ShowGrid) |
| Allow you to change the "show grid" state of a DocView. | |
| BOOL | GetSnapToObjectsState () |
| To find the "Snap to all objects" state of a DocView. | |
| void | SetSnapToObjectsState (BOOL SnapToObjects) |
| Allow you to change the "snap to all objects" state of a DocView. | |
| BOOL | GetSnapToMagObjectsState () |
| To find the "Snap to magnetic objects" state of a DocView. | |
| void | SetSnapToMagObjectsState (BOOL SnapToMagObjects) |
| Allow you to change the "snap to magnetic objects" state of a DocView. | |
| BOOL | GetSnapToGuidesState () |
| void | SetSnapToGuidesState (BOOL State) |
| BOOL | GetShowGuidesState () |
| void | SetShowGuidesState (BOOL State) |
| Spread * | GetVisibleSpread () |
| Compares the bounding rectangles of Spreads in this view's document with the section of the document currently visible in the view, looking for the largest spread object that is within the view. If none are visible then the function returns NULL. | |
| Spread * | GetFirstSelectedSpread () |
| Searches for a selected object in the document, and returns a pointer to the spread containing said object. If there are no selected objects then it returns NULL. | |
| RulerPair * | GetpRulerPair () |
| DocCoord | GetCentreCoord () |
| Gets a DocCoord for the centre of the view. | |
| ImportPosition | GetCentreImportPosition () |
| Gets an import position for the centre of the view. | |
| DocCoord | GetTopLeftCoord () |
| Gets a DocCoord for the top left of the view. | |
| ImportPosition | GetTopLeftImportPosition () |
| Gets an import position for the top left of the view. | |
| double | GetZoomFactor () |
| Obtain the current zoom factor for this document view. | |
| void | SetPreventRenderView (BOOL Value) |
| To set our member variable that will prevent rendering of the view. As you might imagine this is something to be careful about. | |
| BOOL | GetPreventRenderView () |
| As above. | |
| void | NotifyBoundsChanged (BOOL bNewValue=TRUE) |
Static Public Member Functions | |
| static BOOL | DeclarePreferences () |
| Declares any preferences that the DocView class needs to decalre. | |
| static DocView * | GetCurrent () |
| This function returns the parameters which control the transformation of coordinates between Document space and OS space. These parameters can be used to build transformation matrices to perform the transformation in either direction. Clips the DocRect so that it does not go outside the Chapter Bounds. This is used to try and stop the problems with DocCoords that are not within any chapters (ie. in OffPaste area). Find the current DocView object which SHOULD have been set as one of the very first actions during event processing. | |
| static void | SetNoCurrent () |
| Set the current DocView pointer to be NULL, i.e., there is no current DocView object. | |
| static DocView * | GetSelected () |
| Find the selected DocView object which SHOULD have been set as one of the very first actions during event processing. | |
| static CNativeWnd * | GetCurrentRenderWindow () |
| Useful function allowing fairly direct access to CCamView's render window, which comes in handy on the odd occasion. | |
| static BOOL | GetCurrentMousePos (Spread **ppSpread, DocCoord *pdcMousePos) |
| Reports the position of the mouse if it is within the "selected" DocView. It position is "returned" in Spread coordinates. | |
| static RenderRegion * | RenderOnTop (DocRect *Rect, Spread *pSpread, OnTopCode Reason) |
| Marks the start of an 'On Top' rendering loop. On Top simply means that the rendering will be done directly over the top of anything else that happens to be there, without causeing a redraw from the bottom of the tree. This functions main use is drawing on the EOR blobs that show selection, are part of a tool or are there to show a drag is in progress. This function could also be used to draw objects that we know will be placed on top of all other objects (ie a new object, being drawn for the first time). You should always use a loop like the one below :- MonoOn RenderRegion* pRegion = DocView::RenderOnTop( MyRect, EOR ); while ( pRegion ) { Do your EOR rendering in here pRegion = DocView::GetNextOnTop( MyRect ); } MonoOff This bit of code will loop through all the invalid regions that the OS needs redrawing as well as all the rectangles that Camelot splits a region into itself. IMPORTANT : Because this is a loop, you should not change the state of any data within it, because it will then be different the second time the code in the loop is executed. | |
| static RenderRegion * | GetNextOnTop (DocRect *) |
| This function continues the RenderOnTop loop, returning the next RenderRegion to be considered. If we are not in the outer most rendering loop then this function will return NULL, as it will be up to the top level to re-call everyone with the next render region. It should always be used as part of a rendering loop as described in DocView::RenderOnTop. | |
| static BOOL | SnapSelected (Spread *pSpread, DocCoord *pDocCoord, BOOL TryMagSnap=TRUE, BOOL TryGridSnap=TRUE) |
| Calls the Snap(pSpread,pDocCoord) function of the selected DocView. | |
| static BOOL | SnapSelected (Spread *pSpread, DocRect *pDocRect, const DocCoord &PrevCoord, const DocCoord &CurCoord) |
| Calls the Snap(pSpread,pDocRect,PrevCoord,CurCoord) function of the selected DocView. | |
| static BOOL | SnapCurrent (Spread *pSpread, DocCoord *pDocCoord, BOOL TryMagSnap=TRUE, BOOL TryGridSnap=TRUE) |
| Calls the Snap(pSpread,pDocCoord) function of the Current DocView. | |
| static BOOL | SnapCurrent (Spread *pSpread, DocRect *pDocRect, const DocCoord &PrevCoord, const DocCoord &CurCoord) |
| Calls the Snap(pSpread,pDocRect,PrevCoord,CurCoord) function of the Current DocView. | |
| static BOOL | SnapToMagneticNode (Spread *pSpread, Node *pNode, DocCoord *pDocCoord) |
| Calls magnetic snapping functions taking into acount the control flags held in this DocView. | |
| static BOOL | ForceSnapToGrid (Spread *pSpread, DocCoord *pDocCoord) |
| Calls grid snapper ignoring enabling flags. | |
| static BOOL | ForceSnapToGuides (Spread *pSpread, DocCoord *pDocCoord, GuidelineType Type) |
| Calls guideline snapper ignoring enabling flags. | |
| static void | ConstrainToAngle (DocCoord &, DocCoord *, double Constrain=0.0) |
| Constrains the mouse movement to rays coming out from a central point. This is ideal for rotation etc. You should use this version of the function as the other verison of the function is being phased out right now. | |
| static void | ConstrainToAngle (DocCoord &, double, DocCoord *) |
| Constrains the mouse movement to rays coming out from a central point. This is ideal for rotation etc. DO NOT USE THIS VERSION OF THE FUNCTION. There is a newer version that makes use of the constrain angle in the preferences and should be used instead of this version. | |
| static void | ConstrainToAspect (DocCoord &FixedPoint, FIXED16 &AspectLock, DocCoord *CurCoord) |
| Forces the supplied coordinate to be constrained to positions that force the aspect ratio from the fixed corner to be the one supplied. It should be called by the tools to 'snap' the coordinates from a drag to positions where the shape is not deformed. NOT FINISHED. | |
Static Public Attributes | |
| static BOOL | BackgroundRendering = TRUE |
| Defines whether or not to use background rendering on new views. 0 => No background rendering 1 => Use background rendering. | |
| static BOOL | SolidDragging = TRUE |
| Defines whether or not solid dragging is enabled. 0 => Solid dragging disabled 1 => Solid dragging enabled. | |
| static UINT32 | IdleDragDelay = 200 |
| Defines delay time in milliseconds between detecting idle state and showing extra dragging info. | |
| static UINT32 | IdleDragDelay2 = 1000 |
| Defines delay time in milliseconds between detecting idle state and showing extra dragging info. | |
| static BOOL | OriginOutlineShowNonOverlap = FALSE |
| Original outlines will be shown as soon as dragged items don't overlap originals. | |
| static BOOL | OriginOutlineShowAlways = FALSE |
| Original outlines will be shown as soon as dragged items don't overlap originals. | |
| static UINT32 | SolidDragTimeLimit = 333 |
| Defines time limit in milliseconds for solid drag redraw. When redraw takes longer than this value, dragging falls back to outline mode. | |
| static BOOL | OutlineShowBounds = TRUE |
| Dragged outlines will show a bounding rectangle. | |
| static double | DefaultConstrainAngle = PI / 4.0 |
| This is the default angle to which angles are constrained to (eg when rotating with constrain on, it will only rotate in multiples of this constrain angle. It must be greater than zero degrees and less than 360 degrees (note that it is recorded in radians). | |
Static Protected Member Functions | |
| static void | SetSelectedInternal (DocView *NewSelected) |
| This is an INTERNAL function, which MUST NOT BE CALLED by anything other than Document::SetSelectedViewAndSpread. | |
| static void | SendSelectedMessage (DocView *OldSelected, DocView *NewSelected) |
| This is an INTERNAL function, which MUST NOT BE CALLED by anything other than Document::SetSelectedViewAndSpread. | |
Protected Attributes | |
| RulerPair * | pRulerPair |
Private Member Functions | |
| CC_DECLARE_DYNAMIC (DocView) | |
| RenderRegion * | NewRenderRegion (DocRect, Matrix &, CNativeDC *, Spread *, RenderType) |
| void | RenderView (RenderRegion *pRegion, Matrix &mxTxform, Spread *pSpread, BOOL fRenderPaper, BOOL fDeleteRegionAfter=TRUE, BOOL bForceImmediate=FALSE) |
| To render a Document through a given RenderRegion. The dominating factor in this routine is that it renders the document with as little time overhead as possible. Obviously, this is mainly down to RenderRegions and the tree scanning routines working fast but we can do a bit to help. This routine is called directly by other functions in DocView and externally from the Background redraw Idle event processor. | |
| CNativeDC * | GetRenderDC () |
| Access function for the device context of this kernel view object. | |
| void | ScrollToShowAux (DocCoord *pCoord, DocCoord Margin) |
| Scrolls the view to ensure that pCoord is in the view, with a margin of Margin between it and the edges of the view. | |
Private Attributes | |
| BOOL | IsViewDying |
| INT32 | PushToolCursorID |
| Cursor | m_PushCursor |
| DocCoord | StartDragPos |
| DocCoord | OldDragPos |
| WorkCoord | LastWorkClick |
| Operation * | pCurrentDragOp |
| DocCoord | DragPos |
| BOOL | m_bSolidDragSupported |
| DocView::CCAPI | ViewFlags |
| MonotonicTime | StartTime |
| PendingRedraws | PendingRedrawList |
| INT32 | ZoomTableIndex |
| INT32 | PrevIndex |
| FIXED16 | PrevScale |
| WorkCoord | PrevOffset |
| CSnap * | pCSnap |
| BOOL | m_bPreventRenderView |
| BOOL | m_bBoundsChanged |
Static Private Attributes | |
| static DocView * | Selected = NULL |
| static OnTopCode | OnTopReason = Normal |
| static Spread * | OnTopSpread = NULL |
| static RenderRegion * | OnTopRenderRegion = NULL |
| static INT32 | OnTopCount = 0 |
| static UINT32 | ScrollToShowMargin = 18000 |
| Margins to use (in millipoints) when autoscrolling with a margin. | |
Friends | |
| class | Document |
| class | CCamView |
Classes | |
| struct | CCAPI |
When fully implemented it will also hold: Information about the viewing of separations in this view. Information about the state of "snap-to-grid" in this view. Information about the viewing of print-borders and tile boundaries.
The kernel calls functions in this class to change the view, and DocView in turn, calls CCamView. There are also functions which the OIL layer calls to inform the kernel when the OS forcibly changes the view.
If you can't find the information that you want from a DocView object then the next place to try is it's associated CCamView (if there is one) and after that the Document object itself. All these objects are linked to each other.
Definition at line 228 of file docview.h.
|
|
DocView class constructor A DocView object is usually created by the Document and is linked into a list of DocViews owned by the Document. So the DocView constructor takes and stores a pointer to the Document object so that it can get to it quickly.
Definition at line 732 of file docview.cpp. 00732 : 00733 m_PushCursor( (Tool_v1*)NULL, _R(IDC_PUSHTOOLCURSOR) ) 00734 { 00735 // Set the flag that indicates if the view is dying or not. Make sure it is not dying 00736 IsViewDying = FALSE; 00737 00738 // Implementation... 00739 ERROR3IF( pOwnerDoc == NULL, "DocView has no Owner Document !!" ); 00740 00741 pDoc = pOwnerDoc; // Maintain link to Document which owns us 00742 pViewWindow = NULL; // Clear pointer to window 00743 pVState = NULL; 00744 PushToolCursorID = 0; // Matt 12/01/2001 - Ensure it is set to a sensible value at creation 00745 pCurrentDragOp = NULL; // we aren't dragging just yet 00746 Scale = 1.0; // Viewing scale = 1.00 00747 00748 ViewFlags.BackgroundRender = BackgroundRendering; // Use preference 00749 00750 ViewFlags.GridShow = FALSE; // Grid not shown 00751 ViewFlags.GridSnap = FALSE; // Grid not snapping 00752 ViewFlags.ObjectsSnap = FALSE; // All objects not snapping 00753 ViewFlags.MagObjectsSnap = FALSE; // Magnetic objects not snapping 00754 ViewFlags.PrintBorderShow = FALSE; // Print borders not shown 00755 ViewFlags.LogicalView = TRUE; // Chapters are shown one above the other 00756 ViewFlags.WorkClickCached = FALSE; // Haven't got a click cached 00757 ViewFlags.Dragging = FALSE; // We're not dragging anything 00758 ViewFlags.GuidesSnap = TRUE; // Not snapping to guides 00759 ViewFlags.GuidesShow = TRUE; // Show guides by default 00760 00761 // Get the default quality level 00762 RenderQuality = Quality::DefaultQuality; 00763 00764 // Initialise the snap object to NULL. This is set up in the Snap functions 00765 pCSnap = NULL; 00766 00767 // init pointer to rulers 00768 pRulerPair = NULL; 00769 00770 // make sure we don't prevent ourselves from rendering 00771 m_bPreventRenderView = FALSE; 00772 00773 // Setup solid dragging flags 00774 m_bSolidDragSupported = FALSE; 00775 m_bSolidDrag = FALSE; 00776 00777 // Make ourselves current. 00778 SetCurrent(); 00779 00780 // Broadcast a message to all that there's a new view on the block . . . 00781 BROADCAST_TO_ALL(DocViewMsg(this, DocViewMsg::BORN)); 00782 00783 }
|
|
|
DocView class destructor.
Definition at line 799 of file docview.cpp. 00800 { 00801 // delete the rulers (must be done first to prevent them receiving doc view dying messages) 00802 if(pRulerPair) 00803 { 00804 delete pRulerPair; 00805 } 00806 pRulerPair=NULL; 00807 00808 // Set the flag that indicates if the view is dying. 00809 IsViewDying = TRUE; 00810 00811 // Make sure that Current and Selected do not refer to the dying DocView 00812 if (this == Current) SetNoCurrent(); 00813 if (this == Selected) Document::SetNoSelectedViewAndSpread(); 00814 00815 Camelot.DeleteRenderRegions(this); 00816 00817 // Inform parent doc that we are about to die 00818 pDoc->OnDocViewDying(this); 00819 00820 // Bye bye to the ViewState object (DON'T deallocate - done by CCamView). 00821 pVState = NULL; 00822 00823 // If we have an attached CSnap object, junk it 00824 if (pCSnap != NULL) delete pCSnap; 00825 00826 // Broadcast to everyone that this view is a dead duck. 00827 BROADCAST_TO_ALL(DocViewMsg(this, DocViewMsg::KILLED)); 00828 }
|
|
|
Definition at line 5141 of file docview.cpp. 05142 { 05143 return pViewWindow->AreRulersVisible( ); 05144 }
|
|
|
Definition at line 5161 of file docview.cpp. 05162 { 05163 return pViewWindow->AreScrollersVisible( ); 05164 }
|
|
|
|
|
|
Change the type of drag during the middle of a drag. This can only be called if there is a drag already happening (ie between calls to StartDrag and EndDrag).
Definition at line 3637 of file docview.cpp. 03638 { 03639 TRACE( _T("Warning - DocView::ChangeDragType called\n") ); 03640 // A bit of error checking 03641 ERROR3IF(pViewWindow == NULL, "ARGH! DocView is not connected to a window in ChangeDragType!"); 03642 ERROR3IF(pCurrentDragOp == NULL, "Not dragging in ChangeDragType"); 03643 03644 // Ask the Oil side of things to change the drag 03645 BOOL Result = pViewWindow->ChangeDragType(Type); 03646 return Result; 03647 }
|
|
|
Allows click handlers to reset the click logic if they are doing things that would break it.
Definition at line 5515 of file docview.cpp. 05516 { 05517 PORTNOTETRACE("other","DocView::ClearClickState - do nothing"); 05518 #ifndef EXCLUDE_FROM_XARALX 05519 if (pViewWindow) 05520 { 05521 pViewWindow->ClearClickState(); 05522 } 05523 #endif 05524 }
|
|
||||||||||||||||
|
Constrains the mouse movement to rays coming out from a central point. This is ideal for rotation etc. DO NOT USE THIS VERSION OF THE FUNCTION. There is a newer version that makes use of the constrain angle in the preferences and should be used instead of this version.
Definition at line 4815 of file docview.cpp. 04816 { 04817 // Just call the new version of the function 04818 ConstrainToAngle(Centre, CurCoord, Constrain); 04819 }
|
|
||||||||||||||||
|
Constrains the mouse movement to rays coming out from a central point. This is ideal for rotation etc. You should use this version of the function as the other verison of the function is being phased out right now.
Definition at line 4760 of file docview.cpp. 04761 { 04762 if (Constrain==0.0) 04763 { 04764 // Use the angle found in the preferences 04765 Constrain = DefaultConstrainAngle; 04766 } 04767 04768 // Find out which of the 2 axis are the most significant 04769 double dx = CurCoord->x - Centre.x; 04770 double dy = CurCoord->y - Centre.y; 04771 04772 // make sure that the cursor is not over the origin 04773 if ((dx==0) && (dy==0)) 04774 return; 04775 04776 // Find the square of the length of the ray 04777 double RayLength = sqrt((dy*dy) + (dx*dx)); 04778 04779 // Find the angle that this coord is around a circle 04780 double Angle = atan2(dy, dx); 04781 04782 // constrain the angle to the nearest band 04783 double SnapAngle = (Angle + (Constrain/2)) / Constrain; 04784 SnapAngle = floor(SnapAngle); 04785 SnapAngle *= Constrain; 04786 04787 // recalculate the new coordinate for the cursor 04788 dx = (INT32)(RayLength * cos(SnapAngle)); 04789 dy = (INT32)(RayLength * sin(SnapAngle)); 04790 04791 // Calculate the new position for the cursor 04792 CurCoord->x = (INT32)(Centre.x + dx); 04793 CurCoord->y = (INT32)(Centre.y + dy); 04794 }
|
|
||||||||||||||||
|
Forces the supplied coordinate to be constrained to positions that force the aspect ratio from the fixed corner to be the one supplied. It should be called by the tools to 'snap' the coordinates from a drag to positions where the shape is not deformed. NOT FINISHED.
Definition at line 4842 of file docview.cpp. 04843 { 04844 // Get something to avoid all the rampant *s in my code 04845 DocCoord& DiffCoord = *CurCoord; 04846 04847 // Find out which of the 2 axis are the most significant 04848 INT32 dx = DiffCoord.x - FixedCoord.x; 04849 INT32 dy = DiffCoord.y - FixedCoord.y; 04850 double dAspect = AspectLock.MakeDouble(); 04851 04852 if (abs(dx)>abs(dy)) 04853 { 04854 // The x coord is the most significant, so change the y coord to match 04855 // First work out the magnitude of the change and correct it for sign 04856 INT32 NewOffset = (INT32)(abs(dx) / dAspect); 04857 if (dy<0) 04858 NewOffset = -NewOffset; 04859 04860 // add in the difference 04861 DiffCoord.y = FixedCoord.y + NewOffset; 04862 } 04863 else 04864 { 04865 // The y coord is the most significant, so chnage the x coord to match 04866 // First work out the magnitude of the change and correct it for sign 04867 INT32 NewOffset = (INT32)(abs(dy) * dAspect); 04868 if (dx<0) 04869 NewOffset = -NewOffset; 04870 04871 // add in the difference 04872 DiffCoord.x = FixedCoord.x + NewOffset; 04873 } 04874 }
|
|
||||||||||||||||||||||||
|
To re-start rendering a Document through a given RenderRegion. This call is different from RenderView because it may need to re-compute the Doc to OS matrix.
Implements View. Definition at line 1929 of file docview.cpp. 01933 { 01934 // Diccon 10/5/2000 my awful flag that prevents rendering of the view from occurring 01935 // whilst a brush stroke is in progress 01936 if (m_bPreventRenderView == TRUE) 01937 return; 01938 01939 // Remove the drag blobs from this region, if there are any. 01940 if (fRenderPaper) 01941 { 01942 Operation* pDragOp = Operation::GetCurrentDragOp(); 01943 if (pDragOp) 01944 pDragOp->RenderDragBlobs(pRRegion->GetClipRect(), pSpread, m_bSolidDrag); 01945 } 01946 01947 // Render the document in one operation. 01948 Matrix mxConv = ConstructRenderingMatrix(pSpread); 01949 01950 if (OnTopCount == 0 && GetColourPlate() != NULL && !GetColourPlate()->IsDisabled()) 01951 { 01952 ColourPlateType PlateType = GetColourPlate()->GetType(); 01953 if (PlateType != COLOURPLATE_NONE && PlateType != COLOURPLATE_COMPOSITE) 01954 { 01955 // We have to do this before the render as the RenderSimpleView call 01956 // will delete the render region 01957 DocRect BlobClipRect = pRRegion->GetRegionRect(); 01958 DocRect DragClipRect = pRRegion->GetClipRect(); 01959 01960 // Do a printer style simple/complex ScanningRenderRegion type render 01961 RenderSimpleView(pRRegion, mxConv, pSpread, fRenderPaper); 01962 01963 // Dragging blobs/boxes. 01964 if (fRenderPaper) 01965 { 01966 Operation* pDragOp = Operation::GetCurrentDragOp(); 01967 if (pDragOp) pDragOp->RenderDragBlobs(DragClipRect, pSpread, m_bSolidDrag); 01968 } 01969 01970 // Draw the blobs if we are the "selected" view. 01971 // And we're not solid dragging... 01972 if (fRenderPaper && this == Selected && !(pCurrentDragOp!=NULL && m_bSolidDrag)) 01973 { 01974 Tool* pTool = Tool::GetCurrent(); 01975 if (pTool) pTool->RenderToolBlobs(pSpread, &BlobClipRect); 01976 01977 // Render the Currently selected objects selection blobs 01978 RenderSelectBlobs(BlobClipRect, pSpread); 01979 } 01980 return; 01981 } 01982 } 01983 01984 RenderView(pRRegion, mxConv, pSpread, fRenderPaper, fDeleteRegionAfter, bForceImmediate); 01985 }
|
|
|
Declares any preferences that the DocView class needs to decalre.
Definition at line 676 of file docview.cpp. 00677 { 00678 // NB. Constrain angle must be between 1 and 359 degrees. 00679 return GetApplication()->DeclareSection(TEXT("Constraints"), 1) 00680 && GetApplication()->DeclarePref(TEXT("Constraints"), TEXT("Constrain Angle"), 00681 &DefaultConstrainAngle, 00682 (2 * PI) / 360, ((2 * PI) * 359) / 360) 00683 00684 && GetApplication()->DeclareSection(TEXT("Rendering"), 2) 00685 && GetApplication()->DeclarePref(TEXT("Rendering"), TEXT("BackgroundRendering"), 00686 &BackgroundRendering, FALSE, TRUE) 00687 00688 && GetApplication()->DeclareSection(TEXT("AutoScrolling"), 1) 00689 && GetApplication()->DeclarePref(TEXT("AutoScrolling"), TEXT("ScrollToShowMargin"), 00690 &ScrollToShowMargin) 00691 00692 && GetApplication()->DeclareSection(TEXT("Dragging"), 6) 00693 && GetApplication()->DeclarePref(TEXT("Dragging"), TEXT("SolidDragging"), 00694 |