Linux multi-monitor fullscreen support
[ryzomcore.git] / nel / tools / 3d / object_viewer / curve_edit.h
blobbaed5ee236d33ec1f7af228e87f43432f74c730e
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 #if !defined(AFX_CURVE_EDIT_H__7E8F583B_8E0D_4623_9128_B0FD23E1DC4A__INCLUDED_)
18 #define AFX_CURVE_EDIT_H__7E8F583B_8E0D_4623_9128_B0FD23E1DC4A__INCLUDED_
20 #if _MSC_VER > 1000
21 #pragma once
22 #endif
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
34 public:
35 // ctor
36 CurveEdit(NL3D::CPSFloatCurveFunctor *curve, CParticleWorkspace::CNode *ownerNode, IPopupNotify *pn, CWnd* pParent = NULL);
37 // dtor
38 ~CurveEdit();
40 // non modal display
41 void init(CWnd *pParent);
44 // Dialog Data
45 //{{AFX_DATA(CurveEdit)
46 enum { IDD = IDD_CURVE_EDIT };
47 BOOL m_DisplayInterpolation;
48 BOOL m_SmoothingOn;
49 //}}AFX_DATA
52 // Overrides
53 // ClassWizard generated virtual function overrides
54 //{{AFX_VIRTUAL(CurveEdit)
55 protected:
56 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
57 //}}AFX_VIRTUAL
59 // Implementation
60 public:
61 NL3D::CPSFloatCurveFunctor *Curve; // the scheme being edited
62 protected:
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();
87 //}}AFX_MSG
88 DECLARE_MESSAGE_MAP()
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;
103 void scaleMinMax();
105 sint _X, _Y, _Width, _Height; // position and size of the drawing window
106 sint _SelectedCtrlPoint; //-1 means none
107 enum { Move, Moving,
108 Create, Created,
109 Remove, Removing } _State;
110 float _Scale, _Origin;
111 CEditableRangeUInt *_NumSamplesDlg;
112 CParticleWorkspace::CNode *_Node;
114 struct CNumSampleWrapper : public IPSWrapper<uint32>
116 CurveEdit *CE;
117 uint32 get(void) const
119 return CE->Curve->getNumSamples();
121 void set(const uint32 &value)
123 CE->Curve->setNumSamples(value);
124 CE->Invalidate();
126 } _NumSampleWrapper;
128 void invalidate();
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_)