Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. // ScaleVerticesDlg.cpp : implementation file
  9. //
  10. #include "stdafx.h"
  11. #include "hammer.h"
  12. #include "ScaleVerticesDlg.h"
  13. #include "MapDoc.h"
  14. #include "GlobalFunctions.h"
  15. // memdbgon must be the last include file in a .cpp file!!!
  16. #include <tier0/memdbgon.h>
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CScaleVerticesDlg dialog
  19. CScaleVerticesDlg::CScaleVerticesDlg(CWnd* pParent /*=NULL*/)
  20. : CDialog(CScaleVerticesDlg::IDD, pParent)
  21. {
  22. //{{AFX_DATA_INIT(CScaleVerticesDlg)
  23. //}}AFX_DATA_INIT
  24. }
  25. void CScaleVerticesDlg::DoDataExchange(CDataExchange* pDX)
  26. {
  27. CDialog::DoDataExchange(pDX);
  28. //{{AFX_DATA_MAP(CScaleVerticesDlg)
  29. DDX_Control(pDX, IDC_SCALESPIN, m_cScaleSpin);
  30. DDX_Control(pDX, IDC_SCALE, m_cScale);
  31. //}}AFX_DATA_MAP
  32. }
  33. BEGIN_MESSAGE_MAP(CScaleVerticesDlg, CDialog)
  34. //{{AFX_MSG_MAP(CScaleVerticesDlg)
  35. ON_EN_CHANGE(IDC_SCALE, OnChangeScale)
  36. ON_NOTIFY(UDN_DELTAPOS, IDC_SCALESPIN, OnDeltaposScalespin)
  37. ON_WM_CLOSE()
  38. //}}AFX_MSG_MAP
  39. END_MESSAGE_MAP()
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CScaleVerticesDlg message handlers
  42. void CScaleVerticesDlg::OnChangeScale()
  43. {
  44. CString str;
  45. m_cScale.GetWindowText(str);
  46. m_fScale = atof(str);
  47. if (m_fScale <= 0)
  48. {
  49. m_fScale = (float)0.005;
  50. }
  51. // send command to document
  52. CMapDoc::GetActiveMapDoc()->OnCmdMsg(ID_VSCALE_CHANGED, CN_COMMAND, NULL, NULL);
  53. }
  54. void CScaleVerticesDlg::OnDeltaposScalespin(NMHDR* pNMHDR, LRESULT* pResult)
  55. {
  56. NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
  57. CString str;
  58. m_cScale.GetWindowText(str);
  59. m_fScale = atof(str);
  60. m_fScale += 0.1f * float(pNMUpDown->iDelta);
  61. if(m_fScale <= 0)
  62. m_fScale = 0;
  63. str.Format("%.3f", m_fScale);
  64. m_cScale.SetWindowText(str);
  65. *pResult = 0;
  66. }
  67. BOOL CScaleVerticesDlg::OnInitDialog()
  68. {
  69. CDialog::OnInitDialog();
  70. m_cScale.SetWindowText("1.0");
  71. m_cScaleSpin.SetRange(UD_MINVAL, UD_MAXVAL);
  72. return TRUE;
  73. }
  74. void CScaleVerticesDlg::OnClose()
  75. {
  76. CDialog::OnClose();
  77. }