#include <plugopun.h>
Inheritance diagram for ActionApplyPlugInToBitmap:
Public Member Functions | |
ActionApplyPlugInToBitmap () | |
Find out if there is a valid bitmap in the selection and return useful information to the caller. ActionApplyPlugInToBitmap constructor. | |
~ActionApplyPlugInToBitmap () | |
ActionApplyPlugInToBitmap destructor. | |
virtual ActionCode | Execute () |
Executes the ActionApplyPlugInToBitmap to go and apply a new bitmap to the currently selected fill or node bitmap and generate another ActionApplyPlugInToBitmap to undo this change. Forces a redraw of the fill or node. | |
Static Public Member Functions | |
static ActionCode | Init (Operation *const pOp, ActionList *pActionList, UINT32 ActionSize, Document *pDocument, KernelBitmap *pBitmap, KernelBitmapRef *pBitmapRef, NodeBitmap *pFoundNode, AttrFillGeometry *pFoundFillAttribute, Action **NewAction, BOOL bUpdateAspect=FALSE) |
To check that there is sufficient room for the action in the operation history, and if there is, then to add the action to the operations action list. | |
Private Attributes | |
Document * | m_pDocument |
KernelBitmap * | m_pBitmap |
KernelBitmapRef * | m_pBitmapRef |
NodeBitmap * | m_pFoundNode |
AttrFillGeometry * | m_pFoundFillAttribute |
BOOL | m_bUpdateAspect |
Definition at line 167 of file plugopun.h.
|
Find out if there is a valid bitmap in the selection and return useful information to the caller. ActionApplyPlugInToBitmap constructor.
Definition at line 469 of file plugopun.cpp. 00470 { 00471 m_pDocument = NULL; 00472 m_pBitmap = NULL; 00473 m_pBitmapRef = NULL; 00474 m_pFoundNode = NULL; 00475 m_pFoundFillAttribute = NULL; 00476 }
|
|
ActionApplyPlugInToBitmap destructor.
Definition at line 488 of file plugopun.cpp.
|
|
Executes the ActionApplyPlugInToBitmap to go and apply a new bitmap to the currently selected fill or node bitmap and generate another ActionApplyPlugInToBitmap to undo this change. Forces a redraw of the fill or node.
Reimplemented from Action. Definition at line 508 of file plugopun.cpp. 00509 { 00510 ActionApplyPlugInToBitmap ApplyPlugInAct; 00511 ActionCode ActCode = AC_FAIL; 00512 00513 // Get the details on the stored bitmap node or fill so that we can use this to undo what we 00514 // are about to try and do 00515 KernelBitmap * pBitmap = NULL; 00516 KernelBitmapRef * pBitmapRef = NULL; 00517 if (m_pDocument != NULL && m_pBitmap != NULL && m_pBitmapRef != NULL) 00518 { 00519 // Note the bitmap currently in use on that fill or node 00520 if (m_pFoundNode != NULL) 00521 { 00522 pBitmap = m_pFoundNode->GetBitmap(); 00523 pBitmapRef = m_pFoundNode->GetBitmapRef(); 00524 } 00525 else if (m_pFoundFillAttribute != NULL) 00526 { 00527 pBitmap = m_pFoundFillAttribute->GetBitmap(); 00528 pBitmapRef = m_pFoundFillAttribute->GetBitmapRef(); 00529 } 00530 else 00531 { 00532 ERROR3("Called ActionApplyPlugInToBitmap::Execute with no node or fill selected!"); 00533 return AC_FAIL; 00534 } 00535 } 00536 else 00537 { 00538 ERROR3("Called ActionApplyPlugInToBitmap::Execute with no selected bitmap in the range!"); 00539 return AC_FAIL; 00540 } 00541 00542 if (pBitmap == NULL || pBitmapRef == NULL) 00543 { 00544 ERROR3("Called ActionApplyPlugInToBitmap::Execute with no selected bitmap in the range!"); 00545 return AC_FAIL; 00546 } 00547 00548 // Create an action to restore the changes we are about to make 00549 ActCode = ActionApplyPlugInToBitmap::Init( pOperation, 00550 pOppositeActLst, 00551 sizeof(ActionApplyPlugInToBitmap), 00552 m_pDocument, 00553 pBitmap, 00554 pBitmapRef, 00555 m_pFoundNode, 00556 m_pFoundFillAttribute, 00557 ( Action**)(&ApplyPlugInAct), 00558 m_bUpdateAspect 00559 ); 00560 if (ActCode != AC_FAIL) 00561 { 00562 // Make sure we have quite a few valid items before even attempting to continue 00563 if (m_pDocument != NULL && m_pBitmap != NULL && m_pBitmapRef != NULL) 00564 { 00565 // Change that bitmap 00566 if (m_pFoundNode != NULL) 00567 { 00568 if (m_bUpdateAspect) 00569 { 00570 // Ensure that the aspect ratio of the new bitmap is retained 00571 // (Must be done before the new bitmap is attached) 00572 m_pFoundNode->SetAspectRatio(m_pBitmap->GetWidth(), m_pBitmap->GetHeight(), TRUE); 00573 } 00574 00575 // Its a node bitmap so change its bitmap reference to be the new one 00576 m_pBitmapRef->Attach(m_pBitmap, m_pDocument); 00577 00578 BROADCAST_TO_ALL(BitmapListChangedMsg(m_pBitmap->GetParentBitmapList(), m_pBitmap)); 00579 00580 // Say that the bitmap has changed 00581 ((UndoableOperation*)pOperation)->DoInvalidateNodeRegion((NodeRenderableInk*)m_pFoundNode, TRUE); 00582 } 00583 else if (m_pFoundFillAttribute != NULL) 00584 { 00585 // Its a bitmap fill so change its bitmap reference to be the new one 00586 m_pBitmapRef->Attach(m_pBitmap, m_pDocument); 00587 00588 BROADCAST_TO_ALL(BitmapListChangedMsg(m_pBitmap->GetParentBitmapList(), m_pBitmap)); 00589 } 00590 else 00591 { 00592 ERROR3("Called ActionApplyPlugInToBitmap::Execute with no node or fill selected!"); 00593 return AC_FAIL; 00594 } 00595 } 00596 } 00597 00598 return (ActCode); 00599 }
|
|
To check that there is sufficient room for the action in the operation history, and if there is, then to add the action to the operations action list.
AC_OK : The action was successfully initialised and added to the operation. The function calls the Action::Init function passing the runtime class of an ActionApplyPlugInToBitmap.
Definition at line 653 of file plugopun.cpp. 00663 { 00664 ActionCode Ac = (Action::Init(pOp, 00665 pActionList, 00666 ActionSize, 00667 CC_RUNTIME_CLASS(ActionApplyPlugInToBitmap), 00668 NewAction)); 00669 if (*NewAction != NULL) 00670 { 00671 ActionApplyPlugInToBitmap *ACC = (ActionApplyPlugInToBitmap*) (*NewAction); 00672 ACC->m_pDocument = pDocument; 00673 ACC->m_pBitmap = pBitmap; 00674 ACC->m_pBitmapRef = pBitmapRef; 00675 ACC->m_pFoundNode = pFoundNode; 00676 ACC->m_pFoundFillAttribute = pFoundFillAttribute; 00677 ACC->m_bUpdateAspect = bUpdateAspect; 00678 } 00679 00680 return (Ac); 00681 }
|
|
Definition at line 194 of file plugopun.h. |
|
Definition at line 190 of file plugopun.h. |
|
Definition at line 191 of file plugopun.h. |
|
Definition at line 189 of file plugopun.h. |
|
Definition at line 193 of file plugopun.h. |
|
Definition at line 192 of file plugopun.h. |