RotateDlg.cpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #include "../../idlib/precompiled.h"
  21. #pragma hdrstop
  22. #include "qe3.h"
  23. #include "Radiant.h"
  24. #include "RotateDlg.h"
  25. #ifdef _DEBUG
  26. #define new DEBUG_NEW
  27. #undef THIS_FILE
  28. static char THIS_FILE[] = __FILE__;
  29. #endif
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CRotateDlg dialog
  32. CRotateDlg::CRotateDlg(CWnd* pParent /*=NULL*/)
  33. : CDialog(CRotateDlg::IDD, pParent)
  34. {
  35. //{{AFX_DATA_INIT(CRotateDlg)
  36. m_strX = _T("");
  37. m_strY = _T("");
  38. m_strZ = _T("");
  39. //}}AFX_DATA_INIT
  40. }
  41. void CRotateDlg::DoDataExchange(CDataExchange* pDX)
  42. {
  43. CDialog::DoDataExchange(pDX);
  44. //{{AFX_DATA_MAP(CRotateDlg)
  45. DDX_Control(pDX, IDC_SPIN3, m_wndSpin3);
  46. DDX_Control(pDX, IDC_SPIN2, m_wndSpin2);
  47. DDX_Control(pDX, IDC_SPIN1, m_wndSpin1);
  48. DDX_Text(pDX, IDC_ROTX, m_strX);
  49. DDX_Text(pDX, IDC_ROTY, m_strY);
  50. DDX_Text(pDX, IDC_ROTZ, m_strZ);
  51. //}}AFX_DATA_MAP
  52. }
  53. BEGIN_MESSAGE_MAP(CRotateDlg, CDialog)
  54. //{{AFX_MSG_MAP(CRotateDlg)
  55. ON_BN_CLICKED(IDC_APPLY, OnApply)
  56. ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaposSpin1)
  57. ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN2, OnDeltaposSpin2)
  58. ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN3, OnDeltaposSpin3)
  59. //}}AFX_MSG_MAP
  60. END_MESSAGE_MAP()
  61. /////////////////////////////////////////////////////////////////////////////
  62. // CRotateDlg message handlers
  63. void CRotateDlg::OnOK()
  64. {
  65. OnApply();
  66. CDialog::OnOK();
  67. }
  68. void CRotateDlg::OnApply()
  69. {
  70. UpdateData(TRUE);
  71. float f = atof(m_strX);
  72. if (f != 0.0)
  73. Select_RotateAxis(0,f);
  74. f = atof(m_strY);
  75. if (f != 0.0)
  76. Select_RotateAxis(1,f);
  77. f = atof(m_strZ);
  78. if (f != 0.0)
  79. Select_RotateAxis(2,f);
  80. }
  81. BOOL CRotateDlg::OnInitDialog()
  82. {
  83. CDialog::OnInitDialog();
  84. m_wndSpin1.SetRange(0, 359);
  85. m_wndSpin2.SetRange(0, 359);
  86. m_wndSpin3.SetRange(0, 359);
  87. return TRUE; // return TRUE unless you set the focus to a control
  88. // EXCEPTION: OCX Property Pages should return FALSE
  89. }
  90. void CRotateDlg::OnDeltaposSpin1(NMHDR* pNMHDR, LRESULT* pResult)
  91. {
  92. NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
  93. Select_RotateAxis(0, pNMUpDown->iDelta);
  94. *pResult = 0;
  95. }
  96. void CRotateDlg::OnDeltaposSpin2(NMHDR* pNMHDR, LRESULT* pResult)
  97. {
  98. NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
  99. Select_RotateAxis(1, pNMUpDown->iDelta);
  100. *pResult = 0;
  101. }
  102. void CRotateDlg::OnDeltaposSpin3(NMHDR* pNMHDR, LRESULT* pResult)
  103. {
  104. NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
  105. Select_RotateAxis(2, pNMUpDown->iDelta);
  106. *pResult = 0;
  107. }
  108. void CRotateDlg::ApplyNoPaint()
  109. {
  110. }