// 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_)