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 #if !defined(AFX_CURVE_EDIT_H__7E8F583B_8E0D_4623_9128_B0FD23E1DC4A__INCLUDED_)
18 #define AFX_CURVE_EDIT_H__7E8F583B_8E0D_4623_9128_B0FD23E1DC4A__INCLUDED_
25 #include "nel/3d/ps_float.h"
26 #include "ps_wrapper.h"
27 #include "popup_notify.h"
28 #include "editable_range.h"
29 #include "particle_workspace.h"
32 class CurveEdit
: public CDialog
36 CurveEdit(NL3D::CPSFloatCurveFunctor
*curve
, CParticleWorkspace::CNode
*ownerNode
, IPopupNotify
*pn
, CWnd
* pParent
= NULL
);
41 void init(CWnd
*pParent
);
45 //{{AFX_DATA(CurveEdit)
46 enum { IDD
= IDD_CURVE_EDIT
};
47 BOOL m_DisplayInterpolation
;
53 // ClassWizard generated virtual function overrides
54 //{{AFX_VIRTUAL(CurveEdit)
56 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
61 NL3D::CPSFloatCurveFunctor
*Curve
; // the scheme being edited
64 typedef NL3D::CPSFloatCurveFunctor::CCtrlPoint CCtrlPoint
;
66 // Generated message map functions
67 //{{AFX_MSG(CurveEdit)
68 afx_msg
void OnMouseMove(UINT nFlags
, CPoint point
);
69 afx_msg
void OnLButtonUp(UINT nFlags
, CPoint point
);
70 afx_msg
void OnLButtonDown(UINT nFlags
, CPoint point
);
71 afx_msg
void OnPaint();
72 afx_msg
void OnZoomOut();
73 afx_msg
void OnZoomIn();
74 afx_msg
void OnGoUp();
75 afx_msg
void OnGoDown();
76 virtual BOOL
OnInitDialog();
77 afx_msg
void OnMovePoint();
78 afx_msg
void OnAddPoint();
79 afx_msg
void OnRemovePoint();
80 afx_msg
void OnDisplayInterpolation();
81 afx_msg
void OnSmoothingOn();
82 afx_msg
void OnLastEqualFirst();
83 afx_msg
void OnCenterCurve();
84 afx_msg
void OnFirstEqualLast();
85 afx_msg
void OnDestroy();
86 afx_msg
void OnClose();
90 // convert a date / value pair to a pos in the drawing canvas
91 POINT
makePoint(float date
, float value
) const;
92 /// convert from screen coordinate to a <date, value> pair
93 CCtrlPoint
coordsFromScreen(sint x
, sint y
) const;
94 // test if the given pos intersect a control point
95 sint
intersectCtrlPoint(sint x
, sint y
);
96 void drawBackGround(CDC
&dc
);
97 void drawCtrlPoints(CDC
&dc
);
98 void drawCurve(CDC
&dc
);
99 void drawInterpolatingCurve(CDC
&dc
);
100 void setupBoundRect(CDC
&dc
);
101 void drawUnits(CDC
&dc
);
102 float getSampledValue(float date
) const;
105 sint _X
, _Y
, _Width
, _Height
; // position and size of the drawing window
106 sint _SelectedCtrlPoint
; //-1 means none
109 Remove
, Removing
} _State
;
110 float _Scale
, _Origin
;
111 CEditableRangeUInt
*_NumSamplesDlg
;
112 CParticleWorkspace::CNode
*_Node
;
114 struct CNumSampleWrapper
: public IPSWrapper
<uint32
>
117 uint32
get(void) const
119 return CE
->Curve
->getNumSamples();
121 void set(const uint32
&value
)
123 CE
->Curve
->setNumSamples(value
);
130 IPopupNotify
*_PN
; // this should be notified when this window is destroyed
134 //{{AFX_INSERT_LOCATION}}
135 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
137 #endif // !defined(AFX_CURVE_EDIT_H__7E8F583B_8E0D_4623_9128_B0FD23E1DC4A__INCLUDED_)