#include <gridtool.h>
Inheritance diagram for OpGridSelection:
Public Member Functions | |
OpGridSelection () | |
Constructor. | |
~OpGridSelection () | |
Destructor. | |
void | DoDrag (Spread *pSpread, DocCoord PointClicked, NodeGrid *GridClicked) |
Starts dragging from the coordinate passed in. | |
virtual void | DragPointerMove (DocCoord PointerPos, ClickModifiers ClickMods, Spread *, BOOL bSolidDrag) |
Pure virtual function which tells the operation that the mouse has moved. | |
virtual void | DragFinished (DocCoord PointerPos, ClickModifiers ClickMods, Spread *, BOOL Success, BOOL bSolidDrag) |
Ends the drag and translates the selected grids. It also ends the operation. Assumes that DragPointerMove() has been called during the drag. | |
DocRect | GetSelectedGridBounds (Spread *pSpread) |
Goes through all the selected grids in the given spread, returning the union. Used to ensure the snapping of selected grids to grids works. | |
void | RenderMyDragBlobs () |
Draws an EORed rectangle for all selected grids in SpreadClicked. | |
void | RenderDragBlobs (DocRect Rect, Spread *pSpread, BOOL bSolidDrag) |
Draws an EORed rectangle for all selected grids using the given params. | |
void | GetOpName (String_256 *OpName) |
The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies. | |
Static Public Member Functions | |
static BOOL | Declare () |
Adds the operation to the list of all known operations. | |
static OpState | GetState (String_256 *Description, OpDescriptor *) |
Find out the state of the operation at the specific time. | |
Private Member Functions | |
CC_DECLARE_DYNCREATE (OpGridSelection) | |
Private Attributes | |
Spread * | SpreadClicked |
DocCoord | StartPoint |
DocCoord | DragPoint |
Spread * | SpreadDrag |
DocRect | StartRect |
DocRect | DragRect |
BOOL | Plural |
Definition at line 320 of file gridtool.h.
|
Constructor.
Definition at line 2090 of file gridtool.cpp.
|
|
Destructor.
Definition at line 2104 of file gridtool.cpp.
|
|
|
|
Adds the operation to the list of all known operations.
Definition at line 2419 of file gridtool.cpp. 02420 { 02421 return (RegisterOpDescriptor( 02422 0, 02423 _R(IDS_GRID_TOOL), 02424 CC_RUNTIME_CLASS(OpGridSelection), 02425 OPTOKEN_GRIDSELECTION, 02426 OpGridSelection::GetState, 02427 0, /* help ID */ 02428 _R(IDBBL_NOOP), /* bubble ID */ 02429 0 /* bitmap ID */ 02430 )); 02431 }
|
|
Starts dragging from the coordinate passed in.
Definition at line 2158 of file gridtool.cpp. 02159 { 02160 // The last grid shown in the infobar before this op must be GridClicked 02161 PreOpDisplayedGrid = GridClicked; 02162 // The dragged version of GridClicked is yet to be determined 02163 PostOpDisplayedGrid = NULL; 02164 02165 SpreadClicked = pSpread; 02166 SpreadDrag = pSpread; 02167 StartPoint = PointClicked; 02168 DragPoint = PointClicked; 02169 02170 NodeGrid::ResetDocRectSnap(); 02171 02172 StartRect = GetSelectedGridBounds(pSpread); 02173 DragRect = StartRect; 02174 //DocView::SnapCurrent(pSpread,&DragRect,StartPoint,DragPoint); 02175 02176 RenderMyDragBlobs(); 02177 02178 // And tell the Dragging system that we need drags to happen 02179 StartDrag( DRAGTYPE_AUTOSCROLL ); 02180 }
|
|
Ends the drag and translates the selected grids. It also ends the operation. Assumes that DragPointerMove() has been called during the drag.
Reimplemented from Operation. Definition at line 2240 of file gridtool.cpp. 02242 { 02243 BOOL ok = Success; // The OK flag. If this is TRUE, it is safe to continue the operation 02244 02245 // Put the hour glass up as we have to 02246 BeginSlowJob(); 02247 02248 INT32 XDelta = DragRect.lo.x - StartRect.lo.x; 02249 INT32 YDelta = DragRect.lo.y - StartRect.lo.y; 02250 02251 BOOL FRedraw = FALSE; 02252 UINT32 SelCount = 0; 02253 UINT32 IDS = 0; 02254 02255 DocView* pDocView = DocView::GetSelected(); // Get ptr to current doc view 02256 if (pDocView != NULL) 02257 FRedraw = pDocView->GetShowGridState(); 02258 02259 FRedraw = TRUE; 02260 02261 // First Rub out the old boxes 02262 RenderMyDragBlobs(); 02263 02264 Node* pNode = SpreadClicked->FindLastChild(); 02265 Node* pPrevNode; 02266 while (pNode != NULL && ok) 02267 { 02268 pPrevNode = pNode->FindPrevious(); 02269 02270 if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeGrid))) 02271 { 02272 NodeGrid* pOldGrid = (NodeGrid*)pNode; 02273 02274 if (pOldGrid->IsGridSelected() && !pOldGrid->IsDefault()) 02275 { 02276 AttachNodeDirection AttDir; 02277 Node* pContextNode; 02278 NodeGrid* pNewGrid; 02279 Spread* pSrcSpread = SpreadClicked; 02280 Spread* pDestSpread; 02281 DocRect OldRect,NewRect; 02282 02283 SelCount++; 02284 02285 if (SpreadClicked == SpreadDrag) 02286 { 02287 pContextNode = pOldGrid; 02288 AttDir = NEXT; 02289 pDestSpread = SpreadClicked; 02290 } 02291 else 02292 { 02293 pContextNode = SpreadDrag; 02294 AttDir = LASTCHILD; 02295 pDestSpread = SpreadDrag; 02296 } 02297 02298 pNewGrid = DoDuplicateGrid( pOldGrid,AttDir,pContextNode, 02299 pSrcSpread,pDestSpread,FRedraw, 02300 XDelta,YDelta); 02301 ok = (pNewGrid != NULL); 02302 if (ok) ok = DoHideNode(pOldGrid,TRUE); 02303 02304 if (ok) 02305 { 02306 if (pOldGrid == PreOpDisplayedGrid) 02307 { 02308 GridTool::DisplayGridInfo(pNewGrid); 02309 PostOpDisplayedGrid = pNewGrid; 02310 } 02311 } 02312 } 02313 } 02314 pNode = pPrevNode; 02315 } 02316 02317 if (!ok) 02318 { 02319 if (IDS > 0) InformError( IDS, _R(IDS_OK) ); 02320 FailAndExecute(); 02321 } 02322 02323 Plural = (SelCount > 1); 02324 02325 // End the Drag 02326 EndDrag(); 02327 02328 // End the op 02329 End(); 02330 }
|
|
Pure virtual function which tells the operation that the mouse has moved. virtual void Operation::DragPointerMove( DocCoord PointerPos, ClickModifiers ClickMods, Spread *pSpread, BOOL bSolidDrag)
Reimplemented from Operation. Definition at line 2200 of file gridtool.cpp. 02202 { 02203 // First Rub out the old boxes 02204 RenderMyDragBlobs(); 02205 02206 DocCoord PrevDragPoint = DragPoint; 02207 02208 DragPoint = PointerPos; 02209 SpreadDrag = pSpread; 02210 02211 DragRect = StartRect; 02212 DragRect.Translate(DragPoint.x - StartPoint.x , DragPoint.y - StartPoint.y); 02213 DocView::SnapCurrent(pSpread,&DragRect,PrevDragPoint,DragPoint); 02214 02215 RenderMyDragBlobs(); 02216 }
|
|
The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies.
Reimplemented from Operation. Definition at line 2472 of file gridtool.cpp. 02473 { 02474 if (Plural) 02475 *OpName = String_256(_R(IDS_GRID_UNDO_SELECTS)); 02476 else 02477 *OpName = String_256(_R(IDS_GRID_UNDO_SELECT)); 02478 }
|
|
Goes through all the selected grids in the given spread, returning the union. Used to ensure the snapping of selected grids to grids works.
Definition at line 2123 of file gridtool.cpp. 02124 { 02125 DocRect rect; 02126 02127 Node* pNode = pSpread->FindLastChild(); 02128 Node* pPrevNode; 02129 while (pNode != NULL) 02130 { 02131 pPrevNode = pNode->FindPrevious(); 02132 02133 if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeGrid))) 02134 { 02135 NodeGrid* pGrid = (NodeGrid*)pNode; 02136 02137 if (pGrid->IsGridSelected() && !pGrid->IsDefault()) 02138 rect = rect.Union(pGrid->GetBoundingRect()); 02139 } 02140 pNode = pPrevNode; 02141 } 02142 02143 return (rect); 02144 }
|
|
Find out the state of the operation at the specific time.
Definition at line 2448 of file gridtool.cpp. 02449 { 02450 OpState Grid; 02451 02452 return Grid; 02453 }
|
|
Draws an EORed rectangle for all selected grids using the given params.
Reimplemented from Operation. Definition at line 2369 of file gridtool.cpp. 02370 { 02371 //MILLIPOINT dx = DragPoint.x - StartPoint.x; 02372 //MILLIPOINT dy = DragPoint.y - StartPoint.y; 02373 MILLIPOINT dx = DragRect.lo.x - StartRect.lo.x; 02374 MILLIPOINT dy = DragRect.lo.y - StartRect.lo.y; 02375 DocRect GridRect; 02376 02377 RenderRegion* pRegion = DocView::RenderOnTop( NULL/*&Rect*/, pSpread, UnclippedEOR ); 02378 02379 while ( pRegion != NULL ) 02380 { 02381 // Set the line colour 02382 pRegion -> SetLineColour( COLOUR_XORDRAG ); 02383 02384 Node* pNode = SpreadClicked->FindLastChild(); 02385 while (pNode != NULL) 02386 { 02387 if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeGrid))) 02388 { 02389 NodeGrid* pGrid = (NodeGrid*)pNode; 02390 02391 if (pGrid->IsGridSelected()) 02392 { 02393 GridRect = pGrid->GetBoundingRect(); 02394 GridRect.Translate(dx,dy); 02395 pRegion->DrawDragRect(&GridRect); 02396 } 02397 } 02398 pNode = pNode->FindPrevious(); 02399 } 02400 02401 // Get the Next render region 02402 pRegion = DocView::GetNextOnTop( &Rect ); 02403 } 02404 }
|
|
Draws an EORed rectangle for all selected grids in SpreadClicked.
Definition at line 2343 of file gridtool.cpp. 02344 { 02345 /* 02346 DocRect SpreadRect = SpreadClicked->GetPasteboardRect(); 02347 SpreadClicked->DocCoordToSpreadCoord(&SpreadRect); 02348 02349 RenderDragBlobs(SpreadRect,SpreadClicked); 02350 */ 02351 DocRect SpreadRect = SpreadDrag->GetPasteboardRect(); 02352 SpreadDrag->DocCoordToSpreadCoord(&SpreadRect); 02353 02354 RenderDragBlobs(SpreadRect,SpreadDrag, FALSE); 02355 }
|
|
Definition at line 355 of file gridtool.h. |
|
Definition at line 358 of file gridtool.h. |
|
Definition at line 360 of file gridtool.h. |
|
Definition at line 353 of file gridtool.h. |
|
Definition at line 356 of file gridtool.h. |
|
Definition at line 354 of file gridtool.h. |
|
Definition at line 357 of file gridtool.h. |