00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef INC_MGUI_TOOLMLPT_H
00022 #define INC_MGUI_TOOLMLPT_H
00023
00024 #ifndef INC_MGUI_TOOLBASE_H
00025 #include <mgui/toolbase.h>
00026 #endif
00027
00028 #ifndef INC_MI32_DOUBLEAR_H
00029 #include <mi32/doublear.h>
00030 #endif
00031
00032 namespace MGUI {
00033
00034
00035
00036 class TOOL_MULTIPOINT : public TOOL_BASE {
00037 public:
00038
00039
00040 explicit TOOL_MULTIPOINT (
00041 TOOLCANVAS *canvas
00042 );
00043
00044
00045 virtual ~TOOL_MULTIPOINT ();
00046
00047
00048 const DPOINT3D& GetActivePoint (
00049 ) const { return (m_Points[m_ActiveIndex]); }
00050
00051
00052 int GetNumPoints (
00053 ) const { return (m_Points.GetNumItems()); }
00054
00055
00056
00057 const DPOINT3D& GetPoint (
00058 int index
00059 ) const { return (m_Points[index]); }
00060
00061
00062 const DOUBLE_ARRAY<DPOINT3D> GetPoints (
00063 ) const { return (m_Points); }
00064
00065
00066 bool IsActiveValid (
00067 ) const { return (m_ActiveIndex >= 0 && m_ActiveIndex < m_Points.GetNumItems()); }
00068
00069
00070
00071 void SetMarker (
00072 MARKER marker,
00073 UINT16 size = 0
00074 );
00075
00076 protected:
00077
00078
00079 virtual void v_OnChangeActiveElem (
00080 );
00081
00082 private:
00083
00084 #ifndef GENERATING_DOXYGEN_OUTPUT
00085
00086 enum EDITMODE {
00087 EDITMODE_Automatic,
00088 EDITMODE_Add,
00089 EDITMODE_Move,
00090 EDITMODE_Select
00091 };
00092
00093 enum ZONE {
00094 ZONE_NoFunction = 0,
00095 ZONE_Outside,
00096 };
00097
00098
00099 MARKER m_marker;
00100 UINT16 m_markersize;
00101 EDITMODE m_EditMode;
00102
00103 DOUBLE_ARRAY<DPOINT3D> m_Points;
00104 int m_ActiveIndex;
00105
00106 ZONE m_CursorZone;
00107 DPOINT2D m_prevpt;
00108 bool m_NotifyChangeElem;
00109
00110 void ActivateClosestPoint (const DPOINT2D&);
00111 void AddPoint (MGD::CONTEXT*, const DPOINT2D&);
00112 void AdjustTool (DPOINT2D&, CHANGESEQ);
00113 void ComputeCursorZone (const DPOINT2D&);
00114 void DeletePoint ();
00115 void DrawNeighborPoints (MGD::CONTEXT*, const LRECT2D&) const;
00116 void DrawPoint (MGD::CONTEXT*, int) const;
00117 void ErasePoint (MGD::CONTEXT*, bool circleonly = false) const;
00118 int FindClosestPoint (const DPOINT2D&) const;
00119 void SetActiveIndex (int);
00120 void UpdateCursor () const;
00121
00122
00123 virtual MGUI::FORM* v_CreateControlForm (LAYOUT_PANE_BASE& ParentPane, CTRLOPT ctrlopt);
00124 virtual void v_DoDraw (MGD::CONTEXT*);
00125 virtual void v_DoMove (double dx, double dy, ADJUSTFLAGS flags);
00126 virtual void v_OnClear ();
00127 virtual bool v_OnKey (MGUI::POINT point, KEYCODE keycode, KEYSTATE keystate);
00128 virtual void v_OnLButtonDown (MGUI::POINT point, KEYSTATE keystate);
00129 virtual void v_OnLButtonUp (MGUI::POINT point, KEYSTATE keystate);
00130 virtual void v_OnMouseMove (MGUI::POINT point, KEYSTATE keystate);
00131
00132 #endif // GENERATING_DOXYGEN_OUTPUT
00133 };
00134
00135
00136 }
00137
00138
00139 #endif // INC_MGUI_TOOLMLPT_H