DocView Class Reference

The DocView class is used to hold non-oil data about views onto a document. When a CCamView object exists there is always a DocView object on the other side of the OIL- interface and they are linked. However, the DocView object is not destroyed when the CCamView object is destroyed so that it records the state of views while they are closed. More...

#include <docview.h>

Inheritance diagram for DocView:

View ListItem CCObject SimpleCCObject List of all members.

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 CNativeWndGetRenderWindow ()
 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)
SpreadFindEnclosingSpread (OilCoord)
 Given a chapter and an OilCoord, finds the spread that contains the coordinate.
SpreadOilToSpreadCoord (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.
RenderRegionGetFirstRenderRegion (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.
RenderRegionGetNextRenderRegion (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)
SpreadGetVisibleSpread ()
 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.
SpreadGetFirstSelectedSpread ()
 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.
RulerPairGetpRulerPair ()
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 DocViewGetCurrent ()
 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 DocViewGetSelected ()
 Find the selected DocView object which SHOULD have been set as one of the very first actions during event processing.
static CNativeWndGetCurrentRenderWindow ()
 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 RenderRegionRenderOnTop (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 RenderRegionGetNextOnTop (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

RulerPairpRulerPair

Private Member Functions

 CC_DECLARE_DYNAMIC (DocView)
RenderRegionNewRenderRegion (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.
CNativeDCGetRenderDC ()
 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
OperationpCurrentDragOp
DocCoord DragPos
BOOL m_bSolidDragSupported
DocView::CCAPI ViewFlags
MonotonicTime StartTime
PendingRedraws PendingRedrawList
INT32 ZoomTableIndex
INT32 PrevIndex
FIXED16 PrevScale
WorkCoord PrevOffset
CSnappCSnap
BOOL m_bPreventRenderView
BOOL m_bBoundsChanged

Static Private Attributes

static DocViewSelected = NULL
static OnTopCode OnTopReason = Normal
static SpreadOnTopSpread = NULL
static RenderRegionOnTopRenderRegion = 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

Detailed Description

The DocView class is used to hold non-oil data about views onto a document. When a CCamView object exists there is always a DocView object on the other side of the OIL- interface and they are linked. However, the DocView object is not destroyed when the CCamView object is destroyed so that it records the state of views while they are closed.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/5/1993 Base Class: ListItem Friends: CCamView
Currently it contains: The rectangle of physical document space being shown by this view. The user viewing scale factor (as opposed to the PhysToWindow factor). The user WYSIWYG value for this view.

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.

See also:
View

Definition at line 228 of file docview.h.


Constructor & Destructor Documentation

DocView::DocView Document pOwnerDoc  ) 
 

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.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/5/93
Parameters:
Pointer to Document to which it belongs [INPUTS]
None [OUTPUTS]
Returns:
None

Errors: None

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::~DocView  )  [virtual]
 

DocView class destructor.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/5/93
Parameters:
None [INPUTS]
None [OUTPUTS]
Returns:
None

Errors: None

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 }


Member Function Documentation

BOOL DocView::AreRulersVisible  ) 
 

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Are Rulers Visible on this view
See also:
-

Definition at line 5141 of file docview.cpp.

05142 {
05143     return pViewWindow->AreRulersVisible( );
05144 }

BOOL DocView::AreScrollersVisible  ) 
 

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Are Rulers Visible on this view
See also:
-

Definition at line 5161 of file docview.cpp.

05162 {
05163     return pViewWindow->AreScrollersVisible( );
05164 }

DocView::CC_DECLARE_DYNAMIC DocView   )  [private]
 

BOOL DocView::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).

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95
Parameters:
Type - The type of drag to change to [INPUTS]
Returns:
TRUE if it worked, FALSE if it failed

Errors: ERROR3 if there is no render window or there is no drag happening

See also:
ScreenCamView::ChangeDragType

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 }

void DocView::ClearClickState  ) 
 

Allows click handlers to reset the click logic if they are doing things that would break it.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/02/2004
Returns:
-

Errors: See also:

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 }

void DocView::ConstrainToAngle DocCoord Centre,
double  Constrain,
DocCoord CurCoord
[static]
 

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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/7/94
Parameters:
Centre - The point that all the constrain rays come from [INPUTS] Constrain - The constrain angle in Radians
CurCoord - contains the mouse coord on entry and contains the constrained [OUTPUTS] mouse coord afterwards

Definition at line 4815 of file docview.cpp.

04816 {
04817     // Just call the new version of the function
04818     ConstrainToAngle(Centre, CurCoord, Constrain);
04819 }

void DocView::ConstrainToAngle DocCoord Centre,
DocCoord CurCoord,
double  Constrain = 0.0
[static]
 

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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/7/94
Parameters:
Centre - The point that all the constrain rays come from [INPUTS] Constrain - The constrain angle in Radians. You should not pass in this param except in very special circumstances. When this param is left out the constrain angle from the users preferences is used, which should be the way it is done in almost all circumstances.
CurCoord - contains the mouse coord on entry and contains the constrained [OUTPUTS] mouse coord afterwards

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 }

void DocView::ConstrainToAspect DocCoord FixedCoord,
FIXED16 AspectLock,
DocCoord CurCoord
[static]
 

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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/7/94
Parameters:
FixedCoord - a fixed reference point, usually the opposite corner of the [INPUTS] bounding rectangle to be constrained AspectLock - The aspect ratio to maintain (1 is square)
CurCoord - This coordinate will be modified so that it forms a rectangle of [OUTPUTS] the correct aspect ratio from the fixed corner.
See also:
DocView::ConstrainToAngle()

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 }

void DocView::ContinueRenderView RenderRegion pRRegion,
Spread pSpread,
BOOL  fRenderPaper = TRUE,
BOOL  fDeleteRegionAfter = TRUE,
BOOL  bForceImmediate = FALSE
[virtual]
 

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.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/7/93
Parameters:
Pointer to RenderRegion which needs rendering to be performed. [INPUTS] Pointer to chapter which RenderRegion represents. fRenderPaper --- if TRUE then render paper, blobs etc. By default TRUE. fDeleteRegionAfter --- if TRUE then this function will deallocate the RenderRegion passed to it when it has been completely rendered. By default TRUE.
None [OUTPUTS]
Returns:
None Scope: Public

Errors: None

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 }

BOOL DocView::DeclarePreferences  )  [static]
 

Declares any preferences that the DocView class needs to decalre.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/10/94
Returns:
TRUE if it worked, FALSE if it failed

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                                          &SolidDragging, FALSE, TRUE)
00695         && GetApplication()->DeclarePref(TEXT("Dragging"), TEXT("IdleDragDelay"),
00696                                          (UINT32*)&IdleDragDelay, 0, 10000)
00697         && GetApplication()->DeclarePref(TEXT("Dragging"), TEXT("IdleDragDelay2"),
00698                                          (UINT32*)&IdleDragDelay2, 0, 10000)
00699         && GetApplication()->DeclarePref(TEXT("Dragging"), TEXT("SolidDragTimeLimit"),
00700                                          (UINT32*)&SolidDragTimeLimit, 0, 10000)
00701         && GetApplication()->DeclarePref(TEXT("Dragging"), TEXT("OriginOutlineShowAlways"),
00702                                          &OriginOutlineShowAlways, FALSE, TRUE)
00703         && GetApplication()->DeclarePref(TEXT("Dragging"), TEXT("OriginOutlineShowNonOverlap"),
00704                                          &OriginOutlineShowNonOverlap, FALSE, TRUE)
00705         && GetApplication()->DeclarePref(TEXT("Dragging"), TEXT("OutlineShowBounds"),
00706                                          &OutlineShowBounds, FALSE, TRUE);
00707 }

BOOL DocView::DM_DragFinished DragInformation DragInfo,
ViewDragTarget pDragTarget
 

act at the end of a general drag according to the drag type.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com> (and Will)
Date:
23/1/95
Parameters:
DragInformation - about this drag.. [INPUTS] pDragTarget - The drag target created for this DocView

Definition at line 3028 of file docview.cpp.

03029 {
03030     // The DragInfo must know what to do, or else we wouldn't 
03031     // have accepted the drag
03032     BOOL DropOK = DragInfo->OnPageDrop(pDragTarget);
03033 
03034     return DropOK;
03035 }

void DocView::DragFinished Operation pDragOp,
OilCoord  PointerPos,
ClickModifiers  Mods,
BOOL  Success
 

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.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/7/93
Parameters:
pDragOp - Pointer to the current drag operation [INPUTS] PointerPos - Coordinate of pointer in OS space Mods - Click modifiers structure Success - Flag saying whether drag ended OK or was aborted for some reason

Definition at line 3174 of file docview.cpp.

03176 {
03177     // Ignore if system is disabled
03178     if (CCamApp::IsDisabled())
03179         return;                             // If the system is disabled, ignore
03180     // SHOULD END THE DRAG
03181 
03182     // Find the spread that contains DocPos
03183     Spread *pSpread = FindEnclosingSpread(PointerPos);
03184 
03185     if (pSpread == NULL)
03186     {
03187         ERROR3("Could not find spread in which the click happened");
03188         return; // Exit reasonably nicely
03189     }
03190 
03191     // First of all convert the OSRect into document coords
03192     DocCoord DocPos = PointerPos.ToDoc( pSpread, this );
03193 
03194     // Convert the coord to spread coords
03195     pSpread->DocCoordToSpreadCoord(&DocPos);
03196 
03197     // Store away the WorkCoord version of this click in the DocView for later extraction by
03198     // GetClickWorkCoord();
03199     LastWorkClick = PointerPos.ToWork( pVState->GetScrollPos() );
03200 
03201     // Cached WorkCoord is valid.
03202     ViewFlags.WorkClickCached = TRUE;
03203 
03204     // Broadcast a "starting operation" message to begin with (normally broadcast by
03205     // OpDescriptor::Invoke, but thanks to the brain-damaged Camelot architecture, operations
03206     // which drag do not invoke, and this is the best place to catch them.  Go figure.)
03207     BROADCAST_TO_ALL(OpMsg(pDragOp, OpMsg::BEGIN));
03208 
03209     // Now call the current tool with the DocCoord click point
03210     pDragOp->DragFinished(DocPos, Mods, pSpread, Success, m_bSolidDrag);
03211 
03212     // Cached WorkCoord is no longer valid!
03213     ViewFlags.WorkClickCached = FALSE;
03214     m_bSolidDrag = FALSE;
03215 }

void DocView::DragPointerIdle Operation pDragOp,
OilCoord  PointerPos,
ClickModifiers  Mods
 

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.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/7/93
Parameters:
pDragOp - Pointer to the current drag operation [INPUTS] PointerPos - Coordinate of pointer in OS space Mods - Click modifiers structure

Definition at line 3111 of file docview.cpp.

03112 {
03113     ERROR3IF(pDragOp == NULL, "Illegal NULL parameter!");
03114 
03115     // Ignore if system is disabled
03116     if (CCamApp::IsDisabled())
03117         return;                             // If the system is disabled, ignore
03118 
03119     // Find the spread that contains DocPos
03120     Spread *pSpread = FindEnclosingSpread(PointerPos);
03121 
03122 // Note GetSelectedSpread is quicker in situations where you know you only have one spread
03123 //      but it prevents drags on multiple spread views working properly...
03124 //  Spread *pSpread = Document::GetSelectedSpread();
03125 
03126     if (pSpread == NULL)
03127     {
03128         ERROR3("Could not find spread in which the click happened");
03129         return; // Exit reasonably nicely
03130     }
03131 
03132     // First of all convert the OSRect into document coords
03133     DocCoord DocPos = PointerPos.ToDoc(pSpread, this);
03134 
03135     // Convert the coord to spread coords
03136     pSpread->DocCoordToSpreadCoord(&DocPos);
03137 
03138     // Store away the WorkCoord version of this click in the DocView for later extraction by
03139     // GetClickWorkCoord();
03140     LastWorkClick = PointerPos.ToWork( pVState->GetScrollPos() );
03141     ViewFlags.WorkClickCached = TRUE;           // Cached WorkCoord is valid.
03142 
03143     // Now call the current tool with the DocCoord click point
03144     if (pDragOp != NULL)
03145         pDragOp->DragPointerIdle(DocPos, Mods, pSpread, m_bSolidDrag);
03146 
03147     // Cached WorkCoord is no longer valid!
03148     ViewFlags.WorkClickCached = FALSE;
03149 }

void DocView::DragPointerMove Operation pDragOp,
OilCoord  PointerPos,
ClickModifiers  Mods
 

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.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/7/93
Parameters:
pDragOp - Pointer to the current drag operation [INPUTS] PointerPos - Coordinate of pointer in OS space Mods - Click modifiers structure

Definition at line 3052 of file docview.cpp.

03053 {
03054 //  BOOL bDragSolidly = FALSE;
03055 
03056     // Ignore if system is disabled
03057     if (CCamApp::IsDisabled())
03058         return;                             // If the system is disabled, ignore
03059 
03060     // Find the spread that contains DocPos
03061     Spread *pSpread = FindEnclosingSpread(PointerPos);
03062 
03063 // Note GetSelectedSpread is quicker in situations where you know you only have one spread
03064 //      but it prevents drags on multiple spread views working properly...
03065 //  Spread *pSpread = Document::GetSelectedSpread();
03066 
03067     if (pSpread == NULL)
03068     {
03069         ERROR3("Could not find spread in which the click happened");
03070         return; // Exit reasonably nicely
03071     }
03072 
03073     // Convert the OSRect into document coords
03074     DocCoord DocPos = PointerPos.ToDoc(pSpread, this);
03075 
03076     // Convert the coord to spread coords
03077     pSpread->DocCoordToSpreadCoord(&DocPos);
03078 
03079     // Store away the WorkCoord version of this click in the DocView for later extraction by
03080     // GetClickWorkCoord();
03081     LastWorkClick = PointerPos.ToWork( pVState->GetScrollPos() );
03082     ViewFlags.WorkClickCached = TRUE;           // Cached WorkCoord is valid.
03083 
03084     // Now call the current tool with the DocCoord click point
03085     ERROR3IF( pDragOp==NULL, "There was not operation in DragPointerMove()" );
03086     if (pDragOp)
03087         pDragOp->DragPointerMove(DocPos, Mods, pSpread, m_bSolidDrag);
03088 
03089     ViewFlags.WorkClickCached = FALSE;          // Cached WorkCoord is no longer valid!
03090 }

BOOL DocView::EndDrag Operation pDragOp  ) 
 

Tell the oil layer that the drag has finished.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/7/93
Parameters:
pDragOp - The current operation [INPUTS]
Returns:
TRUE if it workded

Definition at line 3602 of file docview.cpp.

03603 {
03604     ERROR3IF(pViewWindow == NULL, "ARGH! DocView is not connected to a window in EndDrag!");
03605 //  ERROR3IF(pCurrentDragOp == NULL, "Not dragging in DocView::EndDrag?");
03606 //  ERROR3IF(pDragOp != pCurrentDragOp, "DragOp pointer inconsistent in DocView::EndDrag");
03607     pCurrentDragOp = NULL;
03608 
03609     // Matt 12/01/2001 - Restore the cursor if we've changed it earlier to the push tool cursor...
03610     if (PushToolCursorID && (PushToolCursorID != 0))
03611     {
03612             CursorStack::GPop(PushToolCursorID);
03613             PushToolCursorID = 0;
03614     }
03615 
03616     return pViewWindow->EndDrag(pDragOp);
03617 }

Spread * DocView::FindEnclosingSpread OilCoord  Pos  ) 
 

Given a chapter and an OilCoord, finds the spread that contains the coordinate.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/12/93
Parameters:
Pos - the coord to look for. [INPUTS]
Returns:
The spread that contains the coordinate, or NULL if such a spread does not exist.

Definition at line 4197 of file docview.cpp.

04198 {
04199     // Find first spread in chapter
04200     Chapter* pChapter = Node::FindFirstChapter(pDoc);
04201     if (pChapter==NULL)
04202     {
04203         ERROR3( "There was no chapter in this document");
04204         return NULL;
04205     }
04206 
04207     Spread* pSpread = (Spread*)pChapter->FindFirstChild();
04208     ERROR3IF((pSpread == NULL) || !pSpread->IsSpread(), "Chapter has no spreads");
04209 
04210     // Optimisation for simple documents:
04211     // If only one chapter containing only one spread then that must be the
04212     // enclosing spread!
04213     if (pSpread && (pSpread->FindNext()==NULL || !pSpread->FindNext()->IsSpread()) && pChapter->FindNext()==NULL)
04214         return pSpread;
04215 
04216     // If the cursor was above the top of the document, then return the first spread
04217     // if there is one
04218     if (Pos.y >= 0)
04219         return pSpread;
04220 
04221     // Find this position in 64-bit work coords
04222     WorkCoord WorkPos = Pos.ToWork( pVState->GetScrollPos() );
04223 
04224     do
04225     {
04226         pSpread = (Spread *) pChapter->FindFirstChild();
04227         ERROR3IF((pSpread == NULL) || !pSpread->IsSpread(), 
04228                 "Chapter has no spreads");
04229 
04230         do
04231         {
04232             // Convert spread bounding box to logical coords
04233             DocRect PhysSpreadRect = pSpread->GetWidePasteboard(this);
04234             WorkRect LogSpreadRect;
04235             LogSpreadRect.lo = PhysSpreadRect.lo.ToWork(pSpread, this);
04236             LogSpreadRect.hi = PhysSpreadRect.hi.ToWork(pSpread, this);
04237 
04238             // Check if spread intersects the clipping rect
04239             if ((WorkPos.y <= LogSpreadRect.hi.y) &&
04240                 (WorkPos.y >= LogSpreadRect.lo.y))
04241             {
04242                 // Found the correct spread so stop looking.
04243                 return pSpread;
04244             }
04245 
04246             // try next spread
04247             pSpread = (Spread *) pSpread->FindNext();
04248             ERROR3IF((pSpread != NULL) && !(pSpread->IsSpread()),
04249                     "Spread is not a Spread!");
04250 
04251         } while (pSpread != NULL);
04252 
04253         // Was not in that chapter, so try the next one
04254         pChapter = (Chapter*) pChapter->FindNext();
04255         ERROR3IF( (pChapter!=NULL) && !(pChapter->IsKindOf(CC_RUNTIME_CLASS(Chapter))),
04256                  "Chapter is not a Chapter!" );
04257 
04258     } while (pChapter != NULL);
04259 
04260 
04261     ERROR3IF( pSpread == NULL, "Could not find spread in which the click happened");
04262 
04263     return pSpread;
04264 }

