CameraDistanceDialog.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program 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. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // CameraDistanceDialog.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "w3dview.h"
  22. #include "cameradistancedialog.h"
  23. #include "utils.h"
  24. #include "graphicview.h"
  25. #ifdef _DEBUG
  26. #define new DEBUG_NEW
  27. #undef THIS_FILE
  28. static char THIS_FILE[] = __FILE__;
  29. #endif
  30. /////////////////////////////////////////////////////////////////////////////
  31. //
  32. // CameraDistanceDialogClass
  33. //
  34. /////////////////////////////////////////////////////////////////////////////
  35. CameraDistanceDialogClass::CameraDistanceDialogClass(CWnd* pParent /*=NULL*/)
  36. : CDialog(CameraDistanceDialogClass::IDD, pParent)
  37. {
  38. //{{AFX_DATA_INIT(CameraDistanceDialogClass)
  39. // NOTE: the ClassWizard will add member initialization here
  40. //}}AFX_DATA_INIT
  41. return ;
  42. }
  43. /////////////////////////////////////////////////////////////////////////////
  44. //
  45. // DoDataExchange
  46. //
  47. /////////////////////////////////////////////////////////////////////////////
  48. void
  49. CameraDistanceDialogClass::DoDataExchange (CDataExchange *pDX)
  50. {
  51. CDialog::DoDataExchange(pDX);
  52. //{{AFX_DATA_MAP(CameraDistanceDialogClass)
  53. DDX_Control(pDX, IDC_DISTANCE_SPIN, m_DistanceSpinCtrl);
  54. //}}AFX_DATA_MAP
  55. return ;
  56. }
  57. BEGIN_MESSAGE_MAP(CameraDistanceDialogClass, CDialog)
  58. //{{AFX_MSG_MAP(CameraDistanceDialogClass)
  59. //}}AFX_MSG_MAP
  60. END_MESSAGE_MAP()
  61. /////////////////////////////////////////////////////////////////////////////
  62. //
  63. // OnInitDialog
  64. //
  65. /////////////////////////////////////////////////////////////////////////////
  66. BOOL
  67. CameraDistanceDialogClass::OnInitDialog (void)
  68. {
  69. CDialog::OnInitDialog ();
  70. CGraphicView *graphic_view = ::Get_Graphic_View ();
  71. ::Initialize_Spinner (m_DistanceSpinCtrl, graphic_view->Get_Camera_Distance (), 0, 25000.0F);
  72. ::SetDlgItemFloat (m_hWnd, IDC_DISTANCE_EDIT, graphic_view->Get_Camera_Distance ());
  73. return TRUE;
  74. }
  75. /////////////////////////////////////////////////////////////////////////////
  76. //
  77. // OnOK
  78. //
  79. /////////////////////////////////////////////////////////////////////////////
  80. void
  81. CameraDistanceDialogClass::OnOK (void)
  82. {
  83. CDialog::OnOK ();
  84. float distance = ::GetDlgItemFloat (m_hWnd, IDC_DISTANCE_EDIT);
  85. CGraphicView *graphic_view = ::Get_Graphic_View ();
  86. graphic_view->Set_Camera_Distance (distance);
  87. return ;
  88. }
  89. ////////////////////////////////////////////////////////////////////
  90. //
  91. // OnNotify
  92. //
  93. ////////////////////////////////////////////////////////////////////
  94. BOOL
  95. CameraDistanceDialogClass::OnNotify
  96. (
  97. WPARAM wParam,
  98. LPARAM lParam,
  99. LRESULT *pResult
  100. )
  101. {
  102. //
  103. // Update the spinner control if necessary
  104. //
  105. NMHDR *pheader = (NMHDR *)lParam;
  106. if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) {
  107. LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam;
  108. ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta);
  109. }
  110. // Allow the base class to process this message
  111. return CDialog::OnNotify (wParam, lParam, pResult);
  112. }