ScreenView Class Reference

A subclass of CCamView which is the class actually used for screen display. More...

#include <scrvw.h>

Inheritance diagram for ScreenView:

CCamView ScreenCamView List of all members.

Public Member Functions

 ScreenView ()
 Default constructor for a ScreenView window. Sets the pointers to the child windows to null, so that an incomplete construction of the view that is later destroyed won't try to delete invalid pointers. The Windows side of construction is done later, in the OnCreate() message handler.
virtual ~ScreenView ()
 Destroys a ScreenView window. Deletes child windows first. Updates the ScreenView population counter.
void SetViewStateFromThis () const
 Called by a virgin ScreenView, ie. a view onto a new, unedited document. The function reads the attributes of the view window from the operating system, converts them into a device- independent form, and stores them in the ViewState.
void SetThisFromViewState ()
 Move and resize the ScreenView according to the (device-independent) settings of a ViewState object. This typically happens when a new view is opened on a saved document.
virtual BOOL IsScreenView ()
MouseOverRulerHit IsMouseOverRuler ()
 

BOOL IsTopmost () const
 Tests if this ScreenView is the active view, ie. is on top of all other views.
BOOL ShouldEatClick () const
void ClearEatFlag ()
wxDC * GetRenderDC () const
 Allows the kernel to draw on the client area at times other than when processing WM_PAINT messages. Note that the pointer returned is temporary and should NOT be stored away for future use - it may well become invalid on the next idle event.
wxWindow * GetRenderWindow () const
 Allows the kernel to access to the render window, useful on the odd occasion, although it does distort "encapsulation".
virtual void GetClientSize (int *width, int *height) const
 Updates the ViewState object with the view's position, in an OS- independent form. This message is sent by the view's frame window whenever it is moved. Calculates the size of the ScreenView's RendWnd.
void InvalidateView (const OilRect *pRect=0, BOOL updatenow=FALSE)
 Invalidates the appropriate section of the RendWnd client area - if the passed parameter is NULL then the whole client area is invalidated. The rectangle will be redrawn at some time in the (near) future.
virtual void OnDraw (wxDC *pDc)
 Makes sure that the kernel knows which view to render into. Retrieves the clipping rectangle from the CDC. Passes the CDC and the rectangle to DocView::OnDraw(), which does the actual rendering.
virtual BOOL OnPreparePrinting (CPrintInfo *pInfo)
 Current just returns that value of CView::DoPreparePrinting().
BOOL GetScrollerStyle () const
 Tests whether proportional scroll bars are currently in operation.
void SetScrollerStyle (BOOL proportional)
 Allows DocView to change the style - groovy or dull - of ScreenView's scroll bars. Records the setting and calls the appropriate functions of the scroll bar gadgets.
void SetWorkAreaExtent (const WorkRect &area, BOOL redraw=TRUE)
 Provides read-only access to the WorkAreaExtent, as maintained by DocView/ScreenView. Calculates the size of the RendWnd, setting the "page size" of the scroll bars accordingly. Sets the scroll range of the scroll bars to the size of the WorkAreaExtent (note that the Y range is negated and inverted - the mother of all bodges).
void GetScrollOffset (WorkCoord *pOffset) const
 Reads the offset from the horizontal and vertical scroll bars, combining then into a WorkCoord.
void SetScrollOffset (const WorkCoord &pos, BOOL redraw=TRUE)
 Changes the scroll offset in the horizontal and vertical scroll bar. Note that it DOES NOT immediately scroll the client area, which is only done when the scroll bars send back a WM_SCROLLEREVENT message to the ScreenView.
void ShowScrollers (BOOL Show)
 Hide or Show Scrollers.
void ShowRulers (BOOL Show)
 Hide or Show Rulers.
BOOL AreRulersVisible ()
 

BOOL AreScrollersVisible ()
 

void RecaptureMouseOnNextUpdate (void)
 Called by the OLE drag & drop system (CCamDropSource::QueryContinueDrag, winoil.cpp) when dragging a selection - if the mouse pointer goes outside the view, the selection drag is "paused", and an OLE drag is started. If the pointer comes back into our view, we cancel the OLE drag and resume the selector drag - the only thing we need to do to resume is to reclaim the mouse capture (but we must do it on the next idle to ensure that we get & keep the capture, so we flag it here and fix it up in OnTimer, above).
BOOL StartDrag (Operation *pOp, DragType type, BOOL KeepAccuracy)
 Begins a drag operation, from the point of view of the OIL layer. Unbounds the mouse cursor, so it can go off-screen (display driver permitting). Captures all mouse input, to guarantee that the drag being started will terminate properly at some time in the future. Sets some internal variables indicating that ScreenView is in "drag mode". Finally, asks the system for a timer which is used to generate "idle" mouse events.
BOOL EndDrag (Operation *pOp)
 Finishes a drag operation in the OIL layer. Releases mouse capture and restores the previous mouse cursor clipping rectangle (generally the screen). Sets internal variables to indicate that ScreenView is not in "drag mode". Kills the timer set in StartDrag().
BOOL ChangeDragType (DragType Type)
 Allows someone to change the type of a drag (eg have Auto Scrolling on in some situations, but not in others). This function is mostly called from the Kernel (DocView) version of the same function.
void ClearClickState ()
 Clear the current click state so that any logic in progress is stopped before it does anything nasty.
BOOL InvokeDragOp (String_256 *pOpToken, OpParam *pParam, UINT32 Flags, wxPoint point)
 This func provides a mechanism that allows a drag op to be invoked as if it has been started as a result of clicking in the view. This allows drag ops to be invoked that aren't associated to a given tool.
BOOL IsWaitingMouseMove ()
 There are some things in Camelot that are processed as a result of a mouse move message (Magnetic snapping to all the objects in the document for example). If these operations take a long time, there is little point in carrying on with the calculations if the mouse has already moved away from the coord being tested (and hence invalidating the findings of the search). This function checks to see if there is a mouse move message waiting in the queue to be processed, so that the callers can abort any processing they were doing if applicable.
BOOL GetCurrentMousePos (OilCoord *pMousePos) const
 Finds out the current mouse position within this view window.
BOOL CreateDragTarget (DragInformation *DragInfo)
 will create drag targets for appropriate drags
virtual BOOL IsSelected (const CObject *pDocItem) const
 "Tests for a selected OLE client item".
void OnFilePrint ()
void OnFilePrintPreview ()
 Simply makes CView::OnFilePrintPreview() have public scope. Used by the menu system.
DocViewGetDocViewPtr () const
 Used by Will's rendering system - somehow.
BOOL IsSingleClickReallyTriple () const
BOOL IsSingleClickReallyQuad () const

Static Public Member Functions

static BOOL ReadViewPrefs ()
 Tries to load preferences for ScreenView, creating them with default values if they don't exist.
static INT32 HowMany ()
 None immediately springs to mind, although one day - who knows?
static DocViewGetDocViewFromHwnd (wxWindow *hwnd)
 Given a window handle of a ScreenView render window, this function will return a pointer to the kernel DocView object that renders into that window, or NULL if there isn't one.
static DocViewGetDocViewFromWindowID (CWindowID WinID)
static void SetReadyMadeViewState (ViewState *pvs)
 Calls CCamView::Create() to attach a Windows object to the previously constructed C++ object. The view has a standard arrow cursor and a custom icon (_R(IDR_CAMTYPE)). The view is responsible for painting its background itself. The view is initially hidden, until its size and position have been properly set. Call this to set up a view-state object that ScreenView::OnInitialUpdate will use in preference to the one the ScreenView has got already. This is a nasty little "back-door" to changing the creation state of a ScreenView, used by the code that restores docs and views when the app starts. The reason we have to use code like this is that the Camelot doc/view architecture is NOT MFC.
static void SetUseVisibleDefaults (BOOL state)
static BOOL GetUseVisibleDefaults ()
static BOOL GetDefaultRulersState ()
static BOOL GetDefaultScrollersState ()
static void SetDefaultRulersState (BOOL State)
static void SetDefaultScrollersState (BOOL State)
static void GetClickMods (wxMouseEvent &event, ClickModifiers *p)
 Helps convert an OIL-layer mouse event into a form acceptable to the kernel. Sets the fields of the ClickModifier according to which button is down/up, whether the SHIFT, CONTROL, or ALT key is held down etc. Note that as the fields of a ClickModifier are only one bit wide, we must be carefule when assigning the (integer) results of logical tests to them.

Protected Member Functions

virtual CCamCanvas * CreateCanvas (wxView *v, wxMDIChildFrame *frame, const wxPoint &pos, const wxSize &size, long style)
void UpdateViewPosition () const
 Updates the ViewState object shared between this ScreenView and its associated DocView with the new size of the view etc.
virtual void OnInitialUpdate ()
virtual void OnUpdate (wxView *sender, wxObject *hint=(wxObject *) NULL)
 Called when the view must first display the document. Moves this view/frame to the position given in the ViewState object.
virtual void OnActivateView (bool bActivate, wxView *pActiveView, wxView *pDeactiveView)
 Called by MFC when a view gains or loses the input focus, either due to the the user clicking about, or another application popping up a window etc etc. I would just like to point out that this MFC function is the most brain-damaged Microsoft have come up so far. It's documentation bears no resemblance to the way the function is called/used - for example, as far as I can see, the two CView* parameters are NEVER different!
void ScrollTo (const WorkCoord &offset)
 Scroll the client area of the window to the specified position. The offset must be converted to OS coordinates before being passed to Windows. If the new position of the view does not overlap the old position then the client area is completely redrawn. Otherwise, the Windows USER module is called to scroll the window.
void HandleDragEvent (UINT32 Button, wxMouseEvent &event, ClickType t)
 Gathers together Windows information about a mouse event and passes it on to the kernel, by calling DocView::OnClick().
BOOL HandleMouseWheelEvent (wxMouseEvent &event)
void HandleDragScrolling (wxPoint point)
 Checks if the view window needs to be scrolled because the cursor has been dragged outside the window. The window will be scrolled if the current mode is AUTO_SCROLL (and the Scroll Lock key isn't latched!!). The scrolling itself is done by calling the routine in DocView, not ScreenView, so that the kernel has fair warning to remove any blobbies before the blit is done.
void CalcScrollDeltas (wxPoint point, WinRect wrSize, INT32 *dx, INT32 *dy)
 Calculates the scroll deltas due to the current mouse position being outside the allowed rectangle. Helper function.
void HandleButtonUp (UINT32 Button, wxMouseEvent &event)
 Finishes the current drag, if there is one, by elucidating the state of the buttons etc and calling DragDFinished() in the kernel (DocView). Called whenever a mouse button is released.
virtual void HandleOleDragOutOfView (wxPoint point)
 Called when doing a DRAGTYPE_OLESCROLL and the mouse pointer moves outside the view window. The base class does nothing, so dragging continues as normal, but in the derived ScreenCamView class, this is used to cancel the internal XOR drag operation, and start an OLE drag and drop export procedure.
BOOL PrintPaper (wxDC *pPrintDC, CCPrintInfo *pPrintInfo, PrintControl *pPrintControl)
WinRect GetPrintClipRect (wxDC *pPrintDC, CCPrintInfo *pPrintInfo)
void EnumeratePagePatches (CCPrintInfo *pPrintInfo)
void OnSize (wxSizeEvent &event)
 Moved down to ScreenCamView.
void OnLButtonDown (wxMouseEvent &event)
 Called by MFC upon receipt of a left-button-down mouse message. Finds out which other buttons are down (eg. SHIFT) and passes the message on to the kernel. Note that the mouse message will have originally come from the RendWnd object, a child window of ScreenView.
void OnLButtonDblClk (wxMouseEvent &event)
 Passes a left-button double-click to ScreenView::HandleDragEvent().
void OnLButtonUp (wxMouseEvent &event)
 Passes the event on to HandleButtonUp().
void OnMButtonDown (wxMouseEvent &event)
 Called by MFC upon receipt of a middle-button-down mouse message. Finds out which other buttons are down (eg. SHIFT) and passes the message on to the kernel. Note that the mouse message will have originally come from the RendWnd object, a child window of ScreenView.
void OnMButtonDblClk (wxMouseEvent &event)
 Passes a middle-button double-click to ScreenView::HandleDragEvent().
void OnMButtonUp (wxMouseEvent &event)
 Passes the event on to HandleButtonUp().
void OnRButtonDown (wxMouseEvent &event)
 Same as for ScreenView::OnLButtonDown(), but for the right mouse button.
void OnRButtonDblClk (wxMouseEvent &event)
 Same as ScreenView::OnLButtonDblClk(), bit for the right button.
void OnRButtonUp (wxMouseEvent &event)
 Same as ScreenView::OnLButtonUp(), but for the right mouse button.
void OnMouseMove (wxMouseEvent &event)
 Packages up OIL-layer mouse-move messages before passing them on to DocView::DragPointerMove(). If ScreenView is not in "drag mode" the event is passed to our DocView, which will forward it to the current tool. Otherwise, checks if a CLICKTYPE_DRAG message has been sent to the kernel, sending one if it hasn't (this smooths the difference between Windows and RISC OS, the former system providing little support for drag operations).
void OnMouseWheel (wxMouseEvent &event)
 Scope: Protected.
afx_msg void OnDropFiles (HDROP hDropInfo)
 Respond to files being dropped onto the view window. It sets up the current document and docview, and passes control on to the OpDroppedFile operation.
afx_msg INT32 OnMouseActivate (wxWindow *pDesktopWnd, UINT32 nHitTest, UINT32 nMessage)
afx_msg void OnTimer (UINT32 nIDEvent)
 Called when a key is pressed, so we can do something with it. It is currently only used to adjust the Pretend Pen Pressure. THIS CODE HAS BEEN COMMENTED OUT UNTIL THE NEW KEYBOARD SYSTEM IS FULLY OPERATIONAL!! Sends DragPointerIdle "events" to the kernel, when dragging. As Windows doesn't support such "idle" messages, the OIL drag system sets up a timer when a drag starts, and sends idle messages every time the timer elapses, until the drag is finished.
afx_msg void OnCancelMode ()
 Called by the system whenever this window loses the focus to a dialogue box etc. Checks if the window is in drag mode, if it is makes sure that the drag is tidily cancelled, eg. the mouse is uncaptured and its clipping area restored. Calls DocView::DragFinished() (WITH JUNK PARAMETERS FOR THE MOUSE POSITION/BUTTONS) to indicate that the drag has been cancelled.
afx_msg void OnInsertObject ()
 "Creates an embedded OLE object with a type-name retrieved from the user" - currently unimplemented.
afx_msg void OnPaint ()
 Handles WM_PAINT messages for the ScreenView window. As the window is entirely covered by child windows, which know how to paint themselves, this function simply validates its (invisible) client area, removing the paint message. No drawing of any kind is done.
afx_msg BOOL OnSetCursor (wxWindow *pWnd, UINT32 nHitTest, UINT32 nMessage)
 Calls the kernel DocView object to set the cursor for this ScreenView. Scope: Protected.
afx_msg LRESULT OnScrollerEvent (WPARAM wp, LPARAM lp)
 This message is sent by the scroll bars in response to an earlier call to ScreenView::SetScrollOffset(). The scroll offset is read from the scroll bars and the ScrollPosition field of the ViewState is updated accordingly. If the WPARAM parameter is TRUE then the client area is repainted via a call to ScreenView::ScrollTo().
afx_msg LRESULT OnRenderView (WPARAM wp, LPARAM lp)
 Responds to a WM_PAINT message sent to the RendWnd window object. Effectively tricks MFC into painting the RendWnd as if it was a CView window, not a child of a CView - calls CView::OnPrepareDC() and ScreenView::OnDraw().
afx_msg LRESULT OnFrameMove (WPARAM x, LPARAM y)
afx_msg void OnVScroll (UINT32 nSBCode, UINT32 nPos, CScrollBar *pScrollBar)
 The framework calls this member function when the user clicks a window's vertical scroll bar.
afx_msg void OnHScroll (UINT32 nSBCode, UINT32 nPos, CScrollBar *pScrollBar)
 The framework calls this member function when the user clicks a window's horizontal scroll bar.

Protected Attributes

BOOL fSetupDone
bool fInitialUpdate
BOOL fJustCreated
CWinScrollerHScrollBar
CWinScrollerVScrollBar
CScrollerCornerCorner
OILHorizontalRulerHRuler
OILVerticalRulerVRuler
OriginGadgetOGadget
WinRect CurrentSize
WorkRect WorkArea
WorkCoord OldOffset
BOOL ScrollerStyle
BOOL DragKeepAccuracy
BOOL AutoScrollExcludeRulers
ClickType LastClickType
UINT32 LastClickButton
wxPoint LastClickPoint
wxPoint CurrentMousePos
ClickModifiers LastClickMods
UINT32 FirstClickButton
OperationpCurrentDragOp
DragType CurrentDragType
WinRect MouseClipRect
BOOL OLERecaptureMouse
MonotonicTime m_OLELastOutTime
String_256 DragOpToken
OpParampDragOpParam
BOOL DragOpInvoke
MonotonicTime TimeOfLastClick
wxPoint LastDoubleClickPos
BOOL ThisSingleIsTriple
BOOL ThisDoubleIsQuad

Static Protected Attributes

static INT32 PopCount
static ViewStatepReadyMadeViewState
static BOOL UnzoomOnNewView = FALSE
static BOOL ZoomSingleView = TRUE
static BOOL PropScrollersOn = TRUE
static BOOL DefaultScrollersState = TRUE
static BOOL DefaultRulersState = FALSE
static BOOL UseVisibleDefaults = TRUE
static INT32 DragLatency = 3
 This function is called whenever the joystick moves. It is used currently to set the Pretend Pen Pressure from the joystick position. This function only exists under Win32.
static INT32 DragDelay = 500
static MonotonicTime DragTimer

Classes

class  ScreenCanvas

Detailed Description

A subclass of CCamView which is the class actually used for screen display.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/01/95
See also:
CCamView; PrintCamView

Definition at line 162 of file scrvw.h.


Constructor & Destructor Documentation

ScreenView::ScreenView  ) 
 

Default constructor for a ScreenView window. Sets the pointers to the child windows to null, so that an incomplete construction of the view that is later destroyed won't try to delete invalid pointers. The Windows side of construction is done later, in the OnCreate() message handler.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
Updates the ScreenView population counter. Called from somewhere deep inside MFC.
Returns:
Errors: - Scope: Protected.
See also:
ScreenView::OnCreate(); ScreenView::~ScreenView()

Definition at line 299 of file scrvw.cpp.

00300 {
00301 //  TRACEUSER( "Richard", _T("ScreenView::ScreenView()\n"));
00302 
00303     // No child windows or connections yet.
00304 //  RenderWindow = NULL;
00305     HScrollBar = NULL;
00306     VScrollBar = NULL;
00307 
00308 PORTNOTE("other","Removed CScrollerCorner usage")
00309 #ifndef EXCLUDE_FROM_XARALX
00310     Corner = NULL;
00311 #endif
00312 
00313 // WEBSTER - markn 15/1/97
00314 // No rulers in Webster
00315 #ifndef WEBSTER
00316     HRuler = NULL;
00317     VRuler = NULL;
00318     OGadget= NULL;
00319 #endif // WEBSTER
00320 
00321 
00322     // Set/clear these internal flags.
00323     fSetupDone = FALSE;
00324     fInitialUpdate = false;
00325 
00326     // Not dragging or scrolling either.
00327     ScrollerStyle = TRUE;
00328     pCurrentDragOp = NULL;
00329 
00330     OLERecaptureMouse = FALSE;
00331 
00332     // Set up click event variables
00333     LastClickType = CLICKTYPE_NONE;
00334     LastClickButton = 0;
00335     LastClickPoint.x = 0;
00336     LastClickPoint.y = 0;
00337     CurrentMousePos.x = 0;
00338     CurrentMousePos.y = 0;
00339     FirstClickButton = 0;
00340     DragKeepAccuracy = TRUE;
00341     AutoScrollExcludeRulers = FALSE;
00342     
00343     // Bump the population.
00344     PopCount++;
00345 
00346     // Vars used by InvokeDragOp() mechanism
00347     DragOpToken = "";
00348     pDragOpParam = NULL;
00349     DragOpInvoke = FALSE;
00350 
00351     // Triple and quad click support
00352     LastDoubleClickPos = wxPoint( 0, 0 );
00353     ThisSingleIsTriple = FALSE;
00354     ThisDoubleIsQuad = FALSE;
00355 
00356     // Set this flag until we have been through OnActivateView once, after which we can
00357     // include this view in the eat-activating-click system.
00358     fJustCreated = TRUE;
00359 }

