////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004 Sergey Solozhentsev
// Author: 	Sergey Solozhentsev e-mail: salos@mail.ru
// Product:	WTL Helper
// File:      	FunctionOptDlg.cpp
// Created:	21.12.2004 10:46
// 
//   Using this software in commercial applications requires an author
// permission. The permission will be granted to everyone excluding the cases
// when someone simply tries to resell the code.
//   This file may be redistributed by any means PROVIDING it is not sold for
// profit without the authors written consent, and providing that this notice
// and the authors name is included.
//   This file is provided "as is" with no expressed or implied warranty. The
// author accepts no liability if it causes any damage to you or your computer
// whatsoever.
//
////////////////////////////////////////////////////////////////////////////////

// This file was generated by WTL Dialog wizard 
// FunctionOptDlg.cpp : Implementation of CFunctionOptDlg

#include "stdafx.h"
#include "FunctionOptDlg.h"
#include "../RegArchive.h"
#include ".\functionoptdlg.h"

extern LPCTSTR RegPath;
extern LPCTSTR FunctionName;

// CFunctionOptDlg
CFunctionOptDlg::CFunctionOptDlg() : m_bNewStyle(TRUE), m_Sort(TRUE),
m_bInline(FALSE), m_bUseAtlMisc(TRUE), m_bAllowDlgIdle(TRUE), m_bCheckMissingEndMap(TRUE)
{
}

CFunctionOptDlg::~CFunctionOptDlg()
{
}

LRESULT CFunctionOptDlg::OnInitDialog(HWND hwndFocus, LPARAM lParam)
{
	CRegArchive RegArchive;
	if (RegArchive.Open(HKEY_CURRENT_USER, RegPath))
	{
		LoadSettings(RegArchive, FunctionName);
		m_ColorSetup.LoadSettings(RegArchive, FunctionName);
		RegArchive.Close();
	}
	DoDataExchange();
	return TRUE;
}

void CFunctionOptDlg::SaveOptions()
{
	DoDataExchange(TRUE);
	CRegArchive RegArchive;
	if (RegArchive.Open(HKEY_CURRENT_USER, RegPath, true))
	{
		SaveSettings(RegArchive, FunctionName);
		m_ColorSetup.SaveSettings(RegArchive, FunctionName);
		RegArchive.Close();
	}
}

LRESULT CFunctionOptDlg::OnColorsClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	m_ColorSetup.DoModal();
	return 0;
}