OpGridChange Class Reference

#include <gridtool.h>

Inheritance diagram for OpGridChange:

OpGrid UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpGridChange ()
 Constructor.
 ~OpGridChange ()
 Destructor.
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.
void DoChangeSelectedGrids (ChangeGrid *pChangeGrid)
 Changes all the selected grids using the given ChangeGrid object.
BOOL DoChangeGrid (NodeGrid *pOldGrid, ChangeGrid *pChangeGrid)
 Changes the given grid to reflect the default grid values of the grid tool.

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 (OpGridChange)

Private Attributes

UINT32 ChangeGridUndoIDS

Detailed Description

Definition at line 375 of file gridtool.h.


Constructor & Destructor Documentation

OpGridChange::OpGridChange  ) 
 

Constructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/94

Definition at line 2493 of file gridtool.cpp.

02494 {
02495 }

OpGridChange::~OpGridChange  ) 
 

Destructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/94

Definition at line 2507 of file gridtool.cpp.

02508 {
02509 }


Member Function Documentation

OpGridChange::CC_DECLARE_DYNCREATE OpGridChange   )  [private]
 

BOOL OpGridChange::Declare  )  [static]
 

Adds the operation to the list of all known operations.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/94
Returns:
TRUE if all went OK, False otherwise

Definition at line 2523 of file gridtool.cpp.

02524 {
02525     return (RegisterOpDescriptor(
02526                                 0, 
02527                                 _R(IDS_GRID_TOOL),
02528                                 CC_RUNTIME_CLASS(OpGridChange), 
02529                                 OPTOKEN_GRIDCHANGE,
02530                                 OpGridChange::GetState,
02531                                 0,          /* help ID */
02532                                 _R(IDBBL_NOOP), /* bubble ID */
02533                                 0           /* bitmap ID */
02534                                 ));
02535 }

BOOL OpGridChange::DoChangeGrid NodeGrid pOldGrid,
ChangeGrid pChangeGrid
 

Changes the given grid to reflect the default grid values of the grid tool.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/94
Parameters:
pOldGrid = ptr to a grid in the tree to change [INPUTS] pChangeGrid = ptr to a grid changing object
Returns:
-
See also:

Definition at line 2661 of file gridtool.cpp.

02662 {
02663     DocRect DummyRect;
02664     NodeGrid* pNewGrid;
02665     BOOL ok = TRUE;
02666     
02667     switch (pChangeGrid->GetGridType(pOldGrid))
02668     {
02669         case RECTANGULAR    : ALLOC_WITH_FAIL(pNewGrid,(new NodeGridRect()),this); break;
02670         case ISOMETRIC      : ALLOC_WITH_FAIL(pNewGrid,(new NodeGridIso()), this); break;
02671     }
02672 
02673     ok = (pNewGrid != NULL);
02674     if (ok) ok = DoInsertNewNode(pNewGrid,pOldGrid,NEXT,TRUE);
02675     if (ok) ok = DoInvalidateNodeRegion(pOldGrid, TRUE);
02676     if (ok) ok = DoHideNode(pOldGrid,TRUE);
02677 
02678     if (ok)
02679     {
02680         pNewGrid->SetGridParams(pOldGrid->GetDivisions(),
02681                                 pOldGrid->GetSubdivisions(),
02682                                 pOldGrid->GetUnits());
02683 
02684         pChangeGrid->Change(pNewGrid);
02685         PostOpDisplayedGrid = pNewGrid;
02686 
02687         pNewGrid->SetBoundingRect(pOldGrid->GetBoundingRect());
02688         pNewGrid->SetGridSelected(pOldGrid->IsGridSelected());
02689         pNewGrid->SetDefault(pOldGrid->IsDefault());
02690     }
02691 
02692     return (ok);
02693 }

void OpGridChange::DoChangeSelectedGrids ChangeGrid pChangeGrid  ) 
 

Changes all the selected grids using the given ChangeGrid object.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/94
Parameters:
pChGrid = ptr to a ChangeGrid class for changing the selected grids in some way [INPUTS]
Returns:
-
See also:

Definition at line 2595 of file gridtool.cpp.

02596 {
02597     // We haven't shown a grid in the infobar yet, so set these to NULL
02598     PreOpDisplayedGrid  = NULL;
02599     PostOpDisplayedGrid = NULL;
02600 
02601     Spread* SpreadClicked = GridTool::GetSpreadClicked();
02602 
02603     GridInfoBarOp* pGridInfoBarOp = GridTool::GetGridInfoBarOp();
02604     if (pGridInfoBarOp != NULL)
02605         PreOpDisplayedGrid = pGridInfoBarOp->GetLastGridDisplayed();
02606 
02607     BOOL    ok = (SpreadClicked != NULL);
02608     if (ok) ok = (pChangeGrid   != NULL);
02609 
02610     if (ok)
02611     {
02612         // scan the children of the spread for grids
02613         Node* pNode = SpreadClicked->FindFirstChild();
02614         while (pNode != NULL && ok)
02615         {
02616             Node* pNodeCurrent = pNode;
02617             pNode = pNode->FindNext();
02618 
02619             if (pNodeCurrent->IsKindOf(CC_RUNTIME_CLASS(NodeGrid)))
02620             {
02621                 // we now have a ptr to a grid, so render those blobs
02622                 NodeGrid* pGrid = (NodeGrid*)pNodeCurrent;
02623 
02624                 if (pGrid->IsGridSelected())
02625                 {
02626                     GridTool::ForceRedraw(pGrid);
02627                     ok = DoChangeGrid(pGrid,pChangeGrid);
02628                 }
02629             }
02630         }
02631     }
02632 
02633     if (!ok)
02634         FailAndExecute();
02635     else
02636     {
02637         ChangeGridUndoIDS = pChangeGrid->GetUndoIDS();
02638         if (PostOpDisplayedGrid != NULL)
02639             GridTool::DisplayGridInfo(PostOpDisplayedGrid);
02640     }
02641 
02642     delete pChangeGrid;
02643 
02644     End();
02645 }

void OpGridChange::GetOpName String_256 OpName  )  [virtual]
 

The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/94
Parameters:
- [INPUTS]
The undo string for the operation [OUTPUTS]
Returns:

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 2576 of file gridtool.cpp.

02577 { 
02578     *OpName = String_256(ChangeGridUndoIDS);
02579 }  

OpState OpGridChange::GetState String_256 Description,
OpDescriptor
[static]
 

Find out the state of the operation at the specific time.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/94
Parameters:
Description - GetState fills this string with an approriate description [OUTPUTS] of the current state of the push tool
Returns:
The state of the operation, so that menu items (ticks and greying can be done properly

Definition at line 2552 of file gridtool.cpp.

02553 {
02554     OpState Grid;
02555     
02556     return Grid;
02557 }


Member Data Documentation

UINT32 OpGridChange::ChangeGridUndoIDS [private]
 

Definition at line 394 of file gridtool.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:58:16 2007 for Camelot by  doxygen 1.4.4