void DocView::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.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/12/94
See also:
DocView::ForceRedraw; PendingRedraws; SpreadRedraws

Definition at line 2749 of file docview.cpp.

02750 {
02751     // Ask the update list to do its stuff
02752     PendingRedrawList.FlushRedraw(this);
02753 }

void DocView::ForceRedraw Spread pSpread,
DocRect  SpreadRect,
BOOL  Accumulate = FALSE,
Node pInvalidNode = NULL
 

Force redraw of an area of a spread.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com> & Rik
Date:
14/12/93
Parameters:
pSpread - the spread which contains the invalid region. [INPUTS] SpreadRect - the invalid region (in spread coordinates, i.e. (0,0) based) Accumulate - TRUE => invalidate *now* FALSE => don't invalidate right now, but accumulate this into a list of rectangles for this view, and update intelligently when DocView::FlushRedraw() is called. ForceRecache - TRUE => Make sure that any overlapping cached bitmaps that capture bits of objects around/under/over them are thrown away during this redraw FALSE => Don't need to worry about cached objects because nothing in the tree has changed
See also:
DocView::FlushRedraw

Definition at line 2652 of file docview.cpp.

02653 {
02654     ERROR3IF(pSpread == NULL, "ForceRedraw has been passed a NULL spread pointer");
02655 
02656     // Make sure we use this DocView
02657     SetCurrent();
02658 
02659     // This rectangle has come directly from the program and might not lie on pixel
02660     // boundaries. So pixelise it before passing it directly on to the rendering system.
02661     SpreadRect.lo.Pixelise(this);
02662     SpreadRect.hi.Pixelise(this);
02663 
02664     // Should we do it now?
02665 // IMMEDIATE REDRAW
02666 //  if (FALSE)
02667     if (Accumulate)
02668     {
02669         // No - add it to our list and wait until the Operation finishes...as long as it
02670         // works.
02671         if (PendingRedrawList.AddInvalidRegion(pSpread, SpreadRect, pInvalidNode))
02672         {
02673             // Worked - exit now and wait for FlushRedraw() to be called.
02674             return;
02675         }
02676 
02677         // Otherwise fall through to normal processing (which will probably fail too!)
02678     }
02679 
02680     // Is this a bodge I see before me???
02681     // Not really. This modification expands the invalid region to take anti-aliasing
02682     // pixels into account. It could be made conditional on anti-aliasing being turned on
02683     // but this is simpler and the overhead when anti-aliasing is off is not great.
02684     SpreadRect.Inflate(ScaledPixelWidth.MakeLong(), ScaledPixelHeight.MakeLong());
02685 
02686     // Translate spread coords to document coords
02687     pSpread->SpreadCoordToDocCoord(&SpreadRect);
02688 
02689     // Clip this region to the spread
02690     DocRect WidePasteRect = pSpread->GetWidePasteboard(this);
02691     SpreadRect = SpreadRect.Intersection(WidePasteRect);
02692 
02693     // need to check for valid intersections here as Intersecting with
02694     // an invalid rectangle again will give a valid rectangle would you
02695     // believe! (Mike 20/12/95)
02696     if ( SpreadRect.IsEmpty() || (!SpreadRect.IsValid()) )
02697     {
02698         return;
02699     }
02700 
02701     // Convert clip rectangle to document coords
02702     DocRect DocClipRect = GetDocViewRect(pSpread);
02703 
02704     // Clip to spread rectangle
02705     SpreadRect = SpreadRect.Intersection(DocClipRect);
02706                                                         
02707     // Check to see if the result is an empty rectangle
02708     if ((SpreadRect.IsValid()) && (!SpreadRect.IsEmpty()))
02709     {
02710         // Find type of rendering device
02711         CCamView *pCamView = GetConnectionToOilView();
02712         ERROR2IF(pCamView == NULL, (void)0, "DocView has no CamView!");
02713 
02714 // These next two are commented out because 
02715 // a) rType is never used, and
02716 // b) pDevContext idn't needed in MakeNewRenderRegion if PaintPaper is FALSE (which is is)
02717 
02718 //      CDC *pDevContext = pCamView->GetRenderDC();
02719 //      const RenderType rType = CCDC::GetType(pDevContext, TRUE);
02720 
02721         // Translate document coords back to spread coords
02722         pSpread->DocCoordToSpreadCoord(&SpreadRect);
02723 
02724         // Use this to make a render region.
02725 //      MakeNewRenderRegion(pSpread, SpreadRect, pDevContext, RENDERTYPE_SCREEN, FALSE);    // See changed line below
02726         
02727         // Notice that because the PaintPaper parameter (5th one) is FALSE, we can pass
02728         // NULL as a pointer to a device context, and thus we don't have to call
02729         // GetRenderDC above at all, and hopefully, this will speed up translation
02730         // no end.
02731         MakeNewRenderRegion(pSpread, SpreadRect, NULL, RENDERTYPE_SCREEN, FALSE, pInvalidNode);
02732     }
02733 }

void DocView::ForceRedraw WorkRect ForceRect  ) 
 

Force a specific rectangle of the view to be redrawn.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/7/93
Parameters:
ForceRect - the rectangle to be invalidated [INPUTS]

Definition at line 2613 of file docview.cpp.

02614 {
02615     PORTNOTETRACE("other","DocView::ForceRedraw - do nothing");
02616 #ifndef EXCLUDE_FROM_XARALX
02617     ERROR3("Should not be called!");
02618 
02619     OilCoord OilRectLo = (ForceRect.lo).ToOil(GetScrollOffsets());
02620     OilCoord OilRectHi = (ForceRect.hi).ToOil(GetScrollOffsets());
02621 
02622     OilRect RedrawOilRect(OilRectLo, OilRectHi);
02623 
02624     pViewWindow->InvalidateView(&RedrawOilRect);
02625 #endif
02626 }

void DocView::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.).

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/7/93
Parameters:
ForcePaper,: TRUE => do a normal OS-style invalidation [INPUTS] FALSE => do a 'clever' internal invalidation which does not cause paper to be drawn straight away, so we get a smoother feel to the update.

Definition at line 2505 of file docview.cpp.

02506 {
02507     // Make sure we use this DocView
02508     SetCurrent();
02509 
02510     // Get rid of any render regions associated with this DocView
02511     Camelot.DeleteRenderRegions(this);
02512 
02513     // Invalidate the whole view window
02514     if (ForcePaper)
02515     {
02516         // We want an instant update with paper drawn now, so use the OS to do the
02517         // invalidation.
02518         pViewWindow->InvalidateView();
02519         return;
02520     }
02521 
02522     // find type of rendering device
02523     CCamView *pCamView = GetConnectionToOilView();
02524     ERROR2IF(pCamView == NULL, (void)0, "DocView::ForceRedraw: DocView has no CamView");
02525 
02526     pCamView->AllocateDC(); // allocate a DC
02527 
02528     CNativeDC* pDevContext = pCamView->GetRenderDC();
02529     const RenderType rType = CCDC::GetType(pDevContext, TRUE);
02530 
02531     // Get DocView rectangle in 64 bit WorkCoods
02532     WorkRect ClipRect = GetViewRect();
02533 
02534     ERROR3IF(ClipRect.lo.x > ClipRect.hi.x, "DocView::ForceRedraw: clipping rect is invalid");
02535     ERROR3IF(ClipRect.lo.y > ClipRect.hi.y, "DocView::ForceRedraw: clipping rect is invalid");
02536 
02537     // Find all the spreads in the document that intersect the clipping rect, and create
02538     // a render region for each of them.
02539 
02540     // Get the first chapter in the document
02541     for (Chapter* pChapter = Node::FindFirstChapter(pDoc);
02542          pChapter != 0;
02543          pChapter = pChapter->FindNextChapter())
02544     {
02545         // Convert chapter bounding box to logical coords
02546         DocRect PhysChapterRect = pChapter->GetPasteboardRect(TRUE, this);
02547         WorkRect LogChapterRect;
02548         LogChapterRect.lo = PhysChapterRect.lo.ToWork(pDoc, this);
02549         LogChapterRect.hi = PhysChapterRect.hi.ToWork(pDoc, this);
02550 
02551         // Check to see if this chapter intersects the clipping rectangle.
02552         // If the chapter is the last one in the document, then the chapter's pasteboard
02553         // does not include the area of the bottom of the last spread, so we only check
02554         // the chapter's top boundary.
02555 
02556         BOOL fIsLastChapter = (pChapter->FindNextChapter() == 0);
02557 
02558         if (ClipRect.lo.y <= LogChapterRect.hi.y &&
02559             (fIsLastChapter || ClipRect.hi.y >= LogChapterRect.lo.y))
02560         {
02561             for (Spread* pSpread = pChapter->FindFirstSpread();
02562                  pSpread != 0;
02563                  pSpread = pSpread->FindNextSpread())
02564             {
02565                 // Convert spread bounding box to logical coords
02566                 DocRect PhysSpreadRect = pSpread->GetPasteboardRect(TRUE);  // Pixelised
02567                 WorkRect LogSpreadRect;
02568                 LogSpreadRect.lo = PhysSpreadRect.lo.ToWork(pSpread, this);
02569                 LogSpreadRect.hi = PhysSpreadRect.hi.ToWork(pSpread, this);
02570 
02571                 BOOL fIsLastSpread = (pSpread->FindNextSpread() == 0);
02572 
02573                 // Check if spread intersects the clipping rect
02574                 if (ClipRect.lo.y <= LogSpreadRect.hi.y &&
02575                     ((fIsLastChapter && fIsLastSpread) || ClipRect.hi.y >= LogSpreadRect.lo.y))
02576                 {
02577                     // Make render region for intersection between spread and cliprect.
02578                     DocRect SpreadClipRect = pSpread->GetWidePasteboard(this);
02579 
02580                     // Convert clip rectangle to document coords
02581                     DocRect DocClipRect = GetDocViewRect(pSpread);
02582 
02583                     // Clip to spread rectangle
02584                     SpreadClipRect = SpreadClipRect.Intersection(DocClipRect);
02585 
02586                     // Make sure that the clip region is valid after the intersection
02587                     if (SpreadClipRect.IsValid() && !SpreadClipRect.IsEmpty())
02588                     {
02589                         // Convert it to Spread coords and create a render region
02590                         pSpread->DocCoordToSpreadCoord(&SpreadClipRect);
02591                         MakeNewRenderRegion(pSpread, SpreadClipRect, pDevContext, rType, FALSE);
02592                     }
02593                 }
02594             }
02595         }
02596     }
02597 
02598     pCamView->DoneWithDC(); // deallocate a DC
02599 }

BOOL DocView::ForceSnapToGrid Spread pSpread,
DocCoord pDocCoord
[static]
 

Calls grid snapper ignoring enabling flags.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
pSpread Pointer to spread on which node exists [INPUTS] pDocCoord A coordinate to test magnetically against the node
Returns:
TRUE - The coord has been snapped to something FALSE - The coord is untouched by man and beast

Errors: Will error in debug builds if there is no selected DocView

See also:
All Snap member functions of all classes derived from NodeRenderableBounded.

Definition at line 4467 of file docview.cpp.

04468 {
04469     ERROR3IF(Selected == NULL,"DocView::SnapSelected called when no selected DocView");
04470 
04471     if (Selected != NULL)
04472     {
04473         BOOL Snapped = FALSE;
04474 
04475         if (Selected->pCSnap == NULL)
04476             Selected->pCSnap = new CSnap(Selected,pSpread);
04477 
04478         if (Selected->pCSnap != NULL)
04479         {
04480             Selected->pCSnap->SetSpread(pSpread);
04481             Snapped = Selected->pCSnap->SnapToGrids(pDocCoord);
04482         }
04483 
04484         return (Snapped);
04485     }
04486     else
04487         return (FALSE);
04488 }

BOOL DocView::ForceSnapToGuides Spread pSpread,
DocCoord pDocCoord,
GuidelineType  Type
[static]
 

Calls guideline snapper ignoring enabling flags.

Author:
Martin Wuerthner <xara@mw-software.com>
Date:
24/08/06
Parameters:
pSpread Pointer to spread on which node exists [INPUTS] pDocCoord A coordinate to test magnetically against the node
Returns:
TRUE - The coord has been snapped to something FALSE - The coord is untouched by man and beast

Errors: Will error in debug builds if there is no selected DocView

See also:
All Snap member functions of all classes derived from NodeRenderableBounded.

Definition at line 4357 of file docview.cpp.

04358 {
04359     ERROR3IF(Selected == NULL,"DocView::ForceSnapToGuides called when no selected DocView");
04360 
04361     if (Selected != NULL)
04362     {
04363         BOOL Snapped = FALSE;
04364 
04365         if (Selected->pCSnap == NULL)
04366             Selected->pCSnap = new CSnap(Selected,pSpread);
04367 
04368         if (Selected->pCSnap != NULL)
04369         {
04370             Selected->pCSnap->SetSpread(pSpread);
04371             Snapped = Selected->pCSnap->SnapToGuidelines(pDocCoord, Type);
04372         }
04373 
04374         return (Snapped);
04375     }
04376     else
04377         return (FALSE);
04378 }

DocCoord DocView::GetCentreCoord  ) 
 

Gets a DocCoord for the centre of the view.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/7/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The DocCoord for the centre of the view

Errors: -

See also:
-

Definition at line 5285 of file docview.cpp.

05286 {
05287     //First get the document associated with this view
05288     Document* pDocument=GetDoc();
05289 
05290     //And find the first spread in that document
05291 PORTNOTE("spread", "Multi-spread warning!")
05292     Spread* pSpread=pDocument->FindFirstSpread();
05293 
05294     //Check we got both of those
05295     ERROR2IF(pDocument==NULL || pSpread==NULL, DocCoord(0,0), "DocView::GetCentreImportPosition - no document or spread");
05296 
05297     //So get the view rectangle
05298     DocRect rectView = GetDocViewRect(pSpread);
05299     
05300     //And find the middle of that rectangle
05301     DocCoord dcCentre;
05302     dcCentre.x = rectView.lo.x / 2 + rectView.hi.x / 2;
05303     dcCentre.y = rectView.lo.y / 2 + rectView.hi.y / 2;
05304                 
05305     //Now make that into a spread coordinate
05306     DocRect rectSpread = pSpread->GetPasteboardRect();
05307 
05308     DocCoord dcToReturn;
05309     
05310     dcToReturn.x = dcCentre.x - rectSpread.lo.x; 
05311     dcToReturn.y = dcCentre.y - rectSpread.lo.y;
05312                                                                                         
05313     //And return that DocCoord
05314     return dcToReturn;
05315 }

ImportPosition DocView::GetCentreImportPosition  ) 
 

Gets an import position for the centre of the view.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/7/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The import position for the centre of the view

Errors: -

See also:
-

Definition at line 5332 of file docview.cpp.

05333 {
05334     //First get the document associated with this view
05335     Document* pDocument=GetDoc();
05336 
05337     //And find the first spread in that document
05338 PORTNOTE("spread", "Multi-spread warning!")
05339     Spread* pSpread=pDocument->FindFirstSpread();
05340 
05341     //Now get the DocCoord in the centre of the view
05342     DocCoord dcToReturn=GetCentreCoord();
05343 
05344     //Put all those values into an ImportPosition structure
05345     ImportPosition posToReturn;
05346 
05347     posToReturn.pSpread=pSpread;
05348     posToReturn.Position=dcToReturn;
05349 
05350     //And return that ImportPosition
05351     return posToReturn;
05352 
05353 }

WorkCoord DocView::GetClickWorkCoord  ) 
 

To let people know where the last click was in Work Coordinates.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/7/93
Returns:
The position of the last click in work coords

Definition at line 3521 of file docview.cpp.

03522 {
03523     ERROR3IF(!ViewFlags.WorkClickCached,
03524                 "DocView::GetClickWorkCoord called when WorkClickCached is FALSE");
03525     return LastWorkClick;
03526 }

DocView * DocView::GetCurrent  )  [static]
 

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.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/5/93
Returns:
Pointer to the current DocView object.

Reimplemented from View.

Definition at line 2122 of file docview.cpp.

02123 {
02124     View *pView = View::GetCurrent();
02125 
02126     // Make sure it really is a DocView;
02127     if ((pView == NULL) || (pView->IS_KIND_OF(DocView)))
02128         // Yes - return it.
02129         return (DocView *) pView;
02130 
02131     // Complain!
02132     //ERROR2(NULL, "DocView::GetCurrent called when current view is not a DocView!");
02133     TRACEALL( _T("DocView::GetCurrent called when current view is not a DocView!\n") );
02134     return NULL;
02135 }

BOOL DocView::GetCurrentMousePos Spread **  ppSpread,
DocCoord pdcMousePos
[static]
 

Reports the position of the mouse if it is within the "selected" DocView. It position is "returned" in Spread coordinates.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/10/94
Parameters:
- [INPUTS]
ppSpread pointer to a Spread pointer that will hold the spread [OUTPUTS] containing the mouse pdcMousePos pointer to a DocCoord that will hold the coordinates of the mouse
Returns:
TRUE if the mouse is within the "selected" DocView, FALSE otherwise.

Errors: -

See also:
CCamView::GetCurrentMousePos

Definition at line 3779 of file docview.cpp.

