// LogicView.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CLogicView view

 

#if !defined (CLOGICVIEW_H)
#	define CLOGICVIEW_H



#define WM_DRAW_BACKGROUND  WM_USER + 5

class CLogicView;

#include "style.hpp"
#include "traceline.hpp"
#include "childfrm.h"



class CLogicView : public CView
{
protected:
	CLogicView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CLogicView)

// Attributes
public:

	CChildFrame *myParent;

	CDC *displayMemory;


	//
	// Background Drawing stuff 
	//
	

	HCURSOR 
		zoomInCursor,
		zoomOutCursor,
		zoomSelCursor,
		openHandCursor,
		closeHandCursor,
		arrowCursor;

	enum {
		Waiting,
		MakingTrace,
		DrawingTrace
	};
	

	enum {
		ZoomIn,
		ZoomOut,
		ZoomSelect,
		Select,
		SelectRegion,
		Move
	};

	int subMode;

	int
		currentOperation;

	int 
		currentTrace;

	Time
		startMove;

	Logical
		peekingMessages;

	Logical
		bugEnabled;

	UINT
		drawingTimer;

	int 
		menuOnTraceIndex;

private:
	Logical windowActive;

// Operations
public:
	void Render(CRect placement);
	LONG OnDrawBackground(UINT wParam, LONG lParam);
	void MoveTime(int current_position, BOOL absolute);
	void DragTime(CPoint points_to_move);
	void ScaleTime(int scale_factor, CPoint point);
	int FindSelectionScreen(CPoint point);
	void SetStatusBar(void);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CLogicView)
	public:
	virtual void OnInitialUpdate();
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	protected:
	virtual void OnDraw(CDC* pDC);      // overridden to draw this view
	//}}AFX_VIRTUAL


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

	// Generated message map functions
protected:
	//{{AFX_MSG(CLogicView)
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	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 BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	//}}AFX_MSG
	afx_msg void OnPlugIn( UINT nID );
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////
#endif