ScreenView::~ScreenView  )  [virtual]
 

Destroys a ScreenView window. Deletes child windows first. Updates the ScreenView population counter.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Public

See also:
ScreenView::ScreenView()

Definition at line 379 of file scrvw.cpp.

00380 {
00381     TRACEUSER( "Richard", _T("ScreenView::~ScreenView()\n"));
00382     // Deregister for WM_DROPFILES messages
00383     // VC2 Beta 1 asserts with a zero handle here so we check
00384 PORTNOTE("other","Removed DragAcceptFiles usage")
00385 #ifndef EXCLUDE_FROM_XARALX
00386     if (m_hWnd) DragAcceptFiles(TRUE);
00387 #endif
00388 
00389 //  delete RenderWindow;    GetCanvas()?
00390 PORTNOTE("other","Removed CWinScroller usage")
00391 #ifndef EXCLUDE_FROM_XARALX
00392     delete HScrollBar;
00393     delete VScrollBar;
00394 #endif
00395 PORTNOTE("other","Removed CScrollerCorner usage")
00396 #ifndef EXCLUDE_FROM_XARALX
00397     delete Corner;
00398 #endif
00399 
00400 // WEBSTER - markn 15/1/97
00401 // No rulers in Webster
00402 #ifndef WEBSTER
00403 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00404     delete HRuler;
00405     delete VRuler;
00406     delete OGadget;
00407 #endif
00408 #endif // WEBSTER
00409 
00410     PopCount--;         // one less ScreenView in the world, sigh
00411 }


Member Function Documentation

BOOL ScreenView::AreRulersVisible  ) 
 

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Ruler Visible state.

Errors: - Scope: Public

Reimplemented from CCamView.

Definition at line 557 of file scrvw.cpp.

00558 {
00559 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00560     if(Status)
00561         return Status->RulersVisible;
00562 #endif
00563     return FALSE;       
00564 };

BOOL ScreenView::AreScrollersVisible  ) 
 

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Scroller Visible state.

Errors: - Scope: Public

Reimplemented from CCamView.

Definition at line 580 of file scrvw.cpp.

00581 { 
00582     if(Status)
00583         return Status->ScrollersVisible;
00584     return FALSE;       
00585 }

void ScreenView::CalcScrollDeltas wxPoint  point,
WinRect  wrSize,
INT32 *  dx,
INT32 *  dy
[protected]
 

Calculates the scroll deltas due to the current mouse position being outside the allowed rectangle. Helper function.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> (from Justin)
Date:
22/9/96
Parameters:
point The current position of the mouse cursor. [INPUTS] wrSize The rectangle controlling scrolling.
dx The amount to scroll in the X axis. [OUTPUTS] dy The amount to scroll in the Y axis.
Returns:
-

Errors: - Scope: Protected

See also:
ScreenView::HandleDragScrolling

Reimplemented from CCamView.

Definition at line 3298 of file scrvw.cpp.

03299 {
03300     if( point.x < wrSize.GetLeft() )
03301         *dx = point.x - wrSize.GetLeft();
03302     else
03303     if( point.x >= wrSize.GetRight() )
03304         *dx = point.x - wrSize.GetRight();
03305     else
03306         *dx = 0;
03307 
03308     if( point.y < wrSize.GetTop() )
03309         *dy = point.y - wrSize.GetTop();
03310     else
03311     if( point.y >= wrSize.GetBottom() )
03312         *dy = point.y - wrSize.GetBottom();
03313     else
03314         *dy = 0;
03315 }

BOOL ScreenView::ChangeDragType DragType  Type  ) 
 

Allows someone to change the type of a drag (eg have Auto Scrolling on in some situations, but not in others). This function is mostly called from the Kernel (DocView) version of the same function.

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
See also:
DocView::ChangeDragType

Reimplemented from CCamView.

Definition at line 2982 of file scrvw.cpp.

02983 {
02984     // Change the current drag type
02985     CurrentDragType = Type;
02986     m_OLELastOutTime.Sample();
02987     OLERecaptureMouse = FALSE;
02988 
02989     return TRUE;
02990 }

void ScreenView::ClearClickState  ) 
 

Clear the current click state so that any logic in progress is stopped before it does anything nasty.

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

Reimplemented from CCamView.

Definition at line 4169 of file scrvw.cpp.

04170 {
04171     LastClickType = CLICKTYPE_NONE;
04172     if( GetParentFrame()->HasCapture() )
04173     {
04174         GetParentFrame()->ReleaseMouse();
04175     }
04176 }

void ScreenView::ClearEatFlag  ) 
 

virtual CCamCanvas* ScreenView::CreateCanvas wxView *  v,
wxMDIChildFrame *  frame,
const wxPoint &  pos,
const wxSize &  size,
long  style
[inline, protected, virtual]
 

Reimplemented in ScreenCamView.

Definition at line 197 of file scrvw.h.

00198                                        : Correct */ long style )
00199     {
00200         return new ScreenCanvas( v, frame, pos, size, style );
00201     }

BOOL ScreenView::CreateDragTarget DragInformation DragInfo  ) 
 

will create drag targets for appropriate drags

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/95
Parameters:
DragInfo : details about the current drag [INPUTS]
- [OUTPUTS]
Returns:
Errors: -

Reimplemented from CCamView.

Definition at line 650 of file scrvw.cpp.

00651 {
00652 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00653     // TEMPORARY - only create drag targets for the selected (frontmost/input-focus)
00654     // DocView. This stops us allowing colour drags to go into the wrong document
00655     // if the user ctrl-tabs to a different window during the drag.
00656     // Ideally, drags will be allowed, but the colour will be copied to the destination
00657     // document before being applied, but currently we don't have time to implement all that
00658     if (pDocView != DocView::GetSelected())
00659         return FALSE;
00660 
00661     if (DragInfo->CanDropOnPage())
00662     {
00663         // If the drag can be dropped onto an object or the page, then we will accept it
00664         ViewDragTarget * NewTarget;
00665         NewTarget = new ViewDragTarget(RenderWindow->m_hWnd,NULL,DragInfo);
00666         return TRUE;
00667     }
00668 #endif
00669 
00670     return FALSE;
00671 }

BOOL ScreenView::EndDrag Operation pOp  ) 
 

Finishes a drag operation in the OIL layer. Releases mouse capture and restores the previous mouse cursor clipping rectangle (generally the screen). Sets internal variables to indicate that ScreenView is not in "drag mode". Kills the timer set in StartDrag().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
A pointer to the current drag operation (currently not used). [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the drag is successfully terminated.

Errors: ASSERTion failure if ScreenView was not already in "drag mode". Scope: Public

See also:
ScreenView::StartDrag(); ScreenView::HandleDragEvent()

Reimplemented from CCamView.

Definition at line 2930 of file scrvw.cpp.

02931 {
02932 /*
02933 #ifdef  _DEBUG
02934     // Prevent a very nasty recursive ENSURE!
02935     if (!CCamApp::IsDisabled())
02936     {
02937         ENSURE(pCurrentDragOp != 0, "ScreenView::EndDrag: pCurrentDragOp is zero");
02938     }
02939 #endif  // _DEBUG
02940 */
02941     // Restore the previous mouse clipping rectangle.  Windows will move the
02942     // mouse, if necessary, so that the mouse is within the new clipping
02943     // rectangle (or so the documentation says!)
02944     //::ClipCursor(&MouseClipRect);
02945     pCurrentDragOp = 0;
02946     FirstClickButton = 0;
02947     DragKeepAccuracy = TRUE;
02948 if (m_pCanvas && m_pCanvas->GetCapture() == m_pCanvas)
02949     m_pCanvas->ReleaseMouse();
02950 
02951     // Check status of temporary tool selection - this is because we don't change tool
02952     // mid-drag! (e.g. user holds down Alt to get selector, starts drag, releases Alt,
02953     // then ends drag - we want to restore the original tool).
02954     Tool::EndDrag();
02955 
02956     // Kill the timer started in HandleDragEvent().
02957 PORTNOTE("other","Removed FixKillTimer usage")
02958 #ifndef EXCLUDE_FROM_XARALX
02959     return ::FixKillTimer(m_hWnd, 1);
02960 #else
02961     return TRUE;
02962 #endif
02963 }

void ScreenView::EnumeratePagePatches CCPrintInfo pPrintInfo  )  [protected]
 

Reimplemented from CCamView.

void ScreenView::GetClickMods wxMouseEvent &  event,
ClickModifiers p
[static]
 

Helps convert an OIL-layer mouse event into a form acceptable to the kernel. Sets the fields of the ClickModifier according to which button is down/up, whether the SHIFT, CONTROL, or ALT key is held down etc. Note that as the fields of a ClickModifier are only one bit wide, we must be carefule when assigning the (integer) results of logical tests to them.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
The mouse event passed by wx to a mouse message-handler function. [INPUTS]
Changes the ClickModifier to reflect the button flags. [OUTPUTS]
Returns:
-

Errors: - Scope: Public

See also:
ScreenView::HandleDragEvent()

Reimplemented from CCamView.

Definition at line 2259 of file scrvw.cpp.

02260 {
02261     *p = ClickModifiers::GetClickModifiers(event);
02262 }

void ScreenView::GetClientSize int *  pWidth,
int *  pHeight
const [virtual]
 

Updates the ViewState object with the view's position, in an OS- independent form. This message is sent by the view's frame window whenever it is moved. Calculates the size of the ScreenView's RendWnd.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
The width and height of the client area which the kernel can render into. [OUTPUTS]
Returns:
-

Errors: - Scope: Public

See also:
class CRendWnd

Reimplemented from CCamView.

Definition at line 1429 of file scrvw.cpp.

01429                                                                            : Correct */
01430 {
01431 //  OilRect r = CurrentSize.ToOil(pDocView);
01432 //  *pWidth = r.Width();
01433 //  *pHeight = r.Height();
01434     WinRect wrect(0,0,0,0);
01435     GetCanvas()->GetClientSize(&wrect.width,&wrect.height);
01436     OilRect orect = wrect.ToOil(pDocView);
01437     *pWidth  = orect.Width();
01438     *pHeight = orect.Height();
01439 }

BOOL ScreenView::GetCurrentMousePos OilCoord pMousePos  )  const
 

Finds out the current mouse position within this view window.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/10/94
Parameters:
- [INPUTS]
pMousePos the mouse position within this view, in OIL coordinates [OUTPUTS]
Returns:
TRUE if the mouse is within this view, and hence that *pMousePos holds its position; FALSE if the mouse is outside the view (in which case pMousePos is unchanged).

Errors: -

See also:
-

Reimplemented from CCamView.

Definition at line 3731 of file scrvw.cpp.

03732 {
03733     // Get the Windows screen coordinates of the mouse cursor.
03734     // Convert from screen to window coordinates.
03735     WinCoord pt;
03736     *(wxPoint *)&pt = GetCanvas()->ScreenToClient( ::wxGetMousePosition() );
03737 
03738     // If the mouse is outside the view then we can do nothing more.
03739     if (!CurrentSize.Inside(pt)) return FALSE;
03740 
03741     // Convert to OIL coordinates.
03742     if (pMousePos!=NULL)
03743         *pMousePos = pt.ToOil(pDocView, TRUE);
03744 
03745     // We stored something useful.
03746     return TRUE;
03747 }

static BOOL ScreenView::GetDefaultRulersState  )  [inline, static]
 

Reimplemented from CCamView.

Definition at line 324 of file scrvw.h.

00324 { return DefaultRulersState;};

static BOOL ScreenView::GetDefaultScrollersState  )  [inline, static]
 

Reimplemented from CCamView.

Definition at line 325 of file scrvw.h.

00325 { return DefaultScrollersState;};

DocView * ScreenView::GetDocViewFromHwnd wxWindow *  hwnd  )  [static]
 

Given a window handle of a ScreenView render window, this function will return a pointer to the kernel DocView object that renders into that window, or NULL if there isn't one.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/7/94
Parameters:
The handle of the render window to find. [INPUTS]
- [OUTPUTS]
Returns:
A pointer to the DocView associated with a render window, or NULL if there isn't one.

Errors: -

See also:
-

Definition at line 691 of file scrvw.cpp.

00692 {
00693     PORTNOTETRACE("other","ScreenView::GetDocViewFromHwnd - do nothing");
00694 #ifndef EXCLUDE_FROM_XARALX
00695     // For all kernel documents in existence . . .
00696     List* pDocList = &(GetApplication()->Documents);
00697     for (Document* pKernelDoc = (Document*) pDocList->GetHead();
00698          pKernelDoc != NULL;
00699          pKernelDoc = (Document*) pDocList->GetNext(pKernelDoc))
00700     {
00701     
00702         if(pKernelDoc->IsARalphDoc())
00703         {
00704             // a bit unpleasent - only works because Ralph Docs have only one view..
00705             // get the first (and only) docview
00706             DocView * pDocView = pKernelDoc->GetFirstDocView();
00707             // check handles
00708             if(pDocView)
00709                 if( pDocView->GetRenderWindow() == hwnd )
00710                     return pDocView;
00711         }
00712         else
00713         {
00714 
00715              // Convert from a kernel document to an OIL document.
00716             CCamDoc* pCamDoc = pKernelDoc->GetOilDoc();
00717 
00718             // For all views onto the OIL document . . .
00719             POSITION pos = pCamDoc->GetFirstViewPosition();
00720             while (pos != NULL)
00721             {
00722                 // Compare the handle of the view's render window to the given handle,
00723                 // returning the associated DocView if they match.
00724                 ScreenView* pCamView = (ScreenView*) pCamDoc->GetNextView(pos);
00725 
00726                 // Not interested unless it is a ScreenView (it could be a print preview view)
00727                 if (pCamView->IsKindOf(RUNTIME_CLASS(ScreenView)))
00728                 {
00729                     if (pCamView->RenderWindow->m_hWnd == hwnd)
00730                     {
00731                         return pCamView->pDocView;
00732                     }
00733                 }
00734             }
00735         }
00736     } 
00737 #endif
00738     // Couldn't find the handle, so return nothing.
00739     return NULL;
00740 }   

DocView * ScreenView::GetDocViewFromWindowID CWindowID  WinID  )  [static]
 

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/1/95
Parameters:
Window ID [INPUTS]
Returns:
A pointer to the DocView associated with the window ID, else NULL Also See: GetDocViewFromHwnd()

Reimplemented from CCamView.

Definition at line 753 of file scrvw.cpp.

00754 {
00755     return GetDocViewFromHwnd( (wxWindow *)WinID );
00756 }

DocView * ScreenView::GetDocViewPtr  )  const
 

Used by Will's rendering system - somehow.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A pointer to the DocView object associated with this CCamView.

Errors: - Scope: Public

See also:
Will's stuff.

Reimplemented from CCamView.

Definition at line 4224 of file scrvw.cpp.

04225 {
04226     return pDocView;
04227 }

WinRect ScreenView::GetPrintClipRect wxDC *  pPrintDC,
CCPrintInfo pPrintInfo
[protected]
 

Reimplemented from CCamView.

wxDC * ScreenView::GetRenderDC  )  const [virtual]
 

Allows the kernel to draw on the client area at times other than when processing WM_PAINT messages. Note that the pointer returned is temporary and should NOT be stored away for future use - it may well become invalid on the next idle event.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
2nd Sept 1993
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A pointer to the CDC object associated with the RenderWindow.

Errors: Returns NULL if the DC could not be obtained. Scope: Public

See also:
ScreenView::OnDraw()

Reimplemented from CCamView.

Definition at line 1795 of file scrvw.cpp.

01796 {
01797 //
01798 // GAT: Warning - I don't think we want to be using this function anymore.
01799 // Create a DC when required.
01800 //
01801     PORTNOTETRACE("other","ScreenView::GetRenderDC - do nothing");
01802 #ifndef EXCLUDE_FROM_XARALX
01803     return GetCanvas()->GetDC();
01804 #else
01805     return NULL;
01806 #endif
01807 }

wxWindow * ScreenView::GetRenderWindow  )  const
 

Allows the kernel to access to the render window, useful on the odd occasion, although it does distort "encapsulation".

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15th October 1993
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A pointer to the RenderWindow child of this ScreenView

Errors: - Scope: Public

See also:
ScreenView::GetRenderDC()

Reimplemented from CCamView.

Definition at line 1827 of file scrvw.cpp.

01828 {
01829     return GetCanvas();
01830 }

BOOL ScreenView::GetScrollerStyle  )  const
 

Tests whether proportional scroll bars are currently in operation.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if this ScreenView is currently sporting proportional scroll bars, FALSE if it isn't, and its scroll bars look like typical naff Windows ones.

Errors: - Scope: Public

See also:
ScreenView::SetScrollerStyle; CScroller::SetProportional()

Definition at line 1934 of file scrvw.cpp.

01935 {
01936     return ScrollerStyle;
01937 }

void ScreenView::GetScrollOffset WorkCoord pOffset  )  const
 

Reads the offset from the horizontal and vertical scroll bars, combining then into a WorkCoord.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
The current scroll offset is written to the passed WorkCoord. [OUTPUTS]
Returns:
-

Errors: - Scope: Public

See also:
ScreenView::SetScrollOffset(); CScroller::GetScrollPos()

Reimplemented from CCamView.

Definition at line 2049 of file scrvw.cpp.

02050 {   
02051     FIXED16 PixelWidth,PixelHeight;
02052     pDocView->GetPixelSize(&PixelWidth,&PixelHeight);
02053 
02054 //  TRACE( _T("SV::GetScrollOffset\n"));
02055 //  TRACE( _T("CanvasPos = (%d, %d)\n"), GetCanvas()->GetScrollPos(wxHORIZONTAL), GetCanvas()->GetScrollPos(wxVERTICAL));
02056 
02057     pOffset->x = XLONG(WorkArea.lo.x+GetCanvas()->GetScrollPos(wxHORIZONTAL)*PixelWidth .MakeDouble());
02058     pOffset->y = XLONG(WorkArea.hi.y-GetCanvas()->GetScrollPos(wxVERTICAL  )*PixelHeight.MakeDouble());
02059 
02060 //  TRACE( _T("ScrollOffset = (%d, %d)\n"), (INT32)(pOffset->x), (INT32)(pOffset->y));
02061 }

static BOOL ScreenView::GetUseVisibleDefaults  )  [inline, static]
 

Reimplemented from CCamView.

Definition at line 323 of file scrvw.h.

00323 { return UseVisibleDefaults;};

void ScreenView::HandleButtonUp UINT32  Button,
wxMouseEvent &  event
[protected]
 

Finishes the current drag, if there is one, by elucidating the state of the buttons etc and calling DragDFinished() in the kernel (DocView). Called whenever a mouse button is released.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
9th Sept 1993
Parameters:
Button - which mouse button has been released. [INPUTS] nFlags - The mouse button flags. point - the coordinate of the mouse cursor.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Private

See also:
ScreenView::GetClickMods(); ScreenView::OnLButtonDown(); ScreenView::OnRButtonDown() DocView::OnClick()

Reimplemented from CCamView.

Definition at line 2614 of file scrvw.cpp.

