/******************************************************************************
** Copyright (C) 2001, University of Alabama in Huntsville. All rights 
** reserved.
**
** File   : ConGraTView.h
**
** Author : Satish Hota & Edwin Chan (with help from MFC)
**
** Description:
**    This file provides interface for CConGraTView class.
**
** History:
** 09-Nov-01 Satish Hota & Edwin Chan
**     File Created
** 19-Nov-01 Satish Hota
**     * Moved the ViewType enumerator into the class
**     * Defined a vector for the select set.
** 20-Nov-01 Edwin Chan
**     Added CmdType enumerator
** 25-Nov-01 Satish Hota
**     Added new ClientToDoc and DocToClient methods.
** 26-Nov-01 Edwin Chan
**     * Removed method OnCancelMode
**     * Added new methods OnEditProperties, and OnUpdateEditProperties
**     * Added new method IsSelected
**     * Modified method Select
**     * Changed m_SelectSet to public
** 28-Nov-01 Satish Hota
**     Made the CDrawable class CDrawableElement and created a CDrawable
**     super-class.  Hence, replaced usage of CDrawable with CDrawableElement.
** 30-Nov-01 Satish Hota
**     Added the ObjectAt method.
** 01-Dec-01 Edwin Chan
**     * Added Update Command to formation rule buttons.
**     * Added GetCurrentCmd method.
**     * Moved CmdType enumerations to ConGraT.h
******************************************************************************/


#if !defined(AFX_CONGRATVIEW_H__1050F62E_1058_457F_9F73_24B0CF57FBDB__INCLUDED_)
#define AFX_CONGRATVIEW_H__1050F62E_1058_457F_9F73_24B0CF57FBDB__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "DrawableElement.h"
#include <vector>
#include "ConGraT.h"	// Added by ClassView


class CConGraTView : public CScrollView
{
protected: // create from serialization only
	CConGraTView();
	DECLARE_DYNCREATE(CConGraTView)

// Attributes
public:
	CConGraTDoc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CConGraTView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual void OnInitialUpdate(); // called first time after construct
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CConGraTView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CConGraTView)
	afx_msg void OnRulesCopy();
	afx_msg void OnRulesSimplify();
	afx_msg void OnRulesRestrict();
	afx_msg void OnRulesUnrestrict();
	afx_msg void OnRulesJoin();
	afx_msg void OnRulesDetach();
	afx_msg void OnDrawSelect();
	afx_msg void OnUpdateDrawSelect(CCmdUI* pCmdUI);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnViewTypehierarchy();
	afx_msg void OnUpdateViewTypehierarchy(CCmdUI* pCmdUI);
	afx_msg void OnViewRelationhierarchy();
	afx_msg void OnUpdateViewRelationhierarchy(CCmdUI* pCmdUI);
	afx_msg void OnViewCatalogofindividuals();
	afx_msg void OnUpdateViewCatalogofindividuals(CCmdUI* pCmdUI);
	afx_msg void OnViewSheetofassertion();
	afx_msg void OnUpdateViewSheetofassertion(CCmdUI* pCmdUI);
	afx_msg void OnEditProperties();
	afx_msg void OnUpdateEditProperties(CCmdUI* pCmdUI);
	afx_msg void OnEditSelectall();
	afx_msg void OnUpdateRulesCopy(CCmdUI* pCmdUI);
	afx_msg void OnUpdateRulesDetach(CCmdUI* pCmdUI);
	afx_msg void OnUpdateRulesJoin(CCmdUI* pCmdUI);
	afx_msg void OnUpdateRulesRestrict(CCmdUI* pCmdUI);
	afx_msg void OnUpdateRulesSimplify(CCmdUI* pCmdUI);
	afx_msg void OnUpdateRulesUnrestrict(CCmdUI* pCmdUI);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

// All declarations below have been made manually and not by the class wizard.
public:
	virtual CDrawableElement* ObjectAt(const CPoint &point);
	VDrawableElement GetSelectSet();
	CmdType GetCurrentCmd();
	void ClientToDoc(CRect& rect);
	void ClientToDoc(CPoint& point);
	void DocToClient(CPoint& point);
	void DocToClient(CRect& rect);
	void Select(CDrawableElement *pObj, bool b_AddSel);
	bool IsSelected(CDrawableElement* pObj);

protected:
	std::vector<CDrawableElement*> m_SelectSet; // Set of all currently selected items
    ViewType m_eCurrentView;      // Gives current view type
    CmdType m_eCurrentCmd;        // Current command 

};

#ifndef _DEBUG  // debug version in ConGraTView.cpp
inline CConGraTDoc* CConGraTView::GetDocument()
   { return (CConGraTDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CONGRATVIEW_H__1050F62E_1058_457F_9F73_24B0CF57FBDB__INCLUDED_)
