SearchWaypointDlg.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. // SearchWaypointDlg.cpp: Implementierungsdatei
  17. //
  18. #include "stdafx.h"
  19. #include "finalsun.h"
  20. #include "SearchWaypointDlg.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 CSearchWaypointDlg
  29. CSearchWaypointDlg::CSearchWaypointDlg(CWnd* pParent /*=NULL*/)
  30. : CDialog(CSearchWaypointDlg::IDD, pParent)
  31. {
  32. //{{AFX_DATA_INIT(CSearchWaypointDlg)
  33. m_Waypoints = _T("");
  34. //}}AFX_DATA_INIT
  35. }
  36. void CSearchWaypointDlg::DoDataExchange(CDataExchange* pDX)
  37. {
  38. CDialog::DoDataExchange(pDX);
  39. //{{AFX_DATA_MAP(CSearchWaypointDlg)
  40. DDX_LBString(pDX, IDC_WAYPOINTS, m_Waypoints);
  41. //}}AFX_DATA_MAP
  42. }
  43. BEGIN_MESSAGE_MAP(CSearchWaypointDlg, CDialog)
  44. //{{AFX_MSG_MAP(CSearchWaypointDlg)
  45. //}}AFX_MSG_MAP
  46. END_MESSAGE_MAP()
  47. /////////////////////////////////////////////////////////////////////////////
  48. // Behandlungsroutinen für Nachrichten CSearchWaypointDlg
  49. BOOL CSearchWaypointDlg::OnInitDialog()
  50. {
  51. CDialog::OnInitDialog();
  52. CListBox& ctrl=*(CListBox*)GetDlgItem(IDC_WAYPOINTS);
  53. while(ctrl.DeleteString(0)!=LB_ERR);
  54. int i;
  55. int count=Map->GetWaypointCount();
  56. for(i=0;i<count;i++)
  57. {
  58. CString id;
  59. DWORD pos;
  60. Map->GetWaypointData(i, &id, &pos);
  61. ctrl.SetItemData(ctrl.InsertString(i, id), i);
  62. }
  63. return TRUE; // return TRUE unless you set the focus to a control
  64. // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben
  65. }
  66. void CSearchWaypointDlg::OnOK()
  67. {
  68. CListBox& ctrl=*(CListBox*)GetDlgItem(IDC_WAYPOINTS);
  69. int sel=ctrl.GetCurSel();
  70. if(sel<0) m_WaypointIndex=-1;
  71. else
  72. {
  73. m_WaypointIndex=ctrl.GetItemData(sel);
  74. }
  75. CDialog::OnOK();
  76. }