02615 {
02616     //Graham 18/6/96: Changed the logical conditions of this function
02617     //to support clicks with one mouse button while another button is
02618     //dragging
02619     
02620     if (DocView::GetSelected() != pDocView)
02621     {
02622         ENSURE(pCurrentDragOp == NULL, "Drag operation in a view that isn't 'selected' !!");
02623 //      TRACEUSER( "JustinF", _T("Ignored button-up cos not in the selected view\n"));
02624         return;
02625     }
02626 
02627     // Set Current states...
02628     SetCurrentStates();
02629 
02630     //Graham: Here's the change - in the logical conditions only. The actual
02631     //functions called are the same.
02632 
02633     WinCoord            point;
02634     event.GetPosition( &point.x, &point.y );
02635 
02636     //Was the button that went up the first one that went down?
02637     if (Button==FirstClickButton)
02638     {
02639         //Yes it was.
02640         //Is there a drag currently running?
02641         if (pCurrentDragOp != NULL)
02642         {
02643             // Yes there is.
02644             // Release the capture and terminate the drag.  Note that we try to release
02645             // the mouse capture as soon as possible after a drag has finished, in case the
02646             // DragFinished method below brings up a dialog box or something.
02647 if (m_pCanvas && m_pCanvas->GetCapture()==m_pCanvas)
02648             m_pCanvas->ReleaseMouse();
02649             pDocView->DragFinished(pCurrentDragOp, ((WinCoord*) &point)->ToOil(pDocView, TRUE), 
02650                                LastClickMods, TRUE);
02651 
02652 
02653             // Now cater for the special case that the user used the PushCentreTool Click Modifier
02654             // and they didn't move the mouse - this means they either wanted to Centre the
02655             // view about the cursor, ZoomIn() or ZoomOut() depending on the modifiers....
02656             if ((LastClickPoint == CurrentMousePos) && LastClickMods.PushCentreTool)
02657             {
02658                 // Did we want to ZoomIn()?
02659                 if( event.ControlDown() )
02660                 {
02661                     OpZoom* pZoomOp = new OpZoom;
02662                     ERROR3IF(!pZoomOp,"Couldn't create pZoomOp");
02663 
02664                     // Find the mid-point of the view, in work coordinates...
02665                     WorkRect wrView = pDocView->GetViewRect();
02666                     WorkCoord wcMidView((wrView.lo.x + wrView.hi.x) / 2, (wrView.lo.y + wrView.hi.y) / 2);
02667 
02668                     pZoomOp->ZoomIn(wcMidView);
02669                 }
02670                 // Did we want to ZoomOut()?
02671                 else if( event.ShiftDown() )
02672                 {
02673                     OpZoom* pZoomOp = new OpZoom;
02674                     ERROR3IF(!pZoomOp,"Couldn't create pZoomOp");
02675 
02676                     // Find the mid-point of the view, in work coordinates...
02677                     WorkRect wrView = pDocView->GetViewRect();
02678                     WorkCoord wcMidView((wrView.lo.x + wrView.hi.x) / 2, (wrView.lo.y + wrView.hi.y) / 2);
02679 
02680                     pZoomOp->ZoomOut(wcMidView);
02681                 }
02682                 else
02683                 {
02684                     // Then we must have wanted to centre the screen about the cursor...
02685 
02686                     DocCoord MousePos;
02687                     Spread *pSpread = Document::GetSelectedSpread();
02688                     if(!DocView::GetCurrentMousePos(&pSpread, &MousePos))
02689                     {
02690                         return;
02691                     }
02692 
02693 
02694                     WorkCoord testwork(MousePos.ToWork(pSpread, pDocView));
02695 
02696 
02697                     // Find out where the middle of the current view is...
02698                     DocRect ViewRect = (pDocView->GetDocViewRect(pSpread)).ToSpread(pSpread, pDocView);
02699                     DocCoord ViewMidPoint(0,0);
02700                     ViewMidPoint.x = INT32(ViewRect.lo.x + (ViewRect.hi.x - ViewRect.lo.x)/2.0);
02701                     ViewMidPoint.y = INT32(ViewRect.lo.y - (ViewRect.lo.y - ViewRect.hi.y)/2.0);
02702 
02703                     // Work out what the offset between the centre of the screen and the MousePos is...
02704                     DocCoord Offset = MousePos - ViewMidPoint;
02705 
02706                     WorkCoord ScrollOffset;
02707                     WorkCoord WorkOffset;
02708 
02709                     WorkOffset.x = (XLONG) (MakeXLong(Offset.x) * pDocView->GetViewScale());
02710                     WorkOffset.y = (XLONG) (MakeXLong(Offset.y) * pDocView->GetViewScale());
02711 
02712                     ScrollOffset = pDocView->GetScrollOffsets();
02713                     ScrollOffset.x = ScrollOffset.x + WorkOffset.x;
02714                     ScrollOffset.y = ScrollOffset.y + WorkOffset.y;
02715 
02716                     if (ScrollOffset.x < (XLONG) 0) ScrollOffset.x = (XLONG) 0;
02717                     if (ScrollOffset.y > (XLONG) 0) ScrollOffset.y = (XLONG) 0;
02718 
02719                     // Scroll the screen to centre about the cursor!
02720                     pDocView->SetScrollOffsets(ScrollOffset, TRUE);
02721                 }
02722             }
02723         }
02724         else
02725         {
02726             // No there isn't.
02727             // Kill the timer started in HandleDragEvent(), 
02728             // as we don't want to wait for a drag anymore.
02729 PORTNOTE("other","Removed FixKillTimer usage")
02730 #ifndef EXCLUDE_FROM_XARALX
02731             ::FixKillTimer(m_hWnd, 1);
02732 #endif
02733             FirstClickButton = 0;
02734 
02735             //Then pass the Up-Click message to ScreenView::OnClick
02736             pDocView->OnClick(((WinCoord*) &point)->ToOil(pDocView, TRUE), CLICKTYPE_UP, LastClickMods);
02737         }
02738     }
02739     else
02740     {
02741         //No, the button that went up was not the first one to go down.
02742         //In that case, we expect the first button that went down is still down and
02743         //hence there is a drag running.
02744         //Is there a drag running?
02745         if (pCurrentDragOp != NULL)
02746         {
02747             //Yes, as expected.
02748             //Pass the Up-Click message to ScreenView::OnClick
02749             pDocView->OnClick(((WinCoord*) &point)->ToOil(pDocView, TRUE), CLICKTYPE_UP, LastClickMods);
02750         }
02751         //If not, something odd has happened - perhaps the user has clicked fast
02752         //with the mouse. This need not worry us but we should not do anything
02753         //with the up-click message.
02754         //The only problem that could occur is if we are in a button-up-drag. This
02755         //is handled below.
02756         
02757     }
02758 
02759     //Ensure there is not a button-up drag in progress
02760     //That is, there is a drag in progress AND no buttons down
02761 //  ERROR3IF((Operation::GetCurrentDragOp()==NULL)&&(nFlags & ~(MK_SHIFT | MK_CONTROL) == 0),
02762 //      "ScreenView::HandleButtonUp - drag operation in progress but no buttons down");
02763 }

void ScreenView::HandleDragEvent UINT32  Button,
wxMouseEvent &  event,
ClickType  t
[protected]
 

Gathers together Windows information about a mouse event and passes it on to the kernel, by calling DocView::OnClick().

Technical notes (by Tim):

The Button is parameter is necessary, because sometimes when we get the *first* button down event, nFlags has more than one mouse button bit set. This only happens when you rampantly click buttons very quickly but nevertheless we *do* need to know which button was pressed, otherwise we never release the drag event and we end up with button-up-drag city.

I assume this is due to some latency in Windows, e.g., it gets a button down event, and while preparing it goes and reads the mouse button state and meanwhile another button has been pressed so we get a button down event with nFlags indicating more than one button is down.

Definition at line 2304 of file scrvw.cpp.

02305 {
02306     if (DocView::GetSelected() != pDocView)
02307     {
02308 //      TRACEUSER( "JustinF", _T("Ignored drag-event cos not in the selected view\n"));
02309         // If selected doc is null, let's select it anyway.
02310         if (DocView::GetSelected() == NULL)
02311         {
02312             // We're in a weird state that should never happen but does - a document
02313             // has the focus, but isn't selected
02314             Document* pKDoc =NULL;
02315             if(pDocView)
02316                 pKDoc = pDocView->GetDoc();
02317 
02318             if (pKDoc)
02319             {
02320                 Document::SetSelectedViewAndSpread(pKDoc, pDocView, NULL);
02321             }
02322             
02323         }
02324         return; 
02325     }
02326 
02327     SetCurrentStates();
02328 
02329     // Find out which buttons etc are down.
02330     GetClickMods(event, &LastClickMods);
02331 
02332     // If it's the first single click, then reset the drag delay timer, and ask for a 
02333     // Windows timer.
02334     if (((t == CLICKTYPE_SINGLE) || (t == CLICKTYPE_DOUBLE)) && 
02335         (FirstClickButton == 0))
02336     {
02337         // Remember this event.
02338         LastClickPoint = event.GetPosition();
02339         LastClickType = t;
02340         LastClickButton = Button;
02341         FirstClickButton = Button;
02342         DragTimer.Sample();
02343 
02344 #if (_OLE_VER >= 0x200)
02345         // The user's doing something so don't update any container docs
02346         CCamDoc::ResetContainerUpdateTimer();
02347 #endif
02348 
02349 PORTNOTE("other","Removed FixSetTimer usage")
02350 #ifndef EXCLUDE_FROM_XARALX
02351         // Ask the system for a timer.  Fails (returns FALSE) if there isn't one available.
02352         // The timer is used to generate DragPointerIdle events, which are not directly
02353         // supported by Windows.
02354         UINT32 rate;
02355         ::SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &rate, 0);
02356         if (!::FixSetTimer(m_hWnd, 1, rate, 0))
02357         {
02358             ENSURE(FALSE, "Cannot get a timer in ScreenView::StartDrag()!\n");
02359         }
02360 #endif
02361     }
02362 
02363     if (DragOpInvoke)
02364     {
02365         OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(DragOpToken);
02366 
02367         ERROR3IF_PF(pOpDesc == NULL,("FindOpDescriptor(%s) failed",(TCHAR*)DragOpToken));
02368 
02369         if (pOpDesc != NULL)
02370             pOpDesc->Invoke(pDragOpParam);
02371 
02372         // Reset the vars ready for the next call to InvokeDragOp()
02373         DragOpInvoke = FALSE;
02374         pDragOpParam = NULL;
02375     }
02376     else
02377     {
02378         // Convert the click position to OIL coordinates before passing to the kernel.
02379         //  pDocView->SetCurrent();
02380         WinCoord        point;
02381         event.GetPosition( &point.x, &point.y );
02382         pDocView->OnClick( ( (WinCoord *)&point )->ToOil(pDocView, TRUE), t, LastClickMods);
02383     }
02384 }                                                             

void ScreenView::HandleDragScrolling wxPoint  point  )  [protected]
 

Checks if the view window needs to be scrolled because the cursor has been dragged outside the window. The window will be scrolled if the current mode is AUTO_SCROLL (and the Scroll Lock key isn't latched!!). The scrolling itself is done by calling the routine in DocView, not ScreenView, so that the kernel has fair warning to remove any blobbies before the blit is done.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
20th Sept 1993
Parameters:
The current position of the mouse cursor. [INPUTS]
- [OUTPUTS]
Returns:
-
Called when ScreenView receives mouse-move messages and timer ("mouse-idle") messages. Also handles DEFERRED_SCROLLING.
Returns:
Errors: - Scope: Private
See also:
ScreenView::OnMouseMove; ScreenView::OnTimer

Reimplemented from CCamView.

Definition at line 3114 of file scrvw.cpp.

03115 {
03116     // Get the size of the view.  We may have to deflate the rectangle a little here, if the
03117     // bottom-right edges of the view coincide with the bottom-right edges of the screen,
03118     // otherwise it is not possible to auto-scroll to the right or down as the mouse never
03119     // leaves the view window.
03120     WinRect wrSize = CurrentSize;
03121     point = GetCanvas()->ClientToScreen( point );
03122     point = GetFrame()->ScreenToClient( point );
03123     
03124 // WEBSTER - markn 15/1/97
03125 // No rulers in Webster
03126 #ifndef WEBSTER
03127 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
03128     // This is used to allow guidelines to be deleted by dropping on to the rulers - normally
03129     // we would start to auto scroll at this point which is a little off putting..
03130     if (AutoScrollExcludeRulers && CurrentDragType != DRAGTYPE_OLESCROLL)
03131     {
03132         UINT32 RulerWidth = OILRuler::GetWidth();
03133         wrSize.left -= RulerWidth;
03134         wrSize.top -= RulerWidth;   
03135     }
03136 #endif
03137 #endif // WEBSTER
03138 
03139 PORTNOTE("other","Removed special handling for Zoomed and FullScreen")
03140 #ifndef EXCLUDE_FROM_XARALX
03141     CCamFrame* pMainWnd = GetMainFrame();
03142     if (pMainWnd != NULL && (pMainWnd->InFullScreenMode() || pMainWnd->IsZoomed()) &&
03143         CurrentDragType != DRAGTYPE_OLESCROLL)
03144     {
03145 //      TRACEUSER( "JustinF", _T("Deflating bounds for special auto-scroll handling\n"));
03146         //const INT32 nMargin = (IsWin32c()) ? 4 : 8;
03147         const INT32 nMargin = (CCamApp::IsNewWindowsUI()) ? 4 : 8;
03148         wrSize.Inflate(-nMargin, -nMargin);
03149     }
03150 #endif
03151 
03152     // Initialise Deltas...
03153     INT32 dx = 0;
03154     INT32 dy = 0;
03155 
03156     // Depending on the type of the drag...
03157     switch (CurrentDragType)
03158     {
03159     //-------------------------
03160     case DRAGTYPE_NOSCROLL:
03161         break;
03162 
03163     //-------------------------
03164     case DRAGTYPE_AUTOSCROLL:
03165         {
03166             // Has the mouse moved outside there bounds?
03167             if (!wrSize.IsEmpty() && !wrSize.Inside(point))
03168             {
03169                 // The mouse is outside the view, and we have to scroll the view
03170                 // proportionate to how far outside it is.
03171                 CalcScrollDeltas(point,wrSize,&dx,&dy);
03172             }
03173             break;
03174         }
03175 
03176     //-------------------------
03177     case DRAGTYPE_OLESCROLL:
03178         {
03179 PORTNOTE("other","Disable DRAGTYPE_OLESCROLL")
03180 #ifndef EXCLUDE_FROM_XARALX
03181             WinRect Outer = wrSize;
03182 
03183             // Set auto-scroll region to be one scrollbar width within the current
03184             // view (as per The Windows Interface Guidelines Chapter 5).
03185             INT32 ScrollbarSize = VScrollBar->GetScrollerSize();
03186             wrSize.Inflate(-ScrollbarSize,-ScrollbarSize);
03187 
03188             if (!wrSize.IsEmpty() && !Outer.IsEmpty()
03189                 && !wrSize.Inside(point)        // Outside allowed scroll rectangle
03190                 )
03191             {
03192                 if (Outer.Inside(point))        // and still inside visible window
03193                 {
03194                     // If we've been in the OLE scroll region for long enough
03195                     if (m_OLELastOutTime.Elapsed(100))
03196                     {
03197                         // NOTE: According to Windows Interface Guidelines Chapter 5 we should
03198                         // Test the "speed" of the mouse here but because we have already
03199                         // checked that the mouse has been in the region for longer than 100
03200                         // milliseconds it doesn't seem neccessary. (To be within the region
03201                         // for longer than 100 milliseconds is sort of a speed test anyway!)
03202 
03203                         // The mouse is in the scroll region, and we have to scroll the view
03204                         // proportionate to how far into the region it is.
03205                         CalcScrollDeltas(point,wrSize,&dx,&dy);
03206                     }
03207                 }
03208                 else
03209                 {
03210                     // We've dragged beyond the OLE scroll area, so we can now convert the drag
03211                     // into an OLE export drag if we so desire.
03212                     HandleOleDragOutOfView(point);
03213                 }
03214             }
03215             else
03216             {
03217                 // We're not in the OLE scroll region so reset the timer
03218                 m_OLELastOutTime.Sample();
03219             }
03220 #endif
03221             break;
03222         }
03223 
03224     //-------------------------
03225     case DRAGTYPE_DEFERSCROLL:
03226         {
03227             // If the mouse is within the window, and we are performing deferred-scrolling
03228             // then we can change over to auto-scrolling.
03229             if (!wrSize.IsEmpty() && wrSize.Inside(point))
03230             {
03231                 CurrentDragType = DRAGTYPE_AUTOSCROLL;
03232                 AutoScrollExcludeRulers = TRUE;
03233             }
03234             break;
03235         }
03236 
03237     default:
03238         ERROR3("Shouldn't ever get here!");
03239         break;
03240     }
03241 
03242     //------------------------------------
03243     // Now do the scroll if necessary...
03244     // If dx<>0 or dy<>0 and scroll lock is disabled
03245 
03246     // Test if the SCROLL LOCK key has been set.
03247     if( !wxGetKeyState( CAMKEY(SCROLL) ) && !(dx==0 && dy==0))
03248     {
03249         // Set Current states...
03250         SetCurrentStates();
03251 
03252         // Convert these pixel values into a WorkCoord offset, add to the
03253         // scroll position and update the scroll bars etc.  Note that the
03254         // y offset is subtracted as the y-axis is reversed compared to
03255         // Windows . . .
03256         WorkCoord offset;
03257         GetScrollOffset(&offset);
03258         FIXED16 PixelWidth, PixelHeight;
03259         pDocView->GetPixelSize(&PixelWidth, &PixelHeight);
03260         offset.x += dx * PixelWidth;
03261         offset.y -= dy * PixelHeight;
03262             
03263         WorkRect wrScrollRect = GetMaxScrollRect();
03264         if (offset.x < wrScrollRect.lo.x)   offset.x = wrScrollRect.lo.x;
03265         if (offset.y < wrScrollRect.lo.y)   offset.y = wrScrollRect.lo.y;
03266         if (offset.x > wrScrollRect.hi.x)   offset.x = wrScrollRect.hi.x;
03267         if (offset.y > wrScrollRect.hi.y)   offset.y = wrScrollRect.hi.y;
03268 
03269         // By calling DocView to do the scroll we give it a chance to remove
03270         // any blobbies it might have put on the screen.  Note that the scrollers
03271         // will prevent any overscroll.
03272         pDocView->SetScrollOffsets(offset, TRUE);
03273     }
03274 }

BOOL ScreenView::HandleMouseWheelEvent wxMouseEvent &  event  )  [protected]
 

Reimplemented from CCamView.

Definition at line 2399 of file scrvw.cpp.

