Debian Codegraph @

editor/CustDefaultScriptSelect.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
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
19 // CustDefaultScriptSelect.cpp : implementation file
20 //
21
22 #include "stdafx.h"
23 #include "editor.h"
24 #include "CustDefaultScriptSelect.h"
25 #include "manage.h"
26 #include "ddio.h"
27
28 #ifdef _DEBUG
29 #define new DEBUG_NEW
30 #undef THIS_FILE
31 static char THIS_FILE[] = __FILE__;
32 #endif
33
34 /////////////////////////////////////////////////////////////////////////////
35 // CCustDefaultScriptSelect dialog
36
37 CCustDefaultScriptSelect::CCustDefaultScriptSelect(CWnd *pParent /*=NULL*/)
38 : CDialog(CCustDefaultScriptSelect::IDD, pParent) {
39 //{{AFX_DATA_INIT(CCustDefaultScriptSelect)
40 m_Name = _T("");
41 m_Module = _T("");
42 //}}AFX_DATA_INIT
43 }
44
45 void CCustDefaultScriptSelect::DoDataExchange(CDataExchange *pDX) {
46 CDialog::DoDataExchange(pDX);
47 //{{AFX_DATA_MAP(CCustDefaultScriptSelect)
48 DDX_Text(pDX, IDC_NAME, m_Name);
49 DDX_Text(pDX, IDC_MODULE, m_Module);
50 //}}AFX_DATA_MAP
51 }
52
53 BEGIN_MESSAGE_MAP(CCustDefaultScriptSelect, CDialog)
54 //{{AFX_MSG_MAP(CCustDefaultScriptSelect)
55 ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
56 //}}AFX_MSG_MAP
57 END_MESSAGE_MAP()
58
59 /////////////////////////////////////////////////////////////////////////////
60 // CCustDefaultScriptSelect message handlers
61
62 void CCustDefaultScriptSelect::OnOK() {
63 // TODO: Add extra validation here
64
65 CDialog::OnOK();
66 }
67
68 void CCustDefaultScriptSelect::OnBrowse() {
69
70 UpdateData(true);
71
72 CString filter = "D3 Compiled Scripts (*.dll)|*.dll||";
73
74 char filename[_MAX_PATH];
75 char pathname[_MAX_PATH], name[_MAX_PATH];
76 strcpy(pathname, LocalScriptDir);
77
78 if (!OpenFileDialog(this, (LPCTSTR)filter, filename, pathname, sizeof(pathname)))
79 return;
80
81 ddio_SplitPath(filename, NULL, name, NULL);
82
83 m_Module = name;
84
85 UpdateData(false);
86 }