03780 {
03781     // Valid output arguments must be provided.
03782     ERROR3IF(ppSpread == NULL, "Null Spread** in DocView::GetCurrentMousePos");
03783     ERROR3IF(pdcMousePos == NULL, "Null DocCoord* in DocView::GetCurrentMousePos");
03784 
03785     // Check if there is a "selected" DocView.
03786     if (Selected == NULL) return FALSE;
03787 
03788     // Ask the CCamView attached to the selected DocView to report the mouse position.
03789     OilCoord pt;
03790     if (!Selected->pViewWindow->GetCurrentMousePos(&pt)) return FALSE;
03791 
03792     // Convert the OIL coordinate to spread / doccoords.
03793     Spread* pSpread = Selected->FindEnclosingSpread(pt);
03794     if (pSpread == NULL)
03795     {
03796         ERROR3("Couldn't find a spread containing mouse position in DocView::GetCurrentMousePos");
03797         return FALSE;
03798     }
03799 
03800     // Convert the OSRect into document coords
03801     DocCoord dc = pt.ToDoc(pSpread, Selected );
03802 
03803     // Convert the coord to spread coords
03804     pSpread->DocCoordToSpreadCoord(&dc);
03805 
03806     // Return result and success code to caller.
03807     *ppSpread = pSpread;
03808     *pdcMousePos = dc;
03809     return TRUE;
03810 }

CNativeWnd * DocView::GetCurrentRenderWindow  )  [static]
 

Useful function allowing fairly direct access to CCamView's render window, which comes in handy on the odd occasion.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> (modified to use DocView::GetRenderWindow() by Ed 1/9/95)
Date:
15 Oct 93
Returns:
Pointer to the current CNativeWnd window object which is being rendered.

Errors: Returns NULL if there isn't one.

Definition at line 2167 of file docview.cpp.

02168 {
02169     DocView* pCurrent=GetCurrent();
02170     if (pCurrent==NULL)
02171         return NULL;
02172 
02173     return pCurrent->GetRenderWindow();
02174 }

BOOL DocView::GetCurrentSolidDragAbility  )  [inline]
 

Definition at line 335 of file docview.h.

00335 {return m_bSolidDragSupported;}

BOOL DocView::GetCurrentSolidDragState  )  [inline]
 

Definition at line 336 of file docview.h.

00336 {return m_bSolidDrag;}

DocRect DocView::GetDocViewRect Spread pSpread  )  [virtual]
 

To find the rectangle describing the viewport onto the document.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/7/93
Parameters:
pSpread - the spread that we are interested in [INPUTS]
Returns:
A DocCoords rectangle describing the viewport onto the document which this view is displaying. I.E. The top left corner of this rectangle is the same as the value returned by GetScrollOffsets() except in DocCoords.

Implements View.

Definition at line 1612 of file docview.cpp.

01613 {
01614     ERROR3IF(pViewWindow == NULL, "DocView::GetDocViewRect called when we have no view");
01615 
01616     INT32 ClientWidth = 0;
01617     INT32 ClientHeight = 0;
01618 
01619     // Get the width and height of the view in OS units
01620     pViewWindow->GetClientSize(&ClientWidth, &ClientHeight);
01621 
01622     OilRect OilViewRect;
01623     OilViewRect.lo.x = 0;
01624     OilViewRect.lo.y = -ClientHeight;
01625     OilViewRect.hi.x = ClientWidth;
01626     OilViewRect.hi.y = 0;
01627 
01628     // Convert the OSRect into Doc coords
01629     return OilViewRect.ToDoc(pSpread, this);
01630 }

RenderRegion * DocView::GetFirstRenderRegion DocRect ClipRect,
Spread pSpread,
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.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/8/93
Parameters:
ClipRect - The Rectangle to clip to [INPUTS] pSpread - The Spread that the render region is for Reason - the kind of rendering needed
Returns:
A Ptr to a RenderRegion to render into.
See also:
DocView::GetNextRenderRegion()

Definition at line 3840 of file docview.cpp.

03841 {
03842     // Construct the transformation matrix for the spread.
03843     Matrix RenderMatrix = ConstructRenderingMatrix(pSpread);
03844 
03845     // Make render region for intersection between spread and cliprect.
03846     // (Cliprect is still d)
03847     DocRect SpreadClipRect = pSpread->GetWidePasteboard(this);
03848 
03849     // Convert the coord to spread coords
03850     pSpread->DocCoordToSpreadCoord(&SpreadClipRect);
03851 
03852     // Clip to spread rectangle, if required
03853     if (Reason == ClippedEOR)
03854         SpreadClipRect = SpreadClipRect.Intersection(ClipRect);
03855     else
03856         SpreadClipRect = ClipRect;
03857 
03858     // Make sure that the clip region is valid after the intersection
03859     if ( (SpreadClipRect.IsValid()) && (!SpreadClipRect.IsEmpty()) )
03860     {
03861         RenderType rType = RENDERTYPE_NONE; // Initialise it! Mark H
03862 
03863         switch (Reason)
03864         {
03865             case CLICKBITMAP:   rType = RENDERTYPE_HITDETECT; break;
03866             case COLOURBITMAP:  rType = RENDERTYPE_COLOURBITMAP; break;
03867             case Normal:        rType = RENDERTYPE_SCREEN;
03868             default:            rType = RENDERTYPE_SCREENXOR; break;
03869         }
03870 
03871         CNativeDC* pDC = pViewWindow->GetRenderDC();
03872         ERROR3IF(!pDC, "No allocated DC");
03873 
03874         RenderRegion *NewRegion =   View::NewRenderRegion(SpreadClipRect, RenderMatrix, 
03875                                     pDC, pSpread, rType);
03876 
03877         if (NewRegion == NULL)
03878             TRACEALL( _T("Not enough memory to create render region\n") );
03879         else
03880             NewRegion->ImmediateRender();
03881 
03882         return NewRegion;
03883     }
03884 
03885     // No render region could be created as the spread clip rect was empty or invalid
03886     return NULL;
03887 }

Spread * DocView::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.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/5/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A pointer to a Spread node in this view's document, or NULL.

Errors: -

See also:
DocView::GetVisibleSpread

Definition at line 5005 of file docview.cpp.

05006 {
05007     // Obtain the current selection, if any.
05008     //GetApplication()->UpdateSelection();
05009     SelRange* pSel = GetApplication()->FindSelection();
05010     if (pSel == NULL) return NULL;
05011     
05012     // Find the first selected object.
05013     Node* pFirstSelectedNode = pSel->FindFirst();
05014 
05015     // If there isn't one, then there is no spread with sel objects.
05016     // Otherwise get the selected object's parent spread.
05017     return (pFirstSelectedNode != NULL)
05018          ? (Spread*) pFirstSelectedNode->FindParent(CC_RUNTIME_CLASS(Spread))
05019          : NULL;
05020 }

BOOL DocView::GetForeBackMode  )  [virtual]
 

To find out if background rendering is on.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/93
Returns:
TRUE if background rendering is on

Implements View.

Definition at line 1672 of file docview.cpp.

01673 {
01674     // As the flag is a BOOL in a bitfield, it seems to like returning -1 or 0
01675     // Therefore, ensure that we always return TRUE or FALSE
01676 
01677     if (ViewFlags.BackgroundRender == FALSE)
01678         return (FALSE);
01679     else
01680         return (TRUE);
01681 
01682 }

RenderRegion * DocView::GetNextOnTop DocRect Rect  )  [static]
 

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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/8/93
Parameters:
Rect - A pointer to the DocRect that the Rendering is to be clipped to [INPUTS]
Returns:
A RenderRegion if there is another valid one to be rendered into, or NULL if there is not
See also:
DocView::RenderOnTop

Definition at line 4063 of file docview.cpp.

04064 {
04065     ERROR3IF( OnTopCount <= 0, "GetNextOnTop was called before RenderOnTop was called\n" );
04066 
04067     RenderRegion* pRender = OnTopRenderRegion;
04068     
04069     if (OnTopCount == 1)
04070     {
04071         // Delete the old render region that is no longer needed
04072         if (pRender!=NULL)
04073         {
04074             pRender->StopRender();
04075 
04076             if (( OnTopReason == UnclippedEOR ) || (OnTopReason == ClippedEOR))
04077             {
04078                 // Detach the Static OnTopRegion
04079                 View::DeInitOnTopRegion();
04080             }
04081             else
04082             {
04083                 delete pRender;
04084             }
04085 
04086             pRender = NULL;
04087             OnTopRenderRegion = NULL;
04088         }
04089         
04090         // Find the current view
04091         DocView* pView = GetSelected();
04092         if (pView==NULL)
04093             return NULL;
04094 
04095         // Get the next rectangle or region and make a RenderRegion
04096         DocRect ClipRect;
04097         if (Rect == NULL)
04098         {
04099             // Get the DocView's viewport and convert it from document coords to
04100             // spread coords
04101             ClipRect = pView->GetDocViewRect(OnTopSpread);
04102             OnTopSpread->DocCoordToSpreadCoord(&ClipRect);
04103         }
04104         else
04105             ClipRect = *Rect;
04106 
04107         // Go and build a new render region
04108         pRender = pView->GetNextRenderRegion(ClipRect, OnTopSpread, OnTopReason);
04109         OnTopRenderRegion = pRender;
04110             
04111         // See if we got one
04112         if (!pRender)
04113         {
04114             // There were no more render regions, so decrement the call count and 
04115             // return NULL
04116             OnTopCount--;
04117             return NULL;
04118         }
04119 
04120         // Turn on EORing for the RenderRegion if needed
04121         if ((OnTopReason == UnclippedEOR) || (OnTopReason == ClippedEOR))
04122             pRender->SetDrawingMode(DM_EORPEN);
04123                 
04124         // return the render region
04125         return pRender;
04126     }
04127     else
04128     {
04129         // It is not up to this level to try and find more RenderRegions
04130         // so decrement the counter
04131         OnTopCount--;
04132 
04133         // No more RenderRegions here, so return NULL
04134         return NULL;
04135     }
04136 
04137     return NULL;
04138 }

RenderRegion * DocView::GetNextRenderRegion DocRect ClipRect,
Spread pSpread,
OnTopCode  Reason
 

Used to split a DocRect to be redrawn into one or more RenderRegions. See DocView::GetFirstRenderRegion(DocRect& ClipRect) for more details.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/8/93
Parameters:
ClipRect - The Rectangle to clip to [INPUTS] pSpread - The Spread that the render region is for Reason - the kind of rendering needed
Returns:
A Ptr to a RenderRegion to render into.
See also:
DocView::GetFirstRenderRegion()

Definition at line 3908 of file docview.cpp.

03909 {
03910     // This needs to be expanded!
03911     // It's ok for Windows, but maybe not for other platforms...
03912     return NULL;
03913 }

BOOL DocView::GetPreventRenderView  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/5/2000
Returns:
The state of our flag which prevents the view from rendering

Errors: See also:

Definition at line 5495 of file docview.cpp.

05496 {
05497     return m_bPreventRenderView;
05498 }

INT32 DocView::GetPrevZoomIndex  )  const
 

Returns the index into the zoom tool's tabel of a previous zoom on this DocView.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/5/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DocView::SetPrevZoomIndex

Definition at line 2375 of file docview.cpp.

02376 {
02377     return PrevIndex;
02378 }

WorkCoord DocView::GetPrevZoomOffset  )  const
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/5/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The scroll offset of this DocView during a previous zoom.

Errors: -

See also:
DocView::SetPrevZoomOffset

Definition at line 2457 of file docview.cpp.

02458 {
02459     return PrevOffset;
02460 }

FIXED16 DocView::GetPrevZoomScale  )  const
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/5/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The scale factor of this view as set by a previous zoom.

Errors: -

See also:
DocView::SetPrevZoomScale

Definition at line 2417 of file docview.cpp.

02418 {
02419     return PrevScale;
02420 }

RulerPair* DocView::GetpRulerPair  )  [inline]
 

Definition at line 579 of file docview.h.

00579 { return pRulerPair; }

CNativeDC * DocView::GetRenderDC  )  [private, virtual]
 

Access function for the device context of this kernel view object.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/09/95
See also:
PrintView; View

Implements View.

Definition at line 5177 of file docview.cpp.

05178 {
05179     // Ask our CCamView to give us its DC and return that.
05180     return pViewWindow->GetRenderDC();
05181 }

CNativeWnd * DocView::GetRenderWindow  )  [virtual]
 

Get a pointer to a CNativeWnd window object associated with a DocView.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/9/95
Returns:
Pointer to CNativeWnd (else NULL if none)

Definition at line 2186 of file docview.cpp.

02187 {
02188     if (pViewWindow==NULL)
02189         return NULL;
02190 
02191     return pViewWindow->GetRenderWindow();
02192 }

DocView * DocView::GetSelected  )  [static]
 

Find the selected DocView object which SHOULD have been set as one of the very first actions during event processing.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/5/93
Returns:
Pointer to the selected DocView object.

Definition at line 2207 of file docview.cpp.

02208 {
02209     return Selected;
02210 }

BOOL DocView::GetShowGridState  ) 
 

To find the "Show grid" state of a DocView.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/94
Parameters:
- [INPUTS]
Returns:
TRUE - grids are visible in the doc view FALSE - grids are not visible in the doc view
See also:

Definition at line 4725 of file docview.cpp.

04726 {
04727     return (ViewFlags.GridShow);
04728 }

BOOL DocView::GetShowGuidesState  )  [inline]
 

Definition at line 549 of file docview.h.

00549 { return (ViewFlags.GuidesShow != 0); }

BOOL DocView::GetShowPrintBorders  )  [inline]
 

Definition at line 387 of file docview.h.

00387 { return (ViewFlags.PrintBorderShow != 0); }

BOOL DocView::GetSnapToGridState  ) 
 

To find the "Snap to grid" state of a DocView.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/94
Parameters:
- [INPUTS]
Returns:
TRUE - snap to grids in the doc view FALSE - don't snap to grids in the doc view
See also:

Definition at line 4614 of file docview.cpp.

04615 {
04616     return (ViewFlags.GridSnap);
04617 }

BOOL DocView::GetSnapToGuidesState  )  [inline]
 

Definition at line 546 of file docview.h.

00546 { return (ViewFlags.GuidesSnap != 0); }

BOOL DocView::GetSnapToMagObjectsState  ) 
 

To find the "Snap to magnetic objects" state of a DocView.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/9/94
Parameters:
- [INPUTS]
Returns:
TRUE - snap to magnetic objects in the doc view FALSE - don't snap to magnetic objects in the doc view
See also:

Definition at line 4688 of file docview.cpp.

04689 {
04690     return (ViewFlags.MagObjectsSnap);
04691 }

BOOL DocView::GetSnapToObjectsState  ) 
 

To find the "Snap to all objects" state of a DocView.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/9/94
Parameters:
- [INPUTS]
Returns:
TRUE - snap to objects in the doc view FALSE - don't snap to objects in the doc view
See also:

Definition at line 4651 of file docview.cpp.

04652 {
04653     return (ViewFlags.ObjectsSnap);
04654 }

DocCoord DocView::GetTopLeftCoord  ) 
 

Gets a DocCoord for the top left of the view.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/7/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The DocCoord for the top left of the view

Errors: -

See also:
-

Definition at line 5370 of file docview.cpp.

05371 {
05372     //First get the document associated with this view
05373     Document* pDocument=GetDoc();
05374 
05375     //And find the first spread in that document
05376 PORTNOTE("spread", "Multi-spread warning!")
05377     Spread* pSpread=pDocument->FindFirstSpread();
05378 
05379     //Check we got both of those
05380     ERROR2IF(pDocument==NULL || pSpread==NULL, DocCoord(0,0), "DocView::GetCentreImportPosition - no document or spread");
05381 
05382     //So get the view rectangle
05383     DocRect rectView = GetDocViewRect(pSpread);
05384     
05385     //And find the top left of that rectangle
05386     DocCoord dcTopLeft(rectView.lo.x, rectView.hi.y);
05387                 
05388     //Now make that into a spread coordinate
05389     DocRect rectSpread = pSpread->GetPasteboardRect();
05390 
05391     DocCoord dcToReturn;
05392     
05393     dcToReturn.x = dcTopLeft.x - rectSpread.lo.x; 
05394     dcToReturn.y = dcTopLeft.y - rectSpread.lo.y;
05395 
05396     TRACEUSER( "luke", _T("rcToReturn (%x, %x), dcTopLeft (%x, %x), rectSpead (%x, %x)"),
05397         dcToReturn.x, dcToReturn.y, dcTopLeft.x, dcTopLeft.y, rectSpread.lo.x, rectSpread.lo.y );
05398                                                                                         
05399     //And return that DocCoord
05400     return dcToReturn;
05401 }

ImportPosition DocView::GetTopLeftImportPosition  ) 
 

Gets an import position for the top left of the view.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/7/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The import position for the top left of the view

Errors: -

See also:
-

Definition at line 5418 of file docview.cpp.

05419 {
05420     //First get the document associated with this view
05421     Document* pDocument=GetDoc();
05422 
05423     //And find the first spread in that document
05424 PORTNOTE("spread", "Multi-spread warning!")
05425     Spread* pSpread=pDocument->FindFirstSpread();
05426 
05427     //Now get the DocCoord in the top left of the view
05428     DocCoord dcToReturn=GetTopLeftCoord();
05429 
05430     //Put all those values into an ImportPosition structure
05431     ImportPosition posToReturn;
05432 
05433     posToReturn.pSpread=pSpread;
05434     posToReturn.Position=dcToReturn;
05435 
05436     //And return that ImportPosition
05437     return posToReturn;
05438 
05439 }

WorkRect DocView::GetViewRect  )  [virtual]
 

To find the rectangle describing the viewport onto the document.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/7/93
Returns:
A WorkCoords rectangle describing the viewport onto the document which this view is displaying. I.E. The top left corner of this rectangle is the same as the value returned by GetScrollOffsets().

