00001
00030 #ifndef INC_MGUI_TOOLINSERTION_H
00031 #define INC_MGUI_TOOLINSERTION_H
00032
00033 #ifndef INC_MGUI_TOOLBASE_H
00034 #include <mgui/toolbase.h>
00035 #endif
00036
00037 class TRANS2D_AFFINE;
00038
00039 namespace MGUI {
00040
00042 class TOOL_INSERTION : public TOOL_BASE {
00043 public:
00044
00046 explicit TOOL_INSERTION (
00047 TOOLCANVAS *canvas
00048 );
00049
00051 virtual ~TOOL_INSERTION ();
00052
00055 double GetAngle (
00056 ) const { return (m_angle); }
00057
00059 const DRECT2D& GetExtents (
00060 ) const { return (m_extents); }
00061
00064 const DPOINT2D& GetInsertionPoint (
00065 ) const { return (m_InsertPoint); }
00066
00069 const DPOINT2D& GetScale (
00070 ) const { return (m_scale); }
00071
00074 const TRANS2D_AFFINE& GetTransformation (
00075 ) const { return (m_SrcToDest); }
00076
00078 void SetAngle (
00079 double angle
00080 );
00081
00085 void SetAngleVisible (
00086 bool anglevisible = true
00087 );
00088
00090 void SetCenterVisible (
00091 bool centervisible = true
00092 );
00093
00096 void SetInsertionPoint (
00097 const DPOINT2D& InsertionPoint
00098 );
00099
00102 void SetScale (
00103 const DPOINT2D& scale
00104 );
00105
00107 void SetSourcePosition (
00108 const DRECT2D& SrcExtents,
00109 const DPOINT2D* SrcBasePoint = 0,
00110 bool ResetToIdentity = true
00111 );
00112
00116 void SetSideMarkerLength (
00117 int lengthoutside
00118 );
00119
00120 private:
00121 #ifndef GENERATING_DOXYGEN_OUTPUT
00122
00123 enum ZONE {
00124 ZONE_Outside = 0,
00125 ZONE_Inside,
00126 ZONE_Corner0,
00127 ZONE_Corner1,
00128 ZONE_Corner2,
00129 ZONE_Corner3,
00130 ZONE_Side01,
00131 ZONE_Side12,
00132 ZONE_Side23,
00133 ZONE_Side30,
00134 ZONE_Rotate,
00135 ZONE_SetCenter,
00136 ZONE_NoFunction
00137 };
00138
00139 bool m_centervisible;
00140 bool m_anglevisible;
00141 int m_sidemarkerlength;
00142
00143 DRECT2D m_extents;
00144 DPOINT2D m_destCorners[4];
00145 DPOINT2D m_scale;
00146 DPOINT2D m_BasePoint;
00147 DPOINT2D m_InsertPoint;
00148 double m_angle;
00149 TRANS2D_AFFINE m_SrcToDest;
00150
00151 ZONE m_PointerZone;
00152 DPOINT2D m_prevpt;
00153 UINT8 m_AdjustMode;
00154
00156 class MANUAL_INSERTION;
00157 friend class MANUAL_INSERTION;
00158
00159
00160 void AdjustTool (const DPOINT2D&, bool firsttime=false);
00161 DPOINT2D ComputeCenter () const;
00162 void ComputePointerZone (const DPOINT2D&);
00163 void Recompute ();
00164 void ResizeTool (const DPOINT2D&);
00165 void RotateTool (const DPOINT2D&);
00166 void StartTool (const DPOINT2D&);
00167 void UpdateCursor (const DPOINT2D&) const;
00168
00169
00170 virtual MANUAL_BASE* v_CreateManualBase ();
00171 virtual void v_DoDraw ();
00172 virtual void v_DoMove (double dx, double dy, ADJUSTFLAGS flags);
00173 virtual bool v_OnPointerButtonDown (MGUI::POINT point, POINTERBUTTON button, KEYSTATE keystate);
00174 virtual void v_OnPointerMove (MGUI::POINT point, POINTERBUTTON button, KEYSTATE keystate);
00175 #endif // GENERATING_DOXYGEN_OUTPUT
00176
00177 };
00178
00179
00180 }
00181
00182
00183 #endif // INC_MGUI_TOOLRECTANGLE_H