02400 {
02401     // Reasons Why This Is Done As It Is...
02402     // ************************************
02403     //
02404     // The WM_MOUSEWHEEL message is only ever sent to the window with focus. Galleries
02405     // never have the focus, even though they show they have (their windows are highlighted)
02406     // as this is done using rendering onto a blank window (as is their grey-ing out)
02407     // As a result of this, a Gallery is never sent a WM_MOUSEWHEEL message.
02408     // We therefore need to trap the message (here is as good a place as any) and check if the
02409     // user was actually over a gallery...
02410     // Finding out if they are over a Gallery SHOULD have been quite easy (eg WindowFromPoint())
02411     // EXCEPT that we don't create the Galleries in any sensible manner, thus they aren't
02412     // children of the current window - they are children of the Program Manager - sensible...
02413     // So, when we ask for the appropriate HWND it returns a nonsense value... Anyhow, the
02414     // following code gets around this and gives us the real HWND of the Gallery underneath the
02415     // mouse, OR returns NULL if no bar was found.
02416     // In the case where we get the Gallery HWND, we dispatch a message to scroll up/down according
02417     // to mousewheel delta. In the case where we have no HWND we check if the mouse lies within the
02418     // currently selected view and if it does, then scroll appropriately.
02419     // If anyone can see an easier way, then let me know!!!
02420     // Matt 1/11/00
02421 
02422     PORTNOTETRACE("other","ScreenView::HandleMouseWheelEvent - do nothing");
02423 #ifndef EXCLUDE_FROM_XARALX
02424     // We need to know if the mouse pointer is over a Gallery, and if it is what the
02425     // HWND of that Gallery is, so that I can send it a scroll message...
02426     HWND OverBar = GetMainFrame()->IsScreenPointInBar(pt);
02427 
02428     if (OverBar)
02429     {
02430         if (zDelta < 0)
02431         {
02432             BROADCAST_TO_CLASS(DialogMsg(OverBar, DIM_MOUSEWHEEL_DOWN, 256), DialogOp);
02433         }
02434         else
02435         {
02436             BROADCAST_TO_CLASS(DialogMsg(OverBar, DIM_MOUSEWHEEL_UP, 256), DialogOp);
02437         }
02438     }
02439     else
02440     {
02441         //Preliminary Checks...
02442         if (DocView::GetSelected() != pDocView)
02443         {
02444             // If selected doc is null, let's select it anyway.
02445             if (DocView::GetSelected() == NULL)
02446             {
02447                 // We're in a weird state that should never happen but does - a document
02448                 // has the focus, but isn't selected
02449                 Document* pKDoc =NULL;
02450                 if(pDocView)
02451                 {
02452                     pKDoc = pDocView->GetDoc();
02453                 }
02454 
02455                 if (pKDoc)
02456                 {
02457                     Document::SetSelectedViewAndSpread(pKDoc, pDocView, NULL);
02458                 }
02459             
02460             }
02461             return FALSE;   
02462         }
02463 
02464         SetCurrentStates();
02465 
02466         // We now need to work out if the Mouse is currently over part of the document - if it isn't
02467         // then we should ignore the message and let something else handle it...
02468         Spread* pSpread = Document::GetSelectedSpread();
02469         if (pSpread == NULL)    {   return FALSE;   }
02470 
02471         DocCoord MousePos;
02472         if(!DocView::GetCurrentMousePos(&pSpread, &MousePos))
02473         {
02474             return FALSE;
02475         }
02476 
02477 
02478 #if (_OLE_VER >= 0x200)
02479         // The user's doing something so don't update any container docs
02480         CCamDoc::ResetContainerUpdateTimer();
02481 #endif
02482 
02483         //If the user is holding down CTRL whilst scrolling the wheel, then we should do the standard zoom-in/out
02484         if (nFlags & MK_CONTROL)
02485         {
02486 //          TRACEUSER( "Matt", _T("MouseWheel + CTRL = Zoom, in ScreenView\n"));
02487 
02488             // Try to create an instance of the zoom operation.
02489             OpZoom* pZoomOp = new OpZoom;
02490             if (pZoomOp == NULL)
02491             {
02492                 // We ran out of memory, so sorry.
02493                 InformError(_R(IDE_NOMORE_MEMORY));
02494                 return FALSE;
02495             }
02496 
02497             DocCoord DocMouse = MousePos.ToDoc(pSpread, pDocView);
02498             WorkCoord WorkMouse;
02499             WorkMouse = DocMouse.ToWork(pSpread, pDocView);
02500 
02501 
02502             // Get the current view's scaling factor as a rounded precentage.
02503             INT32 nOldScalePercent = ((pDocView->GetViewScale() * 100) + FIXED16_DBL(0.5)).MakeInt();
02504 
02505 
02506             // Zoom in or out around the mouse position...
02507             if (zDelta > 0)
02508             {
02509                 // Search backwards until we find a higher zoom, or the end of the table
02510                 for (INT32 i = cZoomTableSize - 1; i >= 0; i--)
02511                 {
02512                     // Found a higher zoom?  If so, set it, remember it's position and return.
02513                     if (nOldScalePercent < pZoomOp->GetPresetZoomPercent(i))
02514                     {
02515                         // Do the zoom.  We will (optionally) end the operation.
02516                         pDocView->SetZoomTableIndex(i);
02517 //                      pZoomOp->ZoomAtPoint(WorkMouse, pZoomOp->GetPresetZoomScale(i), FALSE);
02518                         pZoomOp->MouseWheelZoomAtPoint(WorkMouse, pZoomOp->GetPresetZoomScale(i), FALSE);
02519                         break;
02520                     }
02521                 }
02522 
02523 //              pZoomOp->ZoomIn(WorkMouse);
02524             }
02525             else
02526             {
02527                 // Search forwards through the zoom table until we find a lower zoom factor
02528                 for (INT32 i = 0; i < cZoomTableSize; i++)
02529                 {
02530                     // Found a lower zoom?  If so, set it, remember it's position in the zoom table
02531                     if (nOldScalePercent > pZoomOp->GetPresetZoomPercent(i))
02532                     {
02533                         // Do the zoom.  We will (optionally) end the operation.
02534                         pDocView->SetZoomTableIndex(i);
02535 //                      pZoomOp->ZoomAtPoint(WorkMouse, pZoomOp->GetPresetZoomScale(i), FALSE);
02536                         pZoomOp->MouseWheelZoomAtPoint(WorkMouse, pZoomOp->GetPresetZoomScale(i), FALSE);
02537                         break;
02538                     }
02539                 }
02540 
02541 //              pZoomOp->ZoomOut(WorkMouse);
02542             }
02543 
02544             // Tidy away...
02545             delete pZoomOp;
02546 
02547             return TRUE;
02548         }
02549         else
02550         {
02551             // The CTRL key was not pressed, so we should simply (is anything simple around here)
02552             // scroll the viewport up/down. (OR left/right if SHIFT is held down - Matt 16/11/2000)
02553     //      TRACEUSER( "Matt", _T("MouseWheel = Scroll, in ScreenView\n"));
02554 
02555             if (nFlags & MK_SHIFT)
02556             {
02557                 // If HScrollBar doesn't exist at this point then something's not quite right...
02558                 if(!HScrollBar) {   return FALSE;   }
02559 
02560                 // Get the current Horizontal Scroll Position, increment it by a zoom-dependent amount
02561                 // and set the Horizontal Scroll Position to be this value, flagging it to redraw...
02562                 XLONG horizpos;
02563                 HScrollBar->GetScrollPos(&horizpos);
02564                 horizpos -= (XLONG)((zDelta/120) * 750 * 15);
02565                 HScrollBar->SetScrollPos(horizpos, true);
02566             }
02567             else
02568             {
02569                 // If VScrollBar doesn't exist at this point then something's not quite right...
02570                 if(!VScrollBar) {   return FALSE;   }
02571 
02572                 // Get the current Vertical Scroll Position, increment it by a zoom-dependent amount
02573                 // and set the Vertical Scroll Position to be this value, flagging it to redraw...
02574                 XLONG vertpos;
02575                 VScrollBar->GetScrollPos(&vertpos);
02576                 vertpos -= (XLONG)((zDelta/120) * 750 * 15);
02577                 VScrollBar->SetScrollPos(vertpos, true);
02578             }
02579 
02580             // NOTE : If we wanted to be really flash, we could make the scroll distance affected by the
02581             // user's settings in the Control Panel - ie, default is to scroll 3 lines on 120 zDelta, but
02582             // can be adjusted so we could look at that value...
02583         }
02584         // tell everyone we've changed the screen
02585         BROADCAST_TO_ALL(ScreenChangeMsg());
02586     }
02587 #endif
02588     // If we get to here, then we must have handled the MouseWheel, so return true...
02589     return TRUE;
02590 }

void ScreenView::HandleOleDragOutOfView wxPoint  point  )  [protected, virtual]
 

Called when doing a DRAGTYPE_OLESCROLL and the mouse pointer moves outside the view window. The base class does nothing, so dragging continues as normal, but in the derived ScreenCamView class, this is used to cancel the internal XOR drag operation, and start an OLE drag and drop export procedure.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/9/96
Notes: May cancel the current Drag Op

Scope: Protected

See also:
ScreenCamView::HandleOleDragOutOfView

Definition at line 3339 of file scrvw.cpp.

03340 {
03341     // The base class does nothing - this should keep Ralph happy
03342 }

INT32 ScreenView::HowMany  )  [static]
 

None immediately springs to mind, although one day - who knows?

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The number of ScreenViews existing at the moment.

Errors: - Scope: Public

See also:
ScreenView::ScreenView(); ScreenView::~ScreenView();

Definition at line 536 of file scrvw.cpp.

00537 {
00538     return PopCount;
00539 }

void ScreenView::InvalidateView const OilRect pRect = 0,
BOOL  updatenow = FALSE
 

Invalidates the appropriate section of the RendWnd client area - if the passed parameter is NULL then the whole client area is invalidated. The rectangle will be redrawn at some time in the (near) future.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
A pointer to the client area rectangle, an OilRect, which is to be [INPUTS] invalidated (marked as needing to be redrawn). This parameter may be omitted. If the first parameter is present, an optional second parameter may be specified, which if TRUE tells Windows to immediately send a WM_PAINT message to the view, which will force an instant redraw of any invalid areas (normally Windows waits until all other messages have been processed before sending the WM_PAINT message).
- [OUTPUTS]
Returns:
-

Errors: - Scope: Public

See also:
class CRendWnd; ScreenView::OnDraw()

Reimplemented from CCamView.

Definition at line 1466 of file scrvw.cpp.

01467 {
01468     if (pRect != NULL)
01469     {
01470         // Convert passed rectangle to an MFC-derived type and invalidate it.  Add an extra
01471         // pixel to the right and bottom edges of the rectangle to ensure that the whole
01472         // rectangle, after scaling and rounding, is invalidated.
01473         WinRect r = pRect->ToWin( pDocView );
01474         r.width++;
01475         r.height++;     
01476         GetCanvas()->Refresh( true, &r );
01477     }
01478     else
01479     {
01480         // We are completely redrawing the client area, so it is possible that the
01481         // "cached" previous scroll offsets, contained in OldOffset, will become
01482         // incorrect.
01483         GetCanvas()->Refresh( true );
01484         GetScrollOffset(&OldOffset);
01485     }
01486     
01487     if (updatenow) GetCanvas()->Update();
01488 }

BOOL ScreenView::InvokeDragOp String_256 pOpToken,
OpParam pParam,
UINT32  Flags,
wxPoint  point
 

This func provides a mechanism that allows a drag op to be invoked as if it has been started as a result of clicking in the view. This allows drag ops to be invoked that aren't associated to a given tool.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/9/95
Parameters:
OpToken = Op token of op to invoke [INPUTS] pParam = ptr to a param block that's passed to the op NOTE! Object at *pParam must have a long life time. I.e. do NOT call this func with ptr to a local OpParam var Flags = flags that specify which modifiers were down during the click point = screen coord of the start of the drag
- [OUTPUTS]
Returns:
Returns TRUE if successful. Returns FALSE if not
This allows a drag op to be started directly, instead of being a result of a tool handling the click. This allows you to write drag ops in the usual way.

If pParam is NULL, the op's Do() function will be called. If pParam != NULL, the op's DoWithParam(pParam) func will be called. Either way, Operation::StartDrag() should be called as a result.

It was introduced to allow the rulers to create guidelines undoably, no matter what tool you are in. See winoil.cpp & kernel.cpp & OpGuideLine

Returns:
Errors: - Scope: -
See also:
-

Reimplemented from CCamView.

Definition at line 2851 of file scrvw.cpp.

02852 {
02853     PORTNOTETRACE("other","ScreenView::InvokeDragOp - do nothing");
02854 #ifndef EXCLUDE_FROM_XARALX
02855     DragOpToken  = *pOpToken;
02856     pDragOpParam = pParam;
02857     DragOpInvoke = TRUE;
02858 
02859     PostMessage(WM_LBUTTONDOWN,Flags,point.x | (point.y << 16));
02860 #endif
02861     return TRUE;
02862 }

MouseOverRulerHit ScreenView::IsMouseOverRuler  ) 
 

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/10/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
enum MouseOverRulerHit can be OVER_NO_RULERS, OVER_HORIZONTAL, OVER_VERTICAL, OVER_ORIGIN_GADGET.

Errors: - Scope: Public

Reimplemented from CCamView.

Definition at line 605 of file scrvw.cpp.

00606 { 
00607 // WEBSTER - markn 15/1/97
00608 // No rulers in Webster
00609 #ifndef WEBSTER
00610 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00611     // check that we have some rulers
00612     if(!HRuler||!VRuler||!OGadget)
00613         return OVER_NO_RULERS;
00614     // get the mouse position in screen coords
00615     wxPoint ScrMousePos;
00616     ::GetCursorPos(&ScrMousePos);
00617 
00618     // get the HWND under the mouse
00619     HWND ThisControl = ::WindowFromPoint(ScrMousePos);
00620     
00621     // check the HWND against the rulers
00622     if(ThisControl == HRuler->GetSafeHwnd())
00623         return OVER_HORIZONTAL;
00624     else    if(ThisControl == VRuler->GetSafeHwnd())
00625         return OVER_VERTICAL;
00626     else    if(ThisControl == OGadget->GetSafeHwnd())
00627         return OVER_ORIGIN_GADGET;
00628         
00629     
00630 #endif
00631 #endif // WEBSTER
00632     return OVER_NO_RULERS;      
00633  };

virtual BOOL ScreenView::IsScreenView  )  [inline, virtual]
 

Definition at line 223 of file scrvw.h.

00223 { return TRUE; }

BOOL ScreenView::IsSelected const CObject *  pDocItem  )  const [virtual]
 

"Tests for a selected OLE client item".

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
A constant pointer to a CObject which is a candidate for some [INPUTS] OLE action.
- [OUTPUTS]
Returns:
TRUE if the parameter is selected in this view.

Errors: - Scope: Public

See also:
ScreenView::OnInsertObject()

Definition at line 4252 of file scrvw.cpp.

04253 {
04254     // TODO: implement this function that tests for a selected OLE client item
04255 
04256 #if (_OLE_VER >= 0x200)
04257     // This implementation is adequate if your selection only consists of CCamCntrItems.
04258     // To handle different selection mechanisms, this implementation should be changed.
04259     return pDocItem == m_pSelection;
04260 #else
04261     return FALSE;
04262 #endif
04263 }

BOOL ScreenView::IsSingleClickReallyQuad  )  const [inline]
 

Reimplemented from CCamView.

Definition at line 450 of file scrvw.h.

00450 {return ThisDoubleIsQuad;}

BOOL ScreenView::IsSingleClickReallyTriple  )  const [inline]
 

Reimplemented from CCamView.

Definition at line 449 of file scrvw.h.

00449 {return ThisSingleIsTriple;}

BOOL ScreenView::IsTopmost  )  const
 

Tests if this ScreenView is the active view, ie. is on top of all other views.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/11/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if this view is the active view.

Errors: -

See also:
-

Reimplemented from CCamView.

Definition at line 1249 of file scrvw.cpp.

01250 {
01251     PORTNOTETRACE("other","ScreenView::IsTopmost - do nothing");
01252 #ifndef EXCLUDE_FROM_XARALX
01253     // always true for ralph
01254 #ifdef RALPH
01255        return TRUE;
01256 #else
01257        return ( (wxView *)this ) == GetParentFrame()->GetActiveView();
01258 #endif
01259 #else
01260     return TRUE;
01261 #endif
01262 }

BOOL ScreenView::IsWaitingMouseMove  ) 
 

There are some things in Camelot that are processed as a result of a mouse move message (Magnetic snapping to all the objects in the document for example). If these operations take a long time, there is little point in carrying on with the calculations if the mouse has already moved away from the coord being tested (and hence invalidating the findings of the search). This function checks to see if there is a mouse move message waiting in the queue to be processed, so that the callers can abort any processing they were doing if applicable.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/11/94
Returns:
TRUE if there is a mouse move message waiting to be processed

Reimplemented from CCamView.

Definition at line 3013 of file scrvw.cpp.

03014 {
03015 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
03016     MSG Msg;
03017     // if there is a current drag all messages will be routed to the drag capture
03018     // capture window so there's no point in looking in this queue  
03019     if(DragManagerOp::GetCurrentManager()==NULL)
03020     {
03021         while (PeekMessage(&Msg,m_hWnd, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_NOREMOVE))
03022         {
03023             // Check that this message is meant for this CamView OR it's RenderWindow child
03024             // window because the OS sometimes leaves the RenderWindow handle in the MouseMove
03025             // message (that window was the first to receive the message)
03026             if (m_hWnd==Msg.hwnd || Msg.hwnd==GetCanvas()->m_hWnd)
03027             {
03028                 // There is a mouse move message in the queue.
03029                 // Have to cast to INT8 so we get correct sign-extension.
03030                 wxPoint Point;
03031                 Point.x = (INT8) LOWORD(Msg.lParam);
03032                 Point.y = (INT8) HIWORD(Msg.lParam);
03033 
03034                 // See if this mouse move message is different from the last one
03035                 if (Point!=CurrentMousePos)
03036                     return TRUE;
03037 
03038                 // Sadly, it was the same as the last one
03039                 // so remove it from the queue as this should not happen
03040                 PeekMessage(&Msg, m_hWnd, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE);
03041             }
03042             else
03043             {
03044                 // Peek message bug. Gave me a message for someone elses window
03045                 // Have to return something, so we will assume that there was not
03046                 // a message in the queue.
03047                 return FALSE;
03048             }
03049         }
03050     } 
03051     else   // there is a current drag
03052     {
03053         if(DragManagerOp::GetDragCaptureWnd()!=NULL){
03054             while (PeekMessage(&Msg,DragManagerOp::GetDragCaptureWnd()->m_hWnd,WM_MOUSEMOVE, WM_MOUSEMOVE, PM_NOREMOVE))
03055             {
03056                 // Check that this message is meant for this CamView OR it's RenderWindow child
03057                 // window because the OS sometimes leaves the RenderWindow handle in the MouseMove
03058                 // message (that window was the first to receive the message)
03059                 if (Msg.hwnd==DragManagerOp::GetDragCaptureWnd()->m_hWnd)
03060                 {
03061                     // There is a mouse move message in the queue.
03062                     // Have to cast to INT8 so we get correct sign-extension.
03063                     wxPoint Point;
03064                     Point.x = (INT8) LOWORD(Msg.lParam);
03065                     Point.y = (INT8) HIWORD(Msg.lParam);
03066 
03067                     // See if this mouse move message is different from the last one
03068                     if (Point!=CurrentMousePos)
03069                         return TRUE;
03070 
03071                     // Sadly, it was the same as the last one
03072                     // so remove it from the queue as this should not happen
03073                     PeekMessage(&Msg, m_hWnd, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE);
03074                 }
03075                 else
03076                 {
03077                     // Peek message bug. Gave me a message for someone elses window
03078                     // Have to return something, so we will assume that there was not
03079                     // a message in the queue.
03080                     return FALSE;
03081                 }
03082             }
03083         }
03084     }
03085 #endif
03086     // there were no mouse move messages in the queue
03087     return FALSE;
03088 }

void ScreenView::OnActivateView bool  bActivate,
wxView *  pActiveView,
wxView *  pDeactiveView
[protected, virtual]
 

Called by MFC when a view gains or loses the input focus, either due to the the user clicking about, or another application popping up a window etc etc. I would just like to point out that this MFC function is the most brain-damaged Microsoft have come up so far. It's documentation bears no resemblance to the way the function is called/used - for example, as far as I can see, the two CView* parameters are NEVER different!

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
A boolean which if TRUE means that this view is being activated, if FALSE [INPUTS] that this view is being deactivated; two pointers to the CView objects which are being activated/deactivated.
Possibly changes the pointed-to views. [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
Pretty unique, this one, so I can't think of anything to put here.

Reimplemented from CCamView.

Definition at line 1201 of file scrvw.cpp.

01202 {
01203     if ( !pDocView )
01204     {
01205         TRACE( _T("ScreenView::OnActivateView - Warning: pDocView uninitialised\n") );
01206         return;
01207     }
01208 
01209     if (bActivate) SetCurrentStates();
01210 
01211     Document* KernelDoc = NULL; 
01212     if (pDocView) KernelDoc = pDocView->GetDoc();
01213 
01214     // MFC does some hidden stuff here . . .
01215     CCamView::OnActivateView( bActivate, pActiveView, pDeactiveView );
01216 
01217     // Trigger off some messages into the kernel.
01218     if (bActivate)
01219     {
01220         // make sure the global preference reflects the current state
01221         SetDefaultRulersState(Status->RulersVisible);
01222         SetDefaultScrollersState(Status->ScrollersVisible);
01223         
01224         // Update our records of who is top-most and set the keyboard input focus to
01225         // the rendering child window.
01226         GetCanvas()->SetFocus();
01227 
01228         // Inform the kernel that the view's Z-order has changed. This sets the selected
01229         // View, Document, and spread, to legal values.
01230         Document::SetSelectedViewAndSpread(KernelDoc, pDocView, NULL);
01231     }
01232 }

void ScreenView::OnCancelMode  )  [protected]
 

