#include <tranlate.h>
Inheritance diagram for OpTranslateTrans:
Public Member Functions | |
OpTranslateTrans () | |
Constructor. Does nothing. | |
virtual BOOL | ShouldPointerBeOffset () |
Tells the base class of the operation that we want our mouse coords to be left alone. | |
Static Public Member Functions | |
static BOOL | Declare () |
Adds the operation to the list of all known operations. | |
Private Member Functions | |
CC_DECLARE_DYNCREATE (OpTranslateTrans) | |
virtual void | InitTransformImmediate (OpParam *) |
Sets up the transform ready for an immediate translation. This is called from DoWithParam(). | |
virtual void | InitTransformOnDrag (DocCoord, ClickModifiers) |
Sets up the parameters needed to build the transform matrix at the start of the drag. This base class version of this function does nothing. | |
virtual void | UpdateTransformOnDrag (DocCoord, Spread *, ClickModifiers &) |
Does the calculations needed when the mouse moves to keep all the params needed to build the rotation matrix up to date. | |
virtual void | BuildMatrix () |
Builds the transform matrix required to rotate the selection about the point CentreOfRot by the required number of degrees. | |
virtual void | ConstrainDrag (DocCoord *) |
Will constrain the mouse position to lie along rays from the centre of rotation at the constrain angle apart (45 degrees by default). | |
virtual BOOL | CanChangeSpread () |
Tell the baseclass functions whether to draw drag feedback only on the start spread or to allow drag rendering to be done on other spreads too. | |
Private Attributes | |
DocCoord | LastPos |
DocCoord | OriginalGridOffset |
Definition at line 122 of file tranlate.h.
|
Constructor. Does nothing.
Definition at line 134 of file tranlate.cpp. 00134 : TransOperation() 00135 { 00136 //Set status line help 00137 StatusHelpID = _R(IDS_TRANSLTRANS_STATUS1); 00138 StatusHelpID2 = _R(IDS_TRANSLTRANS_STATUS2); 00139 CanScaleLines = FALSE; 00140 }
|
|
Builds the transform matrix required to rotate the selection about the point CentreOfRot by the required number of degrees.
Reimplemented from TransOperation. Definition at line 300 of file tranlate.cpp. 00301 { 00302 // Build a translation matrix by takeing the offset from the last mouse position 00303 // to the start mouse position 00304 Transform = Matrix(LastPos.x-GetStartPos().x, LastPos.y-GetStartPos().y); 00305 }
|
|
Tell the baseclass functions whether to draw drag feedback only on the start spread or to allow drag rendering to be done on other spreads too.
Reimplemented from TransOperation. Definition at line 283 of file tranlate.cpp. 00284 { 00285 return TRUE; 00286 }
|
|
|
|
Will constrain the mouse position to lie along rays from the centre of rotation at the constrain angle apart (45 degrees by default).
Reimplemented from TransOperation. Definition at line 342 of file tranlate.cpp. 00343 { 00344 // Lock the mouse to move along the axis or diagonally 00345 DocCoord Blobby = GetStartPos(); 00346 DocView::ConstrainToAngle(Blobby, PointerPos); 00347 }
|
|
Adds the operation to the list of all known operations.
Reimplemented from TransOperation. Definition at line 361 of file tranlate.cpp. 00362 { 00363 return (RegisterOpDescriptor(0, _R(IDS_SELECTOR_MOVE), CC_RUNTIME_CLASS(OpTranslateTrans), 00364 OPTOKEN_TRANSLATE, TransOperation::GetState)); 00365 }
|
|
Sets up the transform ready for an immediate translation. This is called from DoWithParam().
Reimplemented from TransOperation. Definition at line 158 of file tranlate.cpp. 00159 { 00160 // Set the initial position 00161 StartPos = DocCoord(0,0); 00162 RawStartPos = StartPos; 00163 MagStartPos = StartPos; 00164 00165 // and copy the offset to translate by from Param2 00166 DocCoord* Offset = (DocCoord*)( PVOID(pOpParam->Param2) ); 00167 LastPos.x = Offset->x; 00168 LastPos.y = Offset->y; 00169 00170 OriginalGridOffset.x=0; 00171 OriginalGridOffset.y=0; 00172 }
|
|
Sets up the parameters needed to build the transform matrix at the start of the drag. This base class version of this function does nothing.
Reimplemented from TransOperation. Definition at line 188 of file tranlate.cpp. 00189 { 00190 // make a note of the current mouse position 00191 LastPos = PointerPos; 00192 00193 // Record the offset from the mouse pos to the grid 00194 OriginalGridOffset = GetStartPos(); 00195 DocView::ForceSnapToGrid(StartSpread, &OriginalGridOffset); 00196 OriginalGridOffset = GetStartPos() - OriginalGridOffset; 00197 }
|
|
Tells the base class of the operation that we want our mouse coords to be left alone.
Reimplemented from TransOperation. Definition at line 321 of file tranlate.cpp. 00322 { 00323 return FALSE; 00324 }
|
|
Does the calculations needed when the mouse moves to keep all the params needed to build the rotation matrix up to date.
Reimplemented from TransOperation. Definition at line 215 of file tranlate.cpp. 00216 { 00217 if (!ClickMods.Constrain) 00218 { 00219 // Apply snapping to the pointer pos 00220 // First apply magnetic snapping alone 00221 if (MagneticGripPoint && DocView::SnapSelected(pSpread, &PointerPos, TRUE, FALSE)) 00222 { 00223 // Magnetic snapping worked! 00224 } 00225 else 00226 { 00227 // Magnetic snapping failed! 00228 // If magnetic snapping failed then try grid snapping 00229 // on the adjusted coordinate 00230 if (ClickMods.Alternative1) 00231 { 00232 PointerPos = PointerPos - OriginalGridOffset; 00233 DocView::SnapSelected(pSpread, &PointerPos, FALSE, TRUE); 00234 PointerPos = PointerPos + OriginalGridOffset; 00235 } 00236 else 00237 { 00238 DocCoord Offset = PointerPos - LastPos; 00239 DocRect Bounds( BoundingData.x, BoundingData.y, 00240 BoundingData.x+BoundingData.Width, BoundingData.y+BoundingData.Height 00241 ); 00242 Bounds.lo = Bounds.lo + Offset; 00243 Bounds.hi = Bounds.hi + Offset; 00244 DocRect SnappedBounds = Bounds; 00245 DocView::SnapSelected(pSpread,&SnappedBounds,LastRawPos,RawPos); 00246 PointerPos = PointerPos + (SnappedBounds.lo - Bounds.lo); 00247 } 00248 } 00249 } 00250 00251 // Work out the offset from the last mouse pos 00252 INT32 dx = PointerPos.x - LastPos.x; 00253 INT32 dy = PointerPos.y - LastPos.y; 00254 00255 // Add the offset into the structure 00256 BoundingData.x += dx; 00257 BoundingData.y += dy; 00258 BoundingData.XYChanged = TRUE; 00259 00260 // Make a mental note of the current position 00261 LastPos = PointerPos; 00262 00263 // Update the current spread (must do this if CanChangeSpread returns TRUE) 00264 CurrentSpread = pSpread; 00265 }
|
|
Definition at line 148 of file tranlate.h. |
|
Definition at line 149 of file tranlate.h. |