Implements View.

Definition at line 1572 of file docview.cpp.

01573 {
01574     ERROR3IF(pViewWindow == NULL, "DocView::GetViewRect called when we have no ViewWindow");
01575 
01576     // Get the width and height of the view in OS units
01577     INT32 ClientWidth = 0;
01578     INT32 ClientHeight = 0;
01579     pViewWindow->GetClientSize(&ClientWidth, &ClientHeight);
01580 
01581     OilRect OilViewRect;
01582     OilViewRect.lo.x = 0;
01583     OilViewRect.lo.y = -ClientHeight;
01584     OilViewRect.hi.x = ClientWidth;
01585     OilViewRect.hi.y = 0;
01586 
01587     // Convert the OSRect into Workarea coords
01588 //  WorkCoord pos;
01589 //  pViewWindow->GetScrollOffset(&pos);
01590 //  pVState->SetScrollPos(pos);
01591 //  return OilViewRect.ToWork(pos);
01592     return OilViewRect.ToWork(pVState->GetScrollPos());
01593 }

Spread * DocView::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.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/5/94
Returns:
A pointer to a Spread, or NULL.
NB. hacked to simply return the first spread for the v1 release.
Returns:
Errors: -
See also:
DocView::GetFirstSelectedSpread

Definition at line 4897 of file docview.cpp.

04898 {
04899     // Initially we have no visible spread, which has zero area (of course).
04900     Spread* pCandidateSpread = NULL;
04901 //  XLONG xlCandidateArea = 0;
04902 
04903     // Begin by finding the extent of the viewport.
04904     WorkRect wrViewPort = GetViewRect();
04905 
04906     // Check that we have a document.
04907     if (pDoc == NULL) 
04908         return NULL;
04909 
04910     // Find the first node in the document's tree.
04911     Node* pNode = pDoc->GetFirstNode();
04912     if (pNode == NULL) 
04913         return NULL;
04914 
04915     // Find its first sibling, which should be a NodeDocument.
04916     pNode = pNode->FindNext();
04917     if (pNode == NULL) 
04918         return NULL;
04919 
04920     ERROR3IF(!pNode->IsKindOf(CC_RUNTIME_CLASS(NodeDocument)),
04921                 "Can't find a NodeDocument in DocView::GetVisibleSpread");
04922 
04923     // Find the first child node of the NodeDocument.
04924     pNode = pNode->FindFirstChild();
04925     if (pNode == NULL) return NULL;
04926 
04927     // Check if it's a chapter, skip it if it isn't.
04928     if (pNode->GetRuntimeClass() != CC_RUNTIME_CLASS(Chapter))
04929     { 
04930         pNode = pNode->FindNext(CC_RUNTIME_CLASS(Chapter));
04931         if (pNode == NULL) return NULL;
04932     }
04933     
04934     // We've found a chapter.
04935     Chapter* pChapter = (Chapter*) pNode;
04936 //  do {
04937         // Find the first child of the chapter.
04938         pNode = pChapter->FindFirstChild();
04939         if (pNode == NULL) return NULL;
04940 
04941         // If it isn't a spread then skip it.
04942         if (pNode->GetRuntimeClass() != CC_RUNTIME_CLASS(Spread))
04943         {
04944             pNode = pNode->FindNext(CC_RUNTIME_CLASS(Spread));
04945             if (pNode == NULL) return NULL;
04946         } 
04947         
04948         // Now check all sibling spreads.
04949         Spread* pSpread = (Spread*) pNode;
04950 /*      do {
04951             // At last, we found a spread!  Get its bounding rectangle in
04952             // document coordinates.
04953             DocRect drBound = pSpread->GetPageBounds();
04954 
04955             // Convert to work coordinates.
04956             WorkRect wrBound(drBound.lo.ToWork(pSpread, this),
04957                              drBound.hi.ToWork(pSpread, this));
04958 
04959             // If it intersects with the current viewport then we check if it is
04960             // the largest considered so far.
04961             WorkRect wrIntersect = wrBound.Intersection(wrViewPort);
04962             if (wrIntersect.IsValid() && !wrIntersect.IsEmpty())
04963             {
04964                 XLONG xlArea = wrIntersect.Width() * wrIntersect.Height();
04965                 if (xlArea > xlCandidateArea)
04966                 {
04967 */                  // It is the largest so far, so remember it.
04968                     pCandidateSpread = pSpread;
04969 /*                  xlCandidateArea = xlArea;
04970                 }
04971             }
04972 
04973             // Find the next sibling spread, if any.
04974             pSpread = (Spread*) pSpread->FindNext(CC_RUNTIME_CLASS(Spread));
04975         }
04976         while (pSpread != NULL);
04977 
04978         // Find the next sibling chapter, if any.
04979         pChapter = (Chapter*) pChapter->FindNext(CC_RUNTIME_CLASS(Chapter));
04980     } while (pChapter != NULL);
04981 */
04982     // If we get here we couldn't find anything!
04983     return pCandidateSpread;
04984 }

double DocView::GetZoomFactor  ) 
 

Obtain the current zoom factor for this document view.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
17 February 2000
Returns:
The current zoom factor for this document view.

Errors: See also: GetScaledPixelWidth(), GetPixelWidth().

Definition at line 5455 of file docview.cpp.

05456 {
05457     return GetScaledPixelWidth().MakeDouble() / GetPixelWidth().MakeDouble();
05458 }

INT32 DocView::GetZoomTableIndex  )  const
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/5/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Returns the value of the zoom table index.

Errors: -

See also:
DocView::SetZoomTableIndex

Definition at line 2334 of file docview.cpp.

02335 {
02336     return ZoomTableIndex;
02337 }

BOOL DocView::HandleKeyPress KeyPress pKeyPress  )  [virtual]
 

Passes keystroke events to the current drag op, if dragging, or the current tool, if not.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/94
Parameters:
A pointer to the keypress event. [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the event was handled by this function, or a function it called.

Errors: -

See also:
App::OnKeyPress; Tool::OnKeyPress; Operation::DragKeyPress

Definition at line 3472 of file docview.cpp.

03473 {
03474     // Ignore if system is disabled
03475     if (CCamApp::IsDisabled())
03476         return FALSE;                           // If the system is disabled, ignore
03477 
03478     // If we are dragging then pass the event on to the current drag operation.
03479     if (pCurrentDragOp != NULL)
03480     {
03481         // Handle the TAB key out here on behalf of ALL drag ops
03482         if (m_bSolidDragSupported && pKeyPress->IsPress() && !pKeyPress->IsRepeat())    // I.e. is this a non-auto-repeated key-down event?
03483         {
03484             switch (pKeyPress->GetVirtKey())
03485             {
03486                 // TAB key means "change solid dragging mode"
03487                 case CAMKEY(TAB):
03488                 {
03489                     DocView::SolidDragging = !DocView::SolidDragging;
03490                     m_bSolidDrag = (m_bSolidDragSupported && DocView::SolidDragging);
03491                     pCurrentDragOp->DragModeChanged(m_bSolidDrag);
03492 
03493                     // update indicator in StatusLine
03494                     DialogBarOp::SetSystemStateChanged();
03495                     break;
03496                 }
03497             }
03498         }
03499 
03500         return pCurrentDragOp->DragKeyPress(pKeyPress, m_bSolidDrag);
03501     }
03502     
03503     // Otherwise give the current tool, if any, the chance to deal with it.
03504     Tool* pTool = Tool::GetCurrent();
03505     return (pTool != NULL) ? pTool->OnKeyPress(pKeyPress) : FALSE;
03506 }

void DocView::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.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/12/94
See also:
DocView::ForceRedraw; PendingRedraws; SpreadRedraws

Definition at line 2768 of file docview.cpp.

02769 {
02770     // Ask the update list to do its stuff
02771     PendingRedrawList.HandleNodeDeletion(pNode);
02772 }

BOOL DocView::Init void   ) 
 

Init a doc view.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/9/95
Returns:
FALSE if fails

Reimplemented from SimpleCCObject.

Definition at line 840 of file docview.cpp.

00841 {
00842     pRulerPair = NULL;
00843 
00844     pRulerPair = new RulerPair();
00845     ERROR2IF(pRulerPair==NULL,FALSE,"DocView::Init() - failed to create RulerPair");
00846 
00847     // update indicator in StatusLine
00848     DialogBarOp::SetSystemStateChanged();
00849 
00850     return TRUE;
00851 }

BOOL DocView::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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/11/94
Returns:
TRUE if the mouse has moved, FALSE if not
See also:
CCamView::IsWaitingMouseMove

Definition at line 3747 of file docview.cpp.

03748 {
03749     PORTNOTETRACE("other","DocView::IsMouseMoved - do nothing");
03750 #ifndef EXCLUDE_FROM_XARALX
03751     // If there is a Cam View about, ask it to see if there are more ouse messages
03752     // kicking about
03753     if (pViewWindow!=NULL)
03754         return pViewWindow->IsWaitingMouseMove();
03755 #endif
03756     // there was no CamView, so no mouse messages
03757     return FALSE;
03758 }

ObjectDragTarget DocView::IsPointerOverNode NodeRenderableInk **  pThisNode,
INT32  Range,
BOOL  Interrupt = TRUE,
BOOL  bIsColourDrag = FALSE
 

to determine whether pointer is over 1 - an objects outline 2 - any visible fill blobs 3 - a simple (non grouped) object

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com> (and Will)
Date:
23/1/95
Parameters:
ThisNode - ptr to node over if any NULL otherwise [OUTPUTS]
Range - Margin to use in line hittest [INPUTS] Interrupt - TRUE if the Hit Test should be interruptable or not.
DMc inserted 6/5/99 For colour drags, you don't want to addess the shadow or bevel controller node, but what's inside

Returns:
an ObjectDragTarget - FILL/LINE/STARTFILL/ENDFILL

Definition at line 2795 of file docview.cpp.

02797 {
02798     Spread *pSpread=NULL;
02799     DocCoord pMousePos;
02800         
02801     // get the current spread and mouse pos
02802     if(!GetCurrentMousePos(&pSpread, &pMousePos))
02803         return NO_TARGET;
02804     
02805     // mouse pos to be used at end of drag
02806     DragPos = pMousePos;
02807 
02808     // ouch !
02809     if(!pSpread)
02810         return NO_TARGET;
02811 
02812     // See if we are close to the TextStory caret - We can't hittest on it as it is only a blob
02813     if (TextStory::GetFocusStory() != NULL)
02814     {
02815         CaretNode* pCaret = TextStory::GetFocusStory()->GetCaret();
02816         Matrix matrix;
02817 
02818         if ((pCaret != NULL) && pCaret->IsSelected() && (pCaret->GetStoryAndCharMatrix(&matrix)!=FALSE))
02819         {
02820             // get the bounds of the caret path for the blob bounds
02821             Path* pCaretPath = pCaret->CreatePath(&matrix);
02822             if (pCaretPath != NULL)
02823             {
02824                 INT32 CloseSlot = 0;
02825                 double mu = 0.0;
02826                 if (pCaretPath->IsPointCloseTo(pMousePos, Range*Range, &CloseSlot, &mu))
02827                 {
02828                     *pThisNode = pCaret;
02829                     delete pCaretPath;
02830                     return FILL_TARGET;
02831                 }
02832                 delete pCaretPath;
02833             }
02834         }
02835     }
02836 
02837     // Allow the hit-test to be interrupted if the mouse moves!
02838     Node* pInterruptedNode = NULL;
02839     NodeRenderableInk * pCompoundNode = NULL;
02840     NodeRenderableInk* pSimpleNode = NodeRenderableInk::FindSimpleAtPoint(pSpread,
02841                   pMousePos,
02842                   NULL,
02843                   Interrupt ? &pInterruptedNode : NULL);
02844 
02845     if (pInterruptedNode!=NULL)
02846         // hit-test was interrupted...
02847         pSimpleNode=NULL;
02848 
02849     // Now we have the 'Simple' node that the pointer was over.
02850 
02851     // If we can we should use any Selected nodes, so lets see if
02852     // this node or any of it's parents are selected.
02853     // We will stop if we get to the layer.
02854 
02855     if (pSimpleNode != NULL)    // Did we hit anything ?
02856     {
02857         Node* pSelNode = NULL;
02858 
02859         if ((ClickModifiers::GetClickModifiers().Constrain) || pSimpleNode->IsSelected())
02860         {
02861             // The node we hit was selected, so we will just use that
02862             pSelNode = pSimpleNode;
02863         }
02864         else
02865         {
02866             // Hunt up the tree, looking for a selected parent
02867             Node* pParent = pSimpleNode->FindParent();
02868             while (pParent != NULL && !pParent->IsLayer())
02869             {
02870                 if (pParent->IsSelected())
02871                 {
02872                     // Found a selected parent, so we'll use that
02873 
02874                     // don't do it for shadow controller nodes, or bevel nodes
02875                     if ((!pSimpleNode->IsKindOf(CC_RUNTIME_CLASS(NodeShadow)) &&
02876                         !pSimpleNode->IsKindOf(CC_RUNTIME_CLASS(NodeBevel))) ||
02877                         !bIsColourDrag)
02878                     {
02879                         pSelNode = pParent;
02880                     }
02881                     else
02882                     {
02883                         pSelNode = pSimpleNode;
02884                     }
02885 
02886                     
02887                     break;
02888                 }
02889 
02890                 pParent = pParent->FindParent();
02891             }
02892         }
02893 
02894         if (pSelNode != NULL)
02895         {
02896             // We will use the selected node in preference to anything else
02897             pSimpleNode = (NodeRenderableInk*)pSelNode;
02898         }
02899         else
02900         {
02901             // We didn't find any selected nodes, so we will try and apply
02902             // to a Parent group of the hit node.
02903 
02904             // This function will return the same node, if it has no parent group
02905 
02906             // DMc 6/5/99
02907             // change to hit testing for drags - don't do a compound node
02908             // for bevel controller or shadow controller nodes
02909             pCompoundNode = NodeRenderableInk::FindCompoundFromSimple(pSimpleNode);
02910             pSimpleNode = pCompoundNode;
02911 
02912             if ((!pSimpleNode->IsKindOf(CC_RUNTIME_CLASS(NodeShadow)) &&
02913                         !pSimpleNode->IsKindOf(CC_RUNTIME_CLASS(NodeBevel))) ||
02914                         !bIsColourDrag)
02915             {
02916                 pSimpleNode = pCompoundNode;
02917             }
02918     
02919         }
02920     }
02921     
02922     // we can pass this back to the drag target
02923 
02924     *pThisNode = pSimpleNode;
02925     
02926     
02927     // get the object bounds for this object 
02928     DocRect pSimpleBounds;
02929     if(pSimpleNode)
02930         pSimpleBounds = pSimpleNode->GetBoundingRect();
02931     else
02932         pSimpleBounds.MakeEmpty();
02933     
02934     AttrColourDrop *Attrib = new AttrColourDrop(pMousePos,pSimpleBounds,DocColour(COLOUR_TRANS));
02935 
02936     // this will sort out whether we are over any fill blobs 
02937     // pThisNode will then point to the relevant Node 
02938     // OverFill is the FillControl type we are currently over
02939     FillControl OverFill = AttrFillGeometry::DoColourDropTest(Attrib,pThisNode,NULL);
02940     delete Attrib;
02941 
02942     ObjectDragTarget TargetHit;
02943     
02944     // return the appropriate colour drag target 
02945     switch(OverFill)
02946     {
02947         case FILLCONTROL_STARTPOINT:
02948             TargetHit = STARTCOL_TARGET;
02949             break;
02950         
02951         case FILLCONTROL_ENDPOINT:
02952         case FILLCONTROL_SECONDARYPOINT:
02953             TargetHit = ENDCOL_TARGET;
02954             break;
02955         
02956         case FILLCONTROL_ENDPOINT2:
02957             TargetHit = ENDCOL2_TARGET;
02958             break;
02959         
02960         case FILLCONTROL_ENDPOINT3:
02961             TargetHit = ENDCOL3_TARGET;
02962             break;
02963         
02964         case FILLCONTROL_MANY:      
02965             TargetHit = MANY_TARGET;
02966             break;
02967 
02968         case FILLCONTROL_NULL:
02969             TargetHit = FILL_TARGET;
02970             break;
02971 
02972         default:
02973             TargetHit = FILL_TARGET;
02974             break;
02975     }   
02976     
02977         // BODGE ??? This should all change when we can do hit testing on lines.
02978     if(pSimpleNode)
02979     {
02980         // we're over an object - we'll see how close to its path we are
02981         Path* pPath = NULL; 
02982     
02983         if (IS_A(pSimpleNode, NodePath))
02984         {
02985             // get the node as a NodePath
02986             NodePath* pNPath = (NodePath*) pSimpleNode;
02987             pPath= &(pNPath->InkPath);
02988         }
02989         else if (pSimpleNode->IsKindOf(CC_RUNTIME_CLASS(NodeSimpleShape)))
02990         {
02991             // get the node as a NodeSimpleShape
02992             NodeSimpleShape * pNShape = (NodeSimpleShape*) pSimpleNode;
02993             pPath= &(pNShape->InkPath);
02994         }
02995         else if (pSimpleNode->IsKindOf(CC_RUNTIME_CLASS(NodeRegularShape)))
02996         {
02997             NodeRegularShape * pNShape = (NodeRegularShape*) pSimpleNode;
02998             pNShape->BuildShapePath(&pPath);
02999         }
03000 
03001         // we'll use the snap range to determine whether we are close to the path or not
03002         if(pPath)
03003         {
03004             INT32 CloseSlot = 0;
03005             double mu = 0.0;
03006             if (pPath->IsPointCloseTo(pMousePos,Range*Range, &CloseSlot, &mu))
03007             {
03008                 return LINE_TARGET;         // yes we are
03009             }
03010         }
03011     }
03012 
03013     return TargetHit;
03014 }

