0027736: Samples - rectangle selection issues within MFC sample Viewer3d
[occt.git] / samples / mfc / standard / 09_Animation / src / AnimationView3D.h
1 // AnimationView.h : interface of the CAnimationView3D class
2 //
3 /////////////////////////////////////////////////////////////////////////////
4
5 #if !defined(AFX_ANIMATIONVIEW3D_H__79840E88_1001_11D2_B8C1_0000F87A77C1_3D_INCLUDED_)
6 #define AFX_ANIMATIONVIEW3D_H__79840E88_1001_11D2_B8C1_0000F87A77C1_3D_INCLUDED_
7
8 #if _MSC_VER >= 1000
9 #pragma once
10 #endif // _MSC_VER >= 1000
11
12 #include "Tune.h"
13 #include "AnimationDoc.h"
14 #include "..\..\Common\res\OCC_Resource.h"
15
16 class AIS_RubberBand;
17
18 enum View3D_CurrentAction { 
19   CurrentAction3d_Nothing,
20   CurrentAction3d_DynamicZooming,
21   CurrentAction3d_WindowZooming,
22   CurrentAction3d_DynamicPanning,
23   CurrentAction3d_GlobalPanning,
24   CurrentAction3d_DynamicRotation,
25   CurrentAction3d_Fly,
26   CurrentAction3d_Turn
27 };
28
29 class CAnimationView3D : public CView
30 {
31 protected: // create from serialization only
32         CAnimationView3D();
33         DECLARE_DYNCREATE(CAnimationView3D)
34
35 // Attributes
36 public:
37         CAnimationDoc* GetDocument();
38
39 // Operations
40 public:
41
42 // Overrides
43         // ClassWizard generated virtual function overrides
44         //{{AFX_VIRTUAL(CAnimationView3D)
45         public:
46         void FitAll() {   if ( !myView.IsNull() ) myView->FitAll();  myView->ZFitAll(); };
47         virtual void OnDraw(CDC* pDC);  // overridden to draw this view
48         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
49         virtual void OnInitialUpdate(); // CasCade
50         protected:
51
52         //}}AFX_VIRTUAL
53
54 // Implementation
55 public:
56         virtual ~CAnimationView3D();
57 #ifdef _DEBUG
58         virtual void AssertValid() const;
59         virtual void Dump(CDumpContext& dc) const;
60 #endif
61         void SetDimensions ();
62         void ReloadData();
63         CTune m_Tune;
64   void SetFocal (double theFocus, double theAngle);
65         void Fly (int x , int y);
66         void Turn (int x , int y);
67         void Roll (int x , int y);
68         void Twist (int x , int y);
69
70 protected:
71         double m_dAngle;
72         BOOL m_bShift;
73         int m_cx , m_cy ;
74         int m_curx , m_cury ;
75
76 // Generated message map functions
77 protected:
78         //{{AFX_MSG(CAnimationView3D)
79         afx_msg void OnBUTTONAxo();
80         afx_msg void OnBUTTONBack();
81         afx_msg void OnBUTTONBottom();
82         afx_msg void OnBUTTONFront();
83         afx_msg void OnBUTTONHlrOff();
84         afx_msg void OnBUTTONHlrOn();
85         afx_msg void OnBUTTONLeft();
86         afx_msg void OnBUTTONPan();
87         afx_msg void OnBUTTONPanGlo();
88         afx_msg void OnBUTTONReset();
89         afx_msg void OnBUTTONRight();
90         afx_msg void OnBUTTONRot();
91         afx_msg void OnBUTTONTop();
92         afx_msg void OnBUTTONZoomAll();
93     afx_msg void OnFileExportImage();
94         afx_msg void OnSize(UINT nType, int cx, int cy);
95         afx_msg void OnBUTTONZoomProg();
96         afx_msg void OnBUTTONZoomWin();
97         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
98         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
99         afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
100         afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
101         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
102         afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
103         afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
104         afx_msg void OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI);
105         afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI);
106         afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI);
107         afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI);
108         afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI);
109         afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI);
110         afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI);
111
112         afx_msg void OnChangeBackground();
113         afx_msg void OnTimer(UINT_PTR nIDEvent);
114
115         afx_msg void OnSensitivity();
116         afx_msg void OnBUTTONFly();
117         afx_msg void OnBUTTONTurn();
118         afx_msg void OnUpdateBUTTONFly(CCmdUI* pCmdUI);
119         afx_msg void OnUpdateBUTTONTurn(CCmdUI* pCmdUI);
120         afx_msg void OnViewDisplaystatus();
121         afx_msg void OnUpdateViewDisplaystatus(CCmdUI* pCmdUI);
122         //}}AFX_MSG
123         
124 public :
125         afx_msg void OnStop();
126         afx_msg void OnRestart();
127 protected:
128
129         DECLARE_MESSAGE_MAP()
130 private:
131         Handle(V3d_View)     myView;
132 public:
133         Handle(V3d_View)&    GetView() { return myView;};
134         void                DisplayTuneDialog();
135 private:
136   Standard_Integer     myXmin;
137   Standard_Integer     myYmin;
138   Standard_Integer     myXmax;
139   Standard_Integer     myYmax;
140   Standard_Real        myCurZoom;
141   Standard_Boolean     myHlrModeIsOn;
142
143   View3D_CurrentAction myCurrentMode;
144   double               m_Atx  , m_Aty  , m_Atz  ;
145   double               m_Eyex , m_Eyey , m_Eyez ;
146   double               m_FlySens ;
147   double               m_TurnSens ;
148   double               m_Focus ;
149
150 private:
151   Handle(AIS_RubberBand) myRect; //!< Rubber rectangle for selection
152   void DrawRectangle (Standard_Integer theMinX, Standard_Integer theMinY, Standard_Integer theMaxX, Standard_Integer theMaxY,
153                       Standard_Boolean theToDraw, Aspect_TypeOfLine theLineType = Aspect_TOL_SOLID);
154 };
155
156 #ifndef _DEBUG  // debug version in AnimationView.cpp
157 inline CAnimationDoc* CAnimationView3D::GetDocument()
158    { return (CAnimationDoc*)m_pDocument; }
159 #endif
160
161 /////////////////////////////////////////////////////////////////////////////
162
163 //{{AFX_INSERT_LOCATION}}
164 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
165
166 #endif // !defined(AFX_ANIMATIONVIEW3D_H__79840E88_1001_11D2_B8C1_0000F87A77C1_3D_INCLUDED_)