lattrops.cpp

Go to the documentation of this file.
00001 // $Id: lattrops.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 
00102 #include "camtypes.h"
00103 //#include "undoop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 #include "lattrops.h"
00105 //#include "dialogop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 #include "lineattr.h"
00107 //#include "document.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 //#include "convert.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00109 #include "attrappl.h"
00110 //#include "resource.h"
00111 //#include "barsdlgs.h"
00112 //#include "mario.h"
00113 //#include "simon.h"
00114 //#include "justin.h"
00115 //#include "bars.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00116 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00117 //#include "selmsg.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00118 //#include "range.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00119 //#include "attrmgr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00120 //#include "tool.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00121 
00122 #ifdef ARROWHEADS
00123 CC_IMPLEMENT_DYNCREATE(OpChangeStartArrowExtendsDesc, SelOperation)
00124 CC_IMPLEMENT_DYNCREATE(OpChangeEndArrowExtendsDesc, SelOperation)
00125 #endif
00126 
00127 #define new CAM_DEBUG_NEW
00128 
00129 
00130 /********************************************************************************************
00131 >   static BOOL OpChangeLineJoinOpDesc::Init()
00132 
00133     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00134     Created:    4/4/95
00135     Inputs:     -
00136     Outputs:    -
00137     Returns:    -
00138     Purpose:    Registers the OpChangeLineJoinOpDesc operation descriptor.
00139     Errors:     -
00140     SeeAlso:    LineSGallery::Init
00141 ********************************************************************************************/
00142 
00143 BOOL OpChangeLineJoinOpDesc::Init()
00144 {
00145     return (new OpChangeLineJoinOpDesc) != NULL;
00146 }
00147     
00148 
00149 
00150 /********************************************************************************************
00151 >   OpChangeLineJoinOpDesc::OpChangeLineJoinOpDesc()
00152     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00153     Created:    3/3/95
00154     Inputs:     -
00155     Outputs:    -
00156     Returns:    -
00157     Purpose:    Simply calls the OpChangeLineAttribOpDesc base class constructor, passing
00158                 appropriate arguments.
00159     Errors:     -
00160     SeeAlso:    UndoableOpDescriptor::UndoableOpDescriptor
00161 ********************************************************************************************/
00162 
00163 OpChangeLineJoinOpDesc::OpChangeLineJoinOpDesc()
00164   : OpChangeLineAttribOpDesc(_R(IDS_CHANGE_LINE_JOIN),
00165                              OPTOKEN_CHANGE_LINE_JOIN,
00166                              _R(IDBBL_CHANGE_LINE_JOIN),
00167                              _R(IDLB_JOINTYPE_LIST_BOX))
00168 {
00169     // Empty.
00170 }
00171 
00172 
00173 
00174 /********************************************************************************************
00175 >   virtual CCRuntimeClass* OpChangeLineJoinOpDesc::GetAttribRuntimeClass() const
00176 
00177     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00178     Created:    5/4/95
00179     Inputs:     -
00180     Outputs:    -
00181     Returns:    The run-time class of the AttrJoinType line attribute.
00182     Purpose:    
00183     Errors:     -
00184     SeeAlso:    -
00185 ********************************************************************************************/
00186 
00187 CCRuntimeClass* OpChangeLineJoinOpDesc::GetAttribRuntimeClass() const
00188 {
00189     return CC_RUNTIME_CLASS(AttrJoinType);
00190 }
00191 
00192 
00193 
00194 /********************************************************************************************
00195 >   virtual UINT32 OpChangeLineJoinOpDesc::ConvertAttribToStringID(NodeAttribute* pAttr) const
00196 
00197     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00198     Created:    5/4/95
00199     Inputs:     pAttr       the attribute to "convert"
00200     Outputs:    -
00201     Returns:    A string ID describing the given attribute.
00202     Purpose:    Called by the OpChangeLineAttribOpDesc base class when it wants to get
00203                 a string describing the given attribute.
00204     Errors:     -
00205     SeeAlso:    -
00206 ********************************************************************************************/
00207 
00208 UINT32 OpChangeLineJoinOpDesc::ConvertAttribToStringID(NodeAttribute* pAttr) const
00209 {
00210     UINT32 nTxtID;
00211     switch (((AttrJoinType*) pAttr)->Value.JoinType)
00212     {
00213     case MitreJoin:
00214         nTxtID = _R(IDS_JOINTYPE_MITRE);
00215         break;
00216 
00217     case RoundJoin:
00218         nTxtID = _R(IDS_JOINTYPE_ROUND);
00219         break;
00220 
00221     case BevelledJoin:
00222         nTxtID = _R(IDS_JOINTYPE_BEVEL);
00223         break;
00224 
00225     default:
00226         nTxtID = 0;
00227         break;
00228     }
00229     
00230     return nTxtID;
00231 }
00232 
00233 
00234 
00235 /********************************************************************************************
00236 >   virtual UINT32 OpChangeLineJoinOpDesc::GetItemStringID(INT32 nItemIndex) const
00237 
00238     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00239     Created:    5/4/95
00240     Inputs:     A combo-box position index (ie. 0, 1, 2, 3, ...)
00241     Outputs:    -
00242     Returns:    The string ID of the item in the combo at the given position, or 0 if there
00243                 isn't one.
00244     Purpose:    Called by the OpChangeLineAttribOpDesc base class when it wants the string
00245                 to insert at the given position in the combo.
00246     Errors:     -
00247     SeeAlso:    -
00248 ********************************************************************************************/
00249 
00250 UINT32 OpChangeLineJoinOpDesc::GetItemStringID(INT32 nItemIndex) const
00251 {
00252     static UINT32 nStringID[] =
00253     {
00254         _R(IDS_JOINTYPE_MITRE),
00255         _R(IDS_JOINTYPE_ROUND),
00256         _R(IDS_JOINTYPE_BEVEL),
00257         0
00258     };
00259 
00260     return nStringID[nItemIndex];
00261 }
00262 
00263 
00264 
00265 /********************************************************************************************
00266 >   virtual NodeAttribute* OpChangeLineJoinOpDesc::GetNewAttrib(INT32 nItemIndex) const
00267 
00268     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00269     Created:    5/4/95
00270     Inputs:     nItemIndex      the index position within the combo the user has selected
00271     Outputs:    -
00272     Returns:    A pointer to an attribute corresponding to the given index position.
00273     Purpose:    Called by the OpChangeLineAttribOpDesc base class when it wants to create
00274                 an attribute.
00275     Errors:     -
00276     SeeAlso:    -
00277 ********************************************************************************************/
00278 
00279 NodeAttribute* OpChangeLineJoinOpDesc::GetNewAttrib(INT32 nItemIndex) const
00280 {
00281     AttrJoinType* pAttr = new AttrJoinType;
00282     if (pAttr != NULL) pAttr->Value.JoinType = (JointType) nItemIndex;
00283     return pAttr;
00284 }
00285 
00286 
00287 
00288 /********************************************************************************************
00289 >   static BOOL OpChangeLineCapOpDesc::Init()
00290 
00291     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00292     Created:    4/4/95
00293     Inputs:     -
00294     Outputs:    -
00295     Returns:    -
00296     Purpose:    Registers the OpChangeLineCapOpDesc operation descriptor.
00297     Errors:     -
00298     SeeAlso:    LineSGallery::Init
00299 ********************************************************************************************/
00300 
00301 BOOL OpChangeLineCapOpDesc::Init()
00302 {
00303     return (new OpChangeLineCapOpDesc) != NULL;
00304 }
00305     
00306 
00307 
00308 /********************************************************************************************
00309 >   OpChangeLineCapOpDesc::OpChangeLineCapOpDesc()
00310     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00311     Created:    3/3/95
00312     Inputs:     -
00313     Outputs:    -
00314     Returns:    -
00315     Purpose:    Simply calls the OpChangeLineAttribOpDesc base class constructor, passing
00316                 appropriate arguments.
00317     Errors:     -
00318     SeeAlso:    UndoableOpDescriptor::UndoableOpDescriptor
00319 ********************************************************************************************/
00320 
00321 OpChangeLineCapOpDesc::OpChangeLineCapOpDesc()
00322   : OpChangeLineAttribOpDesc(_R(IDS_CHANGE_LINE_CAP),
00323                              OPTOKEN_CHANGE_LINE_CAP,
00324                              _R(IDBBL_CHANGE_LINE_CAP),
00325                              _R(IDLB_LINECAP_LIST_BOX))
00326 {
00327     // Empty.
00328 }
00329 
00330 
00331 
00332 /********************************************************************************************
00333 >   virtual CCRuntimeClass* OpChangeLineCapOpDesc::GetAttribRuntimeClass() const
00334 
00335     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00336     Created:    5/4/95
00337     Inputs:     -
00338     Outputs:    -
00339     Returns:    The run-time class of the AttrJoinType line attribute.
00340     Purpose:    
00341     Errors:     -
00342     SeeAlso:    -
00343 ********************************************************************************************/
00344 
00345 CCRuntimeClass* OpChangeLineCapOpDesc::GetAttribRuntimeClass() const
00346 {
00347     return CC_RUNTIME_CLASS(AttrStartCap);
00348 }
00349 
00350 
00351 
00352 /********************************************************************************************
00353 >   virtual UINT32 OpChangeLineCapOpDesc::ConvertAttribToStringID(NodeAttribute* pAttr) const
00354 
00355     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00356     Created:    5/4/95
00357     Inputs:     pAttr       the attribute to "convert"
00358     Outputs:    -
00359     Returns:    A string ID describing the given attribute.
00360     Purpose:    Called by the OpChangeLineAttribOpDesc base class when it wants to get
00361                 a string describing the given attribute.
00362     Errors:     -
00363     SeeAlso:    -
00364 ********************************************************************************************/
00365 
00366 UINT32 OpChangeLineCapOpDesc::ConvertAttribToStringID(NodeAttribute* pAttr) const
00367 {
00368     UINT32 nTxtID;
00369     switch (((AttrStartCap*) pAttr)->Value.StartCap)
00370     {
00371     case LineCapButt:
00372         nTxtID = _R(IDS_CAPTYPE_BUTT);
00373         break;
00374 
00375     case LineCapRound:
00376         nTxtID = _R(IDS_CAPTYPE_ROUND);
00377         break;
00378 
00379     case LineCapSquare:
00380         nTxtID = _R(IDS_CAPTYPE_SQUARE);
00381         break;
00382 
00383     default:
00384         nTxtID = 0;
00385         break;
00386     }
00387     
00388     return nTxtID;
00389 }
00390 
00391 
00392 
00393 /********************************************************************************************
00394 >   virtual UINT32 OpChangeLineCapOpDesc::GetItemStringID(INT32 nItemIndex) const
00395 
00396     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00397     Created:    5/4/95
00398     Inputs:     A combo-box position index (ie. 0, 1, 2, 3, ...)
00399     Outputs:    -
00400     Returns:    The string ID of the item in the combo at the given position, or 0 if there
00401                 isn't one.
00402     Purpose:    Called by the OpChangeLineAttribOpDesc base class when it wants the string
00403                 to insert at the given position in the combo.
00404     Errors:     -
00405     SeeAlso:    -
00406 ********************************************************************************************/
00407 
00408 UINT32 OpChangeLineCapOpDesc::GetItemStringID(INT32 nItemIndex) const
00409 {
00410     static UINT32 nStringID[] =
00411     {
00412         _R(IDS_CAPTYPE_BUTT),
00413         _R(IDS_CAPTYPE_ROUND),
00414         _R(IDS_CAPTYPE_SQUARE),
00415         0
00416     };
00417 
00418     return nStringID[nItemIndex];
00419 }
00420 
00421 
00422 
00423 /********************************************************************************************
00424 >   virtual NodeAttribute* OpChangeLineCapOpDesc::GetNewAttrib(INT32 nItemIndex) const
00425 
00426     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00427     Created:    5/4/95
00428     Inputs:     nItemIndex      the index position within the combo the user has selected
00429     Outputs:    -
00430     Returns:    A pointer to an attribute corresponding to the given index position.
00431     Purpose:    Called by the OpChangeLineAttribOpDesc base class when it wants to create
00432                 an attribute.
00433     Errors:     -
00434     SeeAlso:    -
00435 ********************************************************************************************/
00436 
00437 NodeAttribute* OpChangeLineCapOpDesc::GetNewAttrib(INT32 nItemIndex) const
00438 {
00439     AttrStartCap* pAttr = new AttrStartCap;
00440     if (pAttr != NULL) pAttr->Value.StartCap = (LineCapType) nItemIndex;
00441     return pAttr;
00442 }
00443 
00444 #ifdef ARROWHEADS
00445 /********************************************************************************************
00446 >   OpChangeStartArrowExtendsDesc::OpChangeStartArrowExtendsDesc()
00447 
00448     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> & Olivier
00449     Created:    21/11/96
00450     Purpose:    Constructor.
00451 ********************************************************************************************/
00452 OpChangeStartArrowExtendsDesc::OpChangeStartArrowExtendsDesc()
00453 {
00454     //TRACEUSER( "MarkH", _T("Just Made a OpChangeStartArrowExtendsDesc Class!\n"));
00455 }
00456 
00457 
00458 
00459 /********************************************************************************************
00460 >   virtual void OpChangeArrowStartExtendsDesc::Do(OpDescriptor *pOpDesc)
00461 
00462     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> & Olivier
00463     Created:    21/11/96
00464     Inputs:     pOpDesc - OpDescriptor - unused
00465     Outputs:    -
00466     Returns:    -
00467     Purpose:    The do function.  Inverts the arrow behaviour
00468 ********************************************************************************************/
00469 void OpChangeStartArrowExtendsDesc::Do(OpDescriptor *pOpDesc)
00470 {
00471     TRACEUSER( "DavidM", _T("OpChangeStartArrowExtendsDesc::Do !\n"));
00472 
00473     // ok, start the sel op
00474     // get the current selection
00475     SelRange* pSel = GetApplication()->FindSelection();
00476 
00477     // DoStartSelOp(TRUE);
00478 
00479     NodeListItem* pNodeListItem = NULL;
00480 
00481     // make a node list
00482     List * pSelList = NULL;
00483 
00484     pSelList = pSel->MakeListOfNodes(FALSE);
00485 
00486     Node * pNode = NULL;
00487 
00488     pNodeListItem = (NodeListItem *)pSelList->GetHead();
00489 
00490     AttrStartArrow * pNewAttrStartArrow = NULL;
00491     AttrStartArrow * pAttrStartArrow = NULL;
00492     
00493     AttrEndArrow * pNewAttrEndArrow = NULL;
00494     AttrEndArrow * pAttrEndArrow = NULL;
00495     NodeRenderableBounded * pParent = NULL;
00496 
00497     NodeHidden * pHidden = NULL;
00498 
00499     // run the the list finding arrow attributes, and invert them
00500     while (pNodeListItem)
00501     {
00502         pNode = pNodeListItem->pNode;
00503 
00504         if (pNode)
00505         {
00506             if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableInk)))
00507             {
00508                 // make a copy of the node, and pass this to the attribute manager !
00509                 pAttrStartArrow = (AttrStartArrow *)pNode->FindFirstChild(CC_RUNTIME_CLASS(AttrStartArrow));
00510 
00511                 if (pAttrStartArrow)
00512                 {
00513                     // make a copy of the attribute & invert its direction flag
00514                     pNewAttrStartArrow = (AttrStartArrow *)pAttrStartArrow->SimpleCopy();
00515                     
00516                     if (pNewAttrStartArrow)
00517                     {
00518                         if (pAttrStartArrow->Value.StartArrow.m_bExtendPath)
00519                         {
00520                             pNewAttrStartArrow->Value.StartArrow.m_bExtendPath = FALSE;
00521                         }
00522                         else
00523                         {
00524                             pNewAttrStartArrow->Value.StartArrow.m_bExtendPath = TRUE;
00525                         }
00526                         
00527                         AttributeManager::ApplyAttribToNode(
00528                             (NodeRenderableInk *)(pNode), pNewAttrStartArrow);
00529                         
00530                     }
00531                 }
00532             }
00533         }
00534 
00535         pNodeListItem = (NodeListItem *)pSelList->GetNext(pNodeListItem);
00536     }
00537 
00538     // end the selection operation
00539 
00540     // delete the sel list
00541     delete pSelList;
00542 
00543     // End();
00544 }
00545 
00546 /********************************************************************************************
00547 
00548 >   BOOL OpChangeStartArrowExtendsDesc::Declare()
00549 
00550     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00551     Created:    29/2/99
00552     Returns:    TRUE if all went OK, False otherwise
00553     Purpose:    Adds the operation to the list of all known operations
00554 
00555 ********************************************************************************************/
00556 BOOL OpChangeStartArrowExtendsDesc::Declare()
00557 {
00558     return (RegisterOpDescriptor(
00559                                 0, 
00560                                 _R(IDS_CHANGE_START_ARROW_EXTENDS),
00561                                 CC_RUNTIME_CLASS(OpChangeStartArrowExtendsDesc), 
00562                                 OPTOKEN_CHANGE_START_ARROW_EXTENDS,
00563                                 OpChangeStartArrowExtendsDesc::GetState));
00564 
00565 }
00566 
00567 /********************************************************************************************
00568 
00569 >   OpState OpChangeStartArrowExtendsDesc::GetState(String_256* Description, OpDescriptor*)
00570 
00571     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00572     Created:    29/2/00
00573     Outputs:    -
00574     Returns:    Ungreyed, Unticked
00575     Purpose:    Find out the state of the new regular shape at the specific time
00576 
00577 ********************************************************************************************/
00578 OpState OpChangeStartArrowExtendsDesc::GetState(String_256* Description, OpDescriptor*)
00579 {
00580     OpState Blobby;
00581     
00582     return Blobby;
00583 }
00584 
00585 /********************************************************************************************
00586 >   OpChangeEndArrowExtendsDesc::OpChangeEndArrowExtendsDesc()
00587 
00588     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> & Olivier
00589     Created:    21/11/96
00590     Purpose:    Constructor.
00591 ********************************************************************************************/
00592 OpChangeEndArrowExtendsDesc::OpChangeEndArrowExtendsDesc()
00593 {
00594     //TRACEUSER( "MarkH", _T("Just Made a OpChangeEndArrowExtendsDesc Class!\n"));
00595 }
00596 
00597 
00598 
00599 /********************************************************************************************
00600 >   virtual void OpChangeArrowStartExtendsDesc::Do(OpDescriptor *pOpDesc)
00601 
00602     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> & Olivier
00603     Created:    21/11/96
00604     Inputs:     pOpDesc - OpDescriptor - unused
00605     Outputs:    -
00606     Returns:    -
00607     Purpose:    The do function.  Inverts the arrow behaviour
00608 ********************************************************************************************/
00609 void OpChangeEndArrowExtendsDesc::Do(OpDescriptor *pOpDesc)
00610 {
00611     TRACEUSER( "DavidM", _T("OpChangeEndArrowExtendsDesc::Do !\n"));
00612 
00613     // ok, start the sel op
00614     // get the current selection
00615     SelRange* pSel = GetApplication()->FindSelection();
00616 
00617     // DoStartSelOp(TRUE);
00618 
00619     NodeListItem* pNodeListItem = NULL;
00620 
00621     // make a node list
00622     List * pSelList = NULL;
00623 
00624     pSelList = pSel->MakeListOfNodes(FALSE);
00625 
00626     Node * pNode = NULL;
00627 
00628     pNodeListItem = (NodeListItem *)pSelList->GetHead();
00629 
00630     AttrStartArrow * pNewAttrStartArrow = NULL;
00631     AttrStartArrow * pAttrStartArrow = NULL;
00632     
00633     AttrEndArrow * pNewAttrEndArrow = NULL;
00634     AttrEndArrow * pAttrEndArrow = NULL;
00635     NodeRenderableBounded * pParent = NULL;
00636 
00637     NodeHidden * pHidden = NULL;
00638 
00639     // run the the list finding arrow attributes, and invert them
00640     while (pNodeListItem)
00641     {
00642         pNode = pNodeListItem->pNode;
00643 
00644         if (pNode)
00645         {
00646             if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableInk)))
00647             {
00648                 pAttrEndArrow = (AttrEndArrow *)pNode->FindFirstChild(CC_RUNTIME_CLASS(AttrEndArrow));
00649                 
00650                 if (pAttrEndArrow)
00651                 {
00652                     pNewAttrEndArrow = (AttrEndArrow *)pAttrEndArrow->SimpleCopy();
00653                     
00654                     if (pNewAttrEndArrow)
00655                     {
00656                         if (pAttrEndArrow->Value.EndArrow.m_bExtendPath)
00657                         {
00658                             pNewAttrEndArrow->Value.EndArrow.m_bExtendPath = FALSE;
00659                         }
00660                         else
00661                         {
00662                             pNewAttrEndArrow->Value.EndArrow.m_bExtendPath = TRUE;
00663                         }
00664                         
00665                         AttributeManager::ApplyAttribToNode(
00666                             (NodeRenderableInk *)(pNode), pNewAttrEndArrow);
00667                         
00668                     }
00669                     
00670                 }
00671 
00672             }
00673         }
00674 
00675         pNodeListItem = (NodeListItem *)pSelList->GetNext(pNodeListItem);
00676     }
00677 
00678     // end the selection operation
00679 
00680     // delete the sel list
00681     delete pSelList;
00682 
00683     // End();
00684 }
00685 
00686 /********************************************************************************************
00687 
00688 >   BOOL OpChangeEndArrowExtendsDesc::Declare()
00689 
00690     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00691     Created:    29/2/99
00692     Returns:    TRUE if all went OK, False otherwise
00693     Purpose:    Adds the operation to the list of all known operations
00694 
00695 ********************************************************************************************/
00696 BOOL OpChangeEndArrowExtendsDesc::Declare()
00697 {
00698     return (RegisterOpDescriptor(
00699                                 0, 
00700                                 _R(IDS_CHANGE_END_ARROW_EXTENDS),
00701                                 CC_RUNTIME_CLASS(OpChangeEndArrowExtendsDesc), 
00702                                 OPTOKEN_CHANGE_END_ARROW_EXTENDS,
00703                                 OpChangeEndArrowExtendsDesc::GetState));
00704 
00705 }
00706 
00707 /********************************************************************************************
00708 
00709 >   OpState OpChangeEndArrowExtendsDesc::GetState(String_256* Description, OpDescriptor*)
00710 
00711     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00712     Created:    29/2/00
00713     Outputs:    -
00714     Returns:    Ungreyed, Unticked
00715     Purpose:    Find out the state of the new regular shape at the specific time
00716 
00717 ********************************************************************************************/
00718 OpState OpChangeEndArrowExtendsDesc::GetState(String_256* Description, OpDescriptor*)
00719 {
00720     OpState Blobby;
00721     
00722     return Blobby;
00723 }
00724 
00725 #endif
00726 

Generated on Sat Nov 10 03:45:35 2007 for Camelot by  doxygen 1.4.4