BOOL DocView::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!

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/12/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the last click event was a quad click. FALSE if not, or the attached oil view is not a screen view.
See also:
DocView::IsSingleClickReallyTriple()

Definition at line 5070 of file docview.cpp.

05071 {
05072     // Salary check
05073     if (pViewWindow == NULL)
05074     {
05075         ERROR3("No attached oil view");
05076         return FALSE;
05077     }
05078 
05079     return pViewWindow->IsSingleClickReallyQuad();
05080 }

BOOL DocView::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!

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/12/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the last click event was a triple click. FALSE if not, or the attached oil view is not a screen view.
See also:
DocView::IsSingleClickReallyQuad()

Definition at line 5040 of file docview.cpp.

05041 {
05042     // Salary check
05043     if (pViewWindow == NULL)
05044     {
05045         ERROR3("No attached oil view");
05046         return FALSE;
05047     }
05048 
05049     return pViewWindow->IsSingleClickReallyTriple();
05050 }

RenderRegion* DocView::NewRenderRegion DocRect  ,
Matrix ,
CNativeDC ,
Spread ,
RenderType 
[private]
 

void DocView::NotifyBoundsChanged BOOL  bNewValue = TRUE  )  [inline]
 

Definition at line 615 of file docview.h.

00615 {m_bBoundsChanged = (m_bBoundsChanged || bNewValue);}

Spread * DocView::OilToSpreadCoord OilCoord  oilpos,
DocCoord pdocpos
 

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.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/11/94
Parameters:
oilpos - OilCoord to find spread and DocCoord for. [INPUTS]
pdocpos - Pointer to DocCoord to receive DocCoord. [OUTPUTS]
Returns:
Spread* - Pointer to spread in which pdocpos is valid.

Definition at line 4158 of file docview.cpp.

04159 {
04160     // Preconditions
04161     ERROR2IF(this==NULL,NULL,"DocView::OilToDoc called on NULL pointer");
04162 
04163     // Clear the destination DocCoord in case it all goes horribly wrong...
04164     *pdocpos = DocCoord(0,0);
04165 
04166     // Find the spread that contains DocPos, if none then return NULL immediately...
04167     Spread *pSpread = FindEnclosingSpread(oilpos);
04168     if (pSpread != NULL)
04169     {
04170         // Convert the OilCoord into document coords...
04171         *pdocpos = oilpos.ToDoc(pSpread, this);
04172 
04173         // and then into Spread coords...
04174         pSpread->DocCoordToSpreadCoord(pdocpos);
04175     }
04176 
04177     // Return pointer to enclosing spread to caller.
04178     return pSpread;
04179 }

void DocView::OnClick OilCoord  PointerPos,
ClickType  Click,
ClickModifiers  Mods
 

Convert click coordinates into DocCoords and pass them on to the current tool.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/7/93
Parameters:
PointerPos - Position of click from OS [INPUTS] Click - Type of click (single, double or drag) Mods - Other inputs which modify the meaning of the click

Definition at line 3240 of file docview.cpp.

03241 {
03242     // Ignore if system is disabled
03243     if (CCamApp::IsDisabled())
03244         return;                             // If the system is disabled, ignore
03245 
03246     // grab the focus if it's stuck in  a control somewhere
03247     DialogManager::DefaultKeyboardFocus();  
03248     
03249     // Find the spread in which the click happened
03250     Spread *pSpread = FindEnclosingSpread(PointerPos);
03251 
03252     if (pSpread == NULL)
03253     {
03254         ERROR3("Could not find spread in which the click happened");
03255         return; // Exit reasonably nicely
03256     }
03257 
03258     // When the user clicks on a spread which is not the selected spread then this spread becomes
03259     // selected and the selection is cleared.
03260     //Document::SetSelectedSpread(pSpread);
03261     Document::SetSelectedViewAndSpread(pDoc, this, pSpread);
03262 
03263     //GetApplication()->FindSelection()->SetSelectedSpread(pSpread);
03264 
03265     // First of all convert the OilRect into device coords
03266     DocCoord DocPos = PointerPos.ToDoc( pSpread, this );
03267     
03268     // Convert the coord to spread coords
03269     pSpread->DocCoordToSpreadCoord(&DocPos);
03270 
03271 
03272     // Store away the WorkCoord version of this click in the DocView for later extraction by
03273     // GetClickWorkCoord();
03274     LastWorkClick = PointerPos.ToWork( pVState->GetScrollPos() );
03275     ViewFlags.WorkClickCached = TRUE;           // Cached WorkCoord is valid.
03276 
03277     // Check the click mods to see if they specify an operation which we can do directly here
03278     if (Mods.IsHandledByTool())
03279     {
03280         // Now call the current tool with the DocCoord click point
03281         // Graham 18/6/96: When one button clicks while another one is dragging
03282         // we call the current drag operation, not the tool
03283         if (Mods.ClickWhileDrag)
03284         {
03285             //First make sure there is a current drag operation
03286             ERROR3IF(Operation::GetCurrentDragOp()==NULL, "DocView::OnClick - no current drag operation");
03287 
03288             //Now call the current drag operation.
03289             //If the current drag operation is not a transform operation, this
03290             //will call the empty virtual function Operator::OnClickWhileDragging.
03291             Operation::GetCurrentDragOp()->OnClickWhileDragging(PointerPos, Click, Mods, m_bSolidDrag);
03292         }
03293         else if (Mods.PushCentreTool)
03294         {
03295             // Matt 16/11/2000 - Use the push tool/auto-screen-centrey-tool when required
03296             OpPush* pOpPush = new OpPush;
03297             ERROR3IF(!pOpPush,"Out of memory in DocView() -> Cannot create PushOp");
03298 
03299             // Matt 12/01/2001
03300             // Change the cursor to show the hand icon
03301             PushToolCursorID = CursorStack::GPush( &m_PushCursor, TRUE );
03302 
03303             // Start the drag operation and pass in the Anchor Point to the push operation
03304             pOpPush -> DoDrag( DocPos );
03305         }
03306         else
03307         {
03308             Tool* pCurrentTool = Tool::GetCurrent();
03309 
03310             if(pCurrentTool)
03311             {
03312                 pCurrentTool->OnClick(DocPos, Click, Mods, pSpread);
03313             }
03314         else
03315             ERROR3("No current tool in DocView::OnClick()!");
03316         }
03317 
03318         // ---------------------------------------------------------------------------
03319         // Do special handling for menu clicks
03320         // Allow the Selector to do it's normal stuff for "Click" events and "Up" events
03321         // So that menu clicks perform selection as required by Windows UI guidelines
03322         // On the up stroke show the context menu
03323         if (Mods.Menu)
03324         {
03325 #ifndef STANDALONE
03326             Tool* pSelector = Tool::FindTool(TOOLID_SELECTOR);
03327             ERROR3IF(pSelector==NULL, "ARGH! No Selector when DocView got a menu click!");
03328             Tool* pCurrentTool = Tool::GetCurrent();
03329             if (pSelector!=pCurrentTool &&
03330                 (Click == CLICKTYPE_SINGLE || Click == CLICKTYPE_UP) && // Don't allow menu drags while selector not current
03331                 !Mods.ClickWhileDrag &&
03332                 Operation::GetCurrentDragOp()==NULL)
03333             {
03334                 pSelector->OnClick(DocPos, Click, Mods, pSpread);
03335             }
03336 
03337             // On the up stroke
03338             if (Click==CLICKTYPE_UP && !Mods.ClickWhileDrag)
03339             {
03340 #ifdef PHOTOSHOPPLUGINS
03341                 // As we are just about to invoke a context menu, check that the plug-in manager has its list
03342                 // of available plug-ins otherwise, go and get it now as we are just about to need it.
03343                 // Must do it now before even the hint of a context menu is started as the context
03344                 // menus stack the automatic menu id and then restore it after they are destroyed.
03345                 // This is bad if our main plug in menu ids are in this range!
03346                 // We have to do it generally as at this point we don't know whether we are over a node
03347                 // such as NodeBitmap which requires it.
03348                 PlugInManager* pManager = GetApplication()->GetPlugInManager();
03349                 if (pManager)
03350                     pManager->CheckHaveDetailsOnPlugIns();
03351 #endif // PHOTOSHOPPLUGINS
03352                 
03353                 // Pop up the context sensitive view menu.
03354                 ViewContextMenu* pViewPopup = new ViewContextMenu;
03355                 pViewPopup->ShowOverView(pSpread, DocPos, Mods);
03356             }
03357 #endif
03358         }
03359         // ---------------------------------------------------------------------------
03360     }
03361     else
03362     {
03363         if (Click==CLICKTYPE_UP)
03364         {
03365             if (Mods.EditObject)
03366             {
03367                 // Find the node under the pointer and ask it what its favourite editing
03368                 // tool is.
03369             }
03370 
03371             else if (Mods.FullScreen)
03372             {
03373                 // Use the full screen toggle.
03374                 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor( OPTOKEN_VIEWFULLSCREEN );
03375                 if (pOpDesc) pOpDesc->Invoke();
03376             }
03377 
03378             else if (Mods.ZoomIn)
03379             {
03380                 // Try to create an instance of the zoom operation.
03381                 OpZoom* pZoomOp = new OpZoom;
03382                 if (pZoomOp == NULL)
03383                 {
03384                     // We ran out of memory, so sorry.
03385                     InformError(_R(IDE_NOMORE_MEMORY));
03386                     return;
03387                 }           
03388 
03389                 // Zoom in or out around the mouse position.
03390                 if (Mods.Adjust)
03391                 {
03392                     pZoomOp->ZoomOut(LastWorkClick);
03393                 }
03394                 else
03395                 {
03396                     pZoomOp->ZoomIn(LastWorkClick);
03397                 }
03398             }
03399             else if (Mods.PushCentreTool)
03400             {
03401                 // Then the user wants us to centre the view about their mouse position
03402             }
03403 
03404         }
03405     }
03406 
03407     ViewFlags.WorkClickCached = FALSE;          // Cached WorkCoord is no longer valid!
03408 }

void DocView::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.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DocView::OnNewView; CCamView::OnInitialUpdate; struct ViewState

Definition at line 1503 of file docview.cpp.

01504 {
01505     // empty for now
01506 }

void DocView::OnMouseMove OilCoord  Pos,
ClickModifiers  mods
 

Converts the mouse position into document coordinates, then calls the OnMouseMove() function of the currently selected tool with this information.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> (Updated by Tim & Rik)
Date:
14 Oct 93
Parameters:
Pos - The position of the mouse, in OIL layer coordinates. [INPUTS] mods - which buttons/keys are down.

Definition at line 3425 of file docview.cpp.

03426 {
03427     // Ignore if system is disabled
03428     if (CCamApp::IsDisabled())
03429         return;                             // If the system is disabled, ignore
03430 
03431     Spread *pSpread = FindEnclosingSpread(Pos);
03432     if (pSpread != NULL)
03433     {
03434         // Convert from OIL coordinates to document coordinates
03435         DocCoord DocPos = Pos.ToDoc(pSpread, this );
03436 
03437         // Convert the coord to spread coords
03438         pSpread->DocCoordToSpreadCoord(&DocPos);
03439 
03440         // Call the currently selected tool.
03441         Tool* pTool = Tool::GetCurrent();
03442 
03443         //Is there a currently selected tool?
03444         if (pTool != NULL)
03445         {
03446             // And pass the mouse move event to the tool.
03447             pTool->OnMouseMove(DocPos, pSpread, mods);
03448         }
03449         else
03450             //No, there's no currently selected tool. We're in Camelot so that's worrying.
03451             //Show an error.
03452             ERROR3("No current tool in DocView::OnMouseMove()!");
03453     }
03454 }

void DocView::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.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DocView::OnLoadedView; CCamView::OnInitialUpdate; struct ViewState

Definition at line 1425 of file docview.cpp.

01426 {
01427     // Only set the scroll offsets if they have not been set yet.
01428     // eg. When a document is loaded it is possible that it has already set the Scroll Offsets
01429     // to something sensible.
01430     WorkCoord CurrentOffset = GetScrollOffsets();
01431     if ((CurrentOffset.x==0) && (CurrentOffset.y==0))
01432     {
01433         // Find the first page in the document and set the scroll offsets so that the top
01434         // left corner of the page is in the top left corner of the view.
01435         Node* pSearchNode = Node::DocFindFirstDepthFirst(pDoc);
01436         while (pSearchNode != NULL && !pSearchNode->IsSpread())
01437             pSearchNode = pSearchNode->DocFindNextDepthFirst();
01438 
01439         ERROR3IF(pSearchNode == NULL, "ViewStateChanged: Can't find first spread.");
01440 
01441         if (pSearchNode != NULL)
01442         {
01443             Spread *pSpread = (Spread *)pSearchNode;
01444 
01445             // OK, found the spread. Go look for the first page
01446             Page *pPage = pSpread->FindFirstPageInSpread();
01447             ERROR3IF(pPage == NULL, "ViewStateChanged: Can't find first page in spread.");
01448 
01449             if (pPage != NULL)
01450             {
01451                 // OK, found the first page.
01452                 // Read its position in the spread, translate into Doc Coord space
01453                 DocRect PageRect = pPage->GetPageRect();
01454 
01455                 DocCoord TopLeft(PageRect.lo.x, PageRect.hi.y);
01456                 pSpread->SpreadCoordToDocCoord(&TopLeft);
01457 
01458                 // Then translate to work coords
01459                 WorkCoord TopLeftWrk = TopLeft.ToWork(pSpread, this);
01460             
01461                 // Shift the corner of the page 1/8th of an inch into the window.
01462                 TopLeftWrk.x -= (72000/8);
01463                 TopLeftWrk.y += (72000/8);
01464 
01465                 // Only set the new scroll offsets if valid. Otherwise we will get an Error2.
01466                 // We may try to set illegal values now that we allow zero sized pasterboards.
01467                 if (TopLeftWrk.x >= (XLONG)0 && TopLeftWrk.y <= (XLONG)0)
01468                 {
01469                     // And scroll to place that offset at the top left of the view window
01470                     SetScrollOffsets(TopLeftWrk, FALSE);
01471                 }
01472             }
01473         }
01474     }
01475 
01476     DialogBarOp::SetSystemStateChanged();
01477 
01478     // Change the View State so that it is no longer marked as new
01479 PORTNOTE("other","Removed ViewState usage")
01480 #ifndef EXCLUDE_FROM_XARALX
01481     if (pVState!=NULL)
01482         pVState->IsNewView = FALSE;
01483 #endif
01484 }

void DocView::RenderEntireView RenderRegion pRRegion,
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.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/8/2000
Parameters:
pRRegion - the region to use for rendering the spread [INPUTS]

Definition at line 2010 of file docview.cpp.

02011 {
02012     DocRect ClipRect;
02013 
02014     Matrix ViewTransform = ConstructRenderingMatrix(pSpread);
02015     // Scroll offsets etc may have changed, so transfer matrix.
02016     pRRegion->SetMatrix(ViewTransform);
02017 
02018     // Get the region to clip all the rendering to
02019     ClipRect = pRRegion->GetClipRect();
02020 
02021     // If the state is NULL I take this to mean that the RenderRegion has only just been 
02022     // created and I will therefore ensure that the window background is rendered by rendering 
02023     // all the "paper" parts of the document. That is, the pages, chapters, pasteboard, etc...
02024     if (pRRegion->IsPaperRendered == FALSE)
02025     {
02026         // Render all paper nodes from there into the real render region
02027         pRRegion->SaveContext();
02028         RenderPaper(pRRegion, pSpread);
02029         pRRegion->RestoreContext();
02030 
02031         // The Paper is now done
02032         pRRegion->IsPaperRendered = TRUE;
02033     }
02034 
02035     // Now render all the ink (non-paper) parts of the document.
02036     pRRegion->RenderTree(pSpread, FALSE);
02037 
02038     // Reset state to new posn in tree.
02039     pRRegion->StopRender();
02040 }

