Debian Codegraph @

editor/TableFileFilterAddDlg.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 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/Main/editor/TableFileFilterAddDlg.cpp $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003-08-26 03:57:39 $
23 * $Author: kevinb $
24 *
25 *
26 *
27 * $Log: not supported by cvs2svn $
28 *
29 * 5 10/09/98 11:07a Nate
30 * Fixed it up a bit, made it save the last selected type
31 *
32 * 4 10/08/98 10:48p Nate
33 *
34 * 3 10/08/98 10:30a Nate
35 * Initial version
36 *
37 * $NoKeywords: $
38 */
39
40 // TableFileFilterAddDlg.cpp : implementation file
41 //
42
43 #include "stdafx.h"
44 #include "editor.h"
45 #include "TableFileFilterAddDlg.h"
46 #include "manage.h"
47
48 #ifdef _DEBUG
49 #define new DEBUG_NEW
50 #undef THIS_FILE
51 static char THIS_FILE[] = __FILE__;
52 #endif
53
54 // Global to save user's last type choice
55 CString last_type = "";
56
57 /////////////////////////////////////////////////////////////////////////////
58 // CTableFileFilterAddDlg dialog
59
60 CTableFileFilterAddDlg::CTableFileFilterAddDlg(CWnd *pParent /*=NULL*/)
61 : CDialog(CTableFileFilterAddDlg::IDD, pParent) {
62 //{{AFX_DATA_INIT(CTableFileFilterAddDlg)
63 // NOTE: the ClassWizard will add member initialization here
64 //}}AFX_DATA_INIT
65 }
66
67 void CTableFileFilterAddDlg::DoDataExchange(CDataExchange *pDX) {
68 CDialog::DoDataExchange(pDX);
69 //{{AFX_DATA_MAP(CTableFileFilterAddDlg)
70 DDX_Control(pDX, IDC_TABLEFILEFILTER_ADDTYPE_COMBO, m_TypeCombo);
71 DDX_Control(pDX, IDC_TABLEFILEFILTER_ADDNAME_EDIT, m_NameEdit);
72 //}}AFX_DATA_MAP
73 }
74
75 BEGIN_MESSAGE_MAP(CTableFileFilterAddDlg, CDialog)
76 //{{AFX_MSG_MAP(CTableFileFilterAddDlg)
77 //}}AFX_MSG_MAP
78 END_MESSAGE_MAP()
79
80 /////////////////////////////////////////////////////////////////////////////
81 // CTableFileFilterAddDlg message handlers
82
83 BOOL CTableFileFilterAddDlg::OnInitDialog() {
84 CDialog::OnInitDialog();
85
86 // TODO: Add extra initialization here
87 m_TypeCombo.ResetContent();
88 // m_TypeCombo.AddString("Unknown");
89 m_TypeCombo.AddString("Texture");
90 m_TypeCombo.AddString("Weapon");
91 // m_TypeCombo.AddString("Robot");
92 // m_TypeCombo.AddString("Powerup");
93 m_TypeCombo.AddString("Door");
94 m_TypeCombo.AddString("Ship");
95 m_TypeCombo.AddString("Sound");
96 // m_TypeCombo.AddString("Megacell");
97 // m_TypeCombo.AddString("Gamefile");
98 m_TypeCombo.AddString("Generic");
99
100 if (last_type.IsEmpty())
101 m_TypeCombo.SelectString(-1, "Generic");
102 else
103 m_TypeCombo.SelectString(-1, last_type.GetBuffer(0));
104
105 m_NameEdit.LimitText(PAGENAME_LEN - 1);
106 m_NameEdit.SetWindowText("");
107
108 return TRUE; // return TRUE unless you set the focus to a control
109 // EXCEPTION: OCX Property Pages should return FALSE
110 }
111
112 void CTableFileFilterAddDlg::OnOK() {
113 // TODO: Add extra validation here
114 CString type_name;
115
116 m_NameEdit.GetWindowText(page_name);
117
118 int index = m_TypeCombo.GetCurSel();
119 m_TypeCombo.GetLBText(index, type_name);
120 last_type = type_name;
121
122 if (type_name == "Unknown")
123 page_type = PAGETYPE_UNKNOWN;
124 else if (type_name == "Texture")
125 page_type = PAGETYPE_TEXTURE;
126 else if (type_name == "Weapon")
127 page_type = PAGETYPE_WEAPON;
128 else if (type_name == "Robot")
129 page_type = PAGETYPE_ROBOT;
130 else if (type_name == "Powerup")
131 page_type = PAGETYPE_POWERUP;
132 else if (type_name == "Door")
133 page_type = PAGETYPE_DOOR;
134 else if (type_name == "Ship")
135 page_type = PAGETYPE_SHIP;
136 else if (type_name == "Sound")
137 page_type = PAGETYPE_SOUND;
138 else if (type_name == "Megacell")
139 page_type = PAGETYPE_MEGACELL;
140 else if (type_name == "Gamefile")
141 page_type = PAGETYPE_GAMEFILE;
142 else
143 page_type = PAGETYPE_GENERIC;
144
145 CDialog::OnOK();
146 }
147
148 void CTableFileFilterAddDlg::OnCancel() {
149 // TODO: Add extra cleanup here
150
151 CDialog::OnCancel();
152 }