#ifndef MACRODLG_H
#define MACRODLG_H

#include "resource.h"
#include "macrointerface.h"


#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// macrodlg.h : header file
//
#ifndef WM_MODELESSEXIT
#define WM_MODELESSEXIT (WM_USER + 1)
#endif

/////////////////////////////////////////////////////////////////////////////
// CMacroDlg dialog

class CMacroDlg : public CDialog
{
// Construction
public:	
	
	CMacroDlg(CWnd* pParent = NULL, MacroInterface *pMacroInterface = NULL);
	
	// Returns the process name the CMacroDlg is interfacing too
	char *ProcessName();

	// Returns -1 on error
	Int16 Load(char *filename);

	// Refresh from being hidden
	void Refresh();

// Dialog Data
	//{{AFX_DATA(CMacroDlg)
	enum { IDD = IDD_MACROPROCESS_DLG };
	CString	m_MacroProcess;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMacroDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:	

	// Generated message map functions
	//{{AFX_MSG(CMacroDlg)
	afx_msg void OnExit();
	afx_msg void OnStart();
	afx_msg void OnStop();
	afx_msg void OnResume();
	virtual BOOL OnInitDialog();
	afx_msg void OnTimer(UINT nIDEvent);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	// Extract significant lines from macro file. Returns 0 if okay, -1 if
	// file couldn't be opened.
	static Int16 Filter(const char *filename, MACROSOURCE *source);
	
	// Empty macrosource vector
	void EmptyVector(MACROSOURCE *theVector);

	// Insert item into macro dlg list at position index i
	void InsertItem(char *text, Nat16 i);

	// Displays time delay
	void DisplayTimeDelay(Nat32 delay);

	// Clears all the macroList dialog box status bitmaps to MACRO_LOADED
	void ClearAllStatus();

	CWnd *m_pDialog;
	Nat16 _lineCnt;
	Nat32 _delaySecs;
	Nat32 _macroId;

	UINT mTimer;
	MacroInterface *_pMacroInterface;
	CImageList imageList;
	Nat32 _prevDelay;
	clock_t _delayStartTime;

	// TRUE if macro running or paused
	Boolean _inProcess;
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif
