Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

PatchDensityDlg.cpp (2558B)


      1 /*
      2 ===========================================================================
      3 Copyright (C) 1999-2005 Id Software, Inc.
      4 
      5 This file is part of Quake III Arena source code.
      6 
      7 Quake III Arena source code is free software; you can redistribute it
      8 and/or modify it under the terms of the GNU General Public License as
      9 published by the Free Software Foundation; either version 2 of the License,
     10 or (at your option) any later version.
     11 
     12 Quake III Arena source code is distributed in the hope that it will be
     13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 GNU General Public License for more details.
     16 
     17 You should have received a copy of the GNU General Public License
     18 along with Foobar; if not, write to the Free Software
     19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     20 ===========================================================================
     21 */
     22 // PatchDensityDlg.cpp : implementation file
     23 //
     24 
     25 #include "stdafx.h"
     26 #include "Radiant.h"
     27 #include "PatchDensityDlg.h"
     28 
     29 #ifdef _DEBUG
     30 #define new DEBUG_NEW
     31 #undef THIS_FILE
     32 static char THIS_FILE[] = __FILE__;
     33 #endif
     34 
     35 /////////////////////////////////////////////////////////////////////////////
     36 // CPatchDensityDlg dialog
     37 
     38 
     39 CPatchDensityDlg::CPatchDensityDlg(CWnd* pParent /*=NULL*/)
     40 	: CDialog(CPatchDensityDlg::IDD, pParent)
     41 {
     42 	//{{AFX_DATA_INIT(CPatchDensityDlg)
     43 	//}}AFX_DATA_INIT
     44 }
     45 
     46 
     47 void CPatchDensityDlg::DoDataExchange(CDataExchange* pDX)
     48 {
     49 	CDialog::DoDataExchange(pDX);
     50 	//{{AFX_DATA_MAP(CPatchDensityDlg)
     51 	DDX_Control(pDX, IDC_COMBO_WIDTH, m_wndWidth);
     52 	DDX_Control(pDX, IDC_COMBO_HEIGHT, m_wndHeight);
     53 	//}}AFX_DATA_MAP
     54 }
     55 
     56 
     57 BEGIN_MESSAGE_MAP(CPatchDensityDlg, CDialog)
     58 	//{{AFX_MSG_MAP(CPatchDensityDlg)
     59 	//}}AFX_MSG_MAP
     60 END_MESSAGE_MAP()
     61 
     62 /////////////////////////////////////////////////////////////////////////////
     63 // CPatchDensityDlg message handlers
     64 
     65 int g_nXLat[] = {3,5,7,9,11,13,15};
     66 
     67 void CPatchDensityDlg::OnOK() 
     68 {
     69   int nWidth = m_wndWidth.GetCurSel();
     70   int nHeight = m_wndHeight.GetCurSel();
     71 
     72   if (nWidth >= 0 && nWidth <= 6 && nHeight >= 0 && nHeight <= 6)
     73   {
     74 	  Patch_GenericMesh(g_nXLat[nWidth], g_nXLat[nHeight], g_pParentWnd->ActiveXY()->GetViewType());
     75     Sys_UpdateWindows(W_ALL);
     76   }
     77 
     78   CDialog::OnOK();
     79 }
     80 
     81 BOOL CPatchDensityDlg::OnInitDialog() 
     82 {
     83 	CDialog::OnInitDialog();
     84 
     85   m_wndWidth.SetCurSel(0);
     86   m_wndHeight.SetCurSel(0);
     87 	return TRUE;  // return TRUE unless you set the focus to a control
     88 	              // EXCEPTION: OCX Property Pages should return FALSE
     89 }