RenderRegion * DocView::RenderOnTop DocRect Rect,
Spread pSpread,
OnTopCode  Reason
[static]
 

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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/8/93
Parameters:
Rect - The DocRect of the area that needs to be redrawn [INPUTS] Reason - EOR or Normal or CLICKBITMAP
Returns:
A pointer to a render region, or NULL if a valid RRegion could not be generated (or there were none to make in the first place
See also:
DocView::GetNextOnTop

Definition at line 3953 of file docview.cpp.

03954 {
03955     RenderRegion* pRender = NULL; //RenderRegion::GetCurrent();
03956 
03957     if ( OnTopCount == 0 )
03958     {
03959         // Find out about the current view
03960         DocView* pCurrentView = GetSelected();
03961 
03962         // If there is no current view, then return NULL
03963         if (pCurrentView==NULL)
03964             return NULL;
03965 
03966         // We should only hand out render regions if the view is not in the process of dying
03967         if (pCurrentView->IsViewDying)
03968             return NULL;
03969 
03970         // if the spread is NULL then this is bad
03971         if (pSpread==NULL)
03972             return NULL;
03973 
03974         // Find the first rectangle or region that needs redrawing and make
03975         // a render region for it.
03976         DocRect ClipRect;
03977         if (Rect == NULL)
03978         {
03979             // Get the DocView's viewport, in Spread Coords
03980             ClipRect = pCurrentView->GetDocViewRect(pSpread);
03981             pSpread->DocCoordToSpreadCoord(&ClipRect);
03982         }
03983         else
03984             ClipRect = *Rect;
03985 
03986         // Make sure that the clip rect is valid
03987         if (!ClipRect.IsValid())
03988         {
03989             // The Clip rect was not a valid rectangle
03990             ERROR3("RenderOnTop was asked to render to an invalid rect.");
03991             return NULL;
03992         }
03993                 
03994         // Go and get a render region based on all this info
03995         pRender = pCurrentView->GetFirstRenderRegion(ClipRect, pSpread, Reason);
03996             
03997         // stop now if we did not get one
03998         if ( !pRender )
03999             return NULL;
04000 
04001         // Set the static Reason code so that all future calls to RenderOnTop and
04002         // GetNextOnTop will do the same thing
04003         OnTopReason = Reason;
04004         OnTopSpread = pSpread;
04005         OnTopRenderRegion = pRender;
04006     
04007         // Turn on EORing for the RenderRegion if needed
04008         if (( OnTopReason == UnclippedEOR ) || (OnTopReason == ClippedEOR))
04009             pRender -> SetDrawingMode( DM_EORPEN );
04010             
04011         // Increment the Static Counter so that we know how many times this
04012         // function has been called
04013         OnTopCount++;
04014         
04015         // return the render region
04016         return pRender;
04017     }
04018     else
04019     {
04020         // Get the current RenderOnTop RenderRegion
04021         pRender = OnTopRenderRegion;
04022         
04023         // If there is no current render region, then we had better stop now
04024         if (!pRender)
04025             return NULL;
04026 
04027         // Increment the Static Counter so that we know how many times this
04028         // function has been nested through
04029         OnTopCount++;
04030         
04031         // if we want to be EORing, then make sure that EORing has been switched on
04032         if (( OnTopReason == UnclippedEOR ) || (OnTopReason == ClippedEOR))
04033             pRender -> SetDrawingMode( DM_EORPEN );
04034         
04035         // return the current render region
04036         return pRender;
04037     }
04038 }

BOOL DocView::RenderPageMarks RenderRegion pCurrRegion,
Matrix ViewTrans,
DocRect ClipRect,
Spread pSpread
[virtual]
 

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.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/08/96
Parameters:
pSpread - pointer to the spread concerned [INPUTS] pRRegion - pointer to the render region to use.
- [OUTPUTS]
Returns:
-
See also:
View, PrintView

Reimplemented from View.

Definition at line 5265 of file docview.cpp.

05266 {
05267     return TRUE;    
05268 }

void DocView::RenderSelectBlobs DocRect  Rect,
Spread pSpread
 

Renders the Selection blobs of all the currently selected objects.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/9/93
Parameters:
Rect - The Clipping Rectangle of the bit to draw [INPUTS]
See also:
DocView::OnDraw

Definition at line 3663 of file docview.cpp.

03664 {
03665 //  TRACEUSER("Gerry", _T("RenderSelectBlobs (%d, %d) - (%d, %d)\n"), Rect.lo.x, Rect.lo.y, Rect.hi.x, Rect.hi.y);
03666 
03667     // Only render blobs if there is a selection, and this spread owns it.
03668     SelRange* Selected = GetApplication()->FindSelection();
03669 
03670     // Karim 29/06/2000
03671     //  PromoteToParent should never be set TRUE on the selection range, outside
03672     //  of code in which its modifications are required.
03673     //  I have included a TRACE statement here, as a 'quiet' note to programmers,
03674     //  should this occur.
03675     RangeControl rc = Selected->GetRangeControlFlags();
03676     if (rc.PromoteToParent)
03677     {
03678         TRACE( _T("DocView::RenderSelectBlobs; PromoteToParent is TRUE! Read inline comment for details.\n") );
03679         rc.PromoteToParent = FALSE;
03680         Selected->Range::SetRangeControl(rc);
03681     }
03682 
03683 //PostProcessorStack* pStack = Selected->GetPostProcessorStack();
03684 //ListRange* pLevel = pStack->GetNewLevelRange(FALSE);
03685 
03686     Node* pNode = Selected->FindFirst();
03687 //Node* pNode = pLevel->FindFirst();
03688     if ((pNode == NULL) || ( pNode->FindParentSpread() != pSpread))
03689         // This spread does not own selection
03690         return;
03691 
03692     // Go find the blob manager
03693     BlobManager* BlobMgr = GetApplication()->GetBlobManager();
03694     ERROR3IF( BlobMgr == NULL, "BlobManager unexpectedly turned out NULL!");
03695 
03696     // Go and render the blobs
03697     RenderRegion* pRender = DocView::RenderOnTop( &Rect, pSpread, ClippedEOR );
03698     while (pRender)
03699     {
03700         pNode = Selected->FindFirst();
03701 //pNode = pLevel->FindFirst();
03702         while (pNode != NULL)
03703         {
03704             ERROR3IF(!pNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableInk)),
03705                     "Selected node is not a NodeRenderableInk in DocView::RenderSelectBlobs()");
03706 
03707             // Make sure that the nodes bounding box overlaps the redraw box
03708             //if ( Rect.IsIntersectedWith(((NodeRenderableInk*)pNode)->GetBlobBoundingRect()))
03709                 // tell the node to draw in its selection blobs
03710             //  ((NodeRenderableInk*)pNode)->RenderSelectBlobs();
03711 
03712             // Render those blobs           
03713             BlobMgr->RenderMyBlobs(&Rect, pSpread, (NodeRenderable*)pNode);
03714 
03715             // Find the next selected node to render
03716             pNode = Selected->FindNext(pNode);
03717 //pNode = pLevel->FindNext(pNode);
03718         }
03719 
03720         // Get the next render region
03721         pRender = DocView::GetNextOnTop(&Rect);
03722     }
03723 //delete pLevel;
03724 
03725     // Bodge to stop fill meshes EOR each other out.
03726     AttrFillGeometry::LastRenderedMesh = NULL;
03727 }

void DocView::RenderView RenderRegion pRRegion,
Matrix ViewTransform,
Spread pSpread,
BOOL  bPrintPaper,
BOOL  fDeleteRegionAfter = TRUE,
BOOL  bForceImmediate = FALSE
[private]
 

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.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/5/93
Parameters:
pRRegion - the region to use for rendering the spread [INPUTS] ViewTransform - the matrix to use when transforming document coordinates into Window coordinates. pSpread - the spread we are rendering with this render region. bPrintPaper should be TRUE if paper-like items need to be rendered e.g. page marks, blobs, etc, or FALSE otherwise. A TRUE value also will enable background rendering, so long as Viewflags.BackgroundRender is also set. fDeleteRegionAfter --- by default TRUE - if so then this function will deallocate the RenderRegion passed to it when it has been comletely rendered.

Definition at line 1735 of file docview.cpp.

01739 {
01740     Node* pNode = NULL;
01741     BOOL CleanUp = TRUE;                            // TRUE if cleanup at end, FALSE if dont
01742     BOOL IsMoreBands = FALSE;
01743     DocRect ClipRect;
01744 
01745     BOOL HasRendered = FALSE;
01746     BOOL Continue = TRUE;
01747     BOOL bPaperRenderedThisTime = FALSE;
01748 
01749     // Record time when rendering started
01750     StartTime.Sample();
01751 
01752     // Scroll offsets etc may have changed, so transfer matrix.
01753     pRRegion->SetMatrix(ViewTransform);
01754 
01755     // Prepare to find out whether any bounds in selection are changed during redraw
01756     m_bBoundsChanged = FALSE;
01757 
01758     // Start the first band
01759     if (!pRRegion->SetFirstBand())
01760     {
01761         goto ExitRenderNoStop;
01762     }
01763 
01764     do
01765     {
01766         // See if we are actually waiting for memory
01767         if (pRRegion->IsWaitingForRAM)
01768         {
01769             // See if we can get the memory yet ?
01770             pRRegion->GetNextBand();
01771 
01772             if (pRRegion->IsWaitingForRAM)
01773                 break;  // Nope still not enough
01774         }
01775 
01776         // Tell the RenderRegion that I am going to start rendering.
01777         if (!pRRegion->StartRender())
01778         {
01779             TRACEALL( _T("StartRender failed in RenderView\n") );
01780                                                                 // will be deleted quickly
01781             goto ExitRenderNoStop;                              // skip StopRender call
01782         }
01783 
01784         // If the state is NULL I take this to mean that the RenderRegion has only just been 
01785         // created and I will therefore ensure that the window background is rendered by rendering 
01786         // all the "paper" parts of the document. That is, the pages, chapters, pasteboard, etc...
01787         if (pRRegion->IsPaperRendered == FALSE)
01788         {
01789             if (bPrintPaper)
01790             {
01791                 // Render all paper nodes from there into the real render region
01792                 pRRegion->SaveContext();
01793                 RenderPaper(pRRegion, pSpread);
01794                 pRRegion->RestoreContext();
01795 
01796                 if (pRRegion->NeedsOSPaper)
01797                 {
01798                     // This render region uses the OS to render paper, so if we don't
01799                     // render anything except paper then there is no need for e.g.
01800                     // GRenderRegions to blit anything.  Hence we call this function
01801                     // to clear the changed bbox.
01802                     pRRegion->SetClean(TRUE, FALSE);
01803                 }
01804             }
01805 
01806 #ifdef _DEBUG
01807 // TEMP BODGE! DO NOT RELEASE!
01808 //if (pRRegion->IsKindOf(CC_RUNTIME_CLASS(GRenderRegion)))
01809 //  ((GRenderRegion*)pRRegion)->DebugTrace();
01810 #endif 
01811 
01812             // The Paper is now done
01813             pRRegion->IsPaperRendered = TRUE;
01814             bPaperRenderedThisTime = TRUE;
01815         }
01816 
01817         // ------------------------------------------
01818         // Call the central tree renderer...
01819         Continue = pRRegion->RenderTree(pSpread,
01820                                         ViewFlags.BackgroundRender && !bForceImmediate      // Only timeslice if bgr && ! rendering paper
01821                                         );
01822         // ------------------------------------------
01823 
01824         // Reset state to new posn in tree.
01825         BOOL bRendered = pRRegion->StopRender();
01826         HasRendered = HasRendered || bRendered;
01827 
01828         // Dragging blobs/boxes.
01829         Operation* pDragOp = Operation::GetCurrentDragOp();
01830         if (pDragOp) pDragOp->RenderDragBlobs(pRRegion->GetClipRect(), pSpread, m_bSolidDrag);
01831 
01832         // Assume we ran out of time
01833         IsMoreBands = FALSE;
01834 
01835         // If we did not run out of time, prepare the next band
01836         if (Continue)
01837         {
01838             IsMoreBands = pRRegion->GetNextBand();
01839 
01840             if (pRRegion->IsWaitingForRAM)
01841                 break;      // Leave this region for a while
01842         }
01843     } while (IsMoreBands);
01844 
01845     // Could jump straight to here if the render region was waiting for some ram to show up
01846 
01847 ExitRenderNoStop:
01848     pNode = pRRegion->GetRenderState();
01849 
01850     // Find out whether all bounds have become cached during this render
01851     // If so, update the SelRange and tell all tools the SelRange has changed
01852     // This handles the situation where effects change their bounds during rendering
01853     if (m_bBoundsChanged)
01854     {
01855         // Only broadcast to the rest of the program if we're not trying to be quick
01856         Camelot.FindSelection()->Update(!Operation::GetQuickRender(NULL));
01857     }
01858 
01859     // Find out the rectangle of the whole unbanded region
01860     DocRect BlobClipRect = pRRegion->GetRegionRect();
01861     BOOL IsRegionFinished = CleanUp && !pRRegion->IsWaitingForRAM && pRRegion->IsLastBand && !pNode;
01862 
01863     // If the region has finished rendering, delete it, otherwise update its context node.
01864     if (IsRegionFinished)
01865     {
01866         if (fDeleteRegionAfter)
01867         {
01868             // Unlink the RenderRegion from list
01869             BOOL InList = Camelot.DeleteRenderRegion(pRRegion);
01870             ERROR2IF(!InList, (void)0, "DocView::RenderView tried to delete a RenderRegion not in list");
01871             delete pRRegion;
01872         }
01873     }
01874 
01875     // Draw the blobs if we are the "selected" view.
01876     // And we're not solid dragging...
01877     if (this == Selected && !(pCurrentDragOp!=NULL && m_bSolidDrag))
01878     {
01879         // Tool & selection blobs.
01880         // HasRendered really means "Has blitted and wiped out previous blobs within the changedrect..."
01881         // So we should redraw the blobs inside the changed rect (note that the paper chanegd rect
01882         // needs to be derived differently than the ink changed rect)
01883         // BUT we don't know here what the changed rect is!
01884         // SO, all we can do is wait until the render is over then put the blobs back on
01885 //      if (HasRendered || bPaperRenderedThisTime))
01886         if (IsRegionFinished)
01887         {
01888             Tool* pTool = Tool::GetCurrent();
01889             if (pTool)
01890             {
01891                 pTool->RenderToolBlobs(pSpread, &BlobClipRect);
01892             }
01893 
01894             // Render the Currently selected objects selection blobs
01895             RenderSelectBlobs(BlobClipRect, pSpread);
01896         }
01897     }
01898 }

void DocView::ResetRenderingStartTime  )  [inline]
 

Definition at line 350 of file docview.h.

00350 { StartTime.Sample(); }

void DocView::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.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/3/1996
Parameters:
pBoundingBox - DocRect to show in spread coords [INPUTS] Direction - Direction of movement
- [OUTPUTS]
Returns:
-
If an ordinate of Direction is zero then we ignore it and no scrolling is done in that direction.

Definition at line 1067 of file docview.cpp.

01068 {
01069     ERROR3IF(pBoundingBox == NULL,"pBoundingBox is NULL");
01070     if (pBoundingBox == NULL) return;
01071 
01072     DocCoord Point;
01073 
01074     if (Direction.x > 0)
01075         Point.x = pBoundingBox->hi.x;
01076     else if (Direction.x < 0)
01077         Point.x = pBoundingBox->lo.x;
01078     else
01079         Point.x = 0;
01080 
01081     if (Direction.y > 0)
01082         Point.y = pBoundingBox->hi.y;
01083     else if (Direction.y < 0)
01084         Point.y = pBoundingBox->lo.y;
01085     else
01086         Point.y = 0;
01087 
01088     // call ScrollToShowAux which does the actual work
01089     ScrollToShowAux(&Point, DocCoord(0,0));
01090 }

void DocView::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.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/3/96
Parameters:
RectToShow - Rectangle to show, in spread coords [INPUTS]
i.e. Unlike the other ScrollToShow functions, this actually scrolls to show the given rectangle, as opposed to single points.

Definition at line 941 of file docview.cpp.

00942 {
00943     ERROR3IF(RectToShow == NULL, "Illegal NULL params");
00944     
00945     Spread* pSpread = GetFirstSelectedSpread();
00946 
00947     if (pSpread == NULL)
00948         return;
00949 
00950     // The TRUE argument for GetPasteBoardRect means that the result gets
00951     // pixelised. Otherwise the clipping code below doesn't work properly
00952     DocRect ViewRect = (GetDocViewRect(pSpread)).ToSpread(pSpread, this);
00953 
00954     // If the rect is entirely visible, or as much as possible of it is visible, then don't scroll!
00955     if (ViewRect.ContainsRect(*RectToShow) || RectToShow->ContainsRect(ViewRect))
00956         return;
00957 
00958     // Find the distance of the rectangle from each edge of the view rect, and work out
00959     // the distance we should scroll the view by
00960     DocCoord Offset(0,0);
00961 
00962     // If we need to scroll in x axis, work out by how much
00963     // "Need to scroll" means: The target rect lies outside the view rect on *only* one side
00964     if (
00965         (RectToShow->lo.x < ViewRect.lo.x || RectToShow->hi.x > ViewRect.hi.x) &&   // Outside
00966         !(RectToShow->lo.x < ViewRect.lo.x && RectToShow->hi.x > ViewRect.hi.x)     // On one side only
00967         )
00968     {
00969         // Find the distance needed to scroll the left edge of target to the left edge of the view
00970         // and the right edge to the right edge.
00971         INT32 Diff1 = RectToShow->lo.x - ViewRect.lo.x;
00972         INT32 Diff2 = RectToShow->hi.x - ViewRect.hi.x;
00973 
00974         // We need to scroll by the smaller of these 2 distances
00975         INT32 AbsDiff1 = ABS(Diff1);
00976         INT32 AbsDiff2 = ABS(Diff2);
00977 
00978         Offset.x = (AbsDiff1 < AbsDiff2) ? Diff1 : Diff2;
00979     }
00980 
00981     // Repeat the above for the Y axis
00982     if (
00983         (RectToShow->lo.y < ViewRect.lo.y || RectToShow->hi.y > ViewRect.hi.y) &&   // Outside
00984         !(RectToShow->lo.y < ViewRect.lo.y && RectToShow->hi.y > ViewRect.hi.y)     // On one side only
00985         )
00986     {
00987         // Find the distance to scroll to the left and right edges
00988         INT32 Diff1 = RectToShow->lo.y - ViewRect.lo.y;
00989         INT32 Diff2 = RectToShow->hi.y - ViewRect.hi.y;
00990 
00991         // We need to scroll by the smaller of these 2 distances
00992         INT32 AbsDiff1 = ABS(Diff1);
00993         INT32 AbsDiff2 = ABS(Diff2);
00994 
00995         Offset.y = (AbsDiff1 < AbsDiff2) ? Diff1 : Diff2;
00996     }
00997 
00998     // Ensure we don't scroll off the pasteboard area. This should really be done by
00999     // SetScrollOffsets, but it appears that function is complete pants, and I've already
01000     // had to change over 60 files because of poorly designed fundamental code, so
01001     // I really don't have time to fix yet more problems.
01002     DocRect PasteRect = (pSpread->GetPasteboardRect(TRUE)).ToSpread(pSpread, this);
01003     if (Offset.x < 0)
01004     {
01005         if (ViewRect.lo.x + Offset.x < PasteRect.lo.x)
01006             Offset.x = ViewRect.lo.x - PasteRect.lo.x;
01007     }
01008     else
01009     {
01010         if (ViewRect.hi.x + Offset.x > PasteRect.hi.x)
01011             Offset.x = PasteRect.hi.x - ViewRect.hi.x;
01012     }
01013 
01014     if (Offset.y < 0)
01015     {
01016         if (ViewRect.lo.y + Offset.y < PasteRect.lo.y)
01017             Offset.y = ViewRect.lo.y - PasteRect.lo.y;
01018     }
01019     else
01020     {
01021         if (ViewRect.hi.y + Offset.y > PasteRect.hi.y)
01022             Offset.y = PasteRect.hi.y - ViewRect.hi.y;
01023     }
01024 
01025     // determine if we need to scroll or not,
01026     if (Offset != DocCoord(0,0))
01027     {
01028         WorkCoord ScrollOffset;
01029         WorkCoord WorkOffset;
01030 
01031         WorkOffset.x = (XLONG) (MakeXLong(Offset.x) * GetViewScale());
01032         WorkOffset.y = (XLONG) (MakeXLong(Offset.y) * GetViewScale());
01033 
01034         ScrollOffset = GetScrollOffsets();
01035         ScrollOffset.x = ScrollOffset.x + WorkOffset.x;
01036         ScrollOffset.y = ScrollOffset.y + WorkOffset.y;
01037 
01038         if (ScrollOffset.x < (XLONG) 0) ScrollOffset.x = (XLONG) 0;
01039         if (ScrollOffset.y > (XLONG) 0) ScrollOffset.y = (XLONG) 0;
01040 
01041         SetScrollOffsets(ScrollOffset, TRUE);
01042     }
01043 }

