#include "StdAfx.h"

#include "IADDoc.hpp"
#include "IADDgIf.hpp"
#include "IADLnkMt.hpp"


	/////////////////////////////////////
	//  	Ini file implementation	   //
	/////////////////////////////////////

#define IAD_C_szInitSection_General	"General"
	#define IAD_C_szInitEntry_Colors	"Colors"


//***************************************************************************
BOOL IAD_MyDocument::m_fn_bReadIniFile()
{
	CFile file;
	if ( !file.Open(m_csIniFileName, CFile::modeRead) )
	{
		CString csMessage = "The Ini file ""IA_Debug.ini"" is not present in ";
		csMessage += m_csIniFileName.Left(m_csIniFileName.ReverseFind('\\'));
		csMessage += "\nParameters are default ones, but they will be saved when you exit this application.";
		IAD_InformationDialog dial(NULL, csMessage);
		dial.DoModal();

		return FALSE;
	}
	else
	{
		file.Close();
		
		BOOL bReturn = TRUE;

// CG PB DEBUGGER 23/06/98 {
#ifdef ACTIVE_AIDEBUG
		//Reads colors
 		if ( bReturn )
			bReturn = GetPrivateProfileStruct(IAD_C_szInitSection_General,	
																				IAD_C_szInitEntry_Colors,
																				(void *)(&g_a_colrefTypeColor),
																				sizeof(g_a_colrefTypeColor),
																				LPCTSTR(m_csIniFileName));

#else
		bReturn = FALSE;
#endif 
// CG PB DEBUGGER
		return bReturn;
	}

}

//***************************************************************************
BOOL IAD_MyDocument::m_fn_bWriteIniFile()
{
	BOOL bReturn = TRUE;

// CG PB DEBUGGER 23/06/98 {
#ifdef ACTIVE_AIDEBUG
	//Writes colors Array
	if ( bReturn )
		bReturn = WritePrivateProfileStruct(IAD_C_szInitSection_General,	
																				IAD_C_szInitEntry_Colors,
																				(void *)(&g_a_colrefTypeColor),
																				sizeof(g_a_colrefTypeColor),
																				LPCTSTR(m_csIniFileName));

#else
		bReturn = FALSE;
#endif 
// CG PB DEBUGGER
	return bReturn;
}

