ComboUInputDlg.cpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. #include "stdafx.h"
  17. #include "finalsun.h"
  18. #include "ComboUInputDlg.h"
  19. #include "functions.h"
  20. #include "inlines.h"
  21. #ifdef _DEBUG
  22. #define new DEBUG_NEW
  23. #undef THIS_FILE
  24. static char THIS_FILE[] = __FILE__;
  25. #endif
  26. /////////////////////////////////////////////////////////////////////////////
  27. // Dialogfeld CComboUInputDlg
  28. CComboUInputDlg::CComboUInputDlg(CWnd* pParent /*=NULL*/)
  29. : CDialog(CComboUInputDlg::IDD, pParent)
  30. {
  31. //{{AFX_DATA_INIT(CComboUInputDlg)
  32. m_Caption = _T("");
  33. m_Combo = _T("");
  34. //}}AFX_DATA_INIT
  35. m_type=0;
  36. bTruncateStrings=FALSE;
  37. }
  38. void CComboUInputDlg::DoDataExchange(CDataExchange* pDX)
  39. {
  40. CDialog::DoDataExchange(pDX);
  41. //{{AFX_DATA_MAP(CComboUInputDlg)
  42. DDX_Text(pDX, IDC_CAPTION, m_Caption);
  43. DDX_CBString(pDX, IDC_COMBO1, m_Combo);
  44. //}}AFX_DATA_MAP
  45. }
  46. BEGIN_MESSAGE_MAP(CComboUInputDlg, CDialog)
  47. //{{AFX_MSG_MAP(CComboUInputDlg)
  48. //}}AFX_MSG_MAP
  49. END_MESSAGE_MAP()
  50. /////////////////////////////////////////////////////////////////////////////
  51. // Behandlungsroutinen für Nachrichten CComboUInputDlg
  52. BOOL CComboUInputDlg::OnInitDialog()
  53. {
  54. CDialog::OnInitDialog();
  55. CComboBox* box=(CComboBox*)GetDlgItem(IDC_COMBO1);
  56. switch(m_type)
  57. {
  58. case COMBOUINPUT_HOUSES:
  59. {
  60. ListHouses(*box, FALSE, FALSE);
  61. break;
  62. }
  63. case COMBOUINPUT_COUNTRIES:
  64. ListHouses(*box, FALSE, TRUE);
  65. break;
  66. case COMBOUINPUT_TRIGGERS:
  67. ListTriggers(*box);
  68. break;
  69. case COMBOUINPUT_TAGS:
  70. ListTags(*box, FALSE);
  71. break;
  72. case COMBOUINPUT_HOUSES_N:
  73. {
  74. ListHouses(*box, TRUE, FALSE);
  75. break;
  76. }
  77. case COMBOUINPUT_COUNTRIES_N:
  78. ListHouses(*box, TRUE, TRUE);
  79. break;
  80. case COMBOUINPUT_MANUAL:
  81. int i;
  82. for(i=0;i<m_ManualStrings.size();i++)
  83. box->AddString(m_ManualStrings[i]);
  84. }
  85. box->SetCurSel(0);
  86. return TRUE; // return TRUE unless you set the focus to a control
  87. // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben
  88. }
  89. void CComboUInputDlg::OnOK()
  90. {
  91. UpdateData(TRUE);
  92. if(m_type==COMBOUINPUT_TRIGGERS || m_type==COMBOUINPUT_TAGS || m_type==COMBOUINPUT_HOUSES_N || m_type==COMBOUINPUT_COUNTRIES_N) TruncSpace(m_Combo);
  93. else if(m_type==COMBOUINPUT_MANUAL)
  94. {
  95. if(bTruncateStrings) TruncSpace(m_Combo);
  96. }
  97. else
  98. {
  99. m_Combo=TranslateHouse(m_Combo, FALSE);
  100. }
  101. EndDialog(0);
  102. //CDialog::OnOK();
  103. }
  104. void CComboUInputDlg::OnCancel()
  105. {
  106. // TODO: Zusätzlichen Bereinigungscode hier einfügen
  107. //CDialog::OnCancel();
  108. }