ToolSettingsBar.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. // ToolSettingsBar.cpp: Implementierungsdatei
  17. //
  18. #include "stdafx.h"
  19. #include "finalsun.h"
  20. #include "ToolSettingsBar.h"
  21. #include "FinalSunDlg.h"
  22. #include "mapdata.h"
  23. #include "variables.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // Dialogfeld CToolSettingsBar
  31. CToolSettingsBar::CToolSettingsBar(CWnd* pParent /*=NULL*/)
  32. : CDialogBar()
  33. {
  34. //{{AFX_DATA_INIT(CToolSettingsBar)
  35. m_BrushSize = 0;
  36. //}}AFX_DATA_INIT
  37. }
  38. void CToolSettingsBar::DoDataExchange(CDataExchange* pDX)
  39. {
  40. CDialogBar::DoDataExchange(pDX);
  41. //{{AFX_DATA_MAP(CToolSettingsBar)
  42. DDX_CBIndex(pDX, IDC_BRUSHSIZE, m_BrushSize);
  43. //}}AFX_DATA_MAP
  44. }
  45. BEGIN_MESSAGE_MAP(CToolSettingsBar, CDialogBar)
  46. //{{AFX_MSG_MAP(CToolSettingsBar)
  47. ON_CBN_SELCHANGE(IDC_BRUSHSIZE, OnSelchangeBrushsize)
  48. ON_WM_SHOWWINDOW()
  49. //}}AFX_MSG_MAP
  50. END_MESSAGE_MAP()
  51. /////////////////////////////////////////////////////////////////////////////
  52. // Behandlungsroutinen für Nachrichten CToolSettingsBar
  53. void CToolSettingsBar::OnSelchangeBrushsize()
  54. {
  55. UpdateData(TRUE);
  56. int bx,by;
  57. switch(m_BrushSize)
  58. {
  59. case 0:
  60. bx=1;
  61. by=1;
  62. break;
  63. case 1:
  64. bx=2;
  65. by=2;
  66. break;
  67. case 2:
  68. bx=3;
  69. by=3;
  70. break;
  71. case 3:
  72. bx=4;
  73. by=4;
  74. break;
  75. case 4:
  76. bx=5;
  77. by=5;
  78. break;
  79. case 5:
  80. bx=10;
  81. by=10;
  82. break;
  83. case 6:
  84. bx=1;
  85. by=2;
  86. break;
  87. case 7:
  88. bx=2;
  89. by=1;
  90. break;
  91. case 8:
  92. bx=1;
  93. by=3;
  94. break;
  95. case 9:
  96. bx=3;
  97. by=1;
  98. break;
  99. }
  100. ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_x=bx;
  101. ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_y=by;
  102. }
  103. BOOL CToolSettingsBar::OnInitDialog()
  104. {
  105. m_BrushSize=0;
  106. UpdateData(FALSE);
  107. ((CComboBox*)GetDlgItem(IDC_BRUSHSIZE))->SetCurSel(0);
  108. return TRUE; // return TRUE unless you set the focus to a control
  109. // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben
  110. }
  111. void CToolSettingsBar::OnShowWindow(BOOL bShow, UINT nStatus)
  112. {
  113. CDialogBar::OnShowWindow(bShow, nStatus);
  114. UpdateData(FALSE);
  115. }