00001 // $Id: plugopun.cpp 1282 2006-06-09 09:46:49Z alex $ 00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE 00003 ================================XARAHEADERSTART=========================== 00004 00005 Xara LX, a vector drawing and manipulation program. 00006 Copyright (C) 1993-2006 Xara Group Ltd. 00007 Copyright on certain contributions may be held in joint with their 00008 respective authors. See AUTHORS file for details. 00009 00010 LICENSE TO USE AND MODIFY SOFTWARE 00011 ---------------------------------- 00012 00013 This file is part of Xara LX. 00014 00015 Xara LX is free software; you can redistribute it and/or modify it 00016 under the terms of the GNU General Public License version 2 as published 00017 by the Free Software Foundation. 00018 00019 Xara LX and its component source files are distributed in the hope 00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the 00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00022 See the GNU General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with Xara LX (see the file GPL in the root directory of the 00026 distribution); if not, write to the Free Software Foundation, Inc., 51 00027 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00028 00029 00030 ADDITIONAL RIGHTS 00031 ----------------- 00032 00033 Conditional upon your continuing compliance with the GNU General Public 00034 License described above, Xara Group Ltd grants to you certain additional 00035 rights. 00036 00037 The additional rights are to use, modify, and distribute the software 00038 together with the wxWidgets library, the wxXtra library, and the "CDraw" 00039 library and any other such library that any version of Xara LX relased 00040 by Xara Group Ltd requires in order to compile and execute, including 00041 the static linking of that library to XaraLX. In the case of the 00042 "CDraw" library, you may satisfy obligation under the GNU General Public 00043 License to provide source code by providing a binary copy of the library 00044 concerned and a copy of the license accompanying it. 00045 00046 Nothing in this section restricts any of the rights you have under 00047 the GNU General Public License. 00048 00049 00050 SCOPE OF LICENSE 00051 ---------------- 00052 00053 This license applies to this program (XaraLX) and its constituent source 00054 files only, and does not necessarily apply to other Xara products which may 00055 in part share the same code base, and are subject to their own licensing 00056 terms. 00057 00058 This license does not apply to files in the wxXtra directory, which 00059 are built into a separate library, and are subject to the wxWindows 00060 license contained within that directory in the file "WXXTRA-LICENSE". 00061 00062 This license does not apply to the binary libraries (if any) within 00063 the "libs" directory, which are subject to a separate license contained 00064 within that directory in the file "LIBS-LICENSE". 00065 00066 00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS 00068 ---------------------------------------------- 00069 00070 Subject to the terms of the GNU Public License (see above), you are 00071 free to do whatever you like with your modifications. However, you may 00072 (at your option) wish contribute them to Xara's source tree. You can 00073 find details of how to do this at: 00074 http://www.xaraxtreme.org/developers/ 00075 00076 Prior to contributing your modifications, you will need to complete our 00077 contributor agreement. This can be found at: 00078 http://www.xaraxtreme.org/developers/contribute/ 00079 00080 Please note that Xara will not accept modifications which modify any of 00081 the text between the start and end of this header (marked 00082 XARAHEADERSTART and XARAHEADEREND). 00083 00084 00085 MARKS 00086 ----- 00087 00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara 00089 designs are registered or unregistered trademarks, design-marks, and/or 00090 service marks of Xara Group Ltd. All rights in these marks are reserved. 00091 00092 00093 Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK. 00094 http://www.xara.com/ 00095 00096 =================================XARAHEADEREND============================ 00097 */ 00098 // 00099 00100 00101 #include "camtypes.h" 00102 00103 #include "plugopun.h" // useful plug-in related items 00104 #include "plugop.h" // useful plug-in related items 00105 //#include "plugres.h" // _R(IDS_PLUGIN_FAMILY) 00106 00107 #include "plugmngr.h" // main plug-in manager 00108 //#include "app.h" // GetApplication() - in camtypes.h [AUTOMATICALLY REMOVED] 00109 00110 //#include "simon.h" // _R(IDS_NO_DOC) _R(IDS_NO_OBJECTS_SELECTED) 00111 #include "nodebmp.h" // NodeBitmap 00112 //#include "fillattr.h" // AttrFillGeometry - in camtypes.h [AUTOMATICALLY REMOVED] 00113 00114 // Place any IMPLEMENT type statements here 00115 CC_IMPLEMENT_DYNCREATE(PlugInUndoOp, SelOperation); 00116 CC_IMPLEMENT_DYNCREATE(ActionApplyPlugInToBitmap, Action) 00117 00118 // We want better memory tracking 00119 #define new CAM_DEBUG_NEW 00120 00121 /******************************************************************* 00122 00123 > PlugInUndoOp::PlugInUndoOp() : SelOperation() 00124 00125 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00126 Created: 21/1/97 00127 Inputs: 00128 Outputs: 00129 Returns: 00130 Purpose: Constructor for PlugInUndoOp operation. It is undoable. 00131 Errors: None 00132 00133 *******************************************************************/ 00134 00135 PlugInUndoOp::PlugInUndoOp() : SelOperation() 00136 { 00137 m_pOpDesc = NULL; 00138 } 00139 00140 /******************************************************************************************** 00141 00142 > static BOOL PlugInUndoOp::Init() 00143 00144 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00145 Created: 21/1/97 00146 Returns: TRUE if the Op was started ok 00147 Purpose: Creates all the opDescriptors that call this operation. 00148 00149 ********************************************************************************************/ 00150 00151 BOOL PlugInUndoOp::Init() 00152 { 00153 BOOL ok = TRUE; 00154 // Set up some standard operations 00155 // ok = ok && RegisterOpToken(OPTOKEN_PLUGINS, _R(IDS_PLUGINS)); 00156 00157 // ok = ok && RegisterOpToken(OPTOKEN_PHOTOSHOP_PLUGINS, _R(IDS_PHOTOSHOP_PLUGINS)); 00158 // ok = ok && RegisterOpToken(OPTOKEN_PHOTOSHOP_APPLYLAST, _R(IDS_PHOTOSHOP_APPLYLAST)); 00159 00160 // ok = ok && RegisterOpToken(OPTOKEN_PLUGINONE, _R(IDS_PLUGIN_ONE)); 00161 // ok = ok && RegisterOpToken(OPTOKEN_PLUGINTWO, _R(IDS_PLUGIN_TWO)); 00162 // ok = ok && RegisterOpToken(OPTOKEN_PLUGINTHREE, _R(IDS_PLUGIN_THREE)); 00163 return ok; 00164 } 00165 00166 /******************************************************************************************** 00167 00168 > static BOOL PlugInUndoOp::RegisterOpToken(TCHAR *OpToken, const String_64& NewMenuText, 00169 CCRuntimeClass* pClass = CC_RUNTIME_CLASS(PlugInUndoOp)) 00170 00171 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00172 Created: 21/1/97 00173 Inputs: OpToken the OpToken for the operation 00174 NewMenuText the text for the menu item for this operation 00175 pClass the runtime class to use, defaults to PlugInUndoOp. 00176 gs the GetState function to use 00177 Returns: TRUE if the Op was registered ok 00178 Purpose: Allows OpDescriptors to be defined to the operation system. 00179 00180 ********************************************************************************************/ 00181 00182 BOOL PlugInUndoOp::RegisterOpToken(TCHAR *OpToken, const String_64& NewMenuText, 00183 CCRuntimeClass* pClass, pfnGetState gs) 00184 { 00185 // Try to create the OpDescriptor 00186 PlugInOpDescriptor* pOpDesc = new PlugInOpDescriptor(OpToken, NewMenuText, pClass, gs); 00187 if (pOpDesc == NULL) 00188 return FALSE; 00189 00190 return TRUE; 00191 } 00192 00193 /******************************************************************************************** 00194 00195 > static BOOL PlugInUndoOp::RegisterOpToken(TCHAR *OpToken, UINT32 MenuTextID, 00196 CCRuntimeClass* pClass = CC_RUNTIME_CLASS(PlugInUndoOp), 00197 pfnGetState gs = PlugInUndoOp::GetState) 00198 00199 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00200 Created: 21/1/97 00201 Inputs: OpToken the OpToken for the operation 00202 MenuTextId the text for the menu item for this operation 00203 pClass the runtime class to use, defaults to PlugInUndoOp. 00204 gs the GetState function to use 00205 Returns: TRUE if the Op was registered ok 00206 Purpose: Allows OpDescriptors to be defined to the operation system. 00207 00208 ********************************************************************************************/ 00209 00210 BOOL PlugInUndoOp::RegisterOpToken(TCHAR *OpToken, UINT32 MenuTextID, CCRuntimeClass* pClass, 00211 pfnGetState gs) 00212 { 00213 // register some option descriptors 00214 if (!UndoableOperation::RegisterOpDescriptor( 00215 0, // Tool ID 00216 MenuTextID, // String resource ID 00217 pClass, // Runtime class 00218 OpToken, // Token string 00219 gs, // GetState function 00220 NULL, // help ID 00221 NULL, // bubble help 00222 NULL, // resource ID 00223 NULL, // control ID 00224 SYSTEMBAR_ILLEGAL, // Bar ID 00225 TRUE, // Recieve system messages 00226 FALSE, // Smart duplicate operation 00227 FALSE, // Clean operation 00228 // NULL, // No vertical counterpart (not present in undoable versions) 00229 NULL, // String for one copy only error 00230 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags 00231 )) 00232 return FALSE; 00233 00234 return TRUE; 00235 } 00236 00237 /******************************************************************************************** 00238 00239 > static OpState PlugInUndoOp::GetState(String_256*, OpDescriptor*) 00240 00241 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00242 Created: 21/1/97 00243 Inputs: 00244 Outputs: String - if MenuItem is enabled Then return the name of the operation to 00245 be undone Else return the reason why it is disabled 00246 Returns: OpState the state of the operation 00247 Purpose: To provide greying and ticking functionality for the 00248 operation. 00249 Errors: None 00250 00251 ********************************************************************************************/ 00252 00253 OpState PlugInUndoOp::GetState(String_256*, OpDescriptor* OpDesc) 00254 { 00255 // At present, this item is always available. 00256 OpState OpSt; 00257 return OpSt; 00258 } 00259 00260 /******************************************************************************************** 00261 00262 > virtual void Operation::GetOpName(String_256* pOpName) 00263 00264 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00265 Created: 11/3/97 00266 Outputs: The name of the operation 00267 Purpose: To get the name of the operation to put on the undo/redo menu items. 00268 We overide the baseclass version which tries to use the runtime class of 00269 this class to work out the OpDescriptor it was invoked with. Of course, we 00270 use one operation with multiple OpDescriptors and so this is not good enough. 00271 Unfortunately the operation class does not seem to save away the OpDescriptor 00272 that invoked it and so we must do this and then use this to track down the 00273 text to use. 00274 00275 ********************************************************************************************/ 00276 00277 void PlugInUndoOp::GetOpName(String_256* pOpName) 00278 { 00279 if (pOpName == NULL) 00280 return; 00281 00282 // Use our stored copy of the OpDescriptor and ask it for the text 00283 if (m_pOpDesc) 00284 m_pOpDesc->GetText(pOpName, OP_UNDO_TEXT); 00285 } 00286 00287 /******************************************************************************************** 00288 00289 > virtual void PlugInUndoOp::Do(OpDescriptor*) 00290 00291 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00292 Created: 21/1/97 00293 Inputs: pOpDesc the OpDescriptor of the item to invoke 00294 Outputs: None 00295 Returns: None 00296 Purpose: Invokes the plug-in specified by the OpDescriptor. 00297 Errors: if no OpDescriptor is supplied 00298 00299 ********************************************************************************************/ 00300 00301 void PlugInUndoOp::Do(OpDescriptor* pOpDesc) 00302 { 00303 if (pOpDesc == NULL) 00304 { 00305 ERROR3IF(pOpDesc == NULL,"PlugInUndoOp::Do null OpDescriptor"); 00306 return; 00307 } 00308 //ERROR3("PlugInUndoOp - do"); 00309 00310 // Store away a copy of the OpDescriptor for later use 00311 m_pOpDesc = pOpDesc; 00312 00313 // Search the plug-ins list for the specified plug-in and invoke it 00314 PlugInManager* pManager = GetApplication()->GetPlugInManager(); 00315 if (pManager == NULL) 00316 return; 00317 00318 PlugInItem * pPlugIn = pManager->GetFirstPlugIn(); 00319 String_32 OpToken; 00320 while (pPlugIn) 00321 { 00322 OpToken = pPlugIn->GetUniqueID(); 00323 OpToken += pPlugIn->GetPlugInName(); 00324 if (pOpDesc->Token == OpToken) 00325 { 00326 // Do Something 00327 break; 00328 } 00329 00330 pPlugIn = pManager->GetNextPlugIn(pPlugIn); 00331 } 00332 00333 // If we reached here then everything has happened ok and we can just end the 00334 // operation and exit 00335 End(); 00336 00337 return; 00338 } 00339 00340 /******************************************************************************************* 00341 00342 > static BOOL PlugInUndoOp::FindBitmapInSelection(KernelBitmap * pFoundBitmap = NULL, 00343 KernelBitmapRef ** ppFoundBitmapRef = NULL, 00344 NodeBitmap ** ppFoundNode = NULL, 00345 AttrFillGeometry ** ppFoundFillAttribute = NULL) 00346 00347 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00348 Created: 21/1/97 00349 Inputs: None 00350 Outputs: if supplied, it will return a pointer to the bitmap that is in the selection 00351 if supplied, it will return a pointer to the bitmap ref that is in the selection 00352 if supplied, it will return a pointer to the node bitmap that is in the selection 00353 if supplied, it will return a pointer to the fill geometry that is in the selection 00354 Returns: TRUE if succeeded in finding a bitmap, FALSE if not 00355 Purpose: Find out if there is a valid bitmap in the selection and return useful information 00356 to the caller. 00357 SeeAlso: - 00358 00359 *******************************************************************************************/ 00360 00361 /* 00362 This should be in RANGE for God's sake! 00363 BOOL PlugInUndoOp::FindBitmapInSelection(KernelBitmap ** ppFoundBitmap, 00364 KernelBitmapRef ** ppFoundBitmapRef, 00365 NodeBitmap ** ppFoundNode, 00366 AttrFillGeometry ** ppFoundFillAttribute) 00367 { 00368 SelRange *pSelRange = GetApplication()->FindSelection(); 00369 if (pSelRange == NULL) 00370 return FALSE; 00371 00372 Range Sel(*pSelRange); 00373 00374 Node* pFirstSelectedNode = Sel.FindFirst(); 00375 KernelBitmap * pBitmap = NULL; 00376 KernelBitmapRef* pBitmapRef = NULL; 00377 if (pFirstSelectedNode != NULL) // No nodes selected so End 00378 { 00379 Node* pCurrentNode = pFirstSelectedNode; 00380 Node* pNextCurrent = NULL; 00381 00382 // Do all bitmaps. OK this should pick up the fill as well. Never mind 00383 while (pCurrentNode != NULL) 00384 { 00385 pNextCurrent = Sel.FindNext(pCurrentNode); 00386 if ( (pCurrentNode->IsSelected()) && (pCurrentNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeBitmap)) ) 00387 { 00388 NodeBitmap * pNodeBmp = (NodeBitmap *)(pCurrentNode); 00389 pBitmap = pNodeBmp->GetBitmap(); 00390 pBitmapRef = pNodeBmp->GetBitmapRef(); 00391 // If the caller wanted it, return the found bitmap to them 00392 if (ppFoundBitmap) 00393 *ppFoundBitmap = pBitmap; 00394 // ditto found bitmap ref 00395 if (ppFoundBitmapRef) 00396 *ppFoundBitmapRef = pBitmapRef; 00397 // ditto found node 00398 if (ppFoundNode) 00399 *ppFoundNode = pNodeBmp; 00400 // ditto found fill attribute 00401 if (ppFoundFillAttribute) 00402 *ppFoundFillAttribute = NULL; 00403 return TRUE; 00404 } 00405 00406 pCurrentNode = pNextCurrent; 00407 } 00408 00409 } 00410 00411 // Find the first Fill Attribute in the selection 00412 AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr(); 00413 00414 while (pAttrNode != NULL) 00415 { 00416 if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBitmapColourFill))) 00417 { 00418 pBitmap = pAttrNode->GetBitmap(); 00419 pBitmapRef = pAttrNode->GetBitmapRef(); 00420 // If the caller wanted it, return the found bitmap to them 00421 if (ppFoundBitmap) 00422 *ppFoundBitmap = pBitmap; 00423 // ditto found bitmap ref 00424 if (ppFoundBitmapRef) 00425 *ppFoundBitmapRef = pBitmapRef; 00426 // ditto found node 00427 if (ppFoundNode) 00428 *ppFoundNode = NULL; 00429 // ditto found fill attribute 00430 if (ppFoundFillAttribute) 00431 *ppFoundFillAttribute = pAttrNode; 00432 return TRUE; 00433 } 00434 00435 // Check the next fill 00436 pAttrNode = AttrFillGeometry::FindNextSelectedAttr(); 00437 } 00438 00439 // If the caller wanted it, return the found bitmap to them 00440 if (ppFoundBitmap) 00441 *ppFoundBitmap = NULL; 00442 // ditto found bitmap ref 00443 if (ppFoundBitmapRef) 00444 *ppFoundBitmapRef = NULL; 00445 // ditto found node 00446 if (ppFoundNode) 00447 *ppFoundNode = NULL; 00448 // ditto found fill attribute 00449 if (ppFoundFillAttribute) 00450 *ppFoundFillAttribute = NULL; 00451 00452 return FALSE; 00453 } 00454 */ 00455 00456 /******************************************************************************************** 00457 ********************************************************************************************/ 00458 00459 /******************************************************************************************** 00460 00461 > ActionApplyPlugInToBitmap::ActionApplyPlugInToBitmap() 00462 00463 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00464 Created: 21/1/97 00465 Purpose: ActionApplyPlugInToBitmap constructor 00466 00467 ********************************************************************************************/ 00468 00469 ActionApplyPlugInToBitmap::ActionApplyPlugInToBitmap() 00470 { 00471 m_pDocument = NULL; 00472 m_pBitmap = NULL; 00473 m_pBitmapRef = NULL; 00474 m_pFoundNode = NULL; 00475 m_pFoundFillAttribute = NULL; 00476 } 00477 00478 /******************************************************************************************** 00479 00480 > ActionApplyPlugInToBitmap::~ActionApplyPlugInToBitmap() 00481 00482 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00483 Created: 21/1/97 00484 Purpose: ActionApplyPlugInToBitmap destructor 00485 00486 ********************************************************************************************/ 00487 00488 ActionApplyPlugInToBitmap::~ActionApplyPlugInToBitmap() 00489 { 00490 } 00491 00492 /******************************************************************************************** 00493 00494 > virtual ActionCode ActionApplyPlugInToBitmap::Execute() 00495 00496 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00497 Created: 21/1/97 00498 Inputs: - 00499 Outputs: ActionCode indicating if the action was successfully executed or not 00500 Returns: - 00501 Purpose: Executes the ActionApplyPlugInToBitmap to go and apply a new bitmap to 00502 the currently selected fill or node bitmap and generate another 00503 ActionApplyPlugInToBitmap to undo this change. 00504 Forces a redraw of the fill or node. 00505 00506 ********************************************************************************************/ 00507 00508 ActionCode ActionApplyPlugInToBitmap::Execute() 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 } 00600 00601 00602 00603 /******************************************************************************************** 00604 00605 > ActionCode ActionApplyPlugInToBitmap::Init( Operation* const pOp, 00606 ActionList* pActionList, 00607 UINT32 ActionSize, 00608 Document *pDocument, 00609 KernelBitmap *pBitmap, 00610 KernelBitmapRef *pBitmapRef, 00611 NodeBitmap * pFoundNode, 00612 AttrFillGeometry * pFoundFillAttribute, 00613 Action** NewAction) 00614 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00615 Created: 21/1/97 00616 00617 Inputs: pOp: The operation to which the action should be added 00618 pActionList: The action list in the operation object 00619 ActionSize: The size of the action in bytes. This should be the total 00620 size of the action (including any objects pointed to by the 00621 action). 00622 pDocument: The target document which contains the bitmap 00623 pBmp: The target bitmap to have the plug-in applied to 00624 pBitmapRef: The target bitmap reference to be changed 00625 pFoundNode: The possible target nodebitmap or NULL 00626 pFoundFillAttribute: The possible target attribute or null. 00627 00628 Outputs: NewAction: A pointer to the action if it could be allocated. 00629 00630 Returns: AC_FAIL: There was not enough room in the operation history for the 00631 action and the user did not wish to continue. Usually 00632 End() should be called in this situation. 00633 00634 AC_NORECORD: There was not enough room in the operation history for 00635 the action, but the user requested that he wished to 00636 continue without undo. 00637 00638 AC_OK : The action was successfully initialised and added to the 00639 operation. 00640 00641 00642 Purpose: To check that there is sufficient room for the action in the operation 00643 history, and if there is, then to add the action to the operations 00644 action list. 00645 00646 The function calls the Action::Init function passing the runtime class 00647 of an ActionApplyPlugInToBitmap. 00648 Errors: - 00649 SeeAlso: Action::Init; PlugInUndoOp; 00650 00651 ********************************************************************************************/ 00652 00653 ActionCode ActionApplyPlugInToBitmap::Init( Operation* const pOp, 00654 ActionList* pActionList, 00655 UINT32 ActionSize, 00656 Document *pDocument, 00657 KernelBitmap *pBitmap, 00658 KernelBitmapRef *pBitmapRef, 00659 NodeBitmap * pFoundNode, 00660 AttrFillGeometry * pFoundFillAttribute, 00661 Action** NewAction, 00662 BOOL bUpdateAspect) 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 } 00682 00683 /******************************************************************************************** 00684 ********************************************************************************************/