-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEntityVisDlg.cpp
112 lines (92 loc) · 3.7 KB
/
EntityVisDlg.cpp
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/****************************************************************************************/
/* EntityVisDlg.cpp */
/* */
/* Author: Jim Mischel */
/* Description: Entity visibility dialog */
/* */
/* The contents of this file are subject to the Genesis3D Public License */
/* Version 1.01 (the "License"); you may not use this file except in */
/* compliance with the License. You may obtain a copy of the License at */
/* http://www.genesis3d.com */
/* */
/* Software distributed under the License is distributed on an "AS IS" */
/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */
/* the License for the specific language governing rights and limitations */
/* under the License. */
/* */
/* The Original Code is Genesis3D, released March 25, 1999. */
/*Genesis3D Version 1.1 released November 15, 1999 */
/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */
/* */
/****************************************************************************************/
#include "stdafx.h"
#include "resource.h"
#include "EntityVisDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEntityVisDlg dialog
CEntityVisDlg::CEntityVisDlg(CWnd* pParent /*=NULL*/)
: pViewList (NULL),
CDialog(CEntityVisDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CEntityVisDlg)
//}}AFX_DATA_INIT
}
void CEntityVisDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CEntityVisDlg)
DDX_Control(pDX, IDC_LIST1, m_EntsList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CEntityVisDlg, CDialog)
//{{AFX_MSG_MAP(CEntityVisDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEntityVisDlg message handlers
int CEntityVisDlg::DoModal(EntityViewList *pList)
{
pViewList = pList;
return CDialog::DoModal();
}
BOOL CEntityVisDlg::OnInitDialog()
{
CDialog::OnInitDialog();
if (pViewList != NULL)
{
for (int i = 0; i < pViewList->nEntries; i++)
{
int Index;
EntityViewEntry *pEntry;
pEntry = &(pViewList->pEntries[i]);
Index = m_EntsList.AddString (pEntry->pName);
if (Index != LB_ERR)
{
m_EntsList.SetItemData (Index, i);
m_EntsList.SetCheck (Index, pEntry->IsVisible ? 1 : 0);
}
}
m_EntsList.SetCurSel (0);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CEntityVisDlg::OnOK()
{
// set visibility state from list box
int Item;
for (Item = 0; Item < m_EntsList.GetCount (); ++Item)
{
int EntryIndex;
EntityViewEntry *pEntry;
EntryIndex = m_EntsList.GetItemData (Item);
pEntry = &(pViewList->pEntries[EntryIndex]);
pEntry->IsVisible = (m_EntsList.GetCheck (Item) == 1);
}
CDialog::OnOK();
}