00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 #ifndef INC_SCRVW
00102 #define INC_SCRVW
00103
00104 #include "camview.h"
00105
00106
00107
00108
00109 #include "rendwnd.h"
00110 #include "wrkrect.h"
00111
00112
00113 #ifdef _DEBUG
00114
00115
00116 #define WM_DESCRIBEVIEW (WM_USER + 101)
00117 #endif
00118
00119 enum ObjectDragTarget
00120 {
00121 NO_TARGET,
00122 FILL_TARGET,
00123 LINE_TARGET,
00124 STARTCOL_TARGET,
00125 ENDCOL_TARGET,
00126 ENDCOL2_TARGET,
00127 ENDCOL3_TARGET,
00128 MANY_TARGET
00129 };
00130
00131 enum MouseOverRulerHit
00132 {
00133 OVER_NO_RULERS,
00134 OVER_HORIZONTAL,
00135 OVER_VERTICAL,
00136 OVER_ORIGIN_GADGET
00137 };
00138
00139
00140 #ifndef WEBSTER
00141 class CCPrintInfo;
00142 #endif //webster
00143 class PrintControl;
00144 class OILHorizontalRuler;
00145 class OILVerticalRuler;
00146 class OriginGadget;
00147 class CWinScroller;
00148 class CObject;
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162 class ScreenView : public CCamView
00163 {
00165
00166 protected:
00167 class ScreenCanvas :
00168 public CCamView::CCamCanvas
00169 {
00170 public:
00171 ScreenCanvas( wxView *v, wxMDIChildFrame *frame, const wxPoint& pos, const wxSize& size,
00172 long style ) : CCamCanvas( v, frame, pos, size, style )
00173 {
00174 }
00175
00177
00178 protected:
00179 void OnSize( wxSizeEvent &event );
00180 void OnLButtonDown( wxMouseEvent &event );
00181 void OnLButtonDblClk( wxMouseEvent &event );
00182 void OnLButtonUp( wxMouseEvent &event );
00183 void OnMButtonDown( wxMouseEvent &event );
00184 void OnMButtonDblClk( wxMouseEvent &event );
00185 void OnMButtonUp( wxMouseEvent &event );
00186 void OnRButtonDown( wxMouseEvent &event );
00187 void OnRButtonDblClk( wxMouseEvent &event );
00188 void OnRButtonUp( wxMouseEvent &event );
00189 void OnMouseMove( wxMouseEvent &event );
00190 void OnMouseWheel( wxMouseEvent &event );
00191
00192 private:
00193 DECLARE_EVENT_TABLE()
00194 };
00195
00196
00197 virtual CCamCanvas* CreateCanvas( wxView *v, wxMDIChildFrame *frame, const wxPoint& pos,
00198 const wxSize& size, long style )
00199 {
00200 return new ScreenCanvas( v, frame, pos, size, style );
00201 }
00202
00204
00205
00206 protected:
00207 static INT32 PopCount;
00208 static ViewState* pReadyMadeViewState;
00209
00210 public:
00211 ScreenView();
00212 virtual ~ScreenView();
00213
00214 void SetViewStateFromThis() const;
00215 void SetThisFromViewState();
00216
00217 static BOOL ReadViewPrefs();
00218 static INT32 HowMany();
00219
00220 static DocView* GetDocViewFromHwnd( wxWindow *hwnd );
00221 static DocView* GetDocViewFromWindowID(CWindowID WinID);
00222
00223 virtual BOOL IsScreenView() { return TRUE; }
00224
00225 MouseOverRulerHit IsMouseOverRuler();
00226
00227
00228
00229 static void SetReadyMadeViewState(ViewState* pvs);
00230
00232
00233
00234 protected:
00235 static BOOL UnzoomOnNewView;
00236 static BOOL ZoomSingleView;
00237
00238 BOOL fSetupDone;
00239 bool fInitialUpdate;
00240 BOOL fJustCreated;
00241
00242 void UpdateViewPosition() const;
00243
00244 protected:
00245 virtual void OnInitialUpdate();
00246 virtual void OnUpdate(wxView* sender, wxObject* hint=(wxObject*)NULL);
00247 virtual void OnActivateView(bool bActivate, wxView* pActiveView,
00248 wxView* pDeactiveView);
00249
00250 public:
00251 BOOL IsTopmost() const;
00252 BOOL ShouldEatClick() const;
00253 void ClearEatFlag();
00254
00255
00257
00258
00259
00260
00261
00262 public:
00263 wxDC* GetRenderDC() const;
00264 wxWindow* GetRenderWindow() const;
00265
00266 virtual void GetClientSize(int * width, int * height) const;
00267 void InvalidateView(const OilRect* pRect = 0, BOOL updatenow = FALSE);
00268
00269 virtual void OnDraw( wxDC *pDc );
00270 PORTNOTE("other","Removed OnPreparePrinting - not supported yet")
00271 #ifndef EXCLUDE_FROM_XARALX
00272 virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
00273 #endif
00274
00276
00277
00278 protected:
00279 CWinScroller* HScrollBar;
00280 CWinScroller* VScrollBar;
00281
00282 PORTNOTE("other","Removed CScrollerCorner usage")
00283 #ifndef EXCLUDE_FROM_XARALX
00284 CScrollerCorner* Corner;
00285 #endif
00286
00287
00288 #ifndef WEBSTER
00289 OILHorizontalRuler * HRuler;
00290 OILVerticalRuler * VRuler;
00291 OriginGadget * OGadget;
00292 #endif //wesbter
00293
00294 WinRect CurrentSize;
00295 WorkRect WorkArea;
00296 WorkCoord OldOffset;
00297
00298 BOOL ScrollerStyle;
00299 static BOOL PropScrollersOn;
00300
00301 static BOOL DefaultScrollersState;
00302 static BOOL DefaultRulersState;
00303 static BOOL UseVisibleDefaults;
00304
00305 void ScrollTo(const WorkCoord& offset);
00306
00307 public:
00308
00309 static void SetUseVisibleDefaults(BOOL state){ UseVisibleDefaults = state;};
00310 BOOL GetScrollerStyle() const;
00311 void SetScrollerStyle(BOOL proportional);
00312
00313
00314 void SetWorkAreaExtent(const WorkRect& area, BOOL redraw = TRUE);
00315 void GetScrollOffset(WorkCoord* pOffset) const;
00316 void SetScrollOffset(const WorkCoord& pos, BOOL redraw = TRUE);
00317 void ShowScrollers(BOOL Show);
00318 void ShowRulers(BOOL Show);
00319
00320 BOOL AreRulersVisible();
00321 BOOL AreScrollersVisible();
00322
00323 static BOOL GetUseVisibleDefaults() { return UseVisibleDefaults;};
00324 static BOOL GetDefaultRulersState() { return DefaultRulersState;};
00325 static BOOL GetDefaultScrollersState() { return DefaultScrollersState;};
00326 static void SetDefaultRulersState(BOOL State) { DefaultRulersState = State;};
00327 static void SetDefaultScrollersState(BOOL State) { DefaultScrollersState = State;};
00328
00330
00331
00332 protected:
00333 static INT32 DragLatency;
00334 static INT32 DragDelay;
00335
00336 static MonotonicTime DragTimer;
00337
00338 BOOL DragKeepAccuracy;
00339
00340 BOOL AutoScrollExcludeRulers;
00341
00342
00343 ClickType LastClickType;
00344 UINT32 LastClickButton;
00345 wxPoint LastClickPoint;
00346 wxPoint CurrentMousePos;
00347 ClickModifiers LastClickMods;
00348
00349
00350 UINT32 FirstClickButton;
00351
00352 Operation* pCurrentDragOp;
00353 DragType CurrentDragType;
00354 WinRect MouseClipRect;
00355
00356 BOOL OLERecaptureMouse;
00357
00358
00359 void HandleDragEvent(UINT32 Button, wxMouseEvent &event, ClickType t);
00360 BOOL HandleMouseWheelEvent( wxMouseEvent &event );
00361 void HandleDragScrolling(wxPoint point);
00362 void CalcScrollDeltas(wxPoint point, WinRect wrSize, INT32* dx, INT32* dy);
00363 void HandleButtonUp(UINT32 Button, wxMouseEvent &event);
00364 virtual void HandleOleDragOutOfView(wxPoint point);
00365
00366 MonotonicTime m_OLELastOutTime;
00367
00368 public:
00369 void RecaptureMouseOnNextUpdate(void);
00370
00371 static void GetClickMods( wxMouseEvent &event, ClickModifiers *p );
00372 BOOL StartDrag(Operation* pOp, DragType type, BOOL KeepAccuracy);
00373 BOOL EndDrag(Operation* pOp);
00374 BOOL ChangeDragType(DragType Type);
00375 void ClearClickState();
00376
00377
00378
00379
00380
00381 BOOL InvokeDragOp(String_256* pOpToken,OpParam* pParam,UINT32 Flags,wxPoint point);
00382
00383
00384 BOOL IsWaitingMouseMove();
00385
00386
00387
00388 BOOL GetCurrentMousePos(OilCoord* pMousePos) const;
00389
00390
00391 BOOL CreateDragTarget(DragInformation * DragInfo);
00392
00393 protected:
00394
00395 String_256 DragOpToken;
00396 OpParam* pDragOpParam;
00397 BOOL DragOpInvoke;
00398
00400
00401
00402 #if (_OLE_VER >= 0x200)
00403
00404
00405
00406
00407
00408
00409
00410
00411 public:
00412 CCamCntrItem* m_pSelection;
00413 #endif
00414
00415 public:
00416 virtual BOOL IsSelected(const CObject* pDocItem) const;
00417
00418
00419
00421
00422
00423 public:
00424
00425 #ifndef WEBSTER
00426 PORTNOTE("other","Removed OnFilePrint - printing support")
00427 #ifndef EXCLUDE_FROM_XARALX
00428 void OnFilePrint();
00429 #endif
00430 #endif //webster
00431 void OnFilePrintPreview();
00432
00433 DocView* GetDocViewPtr() const;
00434
00435
00436 #ifndef WEBSTER
00437
00438 protected:
00439
00440 BOOL PrintPaper(wxDC *pPrintDC, CCPrintInfo *pPrintInfo, PrintControl *pPrintControl);
00441 WinRect GetPrintClipRect(wxDC *pPrintDC, CCPrintInfo *pPrintInfo);
00442 void EnumeratePagePatches(CCPrintInfo *pPrintInfo);
00443
00444 #endif //webster
00445
00446
00447
00448 public:
00449 BOOL IsSingleClickReallyTriple() const {return ThisSingleIsTriple;}
00450 BOOL IsSingleClickReallyQuad() const {return ThisDoubleIsQuad;}
00451
00452 protected:
00453 MonotonicTime TimeOfLastClick;
00454 wxPoint LastDoubleClickPos;
00455 BOOL ThisSingleIsTriple;
00456 BOOL ThisDoubleIsQuad;
00457
00458 DECLARE_DYNAMIC_CLASS( ScreenView )
00459 DECLARE_EVENT_TABLE()
00460
00461 void OnSize( wxSizeEvent &event );
00462 void OnLButtonDown( wxMouseEvent &event );
00463 void OnLButtonDblClk( wxMouseEvent &event );
00464 void OnLButtonUp( wxMouseEvent &event );
00465 void OnMButtonDown( wxMouseEvent &event );
00466 void OnMButtonDblClk( wxMouseEvent &event );
00467 void OnMButtonUp( wxMouseEvent &event );
00468 void OnRButtonDown( wxMouseEvent &event );
00469 void OnRButtonDblClk( wxMouseEvent &event );
00470 void OnRButtonUp( wxMouseEvent &event );
00471 void OnMouseMove( wxMouseEvent &event );
00472 void OnMouseWheel( wxMouseEvent &event );
00473
00474 PORTNOTE("other","Removed MessageMap - hopefully very temporarily")
00475 #ifndef EXCLUDE_FROM_XARALX
00476
00477 afx_msg void OnDropFiles(HDROP hDropInfo);
00478 afx_msg INT32 OnMouseActivate(wxWindow* pDesktopWnd, UINT32 nHitTest, UINT32 nMessage);
00479 afx_msg void OnTimer(UINT32 nIDEvent);
00480 afx_msg void OnCancelMode();
00481 afx_msg void OnInsertObject();
00482 afx_msg void OnPaint();
00483 afx_msg BOOL OnSetCursor(wxWindow* pWnd, UINT32 nHitTest, UINT32 nMessage);
00484 afx_msg LRESULT OnScrollerEvent(WPARAM wp, LPARAM lp);
00485 #ifdef WIN32
00486 afx_msg LRESULT OnJoystickMove(WPARAM wp, LPARAM lp);
00487 #endif
00488 afx_msg LRESULT OnRenderView(WPARAM wp, LPARAM lp);
00489 afx_msg LRESULT OnFrameMove(WPARAM x, LPARAM y);
00490 #if (_OLE_VER >= 0x200)
00491 afx_msg void OnSetFocus(wxWindow* pOldWnd);
00492 afx_msg void OnCancelEdit();
00493 #endif
00494 #ifdef _DEBUG
00495 afx_msg LRESULT OnDescribeView(WPARAM, LPARAM);
00496 #endif
00497 afx_msg void OnVScroll( UINT32 nSBCode, UINT32 nPos, CScrollBar* pScrollBar ) ;
00498 afx_msg void OnHScroll( UINT32 nSBCode, UINT32 nPos, CScrollBar* pScrollBar ) ;
00499 }}AFX_MSG
00500
00501 DECLARE_MESSAGE_MAP()
00502 #endif
00503 };
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517 class PageDropInfo : public CCObject
00518 {
00519 CC_DECLARE_DYNCREATE(PageDropInfo)
00520
00521 public:
00522 Document* pDoc;
00523 DocView* pDocView;
00524 Spread* pSpread;
00525 DocCoord DropPos;
00526
00527 ObjectDragTarget TargetHit;
00528 NodeRenderableInk* pObjectHit;
00529 };
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553 PORTNOTE("other","Removed ViewDragTarget - WinoilDragTarget usage")
00554 #ifndef EXCLUDE_FROM_XARALX
00555 class ViewDragTarget : public WinoilDragTarget
00556 {
00557 friend class DragManagerOp;
00558 friend class ColourDragInformation;
00559
00560 CC_DECLARE_DYNAMIC(ViewDragTarget)
00561
00562
00563 public:
00564
00565 ViewDragTarget( wxWindow *TheWindow, CRect *ClientArea = NULL, DragInformation* pDragInfo = NULL);
00566
00567 virtual UINT32 GetCursorID();
00568 virtual BOOL GetStatusLineText(String_256 * TheText);
00569
00570 virtual BOOL GetDropInfo(PageDropInfo*);
00571
00572 protected:
00573
00574
00575 BOOL ProcessEvent(DragEventType Event,
00576 DragInformation *pDragInfo,
00577 wxPoint *pMousePos, KeyPress* pKeyPress);
00578
00579 DragInformation* pCurrentDragInfo;
00580
00581 BOOL OverOutline;
00582 INT32 LineRad;
00583
00584 DocView* pThisDoc;
00585 Spread* pSpread;
00586 DocCoord DropPos;
00587
00588 ObjectDragTarget OverTarget;
00589 NodeRenderableInk* OverNode;
00590 };
00591 #endif
00592
00593 #endif // INC_SCRCAMVW