#if !defined(MACROPROGRAMDLG_H)
#define MACROPROGRAMDLG_H

#include "types.h"
#include "const.h"
#include "resource.h"
#include "macrointerface.h"
#include "macrodlg.h"
#include "modelessdlg.h"
#include <list>


#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// macroprogramdlg.h : header file
//

using namespace std ;

typedef list<CMacroDlg*> MACRODLG;
typedef MACRODLG::iterator MACRODLG_POSITION;

/////////////////////////////////////////////////////////////////////////////
// CMacroProgramDlg dialog

class CMacroProgramDlg : public CDialog
{
// Construction
public:
	// Constructor
	CMacroProgramDlg(CWnd* pParent,  
		MacroInterface *pMacroInterpreter);

	// Destructor
	~CMacroProgramDlg();

	// CMacroDlg classes created by this dialog call this
	// when a child process loaded by CMacroProgramDlg
	// starts to run, or has stopped.
	void InProcess(Boolean state);

	// Set the file to <s> to load a macroprogram from
	void SetFile(CString s);

// Dialog Data
	//{{AFX_DATA(CMacroProgramDlg)
	enum { IDD = IDD_MACROPROGRAM_DLG };
	CString	m_ProgramFile;
	CString	m_MacroProcesses;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMacroProgramDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CMacroProgramDlg)
	afx_msg void OnLoad();
	afx_msg void OnBrowse();
	afx_msg void OnUnload();
	afx_msg void OnExit();
	afx_msg void OnSelchangeComboMacroprocesses();
	afx_msg void OnSelchangeComboMacroUsage();
	virtual BOOL OnInitDialog();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	// Replace <olddlg> with <newdlg>
	void Replace(CMacroDlg *olddlg, CMacroDlg *newdlg);

	// Search for macrodlg servicing macroprocess with <name>
	CMacroDlg * SearchDlg(char * name);

	LRESULT OnModelessExit(WPARAM wParam, LPARAM lParam);

	// TRUE if any macroprocess is running or paused
	Boolean _inProcess;

	// Pointer to the macro interface class
	MacroInterface *_pMacroInterface;

	MACRODLG _macroDlgList;

	CWnd *m_pDialog;
	
	CModelessDlg *pModelessDlg;

};

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(MACROPROGRAMDLG_H)