Called by the system whenever this window loses the focus to a dialogue box etc. Checks if the window is in drag mode, if it is makes sure that the drag is tidily cancelled, eg. the mouse is uncaptured and its clipping area restored. Calls DocView::DragFinished() (WITH JUNK PARAMETERS FOR THE MOUSE POSITION/BUTTONS) to indicate that the drag has been cancelled.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
22nd Sept 1993
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
DocView::DragFinished(); ScreenView::EndDrag()

Definition at line 3940 of file scrvw.cpp.

03941 {
03942     SetCurrentStates();
03943     // If the system is disabled all messages should be ignored 
03944     if (!pCurrentDragOp) return;
03945 
03946     // Make sure the capture is released.
03947     ::ReleaseCapture();
03948 
03949     if (!CCamApp::IsDisabled())
03950         pDocView->DragFinished(pCurrentDragOp, OilCoord(0, 0), LastClickMods, FALSE);
03951 
03952 //  EndDrag(pCurrentDragOp);
03953 }

void ScreenView::OnDraw wxDC *  pDC  )  [virtual]
 

Makes sure that the kernel knows which view to render into. Retrieves the clipping rectangle from the CDC. Passes the CDC and the rectangle to DocView::OnDraw(), which does the actual rendering.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
A pointer to the CDC object to render into. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Public

See also:
CView::OnPrepareDC(); ScreenView::OnRenderView(); DocView::OnDraw()

Reimplemented from CCamView.

Definition at line 1606 of file scrvw.cpp.

01607 {
01608 //  TRACE( _T("ScreenView::OnDraw\n"));
01609 
01610     if (pDocView==NULL)
01611         return;
01612         
01613     // Set the current DocView, ie. the DocView being worked upon. (and the Doc!)
01614     pDocView->SetCurrent();
01615     (pDocView->GetDoc())->SetCurrent();
01616 
01617     // Are we printing?
01618 PORTNOTE("print","Removed Printing from OnDraw")
01619 #ifndef EXCLUDE_FROM_XARALX
01620     if (pDC->IsPrinting())
01621     {
01622         //TRACE( _T("BAD ! ScreenView::OnDraw reckons we're printing\n"));
01623 #ifndef STANDALONE
01624 
01625         // Yes - do the printing!
01626 
01627         // Find out from the display context the rectangle bounding the invalid
01628         // region.
01629         WinRect clip;
01630 
01631         if (pDC->GetClipBox(&clip) == NULLREGION) 
01632             return;
01633 
01634         // Pass the drawing parameters on to the associated PrintView object.
01635         pPrintView->AttachToDC(pDC);
01636         pPrintView->OnDraw(pDC, clip.ToOil(pPrintView));
01637         pPrintView->AttachToDC(NULL);
01638 
01639 #endif
01640     }
01641     else
01642 #endif
01643     {
01644         WinRect clip;
01645 
01646         // wxWidget only provides a unified accessor, so that's
01647         // what we'll use
01648         wxRegionIterator upd( m_pCanvas->GetUpdateRegion() ); // get the update rect list
01649         while( upd )
01650         {
01651             clip.x      = upd.GetX();
01652             clip.y      = upd.GetY();
01653             clip.width  = upd.GetW();
01654             clip.height = upd.GetH();
01655 
01656 //          DumpRect( pDC, &clip, wxT("OnDraw UpdateRect : ") );
01657 
01658             OilRect oRect = clip.ToOil( pDocView );
01659 //          TRACE( _T("OilRect = (%d, %d) - (%d, %d)\n"), oRect.lo.x, oRect.lo.y, oRect.hi.x, oRect.hi.y);
01660             
01661             pDocView->OnDraw( pDC, oRect );
01662 
01663             upd ++ ;
01664         }
01665 
01666 //#pragma message( __LOCMSG__ "ScreenView::OnDraw - Forcing redraw" )
01667 //TRACE( _T("ScreenView::OnDraw - Forcing redraw") );
01668 //      Camelot.GetRegionList()->ImmediateRender(true);
01669 
01670 #if FALSE
01671         // Find out from the display context the rectangle bounding the invalid
01672         // region.  If we can, try to use lists of rectangles.
01673         wxRect         *lpRect;
01674         UINT32          count = CCDC::GetRectangleList( pDC, &lpRect );
01675 
01676         TRACE( _T("ScreenView::OnDraw called with %d regions\n"), count);
01677 
01678         // If there's more than one rectangle then iterate through them all...
01679         if (count > 1)
01680         {
01681             while (count--)
01682             {
01683                 clip.x      = lpRect->x;
01684                 clip.x      = lpRect->y;
01685                 clip.width  = lpRect->width;
01686                 clip.height = lpRect->height;
01687 
01688                 DumpRect( pDC, &clip, "camrect1" );
01689 
01690                 pDocView->OnDraw( pDC, clip.ToOil(pDocView) );
01691                 lpRect++;
01692             }
01693         }
01694         else
01695         {
01696             //TRACE( _T("ScreenView::OnDraw doing simple rectangle stuff"));
01697             
01698             // . . . else handle the simple <2 rectangle code
01699             pDC->GetClippingBox( clip );
01700             if( !clip.IsEmpty() )
01701             {
01702                 // Pass the drawing parameters on to the associated DocView object.
01703                 DumpRect( pDC, &clip, "camrect2" );
01704                 pDocView->OnDraw( pDC, clip.ToOil(pDocView) );
01705             }
01706         }
01707 #endif
01708     }
01709 
01710 //  TRACE( _T("Leaving ScreenView::OnDraw\n"));
01711 }

void ScreenView::OnDropFiles HDROP  hDropInfo  )  [protected]
 

Respond to files being dropped onto the view window. It sets up the current document and docview, and passes control on to the OpDroppedFile operation.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/07/94
Parameters:
hDropInfo - handle to information about drag event. [INPUTS]
See also:
OpDroppedFile

Definition at line 4134 of file scrvw.cpp.

04135 {
04136 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
04137 #ifdef STANDALONE
04138     // Force Viewer to 'Load' rather than Import
04139     GetMainFrame()->OnDropFiles(hDropInfo);
04140 #else
04141     // Set the correct docivew (and hence document)
04142     pDocView->SetCurrent();
04143     
04144     // Invoke the dropped files operation
04145     OpDescriptor *pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_DROPPEDFILE);
04146     pOpDesc->Invoke((OpParam *) hDropInfo);
04147 
04148     // Clean up
04149     DragFinish(hDropInfo);
04150 #endif
04151 #endif
04152 }

void ScreenView::OnFilePrint  )  [virtual]
 

Reimplemented from CCamView.

void ScreenView::OnFilePrintPreview  )  [virtual]
 

Simply makes CView::OnFilePrintPreview() have public scope. Used by the menu system.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Public

See also:
CView::OnFilePrintPreview(); CCamView::OnFilePrint()

Reimplemented from CCamView.

Definition at line 4199 of file scrvw.cpp.

04200 {
04201     SetCurrentStates();
04202 
04203     CCamView::OnFilePrintPreview();
04204 }

afx_msg LRESULT ScreenView::OnFrameMove WPARAM  x,
LPARAM  y
[protected]
 

void ScreenView::OnHScroll UINT32  nSBCode,
UINT32  nPos,
CScrollBar *  pScrollBar
[protected]
 

The framework calls this member function when the user clicks a window's horizontal scroll bar.

Author:
Marc_Power (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/95

Definition at line 4727 of file scrvw.cpp.

04728 {
04729     if(HScrollBar)  
04730     {   
04731         HScrollBar->HandleScrollMessage(nSBCode, nPos);
04732     }
04733 }

void ScreenView::OnInitialUpdate  )  [protected, virtual]
 

Reimplemented from CCamView.

Definition at line 1005 of file scrvw.cpp.

01006 {
01007     // Set up current etc.
01008     SetCurrentStates();
01009 
01010     // Check if this view is being created by LoadAppWindowState at the start.  If it is
01011     // then pick up the ViewState object ready-made by LoadAppWindowState and set
01012     // this view according to that.
01013     if (pReadyMadeViewState != NULL)
01014     {
01015         // Set the flags saved in temp. storage in the ViewState in the corresponding
01016         // DocView.
01017         DocView* pdv = GetDocViewPtr();
01018         ERROR3IF(pdv == NULL, "Null DocView* in ScreenView::OnInitialUpdate");
01019 
01020         // Deallocate the old ViewState and set the new.
01021         delete SetViewState(pReadyMadeViewState);
01022 
01023         // Set these flags as well in the DocView.
01024         pdv->ViewFlags.GridShow        = pReadyMadeViewState->_GridShow;
01025         pdv->ViewFlags.GridSnap        = pReadyMadeViewState->_GridSnap;
01026         pdv->ViewFlags.ObjectsSnap     = pReadyMadeViewState->_ObjectsSnap;
01027         pdv->ViewFlags.MagObjectsSnap  = pReadyMadeViewState->_MagObjectsSnap;
01028         pdv->ViewFlags.PrintBorderShow = pReadyMadeViewState->_PrintBorderShow;
01029         pdv->ViewFlags.LogicalView     = pReadyMadeViewState->_LogicalView;
01030         pdv->ViewFlags.GuidesSnap      = pReadyMadeViewState->_GuidesSnap;
01031         pdv->ViewFlags.GuidesShow      = pReadyMadeViewState->_GuidesShow;
01032         
01033         // Make sure we set this view from the view-state, not the other way around.
01034         pReadyMadeViewState = NULL;
01035         Status->IsNewView = FALSE;
01036     }
01037 
01038     // Force the DocView to set the work area extent.
01039     pDocView->ViewStateChanged();
01040     PORTNOTETRACE("other","ScreenView::OnInitialUpdate - code removed");
01041 #ifndef EXCLUDE_FROM_XARALX
01042     if(HScrollBar&&VScrollBar)
01043     {
01044 
01045         // Calculate the scroller page & line sizes, and its range, and make sure the
01046         // work area extent is updated.
01047         FIXED16 PixelWidth, PixelHeight;
01048         pDocView->GetPixelSize(&PixelWidth, &PixelHeight);
01049         XLONG x1 = CurrentSize.GetWidth() * PixelWidth;
01050         XLONG x2 = CurrentSize.GetHeight() * PixelHeight;
01051         HScrollBar->SetPageSize(x1);
01052         VScrollBar->SetPageSize(x2);
01053         HScrollBar->SetLineSize(x1 / xlong(10) + xlong(1)); 
01054         VScrollBar->SetLineSize(x2 / xlong(10) + xlong(1));
01055     }
01056 #endif
01057     // Either make this view conform to the ViewState, or update the ViewState with
01058     // information about this view, depending on whether the view is new or (re)loaded.
01059     if (Status->IsNewView)
01060     {
01061         SetViewStateFromThis();
01062         pDocView->OnNewView();          // give the DocView a shot
01063     }
01064     else
01065     {
01066         SetThisFromViewState();
01067         pDocView->OnLoadedView();       // let kernel have its say
01068     }
01069 
01070 PORTNOTE("other","ScreenView::OnInitialUpdate - code removed")
01071 #ifndef EXCLUDE_FROM_XARALX
01072     // RALPH
01073     if (GetParentFrame())
01074     {
01075     #if (_OLE_VER >= 0x200)
01076         // In OLE builds only do this for non-embedded docs, as OnShowDocument will handle it
01077         // for embedded docs.
01078         if (!GetDocument()->IsServer())
01079     #endif
01080         {
01081             // Apply preferences.  To begin, maximise this view if it is the only one around.
01082             BOOL fAppIsIcon = GetMainFrame()->IsIconic();
01083             if (HowMany() == 1)
01084             {
01085                 // This flag is TRUE during workspace restoration of more than one doc.  We don't
01086                 // want to maximise any views if its TRUE.
01087                 extern BOOL fDontMaximiseViews;
01088                 if (ZoomSingleView && !fAppIsIcon && !fDontMaximiseViews)
01089                     ((CMDIChildWnd*) GetParentFrame())->MDIMaximize();
01090             }
01091             else
01092             {
01093                 // Otherwise, if a view is already maximised, un-maximise it so that this
01094                 // view is visible.
01095                 if (UnzoomOnNewView || fAppIsIcon)
01096                 {
01097                     // Find out the active view, which must be the one maximised, if any are.
01098                     BOOL fIsMaxed;
01099                     CMDIFrameWnd* pMainWnd = ((CMDIChildWnd*) GetParentFrame())->GetMDIFrame();
01100                     ENSURE(pMainWnd, "No MDI frame window in ScreenView::OnShowWindow!");
01101                     CMDIChildWnd* pMaxiWnd = pMainWnd->MDIGetActive(&fIsMaxed);
01102 
01103                     // If it is maximised then restore it.
01104                     if (fIsMaxed && pMaxiWnd != NULL)
01105                     {
01106                         wxView* pv = pMaxiWnd->GetActiveView();
01107                         if (pv && pv->GetDocument() &&
01108                             ((CCamDoc*) pv->GetDocument())->IsUntouched())
01109                         {
01110                             TRACEUSER( "JustinF", _T("MDI Restore in ScreenView::OnInitialUpdate\n"));
01111                             pMaxiWnd->MDIRestore();
01112                         }
01113                     }
01114                 }
01115             }
01116         }
01117     }
01118 #ifdef _DEBUG
01119     else
01120     {
01121         TRACEUSER( "JustinF", _T("\t- no parent frame in ScreenView::OnInitialUpdate\n"));
01122     }
01123 #endif
01124 #endif
01125     // Initialise the OLE selection (TODO: remove this when selection model code
01126     // is written).
01127     #if (_OLE_VER >= 0x200)     
01128         m_pSelection = 0;
01129     #endif
01130 
01131     // Make sure the render window is repainted and inform the kernel that something
01132     // has happened.
01133 //  InvalidateView();
01134     pDocView->ViewStateChanged();
01135 
01136     // Allow the base class to do it's OnInitialUpdate stuff last, because it just
01137     // calls OnUpdate.
01138 //  CCamView::OnInitialUpdate();
01139 
01140     // Indicate that we have set the position, size, focus etc so OnActivateView is safe
01141     // to update the HasFocus fields of ViewStates.
01142     fSetupDone = TRUE;
01143 
01144 #if (_OLE_VER >= 0x200)
01145 
01146     // Check if the document wants to zoom to the page.  This is the best place to
01147     // do this as everything should now be stable.
01148     LPCTSTR lpcszZoomOp = GetDocument()->GetInitialZoom();
01149     if (lpcszZoomOp)
01150     {
01151         // Remember the old prev. zoom setting.
01152         INT32 nPrev;
01153         FIXED16 fxPrev;
01154         WorkCoord wcPrev;
01155         nPrev  = pDocView->GetPrevZoomIndex();
01156         fxPrev = pDocView->GetPrevZoomScale();
01157         wcPrev = pDocView->GetPrevZoomOffset();
01158 
01159         // There is, so zoom it to show the new page bounds.  Set-up the kernel.
01160         DocView* pOldCurrent = DocView::GetCurrent();
01161         pDocView->SetCurrent();
01162 
01163         // Perform the Zoom-to-Page Operation (it's non-undo-able).
01164         OpDescriptor* pOp = OpDescriptor::FindOpDescriptor((LPTSTR) lpcszZoomOp);
01165         ERROR3IF(!pOp, "Can't find the Zoom Operation in ScreenView::OnInitialUpdate");
01166         pOp->Invoke(0);
01167 
01168         // Restore the old prev. zoom setting.
01169         pDocView->SetPrevZoomIndex(nPrev);
01170         pDocView->SetPrevZoomScale(fxPrev);
01171         pDocView->SetPrevZoomOffset(wcPrev);
01172     }
01173 
01174 #endif 
01175 }

void ScreenView::OnInsertObject  )  [protected]
 

"Creates an embedded OLE object with a type-name retrieved from the user" - currently unimplemented.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
ScreenView::IsSelected()

Definition at line 4285 of file scrvw.cpp.

04286 {
04287 
04288     SetCurrentStates();
04289 
04290 
04291 #if (_OLE_VER >= 0x200)
04292 
04293     // OLE 2.0+ default implementation.
04294     // Invoke the standard Insert Object dialog box to obtain information for a new
04295     // CCamCntrItem object.
04296     COleInsertDialog dlg;
04297     if (dlg.DoModal() != IDOK) return;
04298 
04299     BeginBusyCursor();
04300 
04301     CCamCntrItem* pItem = NULL;
04302     TRY
04303     {
04304         // Create new item connected to this document.
04305         CCamDoc* pDoc = GetDocument();
04306         ASSERT_VALID(pDoc);
04307         pItem = new CCamCntrItem(pDoc);
04308         ASSERT_VALID(pItem);
04309 
04310         // Initialize the item from the dialog data.
04311         if (!dlg.CreateItem(pItem))
04312             AfxThrowMemoryException();  // any exception will do
04313         ASSERT_VALID(pItem);
04314 
04315         // If item created from class list (not from file) then launch
04316         //  the server to edit the item.
04317         if (dlg.GetSelectionType() == COleInsertDialog::createNewItem)
04318             pItem->DoVerb(OLEIVERB_SHOW, this);
04319 
04320         ASSERT_VALID(pItem);
04321 
04322         // As an arbitrary user interface design, this sets the selection
04323         //  to the last item inserted.
04324 
04325         // TODO: reimplement selection as appropriate for your application
04326 
04327         m_pSelection = pItem;   // set selection to last inserted item
04328         pDoc->UpdateAllViews(NULL);
04329     }
04330 
04331     CATCH(CException, e)
04332     {
04333         if (pItem != NULL)
04334         {
04335             ASSERT_VALID(pItem);
04336             pItem->Delete();
04337         }
04338         AfxMessageBox(_R(IDP_FAILED_TO_CREATE));
04339     }
04340     END_CATCH
04341 
04342     EndBusyCursor();
04343 
04344 #else
04345 
04346     // OLE 1.0 default implementation.
04347     wxString            strTypeName;
04348 
04349 #if (_MFC_VER < 0x300)
04350     if (!AfxOleInsertDialog(strTypeName))
04351         return;     // no OLE class selected
04352 #endif
04353 
04354     TRACE( _T("Trying to Insert OLE item with type '%s'\n"), (const char*)strTypeName);
04355 
04356     // TODO: create an embedded OLE object with that class name
04357     char szT[300];
04358     wsprintf(szT, "Listen pal - don't do that again!  This "
04359         "particular function is not completely implemented.\n"
04360         "You must add code to create a COleClientItem with a "
04361         "type name of '%s'.  See ScreenView::OnInsertObject in\n"
04362         "CAMVW.CPP for more info.", (LPCSTR)strTypeName);
04363     AfxMessageBox(szT);
04364 
04365 #endif
04366 }

void ScreenView::OnLButtonDblClk wxMouseEvent &  event  )  [protected]
 

Passes a left-button double-click to ScreenView::HandleDragEvent().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Flags describing which buttons & keys were down when the message was sent; [INPUTS] the coordinates of the mouse cursor.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
class CRendWnd; ScreenView::HandleDragEvent()

Reimplemented from CCamView.

Definition at line 4048 of file scrvw.cpp.

04049 {
04050     // Support quad clicks
04051     wxRect ClickBounds( LastDoubleClickPos.x-LocalEnvironment::GetXMouseDoubleClickMove(),
04052                         LastDoubleClickPos.y-LocalEnvironment::GetYMouseDoubleClickMove(),
04053                         LastDoubleClickPos.x+LocalEnvironment::GetXMouseDoubleClickMove(),
04054                         LastDoubleClickPos.y+LocalEnvironment::GetYMouseDoubleClickMove());
04055     MonotonicTime ThisClickTime( event.GetTimestamp() );
04056     MonotonicTime ClickGap(LocalEnvironment::GetMouseDoubleClickDelay());
04057     // Is click within allowed movement rectangle and permitted time delay
04058     INT32 TimeDelay = (ThisClickTime - TimeOfLastClick);
04059     if (ClickBounds.Inside( event.GetPosition() ) && (TimeDelay <= (INT32)ClickGap))
04060         ThisDoubleIsQuad = TRUE;
04061     else
04062         ThisDoubleIsQuad = FALSE;
04063 
04064     HandleDragEvent(MK_LBUTTON, event, CLICKTYPE_DOUBLE);
04065 
04066     TimeOfLastClick.Sample();
04067     LastDoubleClickPos = event.GetPosition();
04068 }

