ChangeSizeDlg.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. FinalSun/FinalAlert 2 Mission Editor
  3. Copyright (C) 1999-2024 Electronic Arts, Inc.
  4. Authored by Matthias Wagner
  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. This program is distributed in the hope that it will be useful,
  10. 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 this program. If not, see <https://www.gnu.org/licenses/>.
  15. */
  16. // ChangeSizeDlg.cpp: Implementierungsdatei
  17. //
  18. #include "stdafx.h"
  19. #include "finalsun.h"
  20. #include "ChangeSizeDlg.h"
  21. #include "variables.h"
  22. #ifdef _DEBUG
  23. #define new DEBUG_NEW
  24. #undef THIS_FILE
  25. static char THIS_FILE[] = __FILE__;
  26. #endif
  27. /////////////////////////////////////////////////////////////////////////////
  28. // Dialogfeld CChangeSizeDlg
  29. CChangeSizeDlg::CChangeSizeDlg(CWnd* pParent /*=NULL*/)
  30. : CDialog(CChangeSizeDlg::IDD, pParent)
  31. {
  32. //{{AFX_DATA_INIT(CChangeSizeDlg)
  33. m_Left = 0;
  34. m_Height = 0;
  35. m_Top = 0;
  36. m_Width = 0;
  37. //}}AFX_DATA_INIT
  38. m_Width=Map->GetWidth();
  39. m_Height=Map->GetHeight();
  40. }
  41. void CChangeSizeDlg::DoDataExchange(CDataExchange* pDX)
  42. {
  43. CDialog::DoDataExchange(pDX);
  44. //{{AFX_DATA_MAP(CChangeSizeDlg)
  45. DDX_Text(pDX, IDC_LEFT, m_Left);
  46. DDX_Text(pDX, IDC_HEIGHT, m_Height);
  47. DDV_MinMaxInt(pDX, m_Height, 0, 400);
  48. DDX_Text(pDX, IDC_TOP, m_Top);
  49. DDX_Text(pDX, IDC_WIDTH, m_Width);
  50. DDV_MinMaxInt(pDX, m_Width, 0, 400);
  51. //}}AFX_DATA_MAP
  52. }
  53. BEGIN_MESSAGE_MAP(CChangeSizeDlg, CDialog)
  54. //{{AFX_MSG_MAP(CChangeSizeDlg)
  55. ON_EN_CHANGE(IDC_WIDTH, OnChangeWidth)
  56. ON_EN_CHANGE(IDC_HEIGHT, OnChangeHeight)
  57. //}}AFX_MSG_MAP
  58. END_MESSAGE_MAP()
  59. /////////////////////////////////////////////////////////////////////////////
  60. // Behandlungsroutinen für Nachrichten CChangeSizeDlg
  61. void CChangeSizeDlg::OnChangeWidth()
  62. {
  63. if(UpdateData(TRUE))
  64. {
  65. m_Left=(m_Width-Map->GetWidth())/2;
  66. UpdateData(FALSE);
  67. }
  68. }
  69. void CChangeSizeDlg::OnChangeHeight()
  70. {
  71. if(UpdateData(TRUE))
  72. {
  73. m_Top=(m_Height-Map->GetHeight())/2;
  74. UpdateData(FALSE);
  75. }
  76. }