Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / nel / tools / 3d / object_viewer / bin_op_dlg.h
blob1e54d7e98f95bd2b0f9e83f30ca26484803144d6
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/>.
18 #if !defined(AFX_BIN_OP_DLG_H__1EF9C3C2_6D2B_4E4D_817E_1CA094EBF287__INCLUDED_)
19 #define AFX_BIN_OP_DLG_H__1EF9C3C2_6D2B_4E4D_817E_1CA094EBF287__INCLUDED_
21 #if _MSC_VER > 1000
22 #pragma once
23 #endif
25 #include "attrib_dlg.h"
26 #include "nel/3d/ps_attrib_maker_bin_op.h"
28 class CBinOpDlg : public CDialog
30 // Construction
31 public:
32 CBinOpDlg(IPopupNotify *pn, CWnd* pParent = NULL); // standard constructor
34 virtual void init(CWnd *pParent) = 0 ;
36 void create(CWnd *pParent);
38 // called when a new operator has been selected
39 virtual void newOp(uint32 op) = 0 ;
41 // Dialog Data
42 //{{AFX_DATA(CBinOpDlg)
43 enum { IDD = IDD_BIN_OP };
44 CComboBox m_BinOp;
45 //}}AFX_DATA
48 // Overrides
49 // ClassWizard generated virtual function overrides
50 //{{AFX_VIRTUAL(CBinOpDlg)
51 protected:
52 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
53 //}}AFX_VIRTUAL
55 // Implementation
56 protected:
57 IPopupNotify *_PN;
59 // Generated message map functions
60 //{{AFX_MSG(CBinOpDlg)
61 virtual BOOL OnInitDialog();
62 afx_msg void OnSelchangeBinOp();
63 afx_msg void OnClose();
64 //}}AFX_MSG
65 DECLARE_MESSAGE_MAP()
69 /** construct a dialog that allow to edit a binary operator that produce argument of a particle system
71 template <class T> class CBinOpDlgT : public CBinOpDlg
73 public:
74 /// ctruct the given dialog from the given scheme that owns memory
75 CBinOpDlgT(NL3D::CPSAttribMakerBinOp<T> *editedScheme, CAttribDlgT<T> **attrbDlg, IPopupNotify *pn, HBITMAP bitmapToDisplay)
76 : CBinOpDlg(pn), _BitmapToDisplay(bitmapToDisplay), _EditedScheme(editedScheme)
78 for (uint k = 0 ; k < 2 ; ++k)
80 nlassert(attrbDlg);
81 _AttrbDlg[k] = attrbDlg[k];
82 _SchemeWrapper[k].S = _EditedScheme ;
83 _SchemeWrapper[k].Index = k ;
87 /// call this before performing DoModal and the like...
88 void init(CWnd *pParent)
90 CBinOpDlg::create(pParent);
91 uint k ;
92 for (k = 0 ; k < 2 ; ++k)
94 _AttrbDlg[k]->disableConstantValue() ;
95 _AttrbDlg[k]->setWrapper(&_DummyWrapper) ;
96 _AttrbDlg[k]->setSchemeWrapper(&_SchemeWrapper[k]) ;
97 _AttrbDlg[k]->init(_BitmapToDisplay, 10, 10 + k * 155, this) ;
100 // init the operator list box
101 static const TCHAR *ops[] = { _T("selectArg1"), _T("selectArg2"), _T("modulate"), _T("add"), _T("subtract") };
102 for (k = 0 ; k < (uint) NL3D::CPSBinOp::last ; ++k)
104 // SchemeWrapper[k].S reference the atriobute maker being edited
105 if (_EditedScheme->supportOp( (NL3D::CPSBinOp::BinOp) k))
107 sint index = m_BinOp.AddString(ops[k]);
108 m_BinOp.SetItemData(index, k);
109 if ((uint) _EditedScheme->getOp() == k)
111 m_BinOp.SetCurSel(k) ;
115 UpdateData(FALSE) ;
118 ~CBinOpDlgT()
120 for (uint k = 0 ; k < 2 ; ++k)
122 if (_AttrbDlg[k]) _AttrbDlg[k]->DestroyWindow() ;
123 delete _AttrbDlg[k] ;
127 protected:
129 NL3D::CPSAttribMakerBinOp<T> *_EditedScheme ;
132 // the bitmap displayed onthe left
133 HBITMAP _BitmapToDisplay ;
135 /// the dialogs that allow us to edit the schemes
136 CAttribDlgT<T> *_AttrbDlg[2] ;
138 /// a wrapper to edit the scheme (which himself owns a scheme !!)
139 struct CSchemeWrapper : public IPSSchemeWrapper<T>
141 NL3D::CPSAttribMakerBinOp<T> *S ;
142 uint Index ;
143 virtual scheme_type *getScheme(void) const { return S->getArg(Index) ; }
144 virtual void setScheme(scheme_type *s) { S->setArg(Index, s) ; } ;
145 } _SchemeWrapper[2] ;
147 /// a dummy wrapper for constant value. This shouldn't be called , however
148 struct CDummyWrapper : public IPSWrapper<T>
150 T get(void) const { nlassert(false) ; return T() ; }
151 void set(const T &) { nlassert(false) ; }
152 } _DummyWrapper ;
155 void newOp(uint32 op)
157 nlassert(_EditedScheme) ;
158 _EditedScheme->setOp((NL3D::CPSBinOp::BinOp) op) ;
163 //{{AFX_INSERT_LOCATION}}
164 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
166 #endif // !defined(AFX_BIN_OP_DLG_H__1EF9C3C2_6D2B_4E4D_817E_1CA094EBF287__INCLUDED_)