CellTag.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. // CellTag.cpp: Implementierungsdatei
  17. //
  18. #include "stdafx.h"
  19. #include "FinalSun.h"
  20. #include "CellTag.h"
  21. #include "mapdata.h"
  22. #include "variables.h"
  23. #include "functions.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // Dialogfeld CCellTag
  31. CCellTag::CCellTag(CWnd* pParent /*=NULL*/)
  32. : CDialog(CCellTag::IDD, pParent)
  33. {
  34. //{{AFX_DATA_INIT(CCellTag)
  35. m_tag = _T("");
  36. //}}AFX_DATA_INIT
  37. }
  38. void CCellTag::DoDataExchange(CDataExchange* pDX)
  39. {
  40. CDialog::DoDataExchange(pDX);
  41. //{{AFX_DATA_MAP(CCellTag)
  42. DDX_CBString(pDX, IDC_TAG, m_tag);
  43. //}}AFX_DATA_MAP
  44. }
  45. BEGIN_MESSAGE_MAP(CCellTag, CDialog)
  46. //{{AFX_MSG_MAP(CCellTag)
  47. //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49. /////////////////////////////////////////////////////////////////////////////
  50. // Behandlungsroutinen für Nachrichten CCellTag
  51. string GetParam(string data, int pos);
  52. BOOL CCellTag::OnInitDialog()
  53. {
  54. CDialog::OnInitDialog();
  55. CIniFile& ini=Map->GetIniFile();
  56. CComboBox& m_Tag=*((CComboBox*)GetDlgItem(IDC_TAG));
  57. if(ini.sections.find("Tags")==ini.sections.end())
  58. {
  59. MessageBox("No tags are specified.");
  60. OnCancel();
  61. }
  62. else
  63. {
  64. ListTags(m_Tag, FALSE);
  65. if(m_tag=="") m_Tag.SetCurSel(0);
  66. }
  67. UpdateStrings();
  68. return TRUE;
  69. }
  70. void CCellTag::OnOK()
  71. {
  72. UpdateData();
  73. CDialog::OnOK();
  74. TruncSpace(m_tag);
  75. }
  76. void CCellTag::UpdateStrings()
  77. {
  78. SetWindowText(GetLanguageStringACP("CellTagCap"));
  79. GetDlgItem(IDC_LTAG)->SetWindowText(GetLanguageStringACP("CellTagTag"));
  80. GetDlgItem(IDC_LDESC)->SetWindowText(GetLanguageStringACP("CellTagDesc"));
  81. }