void DocView::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.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/3/1996
Parameters:
pCoord - coord to show in spread coords [INPUTS]
- [OUTPUTS]
Returns:
-
If an ordinate of pCoord is zero then it is ignored and the view willnot be scrolled in that direction.

Definition at line 913 of file docview.cpp.

00914 {
00915     ERROR3IF(pCoord == NULL,"pCoord is NULL");
00916     if (pCoord == NULL) return;
00917 
00918     // call ScrollToShowAux, which does the actual work
00919     ScrollToShowAux(pCoord, DocCoord(0,0));
00920 }

void DocView::ScrollToShowAux DocCoord pCoord,
DocCoord  Margin
[private]
 

Scrolls the view to ensure that pCoord is in the view, with a margin of Margin between it and the edges of the view.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/3/1996
Parameters:
pCoord - coord to show in spread coords [INPUTS] Margin - margin to give between point and edge of view
- [OUTPUTS]
Returns:
-
If an ordinate of pCoord is zero then we ignore it and do not scroll in that direction.

Definition at line 1231 of file docview.cpp.

01232 {
01233     ERROR3IF(pCoord == NULL,"pCoord is NULL");
01234     if (pCoord == NULL) return;
01235 
01236     ERROR3IF(Margin.x < 0,"Negative X margin");
01237     if (Margin.x < 0) return;
01238 
01239     ERROR3IF(Margin.y < 0,"Negative Y margin");
01240     if (Margin.y < 0) return;
01241     
01242     Spread* pSpread = GetFirstSelectedSpread();
01243 
01244     if (pSpread == NULL)
01245     {
01246         // do nothing
01247     }
01248     else
01249     {
01250         DocRect ViewRect;
01251         DocRect PasteRect;
01252         DocCoord Offset;
01253 
01254         // The TRUE argument for GetPasteBoardRect means that the result gets
01255         // pixelised. Otherwise the clipping code below doesn't work properly
01256         ViewRect = (GetDocViewRect(pSpread)).ToSpread(pSpread, this);
01257         PasteRect = (pSpread->GetPasteboardRect(TRUE)).ToSpread(pSpread, this);
01258 
01259         Offset = DocCoord(0,0);
01260 
01261         // suppose the view rectangle is smaller than two margins width, either in height or
01262         // width, we'll need to alter the margin to half the height or width as appropriate
01263         {
01264             INT32 Width = ViewRect.hi.x - ViewRect.lo.x;
01265             INT32 Height = ViewRect.hi.y - ViewRect.lo.y;
01266 
01267             if (Width < 2*Margin.x)
01268                 Margin.x = Width/2;
01269 
01270             if (Height < 2*Margin.y)
01271                 Margin.y = Height/2;
01272         }
01273                 
01274         // only scroll in the X direction if pCoord->x is not zero
01275         if (pCoord->x != 0)
01276         {
01277             if (pCoord->x >= PasteRect.hi.x-Margin.x) pCoord->x = PasteRect.hi.x-Margin.x;
01278             if (pCoord->x <= PasteRect.lo.x+Margin.x) pCoord->x = PasteRect.lo.x+Margin.x;
01279             
01280             if (pCoord->x < (ViewRect.lo.x+Margin.x))
01281             {
01282                 // need to scroll to the left
01283                 Offset.x = pCoord->x - (ViewRect.lo.x + Margin.x);
01284             }
01285             
01286             if (pCoord->x > (ViewRect.hi.x-Margin.x))
01287             {
01288                 // need to scroll to the right
01289                 Offset.x = pCoord->x - (ViewRect.hi.x - Margin.x);
01290             }
01291         }
01292         else
01293         {
01294             Offset.x = 0;
01295         }
01296 
01297         // only scroll in the Y direction if pCoord->y is not zero
01298         if (pCoord->y != 0)
01299         {
01300             if (pCoord->y >= PasteRect.hi.y-Margin.y) pCoord->y = PasteRect.hi.y-Margin.y;
01301             if (pCoord->y <= PasteRect.lo.y+Margin.y) pCoord->y = PasteRect.lo.y+Margin.y;
01302                 
01303             if (pCoord->y < (ViewRect.lo.y+Margin.y))
01304             {
01305                 // need to scroll down
01306                 Offset.y = pCoord->y - (ViewRect.lo.y+Margin.y);
01307             }
01308             
01309             if (pCoord->y > (ViewRect.hi.y-Margin.y))
01310             {
01311                 // need to scroll up
01312                 Offset.y = pCoord->y - (ViewRect.hi.y-Margin.y);
01313             }
01314         }
01315         else
01316         {
01317             Offset.y = 0;
01318         }
01319         
01320         // determine if we need to scroll or not,
01321         if (Offset != DocCoord(0,0))
01322         {
01323             WorkCoord ScrollOffset;
01324             WorkCoord WorkOffset;
01325 
01326             WorkOffset.x = (XLONG) (MakeXLong(Offset.x) * GetViewScale());
01327             WorkOffset.y = (XLONG) (MakeXLong(Offset.y) * GetViewScale());
01328 
01329             ScrollOffset = GetScrollOffsets();
01330             ScrollOffset.x = ScrollOffset.x + WorkOffset.x;
01331             ScrollOffset.y = ScrollOffset.y + WorkOffset.y;
01332 
01333             if (ScrollOffset.x < (XLONG) 0) ScrollOffset.x = (XLONG) 0;
01334             if (ScrollOffset.y > (XLONG) 0) ScrollOffset.y = (XLONG) 0;
01335 
01336             SetScrollOffsets(ScrollOffset, TRUE);
01337         }
01338         // else do nothing
01339     }
01340 }

void DocView::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.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/3/1996
Parameters:
pBoundingBox - DocRect to show, in spread coords [INPUTS] Direction - direction of movement
- [OUTPUTS]
Returns:
-
If an ordinate of Direction is zero then we ignore it and do not scroll in that direction.

Definition at line 1183 of file docview.cpp.

01184 {
01185     ERROR3IF(pBoundingBox == NULL,"pBoundingBox is NULL");
01186     if (pBoundingBox == NULL) return;
01187 
01188     DocCoord Point;
01189     DocCoord Margin;
01190 
01191     if (Direction.x > 0)
01192         Point.x = pBoundingBox->hi.x;
01193     else if (Direction.x < 0)
01194         Point.x = pBoundingBox->lo.x;
01195     else
01196         Point.x = 0;
01197 
01198     if (Direction.y > 0)
01199         Point.y = pBoundingBox->hi.y;
01200     else if (Direction.y < 0)
01201         Point.y = pBoundingBox->lo.y;
01202     else
01203         Point.y = 0;
01204 
01205     double Scale = GetViewScale().MakeDouble();
01206     Margin.x = (INT32) (ScrollToShowMargin/Scale);
01207     Margin.y = (INT32) (ScrollToShowMargin/Scale);
01208 
01209     // call ScrollToShowAux, which does all the actual work
01210     ScrollToShowAux(&Point, Margin);
01211 }

void DocView::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.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/3/96
Parameters:
RectToShow - Rectangle to show, in spread coords [INPUTS]
i.e. Unlike the other ScrollToShow functions, this actually scrolls to show the given rectangle, as opposed to single points.

Definition at line 1146 of file docview.cpp.

01147 {
01148     ERROR3IF(RectToShow == NULL, "Illegal NULL params");
01149 
01150     DocRect Temp(*RectToShow);
01151 
01152     double Scale = GetViewScale().MakeDouble();
01153 
01154     INT32 Margin = (INT32) (ScrollToShowMargin / Scale);
01155 
01156     Temp.Inflate(Margin, Margin);
01157 
01158     ScrollToShow(&Temp);
01159 }

void DocView::ScrollToShowWithMargin DocCoord pCoord  ) 
 

Scrolls the currently selected view to show the coord; if the coord in already in view then we do nothing.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/3/1996
Parameters:
pCoord - coord to show in spread coords [INPUTS]
- [OUTPUTS]
Returns:
-
If an ordinate of pCoord is zero then we ignore it and do not scroll in that direction.

Definition at line 1111 of file docview.cpp.

01112 {
01113     ERROR3IF(pCoord == NULL,"pCoord is NULL");
01114     if (pCoord == NULL) return;
01115 
01116     DocCoord Margin;
01117 
01118     double Scale = GetViewScale().MakeDouble();
01119 
01120     Margin.x = (INT32) (ScrollToShowMargin/Scale);
01121     Margin.y = (INT32) (ScrollToShowMargin/Scale);
01122 
01123     // call ScrollToShowAux, which does all the actual work
01124     ScrollToShowAux(pCoord, Margin);
01125 }

void DocView::SendSelectedMessage DocView OldSelected,
DocView NewSelected
[static, protected]
 

This is an INTERNAL function, which MUST NOT BE CALLED by anything other than Document::SetSelectedViewAndSpread.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/95
Parameters:
OldSelected - Points to the previously selected DocView (may be NULL) [INPUTS] NewSelected - Points to the new selected DocView (may be NULL)
It is used to broadcast a DocViewMsg (SELCHANGED) to inform of a selection change. It follows a SetSelectedInternal call (a bit later, so that the message is only broadcast once the document, view, and spread states have all been updated correctly)

See also:
Document::SetSelectedViewAndSpread; DocView::SetSelectedInternal

Definition at line 2314 of file docview.cpp.

02315 {
02316     BROADCAST_TO_ALL(DocViewMsg(OldSelected, NewSelected, DocViewMsg::SELCHANGED));
02317 }

BOOL DocView::SetCurrent  ) 
 

Make this object be the 'current' DocView.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/5/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if function set current correctly FALSE otherwise (then an Error has been set)

Reimplemented from View.

Definition at line 2229 of file docview.cpp.

02230 {
02231     return View::SetCurrent();
02232 }                                                     

void DocView::SetExtent DocCoord  lolog,
DocCoord  hilog
[virtual]
 

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).

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/5/93
Parameters:
Two DocCoords describing the low and high corners of a rectangle in logical [INPUTS] space describing the full extent of the document. I.E. the bottom-left corner of the last chapter and the top-right corner of the first.

Implements View.

Definition at line 1525 of file docview.cpp.

01526 {
01527     if (ViewFlags.LogicalView)
01528     {
01529         // "Pixelise" the extent DocCoords.
01530         // Effectively, this helps ensure that the spread will be aligned to a whole pixel boundary
01531         // and allows both GDraw and GDI to consistently plot the same pixels when rendering
01532         // the same primitive
01533         lolog.Pixelise(this);
01534         hilog.Pixelise(this);
01535 
01536         // Logical view means that chapters are shown in a contiguous column
01537         // Convert the extent given in DocCoord to WorkCoords...
01538         pVState->WorkAreaExtent.lo = lolog.ToWork(pDoc, this);
01539         pVState->WorkAreaExtent.hi = hilog.ToWork(pDoc, this);
01540 
01541         // If we know where the OIL view is then tell it that the extents have changed...
01542         if (pViewWindow)
01543         {
01544             pViewWindow->SetWorkAreaExtent(pVState->WorkAreaExtent, FALSE);
01545         }
01546     }
01547     else
01548     {
01549         // Physical view means that chapters are shown in their true positions in Document space
01550         ERROR3("DocView::SetExtent - Can't do physical views yet!");
01551     }
01552 }

void DocView::SetForeBackMode BOOL  NewFlag  )  [virtual]
 

Set the background render flag for this view. Also sets the new value to be used as the default preference.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/93
Parameters:
NewFlag - New bg render flag. [INPUTS]

Implements View.

Definition at line 1646 of file docview.cpp.

01647 {
01648     ViewFlags.BackgroundRender = NewFlag;
01649     
01650     // Update the preference to use this
01651     // Ensure that we either set TRUE or FALSE and not -1 or 0.
01652     // The preference is limited to 0 and 1 values and so -1 is illegal
01653     if (NewFlag == FALSE)
01654         BackgroundRendering = FALSE;
01655     else
01656         BackgroundRendering = TRUE;
01657 }

void DocView::SetNoCurrent  )  [static]
 

Set the current DocView pointer to be NULL, i.e., there is no current DocView object.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/5/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Reimplemented from View.

Definition at line 2250 of file docview.cpp.

02251 {
02252     View::SetNoCurrent();
02253 }

void DocView::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.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/5/2000
Parameters:
Value to set [INPUTS]
Returns:
-

Errors: See also:

Definition at line 5476 of file docview.cpp.

05477 {
05478     m_bPreventRenderView = Value;
05479 }

void DocView::SetPrevZoomIndex INT32  nIndex  ) 
 

Sets the zoom table index of a previous zoom onto this DocView.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/5/94
Parameters:
The previous zoom index. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DocView::GetPrevZoomIndex

Definition at line 2395 of file docview.cpp.

02396 {
02397     PrevIndex = nIndex;
02398 }

void DocView::SetPrevZoomOffset const WorkCoord wcOffset  ) 
 

Sets the scroll offset this DocView will "remember" as a previous zoom.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/5/94
Parameters:
The previous zoom's scroll offset. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DocView::GetPrevZoomOffset

Definition at line 2477 of file docview.cpp.

02478 {
02479     PrevOffset = wcOffset;
02480 }

void DocView::SetPrevZoomScale FIXED16  fxScale  ) 
 

Sets the scale factor this DocView will "remember" as a previous zoom.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/5/94
Parameters:
The previous zoom scale. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DocView::GetPrevZoomScale

Definition at line 2437 of file docview.cpp.

02438 {
02439     PrevScale = fxScale;
02440 }

BOOL DocView::SetScrollOffsets WorkCoord  NewTopLeft,
BOOL  RedrawNeeded
[virtual]
 

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.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/7/93
Parameters:
New scroll offsets [INPUTS] Flag to control whether redraw is needed or not

Reimplemented from View.

Definition at line 880 of file docview.cpp.

00881 {
00882     if (!View::SetScrollOffsets(NewTopLeft, RedrawNeeded))
00883         // Something went wrong - report failure to caller.
00884         return FALSE;
00885 
00886     WorkCoord RoundedTopLeft = GetScrollOffsets();
00887 
00888     // Tell Oil they've changed
00889     pViewWindow->SetScrollOffset(RoundedTopLeft, RedrawNeeded);
00890 
00891     return TRUE;
00892 }

void DocView::SetSelectedInternal DocView NewSelected  )  [static, protected]
 

This is an INTERNAL function, which MUST NOT BE CALLED by anything other than Document::SetSelectedViewAndSpread.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/95
Parameters:
NewSelected - NULL, or the new selected DocView [INPUTS]
It sets the new selected DocView, but DOES NOT broadcast a message. The broadcast follows later, via SendSelectedMessage.

It can be used to set No Selected DocView (NewSelected = NULL)

It also sets this DocView as the Current DocView.

See also:
Document::SetSelectedViewAndSpread; DocView::SendSelectedMessage

Definition at line 2280 of file docview.cpp.

02281 {
02282     Selected = NewSelected;
02283     
02284     if (NewSelected == NULL)
02285         DocView::SetNoCurrent();
02286     else
02287         NewSelected->SetCurrent();
02288 }

void DocView::SetShowGridState BOOL  ShowGrid  ) 
 

Allow you to change the "show grid" state of a DocView.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/94
Parameters:
ShowGrid - A bool used to set the visible status of grids in the view [INPUTS]
Returns:
-
See also:

Definition at line 4706 of file docview.cpp.

04707 {
04708     ViewFlags.GridShow = ShowGrid;
04709 }

void DocView::SetShowGuidesState BOOL  State  )  [inline]
 

Definition at line 550 of file docview.h.

00550 { ViewFlags.GuidesShow = State; }

void DocView::SetShowPrintBorders BOOL  State  )  [inline]
 

Definition at line 388 of file docview.h.

00388 { ViewFlags.PrintBorderShow = State; }

void DocView::SetSnapToGridState BOOL  SnapToGrid  ) 
 

Allow you to change the "snap to grid" state of a DocView.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/94
Parameters:
SnapToGrid - A bool used to set the snap status of grids in the view [INPUTS]
Returns:
-
See also:

Definition at line 4595 of file docview.cpp.

04596 {
04597     ViewFlags.GridSnap = SnapToGrid;
04598 }

void DocView::SetSnapToGuidesState BOOL  State  )  [inline]
 

Definition at line 547 of file docview.h.

00547 { ViewFlags.GuidesSnap = State; }

void DocView::SetSnapToMagObjectsState BOOL  SnapToMagObjects  ) 
 

Allow you to change the "snap to magnetic objects" state of a DocView.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/9/94
Parameters:
SnapToMagObjects - A bool used to set the snap status of magnetic objects in the view [INPUTS]
Returns:
-
See also:

Definition at line 4669 of file docview.cpp.

