Menu

[r124]: / MCEView.h  Maximize  Restore  History

Download this file

277 lines (237 with data), 9.4 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
// MCEView.h : interface of the CMCEView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MCEVIEW_H__1CF5FE6D_FA66_11D6_8A12_0050FC50B36D__INCLUDED_)
#define AFX_MCEVIEW_H__1CF5FE6D_FA66_11D6_8A12_0050FC50B36D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Include the OpenGL headers
#include "gl\gl.h"
#include "gl\glu.h"
// Include other support headers
#include "MCEDataEngine.h"
#include "MCESupportRoutines.h"
#include "MCELevelControlPrimary.h" // Added by ClassView
#include "MCELevelControlSecondary.h" // Added by ClassView
#include "MCEPictureSetup.h"
#include "MCEGeneralSetup.h"
#include "MCEMoveFragment.h"
#include "MCEVoidMap.h"
#include "MapSetting2D.h"
#include "MCE2DMapPlaneDef.h"
#include "MCEZmatrixDlg.h"
#include "EditPeakPosition.h"
#include "MCEOverlayAtomsDlg.h"
#include "ShrinkMapDlg.h"
#include "CalculateMapSetting.h"
// non MCE useful headers
#include "Trackball.h"
#include "InterlaceStencil.h"
typedef enum tagDiplayMode {NoStereo,StereoHW,StereoInterlaced,StereoVertical,StereoAnaglyph}
DisplayMode;
typedef enum tageye{CentralEyePicking,CentralEye,LeftEye,RightEye}
Eye;
class CMCEView : public CView ,
CMCEDataEngine ,
CMCESupportRoutines,
CTrackball,
CInterlaceStencil
{
protected: // create from serialization only
CMCEView();
DECLARE_DYNCREATE(CMCEView)
// Attributes
public:
CMCEDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMCEView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMCEView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
LRESULT OnApplyLevelControlChanges(WPARAM wParam, LPARAM lParam);
LRESULT OnLevelControlExit(WPARAM wParam, LPARAM lParam);
LRESULT OnDlgFragmentMoveExit(WPARAM wParam, LPARAM lParam);
LRESULT OnDlgShrinkMapOK(WPARAM wParam, LPARAM lParam);
LRESULT OnDlgShrinkMapReset(WPARAM wParam, LPARAM lParam);
LRESULT OnDlgShrinkMapApply(WPARAM wParam, LPARAM lParam);
LRESULT OnDlgShrinkMapExit(WPARAM wParam, LPARAM lParam);
LRESULT OnDlgApplyFragmentMove(WPARAM wParam, LPARAM lParam);
LRESULT OnDlgRotateRotGroup(WPARAM wParam, LPARAM lParam);
LRESULT OnGetRotatingGroups(WPARAM wParam, LPARAM lParam);
LRESULT OnDlgPlaneDefExit(WPARAM wParam, LPARAM lParam);
LRESULT OnDlgPlaneDefOK(WPARAM wParam, LPARAM lParam);
LRESULT OnDlgEditPeakPositionExit(WPARAM wParam, LPARAM lParam);
LRESULT OnDlgEditPeakPositionOK(WPARAM wParam, LPARAM lParam);
LRESULT OnDlgOverlayAtomsExit(WPARAM wParam, LPARAM lParam);
LRESULT OnDlgOverlayAtomsApply(WPARAM wParam, LPARAM lParam);
//{{AFX_MSG(CMCEView)
afx_msg void OnFileOpen();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnCancelMode();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnViewLevelControl();
afx_msg void OnFileSaveBmp();
afx_msg void OnFileSaveProjectAs();
afx_msg void OnFileOpenProject();
//afx_msg void OnCalculateVoidMapDist();
//afx_msg void OnCalculateVoidMapVdW();
afx_msg void OnCalculateVolume();
afx_msg void OnDeblurMap();
afx_msg void OnCalculateNewMap();
afx_msg void OnResetView();
afx_msg void OnFileOpen2();
afx_msg void OnLoadCavities();
afx_msg void OnImportFragment();
afx_msg void OnImportFragmentFromDB();
afx_msg void OnNewFragment();
afx_msg void OnFileLoadAtoms();
afx_msg void OnFileReadCifAtoms();
afx_msg void OnViewLevelControlSec();
afx_msg void OnEditAddnewpeak();
afx_msg void OnOptimizePeak();
afx_msg void OnShowPeakCloseContacts();
afx_msg void OnApplyPeaksSymmetry();
afx_msg void OnSaveMapSettings();
afx_msg void OnEditClearpeaklist();
afx_msg void OnPreferencesAnimation();
afx_msg void OnPreferenceShowAtomicLabels();
afx_msg void OnPreferences2DMapColorSettings();
afx_msg void OnPreferencesAddingAtoms();
afx_msg void OnPreferencesInfoMode();
afx_msg void OnMoveSelectedPeak();
afx_msg void OnOverlayAtoms();
afx_msg void OnUpdateCalculateVoidMap(CCmdUI* pCmdUI);
afx_msg void OnUpdatePreferencesInfoMode(CCmdUI* pCmdUI);
afx_msg void OnUpdatePreferencesAddingAtoms(CCmdUI* pCmdUI);
afx_msg void OnUpdateShowAtomicLabels(CCmdUI* pCmdUI);
afx_msg void OnUpdateShowPeaksCloseContacts(CCmdUI* pCmdUI);
afx_msg void OnUpdateApplyPeaksSymmetry(CCmdUI* pCmdUI);
afx_msg void OnUpdatePreferencesAnimation(CCmdUI* pCmdUI);
void OnUpdateOptimizePeak(CCmdUI* pCmdUI);
afx_msg void OnUpdateEditAddnewpeak(CCmdUI* pCmdUI);
afx_msg void OnUpdateMoveSelectedPeak(CCmdUI* pCmdUI);
afx_msg void OnUpdateEditClearpeaklist(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewLevelcontrol(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewLevelcontrolSec(CCmdUI* pCmdUI);
afx_msg void OnFileSavepeaklist();
afx_msg void OnFileSaveCif();
afx_msg void OnFileSaveSelectedFragment();
afx_msg void OnFileSaveRestr();
afx_msg void OnUpdateFileSavepeaklist(CCmdUI* pCmdUI);
afx_msg void OnPreferencesBackgroundcolor();
afx_msg void OnPreferencesAtomInfo();
afx_msg void OnToolsShrinkMap();
afx_msg void OnUpdatePreferencesAtomInfo(CCmdUI* pCmdUI);
afx_msg void OnPreferencesSelectMolecule();
afx_msg void OnToolsMoveMolecule();
afx_msg void OnUpdatePreferencesSelectMolecule(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsMoveMolecule(CCmdUI* pCmdUI);
afx_msg void OnUpdateFragmentDB(CCmdUI* pCmdUI);
afx_msg void OnUpdateOverlayAtoms(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileSaveSelectedFragment(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileSaveCif(CCmdUI* pCmdUI);
afx_msg void OnPreferencesDisplayStyle();
afx_msg void OnPreferencesPeriodicTable();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnPreferencesSgsetup();
afx_msg void OnPreferencesGeneralSetup();
afx_msg void OnFileSavepovrayinput();
afx_msg void OnFileSaveVRMLinput();
// afx_msg void OnToolsAddAtom();
// afx_msg void OnUpdateToolsAddAtom(CCmdUI* pCmdUI);
//afx_msg void OnToolsSelectatoms();
//afx_msg void OnUpdateToolsSelectatoms(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
float m_fshiftY;
float m_fshiftX;
float m_fshiftZ;
virtual BOOL SetupPixelFormat(void);
virtual BOOL SetupViewport( int cx, int cy);
BOOL RenderSceneView(void);
bool TestOpenGlError(const char * szMessage = "Sorry - no idea");
void SelectAtom(CPoint point);
void SelectAtomOrBond(CPoint point, SelectStruct &LS);
void ResetView(bool invalidate=true);
void OnCalculateVoidMap(void_map_type type, int output_type, float resolution, BOOL is_res_the_same, int isolevel_option);
private:
void ProcessCommandLine(CString str);
LRESULT OnLevelControlExitSec(WPARAM wParam, LPARAM lParam);
LRESULT OnApplyLevelControlChangesSec(WPARAM wParam, LPARAM lParam);
float getOptimalScale(UnitCell *pUnit);
void SaveBMP(int Width, int Height);
void Animate();
void SupportInitializations();
void RecalcModelView();
void SetError (int e);
BOOL InitializeOpenGL();
void Camera(Eye mode);
DisplayMode ActualDisplayMode;
HGLRC m_hRC;
CDC* m_pDC;
CString m_title;
static const char* const _ErrorStrings[];
const char* m_ErrorString;
// modeless dialog values
CMCELevelControlPrimary* m_pDlgLevelControlPrim;
CMCELevelControlSecondary* m_pDlgLevelControlSec;
MCE2DMapPlaneDef *m_plane_dialog;
MCEMoveFragment* m_pDlgMoveFragment;
MCEZmatrixDlg* m_pDlgZmatrix;
EditPeakPosition *m_pDLgEditPeakPosition;
MCEOverlayAtomsDlg *m_pDlgOverlayAtoms;
ShrinkMapDlg *m_shrinkMapDlg;
float stretchY;
float stretchX;
// mouse handling
int m_beginy;
int m_beginx;
bool m_scaling;
bool m_animate;
bool m_moving;
bool m_spinning;
//bool m_selectatoms;
bool m_addatom_mode;
// trackbal support
float curquat[4];
float lastquat[4];
int beginx, beginy;
int W ,H;
float scalefactor;
CTrackball m_fragment_trackball;
float m_fragment_curquat[4];
float m_fragment_lastquat[4];
};
#ifndef _DEBUG // debug version in MCEView.cpp
inline CMCEDoc* CMCEView::GetDocument()
{ return (CMCEDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MCEVIEW_H__1CF5FE6D_FA66_11D6_8A12_0050FC50B36D__INCLUDED_)