// GosViewDoc.h : interface of the CGosViewDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_GOSVIEWDOC_H__206C4E6E_8F14_4567_B728_870FD6B7D30B__INCLUDED_)
#define AFX_GOSVIEWDOC_H__206C4E6E_8F14_4567_B728_870FD6B7D30B__INCLUDED_

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

#include "session.h"
#include "IDContainer.h"

#include <afxtempl.h>

class CTimeFrame;

class CGosViewDoc : public CDocument
{
protected: // create from serialization only
	CGosViewDoc();
	DECLARE_DYNCREATE(CGosViewDoc)

	CList<CTimeFrame *,CTimeFrame *>m_TimeFrameList;

// Attributes
public:

	// Connection with target
	CSession m_Session;
	char m_ConnName[256];
	void OnUpdateConnectionStatus(CCmdUI* pCmdUI);
	void OnUpdateDocName(CCmdUI* pCmdUI);

	// Target / Connection Status
	bool m_fTracing;
	bool m_fTraceReady;
	bool m_fTraceOnce;
	_int64 m_nFreq;


	// Current Log
	DWORD *m_pLog;		// a currently filled out log
	DWORD *m_pLogEnd;	// (beyond) end of current log
	_int64 m_tLogStart;
	_int64 m_tLogEnd;

	struct TagInfoEntry
	{
		DWORD	id;
		char	Name[256];
	} ;

	IDContainer<TagInfoEntry>	m_TagInfo;

	void ParseNewLog( DWORD *pLog, GosLogInfo *pLogInfo );
	char * GetIDName( DWORD id );
		
	bool TraceReady() { return m_fTraceReady; }
	void SetFreq( _int64 freq ) { m_nFreq = freq; }
	
	_int64 TLogStart() { return m_tLogStart; }
	_int64 TLogEnd() { return m_tLogEnd; }


	// UI for document
	void SetFocus();
	void UpdateTimeFrameList();

	CFont *m_pFont;


// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CGosViewDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

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

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CGosViewDoc)
	afx_msg void OnChangeEdit1();
	afx_msg void OnConnect();
	afx_msg void OnDisconnect();
	afx_msg void OnUpdateConnect(CCmdUI* pCmdUI);
	afx_msg void OnUpdateDisconnect(CCmdUI* pCmdUI);
	afx_msg void OnStartTrace();
	afx_msg void OnUpdateStartTrace(CCmdUI* pCmdUI);
	afx_msg void OnStopTrace();
	afx_msg void OnUpdateStopTrace(CCmdUI* pCmdUI);
	afx_msg void OnTraceOnce();
	afx_msg void OnUpdateTraceOnce(CCmdUI* pCmdUI);
	afx_msg void OnUpdateFontbutton(CCmdUI* pCmdUI);
	afx_msg void OnFontbutton();
	afx_msg void OnTargetButton();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

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

#endif // !defined(AFX_GOSVIEWDOC_H__206C4E6E_8F14_4567_B728_870FD6B7D30B__INCLUDED_)
