ImportTranslationDialog.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  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. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // ImportTranslationDialog.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "leveledit.h"
  22. #include "importtranslationdialog.h"
  23. #include "stringsmgr.h"
  24. #include "translatedb.h"
  25. #ifdef _DEBUG
  26. #define new DEBUG_NEW
  27. #undef THIS_FILE
  28. static char THIS_FILE[] = __FILE__;
  29. #endif
  30. ///////////////////////////////////////////////////////////////////////////
  31. //
  32. // ImportTranslationDialogClass
  33. //
  34. ///////////////////////////////////////////////////////////////////////////
  35. ImportTranslationDialogClass::ImportTranslationDialogClass (CWnd* pParent /*=NULL*/)
  36. : IsForExport (false),
  37. CDialog(ImportTranslationDialogClass::IDD, pParent)
  38. {
  39. //{{AFX_DATA_INIT(ImportTranslationDialogClass)
  40. // NOTE: the ClassWizard will add member initialization here
  41. //}}AFX_DATA_INIT
  42. return ;
  43. }
  44. ///////////////////////////////////////////////////////////////////////////
  45. //
  46. // DoDataExchange
  47. //
  48. ///////////////////////////////////////////////////////////////////////////
  49. void
  50. ImportTranslationDialogClass::DoDataExchange (CDataExchange* pDX)
  51. {
  52. CDialog::DoDataExchange(pDX);
  53. //{{AFX_DATA_MAP(ImportTranslationDialogClass)
  54. // NOTE: the ClassWizard will add DDX and DDV calls here
  55. //}}AFX_DATA_MAP
  56. return ;
  57. }
  58. BEGIN_MESSAGE_MAP(ImportTranslationDialogClass, CDialog)
  59. //{{AFX_MSG_MAP(ImportTranslationDialogClass)
  60. //}}AFX_MSG_MAP
  61. END_MESSAGE_MAP()
  62. ///////////////////////////////////////////////////////////////////////////
  63. //
  64. // OnInitDialog
  65. //
  66. ///////////////////////////////////////////////////////////////////////////
  67. BOOL
  68. ImportTranslationDialogClass::OnInitDialog (void)
  69. {
  70. CDialog::OnInitDialog ();
  71. if (IsForExport) {
  72. SetDlgItemText (IDC_MESSAGE, "Which language are you exporting?");
  73. SetWindowText ("Translation Export");
  74. }
  75. //
  76. // Select english by default
  77. //
  78. SendDlgItemMessage (IDC_LANG_COMBO, CB_SETCURSEL, TranslateDBClass::LANGID_ENGLISH);
  79. return TRUE;
  80. }
  81. ///////////////////////////////////////////////////////////////////////////
  82. //
  83. // OnOK
  84. //
  85. ///////////////////////////////////////////////////////////////////////////
  86. void
  87. ImportTranslationDialogClass::OnOK (void)
  88. {
  89. if (IsForExport) {
  90. //
  91. // Export the data
  92. //
  93. int lang_id = SendDlgItemMessage (IDC_LANG_COMBO, CB_GETCURSEL);
  94. if (lang_id >= 0) {
  95. StringsMgrClass::Export_For_Translation (Filename, lang_id);
  96. }
  97. } else {
  98. //
  99. // Import the data
  100. //
  101. int lang_id = SendDlgItemMessage (IDC_LANG_COMBO, CB_GETCURSEL);
  102. if (lang_id >= 0) {
  103. StringsMgrClass::Import_From_Translation (Filename, lang_id);
  104. }
  105. }
  106. CDialog::OnOK ();
  107. return ;
  108. }