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 #ifndef INC_CAMVIEW_H
00099 #define INC_CAMVIEW_H
00100
00101
00102
00103
00104
00105 #include "wrkrect.h"
00106
00107
00108 #include "wx/dnd.h"
00109
00110
00111 class CRenderWnd;
00112 class CWinScroller;
00113 class CScrollerCorner;
00114 class OILHorizontalRuler;
00115 class OILVerticalRuler;
00116 class OriginGadget;
00117 class PrintView;
00118 class DocView;
00119 class ViewState;
00120 class CCPrintInfo;
00121 class PrintControl;
00122 class Rect;
00123
00124 enum MouseOverRulerHit
00125 {
00126 OVER_NO_RULERS,
00127 OVER_HORIZONTAL,
00128 OVER_VERTICAL,
00129 OVER_ORIGIN_GADGET
00130 };
00131
00132
00133 #define ReflectIntoView( Class, ViewClass, Handler, Type ) void Class::Handler( Type& event ) \
00134 { ((ViewClass*)m_pView)->Handler( event ); }
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157 class CCamView : public wxView
00158 {
00159
00161
00162
00163 public:
00164 CCamView();
00165 virtual ~CCamView();
00166
00167 virtual bool OnCreate( wxDocument* doc, long flags );
00168 bool OnClose( bool deleteWindow = TRUE );
00169
00170 wxMDIChildFrame *GetParentFrame() const
00171 {
00172 return m_pFrame;
00173 }
00174
00175 static BOOL ReadViewPrefs();
00176
00178
00179
00180
00181 protected:
00182 void GrabKernelAttention() const;
00183 void SetCurrentStates();
00184 virtual BOOL CreateNewDocView();
00185 virtual BOOL IsARalphView(){ return FALSE;};
00186
00187 public:
00188 CCamDoc *GetDocument() const;
00189 ViewState *GetViewState() const;
00190 ViewState *SetViewState( ViewState *pvs );
00191
00192 void SetViewStateFromThis() const;
00193 void SetThisFromViewState();
00194
00195
00196 public:
00197 BOOL IsTopmost() const;
00198
00200
00201
00202 public:
00203 virtual CNativeDC *GetRenderDC() const;
00204 virtual void AllocateDC() const;
00205 virtual void DoneWithDC() const;
00206 void GetClientSize( int * width, int * height) const;
00207
00208 virtual void OnDraw( wxDC *pDc );
00209 PORTNOTE("printing", "Disabled CCamView::OnPreparePrinting")
00210 #ifndef EXCLUDE_FROM_XARALX
00211 virtual BOOL OnPreparePrinting( CCPrintInfo *pInfo );
00212 #endif
00213
00215
00216
00217 public:
00218 virtual void OnFilePrint();
00219 virtual void OnFilePrintPreview();
00220
00221 public:
00222 CRenderWnd* GetRenderWindow() const { return(RenderWindow); }
00223 void InvalidateView(const OilRect* pRect = 0, BOOL updatenow = FALSE);
00224
00225 private:
00226 DECLARE_DYNAMIC_CLASS(CCamView)
00227 DECLARE_EVENT_TABLE()
00228
00229 public:
00230 void OnSize( wxSizeEvent &event );
00231 void OnLButtonDown( wxMouseEvent &event );
00232 void OnLButtonDblClk( wxMouseEvent &event );
00233 void OnLButtonUp( wxMouseEvent &event );
00234 void OnMButtonDown( wxMouseEvent &event );
00235 void OnMButtonDblClk( wxMouseEvent &event );
00236 void OnMButtonUp( wxMouseEvent &event );
00237 void OnRButtonDown( wxMouseEvent &event );
00238 void OnRButtonDblClk( wxMouseEvent &event );
00239 void OnRButtonUp( wxMouseEvent &event );
00240 void OnMouseMove( wxMouseEvent &event );
00241 void OnMouseWheel( wxMouseEvent &event );
00242 void OnScroll( wxScrollEvent &event);
00243 void OnDragIdle( wxTimerEvent &event);
00244
00245 void OnSetCursor( wxSetCursorEvent& event );
00246
00247 bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
00248
00249 protected:
00250 LRESULT OnRenderView( WPARAM wp, LPARAM lp );
00251 void ScrollTo(const WorkCoord& offset);
00252 void ScrollBy(INT32 dx, INT32 dy);
00253
00254 public:
00255 static DocView* GetDocViewFromWindow(wxWindow* pWindow);
00256 static void SetUseVisibleDefaults(BOOL state){ UseVisibleDefaults = state;};
00257
00258
00259 void SetWorkAreaExtent(const WorkRect& area, BOOL redraw = TRUE);
00260 void GetScrollOffset(WorkCoord* pOffset) const;
00261 void SetScrollOffset(const WorkCoord& pos, BOOL redraw = TRUE);
00262 void ShowScrollers(BOOL Show);
00263 void ShowRulers(BOOL Show);
00264 WorkRect GetMaxScrollRect() const;
00265
00266 BOOL AreRulersVisible();
00267 BOOL AreScrollersVisible();
00268 MouseOverRulerHit IsMouseOverRuler();
00269
00270 static BOOL GetUseVisibleDefaults() { return UseVisibleDefaults;};
00271 static BOOL GetDefaultRulersState() { return DefaultRulersState;};
00272 static BOOL GetDefaultScrollersState() { return DefaultScrollersState;};
00273 static void SetDefaultRulersState(BOOL State) { DefaultRulersState = State;};
00274 static void SetDefaultScrollersState(BOOL State) { DefaultScrollersState = State;};
00275
00277
00278
00279 protected:
00280
00281 void HandleDragEvent(UINT32 Button, UINT32 nFlags, wxPoint point, ClickType t);
00282 void HandleDragEvent(UINT32 Button, ClickModifiers clickmods, wxPoint point, ClickType t);
00283 BOOL HandleMouseWheelEvent( wxMouseEvent &event );
00284 void HandleDragScrolling(wxPoint point);
00285 void CalcScrollDeltas(wxPoint point, WinRect wrSize, INT32* dx, INT32* dy);
00286 void HandleButtonUp(UINT32 Button, wxMouseEvent &event);
00287
00288
00289
00290 public:
00291 void RecaptureMouseOnNextUpdate(void);
00292
00293 static void GetClickMods( wxMouseEvent &event, ClickModifiers *p );
00294 BOOL StartDrag(Operation* pOp, DragType type, BOOL KeepAccuracy);
00295 BOOL EndDrag(Operation* pOp);
00296 BOOL ChangeDragType(DragType Type);
00297 void ClearClickState();
00298
00299
00300
00301
00302
00303 BOOL InvokeDragOp(String_256* pOpToken,OpParam* pParam,UINT32 Flags,wxPoint point);
00304 BOOL InvokeDragOp(String_256* pOpToken,OpParam* pParam,ClickModifiers clickmods,wxPoint point);
00305
00306
00307 BOOL IsWaitingMouseMove();
00308
00309
00310
00311 BOOL GetCurrentMousePos(OilCoord* pMousePos) const;
00312
00313 BOOL CreateDragTarget(DragInformation * DragInfo);
00314
00315
00316 public:
00317 DocView* GetDocViewPtr() const
00318 {
00319 return pDocView;
00320 }
00321
00322
00323 protected:
00324
00325 BOOL PrintPaper(wxDC *pPrintDC, CCPrintInfo *pPrintInfo, PrintControl *pPrintControl);
00326 WinRect GetPrintClipRect(wxDC *pPrintDC, CCPrintInfo *pPrintInfo);
00327 void EnumeratePagePatches(CCPrintInfo *pPrintInfo);
00328
00329
00330 void UpdateViewPosition() const;
00331
00332 protected:
00333 virtual void OnInitialUpdate();
00334 virtual void OnUpdate(wxView* sender, wxObject* hint=(wxObject*)NULL);
00335 virtual void OnActivateView(bool bActivate, wxView* pActiveView,
00336 wxView* pDeactiveView);
00337
00339
00340
00341 public:
00342 BOOL IsSingleClickReallyTriple() const {return ThisSingleIsTriple;}
00343 BOOL IsSingleClickReallyQuad() const {return ThisDoubleIsQuad;}
00344
00345
00346 protected:
00347 wxMDIChildFrame* m_pFrame;
00348 CRenderWnd* RenderWindow;
00349 CWinScroller* HScrollBar;
00350 CWinScroller* VScrollBar;
00351 CScrollerCorner* Corner;
00352 OILHorizontalRuler* HRuler;
00353 OILVerticalRuler* VRuler;
00354 OriginGadget* OGadget;
00355
00356 DocView *pDocView;
00357 PrintView *pPrintView;
00358 ViewState *Status;
00359
00360 BOOL fSetupDone;
00361 BOOL fInitialUpdate;
00362 BOOL fJustCreated;
00363
00364 WinRect CurrentSize;
00365 WorkRect WorkArea;
00366 WorkCoord OldOffset;
00367
00368
00369 String_256 DragOpToken;
00370 OpParam* pDragOpParam;
00371 BOOL DragOpInvoke;
00372
00373 MonotonicTime TimeOfLastClick;
00374 wxPoint LastDoubleClickPos;
00375 BOOL ThisSingleIsTriple;
00376 BOOL ThisDoubleIsQuad;
00377
00378 wxTimer m_DragIdleTimer;
00379 MonotonicTime m_OLELastOutTime;
00380
00381 BOOL DragKeepAccuracy;
00382
00383 BOOL AutoScrollExcludeRulers;
00384
00385
00386 ClickType LastClickType;
00387 UINT32 LastClickButton;
00388 wxPoint LastClickPoint;
00389 wxPoint CurrentMousePos;
00390 ClickModifiers LastClickMods;
00391
00392
00393 UINT32 FirstClickButton;
00394
00395 Operation* pCurrentDragOp;
00396 DragType CurrentDragType;
00397 WinRect MouseClipRect;
00398
00399 BOOL OLERecaptureMouse;
00400
00401
00402
00403 INT32 m_LastMouseState;
00404 wxPoint m_LastMousePosition;
00405 INT32 m_LastMouseUsedTimestamp;
00406 BOOL m_CouldSkipNextMouse;
00407
00408 public:
00409 void DontSkipNextMouse() {m_CouldSkipNextMouse=FALSE;}
00410
00411
00412 protected:
00413 static void wxPoint2Coord(const wxPoint& point, Coord* pcoord);
00414 static void Coord2wxPoint(const Coord& coord, wxPoint* ppoint);
00415 static void wxRect2Rect(const wxRect& rect, Rect* pkrect);
00416 static void Rect2wxRect(const Rect& krect, wxRect* prect);
00417
00418 public:
00419 static DocView *GetDocViewFromWindowID( CWindowID WindowID );
00420
00421
00422 protected:
00423 static const INT32 WID_RENDERWINDOW = 1;
00424 static const INT32 WID_HSCROLLBAR = 2;
00425 static const INT32 WID_VSCROLLBAR = 3;
00426 static const INT32 WID_SIZECORNER = 4;
00427 static const INT32 WID_HRULER = 5;
00428 static const INT32 WID_VRULER = 6;
00429 static const INT32 WID_RULERORIGIN = 7;
00430 static const INT32 DragIdleID = 100;
00431
00432 static INT32 PopCount;
00433 static ViewState* pReadyMadeViewState;
00434
00435 static BOOL DefaultScrollersState;
00436 static BOOL DefaultRulersState;
00437 static BOOL UseVisibleDefaults;
00438
00439 static INT32 DragLatency;
00440 static INT32 DragDelay;
00441
00442 static MonotonicTime DragTimer;
00443
00444 static INT32 ScrollBarSize;
00445
00446 public:
00447 static INT32 s_MouseMoveEliminationPeriod;
00448 };
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463 class PageDropInfo : public CCObject
00464 {
00465 CC_DECLARE_DYNCREATE(PageDropInfo)
00466
00467 public:
00468 Document* pDoc;
00469 DocView* pDocView;
00470 Spread* pSpread;
00471 DocCoord DropPos;
00472
00473 ObjectDragTarget TargetHit;
00474 NodeRenderableInk* pObjectHit;
00475 };
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500 class ViewDragTarget : public OilDragTarget
00501 {
00502 friend class DragManagerOp;
00503 friend class ColourDragInformation;
00504
00505 CC_DECLARE_DYNAMIC(ViewDragTarget)
00506
00507
00508 public:
00509
00510 ViewDragTarget( wxWindow *TheWindow, wxRect *ClientArea = NULL, DragInformation* pDragInfo = NULL);
00511
00512 virtual UINT32 GetCursorID();
00513 virtual BOOL GetStatusLineText(String_256 * TheText);
00514
00515 virtual BOOL GetDropInfo(PageDropInfo*);
00516
00517 protected:
00518
00519
00520 BOOL ProcessEvent(DragEventType Event,
00521 DragInformation *pDragInfo,
00522 wxPoint *pMousePos, KeyPress* pKeyPress);
00523
00524 DragInformation* pCurrentDragInfo;
00525
00526 BOOL OverOutline;
00527 INT32 LineRad;
00528
00529 DocView* pThisDoc;
00530 Spread* pSpread;
00531 DocCoord DropPos;
00532
00533 ObjectDragTarget OverTarget;
00534 NodeRenderableInk* OverNode;
00535 };
00536
00537
00538
00539 class CViewFileDropTarget : public wxFileDropTarget
00540 {
00541 public:
00542 CViewFileDropTarget(CCamView* pView);
00543 virtual ~CViewFileDropTarget();
00544
00545 virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
00546
00547 protected:
00548 CCamView* m_pView;
00549 };
00550
00551
00552 #endif // INC_CAMVIEW_H