RotateDlg.cpp (3382B)
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 // RotateDlg.cpp : implementation file 23 // 24 25 #include "stdafx.h" 26 #include "Radiant.h" 27 #include "RotateDlg.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 // CRotateDlg dialog 37 38 39 CRotateDlg::CRotateDlg(CWnd* pParent /*=NULL*/) 40 : CDialog(CRotateDlg::IDD, pParent) 41 { 42 //{{AFX_DATA_INIT(CRotateDlg) 43 m_strX = _T(""); 44 m_strY = _T(""); 45 m_strZ = _T(""); 46 //}}AFX_DATA_INIT 47 } 48 49 50 void CRotateDlg::DoDataExchange(CDataExchange* pDX) 51 { 52 CDialog::DoDataExchange(pDX); 53 //{{AFX_DATA_MAP(CRotateDlg) 54 DDX_Control(pDX, IDC_SPIN3, m_wndSpin3); 55 DDX_Control(pDX, IDC_SPIN2, m_wndSpin2); 56 DDX_Control(pDX, IDC_SPIN1, m_wndSpin1); 57 DDX_Text(pDX, IDC_ROTX, m_strX); 58 DDX_Text(pDX, IDC_ROTY, m_strY); 59 DDX_Text(pDX, IDC_ROTZ, m_strZ); 60 //}}AFX_DATA_MAP 61 } 62 63 64 BEGIN_MESSAGE_MAP(CRotateDlg, CDialog) 65 //{{AFX_MSG_MAP(CRotateDlg) 66 ON_BN_CLICKED(ID_APPLY, OnApply) 67 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaposSpin1) 68 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN2, OnDeltaposSpin2) 69 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN3, OnDeltaposSpin3) 70 //}}AFX_MSG_MAP 71 END_MESSAGE_MAP() 72 73 ///////////////////////////////////////////////////////////////////////////// 74 // CRotateDlg message handlers 75 76 void CRotateDlg::OnOK() 77 { 78 OnApply(); 79 CDialog::OnOK(); 80 } 81 82 void CRotateDlg::OnApply() 83 { 84 UpdateData(TRUE); 85 float f = atof(m_strX); 86 if (f != 0.0) 87 Select_RotateAxis(0,f); 88 f = atof(m_strY); 89 if (f != 0.0) 90 Select_RotateAxis(1,f); 91 f = atof(m_strZ); 92 if (f != 0.0) 93 Select_RotateAxis(2,f); 94 } 95 96 BOOL CRotateDlg::OnInitDialog() 97 { 98 CDialog::OnInitDialog(); 99 m_wndSpin1.SetRange(0, 359); 100 m_wndSpin2.SetRange(0, 359); 101 m_wndSpin3.SetRange(0, 359); 102 return TRUE; // return TRUE unless you set the focus to a control 103 // EXCEPTION: OCX Property Pages should return FALSE 104 } 105 106 void CRotateDlg::OnDeltaposSpin1(NMHDR* pNMHDR, LRESULT* pResult) 107 { 108 NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; 109 Select_RotateAxis(0, pNMUpDown->iDelta); 110 *pResult = 0; 111 } 112 113 void CRotateDlg::OnDeltaposSpin2(NMHDR* pNMHDR, LRESULT* pResult) 114 { 115 NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; 116 Select_RotateAxis(1, pNMUpDown->iDelta); 117 *pResult = 0; 118 } 119 120 void CRotateDlg::OnDeltaposSpin3(NMHDR* pNMHDR, LRESULT* pResult) 121 { 122 NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; 123 Select_RotateAxis(2, pNMUpDown->iDelta); 124 *pResult = 0; 125 } 126 127 void CRotateDlg::ApplyNoPaint() 128 { 129 130 }