void ScreenView::OnLButtonDown wxMouseEvent &  event  )  [protected]
 

Called by MFC upon receipt of a left-button-down mouse message. Finds out which other buttons are down (eg. SHIFT) and passes the message on to the kernel. Note that the mouse message will have originally come from the RendWnd object, a child window of ScreenView.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Flags describing which buttons & keys were down when the message was sent; [INPUTS] the coordinates of the mouse cursor.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
class CRendWnd; ScreenView::HandleDragEvent()

Reimplemented from CCamView.

Definition at line 3366 of file scrvw.cpp.

03367 {
03368 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
03369 // WEBSTER - markn 25/4/97
03370 // No pen stuff required in Webster
03371 // Taken out by vector stroking code Neville 2/10/97
03372 #ifdef VECTOR_STROKING
03373     // Setup pressure if pen active
03374     (Camelot.GetPressurePen())->CheckMouseMessage(WM_LBUTTONDOWN, point);
03375 #endif // VECTOR_STROKING
03376 #endif
03377 
03378     // Support triple clicks
03379     wxRect ClickBounds( LastDoubleClickPos.x - LocalEnvironment::GetXMouseDoubleClickMove(),
03380                         LastDoubleClickPos.y - LocalEnvironment::GetYMouseDoubleClickMove(),
03381                         LocalEnvironment::GetXMouseDoubleClickMove() * 2,
03382                         LocalEnvironment::GetYMouseDoubleClickMove() * 2 );
03383     
03384     MonotonicTime ThisClickTime( event.GetTimestamp() );
03385     MonotonicTime ClickGap(LocalEnvironment::GetMouseDoubleClickDelay());
03386 
03387     // Is click within allowed movement rectangle and permitted time delay
03388     INT32 TimeDelay = (ThisClickTime - TimeOfLastClick);
03389     if( ClickBounds.Inside( event.GetPosition() ) && ( TimeDelay <= (INT32)ClickGap ) )
03390         ThisSingleIsTriple = TRUE;
03391     else
03392         ThisSingleIsTriple = FALSE;
03393 
03394     // Deal with the click
03395     HandleDragEvent( MK_LBUTTON, event, CLICKTYPE_SINGLE );
03396 
03397     TimeOfLastClick.Sample();
03398 }

void ScreenView::OnLButtonUp wxMouseEvent &  event  )  [protected]
 

Passes the event on to HandleButtonUp().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Flags describing which buttons & keys were down when the message was sent; [INPUTS] the coordinates of the mouse cursor
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
class CRendWnd; ScreenView::OnLButtonDown(); ScreenView::GetClickMods(); DocView::DragFinished(); ScreenView::HandleButtonUp()

Reimplemented from CCamView.

Definition at line 3974 of file scrvw.cpp.

03975 {
03976     HandleButtonUp(MK_LBUTTON, event);
03977 }

void ScreenView::OnMButtonDblClk wxMouseEvent &  event  )  [protected]
 

Passes a middle-button double-click to ScreenView::HandleDragEvent().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Flags describing which buttons & keys were down when the message was sent; [INPUTS] the coordinates of the mouse cursor.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
class CRendWnd; ScreenView::HandleDragEvent()

Reimplemented from CCamView.

Definition at line 4089 of file scrvw.cpp.

04090 {
04091     HandleDragEvent(MK_MBUTTON, event, CLICKTYPE_DOUBLE);
04092 }

void ScreenView::OnMButtonDown wxMouseEvent &  event  )  [protected]
 

Called by MFC upon receipt of a middle-button-down mouse message. Finds out which other buttons are down (eg. SHIFT) and passes the message on to the kernel. Note that the mouse message will have originally come from the RendWnd object, a child window of ScreenView.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Flags describing which buttons & keys were down when the message was sent; [INPUTS] the coordinates of the mouse cursor.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
class CRendWnd; ScreenView::HandleDragEvent()

Reimplemented from CCamView.

Definition at line 3419 of file scrvw.cpp.

03420 {
03421 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
03422 // WEBSTER - markn 25/4/97
03423 // No pen stuff required in Webster
03424 // Taken out by vector stroking code Neville 2/10/97
03425 #ifdef VECTOR_STROKING
03426     (Camelot.GetPressurePen())->CheckMouseMessage(WM_MBUTTONDOWN, point);
03427 #endif // VECTOR_STROKING
03428 #endif
03429     HandleDragEvent(MK_MBUTTON, event, CLICKTYPE_SINGLE);
03430 }

void ScreenView::OnMButtonUp wxMouseEvent &  event  )  [protected]
 

Passes the event on to HandleButtonUp().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Flags describing which buttons & keys were down when the message was sent; [INPUTS] the coordinates of the mouse cursor.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
class CRendWnd; ScreenView::OnMButtonDown(); ScreenView::GetClickMods(); DocView::DragFinished(); ScreenView::HandleButtonUp()

Reimplemented from CCamView.

Definition at line 3999 of file scrvw.cpp.

04000 {
04001     HandleButtonUp(MK_MBUTTON, event);
04002 }

afx_msg INT32 ScreenView::OnMouseActivate wxWindow *  pDesktopWnd,
UINT32  nHitTest,
UINT32  nMessage
[protected]
 

void ScreenView::OnMouseMove wxMouseEvent &  event  )  [protected]
 

Packages up OIL-layer mouse-move messages before passing them on to DocView::DragPointerMove(). If ScreenView is not in "drag mode" the event is passed to our DocView, which will forward it to the current tool. Otherwise, checks if a CLICKTYPE_DRAG message has been sent to the kernel, sending one if it hasn't (this smooths the difference between Windows and RISC OS, the former system providing little support for drag operations).

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Flags describing which buttons & keys were down when the message was sent; [INPUTS] the coordinates of the mouse cursor.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
class CRendWnd; ScreenView::HandleDragEvent(); DocView::DragPointerMove(); ScreenView::GetClickMods(); ScreenView::HandleDragScrolling(); DocView::OnMouseMove()

Reimplemented from CCamView.

Definition at line 3498 of file scrvw.cpp.

03499 {
03500     // Ignore if system is disabled
03501     if (CCamApp::IsDisabled())
03502         return;                             // If the system is disabled, ignore
03503     
03504     // Only respond to real mouse move messages
03505     if (event.GetPosition()==CurrentMousePos)
03506         return;
03507     
03508     // Ignore mouse moves if we're not the foreground window.
03509     if (pDocView != DocView::GetSelected())
03510     {
03511         return;
03512     }
03513 
03514     UINT32 nFlags = ClickModifiers::SynthesizeMouseEventFlags(event);
03515 
03516 //PORTNOTE("other","Remove StatusLine related code")
03517 //#ifndef EXCLUDE_FROM_XARALX
03518     StatusLine* pStatusLine=NULL;
03519     // flag that the StatusLine's mouse position field needs updating
03520 #ifndef RALPH
03521 
03522     pStatusLine=GetApplication()->GetpStatusLine();
03523     if (pStatusLine)
03524         pStatusLine->FlagMousePosNeedsUpdating();
03525 #endif
03526 //#endif
03527     SetCurrentStates();
03528 
03529 PORTNOTE("other","Remove PeekMessage related code")
03530 #ifndef EXCLUDE_FROM_XARALX
03531     // Only discard mouse move messages if the initiator of the drag has requested this.
03532     if (!DragKeepAccuracy)
03533     {
03534         // Due to problems with auto-repeat on modifier keys, we can lag a long way behind
03535         // with mouse messages, so we discard all except the most recent mouse move messages.
03536         // However we stop discarding mouse move messages if we come across any other mouse
03537         // messages such as button up/down events.
03538         MSG Msg;
03539         BOOL FoundMsg = FALSE;
03540 
03541         for(;;)
03542         {
03543             // We have to test that the window handles match because of a bug in PeekMessage (we 
03544             // get messages which aren't for the window we specified, strangely).
03545 
03546             if (::PeekMessage(&Msg, m_hWnd, WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE) &&
03547                 (m_hWnd == Msg.hwnd) && 
03548                 (Msg.message == WM_MOUSEMOVE))
03549             {
03550                 // Found a mouse move message on the queue...
03551                 // Remember it then discard it.
03552                 nFlags = (UINT32) Msg.wParam;
03553 
03554                 // Have to cast to INT8 so we get correct sign-extension.
03555                 point.x = (INT8) LOWORD(Msg.lParam);
03556                 point.y = (INT8) HIWORD(Msg.lParam);
03557 
03558                 // Discard the message
03559                 PeekMessage(&Msg, m_hWnd, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE);
03560                 FoundMsg = TRUE;
03561             }
03562             else
03563             {
03564                 // Either: there are no messages, or it's not for our window, or it's a mouse
03565                 // event which is not a mouse *move* event - whatever it is, stop looking
03566                 // for mouse events.
03567                 break;
03568             }
03569         }
03570 
03571         // If we found any other mouse messages, use the data from the most recent one and
03572         // ignore the others.
03573         if (FoundMsg)
03574         {
03575             ENSURE(m_hWnd == Msg.hwnd, "Bad message in OnMouseMove");
03576             nFlags = (UINT32) Msg.wParam;
03577             point.x = (INT8) LOWORD(Msg.lParam);
03578             point.y = (INT8) HIWORD(Msg.lParam);
03579 
03580         
03581         }
03582     }
03583     
03584     // Slow mouse reponse due to key auto-repeat msgs?
03585     //
03586     // We could be experiencing delayed mouse move messages due to the message
03587     // queue getting flooded with key auto-repeat msgs.
03588     //
03589     // To overcome this, we remove all mouse move messages, keeping only the most 
03590     // recent msg's coords & flags.
03591     // 
03592     // Stripping the message cue in this way means we get less mouse moves to drag handlers, hence less accurate
03593     // mouse move data.  But, as we only do this if we get an auto-repeated key stroke, accuracy should not be
03594     // a problem, even for the freehand tool.  Freehand drags have two key modifiers (Alt for straught line and
03595     // Shift for rubbing out) that only require the latest mouse move event
03596 
03597     MSG Msg;
03598     // Has there been a key msg during the mouse move?
03599     if (::PeekMessage(&Msg, m_hWnd, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE))
03600     {
03601         // Have a look at the key msg (use KeyPressSysMsg to turn the msg into a system-independant format)
03602         KeyPressSysMsg KeySysMsg(&Msg);
03603 
03604         // Is the key msg an auto-repeated key press (i.e. previously down)?
03605         if (KeySysMsg.IsValid() && KeySysMsg.PrevDown)
03606         {
03607             // Auto repeat key msg found, so get the latest mouse move msg
03608             // Note: We don't remove the msg from the queue, it may need to be processed elsewhere (e.g. button-ups)
03609             while (::PeekMessage(&Msg, m_hWnd, WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE))
03610             {
03611                 // Is the mouse msg a mouse move msgs?
03612                 if (Msg.message == WM_MOUSEMOVE)
03613                 {
03614                     // Found a mouse move message on the queue so remember it 
03615                     nFlags = (UINT32) Msg.wParam;
03616 
03617                     // Have to cast to INT8 so we get correct sign-extension.
03618                     point.x = (INT8) LOWORD(Msg.lParam);
03619                     point.y = (INT8) HIWORD(Msg.lParam);
03620 
03621                     // Remove the mouse move msg, and get the next mouse msg in the queue
03622                     ::PeekMessage(&Msg, m_hWnd, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE);
03623                 }
03624                 else
03625                 {
03626                     // We have got a mouse msg that's not a mouse move msg, so break out of 'while' loop
03627                     // This could be a button-up msg, in which case we should stop looking for
03628                     // mouse moves as they may be irrelevent to the current drag
03629                     break;  
03630                 }
03631             }
03632         }
03633     }
03634 #endif
03635 
03636 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
03637 // WEBSTER - markn 25/4/97
03638 // No pen stuff required in Webster
03639 // Taken out by vector stroking code Neville 2/10/97
03640 #ifdef VECTOR_STROKING
03641 
03642     // Now check the Mouse Message to see if it has any pressure information
03643     (Camelot.GetPressurePen())->CheckMouseMessage(WM_MOUSEMOVE, point);
03644 #endif // VECTOR_STROKING
03645 #endif
03646 
03647     // Set the DocView (and Document)
03648 //  pDocView->SetCurrent();
03649 
03650 
03651     // Find out which buttons/keys are down.
03652     GetClickMods(event, &LastClickMods);
03653 
03654     // Are we dragging at the moment?
03655     if (pCurrentDragOp)
03656     {
03657         // Yes, but just check that the drag isn't "paused" while we do an OLE drag outside the window
03658         if (GetCanvas()->GetCapture() == GetCanvas())
03659         {
03660             WinCoord    point;
03661             event.GetPosition( &point.x, &point.y );
03662 
03663             // Send an on-going drag event to the kernel.
03664             pDocView->DragPointerMove(pCurrentDragOp, point.ToOil(pDocView, TRUE), LastClickMods);
03665 
03666             // Check if we need to scroll this view.
03667             HandleDragScrolling(point);
03668         }
03669     }
03670     else
03671     {
03672         // We are not dragging at the moment, but are we about to start a drag?  If the
03673         // last mouse event was a single click, the same buttons are down, and the mouse
03674         // has either moved (3 or more), then a drag is beginning.
03675         WinCoord point;
03676         event.GetPosition( &point.x, &point.y );
03677 
03678         INT32   dx  = point.x - LastClickPoint.x;
03679         INT32   dy  = point.y - LastClickPoint.y;
03680         INT32   dz2 = (dx * dx) + (dy * dy);
03681         if ((nFlags & FirstClickButton) && (dz2 >= (DragLatency * DragLatency)))
03682         {
03683             // Inform the kernel that a drag is starting.
03684             wxMouseEvent KernelEvent( event );
03685             KernelEvent.m_x = LastClickPoint.x;
03686             KernelEvent.m_y = LastClickPoint.y;
03687             HandleDragEvent(FirstClickButton, KernelEvent, CLICKTYPE_DRAG);
03688         }
03689         else
03690         {
03691             // We are not dragging, just moving the mouse around, so pass the position 
03692             // of the mouse to the tool, giving it an opportunity to set the cursor etc.
03693             pDocView->OnMouseMove( point.ToOil(pDocView, TRUE), LastClickMods);     
03694         }
03695     }
03696 
03697     // Remember the last position of the mouse passed on to the kernel.  The position
03698     // passed on any subsequent DragPointerIdle events must be the same as this!
03699     CurrentMousePos = event.GetPosition();
03700 
03701 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
03702     // if status line has not already been updated by someone calling CSnap::Snap(), call
03703     // CSnap::Snap(), snapping to grid only, to update status line (and ruler mouse followers)
03704     if (pStatusLine && pStatusLine->MousePosNeedsUpdating())
03705     {
03706         OilCoord OilPos=((WinCoord*)&point)->ToOil(pDocView, TRUE);
03707         DocCoord DocPos(0,0);
03708         Spread*  pSpread=pDocView->OilToSpreadCoord(OilPos,&DocPos);
03709         if (pSpread)
03710             pDocView->Snap(pSpread,&DocPos,TRUE,TRUE);
03711     }
03712 #endif
03713 }

void ScreenView::OnMouseWheel wxMouseEvent &  event  )  [protected]
 

Scope: Protected.

Author:
Priestley (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/10/2000

Reimplemented from CCamView.

Definition at line 3471 of file scrvw.cpp.

03472 {
03473     HandleMouseWheelEvent( event );
03474 }

void ScreenView::OnPaint  )  [protected]
 

Handles WM_PAINT messages for the ScreenView window. As the window is entirely covered by child windows, which know how to paint themselves, this function simply validates its (invisible) client area, removing the paint message. No drawing of any kind is done.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
class CRendWnd

Definition at line 1513 of file scrvw.cpp.

01514 {
01515     try
01516     {
01517         Error::RenderThreadIn();
01518         wxPaintDC dc(this);         // this validates the client area
01519         Error::RenderThreadOut();
01520     }
01521     catch( CResourceException e )
01522     {
01523         ENSURE(FALSE, "Resource exception in ScreenView::OnPaint!\n");
01524     }
01525 }

BOOL ScreenView::OnPreparePrinting CPrintInfo *  pInfo  )  [virtual]
 

Current just returns that value of CView::DoPreparePrinting().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
by the wonderful AppWizard
Parameters:
- [INPUTS]
Fills the passed CPrintInfo with some stuff. [OUTPUTS]
Returns:
TRUE if successful preparation for printing.

Errors: - Scope: Public

See also:
CView::DoPreparePrinting()

Definition at line 1730 of file scrvw.cpp.

01731 {
01732 #ifndef STANDALONE
01733 
01734     if (!CCPrintDialog::OnPreparePrinting(pInfo,pDocView->GetDoc()))
01735         ERROR2(FALSE,"Unable to initialise the customized print dialog");
01736 
01737     // default preparation
01738 //  BOOL Result = CCamView::DoPreparePrinting(pInfo);
01739 //  if (!Result)
01740 //      return FALSE;
01741 
01742     // Check because brainless CView only checks for valid DC in debug builds - handy eh? NOT!
01743     if (pInfo->m_pPD->m_pd.hDC == NULL)
01744     {
01745         ERROR1(FALSE,_R(IDE_NULL_PRINTDC));
01746         //ERROR2(FALSE, "No valid DC returned by print dialog!");
01747     }
01748 
01749     // Get ourselves a print view and attach it to this CamView.
01750     // NB. Must be after the user has clicked OK on print dialog, as we set up
01751     //     anti-aliasing etc. in PrintView constructor.
01752     if (pPrintView != NULL)
01753     {
01754         delete pPrintView;
01755         pPrintView = NULL;
01756         ERROR2(FALSE, "OnPreparePrinting(): we already have a PrintView!");
01757     }
01758 
01759     pPrintView = new PrintView(pDocView->GetDoc());
01760     if (pPrintView == NULL)
01761         ERROR2(FALSE, "Not enough memory to create PrintView object");
01762 
01763     if (!pPrintView->ConnectToOilView(this))
01764     {
01765         delete pPrintView;
01766         pPrintView = NULL;
01767         ERROR2(FALSE, "Unable to attach PrintView to CamView.");
01768     }
01769 
01770 #endif
01771 
01772     // OK if we got this far.
01773     return TRUE;
01774 }

void ScreenView::OnRButtonDblClk wxMouseEvent &  event  )  [protected]
 

Same as ScreenView::OnLButtonDblClk(), bit for the right button.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Flags describing which buttons & keys were down when the message was sent; [INPUTS] the coordinates of the mouse cursor
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
class CRendWnd; ScreenView::OnLButtonDblClk()

Reimplemented from CCamView.

Definition at line 4113 of file scrvw.cpp.

04114 {
04115     HandleDragEvent(MK_RBUTTON, event, CLICKTYPE_DOUBLE);
04116 }

void ScreenView::OnRButtonDown wxMouseEvent &  event  )  [protected]
 

Same as for ScreenView::OnLButtonDown(), but for the right mouse button.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Flags describing which buttons & keys were down when the message was sent; [INPUTS] the coordinates of the mouse cursor.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
class CRendWnd; ScreenView::HandleDragEvent(); ScreenView::OnLButtonDown()

Reimplemented from CCamView.

Definition at line 3448 of file scrvw.cpp.

03449 {
03450 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
03451 // WEBSTER - markn 25/4/97
03452 // No pen stuff required in Webster
03453 // Taken out by vector stroking code Neville 2/10/97
03454 #ifdef VECTOR_STROKING
03455     (Camelot.GetPressurePen())->CheckMouseMessage( WM_RBUTTONDOWN, event.GetPosition() );
03456 #endif // VECTOR_STROKING
03457 #endif
03458     HandleDragEvent(MK_RBUTTON, event, CLICKTYPE_SINGLE);
03459 }

