CardinalDialog.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. // CardinalDialog.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "SplineTest.h"
  22. #include "CardinalDialog.h"
  23. #include "curve.h"
  24. #include "hermitespline.h"
  25. #include "catmullromspline.h"
  26. #include "cardinalspline.h"
  27. #include "tcbspline.h"
  28. #ifdef _DEBUG
  29. #define new DEBUG_NEW
  30. #undef THIS_FILE
  31. static char THIS_FILE[] = __FILE__;
  32. #endif
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CCardinalDialog dialog
  35. CCardinalDialog::CCardinalDialog(CWnd* pParent /*=NULL*/,CardinalSpline3DClass * curve,int key)
  36. : CDialog(CCardinalDialog::IDD, pParent)
  37. {
  38. //{{AFX_DATA_INIT(CCardinalDialog)
  39. // NOTE: the ClassWizard will add member initialization here
  40. //}}AFX_DATA_INIT
  41. Curve = curve;
  42. Key = key;
  43. }
  44. void CCardinalDialog::DoDataExchange(CDataExchange* pDX)
  45. {
  46. CDialog::DoDataExchange(pDX);
  47. //{{AFX_DATA_MAP(CCardinalDialog)
  48. // NOTE: the ClassWizard will add DDX and DDV calls here
  49. //}}AFX_DATA_MAP
  50. }
  51. BEGIN_MESSAGE_MAP(CCardinalDialog, CDialog)
  52. //{{AFX_MSG_MAP(CCardinalDialog)
  53. //}}AFX_MSG_MAP
  54. END_MESSAGE_MAP()
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CCardinalDialog message handlers
  57. BOOL CCardinalDialog::OnInitDialog()
  58. {
  59. CDialog::OnInitDialog();
  60. SetDlgItemFloat(IDC_TIGHTNESS_EDIT,Curve->Get_Tightness(Key));
  61. return TRUE;
  62. }
  63. void CCardinalDialog::OnOK()
  64. {
  65. Curve->Set_Tightness(Key,GetDlgItemFloat(IDC_TIGHTNESS_EDIT));
  66. CDialog::OnOK();
  67. }
  68. float CCardinalDialog::GetDlgItemFloat(int controlid)
  69. {
  70. CString string;
  71. GetDlgItemText(controlid,string);
  72. return atof(string);
  73. }
  74. void CCardinalDialog::SetDlgItemFloat(int controlid,float val)
  75. {
  76. CString string;
  77. string.Format("%.2f",val);
  78. SetDlgItemText(controlid,string);
  79. }