#if !defined(AFX_GOSTRACEPANE_H__CE9A9043_8848_4521_874E_EB8726EC15EE__INCLUDED_)
#define AFX_GOSTRACEPANE_H__CE9A9043_8848_4521_874E_EB8726EC15EE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// GosTracePane.h : header file
//
#include "GosEventPane.h"
#include "ZoomDialog.h"
#include "TimeFrame.h"

/////////////////////////////////////////////////////////////////////////////
// CGosTracePane view

class CGosTracePane : public CGosEventPane
{
	friend	CZoomDialog;		// so it can call OnUpdate
protected:
	CGosTracePane();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CGosTracePane)

	bool m_fSelectRect;			// are we selecting a time range using the mouse?
	bool m_fDisplaySelectRect;	// are we displaying a time range using the mouse?
	int m_nSelectRectStart;		// start x position of time range
	int m_nSelectRectEnd;		// end x position of time range

	bool m_fShowEntry;			// show function entry as a colored dot
	bool m_fAlreadyUpdating;	// avoid infinite nest

	double m_rSecPerPixel;	// 10^-9 ..10^+3
	double m_rPixelPerDiv;	// 10 .. 75
	double m_rSecPerDiv;	// 10^-8 .. 10^+4
	double m_rTicksPerPixel;	// 0.1 .. 10^11

	_int64	m_tViewStartOffTick;	// offset into log of left of view
	_int64	m_tViewStartTick;		// absolute time of left of view
	_int64	m_tDiv0StartTick;		// could be 0, start of log, or time of some event
	_int64	m_tCPUFreq;				// ticks per second
	_int64	m_tTicksPerDiv;

	int		m_nScrollShift;		// the shift to apply to the horizontal scrollbar

	void	CalcScrollPage();
	void	ScrollToRange(int curpos);

	int		TimeToXCoord( _int64 tAbs )
			{
				return (int)( ((double)( tAbs - m_tViewStartTick )) / m_rTicksPerPixel );
			}

	int		TagToYCoord( DWORD tag )
			{
				return m_pParentFrame->m_TagList.Find(tag)->screenY;
			}
	inline _int64 CGosTracePane::ViewXToTick( int x ) { return m_tViewStartTick + _int64(m_rTicksPerPixel * (double)x); }
	void	ZoomViewTo( _int64 startTick, _int64 endTick );
	void	CalcScrollRange();
	void	QueryZoom();

	int		m_nLineThickness;



// Attributes
public:

// Operations
public:

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

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

	// Generated message map functions
protected:
	//{{AFX_MSG(CGosTracePane)
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	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 void OnShowentryoff();
	afx_msg void OnUpdateShowentryoff(CCmdUI* pCmdUI);
	afx_msg void OnShowentryon();
	afx_msg void OnUpdateShowentryon(CCmdUI* pCmdUI);
	afx_msg void OnSingleThick();
	afx_msg void OnUpdateSingleThick(CCmdUI* pCmdUI);
	afx_msg void OnTripleThick();
	afx_msg void OnUpdateTripleThick(CCmdUI* pCmdUI);
	afx_msg void OnDoubleThick();
	afx_msg void OnUpdateDoubleThick(CCmdUI* pCmdUI);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

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

#endif // !defined(AFX_GOSTRACEPANE_H__CE9A9043_8848_4521_874E_EB8726EC15EE__INCLUDED_)