void ScreenView::OnRButtonUp wxMouseEvent &  event  )  [protected]
 

Same as ScreenView::OnLButtonUp(), but for the right mouse button.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Flags describing which buttons & keys were down when the message was sent; [INPUTS] the coordinates of the mouse cursor.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
class CRendWnd; ScreenView::OnRButtonDown(); ScreenView::GetClickMods(); DocView::DragFinished(); ScreenView::HandleButtonUp()

Reimplemented from CCamView.

Definition at line 4024 of file scrvw.cpp.

04025 {   
04026     HandleButtonUp(MK_RBUTTON, event);
04027 } 

LRESULT ScreenView::OnRenderView WPARAM  wp,
LPARAM  lp
[protected]
 

Responds to a WM_PAINT message sent to the RendWnd window object. Effectively tricks MFC into painting the RendWnd as if it was a CView window, not a child of a CView - calls CView::OnPrepareDC() and ScreenView::OnDraw().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
A pointer to a CPaintDC, cast into an LPARAM. The WPARAM is not used. [INPUTS]
- [OUTPUTS]
Returns:
Returns 0, indicating to Windows that the message was successfully processed.

Errors: - Scope: Protected

See also:
class CRendWnd; CRenderWnd::OnPaint(); ScreenView::OnDraw();

Reimplemented from CCamView.

Definition at line 1550 of file scrvw.cpp.

01551 {
01552     CPaintDC* pDC = (CPaintDC*) lp;
01553     OnPrepareDC(pDC);
01554     OnDraw(pDC);
01555     return 0;
01556 }

LRESULT ScreenView::OnScrollerEvent WPARAM  redraw,
LPARAM  barptr
[protected]
 

This message is sent by the scroll bars in response to an earlier call to ScreenView::SetScrollOffset(). The scroll offset is read from the scroll bars and the ScrollPosition field of the ViewState is updated accordingly. If the WPARAM parameter is TRUE then the client area is repainted via a call to ScreenView::ScrollTo().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
A boolean, cast to a WPARAM, which indicates whether ScreenView should update [INPUTS] the client area in response to this message. The LPARAM is not used.
- [OUTPUTS]
Returns:
Returns 0, indicating to Windows that the message has been processed successfully.

Errors: - Scope: Protected

See also:
ScreenView::SetScrollOffset(); ScreenView::ScrollTo(); CScroller::MoveThumb()

Definition at line 2137 of file scrvw.cpp.

02138 {
02139     SetCurrentStates();
02140     if (Status && fSetupDone)
02141     {
02142         WorkCoord temp;
02143         GetScrollOffset(&temp);
02144         Status->SetScrollPos(temp);
02145         if (redraw) ScrollTo( Status->GetScrollPos() );
02146     }
02147     return 0;
02148 }

BOOL ScreenView::OnSetCursor wxWindow *  pWnd,
UINT32  nHitTest,
UINT32  nMessage
[protected]
 

Calls the kernel DocView object to set the cursor for this ScreenView. Scope: Protected.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
14 Oct 93
Parameters:
pWnd points to the window that contains the cursor; [INPUTS] "nHitTest" contains a code indicating the part of the window the cursor is over; "nMessage" contains the mouse-message numeric identifier (WM_LBUTTONDOWN etc).
Returns:
TRUE, ie. the cursor has been set, and no further processing is necessary. FALSE if the cursor has not been set, e.g. this view is not active.
See also:
DocView::OnSetCursor

Definition at line 2222 of file scrvw.cpp.

02223 {
02224     // Child windows assume responsibility for setting their own cursor.
02225     if (pWnd == GetCanvas())
02226     {   
02227         // Get the kernel to do the business for the view display ....
02228         ENSURE(pDocView != 0, "No link to kernel DocView in ScreenView::OnSetCursor!\n");
02229 
02230         SetCurrentStates();
02231         pDocView->OnSetCursor();
02232         return TRUE;
02233     }
02234     else if (pWnd == Corner)
02235         return Corner->OnSetCursor(Corner, nHitTest, nMessage);
02236 
02237     return FALSE;
02238 }

void ScreenView::OnSize wxSizeEvent &  event  )  [protected]
 

Moved down to ScreenCamView.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
A flag indicating whether the window is maximised, minimised [INPUTS] etc., the width and height of the ScreenView client area.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
CScroller::CalcPosFromParentClient(); CScroller::SetPageSize(); CScroller::SetLineSize(); class CRendWnd; class CScrollerCorner; struct ViewState; DocView::ViewStateChanged()

Reimplemented from CCamView.

Reimplemented in ScreenCamView.

Definition at line 1365 of file scrvw.cpp.

01366 {
01367 }

void ScreenView::OnTimer UINT32  nIDEvent  )  [protected]
 

Called when a key is pressed, so we can do something with it. It is currently only used to adjust the Pretend Pen Pressure. THIS CODE HAS BEEN COMMENTED OUT UNTIL THE NEW KEYBOARD SYSTEM IS FULLY OPERATIONAL!! Sends DragPointerIdle "events" to the kernel, when dragging. As Windows doesn't support such "idle" messages, the OIL drag system sets up a timer when a drag starts, and sends idle messages every time the timer elapses, until the drag is finished.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
The elapsed timer's numeric identifier (not used). [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
ScreenView::HandleDragEvent(); DocView::DragPointerMove(); ScreenView::GetClickMods();

Definition at line 3805 of file scrvw.cpp.

03806 {
03807 
03808     // Ignore if system is disabled
03809     if (CCamApp::IsDisabled())
03810         return;                             // If the system is disabled, ignore
03811 
03812     // This window should never get a timer event that does not occur between calls to
03813     // StartDrag() and EndDrag().
03814 //  ENSURE(pCurrentDragOp != 0, "ScreenView::StartDrag: pCurrentDragOp is null");
03815 
03816     // Find out which keys/buttons are being held down at the moment.  The mouse buttons
03817     // are more difficult, as they may have been swapped.
03818     UINT32 nFlags = ClickModifiers::SynthesizeMouseEventFlags();
03819 
03820     SetCurrentStates();
03821 
03822     if (pCurrentDragOp == NULL)
03823     {
03824         // We are not dragging at the moment, so check for a time-out condition to 
03825         // start a drag:
03826         // If a mouse button is down, and the timer has expired, then start a drag.
03827         if (LastClickType!=CLICKTYPE_NONE
03828             && (nFlags & (MK_LBUTTON|MK_MBUTTON|MK_RBUTTON))
03829             && DragTimer.Elapsed(DragDelay)
03830             && GetCurrentMousePos(NULL)
03831             )
03832         {
03833             // Inform the kernel that a drag is starting.
03834             HandleDragEvent(FirstClickButton, nFlags, LastClickPoint, CLICKTYPE_DRAG);
03835         }
03836     }
03837     else
03838     {
03839         // If we're doing an OLE drag and drop operation, then our DragOperation is still
03840         // active, but we have lost the Mouse Capture, so we should not update anything.
03841         // If the user drags back into our view window, the OLE drag will be shut down
03842         // and we will be given back our mouse capture so we can continue as if nothing
03843         // had happened. This just stops us scrolling while the OLE system is in charge!
03844         if (GetCanvas()->GetCapture() == GetCanvas())
03845         {
03846             // Check if we need to scroll the screen . . .
03847             HandleDragScrolling(CurrentMousePos);
03848 
03849             // The above call may have aborted the current DragOp, so we must check if it is NULL
03850             if (pCurrentDragOp != NULL)
03851             {
03852                 // Now "fake" a mouse event for the kernel . . .
03853                 GetClickMods(nFlags, &LastClickMods);
03854                 pDocView->DragPointerIdle(pCurrentDragOp, 
03855                                           ((WinCoord*)&CurrentMousePos)->ToOil(pDocView, TRUE),
03856                                           LastClickMods);
03857             }
03858         }
03859         else
03860         {
03861             // We don't own the capture - but if the user was OLE dragging and has dragged back into our
03862             // view window, then the OLE drag will have been cancelled, and we need to recapture the
03863             // mouse so that we can continue processing the drag as if nothing happened. Our OLE DropSource
03864             // will set our OLERecaptureMouse flag if it cancels itself and wishes us to continue...
03865             if (OLERecaptureMouse)
03866             {
03867                 GetCanvas()->SetCapture();
03868                 OLERecaptureMouse = FALSE;      // Only capture it back once!
03869             }
03870         }
03871     }
03872 }

void ScreenView::OnUpdate wxView *  sender,
wxObject *  hint = (wxObject*)NULL
[protected, virtual]
 

Called when the view must first display the document. Moves this view/frame to the position given in the ViewState object.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
19 Jan 1994
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
ScreenView::SetThisFromViewState; ScreenView::SetViewStateFromThis; DocView::ViewStateChanged

Reimplemented from CCamView.

Definition at line 990 of file scrvw.cpp.

00991 {
00992     if ( sender==NULL && !fInitialUpdate )
00993     {
00994         OnInitialUpdate();
00995         fInitialUpdate = true;
00996     }
00997     CCamView::OnUpdate(sender,hint);
00998 }

void ScreenView::OnVScroll UINT32  nSBCode,
UINT32  nPos,
CScrollBar *  pScrollBar
[protected]
 

The framework calls this member function when the user clicks a window's vertical scroll bar.

Author:
Marc_Power (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/95

Definition at line 4744 of file scrvw.cpp.

04745 {
04746     if(VScrollBar)
04747     {
04748         VScrollBar->HandleScrollMessage(nSBCode, nPos);
04749     }
04750 }

BOOL ScreenView::PrintPaper wxDC *  pPrintDC,
CCPrintInfo pPrintInfo,
PrintControl pPrintControl
[protected]
 

Reimplemented from CCamView.

BOOL ScreenView::ReadViewPrefs  )  [static]
 

Tries to load preferences for ScreenView, creating them with default values if they don't exist.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/11/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the .INI file settings were loaded (or created) successfully.

Errors: -

See also:
Application::DeclareSection; Application::DeclarePref

Reimplemented from CCamView.

Definition at line 489 of file scrvw.cpp.

00490 {
00491 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00492     // Declare and load the .INI file settings.
00493     BOOL ok =   Camelot.DeclareSection(TEXT("Mouse"), 10) &&
00494                 Camelot.DeclarePref(TEXT("Mouse"), TEXT("DragLatency"),
00495                                     &ScreenView::DragLatency, 1, 10) &&
00496                 Camelot.DeclarePref(TEXT("Mouse"), TEXT("DragDelay"),
00497                                     &DragDelay, 100, 2000)
00498 
00499              && Camelot.DeclareSection(TEXT("WindowFurniture"), 10) &&
00500                 Camelot.DeclarePref(TEXT("WindowFurniture"), TEXT("PropScrollers"),
00501                                    &ScreenView::PropScrollersOn, FALSE, TRUE) &&
00502                 Camelot.DeclarePref(TEXT("WindowFurniture"), TEXT("Scrollers Visibilty State"),
00503                                    &ScreenView::DefaultScrollersState, FALSE, TRUE)&&
00504                 Camelot.DeclarePref(TEXT("WindowFurniture"), TEXT("Rulers Visibilty State"),
00505                                    &ScreenView::DefaultRulersState, FALSE, TRUE)
00506 
00507              && Camelot.DeclareSection(TEXT("Windows"), 10) &&
00508                 Camelot.DeclarePref(TEXT("Windows"), TEXT("UnzoomOnNewView"),
00509                                    &ScreenView::UnzoomOnNewView, FALSE, TRUE) &&
00510                 Camelot.DeclarePref(TEXT("Windows"), TEXT("ZoomSingleView"),
00511                                    &ScreenView::ZoomSingleView, FALSE, TRUE);
00512 
00513     return ok;
00514 #else
00515     return TRUE;
00516 #endif
00517 }

void ScreenView::RecaptureMouseOnNextUpdate void   ) 
 

Called by the OLE drag & drop system (CCamDropSource::QueryContinueDrag, winoil.cpp) when dragging a selection - if the mouse pointer goes outside the view, the selection drag is "paused", and an OLE drag is started. If the pointer comes back into our view, we cancel the OLE drag and resume the selector drag - the only thing we need to do to resume is to reclaim the mouse capture (but we must do it on the next idle to ensure that we get & keep the capture, so we flag it here and fix it up in OnTimer, above).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
?/10/96
The other thing we must now do is to XOR the dragged objects once to restore them to screen (as we now hide the XOR when you drag out of the window)

Reimplemented from CCamView.

Definition at line 3895 of file scrvw.cpp.

03896 {
03897     // Flag the fact that we must recapture the mouse
03898     OLERecaptureMouse = TRUE;
03899 
03900     Spread *pSpread = pDocView->FindEnclosingSpread(((WinCoord*)&CurrentMousePos)->ToOil(pDocView, TRUE));
03901 
03902     if (pSpread != NULL)
03903     {
03904         // Get the DocView's viewport, in Spread Coords, because we have to supply a DocRect to
03905         // this stupid routine which won't let us pass a NULL pointer in to just redraw
03906         // it all, depsite the fact that all the functions it calls will allow it. Grrr.
03907         // (And using the Spread's bounding rect doesn't work because its bounding rect is in
03908         // chapter coords, not spread coords. Tread carefully...
03909         DocRect ClipRect = pDocView->GetDocViewRect(pSpread);
03910         pSpread->DocCoordToSpreadCoord(&ClipRect);
03911 
03912         if (pCurrentDragOp != NULL)
03913             pCurrentDragOp->RenderDragBlobs(ClipRect, pSpread, pDocView->GetCurrentSolidDragState());
03914     }
03915 }

void ScreenView::ScrollTo const WorkCoord offset  )  [protected]
 

Scroll the client area of the window to the specified position. The offset must be converted to OS coordinates before being passed to Windows. If the new position of the view does not overlap the old position then the client area is completely redrawn. Otherwise, the Windows USER module is called to scroll the window.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
The position, in WorkCoords, that the top-left corner of the view is to [INPUTS] move to.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Private

See also:
ScreenView::SetScrollPos()

Reimplemented from CCamView.

Definition at line 1865 of file scrvw.cpp.

01866 {
01867     PORTNOTETRACE("other","ScreenView::ScrollTo - do nothing");
01868 #ifndef EXCLUDE_FROM_XARALX
01869     // Calculate the difference between where we are and where we want to be.  Notice
01870     // the asymmetry in the calculations, to account for the Windows coordinate origin
01871     // being in the top-left, not the bottom-left.
01872     FIXED16 PixelWidth, PixelHeight;
01873     pDocView->GetPixelSize(&PixelWidth, &PixelHeight);
01874     INT32 dx = ((offset.x - OldOffset.x) / PixelWidth.MakeLong() );
01875     INT32 dy = ((OldOffset.y - offset.y) / PixelHeight.MakeLong() );
01876     if (dx == 0 && dy == 0) return;
01877     
01878     // ZZZ
01879     
01880     
01881     // Scroll part of, or redraw the whole of, the client area.
01882     if (Abs(dx) >= CurrentSize.GetRight() || Abs(dy) >= CurrentSize.GetBottom() )
01883         GetCanvas()->Refresh( true );
01884     else
01885         GetCanvas()->ScrollWindow(-dx, -dy);
01886     
01887 // WEBSTER - markn 15/1/97
01888 // No rulers in Webster
01889 #ifndef WEBSTER
01890 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
01891     if(Status->RulersVisible)
01892     {
01893         if(HRuler)
01894             HRuler->ScrollRuler(-dx);
01895         if(VRuler)
01896             VRuler->ScrollRuler(-dy);
01897 
01898     }
01899 #endif
01900 #endif // WEBSTER
01901     // Remember this scroll offset, which corresponds to what will be drawn on the screen,
01902     // and force an immediate repaint of the invalid area.
01903     OldOffset = offset;
01904     GetCanvas()->UpdateWindow();
01905 
01906 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
01907     // Make sure that the system will update the state of gadgets after this, some of
01908     // which may now be "greyed" because what they apply to is no longer visible etc.
01909     // This is the best place to put this, as all scroll requests, whether they come
01910     // from the user or are internally generated, go through this function.
01911     DialogBarOp::SetSystemStateChanged(TRUE);
01912 #endif
01913 #endif
01914 }

static void ScreenView::SetDefaultRulersState BOOL  State  )  [inline, static]
 

Reimplemented from CCamView.

Definition at line 326 of file scrvw.h.

00326 { DefaultRulersState = State;};

static void ScreenView::SetDefaultScrollersState BOOL  State  )  [inline, static]
 

Reimplemented from CCamView.

Definition at line 327 of file scrvw.h.

00327 { DefaultScrollersState = State;};

void ScreenView::SetReadyMadeViewState ViewState pvs  )  [static]
 

Calls CCamView::Create() to attach a Windows object to the previously constructed C++ object. The view has a standard arrow cursor and a custom icon (_R(IDR_CAMTYPE)). The view is responsible for painting its background itself. The view is initially hidden, until its size and position have been properly set. Call this to set up a view-state object that ScreenView::OnInitialUpdate will use in preference to the one the ScreenView has got already. This is a nasty little "back-door" to changing the creation state of a ScreenView, used by the code that restores docs and views when the app starts. The reason we have to use code like this is that the Camelot doc/view architecture is NOT MFC.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/9/95
Parameters:
pvs pointer to a ViewState object [INPUTS]
See also:
ScreenView::OnInitialUpdate; LoadAppWindowState

Definition at line 470 of file scrvw.cpp.

00471 {
00472     pReadyMadeViewState = pvs;
00473 }

void ScreenView::SetScrollerStyle BOOL  proportional  ) 
 

Allows DocView to change the style - groovy or dull - of ScreenView's scroll bars. Records the setting and calls the appropriate functions of the scroll bar gadgets.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
A boolean which if TRUE means that proportional scroll bars should be turned [INPUTS] on, if FALSE that the scroll bars should look normal.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Public

See also:
ScreenView::GetScrollerStyle(); CScroller::SetProportional()

Definition at line 1959 of file scrvw.cpp.

01960 {
01961     if(!HScrollBar||!VScrollBar)
01962         return;
01963 
01964     ScrollerStyle = proportional;
01965     PORTNOTETRACE("other","ScreenView::SetScrollerStyle - do nothing");
01966 #ifndef EXCLUDE_FROM_XARALX
01967     HScrollBar->SetProportional(ScrollerStyle);
01968     VScrollBar->SetProportional(ScrollerStyle);
01969 #endif
01970 }

void ScreenView::SetScrollOffset const WorkCoord pos,
BOOL  redraw = TRUE
 

Changes the scroll offset in the horizontal and vertical scroll bar. Note that it DOES NOT immediately scroll the client area, which is only done when the scroll bars send back a WM_SCROLLEREVENT message to the ScreenView.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
The desired scroll offset, in WorkCoords, and a boolean indicating if [INPUTS] TRUE that the view window should be repainted immediately to reflect the change in scroll position.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Public

See also:
ScreenView::GetScrollOffset; CScroller::SetScrollPos(); ScreenView::OnScrollerEvent()

Reimplemented from CCamView.

Definition at line 2085 of file scrvw.cpp.

02086 {
02087 //  TRACE( _T("SV::SetScrollOffset(%d, %d)\n"), (INT32)(pos.x), (INT32)(pos.y));
02088     FIXED16 PixelWidth,PixelHeight;
02089     pDocView->GetPixelSize(&PixelWidth,&PixelHeight);
02090 
02091 //  INT32 sx = INT32((pos.x-WorkArea.lo.x)/PixelWidth .MakeDouble());
02092 //  INT32 sy = INT32((WorkArea.hi.y-pos.y)/PixelHeight.MakeDouble());
02093 //  TRACE( _T("Scrolling to (%d, %d)\n"), sx, sy);
02094 
02095     GetCanvas()->Scroll(
02096         INT32((pos.x-WorkArea.lo.x)/PixelWidth .MakeDouble()),
02097         INT32((WorkArea.hi.y-pos.y)/PixelHeight.MakeDouble())
02098     );
02099 
02100     // Neville 22/8/97
02101     // Somebody is setting the scroll position so make sure that this is set
02102     // Other calls to OnScrollerEvent can be filtered out completely so that a document
02103     // can load in completely but not had one single call to ScrollTo code allowed. Everything
02104     // looks ok but if you scroll slightly then becuase the OldOffset is wrong, usually 0,0,
02105     // a large redraw problem can occur OR the whole drawing will be redrawn needlessly.
02106     // This is called by the document loading code and so when it says it wants this scroll position
02107     // it is generally late enough in the loading process that the 'Fixes bug #1448.' comment
02108     // should have been sorted.
02109     fSetupDone = TRUE;
02110 }

