1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 // vegetable_scale_page.cpp : implementation file
21 #include "object_viewer.h"
22 #include "vegetable_scale_page.h"
23 #include "vegetable_edit_tools.h"
24 #include "vegetable_noise_value_dlg.h"
25 #include "vegetable_dlg.h"
26 #include "nel/misc/noise_value.h"
27 #include "nel/3d/vegetable.h"
31 /////////////////////////////////////////////////////////////////////////////
32 // CVegetableScalePage property page
34 IMPLEMENT_DYNCREATE(CVegetableScalePage
, CPropertyPage
)
37 CVegetableScalePage::CVegetableScalePage() : CPropertyPage(CVegetableScalePage::IDD
),
38 _SxyDlg(NULL
), _SzDlg(NULL
), _BendFreqFactorDlg(NULL
)
40 //{{AFX_DATA_INIT(CVegetableScalePage)
41 // NOTE: the ClassWizard will add member initialization here
45 CVegetableScalePage::~CVegetableScalePage()
47 #define REMOVE_WND(wnd) if (wnd) { wnd->DestroyWindow(); delete wnd; }
50 REMOVE_WND(_BendFreqFactorDlg
);
53 void CVegetableScalePage::DoDataExchange(CDataExchange
* pDX
)
55 CPropertyPage::DoDataExchange(pDX
);
56 //{{AFX_DATA_MAP(CVegetableScalePage)
57 // NOTE: the ClassWizard will add DDX and DDV calls here
62 BEGIN_MESSAGE_MAP(CVegetableScalePage
, CPropertyPage
)
63 //{{AFX_MSG_MAP(CVegetableScalePage)
68 // ***************************************************************************
69 // ***************************************************************************
70 // ***************************************************************************
71 // ***************************************************************************
75 // ***************************************************************************
76 void CVegetableScalePage::setVegetableToEdit(NL3D::CVegetable
*vegetable
)
78 _Vegetable
= vegetable
;
80 // If not NULL, init all controls.
85 _SxyDlg
->setNoiseValue(&_Vegetable
->Sxy
, _VegetableDlg
);
86 _SzDlg
->setNoiseValue(&_Vegetable
->Sz
, _VegetableDlg
);
88 // init _BendFreqFactorDlg
90 // Enable the checkBox and the slider
91 _BendFreqFactorDlg
->setFloat(&_Vegetable
->BendFrequencyFactor
, _VegetableDlg
);
97 // ***************************************************************************
98 // ***************************************************************************
99 // CVegetableScalePage message handlers
100 // ***************************************************************************
101 // ***************************************************************************
104 // ***************************************************************************
105 BOOL
CVegetableScalePage::OnInitDialog()
107 CPropertyPage::OnInitDialog();
111 // Position of the density DlgBox relative to CVegetableDensityPage.
115 // Init _SxyDlg Dialog.
116 _SxyDlg
= new CVegetableNoiseValueDlg (std::string("Scale X/Y"));
117 _SxyDlg
->setDefaultRangeAbs(NL_VEGETABLE_SCALE_RANGE_MIN
, NL_VEGETABLE_SCALE_RANGE_MAX
);
118 _SxyDlg
->setDefaultRangeRand(NL_VEGETABLE_SCALE_RANGE_MIN
, NL_VEGETABLE_SCALE_RANGE_MAX
);
119 _SxyDlg
->setDefaultRangeFreq(NL_VEGETABLE_FREQ_RANGE_MIN
, NL_VEGETABLE_FREQ_RANGE_MAX
);
120 _SxyDlg
->init(x
, y
, this);
121 y
+= CVegetableNoiseValueDlg::ControlHeight
+ spaceDy
;
122 // Init _SzDlg Dialog.
123 _SzDlg
= new CVegetableNoiseValueDlg (std::string("Scale Z"));
124 _SzDlg
->setDefaultRangeAbs(NL_VEGETABLE_SCALE_RANGE_MIN
, NL_VEGETABLE_SCALE_RANGE_MAX
);
125 _SzDlg
->setDefaultRangeRand(NL_VEGETABLE_SCALE_RANGE_MIN
, NL_VEGETABLE_SCALE_RANGE_MAX
);
126 _SzDlg
->setDefaultRangeFreq(NL_VEGETABLE_FREQ_RANGE_MIN
, NL_VEGETABLE_FREQ_RANGE_MAX
);
127 _SzDlg
->init(x
, y
, this);
128 y
+= CVegetableNoiseValueDlg::ControlHeight
+ spaceDy
;
131 // Init BendFreqFactorDlg Dialog.
132 _BendFreqFactorDlg
= new CDirectEditableRangeFloat (std::string("VEGET_BEND_FREQ_FACTOR"),
133 NL_VEGETABLE_BENDFREQ_RANGE_MIN
, NL_VEGETABLE_BENDFREQ_RANGE_MAX
, "FreqFactor");
134 _BendFreqFactorDlg
->enableLowerBound(0, false);
136 _BendFreqFactorDlg
->init(x
+10, y
, this);
137 y
+= CDirectEditableRangeFloat::ControlHeight
+ spaceDy
;
140 return TRUE
; // return TRUE unless you set the focus to a control
141 // EXCEPTION: OCX Property Pages should return FALSE