OpConvertToBitmap Class Reference

Converts objects into a bitmap. More...

#include <makebmp.h>

Inheritance diagram for OpConvertToBitmap:

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

Public Member Functions

 OpConvertToBitmap ()
 OpConvertToBitmap constructor.
void Do (OpDescriptor *)
 Convert the selection into a bitmap.
virtual BOOL MayChangeNodeBounds () const

Static Public Member Functions

static BOOL Init ()
 OpConvertToBitmap initialiser method.
static OpState GetState (String_256 *, OpDescriptor *)
 For finding the OpConvertToBitmap's state.

Private Member Functions

 CC_DECLARE_DYNCREATE (OpConvertToBitmap)

Detailed Description

Converts objects into a bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/2/95
See also:
-

Definition at line 120 of file makebmp.h.


Constructor & Destructor Documentation

OpConvertToBitmap::OpConvertToBitmap  ) 
 

OpConvertToBitmap constructor.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/6/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 162 of file makebmp.cpp.

00162                                     : SelOperation()                                
00163 {                              
00164 }


Member Function Documentation

OpConvertToBitmap::CC_DECLARE_DYNCREATE OpConvertToBitmap   )  [private]
 

void OpConvertToBitmap::Do OpDescriptor  )  [virtual]
 

Convert the selection into a bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/6/96
Parameters:
- [INPUTS]
Returns:
Errors: -
See also:
-

Reimplemented from Operation.

Definition at line 256 of file makebmp.cpp.

00257 {   
00258     // We want to include bevel/contour/shadow controller nodes in our bitmap-copy
00259     // deliberations, so set PromoteToParent on a copy of the app's SelRange.
00260     SelRange Sel(*(GetApplication()->FindSelection()));
00261     RangeControl rg = Sel.GetRangeControlFlags();
00262     rg.PromoteToParent = TRUE;
00263     Sel.Range::SetRangeControl(rg);
00264 
00265     // Find the first node which is selected 
00266     Node* CurrentNode = Sel.FindFirst(); 
00267     
00268     ERROR3IF(CurrentNode == NULL, "Called ConvertToBitmap with no nodes selected"); 
00269     
00270     // In the retail build it is best to do nothing if we find there are no selected nodes 
00271     if (CurrentNode != NULL) // No nodes selected so End
00272     {   
00273         // We need to invalidate the region
00274         if (!DoInvalidateNodesRegions(Sel, TRUE))
00275             goto EndOperation; 
00276 
00277         if (!DoStartSelOp(FALSE,FALSE))  // Try to record the selection state , don't
00278             goto EndOperation;           // render the blobs though 
00279              
00280         // Create a special Bitmap filter, that creates a bitmap
00281         // and puts it in the tree   
00282         MakeBitmapFilter* pBitmapFilter = new MakeBitmapFilter();
00283         if (pBitmapFilter == NULL)
00284         {
00285             FailAndExecute();
00286             goto EndOperation;  
00287         }
00288 
00289         KernelBitmap* pBitmapToCreate = NULL;
00290 
00291         if (!pBitmapFilter->DoCreateBitmap(this, Document::GetSelected(), &pBitmapToCreate))
00292         {
00293             delete pBitmapFilter;
00294             FailAndExecute();
00295             goto EndOperation;  
00296         }
00297 
00298         if (!pBitmapFilter->InsertBitmapIntoDocument(this, pBitmapToCreate, Document::GetSelected()))
00299         {
00300             delete pBitmapToCreate;
00301             delete pBitmapFilter;
00302             FailAndExecute();
00303             goto EndOperation;  
00304         }
00305 
00306         delete pBitmapFilter;
00307 
00308         if (!DoInvalidateNodesRegions(*(GetApplication()->FindSelection()), TRUE))
00309         {
00310             // We need to invalidate the region
00311             FailAndExecute();
00312             goto EndOperation; 
00313         } 
00314     }                   
00315 
00316     EndOperation:
00317 
00318     SelRange* pRng = GetApplication()->FindSelection();
00319 
00320     End();
00321 }           

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

For finding the OpConvertToBitmap's state.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/6/96
Returns:
The state of the OpConvertToBitmap operation

Errors: -

See also:
-

Definition at line 207 of file makebmp.cpp.

00208 {
00209     OpState OpSt;
00210     String_256 DisableReason;
00211 
00212     // Ensure that a document exists
00213     if (Document::GetSelected() == NULL)
00214     {
00215         // There is no selected document
00216         OpSt.Greyed = TRUE;
00217 
00218         // Load reason why operation is disabled
00219         DisableReason = String_256(_R(IDS_NO_DOC));
00220         *UIDescription = DisableReason;      
00221         return OpSt;                                 
00222     }
00223 
00224     // Obtain the current selections 
00225     Range Sel(*(GetApplication()->FindSelection()));
00226       
00227     // This operation is disabled if there are no nodes selected, or if none of the selected 
00228     // objects can become a NodePath. 
00229 
00230     Node* FirstSelected = Sel.FindFirst();  
00231     
00232     OpSt.Greyed = FALSE; 
00233     if (FirstSelected == NULL) 
00234     {
00235         OpSt.Greyed = TRUE; 
00236         // Load reason why operation is disabled
00237         DisableReason = String_256(_R(IDS_NO_OBJECTS_SELECTED));
00238         *UIDescription = DisableReason;         
00239     }
00240     
00241     return(OpSt);   
00242 }

BOOL OpConvertToBitmap::Init void   )  [static]
 

OpConvertToBitmap initialiser method.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/6/96
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 180 of file makebmp.cpp.

00181 {
00182     MakeBitmapFilter::Initialise();
00183 
00184     return (RegisterOpDescriptor(
00185                                 0,
00186                                 _R(IDS_CONVERTTOBITMAPOP),
00187                                 CC_RUNTIME_CLASS(OpConvertToBitmap),
00188                                 OPTOKEN_CONVERTTOBITMAP,
00189                                 OpConvertToBitmap::GetState,
00190                                 0,  /* help ID */
00191                                 0,
00192                                 0   /* bitmap ID */));
00193 }               

virtual BOOL OpConvertToBitmap::MayChangeNodeBounds  )  const [inline, virtual]
 

Reimplemented from SelOperation.

Definition at line 131 of file makebmp.h.

00131 { return FALSE; }


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