www.pudn.com > uoth_src.zip > DisplayOptionsPage.cpp
//----------------------------------------------------------------------------- // // @doc // // @module DisplayOptionsPage.cpp - Display options page | // // This module contains the definition of the display options page // // Copyright (c) 2002 - Descartes Systems Sciences, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // 2. Neither the name of Descartes Systems Sciences, Inc nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // @end // // $History: DisplayOptionsPage.cpp $ // //----------------------------------------------------------------------------- #include "stdafx.h" #include "resource.h" #include "DisplayOptionsPage.h" #include "uoth.h" #if defined (_DEBUG) #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif // // Externals // extern COLORREF g_clrTackWithoutDef; extern COLORREF g_clrTackWithDef; extern COLORREF g_clrRegionWithoutDef; extern COLORREF g_clrRegionWithDef; //----------------------------------------------------------------------------- // // @mfuncconstructor. // // @rdesc None. // //----------------------------------------------------------------------------- CDisplayOptionsPage::CDisplayOptionsPage () { // // Set the icon and enable help // #if !defined (_WIN32_WCE) // m_psp .dwFlags |= PSP_HASHELP | PSP_USEICONID; // m_psp .pszIcon = MAKEINTRESOURCE (IDR_IO_MONITOR); #endif } //----------------------------------------------------------------------------- // // @mfunc destructor. // // @rdesc None. // //----------------------------------------------------------------------------- CDisplayOptionsPage::~CDisplayOptionsPage () { } //----------------------------------------------------------------------------- // // @mfunc Initialize the dialog // // @parm UINT | uMsg | Message // // @parm WPARAM | wParam | Message w-parameter // // @parm LPARAM | lParam | Message l-parameter // // @parm BOOL & | bHandled | If handled, set to true // // @rdesc Routine results // //----------------------------------------------------------------------------- LRESULT CDisplayOptionsPage::OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { // // Center the sheet // CenterPropertySheet (GetPropertySheet ()); // // Get the controls // m_btnBeautyOverSpeed = GetDlgItem (IDC_GENERAL_BEAUTY); m_btnTacksCorrect = GetDlgItem (IDC_GENERAL_TACKSRIGHT); m_btnWithoutColor .SubclassWindow (GetDlgItem (IDC_WITHOUT_HILITE_COLOR)); m_btnWithColor .SubclassWindow (GetDlgItem (IDC_WITH_HILITE_COLOR)); m_btnTackWithoutColor .SubclassWindow (GetDlgItem (IDC_TACK_WITHOUT_COLOR)); m_btnTackWithColor .SubclassWindow (GetDlgItem (IDC_TACK_WITH_COLOR)); // // Set the text of the color buttons from the resource file // m_btnWithoutColor .SetText (IDS_COLOR_DEFAULT, IDS_COLOR_CUSTOM); m_btnWithColor .SetText (IDS_COLOR_DEFAULT, IDS_COLOR_CUSTOM); m_btnTackWithoutColor .SetText (IDS_COLOR_DEFAULT, IDS_COLOR_CUSTOM); m_btnTackWithColor .SetText (IDS_COLOR_DEFAULT, IDS_COLOR_CUSTOM); return 0; } //----------------------------------------------------------------------------- // // @mfunc Set the page active // // @rdesc None. // //----------------------------------------------------------------------------- BOOL CDisplayOptionsPage::OnSetActive () { // // Set the values // m_btnBeautyOverSpeed .SetCheck (m_fPrettyDrawing ? 1 : 0); m_btnTacksCorrect .SetCheck (m_fTacksCorrect ? 1 : 0); // // Set the colors // m_btnWithoutColor .SetDefaultColor (g_clrRegionWithoutDef); m_btnWithoutColor .SetColor (m_clrRegionWithout); m_btnWithColor .SetDefaultColor (g_clrRegionWithDef); m_btnWithColor .SetColor (m_clrRegionWith); m_btnTackWithoutColor .SetDefaultColor (g_clrTackWithoutDef); m_btnTackWithoutColor .SetColor (m_clrTackWithout); m_btnTackWithColor .SetDefaultColor (g_clrTackWithDef); m_btnTackWithColor .SetColor (m_clrTackWith); return TRUE; } //----------------------------------------------------------------------------- // // @mfunc Kill the page active // // @rdesc None. // //----------------------------------------------------------------------------- BOOL CDisplayOptionsPage::OnKillActive () { // // Get the values // m_fPrettyDrawing = m_btnBeautyOverSpeed .GetCheck () != 0; m_fTacksCorrect = m_btnTacksCorrect .GetCheck () != 0; // // Get the colors // m_clrRegionWithout = m_btnWithoutColor .GetColor (); m_clrRegionWith = m_btnWithColor .GetColor (); m_clrTackWithout = m_btnTackWithoutColor .GetColor (); m_clrTackWith = m_btnTackWithColor .GetColor (); return TRUE; }