04670 {
04671     ViewFlags.MagObjectsSnap = SnapToMagObjects;
04672 }

void DocView::SetSnapToObjectsState BOOL  SnapToObjects  ) 
 

Allow you to change the "snap to all objects" state of a DocView.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/9/94
Parameters:
SnapToObjects - A bool used to set the snap status of all objects in the view [INPUTS]
Returns:
-
See also:

Definition at line 4632 of file docview.cpp.

04633 {
04634     ViewFlags.ObjectsSnap = SnapToObjects;
04635 }

void DocView::SetSolidDragState BOOL  bNewState  )  [inline]
 

Definition at line 333 of file docview.h.

00333 {m_bSolidDrag = bNewState;}

void DocView::SetViewPixelSize  )  [virtual]
 

Sets up the normal and scaled pixel sizes according to this view.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/10/95
See also:
OilCoord::SetPixelSize; DocCoord::SetScaledPixelSize

Implements View.

Definition at line 2149 of file docview.cpp.

02150 {
02151     // Set the scaled pixel size
02152     ScaledPixelWidth = PixelWidth / Scale;
02153     ScaledPixelHeight = PixelHeight / Scale;
02154 }

BOOL DocView::SetViewScale FIXED16  NewScale  )  [virtual]
 

Set the viewing scale factor for this view. (Also, sets up the scaled pixel size in DocCoord if this View is current.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/93
Parameters:
New view scale factor [INPUTS]

Reimplemented from View.

Definition at line 1396 of file docview.cpp.

01397 {
01398     if (!View::SetViewScale(NewScale))
01399         // Error
01400         return FALSE;
01401 
01402     // Tell everyone that a DocView scale has changed.
01403     BROADCAST_TO_ALL(DocViewMsg(this,DocViewMsg::SCALECHANGED));
01404 
01405     return TRUE;
01406 }

void DocView::SetZoomTableIndex INT32  nIndex  ) 
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/5/94
Parameters:
The new index value. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DocView::GetZoomTableIndex

Definition at line 2354 of file docview.cpp.

02355 {
02356     ZoomTableIndex = nIndex;
02357 }

void DocView::ShowViewRulers BOOL  fIsVisible  ) 
 

Pass on Show Hide Rulers Message to CamView.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 5121 of file docview.cpp.

05122 {
05123     pViewWindow->ShowRulers(fIsVisible);
05124 }

void DocView::ShowViewScrollers BOOL  fIsVisible  ) 
 

Pass on Show Hide Scrollers Message to CamView.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 5099 of file docview.cpp.

05100 {
05101     PORTNOTETRACE("other","DocView::ShowViewScrollers - do nothing");
05102 #ifndef EXCLUDE_FROM_XARALX
05103     pViewWindow->ShowScrollers(fIsVisible);
05104 #endif
05105 }

BOOL DocView::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).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/94 (modified 20/9/94)
Parameters:
pSpread = a ptr to a spread node [INPUTS] pDocRect = a rectangle relative to the given spread PrevCoord = Used to determine how rect is snapped CurCoord = As above
Returns:
TRUE - The rect has been snapped to something FALSE - The rect is untouched by man and beast
See also:
All Snap member functions of all classes derived from NodeRenderableBounded.

Definition at line 4325 of file docview.cpp.

04326 {
04327     BOOL Snapped = FALSE;
04328 
04329     if (pCSnap == NULL)
04330         pCSnap = new CSnap(this,pSpread);
04331 
04332     if (pCSnap != NULL)
04333     {
04334         pCSnap->SetSpread(pSpread);
04335         Snapped = pCSnap->Snap(pDocRect,PrevCoord,CurCoord);
04336     }
04337 
04338     return (Snapped);
04339 }

BOOL DocView::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).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/94 (modified 20/9/94)
Parameters:
pSpread = a ptr to a spread node [INPUTS] pDocCoord = a coord relative to the given spread
Returns:
TRUE - The coord has been snapped to something FALSE - The coord is untouched by man and beast
See also:
All Snap member functions of all classes derived from NodeRenderableBounded.

Definition at line 4289 of file docview.cpp.

04292 {
04293     BOOL Snapped = FALSE;
04294 
04295     if (pCSnap == NULL)
04296         pCSnap = new CSnap(this,pSpread);
04297 
04298     if (pCSnap != NULL)
04299     {
04300         pCSnap->SetSpread(pSpread);
04301         Snapped = pCSnap->Snap(pDocCoord,TryMagSnap,TryGridSnap);
04302     }
04303 
04304     return (Snapped);
04305 }

BOOL DocView::SnapCurrent Spread pSpread,
DocRect pDocRect,
const DocCoord PrevCoord,
const DocCoord CurCoord
[static]
 

Calls the Snap(pSpread,pDocRect,PrevCoord,CurCoord) function of the Current DocView.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/94
Parameters:
pSpread = a ptr to a spread node [INPUTS] pDocRect = a rectangle relative to the given spread PrevCoord = Used to determine how rect is snapped CurCoord = As above
Returns:
TRUE - The rect has been snapped to something FALSE - The rect is untouched by man and beast

Errors: Will error in debug builds if there is no Current DocView

See also:
All Snap member functions of all classes derived from NodeRenderableBounded.

Definition at line 4568 of file docview.cpp.

04569 {
04570     ERROR3IF(Current == NULL,"DocView::SnapCurrent called when no Current DocView");
04571 
04572     DocView *pCurrent = GetCurrent();
04573 
04574     if (pCurrent != NULL)
04575         return (pCurrent->Snap(pSpread,pDocRect,PrevCoord,CurCoord));
04576     else
04577         return (FALSE);
04578 }

BOOL DocView::SnapCurrent Spread pSpread,
DocCoord pDocCoord,
BOOL  TryMagSnap = TRUE,
BOOL  TryGridSnap = TRUE
[static]
 

Calls the Snap(pSpread,pDocCoord) function of the Current DocView.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/94
Parameters:
pSpread = a ptr to a spread node [INPUTS] pDocCoord = a coord relative to the given spread
Returns:
TRUE - The coord has been snapped to something FALSE - The coord is untouched by man and beast

Errors: Will error in debug builds if there is no Current DocView

See also:
All Snap member functions of all classes derived from NodeRenderableBounded.

Definition at line 4536 of file docview.cpp.

04539 {
04540     ERROR3IF(Current == NULL,"DocView::SnapCurrent called when no Current DocView");
04541 
04542     DocView *pCurrent = GetCurrent();
04543 
04544     if (pCurrent != NULL)
04545         return (pCurrent->Snap(pSpread,pDocCoord,TryMagSnap,TryGridSnap));
04546     else
04547         return (FALSE);
04548 }

BOOL DocView::SnapSelected Spread pSpread,
DocRect pDocRect,
const DocCoord PrevCoord,
const DocCoord CurCoord
[static]
 

Calls the Snap(pSpread,pDocRect,PrevCoord,CurCoord) function of the selected DocView.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/94
Parameters:
pSpread = a ptr to a spread node [INPUTS] pDocRect = a rectangle relative to the given spread PrevCoord = Used to determine how rect is snapped CurCoord = As above
Returns:
TRUE - The rect has been snapped to something FALSE - The rect is untouched by man and beast

Errors: Will error in debug builds if there is no selected DocView

See also:
All Snap member functions of all classes derived from NodeRenderableBounded.

Definition at line 4508 of file docview.cpp.

04509 {
04510     ERROR3IF(Selected == NULL,"DocView::SnapSelected called when no selected DocView");
04511 
04512     if (Selected != NULL)
04513         return (Selected->Snap(pSpread,pDocRect,PrevCoord,CurCoord));
04514     else
04515         return (FALSE);
04516 }

BOOL DocView::SnapSelected Spread pSpread,
DocCoord pDocCoord,
BOOL  TryMagSnap = TRUE,
BOOL  TryGridSnap = TRUE
[static]
 

Calls the Snap(pSpread,pDocCoord) function of the selected DocView.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/94
Parameters:
pSpread = a ptr to a spread node [INPUTS] pDocCoord = a coord relative to the given spread
Returns:
TRUE - The coord has been snapped to something FALSE - The coord is untouched by man and beast

Errors: Will error in debug builds if there is no selected DocView

See also:
All Snap member functions of all classes derived from NodeRenderableBounded.

Definition at line 4398 of file docview.cpp.

04401 {
04402     ERROR3IF(Selected == NULL,"DocView::SnapSelected called when no selected DocView");
04403 
04404     if (Selected != NULL)
04405         return (Selected->Snap(pSpread,pDocCoord,TryMagSnap,TryGridSnap));
04406     else
04407         return (FALSE);
04408 }

BOOL DocView::SnapToMagneticNode Spread pSpread,
Node pNode,
DocCoord pDocCoord
[static]
 

Calls magnetic snapping functions taking into acount the control flags held in this DocView.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/3/94
Parameters:
pSpread Pointer to spread on which node exists [INPUTS] pNode Pointer to node to test magnetically pDocCoord A coordinate to test magnetically against the node
Returns:
TRUE - The coord has been snapped to something FALSE - The coord is untouched by man and beast

Errors: Will error in debug builds if there is no selected DocView

See also:
All Snap member functions of all classes derived from NodeRenderableBounded.

Definition at line 4428 of file docview.cpp.

04429 {
04430     ERROR3IF(Selected == NULL,"DocView::SnapSelected called when no selected DocView");
04431 
04432     if (Selected != NULL)
04433     {
04434         BOOL Snapped = FALSE;
04435 
04436         if (Selected->pCSnap == NULL)
04437             Selected->pCSnap = new CSnap(Selected,pSpread);
04438 
04439         if (Selected->pCSnap != NULL)
04440         {
04441             Selected->pCSnap->SetSpread(pSpread);
04442             Snapped = Selected->pCSnap->TryToSnapToObject(pNode, pDocCoord);
04443         }
04444 
04445         return (Snapped);
04446     }
04447     else
04448         return (FALSE);
04449 }

BOOL DocView::StartDrag Operation pDragOp,
DragType  type,
DocRect pMoveBBox,
DocCoord StartPos,
BOOL  KeepAccuracy,
BOOL  bSolidDragSupported = FALSE
 

Tells the world that a drag is starting.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/7/93
Parameters:
pDragOp - Pointer to the operation [INPUTS] type - the type of drag to do pMoveBBox - StartPos - KeepAccuracy - TRUE if drag is biased towards accurate following of all mouse movements; FALSE if drag is biased towards keeping up to date with user. bSolidDragSupported
  • FALSE (default) Do EORed outline dragging TRUE Update the tree during dragging
Returns:
TRUE if all went well

Definition at line 3556 of file docview.cpp.

03562 {
03563     // Ignore if system is disabled
03564     if (CCamApp::IsDisabled())
03565         return TRUE;                            // If the system is disabled, ignore
03566 
03567     if (pMoveBBox != NULL)
03568     {
03569         StartDragPos = *StartPos;
03570         if (pMoveBBox->ContainsCoord(StartDragPos))
03571         {
03572         }
03573     }
03574 
03575     // Remember the drag operation (this also serves as a flag to indicate whether we
03576     // are dragging or not).
03577     ERROR3IF(pCurrentDragOp != NULL, "Nested drag in DocView::StartDrag");
03578     ERROR3IF(pDragOp == NULL, "Null DragOp* in DocView::StartDrag?");
03579     pCurrentDragOp = pDragOp;
03580     m_bSolidDragSupported = bSolidDragSupported;
03581     m_bSolidDrag = (m_bSolidDragSupported && DocView::SolidDragging);
03582 
03583     ERROR3IF(pViewWindow==NULL, "ARGH! DocView is not connected to a window in StartDrag!");
03584     return pViewWindow->StartDrag(pDragOp, type, KeepAccuracy);
03585 }

BOOL DocView::ViewStateChanged  )  [virtual]
 

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.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/5/93

Implements View.

Definition at line 1362 of file docview.cpp.

01363 {
01364     // Local variables...
01365     DocCoord    ExtentLo;                       // coord of bottom-left of logical extent
01366     DocCoord    ExtentHi;                       // coord of top-right of logical extent
01367 
01368     DialogBarOp::SetSystemStateChanged();
01369 
01370     // Implementation...
01371     ERROR2IF(this==NULL,FALSE,"DocView member func called on NULL pointer");
01372     ERROR2IF(pDoc==NULL,FALSE,"ViewStateChanged: There MUST be an   owner doc for this view!");
01373     
01374     // Read DocCoords extent of document & set extent in platform-indy ViewState struct.
01375     pDoc->GetExtents(&ExtentLo, &ExtentHi, &PhysExtent, this);
01376     SetExtent(ExtentLo, ExtentHi);              
01377 
01378     // Set extent in platform-indy ViewState struct
01379     ViewFlags.WorkClickCached = FALSE;          
01380     return TRUE;
01381 }


Friends And Related Function Documentation

friend class CCamView [friend]
 

Definition at line 373 of file docview.h.

friend class Document [friend]
 

Definition at line 230 of file docview.h.


Member Data Documentation

BOOL DocView::BackgroundRendering = TRUE [static]
 

Defines whether or not to use background rendering on new views. 0 => No background rendering 1 => Use background rendering.

Preference: BackgroundRendering Section: Rendering Range: 0 or 1

Definition at line 420 of file docview.h.

double DocView::DefaultConstrainAngle = PI / 4.0 [static]
 

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).

Preference: ConstrainAngle Section: Constraints Range: >0 ---> <2PI

Definition at line 561 of file docview.h.

DocCoord DocView::DragPos [private]
 

Definition at line 295 of file docview.h.

UINT32 DocView::IdleDragDelay = 200 [static]
 

Defines delay time in milliseconds between detecting idle state and showing extra dragging info.

Preference: IdleDragDelay Section: Dragging Range: 0 to 10000

Definition at line 422 of file docview.h.

UINT32 DocView::IdleDragDelay2 = 1000 [static]
 

Defines delay time in milliseconds between detecting idle state and showing extra dragging info.

Preference: IdleDragDelay2 Section: Dragging Range: 0 to 10000

Definition at line 423 of file docview.h.

BOOL DocView::IsViewDying [private]
 

Definition at line 257 of file docview.h.

WorkCoord DocView::LastWorkClick [private]
 

Definition at line 293 of file docview.h.

BOOL DocView::m_bBoundsChanged [private]
 

Definition at line 618 of file docview.h.

BOOL DocView::m_bPreventRenderView [private]
 

Definition at line 610 of file docview.h.

BOOL DocView::m_bSolidDragSupported [private]
 

Definition at line 296 of file docview.h.

Cursor DocView::m_PushCursor [private]
 

Definition at line 285 of file docview.h.

DocCoord DocView::OldDragPos [private]
 

Definition at line 292 of file docview.h.

INT32 DocView::OnTopCount = 0 [static, private]
 

Definition at line 439 of file docview.h.

OnTopCode DocView::OnTopReason = Normal [static, private]
 

Definition at line 436 of file docview.h.

RenderRegion * DocView::OnTopRenderRegion = NULL [static, private]
 

Definition at line 438 of file docview.h.

Spread * DocView::OnTopSpread = NULL [static, private]
 

Definition at line 437 of file docview.h.

BOOL DocView::OriginOutlineShowAlways = FALSE [static]
 

Original outlines will be shown as soon as dragged items don't overlap originals.

Preference: OriginOutlineShowAlways Section: Dragging Range: 0 or 1

Definition at line 425 of file docview.h.

BOOL DocView::OriginOutlineShowNonOverlap = FALSE [static]
 

Original outlines will be shown as soon as dragged items don't overlap originals.

Preference: OriginOutlineShowNonOverlap Section: Dragging Range: 0 or 1

Definition at line 424 of file docview.h.

BOOL DocView::OutlineShowBounds = TRUE [static]
 

Dragged outlines will show a bounding rectangle.

Preference: OutlineShowBounds Section: Dragging Range: 0 or 1

Definition at line 427 of file docview.h.

CSnap* DocView::pCSnap [private]
 

Definition at line 553 of file docview.h.

Operation* DocView::pCurrentDragOp [private]
 

Definition at line 294 of file docview.h.

PendingRedraws DocView::PendingRedrawList [private]
 

Definition at line 430 of file docview.h.

INT32 DocView::PrevIndex [private]
 

Definition at line 487 of file docview.h.

WorkCoord DocView::PrevOffset [private]
 

Definition at line 489 of file docview.h.

FIXED16 DocView::PrevScale [private]
 

Definition at line 488 of file docview.h.

RulerPair* DocView::pRulerPair [protected]
 

Definition at line 582 of file docview.h.

INT32 DocView::PushToolCursorID [private]
 

Definition at line 284 of file docview.h.

UINT32 DocView::ScrollToShowMargin = 18000 [static, private]
 

Margins to use (in millipoints) when autoscrolling with a margin.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/6/1996
See Also: ScrollToShowWithMargin

Definition at line 453 of file docview.h.

DocView * DocView::Selected = NULL [static, private]
 

Definition at line 256 of file docview.h.

BOOL DocView::SolidDragging = TRUE [static]
 

Defines whether or not solid dragging is enabled. 0 => Solid dragging disabled 1 => Solid dragging enabled.

Preference: SolidDragging Section: Dragging Range: 0 or 1

Definition at line 421 of file docview.h.

UINT32 DocView::SolidDragTimeLimit = 333 [static]
 

Defines time limit in milliseconds for solid drag redraw. When redraw takes longer than this value, dragging falls back to outline mode.

Preference: SolidDragTimeLimit Section: Dragging Range: 0 to 10000

Definition at line 426 of file docview.h.

DocCoord DocView::StartDragPos [private]
 

Definition at line 291 of file docview.h.

MonotonicTime DocView::StartTime [private]
 

Definition at line 375 of file docview.h.

struct DocView::CCAPI DocView::ViewFlags [private]
 

INT32 DocView::ZoomTableIndex [private]
 

Definition at line 486 of file docview.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:53:50 2007 for Camelot by  doxygen 1.4.4