OpGridDelete Class Reference

This class represents the grid Delete operation. More...

#include <gridtool.h>

Inheritance diagram for OpGridDelete:

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

Public Member Functions

void Do (OpDescriptor *)
 Performs the Delete operation.
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 OpState GetState (String_256 *, OpDescriptor *)
 For finding OpGridDelete's state.

Private Attributes

BOOL Plural

Detailed Description

This class represents the grid Delete operation.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/7/93

Definition at line 407 of file gridtool.h.


Member Function Documentation

void OpGridDelete::Do OpDescriptor  )  [virtual]
 

Performs the Delete operation.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/7/94
Parameters:
OpDescriptor (unused) [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 3348 of file gridtool.cpp.

03349 {   
03350     // We haven't shown a grid in the infobar yet, so set these to NULL
03351     PreOpDisplayedGrid  = NULL;
03352     PostOpDisplayedGrid = NULL;
03353 
03354     Spread* SpreadClicked = GridTool::GetSpreadClicked();
03355 
03356     GridInfoBarOp* pGridInfoBarOp = GridTool::GetGridInfoBarOp();
03357     if (pGridInfoBarOp != NULL)
03358         PreOpDisplayedGrid = pGridInfoBarOp->GetLastGridDisplayed();
03359 
03360     BOOL ok = (SpreadClicked != NULL);
03361     UINT32 SelCount=0;
03362 
03363     if (ok)
03364     {
03365         // scan the children of the spread for grids
03366         Node* pNode = SpreadClicked->FindFirstChild();
03367         while (pNode != NULL && ok)
03368         {
03369             Node* pNodeCurrent = pNode;
03370             pNode = pNode->FindNext();
03371 
03372             if (pNodeCurrent->IsKindOf(CC_RUNTIME_CLASS(NodeGrid)))
03373             {
03374                 // we now have a ptr to a grid, so render those blobs
03375                 NodeGrid* pGrid = (NodeGrid*)pNodeCurrent;
03376 
03377                 if (pGrid->IsGridSelected() && !pGrid->IsDefault())
03378                 {
03379                     SelCount++;
03380                     GridTool::ForceRedraw(pGrid);
03381                             ok = DoInvalidateNodeRegion(pGrid, TRUE);
03382                     if (ok) ok = DoHideNode(pGrid,TRUE);
03383                 }
03384             }
03385         }
03386     }
03387 
03388     if (!ok)
03389         FailAndExecute();
03390     else
03391     {
03392         NodeGrid::RecalcNumSelectedGrids(SpreadClicked);
03393         pGridInfoBarOp->EnableControls();
03394     }
03395 
03396     Plural = (SelCount > 1);
03397 
03398     End();
03399 }           

void OpGridDelete::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:
19/7/94
Parameters:
- [INPUTS]
The undo string for the operation [OUTPUTS]
Returns:

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 3418 of file gridtool.cpp.

03419 { 
03420     if (Plural)
03421         *OpName = String_256(_R(IDS_GRID_UNDO_DELETES));
03422     else
03423         *OpName = String_256(_R(IDS_GRID_UNDO_DELETE));
03424 }  

OpState OpGridDelete::GetState String_256 UIDescription,
OpDescriptor
[static]
 

For finding OpGridDelete's state.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/7/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The state of the OpGridDelete

Errors: -

See also:
-

Definition at line 3301 of file gridtool.cpp.

03302 {
03303     OpState OpSt;
03304     String_256 DisableReason; 
03305 
03306     // Ensure that a document exists
03307     if (GridTool::GetDoc() == NULL)
03308     {
03309         // There is no current document
03310         OpSt.Greyed = TRUE;
03311         // Load reason why operation is disabled
03312         DisableReason = String_256(_R(IDS_NO_DOC));
03313         *UIDescription = DisableReason;      
03314     }
03315     else
03316     {
03317         Spread* pSpread = GridTool::GetSpreadClicked();
03318         BOOL    enable  = ((NodeGrid::GetNumNonDefaultSelectedGrids() > 0) && (pSpread != NULL));
03319 
03320         if (!enable)
03321         {
03322             OpSt.Greyed = TRUE; 
03323             // Load reason why operation is disabled
03324             DisableReason = String_256(_R(IDS_NO_OBJECTS_SELECTED));
03325             *UIDescription = DisableReason;                                       
03326         }
03327     }
03328 
03329     return (OpSt);
03330 }


Member Data Documentation

BOOL OpGridDelete::Plural [private]
 

Definition at line 417 of file gridtool.h.


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