Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / nel / tools / 3d / object_viewer / global_wind_dlg.cpp
blobef55408e1abb00d9a796100f6ee22d15c7cb0d9f
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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 // global_wind_dlg.cpp : implementation file
20 #include "std_afx.h"
22 #include "object_viewer.h"
23 #include "global_wind_dlg.h"
26 #define NL_GLOBAL_WIND_SLIDER_RANGE 1000
28 /////////////////////////////////////////////////////////////////////////////
29 // CGlobalWindDlg dialog
32 CGlobalWindDlg::CGlobalWindDlg(CObjectViewer *objViewer, CWnd* pParent /*=NULL*/)
33 : CDialog(CGlobalWindDlg::IDD, pParent), _ObjViewer(objViewer)
35 //{{AFX_DATA_INIT(CGlobalWindDlg)
36 // NOTE: the ClassWizard will add member initialization here
37 //}}AFX_DATA_INIT
41 void CGlobalWindDlg::DoDataExchange(CDataExchange* pDX)
43 CDialog::DoDataExchange(pDX);
44 //{{AFX_DATA_MAP(CGlobalWindDlg)
45 DDX_Control(pDX, IDC_STATIC_GLOBAL_WIND_POWER, StaticPower);
46 DDX_Control(pDX, IDC_SLIDER_GLOBAL_WIND_POWER, SliderPower);
47 //}}AFX_DATA_MAP
51 BEGIN_MESSAGE_MAP(CGlobalWindDlg, CDialog)
52 //{{AFX_MSG_MAP(CGlobalWindDlg)
53 ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_GLOBAL_WIND_POWER, OnReleasedcaptureSliderGlobalWindPower)
54 ON_WM_HSCROLL()
55 ON_WM_DESTROY()
56 //}}AFX_MSG_MAP
57 END_MESSAGE_MAP()
60 // ***************************************************************************
61 void CGlobalWindDlg::updateView()
63 float a;
64 TCHAR str[256];
66 // update Power.
67 a= _ObjViewer->getGlobalWindPower();
68 _stprintf(str, _T("%.2f"), a);
69 StaticPower.SetWindowText(str);
70 NLMISC::clamp(a, 0.f, 1.f);
71 SliderPower.SetPos((sint)(a*NL_GLOBAL_WIND_SLIDER_RANGE));
74 // ***************************************************************************
75 // ***************************************************************************
76 // CVegetableWindDlg message handlers
77 // ***************************************************************************
78 // ***************************************************************************
81 // ***************************************************************************
82 BOOL CGlobalWindDlg::OnInitDialog()
84 CDialog::OnInitDialog();
86 SliderPower.SetRange(0, NL_GLOBAL_WIND_SLIDER_RANGE);
88 // Init them and static.
89 updateView();
91 return TRUE; // return TRUE unless you set the focus to a control
92 // EXCEPTION: OCX Property Pages should return FALSE
95 // ***************************************************************************
96 void CGlobalWindDlg::OnReleasedcaptureSliderGlobalWindPower(NMHDR* pNMHDR, LRESULT* pResult)
98 float a;
99 a= (float)SliderPower.GetPos() / NL_GLOBAL_WIND_SLIDER_RANGE;
100 _ObjViewer->setGlobalWindPower(a);
102 // refersh.
103 updateView();
105 *pResult = 0;
108 // ***************************************************************************
109 void CGlobalWindDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
111 // test if one of my sliders.
112 CSliderCtrl *sliderCtrl= (CSliderCtrl*)pScrollBar;
113 if( sliderCtrl==&SliderPower && nSBCode==SB_THUMBPOSITION || nSBCode==SB_THUMBTRACK)
115 float a;
116 TCHAR str[256];
118 a= (float)nPos / NL_GLOBAL_WIND_SLIDER_RANGE;
119 _ObjViewer->setGlobalWindPower(a);
120 _stprintf(str, _T("%.2f"), a);
121 StaticPower.SetWindowText(str);
123 else
125 CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
129 void CGlobalWindDlg::OnDestroy()
131 setRegisterWindowState (this, REGKEY_OBJ_GLOBAL_WIND_DLG);
133 CDialog::OnDestroy();