Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / nel / tools / 3d / object_viewer / vegetable_wind_dlg.cpp
blob6251f1953c8b63be6aa006d8c9e98284cae515df
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_wind_dlg.cpp : implementation file
23 #include "std_afx.h"
24 #include "object_viewer.h"
25 #include "vegetable_wind_dlg.h"
26 #include "object_viewer.h"
29 #define NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE 1000
30 #define NL_VEGETABLE_EDIT_WIND_MAX_POWER 10.f
31 #define NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY 10.f
32 #define NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART 1.f
34 /////////////////////////////////////////////////////////////////////////////
35 // CVegetableWindDlg dialog
38 CVegetableWindDlg::CVegetableWindDlg(CObjectViewer *objViewer, CWnd* pParent /*=NULL*/)
39 : CDialog(CVegetableWindDlg::IDD, pParent), _ObjViewer(objViewer)
41 //{{AFX_DATA_INIT(CVegetableWindDlg)
42 // NOTE: the ClassWizard will add member initialization here
43 //}}AFX_DATA_INIT
47 void CVegetableWindDlg::DoDataExchange(CDataExchange* pDX)
49 CDialog::DoDataExchange(pDX);
50 //{{AFX_DATA_MAP(CVegetableWindDlg)
51 DDX_Control(pDX, IDC_STATIC_VEGETABLE_WIND_POWER, StaticPower);
52 DDX_Control(pDX, IDC_STATIC_VEGETABLE_WIND_FREQUENCY, StaticFrequency);
53 DDX_Control(pDX, IDC_STATIC_VEGETABLE_WIND_BENDSTART, StaticBendStart);
54 DDX_Control(pDX, IDC_SLIDER_VEGETABLE_WIND_POWER, SliderPower);
55 DDX_Control(pDX, IDC_SLIDER_VEGETABLE_WIND_FREQUENCY, SliderFrequency);
56 DDX_Control(pDX, IDC_SLIDER_VEGETABLE_WIND_BENDSTART, SliderBendStart);
57 //}}AFX_DATA_MAP
61 BEGIN_MESSAGE_MAP(CVegetableWindDlg, CDialog)
62 //{{AFX_MSG_MAP(CVegetableWindDlg)
63 ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_VEGETABLE_WIND_BENDSTART, OnReleasedcaptureSliderVegetableWindBendstart)
64 ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_VEGETABLE_WIND_FREQUENCY, OnReleasedcaptureSliderVegetableWindFrequency)
65 ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_VEGETABLE_WIND_POWER, OnReleasedcaptureSliderVegetableWindPower)
66 ON_BN_CLICKED(IDC_BUTTON_CLOSE, OnButtonClose)
67 ON_WM_HSCROLL()
68 //}}AFX_MSG_MAP
69 END_MESSAGE_MAP()
72 // ***************************************************************************
73 void CVegetableWindDlg::updateView()
75 float a;
77 // update Power.
78 a= _ObjViewer->getVegetableWindPower();
79 StaticPower.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
80 NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_POWER);
81 SliderPower.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_POWER));
83 // update BendStart.
84 a= _ObjViewer->getVegetableWindBendStart();
85 StaticBendStart.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
86 NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART);
87 SliderBendStart.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART));
89 // update Frequency.
90 a= _ObjViewer->getVegetableWindFrequency();
91 StaticFrequency.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
92 NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY);
93 SliderFrequency.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY));
97 // ***************************************************************************
98 // ***************************************************************************
99 // CVegetableWindDlg message handlers
100 // ***************************************************************************
101 // ***************************************************************************
104 // ***************************************************************************
105 BOOL CVegetableWindDlg::OnInitDialog()
107 CDialog::OnInitDialog();
109 SliderPower.SetRange(0, NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE);
110 SliderBendStart.SetRange(0, NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE);
111 SliderFrequency.SetRange(0, NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE);
113 // Init them and static.
114 updateView();
116 return TRUE; // return TRUE unless you set the focus to a control
117 // EXCEPTION: OCX Property Pages should return FALSE
122 // ***************************************************************************
123 void CVegetableWindDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
125 // test if one of my sliders.
126 CSliderCtrl *sliderCtrl= (CSliderCtrl*)pScrollBar;
127 if( (sliderCtrl==&SliderPower || sliderCtrl==&SliderBendStart || sliderCtrl==&SliderFrequency)
128 && nSBCode==SB_THUMBPOSITION || nSBCode==SB_THUMBTRACK)
130 float a;
131 if(sliderCtrl == &SliderPower)
133 a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_POWER / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE;
134 _ObjViewer->setVegetableWindPower(a);
135 StaticPower.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
137 else if(sliderCtrl == &SliderBendStart)
139 a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE;
140 _ObjViewer->setVegetableWindBendStart(a);
141 StaticBendStart.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
143 else if(sliderCtrl == &SliderFrequency)
146 a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE;
147 _ObjViewer->setVegetableWindFrequency(a);
148 StaticFrequency.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
151 else
153 CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
157 // ***************************************************************************
158 void CVegetableWindDlg::OnReleasedcaptureSliderVegetableWindPower(NMHDR* pNMHDR, LRESULT* pResult)
160 float a;
161 a= (float)SliderPower.GetPos() * NL_VEGETABLE_EDIT_WIND_MAX_POWER / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE;
162 _ObjViewer->setVegetableWindPower(a);
164 // refersh.
165 updateView();
167 *pResult = 0;
170 // ***************************************************************************
171 void CVegetableWindDlg::OnReleasedcaptureSliderVegetableWindBendstart(NMHDR* pNMHDR, LRESULT* pResult)
173 float a;
174 a= (float)SliderBendStart.GetPos() * NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE;
175 _ObjViewer->setVegetableWindBendStart(a);
177 // refersh.
178 updateView();
180 *pResult = 0;
183 // ***************************************************************************
184 void CVegetableWindDlg::OnReleasedcaptureSliderVegetableWindFrequency(NMHDR* pNMHDR, LRESULT* pResult)
186 float a;
187 a= (float)SliderFrequency.GetPos() * NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE;
188 _ObjViewer->setVegetableWindFrequency(a);
190 // refersh.
191 updateView();
193 *pResult = 0;
198 // ***************************************************************************
199 void CVegetableWindDlg::OnButtonClose()
201 // hide the window
202 ShowWindow(false);