void ScreenView::SetThisFromViewState  ) 
 

Move and resize the ScreenView according to the (device-independent) settings of a ViewState object. This typically happens when a new view is opened on a saved document.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Private

See also:
ScreenView::SetViewStateFromThis(); ScreenView::OnInitialUpdate()

Reimplemented from CCamView.

Definition at line 837 of file scrvw.cpp.

00838 {
00839     PORTNOTETRACE("other","ScreenView::SetThisFromViewState - do nothing");
00840 #ifndef EXCLUDE_FROM_XARALX
00841     // Get a pointer to this view's frame window.
00842     wxMDIChildFrame    *pframewnd = (wxMDIChildFrame *)GetParentFrame();
00843     //ENSURE(pframewnd != NULL, "Found a ScreenView without a frame window?!?");
00844 
00845     // Fill in a Windows placement structure with some converted positions from the
00846     // ViewState object, and set the placement of the parent frame window accordingly.
00847     WINDOWPLACEMENT wp;
00848     wp.length = sizeof(wp);
00849     wp.flags = WPF_SETMINPOSITION;
00850     wp.ptMaxPosition.x = wp.ptMaxPosition.y = 0;
00851 
00852     // Work out how to display the window, either as an icon, maximised, or just normal.
00853     // Note that it is possible for a maximised window to be iconised without being
00854     // restore first.
00855     if (Status->IsMinimised)
00856     {
00857         wp.showCmd = SW_SHOWMINIMIZED;              // display as an icon
00858         if (Status->IsMaximised)
00859         {
00860             wp.flags |= WPF_RESTORETOMAXIMIZED;     // go from icon to maximised
00861         }
00862     }
00863     else if (Status->IsMaximised)
00864     {
00865         wp.showCmd = SW_SHOWMAXIMIZED;              // display maximised
00866     }
00867     else
00868     {
00869         wp.showCmd = SW_SHOWNORMAL;                 // display normally
00870     }
00871 
00872     Coord2POINT(Status->IconPoint, &wp.ptMinPosition);
00873     Rect2RECT(Status->ViewRect, &wp.rcNormalPosition);
00874     
00875     //RALPH
00876     if(pframewnd)
00877         pframewnd->SetWindowPlacement(&wp);
00878     
00879     // Set the scroll offset.
00880     OldOffset = Status->GetScrollPos();
00881     SetScrollOffset(OldOffset);
00882 
00883     // Set the scale factor.
00884     pDocView->SetViewScale(Status->ViewScale);
00885 
00886     // If the view was "always on top" then fake a user selection of the appropriate
00887     // menu option.
00888     // RALPH
00889     if (Status->AlwaysOnTop && GetParentFrame())
00890     {
00891         GetParentFrame()->PostMessage(WM_SYSCOMMAND, _R(IDM_ALWAYSONTOP));
00892     }
00893 #endif
00894 }

static void ScreenView::SetUseVisibleDefaults BOOL  state  )  [inline, static]
 

Reimplemented from CCamView.

Definition at line 309 of file scrvw.h.

00309 { UseVisibleDefaults = state;};

void ScreenView::SetViewStateFromThis  )  const
 

Called by a virgin ScreenView, ie. a view onto a new, unedited document. The function reads the attributes of the view window from the operating system, converts them into a device- independent form, and stores them in the ViewState.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Private

See also:
ScreenView::OnInitialUpdate; ScreenView::SetThisFromViewState(); DocView::ViewStateChanged(); class ViewState

Reimplemented from CCamView.

Definition at line 789 of file scrvw.cpp.

00790 {
00791     // Set the current docview.
00792     pDocView->SetCurrent();
00793 
00794     // Set most of the ViewState according to the current state (the default) of this
00795     // ScreenView.
00796     UpdateViewPosition();
00797 
00798     // Make sure the scale factor is accurate.
00799     FIXED16 scale = pDocView->GetViewScale();
00800     if (scale != Status->ViewScale) Status->ViewScale = scale;
00801     
00802     // Record the current scroller position.
00803     WorkCoord temp;
00804     GetScrollOffset(&temp);
00805     Status->SetScrollPos(temp);
00806 
00807     if( NULL != GetParentFrame() )
00808     {
00809         // Record the top-most attribute of the frame window.
00810 PORTNOTE("other","Removed WM_TOPMOSTENQUIRY usage - is this really needed?")
00811 #ifndef EXCLUDE_FROM_XARALX
00812         Status->AlwaysOnTop = m_pFrame->SendMessage( WM_TOPMOSTENQUIRY );
00813 #endif
00814     }
00815 }

void ScreenView::SetWorkAreaExtent const WorkRect area,
BOOL  redraw = TRUE
 

Provides read-only access to the WorkAreaExtent, as maintained by DocView/ScreenView. Calculates the size of the RendWnd, setting the "page size" of the scroll bars accordingly. Sets the scroll range of the scroll bars to the size of the WorkAreaExtent (note that the Y range is negated and inverted - the mother of all bodges).

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
A WorkRect describing the new WorkAreaExtent, a boolean which if TRUE [INPUTS] means immediately repaint the view window to reflect the change.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Public

See also:
ScreenView::GetWorkAreaExtent(); CScroller::SetPageSize(); CScroller::SetScrollRange(); class CRendWnd

Reimplemented from CCamView.

Definition at line 2019 of file scrvw.cpp.

02020 {
02021     WorkArea = area;
02022     FIXED16 PixelWidth, PixelHeight;
02023     pDocView->GetPixelSize(&PixelWidth,&PixelHeight);
02024     // This doesn't give us a redraw flag.
02025     GetCanvas()->SetVirtualSize(
02026         INT32((area.hi.x-area.lo.x)/PixelWidth .MakeDouble()),
02027         INT32((area.hi.y-area.lo.y)/PixelHeight.MakeDouble())
02028     );
02029 }

BOOL ScreenView::ShouldEatClick  )  const
 

void ScreenView::ShowRulers BOOL  Show  ) 
 

Hide or Show Rulers.

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

Errors: -

See also:
-

Reimplemented from CCamView.

Definition at line 1320 of file scrvw.cpp.

01321 {
01322 // WEBSTER - markn 15/1/97
01323 // No rulers in Webster
01324 #ifndef WEBSTER
01325 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
01326     if(!VRuler||!HRuler)
01327         return;
01328 
01329     // Set flags and Show/Hide the Scrollers
01330     if(VRuler)
01331         VRuler->ShowRuler(Show);
01332     if(HRuler)
01333         HRuler->ShowRuler(Show);
01334 
01335     Status->RulersVisible = Show;
01336 
01337     // call OnSize directly to force new layout 
01338     CRect WRect;
01339     GetClientRect(&WRect);
01340     SendMessage(WM_SIZE, SIZE_RESTORED, MAKELPARAM(WRect.Width(), WRect.Height()));
01341 #endif
01342 #endif // WEBSTER
01343 }

void ScreenView::ShowScrollers BOOL  Show  ) 
 

Hide or Show Scrollers.

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

Errors: -

See also:
-

Reimplemented from CCamView.

Definition at line 1279 of file scrvw.cpp.

01280 {
01281     PORTNOTETRACE("other","ScreenView::ShowScrollers - do nothing");
01282 #ifndef EXCLUDE_FROM_XARALX
01283     // Set flags and Show/Hide the Scrollers
01284     if (Show)
01285     {
01286         VScrollBar->ShowWindow(SW_SHOW);
01287         HScrollBar->ShowWindow(SW_SHOW);
01288     }
01289     else
01290     {
01291         Status->ScrollersVisible = FALSE;
01292         VScrollBar->ShowWindow(SW_HIDE);
01293         HScrollBar->ShowWindow(SW_HIDE);
01294     }
01295 
01296     Status->ScrollersVisible = Show;
01297 
01298     // call OnSize directly to force new layout 
01299     wxRect              WRect;
01300     GetClientRect(&WRect);
01301     SendMessage(WM_SIZE, SIZE_RESTORED, MAKELPARAM(WRect.Width(), WRect.Height())); */
01302 #endif
01303 }

BOOL ScreenView::StartDrag Operation pOp,
DragType  type,
BOOL  KeepAccuracy
 

Begins a drag operation, from the point of view of the OIL layer. Unbounds the mouse cursor, so it can go off-screen (display driver permitting). Captures all mouse input, to guarantee that the drag being started will terminate properly at some time in the future. Sets some internal variables indicating that ScreenView is in "drag mode". Finally, asks the system for a timer which is used to generate "idle" mouse events.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
A pointer to the current (drag) Operation; the type of the drag. [INPUTS]
- [OUTPUTS]
Returns:
Returns TRUE if successful. Returns FALSE if a timer couldn't be allocated.

Errors: ASSERTion failure if the ScreenView is already dragging. Scope: Public

See also:
ScreenView::EndDrag(); ScreenView::HandleDragEvent();

Reimplemented from CCamView.

Definition at line 2887 of file scrvw.cpp.

02888 {
02889     ENSURE( pCurrentDragOp == 0, "ScreenView::StartDrag: pCurrentDragOp is not zero");
02890     
02891     // This has been commented out as some screen drivers can not handle the mouse drifting
02892     // off the top of the screen.
02893     // Unbound mouse from the screen and set the current drag operation.  Note that under
02894     // Win32 raw mouse coordinates change from being 16-bit INTs to 16-bit SHORTs.
02895     //WinRect unbound(SHRT_MIN / 4, SHRT_MIN / 4, SHRT_MAX / 4, SHRT_MAX / 4);
02896     //::GetClipCursor(&MouseClipRect);
02897     //::ClipCursor(&unbound);
02898     GetCanvas()->CaptureMouse();
02899 
02900     // Remember what kind of drag we are performing.
02901     pCurrentDragOp = pOp;
02902     CurrentDragType = type;
02903     OLERecaptureMouse = FALSE;
02904     DragKeepAccuracy = KeepAccuracy;
02905     AutoScrollExcludeRulers = FALSE;
02906     m_OLELastOutTime.Sample();
02907     return TRUE;
02908 }

void ScreenView::UpdateViewPosition  )  const [protected]
 

Updates the ViewState object shared between this ScreenView and its associated DocView with the new size of the view etc.

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

Errors: -

See also:
-

Reimplemented from CCamView.

Definition at line 912 of file scrvw.cpp.

00913 {
00914     PORTNOTETRACE("other","ScreenView::UpdateViewPosition - do nothing");
00915 #ifndef EXCLUDE_FROM_XARALX
00916     ENSURE(Status != NULL, "No ViewState object in ScreenView::UpdateViewPosition!");
00917 
00918     // Get the size of the screen.  We don't use this for anything, but I'm afraid to
00919     // take it out in case something breaks!
00920     // LH 31/08/2005 - Removed, if something breaks I'll revisit!
00921     wxRect              rc;
00922 //  GetDesktopWindow()->GetWindowRect( &rc );
00923 //  RECT2Rect(rc, &Status->ScreenRect);
00924 
00925     wxFrame            *pframewnd = GetParentFrame();
00926 
00927     if(pframewnd)
00928     {
00929         // Get the rectangle of the parent's MDICLIENT window.  All child window sizes and
00930         // positions are calculated as relative to this.  This is more accurate than just
00931         // taking the size of the main frame window as a whole, including menus, title bar etc.
00932         GetMainFrame()->GetClientSize( &rc.width, &rc.height );
00933         RECT2Rect(rc, &Status->ParentRect);
00934     }
00935 
00936     // Get the placement information for this view (MDI child) window.  Note
00937     // that because it is a child window, the position is taken relative to the
00938     // client area of its parent.
00939     WINDOWPLACEMENT wp;
00940     wp.length = sizeof(wp);
00941     
00942     
00943     //ENSURE(pframewnd != NULL, "Found a ScreenView without a frame window?!?");
00944     if(pframewnd)
00945         pframewnd->GetWindowPlacement(&wp);
00946 
00947     // Fill in the ViewState with the position of the normal and iconised
00948     // window.  The maximised position of the window does not need to be
00949     // stored as it always fills the whole MDI client area of its parent.
00950     RECT2Rect(wp.rcNormalPosition, &Status->ViewRect);
00951     POINT2Coord(wp.ptMinPosition, &Status->IconPoint);
00952 
00953     // Update the mini/maxi flags.  Note that it is possible for IsMinised and IsMaximised
00954     // to both be TRUE, if a maximised window has been iconised (but NOT if an iconised
00955     // window has been maximised!).
00956     if (wp.showCmd == SW_SHOWMINIMIZED)
00957     {
00958         Status->IsMinimised = TRUE;
00959     }
00960     else if (wp.showCmd == SW_SHOWMAXIMIZED)
00961     {
00962         Status->IsMinimised = FALSE;
00963         Status->IsMaximised = TRUE;
00964     }
00965     else // must be SW_SHOWNORMAL, ie. "restored"
00966     {
00967         Status->IsMinimised = Status->IsMaximised = FALSE;
00968     }
00969 #endif
00970 }


Member Data Documentation

BOOL ScreenView::AutoScrollExcludeRulers [protected]
 

Reimplemented from CCamView.

Definition at line 340 of file scrvw.h.

CScrollerCorner* ScreenView::Corner [protected]
 

Reimplemented from CCamView.

Definition at line 284 of file scrvw.h.

DragType ScreenView::CurrentDragType [protected]
 

Reimplemented from CCamView.

Definition at line 353 of file scrvw.h.

wxPoint ScreenView::CurrentMousePos [protected]
 

Reimplemented from CCamView.

Definition at line 346 of file scrvw.h.

WinRect ScreenView::CurrentSize [protected]
 

Reimplemented from CCamView.

Definition at line 294 of file scrvw.h.

BOOL ScreenView::DefaultRulersState = FALSE [static, protected]
 

Reimplemented from CCamView.

Definition at line 302 of file scrvw.h.

BOOL ScreenView::DefaultScrollersState = TRUE [static, protected]
 

Reimplemented from CCamView.

Definition at line 301 of file scrvw.h.

INT32 ScreenView::DragDelay = 500 [static, protected]
 

Reimplemented from CCamView.

Definition at line 334 of file scrvw.h.

BOOL ScreenView::DragKeepAccuracy [protected]
 

Reimplemented from CCamView.

Definition at line 338 of file scrvw.h.

INT32 ScreenView::DragLatency = 3 [static, protected]
 

This function is called whenever the joystick moves. It is used currently to set the Pretend Pen Pressure from the joystick position. This function only exists under Win32.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/6/94
Parameters:
The Joystick position and button states [INPUTS]
- [OUTPUTS]
Returns:
Returns 0, indicating to Windows that the message has been processed successfully.

Errors: - Scope: Protected

See also:
ScreenView::OnKeyDown()

Reimplemented from CCamView.

Definition at line 327 of file scrvw.h.

BOOL ScreenView::DragOpInvoke [protected]
 

Reimplemented from CCamView.

Definition at line 397 of file scrvw.h.

String_256 ScreenView::DragOpToken [protected]
 

Reimplemented from CCamView.

Definition at line 395 of file scrvw.h.

MonotonicTime ScreenView::DragTimer [static, protected]
 

Reimplemented from CCamView.

Definition at line 336 of file scrvw.h.

bool ScreenView::fInitialUpdate [protected]
 

Reimplemented from CCamView.

Definition at line 239 of file scrvw.h.

UINT32 ScreenView::FirstClickButton [protected]
 

Reimplemented from CCamView.

Definition at line 350 of file scrvw.h.

BOOL ScreenView::fJustCreated [protected]
 

Reimplemented from CCamView.

Definition at line 240 of file scrvw.h.

BOOL ScreenView::fSetupDone [protected]
 

Reimplemented from CCamView.

Definition at line 238 of file scrvw.h.

OILHorizontalRuler* ScreenView::HRuler [protected]
 

Reimplemented from CCamView.

Definition at line 289 of file scrvw.h.

CWinScroller* ScreenView::HScrollBar [protected]
 

Reimplemented from CCamView.

Definition at line 279 of file scrvw.h.

UINT32 ScreenView::LastClickButton [protected]
 

Reimplemented from CCamView.

Definition at line 344 of file scrvw.h.

ClickModifiers ScreenView::LastClickMods [protected]
 

Reimplemented from CCamView.

Definition at line 347 of file scrvw.h.

wxPoint ScreenView::LastClickPoint [protected]
 

Reimplemented from CCamView.

Definition at line 345 of file scrvw.h.

ClickType ScreenView::LastClickType [protected]
 

Reimplemented from CCamView.

Definition at line 343 of file scrvw.h.

wxPoint ScreenView::LastDoubleClickPos [protected]
 

Reimplemented from CCamView.

Definition at line 454 of file scrvw.h.

MonotonicTime ScreenView::m_OLELastOutTime [protected]
 

Reimplemented from CCamView.

Definition at line 366 of file scrvw.h.

WinRect ScreenView::MouseClipRect [protected]
 

Reimplemented from CCamView.

Definition at line 354 of file scrvw.h.

OriginGadget* ScreenView::OGadget [protected]
 

Reimplemented from CCamView.

Definition at line 291 of file scrvw.h.

WorkCoord ScreenView::OldOffset [protected]
 

Reimplemented from CCamView.

Definition at line 296 of file scrvw.h.

BOOL ScreenView::OLERecaptureMouse [protected]
 

Reimplemented from CCamView.

Definition at line 356 of file scrvw.h.

Operation* ScreenView::pCurrentDragOp [protected]
 

Reimplemented from CCamView.

Definition at line 352 of file scrvw.h.

OpParam* ScreenView::pDragOpParam [protected]
 

Reimplemented from CCamView.

Definition at line 396 of file scrvw.h.

INT32 ScreenView::PopCount [static, protected]
 

Reimplemented from CCamView.

Definition at line 207 of file scrvw.h.

ViewState* ScreenView::pReadyMadeViewState [static, protected]
 

Reimplemented from CCamView.

Definition at line 208 of file scrvw.h.

BOOL ScreenView::PropScrollersOn = TRUE [static, protected]
 

Definition at line 299 of file scrvw.h.

BOOL ScreenView::ScrollerStyle [protected]
 

Definition at line 298 of file scrvw.h.

BOOL ScreenView::ThisDoubleIsQuad [protected]
 

Reimplemented from CCamView.

Definition at line 456 of file scrvw.h.

BOOL ScreenView::ThisSingleIsTriple [protected]
 

Reimplemented from CCamView.

Definition at line 455 of file scrvw.h.

MonotonicTime ScreenView::TimeOfLastClick [protected]
 

Reimplemented from CCamView.

Definition at line 453 of file scrvw.h.

BOOL ScreenView::UnzoomOnNewView = FALSE [static, protected]
 

Definition at line 235 of file scrvw.h.

BOOL ScreenView::UseVisibleDefaults = TRUE [static, protected]
 

Reimplemented from CCamView.

Definition at line 303 of file scrvw.h.

OILVerticalRuler* ScreenView::VRuler [protected]
 

Reimplemented from CCamView.

Definition at line 290 of file scrvw.h.

CWinScroller* ScreenView::VScrollBar [protected]
 

Reimplemented from CCamView.

Definition at line 280 of file scrvw.h.

WorkRect ScreenView::WorkArea [protected]
 

Reimplemented from CCamView.

Definition at line 295 of file scrvw.h.

BOOL ScreenView::ZoomSingleView = TRUE [static, protected]
 

Definition at line 236 of file scrvw.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:43 2007 for Camelot by  doxygen 1.4.4