OpDetachMould Class Reference

An operation to attach and detach a mould manifold from its object This allows the manifold to be edited on its own without the moulded objects following. Handy for quick edits. More...

#include <moldtool.h>

Inheritance diagram for OpDetachMould:

UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpDetachMould ()
 Constructor for Detach mould 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.
void Do (OpDescriptor *)

Static Public Member Functions

static BOOL Init ()
 Initialise the detach mould operation so that it can be accessed from the interface.
static OpState GetState (String_256 *, OpDescriptor *)
 For finding the OpDetachMould state.

Detailed Description

An operation to attach and detach a mould manifold from its object This allows the manifold to be edited on its own without the moulded objects following. Handy for quick edits.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/01/95
See also:
-

Definition at line 495 of file moldtool.h.


Constructor & Destructor Documentation

OpDetachMould::OpDetachMould  ) 
 

Constructor for Detach mould operation.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/03/95
See also:
-

Definition at line 2724 of file moldtool.cpp.

02725 {
02726     // Dummy constructor
02727 }


Member Function Documentation

void OpDetachMould::Do OpDescriptor  )  [virtual]
 

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/03/95
Parameters:
pointer to an OpDescriptor (unused) [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: failandexecute will be called if the operation fails in some way, most likely when no memory is available.

Reimplemented from Operation.

Definition at line 2828 of file moldtool.cpp.

02829 {
02830     BeginSlowJob();
02831 
02832     // Note, I only spent the whole afternoon trying to work out why DoStartSelOp(XX,YY)
02833     // Was completely screwing up the selection here. Anyway, the solution was to
02834     // derive this op from UndoableOperation, not SelOperation which solved the problem
02835     // immediately. The morel is, if the selection is not changing, dont use SelOperation!
02836     // + It stops lots of flashing of blobs too.
02837 
02838     // Scan the selection
02839     SelRange* Selected = GetApplication()->FindSelection();
02840     Node* pNode = Selected->FindFirst();
02841     while (pNode)
02842     {
02843         if (pNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeMould))
02844         {
02845             NodeMould* pMould = (NodeMould*)pNode;
02846 
02847             SaveDetachAction* pSaveDetAct;
02848             ALLOC_WITH_FAIL(pSaveDetAct, (new SaveDetachAction), this);
02849             if (pSaveDetAct==NULL)
02850             {
02851                 FailAndExecute(); End(); return;
02852             }
02853             
02854             if ((pSaveDetAct->Save(this, pMould))==AC_FAIL)
02855             {
02856                 FailAndExecute(); End(); return;
02857             }
02858 
02859             // toggle the detach type
02860             pMould->ToggleDetachFlag();
02861 
02862             if (!pMould->IsDetached())
02863             {
02864                 if (!DoInvalidateNodeRegion(pMould,TRUE))
02865                 {
02866                     FailAndExecute(); End(); return;
02867                 }
02868 
02869                 if (pMould->StartSaveContext(this,REC_REBUILD)!=CC_OK)
02870                 {
02871                     FailAndExecute(); End(); return;
02872                 }
02873 
02874                 if (pMould->RemouldAll(this)!=CC_OK)
02875                 {
02876                     FailAndExecute(); End(); return;
02877                 }
02878 
02879                 if (pMould->EndSaveContext(this,REC_REBUILD)!=CC_OK)
02880                 {
02881                     FailAndExecute(); End(); return;
02882                 }
02883             }
02884         }
02885         pNode = Selected->FindNext(pNode);
02886     }
02887 
02888     End();
02889 }

void OpDetachMould::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:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/01/95
Parameters:
- [INPUTS]
The undo string for the operation [OUTPUTS]
Returns:

Reimplemented from Operation.

Definition at line 2806 of file moldtool.cpp.

02807 {
02808     *OpName = String_256(_R(IDS_UNDO_DETACHMOULD));
02809 }

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

For finding the OpDetachMould state.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/03/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The state of the OpDetachMould

Definition at line 2777 of file moldtool.cpp.

02778 {
02779     OpState OpSt;
02780     String_256 DisableReason; 
02781 
02782     NodeMould* pLastMould;
02783     INT32 nmoulds = MouldInfoBarOp::SelInfo(&pLastMould);
02784 
02785     // Set the detach operation tick and grey fields correctly
02786     OpSt.Greyed = (nmoulds==0);
02787     OpSt.Ticked = ((nmoulds==1) && pLastMould->IsDetached());
02788 
02789     return (OpSt);   
02790 }

BOOL OpDetachMould::Init void   )  [static]
 

Initialise the detach mould operation so that it can be accessed from the interface.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/03/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the operation could be successfully initialised FALSE if no more memory could be allocated

Errors: ERROR will be called if there was insufficient memory to allocate the operation.

See also:
-

Reimplemented from SimpleCCObject.

Definition at line 2750 of file moldtool.cpp.

02751 {
02752     return (RegisterOpDescriptor(0,                                 // tool ID
02753                                 _R(IDS_DETACHMOULD),                    // string resource ID
02754                                 CC_RUNTIME_CLASS(OpDetachMould),    // runtime class for Op
02755                                 OPTOKEN_DETACHMOULD,                // Ptr to token string
02756                                 OpDetachMould::GetState,            // GetState function
02757                                 0,                                  // help ID
02758                                 _R(IDBBL_DETACHMOULD),                  // bubble help ID
02759                                 0
02760                                 ));
02761 }               


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