swfsprit.cpp

Go to the documentation of this file.
00001 // $Id: swfsprit.cpp 751 2006-03-31 15:43: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 #include "camtypes.h"
00099 #include "swfsprit.h"
00100 
00101 #define new CAM_DEBUG_NEW
00102 
00103 /********************************************************************************************
00104 
00105 >   FlashSprite::FlashSprite ( void )
00106 
00107     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00108     Created:    22/12/99
00109     Inputs:     -
00110     Returns:    -
00111     Purpose:    Default constructor. Ensure that all the variables are set to values
00112                 that won't cause problems.
00113 
00114 ********************************************************************************************/
00115 
00116 FlashSprite::FlashSprite ( void )
00117 {
00118     // Generate initial settings.
00119     mpNext = NULL;
00120     mpPlace = NULL;
00121     mpPlaceTail = NULL;
00122     mID = 0;
00123     mLayer = NO_BUTTON;
00124     mName.Empty ();
00125 }
00126 
00127 /********************************************************************************************
00128 
00129 >   FlashSprite::~FlashSprite ()
00130 
00131     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00132     Created:    22/12/99
00133     Inputs:     -
00134     Returns:    -
00135     Purpose:    Default destructor.
00136 
00137 ********************************************************************************************/
00138 
00139 FlashSprite::~FlashSprite ()
00140 {
00141     // Delete the list of FlashPlaceObject records.
00142     while ( mpPlace != NULL )
00143     {
00144         FlashPlaceObject *pLast = mpPlace;
00145         mpPlace = mpPlace->GetNext ();
00146         delete pLast;
00147     }
00148 
00149     // Reset the other pointers.
00150     mpPlaceTail = NULL;
00151     mpNext = NULL;
00152 }
00153 
00154 /********************************************************************************************
00155 
00156 >   FlashSprite* FlashSprite::GetNext ( void )
00157 
00158     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00159     Created:    22/12/99
00160     Inputs:     -
00161     Returns:    A pointer to the next item in the list.
00162     Purpose:    Gets a pointer to the next item in the list.
00163 
00164 ********************************************************************************************/
00165 
00166 FlashSprite* FlashSprite::GetNext ( void )
00167 {
00168     return mpNext;
00169 }
00170 
00171 /********************************************************************************************
00172 
00173 >   void FlashSprite::SetNext ( FlashSprite *pNext )
00174 
00175     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00176     Created:    22/12/99
00177     Inputs:     pNext - A pointer to a FlashSprite.
00178     Returns:    void
00179     Purpose:    Sets mpNext (the pointer to the next item in the list) to the
00180                 FlashSprite pointed to by pNext.
00181 
00182 ********************************************************************************************/
00183 
00184 void FlashSprite::SetNext ( FlashSprite *pNext )
00185 {
00186     mpNext = pNext;
00187 }
00188 
00189 /********************************************************************************************
00190 
00191 >   FlashSprite* FlashSprite::AddNext ( void )
00192 
00193     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00194     Created:    22/12/99
00195     Inputs:     -
00196     Returns:    A pointer to the next item in the list.
00197     Purpose:    Creates a new item, adds it to the list after this node, and returns a
00198                 pointer to this item.
00199 
00200 ********************************************************************************************/
00201 
00202 FlashSprite* FlashSprite::AddNext ( void )
00203 {
00204     // Do a recursive call: If there is a next object, call the AddNext function within this,
00205     // and attempt to create the new object there.
00206     if ( mpNext != NULL )
00207     {
00208         return mpNext->AddNext ();
00209     }
00210     else
00211     {
00212         mpNext = new FlashSprite;
00213         return mpNext;
00214     }
00215 }
00216 
00217 /********************************************************************************************
00218 
00219 >   void FlashSprite::SetID ( WORD ID )
00220 
00221     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00222     Created:    22/12/99
00223     Inputs:     WORD ID - The ID value shape to be displayed.
00224     Returns:    -
00225     Purpose:    Sets mID.
00226 
00227 ********************************************************************************************/
00228 
00229 void FlashSprite::SetID ( WORD ID )
00230 {
00231     mID = ID;
00232 }
00233 
00234 /********************************************************************************************
00235 
00236 >   WORD FlashSprite::GetID ( void )
00237 
00238     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00239     Created:    22/12/99
00240     Inputs:     -
00241     Returns:    The ID number of the current record.
00242     Purpose:    Returns the ID of the object to be placed.
00243 
00244 ********************************************************************************************/
00245 
00246 WORD FlashSprite::GetID ( void )
00247 {
00248     return mID;
00249 }
00250 
00251 /********************************************************************************************
00252 
00253 >   void FlashSprite::SetName ( const TCHAR* pName )
00254 
00255     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00256     Created:    14/1/00
00257     Inputs:     TCHAR *pName - A pointer to a string containing a button's name.
00258     Returns:    -
00259     Purpose:    Sets mName.
00260 
00261 ********************************************************************************************/
00262 
00263 void FlashSprite::SetName ( const TCHAR* pName )
00264 {
00265     mName = pName;
00266 }
00267 
00268 /********************************************************************************************
00269 
00270 >   TCHAR* FlashSprite::GetName ( void )
00271 
00272     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00273     Created:    14/1/00
00274     Inputs:     -
00275     Returns:    A pointer to the contents of the record's name.
00276     Purpose:    Returns the name of the button.
00277 
00278 ********************************************************************************************/
00279 
00280 TCHAR* FlashSprite::GetName ( void )
00281 {
00282     return ( TCHAR* ) mName;
00283 }
00284 
00285 /********************************************************************************************
00286 
00287 >   void FlashSprite::SetLayer ( LayerState Layer )
00288 
00289     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00290     Created:    14/1/00
00291     Inputs:     LayerState Layer - An enumerated type containing the state of the layer.
00292     Returns:    -
00293     Purpose:    Sets mLayer.
00294 
00295 ********************************************************************************************/
00296 
00297 void FlashSprite::SetLayer ( LayerState Layer )
00298 {
00299     mLayer = Layer;
00300 }
00301 
00302 /********************************************************************************************
00303 
00304 >   LayerState FlashSprite::GetLayer ( void )
00305 
00306     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00307     Created:    14/1/00
00308     Inputs:     -
00309     Returns:    mLayer - The named layer on which the button is placed.
00310     Purpose:    Returns the LayerState of the button.
00311 
00312 ********************************************************************************************/
00313 
00314 LayerState FlashSprite::GetLayer ( void )
00315 {
00316     return mLayer;
00317 }
00318 
00319 /********************************************************************************************
00320 
00321 >   BOOL FlashSprite::IsAMatch ( const TCHAR *pName,
00322                                  LayerState State )
00323 
00324     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00325     Created:    14/1/00
00326     Inputs:     -
00327     Returns:    TRUE if a match, FALSE otherwise.
00328     Purpose:    If the state and name values match, then the object data which these were
00329                 related to forms part of this button record, and thus should be incorporated
00330                 into it.
00331 
00332 ********************************************************************************************/
00333 
00334 BOOL FlashSprite::IsAMatch ( const TCHAR *pName,
00335                              LayerState State )
00336 {
00337     if ( mName.IsIdentical ( pName ) && State == mLayer )
00338         return TRUE;
00339     else
00340         return FALSE;
00341 }
00342 
00343 /********************************************************************************************
00344 
00345 >   FlashPlaceObject* FlashSprite::GetPlace ( void )
00346 
00347     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00348     Created:    22/12/99
00349     Inputs:     -
00350     Returns:    mpPlace - A pointer to a FlashPlaceObject.
00351     Purpose:    Gets a pointer to the head of a FlashPlaceObject list.
00352 
00353 ********************************************************************************************/
00354 
00355 FlashPlaceObject* FlashSprite::GetPlace ( void )
00356 {
00357     return mpPlace;
00358 }
00359 
00360 /********************************************************************************************
00361 
00362 >   void FlashSprite::SetPlace ( FlashPlaceObject *pPlace )
00363 
00364     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00365     Created:    22/12/99
00366     Inputs:     pPlace - A pointer to a FlashPlaceObject.
00367     Returns:    -
00368     Purpose:    Sets mpPlace, which is the head of a linked list of FlashPlaceObject
00369                 records.
00370 
00371 ********************************************************************************************/
00372 
00373 void FlashSprite::SetPlace ( FlashPlaceObject *pPlace )
00374 {
00375     mpPlaceTail = mpPlace = pPlace;
00376 }
00377 
00378 /********************************************************************************************
00379 
00380 >   void FlashSprite::SetPlaceTail ( FlashPlaceObject *pPlace )
00381 
00382     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00383     Created:    17/1/00
00384     Inputs:     pPlace - A pointer to a FlashPlaceObject.
00385     Returns:    -
00386     Purpose:    Sets the value of PlaceTail to be pPlace, so that the list of objects can
00387                 be extended.
00388 
00389 ********************************************************************************************/
00390 
00391 void FlashSprite::SetTail ( FlashPlaceObject *pPlace )
00392 {
00393     // Check to see whether or not there is a pointer first. If not, create a new record.
00394     if ( mpPlaceTail != NULL )
00395     {
00396         mpPlaceTail->SetNext ( pPlace );
00397         mpPlaceTail = pPlace;
00398     }
00399     else
00400         SetPlace ( pPlace );
00401 }

Generated on Sat Nov 10 03:47:07 2007 for Camelot by  doxygen 1.4.4