TexturePathDialog.cpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. // TexturePathDialog.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "w3dview.h"
  22. #include "w3dviewdoc.h"
  23. #include "TexturePathDialog.h"
  24. #include "utils.h"
  25. #include "directorydialog.h"
  26. #ifdef _DEBUG
  27. #define new DEBUG_NEW
  28. #undef THIS_FILE
  29. static char THIS_FILE[] = __FILE__;
  30. #endif
  31. /////////////////////////////////////////////////////////////////////////////
  32. //
  33. // TexturePathDialogClass
  34. //
  35. /////////////////////////////////////////////////////////////////////////////
  36. TexturePathDialogClass::TexturePathDialogClass(CWnd* pParent /*=NULL*/)
  37. : CDialog(TexturePathDialogClass::IDD, pParent)
  38. {
  39. //{{AFX_DATA_INIT(TexturePathDialogClass)
  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. TexturePathDialogClass::DoDataExchange (CDataExchange* pDX)
  51. {
  52. CDialog::DoDataExchange(pDX);
  53. //{{AFX_DATA_MAP(TexturePathDialogClass)
  54. // NOTE: the ClassWizard will add DDX and DDV calls here
  55. //}}AFX_DATA_MAP
  56. return ;
  57. }
  58. BEGIN_MESSAGE_MAP(TexturePathDialogClass, CDialog)
  59. //{{AFX_MSG_MAP(TexturePathDialogClass)
  60. ON_BN_CLICKED(IDC_BROWSE1, OnBrowse1)
  61. ON_BN_CLICKED(IDC_BROWSE2, OnBrowse2)
  62. //}}AFX_MSG_MAP
  63. END_MESSAGE_MAP()
  64. /////////////////////////////////////////////////////////////////////////////
  65. //
  66. // OnInitDialog
  67. //
  68. /////////////////////////////////////////////////////////////////////////////
  69. BOOL
  70. TexturePathDialogClass::OnInitDialog (void)
  71. {
  72. CDialog::OnInitDialog ();
  73. CW3DViewDoc *doc = ::GetCurrentDocument ();
  74. SetDlgItemText (IDC_PATH1, doc->Get_Texture_Path1 ());
  75. SetDlgItemText (IDC_PATH2, doc->Get_Texture_Path2 ());
  76. return TRUE;
  77. }
  78. /////////////////////////////////////////////////////////////////////////////
  79. //
  80. // OnOK
  81. //
  82. /////////////////////////////////////////////////////////////////////////////
  83. void
  84. TexturePathDialogClass::OnOK (void)
  85. {
  86. CString path1;
  87. CString path2;
  88. GetDlgItemText (IDC_PATH1, path1);
  89. GetDlgItemText (IDC_PATH2, path2);
  90. CW3DViewDoc *doc = ::GetCurrentDocument ();
  91. doc->Set_Texture_Path1 (path1);
  92. doc->Set_Texture_Path2 (path2);
  93. CDialog::OnOK ();
  94. return ;
  95. }
  96. /////////////////////////////////////////////////////////////////////////////
  97. //
  98. // OnBrowse1
  99. //
  100. /////////////////////////////////////////////////////////////////////////////
  101. void
  102. TexturePathDialogClass::OnBrowse1 (void)
  103. {
  104. CString initial_path;
  105. GetDlgItemText (IDC_PATH1, initial_path);
  106. CString path;
  107. if (::Browse_For_Folder (m_hWnd, initial_path, path)) {
  108. SetDlgItemText (IDC_PATH1, path);
  109. }
  110. return ;
  111. }
  112. /////////////////////////////////////////////////////////////////////////////
  113. //
  114. // OnBrowse2
  115. //
  116. /////////////////////////////////////////////////////////////////////////////
  117. void
  118. TexturePathDialogClass::OnBrowse2 (void)
  119. {
  120. CString initial_path;
  121. GetDlgItemText (IDC_PATH2, initial_path);
  122. CString path;
  123. if (::Browse_For_Folder (m_hWnd, initial_path, path)) {
  124. SetDlgItemText (IDC_PATH2, path);
  125. }
  126. return ;
  127. }