// Strawberry.h : main header file for the Strawberry application
//
#pragma once

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif

#ifdef UNICODE
#define M64 64
#define M64_2 64
#define M64_ch 64
#define UNI2 2
#define my_strcpy wcscpy
#define my_strcat wcscat
#define my_strlen wcslen
#define my_strcmp wcscmp
#define my_sscanf swscanf
#define my_sprintf swprintf
#define my_strstr wcsstr
#define size_in_bytes(S) 2*wcslen(S)+2
#define make_long(x) make_long_func(x)
#define make_utf8(x) make_utf8_func(x)
#define make_short(x) make_short_func(x)
extern wchar_t *make_long_func(BYTE *);
extern char *make_utf8_func(CString);
extern char *make_short_func(CString);
#else
#define M64 0
#define M64_2 2
#define M64_ch ch_set
#define UNI2 1
#define my_strcpy strcpy
#define my_strcat strcat
#define my_strlen strlen
#define my_strcmp strcmp
#define my_sscanf sscanf
#define my_sprintf sprintf
#define my_strstr strstr
#define size_in_bytes(S) strlen(S)+1
#define make_long(x) (LPSTR)(x)
#define make_utf8(x) x
#define make_short(x) x
#endif

#include "resource.h"       // main symbols
#include "Strawberry_h.h"   // Single-Instance Out-of-Process Servers
#include "Head.h"
#include "HeadFunc.h"

class CMainFrame;
class CPrologCntrItem;
class CStrawberryDoc;
class CStrawberryView;
class CProjectInfo;
class C_FrameWnd;
class CwProofTree;
class CwInformation;
class CThread;

extern void MitiText(CStringA, CHARFORMAT* = &cf_blue);
extern void MitiText2(CStringA, int = 0);
//extern DWORD CALLBACK StreamInCallbackEd(DWORD, LPBYTE, LONG, LONG *);
extern BOOL SelectFile(CString&, HWND, LPTSTR, LPTSTR, BOOL=FALSE);
extern void MitiRedraw(void);
extern void ShowInformation(int);
extern int SetProperty(DWORD Server, DWORD Property, DWORD Arg, DWORD p_line);
extern int GetProperty(DWORD Server, DWORD Property, DWORD Return);
extern int CallMethod(DWORD Server, DWORD ArgList, DWORD Return);
extern void SetVariant(DWORD Where, VARIANT* pVariant);
extern void GetVariant(DWORD Where, VARIANT* pVariant);

extern void error_func3(DWORD Arguments, DWORD p_line, DWORD j, DWORD k, DWORD k2);

class C2MultiDocTemplate : public CMultiDocTemplate
{
public:
  void MyDec(void) {m_nUntitledCount--;}
};

class C2DocManager : public CDocManager
{
public:
  virtual BOOL DoPromptFileName(CString&, UINT, DWORD, BOOL, CDocTemplate*);
};

// CStrawberryApp:
// See Strawberry.cpp for the implementation of this class
//
class CStrawberryApp : public CWinApp
{
public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	CStrawberryApp();

// Overrides
public:
	virtual BOOL InitInstance();
	virtual int ExitInstance();

// Implementation
	//COleTemplateServer m_server;
		// Server object for document creation
  afx_msg void OnRunBuild(int);
	afx_msg void OnAppAbout();
	afx_msg void OnOptionsEnvironment();
	afx_msg void OnOptionsSettings();
	afx_msg void OnUpdateOptionsSettings(CCmdUI* pCmdUI);
	afx_msg void OnUpdateRunCompile(CCmdUI* pCmdUI);
	afx_msg void OnUpdateRunRun(CCmdUI* pCmdUI);
	afx_msg void OnRunCompile();
	afx_msg void OnRunRun();
	afx_msg void OnTraceStep();
	afx_msg void OnTraceStop();
	afx_msg void OnProofTree();
	afx_msg void OnHelpOperators();
	afx_msg void OnToolsStack();
	afx_msg void OnToolsSystemList();
	afx_msg void OnToolsVariabels();
	afx_msg void OnToolsClosedTerms();
	afx_msg void OnToolsOpenTerms();
	afx_msg void OnToolsTree();
	afx_msg void OnToolsGoodBlocks();
	afx_msg void OnToolsConstants();
	afx_msg void OnToolsHashBlocks();
	afx_msg void OnToolsEkler();
	afx_msg void OnToolsKeyMap();
	afx_msg void OnToolsWindowObjects();
	afx_msg void OnTraceGo();
	afx_msg void OnTraceStepOver();
	afx_msg void OnTraceStepOut();
	afx_msg void OnRunNextAnswer();
	afx_msg void OnRunLoopCheck();
	afx_msg void OnTraceFirstStep();
	afx_msg void OnTraceFromNext();
	afx_msg void OnUpdateTraceStop(CCmdUI* pCmdUI);
	afx_msg void OnUpdateTraceTrace(CCmdUI* pCmdUI);
	afx_msg void OnTraceTrace();
	afx_msg void OnOptionsDefault();
	afx_msg void OnTraceBreakPoint();
	afx_msg void OnRunBuildExe();
	afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI);
	afx_msg void OnToolsDField();
	afx_msg void OnToolsPointers();
	afx_msg void OnToolsFField();
	afx_msg void OnToolsGoodFField();
	afx_msg void OnObjectBrowser();
	afx_msg void OnFileOpenEx();
	afx_msg void OnFileOpenSt();
	afx_msg void OnToolsClasses();
	afx_msg void OnInstallation();
	afx_msg void OnToolsMake();
	afx_msg void OnToolsInfo();
	DECLARE_MESSAGE_MAP()
  afx_msg void OnFileOpenWith();
  afx_msg void OnFileSaveWith();
};


// Globals
extern BYTE a[60]; // for OLE
extern int b[60];
  
extern CStrawberryApp theApp;
extern CMainFrame* pMainFrame;
extern CFile *pGFile, file;
extern DWORD FileType;
extern DWORD gl_flag, gl_open;  /* temporal */ 
extern DWORD Environment;
extern _TCHAR namef[_MAX_PATH];
extern _TCHAR string3[L_BUFER+2];
extern CRichEditCtrl *pOutput, *pActiveCtrl;
extern CStrawberryDoc *pActivePj, *pActiveFile, *pCompiled, *pActive;
extern CArchive *pAr, *pAr2;
extern CMultiDocTemplate *pDocTemplate1;
extern C2MultiDocTemplate *pDocTemplate2;
extern CProjectInfo *pInfo, *pInfo2, DefaultProject;
extern C_FrameWnd *pMain_Frame;
extern CWnd *pMainWindow;
extern CDC *pMain_DC;
extern CRect G_rectPaint;
extern CRgn G_rgnPaint;
extern DWORD G_FlagsMes;
extern CwProofTree* pProofTree;
extern CwInformation *pStack, *pVariables;
extern CThread *pThread;
/////////////////////////////////////////////////////////////////////////////
