Linux multi-monitor fullscreen support
[ryzomcore.git] / nel / tools / 3d / object_viewer / vegetable_copy_dlg.cpp
blob5cfa6d96caac254d30499e00a2263f69922ee670
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 // vegetable_copy_dlg.cpp : implementation file
23 #include "std_afx.h"
24 #include "object_viewer.h"
25 #include "vegetable_copy_dlg.h"
26 #include "vegetable_dlg.h"
29 /////////////////////////////////////////////////////////////////////////////
30 CVegetableCopyDlg::CLastSetup CVegetableCopyDlg::_LastSetup;
32 CVegetableCopyDlg::CLastSetup::CLastSetup()
34 SubsetCopy = FALSE;
35 ScaleZ = FALSE;
36 ScaleXY = FALSE;
37 RotateZ = FALSE;
38 RotateY = FALSE;
39 RotateX = FALSE;
40 Mesh = FALSE;
41 MaxDensity = FALSE;
42 Distance = FALSE;
43 Density = FALSE;
44 ColorSetup = FALSE;
45 ColorNoise = FALSE;
46 BendPhase = FALSE;
47 BendFactor = FALSE;
48 AngleSetup = FALSE;
52 /////////////////////////////////////////////////////////////////////////////
53 // CVegetableCopyDlg dialog
56 CVegetableCopyDlg::CVegetableCopyDlg(CVegetableDlg *vegetableDlg, CWnd* pParent /*=NULL*/)
57 : CDialog(CVegetableCopyDlg::IDD, pParent), _VegetableDlg(vegetableDlg)
59 //{{AFX_DATA_INIT(CVegetableCopyDlg)
60 SubsetCopy = FALSE;
61 ScaleZ = FALSE;
62 ScaleXY = FALSE;
63 RotateZ = FALSE;
64 RotateY = FALSE;
65 RotateX = FALSE;
66 Mesh = FALSE;
67 MaxDensity = FALSE;
68 Distance = FALSE;
69 Density = FALSE;
70 ColorSetup = FALSE;
71 ColorNoise = FALSE;
72 BendPhase = FALSE;
73 BendFactor = FALSE;
74 AngleSetup = FALSE;
75 VegetableSelected = -1;
76 //}}AFX_DATA_INIT
80 void CVegetableCopyDlg::DoDataExchange(CDataExchange* pDX)
82 CDialog::DoDataExchange(pDX);
83 //{{AFX_DATA_MAP(CVegetableCopyDlg)
84 DDX_Control(pDX, IDC_LIST1, VegetableList);
85 DDX_Control(pDX, IDC_CHECK_VEGETABLE_SUBSET_COPY, CheckSubsetCopy);
86 DDX_Control(pDX, IDC_CHECK_VEGETABLE_SCALEZ, CheckScaleZ);
87 DDX_Control(pDX, IDC_CHECK_VEGETABLE_SCALEXY, CheckScaleXY);
88 DDX_Control(pDX, IDC_CHECK_VEGETABLE_ROTATEZ, CheckRotateZ);
89 DDX_Control(pDX, IDC_CHECK_VEGETABLE_ROTATEY, CheckRotateY);
90 DDX_Control(pDX, IDC_CHECK_VEGETABLE_ROTATEX, CheckRotateX);
91 DDX_Control(pDX, IDC_CHECK_VEGETABLE_MESH, CheckMesh);
92 DDX_Control(pDX, IDC_CHECK_VEGETABLE_MAXDENSITY, CheckMaxDensity);
93 DDX_Control(pDX, IDC_CHECK_VEGETABLE_DISTANCE, CheckDistance);
94 DDX_Control(pDX, IDC_CHECK_VEGETABLE_DENSITY, CheckDensity);
95 DDX_Control(pDX, IDC_CHECK_VEGETABLE_COLORSETUP, CheckColorSetup);
96 DDX_Control(pDX, IDC_CHECK_VEGETABLE_COLORNOISE, CheckColorNoise);
97 DDX_Control(pDX, IDC_CHECK_VEGETABLE_BENDPHASE, CheckBendPhase);
98 DDX_Control(pDX, IDC_CHECK_VEGETABLE_BENDFACTOR, CheckBendFactor);
99 DDX_Control(pDX, IDC_CHECK_VEGETABLE_ANGLESETUP, CheckAngleSetup);
100 DDX_Check(pDX, IDC_CHECK_VEGETABLE_SUBSET_COPY, SubsetCopy);
101 DDX_Check(pDX, IDC_CHECK_VEGETABLE_SCALEZ, ScaleZ);
102 DDX_Check(pDX, IDC_CHECK_VEGETABLE_SCALEXY, ScaleXY);
103 DDX_Check(pDX, IDC_CHECK_VEGETABLE_ROTATEZ, RotateZ);
104 DDX_Check(pDX, IDC_CHECK_VEGETABLE_ROTATEY, RotateY);
105 DDX_Check(pDX, IDC_CHECK_VEGETABLE_ROTATEX, RotateX);
106 DDX_Check(pDX, IDC_CHECK_VEGETABLE_MESH, Mesh);
107 DDX_Check(pDX, IDC_CHECK_VEGETABLE_MAXDENSITY, MaxDensity);
108 DDX_Check(pDX, IDC_CHECK_VEGETABLE_DISTANCE, Distance);
109 DDX_Check(pDX, IDC_CHECK_VEGETABLE_DENSITY, Density);
110 DDX_Check(pDX, IDC_CHECK_VEGETABLE_COLORSETUP, ColorSetup);
111 DDX_Check(pDX, IDC_CHECK_VEGETABLE_COLORNOISE, ColorNoise);
112 DDX_Check(pDX, IDC_CHECK_VEGETABLE_BENDPHASE, BendPhase);
113 DDX_Check(pDX, IDC_CHECK_VEGETABLE_BENDFACTOR, BendFactor);
114 DDX_Check(pDX, IDC_CHECK_VEGETABLE_ANGLESETUP, AngleSetup);
115 DDX_LBIndex(pDX, IDC_LIST1, VegetableSelected);
116 //}}AFX_DATA_MAP
120 BEGIN_MESSAGE_MAP(CVegetableCopyDlg, CDialog)
121 //{{AFX_MSG_MAP(CVegetableCopyDlg)
122 ON_BN_CLICKED(IDC_BUTTON_VEGETABLE_APPEARANCE_NONE, OnButtonVegetableAppearanceNone)
123 ON_BN_CLICKED(IDC_BUTTON_VEGETABLE_APPERANCE_ALL, OnButtonVegetableApperanceAll)
124 ON_BN_CLICKED(IDC_BUTTON_VEGETABLE_GENERAL_ALL, OnButtonVegetableGeneralAll)
125 ON_BN_CLICKED(IDC_BUTTON_VEGETABLE_GENERAL_NONE, OnButtonVegetableGeneralNone)
126 ON_BN_CLICKED(IDC_BUTTON_VEGETABLE_POSITION_ALL, OnButtonVegetablePositionAll)
127 ON_BN_CLICKED(IDC_BUTTON_VEGETABLE_POSITION_NONE, OnButtonVegetablePositionNone)
128 ON_BN_CLICKED(IDC_CHECK_VEGETABLE_SUBSET_COPY, OnCheckVegetableSubsetCopy)
129 ON_WM_DESTROY()
130 ON_LBN_DBLCLK(IDC_LIST1, OnDblclkList1)
131 //}}AFX_MSG_MAP
132 END_MESSAGE_MAP()
135 // ***************************************************************************
136 // ***************************************************************************
137 // ***************************************************************************
138 // ***************************************************************************
141 // ***************************************************************************
142 void CVegetableCopyDlg::enableChecks(bool enable)
144 CheckScaleZ.EnableWindow(enable);
145 CheckScaleXY.EnableWindow(enable);
146 CheckRotateZ.EnableWindow(enable);
147 CheckRotateY.EnableWindow(enable);
148 CheckRotateX.EnableWindow(enable);
149 CheckMesh.EnableWindow(enable);
150 CheckMaxDensity.EnableWindow(enable);
151 CheckDistance.EnableWindow(enable);
152 CheckDensity.EnableWindow(enable);
153 CheckColorSetup.EnableWindow(enable);
154 CheckColorNoise.EnableWindow(enable);
155 CheckBendPhase.EnableWindow(enable);
156 CheckBendFactor.EnableWindow(enable);
157 CheckAngleSetup.EnableWindow(enable);
161 // ***************************************************************************
162 // ***************************************************************************
163 // CVegetableCopyDlg message handlers
164 // ***************************************************************************
165 // ***************************************************************************
167 void CVegetableCopyDlg::OnButtonVegetableGeneralAll()
169 CheckMesh.SetCheck(1);
170 CheckDistance.SetCheck(1);
171 CheckDensity.SetCheck(1);
172 CheckMaxDensity.SetCheck(1);
173 CheckAngleSetup.SetCheck(1);
176 void CVegetableCopyDlg::OnButtonVegetableGeneralNone()
178 CheckMesh.SetCheck(0);
179 CheckDistance.SetCheck(0);
180 CheckDensity.SetCheck(0);
181 CheckMaxDensity.SetCheck(0);
182 CheckAngleSetup.SetCheck(0);
186 void CVegetableCopyDlg::OnButtonVegetableApperanceAll()
188 CheckBendPhase.SetCheck(1);
189 CheckBendFactor.SetCheck(1);
190 CheckColorNoise.SetCheck(1);
191 CheckColorSetup.SetCheck(1);
193 void CVegetableCopyDlg::OnButtonVegetableAppearanceNone()
195 CheckBendPhase.SetCheck(0);
196 CheckBendFactor.SetCheck(0);
197 CheckColorNoise.SetCheck(0);
198 CheckColorSetup.SetCheck(0);
201 void CVegetableCopyDlg::OnButtonVegetablePositionAll()
203 CheckScaleXY.SetCheck(1);
204 CheckScaleZ.SetCheck(1);
205 CheckRotateX.SetCheck(1);
206 CheckRotateY.SetCheck(1);
207 CheckRotateZ.SetCheck(1);
210 void CVegetableCopyDlg::OnButtonVegetablePositionNone()
212 CheckScaleXY.SetCheck(0);
213 CheckScaleZ.SetCheck(0);
214 CheckRotateX.SetCheck(0);
215 CheckRotateY.SetCheck(0);
216 CheckRotateZ.SetCheck(0);
219 void CVegetableCopyDlg::OnCheckVegetableSubsetCopy()
221 // enable checks if needed.
222 enableChecks(CheckSubsetCopy.GetCheck()==1);
225 BOOL CVegetableCopyDlg::OnInitDialog()
227 // setup flags before the UpdateData
228 SubsetCopy= _LastSetup.SubsetCopy;
229 ScaleZ= _LastSetup.ScaleZ;
230 ScaleXY= _LastSetup.ScaleXY;
231 RotateZ= _LastSetup.RotateZ;
232 RotateY= _LastSetup.RotateY;
233 RotateX= _LastSetup.RotateX;
234 Mesh= _LastSetup.Mesh;
235 MaxDensity= _LastSetup.MaxDensity;
236 Distance= _LastSetup.Distance;
237 Density= _LastSetup.Density;
238 ColorSetup= _LastSetup.ColorSetup;
239 ColorNoise= _LastSetup.ColorNoise;
240 BendPhase= _LastSetup.BendPhase;
241 BendFactor= _LastSetup.BendFactor;
242 AngleSetup= _LastSetup.AngleSetup;
245 CDialog::OnInitDialog();
247 // enable checks if needed.
248 enableChecks(CheckSubsetCopy.GetCheck()==1);
251 // Init the control list.
252 uint num= _VegetableDlg->getNumVegetables();
253 for(uint i=0; i<num; i++)
255 VegetableList.AddString(nlUtf8ToTStr(_VegetableDlg->getVegetableName(i)));
259 return TRUE; // return TRUE unless you set the focus to a control
260 // EXCEPTION: OCX Property Pages should return FALSE
263 void CVegetableCopyDlg::OnDestroy()
265 CDialog::OnDestroy();
267 // save setup in _LastSetup.
268 _LastSetup.SubsetCopy= SubsetCopy;
269 _LastSetup.ScaleZ= ScaleZ;
270 _LastSetup.ScaleXY= ScaleXY;
271 _LastSetup.RotateZ= RotateZ;
272 _LastSetup.RotateY= RotateY;
273 _LastSetup.RotateX= RotateX;
274 _LastSetup.Mesh= Mesh;
275 _LastSetup.MaxDensity= MaxDensity;
276 _LastSetup.Distance= Distance;
277 _LastSetup.Density= Density;
278 _LastSetup.ColorSetup= ColorSetup;
279 _LastSetup.ColorNoise= ColorNoise;
280 _LastSetup.BendPhase= BendPhase;
281 _LastSetup.BendFactor= BendFactor;
282 _LastSetup.AngleSetup= AngleSetup;
286 void CVegetableCopyDlg::OnOK()
288 UpdateData();
289 if(VegetableSelected!=LB_ERR)
291 CDialog::OnOK();
293 else
295 MessageBox(_T("Select a vegetable to copy first"), _T("Error"), MB_OK | MB_ICONWARNING);
299 void CVegetableCopyDlg::OnDblclkList1()
301 UpdateData();
302 // DblClck select the name.
303 EndDialog(IDOK);