RotateDlg.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1999-2005 Id Software, Inc.
  4. This file is part of Quake III Arena source code.
  5. Quake III Arena source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake III Arena source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Foobar; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. // RotateDlg.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "Radiant.h"
  22. #include "RotateDlg.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CRotateDlg dialog
  30. CRotateDlg::CRotateDlg(CWnd* pParent /*=NULL*/)
  31. : CDialog(CRotateDlg::IDD, pParent)
  32. {
  33. //{{AFX_DATA_INIT(CRotateDlg)
  34. m_strX = _T("");
  35. m_strY = _T("");
  36. m_strZ = _T("");
  37. //}}AFX_DATA_INIT
  38. }
  39. void CRotateDlg::DoDataExchange(CDataExchange* pDX)
  40. {
  41. CDialog::DoDataExchange(pDX);
  42. //{{AFX_DATA_MAP(CRotateDlg)
  43. DDX_Control(pDX, IDC_SPIN3, m_wndSpin3);
  44. DDX_Control(pDX, IDC_SPIN2, m_wndSpin2);
  45. DDX_Control(pDX, IDC_SPIN1, m_wndSpin1);
  46. DDX_Text(pDX, IDC_ROTX, m_strX);
  47. DDX_Text(pDX, IDC_ROTY, m_strY);
  48. DDX_Text(pDX, IDC_ROTZ, m_strZ);
  49. //}}AFX_DATA_MAP
  50. }
  51. BEGIN_MESSAGE_MAP(CRotateDlg, CDialog)
  52. //{{AFX_MSG_MAP(CRotateDlg)
  53. ON_BN_CLICKED(ID_APPLY, OnApply)
  54. ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaposSpin1)
  55. ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN2, OnDeltaposSpin2)
  56. ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN3, OnDeltaposSpin3)
  57. //}}AFX_MSG_MAP
  58. END_MESSAGE_MAP()
  59. /////////////////////////////////////////////////////////////////////////////
  60. // CRotateDlg message handlers
  61. void CRotateDlg::OnOK()
  62. {
  63. OnApply();
  64. CDialog::OnOK();
  65. }
  66. void CRotateDlg::OnApply()
  67. {
  68. UpdateData(TRUE);
  69. float f = atof(m_strX);
  70. if (f != 0.0)
  71. Select_RotateAxis(0,f);
  72. f = atof(m_strY);
  73. if (f != 0.0)
  74. Select_RotateAxis(1,f);
  75. f = atof(m_strZ);
  76. if (f != 0.0)
  77. Select_RotateAxis(2,f);
  78. }
  79. BOOL CRotateDlg::OnInitDialog()
  80. {
  81. CDialog::OnInitDialog();
  82. m_wndSpin1.SetRange(0, 359);
  83. m_wndSpin2.SetRange(0, 359);
  84. m_wndSpin3.SetRange(0, 359);
  85. return TRUE; // return TRUE unless you set the focus to a control
  86. // EXCEPTION: OCX Property Pages should return FALSE
  87. }
  88. void CRotateDlg::OnDeltaposSpin1(NMHDR* pNMHDR, LRESULT* pResult)
  89. {
  90. NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
  91. Select_RotateAxis(0, pNMUpDown->iDelta);
  92. *pResult = 0;
  93. }
  94. void CRotateDlg::OnDeltaposSpin2(NMHDR* pNMHDR, LRESULT* pResult)
  95. {
  96. NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
  97. Select_RotateAxis(1, pNMUpDown->iDelta);
  98. *pResult = 0;
  99. }
  100. void CRotateDlg::OnDeltaposSpin3(NMHDR* pNMHDR, LRESULT* pResult)
  101. {
  102. NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
  103. Select_RotateAxis(2, pNMUpDown->iDelta);
  104. *pResult = 0;
  105. }
  106. void CRotateDlg::ApplyNoPaint()
  107. {
  108. }