www.pudn.com > uoth_src.zip > PrintDlg.cpp
//----------------------------------------------------------------------------- // // @doc // // @module PrintDlg.cpp - Print select dialog | // // This module contains the definition of the print select dialog. // // 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: PrintDlg.cpp $ // //----------------------------------------------------------------------------- #include "StdAfx.h" #include "resource.h" #include "PrintDlg.h" #include "uoth.h" // // Debug NEW // #if defined (_DEBUG) && !defined (_WIN32_WCE) #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif // // Global variables // extern CPrinter g_sPrinter; extern CDevMode g_sDevMode; //----------------------------------------------------------------------------- // // @mfuncconstructor. // // @parm CFilter * | pFilter | Filter being edited // // @rdesc None. // //----------------------------------------------------------------------------- CPrintDlg::CPrintDlg (CFilter *pFilter) : m_dlgFilter (pFilter) { } //----------------------------------------------------------------------------- // // @mfunc destructor. // // @rdesc None. // //----------------------------------------------------------------------------- CPrintDlg::~CPrintDlg() { } //----------------------------------------------------------------------------- // // @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 CPrintDlg::OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { CString str; // // Create the filter dialog // { // // Get the rect of the dialog // CRect rectDlg; GetClientRect (&rectDlg); CRect rectScreenDlg; GetWindowRect (&rectScreenDlg); // // Load our dialog // m_dlgFilter .Create (m_hWnd, 0); // // Get the extra dialog rect // CRect rectSubDlg; m_dlgFilter .GetClientRect (&rectSubDlg); // // Reposition the extra dialog rect // HWND hWndAfter = ::GetWindow (GetDlgItem (IDOK), GW_HWNDPREV); m_dlgFilter .SetWindowPos (hWndAfter, 0, rectDlg .bottom, rectSubDlg .Width (),rectSubDlg .Height (), 0); // // Resize the main dialog // SetWindowPos (NULL, 0, 0, rectScreenDlg .Width (), rectScreenDlg .Height () + rectSubDlg .Height (), SWP_NOZORDER | SWP_NOMOVE); } // // Get the controls // m_cbContent = GetDlgItem (IDC_PRINT_CONTENT); m_cbMapImage = GetDlgItem (IDC_PRINT_MAP_OPTIONS); m_btnTerse = GetDlgItem (IDC_PRINT_TERSE); // // Center the dialog // CenterWindow (); // // Initialize the content // str .LoadString (IDS_CONTENT_TREASURES); m_cbContent .AddString (str); str .LoadString (IDS_CONTENT_REGIONS); m_cbContent .AddString (str); // // Initialize the map image // str .LoadString (IDS_MAP_OPTION_NONE); m_cbMapImage .AddString (str); str .LoadString (IDS_MAP_OPTION_BW_SMALL); m_cbMapImage .AddString (str); str .LoadString (IDS_MAP_OPTION_BW_LARGE); m_cbMapImage .AddString (str); str .LoadString (IDS_MAP_OPTION_COLOR_SMALL); m_cbMapImage .AddString (str); str .LoadString (IDS_MAP_OPTION_COLOR_LARGE); m_cbMapImage .AddString (str); // // Set the selections // m_cbContent .SetCurSel (m_nContent); m_cbMapImage .SetCurSel (m_nMapImage); m_btnTerse .SetCheck (m_fTerse); return TRUE; } //----------------------------------------------------------------------------- // // @mfunc Handle the user press Ok // // @parm WORD | wNotifyCode | Command notification code // // @parm WORD | wID | ID of the control // // @parm HWND | hWndCtl | Handle of the control // // @parm BOOL & | bHandled | If handled, set to true // // @rdesc Routine results // //----------------------------------------------------------------------------- LRESULT CPrintDlg::OnOk (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled) { // // Get the settings // m_nContent = (_Content) m_cbContent .GetCurSel (); m_nMapImage = (_MapImage) m_cbMapImage .GetCurSel (); m_fTerse = m_btnTerse .GetCheck () != 0; // // Copy the filter settings // *m_dlgFilter .m_pFilter = m_dlgFilter .m_sFilter; // // End the dialog // EndDialog (IDOK); return TRUE; } //----------------------------------------------------------------------------- // // @mfunc Handle the user press cancel // // @parm WORD | wNotifyCode | Command notification code // // @parm WORD | wID | ID of the control // // @parm HWND | hWndCtl | Handle of the control // // @parm BOOL & | bHandled | If handled, set to true // // @rdesc Routine results // //----------------------------------------------------------------------------- LRESULT CPrintDlg::OnCancel (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled) { // // End the dialog // EndDialog (IDCANCEL); return TRUE; } //----------------------------------------------------------------------------- // // @mfunc Handle page setup // // @parm WORD | wNotifyCode | Command notification code // // @parm WORD | wID | ID of the control // // @parm HWND | hWndCtl | Handle of the control // // @parm BOOL & | bHandled | If handled, set to true // // @rdesc Routine results // //----------------------------------------------------------------------------- LRESULT CPrintDlg::OnFilePageSetup (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled) { // // Invoke the helper // PageSetup (); return TRUE; }