| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- /*
- ** Command & Conquer Renegade(tm)
- ** Copyright 2025 Electronic Arts Inc.
- **
- ** This program is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- // WWConfigDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "wwconfig.h"
- #include "wwconfigdlg.h"
- #include "videoconfigdialog.h"
- #include "audioconfigdialog.h"
- #include "performanceconfigdialog.h"
- #include "locale_api.h"
- #include "wwconfig_ids.h"
- extern int GlobalExitValue;
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- ///////////////////////////////////////////////////////////////////
- //
- // CWWConfigDlg
- //
- ///////////////////////////////////////////////////////////////////
- CWWConfigDlg::CWWConfigDlg (CWnd *pParent)
- : CurrentTab (0),
- CDialog(CWWConfigDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CWWConfigDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
-
- m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- return ;
- }
- ///////////////////////////////////////////////////////////////////
- //
- // DoDataExchange
- //
- ///////////////////////////////////////////////////////////////////
- void
- CWWConfigDlg::DoDataExchange (CDataExchange *pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CWWConfigDlg)
- DDX_Control(pDX, IDC_TAB_CTRL, m_TabCtrl);
- //}}AFX_DATA_MAP
- return ;
- }
- BEGIN_MESSAGE_MAP(CWWConfigDlg, CDialog)
- //{{AFX_MSG_MAP(CWWConfigDlg)
- ON_WM_PAINT()
- ON_WM_QUERYDRAGICON()
- ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_CTRL, OnSelchangeTabCtrl)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- ///////////////////////////////////////////////////////////////////
- //
- // OnInitDialog
- //
- // Modified: 12/06/2001 by MML - Retrieving strings from Locomoto file.
- ///////////////////////////////////////////////////////////////////
- BOOL
- CWWConfigDlg::OnInitDialog (void)
- {
- char string[ _MAX_PATH ];
- CDialog::OnInitDialog();
- // Set the icon for this dialog. The framework does this automatically
- // when the application's main window is not a dialog
- SetIcon (m_hIcon, TRUE);
- SetIcon (m_hIcon, FALSE);
- //
- // Set Title of Dialog.
- //
- Locale_GetString( IDS_WWCONFIG_TITLE, string );
- SetWindowText((LPCTSTR) string );
- //
- // Set text on buttons.
- //
- Locale_GetString( IDS_OK, string );
- SetDlgItemText( IDOK, string );
- Locale_GetString( IDS_CANCEL, string );
- SetDlgItemText( IDCANCEL, string );
- //
- // Add a tab to the dialog for video configuration
- //
- TC_ITEM tab_info = { 0 };
- Locale_GetString( IDS_VIDEO_TAB, string );
- tab_info.mask = TCIF_TEXT;
- // tab_info.pszText = "Video";
- tab_info.pszText = string;
- m_TabCtrl.InsertItem (0xFF, &tab_info);
- //
- // Add a tab to the dialog for audio configuration
- //
- Locale_GetString( IDS_SOUND_TAB, string );
- tab_info.mask = TCIF_TEXT;
- // tab_info.pszText = "Sound";
- tab_info.pszText = string;
- m_TabCtrl.InsertItem (0xFF, &tab_info);
- //
- // Add a tab to the dialog for performance configuration
- //
- Locale_GetString( IDS_PERFORMANCE_TAB, string );
- tab_info.mask = TCIF_TEXT;
- // tab_info.pszText = "Performance";
- tab_info.pszText = string;
- m_TabCtrl.InsertItem (0xFF, &tab_info);
- //
- // Get the display rectangle of the tab control
- //
- CRect tab_rect;
- m_TabCtrl.GetWindowRect (&tab_rect);
- m_TabCtrl.AdjustRect (FALSE, &tab_rect);
- ScreenToClient (&tab_rect);
- VideoConfigDialogClass *video_page = new VideoConfigDialogClass (this);
- AudioConfigDialogClass *audio_page = new AudioConfigDialogClass (this);
- PerformanceConfigDialogClass *performance_page = new PerformanceConfigDialogClass (this);
- video_page->SetWindowPos ( NULL, tab_rect.left, tab_rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
- audio_page->SetWindowPos ( NULL, tab_rect.left, tab_rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
- performance_page->SetWindowPos ( NULL, tab_rect.left, tab_rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
- ConfigPages.Add ( video_page );
- ConfigPages.Add ( audio_page );
- ConfigPages.Add ( performance_page );
-
- //
- // Display the first category page
- //
- ConfigPages[0]->ShowWindow( SW_SHOW );
- return TRUE;
- }
- ///////////////////////////////////////////////////////////////////
- //
- // OnPaint
- //
- ///////////////////////////////////////////////////////////////////
- void
- CWWConfigDlg::OnPaint (void)
- {
- if (IsIconic())
- {
- CPaintDC dc(this);
- SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
- // Center icon in client rectangle
- int cxIcon = GetSystemMetrics(SM_CXICON);
- int cyIcon = GetSystemMetrics(SM_CYICON);
- CRect rect;
- GetClientRect(&rect);
- int x = (rect.Width() - cxIcon + 1) / 2;
- int y = (rect.Height() - cyIcon + 1) / 2;
- // Draw the icon
- dc.DrawIcon(x, y, m_hIcon);
- }
- else
- {
- CDialog::OnPaint();
- }
- return ;
- }
- ///////////////////////////////////////////////////////////////////
- //
- // OnQueryDragIcon
- //
- ///////////////////////////////////////////////////////////////////
- HCURSOR
- CWWConfigDlg::OnQueryDragIcon (void)
- {
- return (HCURSOR) m_hIcon;
- }
- ///////////////////////////////////////////////////////////////////
- //
- // OnOK
- //
- ///////////////////////////////////////////////////////////////////
- void
- CWWConfigDlg::OnOK (void)
- {
- GlobalExitValue=0;
- //
- // Loop over each page and ask them to save themselves
- //
- for (int index = 0; index < ConfigPages.Count (); index ++) {
- ConfigPages[index]->SendMessage (WM_USER + 101);
- }
- CDialog::OnOK ();
- return ;
- }
- ///////////////////////////////////////////////////////////////////
- //
- // OnSelchangeTabCtrl
- //
- ///////////////////////////////////////////////////////////////////
- void
- CWWConfigDlg::OnSelchangeTabCtrl
- (
- NMHDR * pNMHDR,
- LRESULT * pResult
- )
- {
- (*pResult) = 0;
- //
- // Check to see if the user has selected a new tab
- //
- int newtab = m_TabCtrl.GetCurSel ();
- if (CurrentTab != newtab) {
-
- //
- // Hide the old tab
- //
- if (CurrentTab < ConfigPages.Count () && ConfigPages[CurrentTab] != NULL) {
- ConfigPages[CurrentTab]->ShowWindow (SW_HIDE);
- }
- //
- // Show the new tab
- //
- if (ConfigPages[newtab] != NULL) {
- ConfigPages[newtab]->ShowWindow (SW_SHOW);
- }
- //
- // Remember what our new current tab is
- //
- CurrentTab = newtab;
- }
- return ;
- }
- void CWWConfigDlg::OnCancel()
- {
- // TODO: Add extra cleanup here
- GlobalExitValue=1;
- CDialog::OnCancel();
- }
|