FS2_Open
Open source remastering of the Freespace 2 engine
adjustgriddlg.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 
12 #include "stdafx.h"
13 #include "FRED.h"
14 #include "AdjustGridDlg.h"
15 #include "mission/missiongrid.h"
16 
17 #ifdef _DEBUG
18 #undef THIS_FILE
19 static char THIS_FILE[] = __FILE__;
20 #endif
21 
23 // adjust_grid_dlg dialog
24 
25 adjust_grid_dlg::adjust_grid_dlg(CWnd* pParent /*=NULL*/)
26  : CDialog(adjust_grid_dlg::IDD, pParent)
27 {
28  //{{AFX_DATA_INIT(adjust_grid_dlg)
29  m_x = 0;
30  m_y = 0;
31  m_z = 0;
32  //}}AFX_DATA_INIT
33 }
34 
35 void adjust_grid_dlg::DoDataExchange(CDataExchange* pDX)
36 {
37  CDialog::DoDataExchange(pDX);
38  //{{AFX_DATA_MAP(adjust_grid_dlg)
39  DDX_Control(pDX, IDC_SPIN_Z, m_spinz);
40  DDX_Control(pDX, IDC_SPIN_Y, m_spiny);
41  DDX_Control(pDX, IDC_SPIN_X, m_spinx);
42  DDX_Text(pDX, IDC_EDIT_X, m_x);
43  DDX_Text(pDX, IDC_EDIT_Y, m_y);
44  DDX_Text(pDX, IDC_EDIT_Z, m_z);
45  //}}AFX_DATA_MAP
46 }
47 
48 BEGIN_MESSAGE_MAP(adjust_grid_dlg, CDialog)
49  //{{AFX_MSG_MAP(adjust_grid_dlg)
50  ON_BN_CLICKED(IDC_XY_PLANE, OnXyPlane)
51  ON_BN_CLICKED(IDC_XZ_PLANE, OnXzPlane)
52  ON_BN_CLICKED(IDC_YZ_PLANE, OnYzPlane)
53  //}}AFX_MSG_MAP
54 END_MESSAGE_MAP()
55 
57 // adjust_grid_dlg message handlers
58 
59 BOOL adjust_grid_dlg::OnInitDialog()
60 {
61  m_x = (int) The_grid->center.xyz.x;
62  m_y = (int) The_grid->center.xyz.y;
63  m_z = (int) The_grid->center.xyz.z;
64  CDialog::OnInitDialog();
65  if (The_grid->gmatrix.vec.uvec.xyz.y) {
66  ((CButton *) GetDlgItem(IDC_XZ_PLANE))->SetCheck(TRUE);
67  GetDlgItem(IDC_EDIT_X)->EnableWindow(FALSE);
68  GetDlgItem(IDC_EDIT_Z)->EnableWindow(FALSE);
69 
70  } else if (The_grid->gmatrix.vec.uvec.xyz.z) {
71  ((CButton *) GetDlgItem(IDC_XY_PLANE))->SetCheck(TRUE);
72  GetDlgItem(IDC_EDIT_X)->EnableWindow(FALSE);
73  GetDlgItem(IDC_EDIT_Y)->EnableWindow(FALSE);
74 
75  } else {
76  ((CButton *) GetDlgItem(IDC_YZ_PLANE))->SetCheck(TRUE);
77  GetDlgItem(IDC_EDIT_Y)->EnableWindow(FALSE);
78  GetDlgItem(IDC_EDIT_Z)->EnableWindow(FALSE);
79  }
80 
81  m_spinx.SetRange(SHRT_MIN, SHRT_MAX);
82  m_spiny.SetRange(SHRT_MIN, SHRT_MAX);
83  m_spinz.SetRange(SHRT_MIN, SHRT_MAX);
84  return TRUE;
85 }
86 
88 {
89  UpdateData(TRUE);
90  The_grid->center.xyz.x = (float) m_x;
91  The_grid->center.xyz.y = (float) m_y;
92  The_grid->center.xyz.z = (float) m_z;
93 
94  if (((CButton *) GetDlgItem(IDC_XY_PLANE)) -> GetCheck()) {
97 
98  } else if (((CButton *) GetDlgItem(IDC_YZ_PLANE)) -> GetCheck()) {
101 
102  } else { // XZ plane
105  }
106 
108  CDialog::OnOK();
109 }
110 
112 {
113  GetDlgItem(IDC_EDIT_X)->EnableWindow(FALSE);
114  GetDlgItem(IDC_SPIN_X)->EnableWindow(FALSE);
115  GetDlgItem(IDC_EDIT_Y)->EnableWindow(FALSE);
116  GetDlgItem(IDC_SPIN_Y)->EnableWindow(FALSE);
117  GetDlgItem(IDC_EDIT_Z)->EnableWindow(TRUE);
118  GetDlgItem(IDC_SPIN_Z)->EnableWindow(TRUE);
119 }
120 
122 {
123  GetDlgItem(IDC_EDIT_X)->EnableWindow(FALSE);
124  GetDlgItem(IDC_SPIN_X)->EnableWindow(FALSE);
125  GetDlgItem(IDC_EDIT_Y)->EnableWindow(TRUE);
126  GetDlgItem(IDC_SPIN_Y)->EnableWindow(TRUE);
127  GetDlgItem(IDC_EDIT_Z)->EnableWindow(FALSE);
128  GetDlgItem(IDC_SPIN_Z)->EnableWindow(FALSE);
129 }
130 
132 {
133  GetDlgItem(IDC_EDIT_X)->EnableWindow(TRUE);
134  GetDlgItem(IDC_SPIN_X)->EnableWindow(TRUE);
135  GetDlgItem(IDC_EDIT_Y)->EnableWindow(FALSE);
136  GetDlgItem(IDC_SPIN_Y)->EnableWindow(FALSE);
137  GetDlgItem(IDC_EDIT_Z)->EnableWindow(FALSE);
138  GetDlgItem(IDC_SPIN_Z)->EnableWindow(FALSE);
139 }
void modify_grid(grid *gridp)
vec3d vmd_z_vector
Definition: vecmat.cpp:27
#define IDC_EDIT_Z
Definition: resource.h:775
CSpinButtonCtrl m_spinz
Definition: adjustgriddlg.h:25
struct vec3d::@225::@227 xyz
#define TRUE
Definition: pstypes.h:399
#define IDC_XZ_PLANE
Definition: resource.h:889
#define IDC_EDIT_Y
Definition: resource.h:895
virtual void DoDataExchange(CDataExchange *pDX)
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
#define IDC_YZ_PLANE
Definition: resource.h:891
struct matrix::@228::@230 vec
matrix gmatrix
Definition: missiongrid.h:24
#define IDC_SPIN_Y
Definition: resource.h:892
vec3d center
Definition: missiongrid.h:23
#define IDC_SPIN_X
Definition: resource.h:893
CSpinButtonCtrl m_spiny
Definition: adjustgriddlg.h:26
vec3d vmd_y_vector
Definition: vecmat.cpp:26
vec3d vmd_x_vector
Definition: vecmat.cpp:25
afx_msg void OnYzPlane()
int BOOL
Definition: config.h:80
typedef float(SCP_EXT_CALLCONV *SCPTRACKIR_PFFLOATVOID)()
CSpinButtonCtrl m_spinx
Definition: adjustgriddlg.h:27
#define IDC_XY_PLANE
Definition: resource.h:890
adjust_grid_dlg(CWnd *pParent=NULL)
grid * The_grid
Definition: missiongrid.cpp:20
afx_msg void OnXyPlane()
afx_msg void OnXzPlane()
#define FALSE
Definition: pstypes.h:400
#define IDC_EDIT_X
Definition: resource.h:789
#define IDC_SPIN_Z
Definition: resource.h:894