00001
00021 #ifndef INC_MGUI_TOOLBREAKLINE_H
00022 #define INC_MGUI_TOOLBREAKLINE_H
00023
00024 #ifndef INC_MGUI_TOOLBASE_H
00025 #include <mgui/toolbase.h>
00026 #endif
00027
00028 #ifndef INC_MI32_POLYLINE_H
00029 #include <mi32/polyline.h>
00030 #endif
00031
00032 namespace MGUI {
00033
00034
00035
00037 class TOOL_BREAKLINE : public TOOL_BASE {
00038 public:
00039
00041 explicit TOOL_BREAKLINE (
00042 TOOLCANVAS *canvas
00043 );
00044
00046 virtual ~TOOL_BREAKLINE ();
00047
00049 void GetLines (
00050 POLYLINELIST& LineList
00051 ) const;
00052
00054 void SetLine (
00055 const POLYLINE& PolyLine
00056 );
00057
00060 void SetMarker (
00061 MARKER marker,
00062 UINT16 size = 0
00063 );
00064
00065 private:
00066 #ifndef GENERATING_DOXYGEN_OUTPUT
00067 enum EDITMODE {
00068 EDITMODE_Automatic,
00069 EDITMODE_Add,
00070 EDITMODE_Edit,
00071 EDITMODE_Delete
00072 };
00073
00074 enum ZONE {
00075 ZONE_NoFunction = 0,
00076 ZONE_Outside,
00077 ZONE_BreakPoint,
00078 ZONE_Line
00079 };
00080
00081 struct BREAKPOINT {
00082 DPOINT3D m_Point;
00083 double m_DistFromStart;
00084 INT32 m_LineSegNum;
00085 bool m_SegmentDeleted;
00086
00087 BREAKPOINT () { memset(this, 0, sizeof(BREAKPOINT)); }
00088 };
00089
00091 MARKER m_marker;
00092 UINT16 m_markersize;
00093 EDITMODE m_EditMode;
00095 POLYLINE m_PolyLine;
00096 int m_ActiveIndex;
00097 MILIST<BREAKPOINT> m_BreakPointList;
00099 ZONE m_CursorZone;
00100 DPOINT2D m_prevpt;
00101 double m_TooltoWindowScale;
00102 bool m_NotifyChangeElem;
00103
00105 class MANUAL_BREAKLINE;
00106 friend class MANUAL_BREAKLINE;
00107 class FORM_BREAKLINE;
00108 FORM_BREAKLINE* m_pFormBreakLine;
00109
00111 void ActivateClosestPoint (const DPOINT2D&);
00112 void AddBreakPoint (const DPOINT2D&);
00113 void AdjustTool (DPOINT2D&, CHANGESEQ);
00114 void ChangeBreakPoint (INT32 idx, const DPOINT3D&);
00115 void ComputeCursorZone (const DPOINT2D&);
00116 void DeleteBreakPoint (int);
00117 void DrawNeighborBreakPoints (MGD::CONTEXT*, const LRECT2D&, int SkipPoint) const;
00118 void DrawLine (MGD::CONTEXT*, const POLYLINE&, const DRECT2D&) const;
00119 void DrawTool (MGD::CONTEXT*, const DRECT2D&, int SkipBreakPointIdx = -1) const;
00120 void MarkLineSegment (const DPOINT2D&);
00121 void SetActiveBreakPointIndex (int);
00122 void UpdateCursor () const;
00123
00124
00125 virtual MGUI::FORM* v_CreateControlForm (LAYOUT_PANE_BASE& ParentPane, CTRLOPT ctrlopt);
00126 virtual MANUAL_BASE* v_CreateManualBase ();
00127 virtual void v_DoDraw ();
00128 virtual void v_DoMove (double dx, double dy, ADJUSTFLAGS flags);
00129 virtual void v_OnClear ();
00130 virtual int v_GenerateRegion (REGION2D& region) const;
00131 virtual bool v_OnKey (MGUI::POINT point, KEYCODE keycode, KEYSTATE keystate);
00132 virtual bool v_OnPointerButtonDown (MGUI::POINT point, POINTERBUTTON button, KEYSTATE keystate);
00133 virtual bool v_OnPointerButtonUp (MGUI::POINT point, POINTERBUTTON button, KEYSTATE keystate);
00134 virtual void v_OnPointerMove (MGUI::POINT point, POINTERBUTTON button, KEYSTATE keystate);
00135 virtual void v_OnSetTransToWindow ();
00136
00137 #endif // GENERATING_DOXYGEN_OUTPUT
00138 };
00139
00140
00141
00142 }
00143
00144 #endif // INC_MGUI_TOOLBREAKLINE_H