File: editcontainernamedlg.cpp

package info (click to toggle)
freespace2 25.0.0%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 47,232 kB
  • sloc: cpp: 657,500; ansic: 22,305; sh: 293; python: 200; makefile: 198; xml: 181
file content (57 lines) | stat: -rw-r--r-- 1,594 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Created by Hassan "Karajorma" Kazmi and Josh "jg18" Glatt for The FreeSpace 2 Source Code Project.
 * You may not sell or otherwise commercially exploit the source or things you
 * create based on the source.
 */

#include "stdafx.h"
#include "FRED.h"
#include "EditContainerNameDlg.h"
#include "parse/sexp.h"
#include "parse/sexp_container.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#define NO_RESET_FOCUS	0
#define RESET_FOCUS		1

CEditContainerNameDlg::CEditContainerNameDlg(const SCP_string &window_title, const SCP_string &old_name, CWnd *pParent)
	: CDialog(CEditContainerNameDlg::IDD, pParent), m_window_title(window_title.c_str()), m_new_container_name(old_name.c_str()), m_cancelled(true)
{
}

void CEditContainerNameDlg::DoDataExchange(CDataExchange *pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_NEW_CONTAINER_NAME, m_new_container_name);
	DDV_MaxChars(pDX, m_new_container_name, sexp_container::NAME_MAX_LENGTH);
}

BEGIN_MESSAGE_MAP(CEditContainerNameDlg, CDialog)
// nothing needed
END_MESSAGE_MAP()

BOOL CEditContainerNameDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	SetWindowText(m_window_title);

	CEdit *new_name_edit = (CEdit *)GetDlgItem(IDC_NEW_CONTAINER_NAME);
	new_name_edit->SetLimitText(sexp_container::NAME_MAX_LENGTH);

	// Send default name and values into dialog box
	UpdateData(FALSE);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CEditContainerNameDlg::OnOK()
{
	m_cancelled = false;
	CDialog::OnOK();
}