swfplace.cpp

Go to the documentation of this file.
00001 // $Id: swfplace.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 #include "camtypes.h"
00099 //#include "paths.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00100 #include "swfplace.h"
00101 
00102 // Global definitions of the static member variables.
00103 WORD FlashPlaceObject::mBitmapCount = 0;
00104 WORD FlashPlaceObject::mFontCount   = 0;
00105 WORD FlashPlaceObject::mTextCount   = 0;
00106 WORD FlashPlaceObject::mShapeCount  = 0;
00107 WORD FlashPlaceObject::mSpriteCount = 0;
00108 WORD FlashPlaceObject::mButtonCount = 0;
00109 
00110 #define new CAM_DEBUG_NEW
00111 
00112 /********************************************************************************************
00113 
00114 >   FlashPlaceObject::FlashPlaceObject ( void )
00115 
00116     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00117     Created:    13/10/99
00118     Inputs:     -
00119     Returns:    -
00120     Purpose:    Default constructor. Ensure that all the variables are set to values
00121                 that won't cause problems.
00122 
00123 ********************************************************************************************/
00124 
00125 FlashPlaceObject::FlashPlaceObject ( void )
00126 {
00127     // Generate initial settings.
00128     DocCoord DefaultPosition ( 0, 0 );
00129 
00130     // And set them.
00131     mToRender = FLASH_SHAPE;
00132     mID = 0;
00133     mPosition = DefaultPosition;
00134     mpNext = NULL;
00135     mpLast = NULL;
00136     mDoTransform = FALSE;
00137 }
00138 
00139 /********************************************************************************************
00140 
00141 >   FlashPlaceObject::~FlashPlaceObject ()
00142 
00143     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00144     Created:    13/10/99
00145     Inputs:     -
00146     Returns:    -
00147     Purpose:    Default destructor.
00148 
00149 ********************************************************************************************/
00150 
00151 FlashPlaceObject::~FlashPlaceObject ()
00152 {
00153     // Nothing needed at the present.
00154 }
00155 
00156 /********************************************************************************************
00157 
00158 >   FlashPlaceObject* FlashPlaceObject::GetNext ( void )
00159 
00160     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00161     Created:    13/10/99
00162     Inputs:     -
00163     Returns:    A pointer to the next item in the list.
00164     Purpose:    Gets a pointer to the next item in the list.
00165 
00166 ********************************************************************************************/
00167 
00168 FlashPlaceObject* FlashPlaceObject::GetNext ( void )
00169 {
00170     return mpNext;
00171 }
00172 
00173 /********************************************************************************************
00174 
00175 >   void FlashPlaceObject::SetNext ( FlashPlaceObject *pNext )
00176 
00177     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00178     Created:    13/10/99
00179     Inputs:     pNext - A pointer to a FlashPlaceObject.
00180     Returns:    void
00181     Purpose:    Sets mpNext (the pointer to the next item in the list) to the
00182                 FlashPlaceObject pointed to by pNext.
00183 
00184 ********************************************************************************************/
00185 
00186 void FlashPlaceObject::SetNext ( FlashPlaceObject *pNext )
00187 {
00188     mpNext = pNext;
00189 }
00190 
00191 /********************************************************************************************
00192 
00193 >   FlashPlaceObject* FlashPlaceObject::AddNext ( void )
00194 
00195     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00196     Created:    13/10/99
00197     Inputs:     -
00198     Returns:    A pointer to the next item in the list.
00199     Purpose:    Creates a new item, adds it to the list after this node, and returns a
00200                 pointer to this item.
00201 
00202 ********************************************************************************************/
00203 
00204 FlashPlaceObject* FlashPlaceObject::AddNext ( void )
00205 {
00206     // Do a recursive call: If there is a next object, call the AddNext function within this,
00207     // and attempt to create the new object there.
00208     if ( mpNext != NULL )
00209     {
00210         return mpNext->AddNext ();
00211     }
00212     else
00213     {
00214         mpNext = new FlashPlaceObject;
00215         ASSERT ( mpNext != NULL );
00216         mpNext->SetLast ( this );
00217         return mpNext;
00218     }
00219 }
00220 
00221 /********************************************************************************************
00222 
00223 >   FlashPlaceObject* FlashPlaceObject::GetLast ( void )
00224 
00225     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00226     Created:    13/1/00
00227     Inputs:     -
00228     Returns:    A pointer to the previous item in the list.
00229     Purpose:    Gets a pointer to the previous item in the list.
00230 
00231 ********************************************************************************************/
00232 
00233 FlashPlaceObject* FlashPlaceObject::GetLast ( void )
00234 {
00235     return mpLast;
00236 }
00237 
00238 /********************************************************************************************
00239 
00240 >   void FlashPlaceObject::SetLast ( FlashPlaceObject *pLast )
00241 
00242     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00243     Created:    13/1/00
00244     Inputs:     pLast - A pointer to a FlashPlaceObject.
00245     Returns:    void
00246     Purpose:    Sets mpLast (the pointer to the previous item in the list) to the
00247                 FlashPlaceObject pointed to by pLast.
00248 
00249 ********************************************************************************************/
00250 
00251 void FlashPlaceObject::SetLast ( FlashPlaceObject *pLast )
00252 {
00253     mpLast = pLast;
00254 }
00255 
00256 /********************************************************************************************
00257 
00258 >   void FlashPlaceObject::SetType ( FlashType Type )
00259 
00260     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00261     Created:    23/10/99
00262     Inputs:     Type - The kind of Flash record to be rendered.
00263     Returns:    -
00264     Purpose:    Sets mToRender, a record of what kind of Flash record to write to the file.
00265 
00266 ********************************************************************************************/
00267 
00268 void FlashPlaceObject::SetType ( FlashType Type )
00269 {
00270     mToRender = Type;
00271 }
00272 
00273 /********************************************************************************************
00274 
00275 >   FlashType FlashPlaceObject::GetType ( void )
00276 
00277     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00278     Created:    23/10/99
00279     Inputs:     -
00280     Returns:    The type of shape to be rendered.
00281     Purpose:    Reveals whether this place object is being used to display a particular
00282                 kind of Flash file record.
00283 
00284 ********************************************************************************************/
00285 
00286 FlashType FlashPlaceObject::GetType ( void )
00287 {
00288     return mToRender;
00289 }
00290 
00291 /********************************************************************************************
00292 
00293 >   void FlashPlaceObject::SetPosition ( DocCoord Point )
00294 
00295     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00296     Created:    13/10/99
00297     Inputs:     Point - The position to place the object on screen. (Typically lox, loy.)
00298     Returns:    -
00299     Purpose:    Sets the position at which the image should be rendered.
00300 
00301 ********************************************************************************************/
00302 
00303 void FlashPlaceObject::SetPosition ( DocCoord Point )
00304 {
00305     mPosition = Point;
00306 }
00307 
00308 /********************************************************************************************
00309 
00310 >   DocCoord FlashPlaceObject::GetPosition ( void )
00311 
00312     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00313     Created:    13/10/99
00314     Inputs:     -
00315     Returns:    DocCoord - The position of the object.
00316     Purpose:    Sets the initial position to render the object at.
00317 
00318 ********************************************************************************************/
00319 
00320 DocCoord FlashPlaceObject::GetPosition ( void )
00321 {
00322     return mPosition;
00323 }
00324 
00325 /********************************************************************************************
00326 
00327 >   void FlashPlaceObject::SetID ( WORD ID )
00328 
00329     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00330     Created:    13/10/99
00331     Inputs:     WORD ID - The ID value shape to be displayed.
00332     Returns:    -
00333     Purpose:    Sets mID.
00334 
00335 ********************************************************************************************/
00336 
00337 void FlashPlaceObject::SetID ( WORD ID )
00338 {
00339     mID = ID;
00340 }
00341 
00342 /********************************************************************************************
00343 
00344 >   WORD FlashPlaceObject::GetID ( void )
00345 
00346     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00347     Created:    23/10/99
00348     Inputs:     -
00349     Returns:    The ID number of the current record.
00350     Purpose:    Returns the ID of the object to be placed.
00351 
00352 ********************************************************************************************/
00353 
00354 WORD FlashPlaceObject::GetID ( void )
00355 {
00356     WORD ID = mID;
00357 
00358     // Use a switch to determine what the ID value should be.
00359     if ( mToRender == FLASH_TEXT )
00360     {
00361         ID += FLASH_FIRST_ID + mBitmapCount + mFontCount;
00362     }
00363     else if ( mToRender == FLASH_SHAPE )
00364     {
00365         ID += FLASH_FIRST_ID + mBitmapCount + mFontCount + mTextCount;
00366     }
00367     else if ( mToRender == FLASH_SPRITE )
00368     {
00369         ID += FLASH_FIRST_ID + mBitmapCount + mFontCount + mTextCount + mShapeCount;
00370     }
00371     else if ( mToRender == FLASH_BUTTON )
00372     {
00373         ID += FLASH_FIRST_ID + mBitmapCount + mFontCount + mTextCount + mShapeCount
00374               + mSpriteCount;
00375     }
00376 
00377     return ID;
00378 }
00379 
00380 /********************************************************************************************
00381 
00382 >   WORD FlashPlaceObject::GetRawID ( void )
00383 
00384     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00385     Created:    14/1/00
00386     Inputs:     -
00387     Returns:    The ID number of the current record.
00388     Purpose:    Returns the raw ID of the object to be placed. (i.e. the value contained in
00389                 mID.)
00390 
00391 ********************************************************************************************/
00392 
00393 WORD FlashPlaceObject::GetRawID ( void )
00394 {
00395     return mID;
00396 }
00397 
00398 /********************************************************************************************
00399 
00400 >   void FlashPlaceObject::SetDoTransform ( BOOL State )
00401 
00402     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00403     Created:    17/1/00
00404     Inputs:     State - Should a transform be applied to the place object co-ordinates?
00405     Returns:    -
00406     Purpose:    The way the Flash render region code for buttons has been set up mean that
00407                 buttons with roll-over states must be placed at (0,0). Unfortunately, if I
00408                 set the co-ordinates to this value, they are transformed when this class is
00409                 processed, so I'm putting this value in to alert the filter that I want to
00410                 use THIS value in the final image.
00411 
00412 ********************************************************************************************/
00413 
00414 void FlashPlaceObject::SetDoTransform ( BOOL State )
00415 {
00416     mDoTransform = State;
00417 }
00418 
00419 /********************************************************************************************
00420 
00421 >   BOOL FlashPlaceObject::GetDoTransform ( void )
00422 
00423     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00424     Created:    17/1/00
00425     Inputs:     -
00426     Returns:    TRUE if the transform should be done, otherwise FALSE.
00427     Purpose:    Allows the filter to determine whether or not a transform should be applied
00428                 to the position co-ordinates for this PlaceObject tag.
00429 
00430 ********************************************************************************************/
00431 
00432 BOOL FlashPlaceObject::GetDoTransform ( void )
00433 {
00434     return mDoTransform;
00435 }
00436 
00437 /********************************************************************************************
00438 
00439 >   static void FlashPlaceObject::ResetStatics ( void )
00440 
00441     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00442     Created:    22/10/99
00443     Inputs:     -
00444     Returns:    -
00445     Purpose:    Sets all the static member variables to zero.
00446 
00447 ********************************************************************************************/
00448 
00449 void FlashPlaceObject::ResetStatics ( void )
00450 {
00451     // Reset the counter variables.
00452     mBitmapCount    = 0;
00453     mFontCount      = 0;
00454     mTextCount      = 0;
00455     mShapeCount     = 0;
00456     mSpriteCount    = 0;
00457     mButtonCount    = 0;
00458 }
00459 
00460 /********************************************************************************************
00461 
00462 >   static void FlashPlaceObject::IncBitmapCount ( void )
00463 
00464     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00465     Created:    22/10/99
00466     Inputs:     -
00467     Returns:    -
00468     Purpose:    Increases mBitmapCount.
00469 
00470 ********************************************************************************************/
00471 
00472 void FlashPlaceObject::IncBitmapCount ( void )
00473 {
00474     mBitmapCount ++;
00475 }
00476 
00477 /********************************************************************************************
00478 
00479 >   static void FlashPlaceObject::IncFontCount ( void )
00480 
00481     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00482     Created:    22/10/99
00483     Inputs:     -
00484     Returns:    -
00485     Purpose:    Increases mFontCount.
00486 
00487 ********************************************************************************************/
00488 
00489 void FlashPlaceObject::IncFontCount ( void )
00490 {
00491     mFontCount ++;
00492 }
00493 
00494 /********************************************************************************************
00495 
00496 >   static void FlashPlaceObject::IncTextCount ( void )
00497 
00498     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00499     Created:    22/10/99
00500     Inputs:     -
00501     Returns:    -
00502     Purpose:    Increases mTextCount.
00503 
00504 ********************************************************************************************/
00505 
00506 void FlashPlaceObject::IncTextCount ( void )
00507 {
00508     mTextCount ++;
00509 }
00510 
00511 /********************************************************************************************
00512 
00513 >   static void FlashPlaceObject::IncShapeCount ( void )
00514 
00515     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00516     Created:    22/10/99
00517     Inputs:     -
00518     Returns:    -
00519     Purpose:    Increases mShapeCount.
00520 
00521 ********************************************************************************************/
00522 
00523 void FlashPlaceObject::IncShapeCount ( void )
00524 {
00525     mShapeCount ++;
00526 }
00527 
00528 /********************************************************************************************
00529 
00530 >   static void FlashPlaceObject::IncSpriteCount ( void )
00531 
00532     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00533     Created:    22/12/99
00534     Inputs:     -
00535     Returns:    -
00536     Purpose:    Increases mSpriteCount.
00537 
00538 ********************************************************************************************/
00539 
00540 void FlashPlaceObject::IncSpriteCount ( void )
00541 {
00542     mSpriteCount ++;
00543 }
00544 
00545 /********************************************************************************************
00546 
00547 >   static void FlashPlaceObject::DecSpriteCount ( void )
00548 
00549     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00550     Created:    18/1/00
00551     Inputs:     -
00552     Returns:    -
00553     Purpose:    Decreases mSpriteCount.
00554 
00555 ********************************************************************************************/
00556 
00557 void FlashPlaceObject::DecSpriteCount ( void )
00558 {
00559     // Only decrease the sprite count if it is greated than zero, since it is an unsigned
00560     // value.
00561     if ( mSpriteCount > 0 )
00562         mSpriteCount --;
00563 }
00564 
00565 /********************************************************************************************
00566 
00567 >   static void FlashPlaceObject::IncButtonCount ( void )
00568 
00569     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00570     Created:    9/12/99
00571     Inputs:     -
00572     Returns:    -
00573     Purpose:    Increases mButtonCount.
00574 
00575 ********************************************************************************************/
00576 
00577 void FlashPlaceObject::IncButtonCount ( void )
00578 {
00579     mButtonCount ++;
00580 }
00581 
00582 /********************************************************************************************
00583 
00584 >   static WORD FlashPlaceObject::GetBitmapCount ( void )
00585 
00586     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00587     Created:    22/10/99
00588     Inputs:     -
00589     Returns:    The current value of mBitmapCount.
00590     Purpose:    Access function to the static member variable mBitmapCount.
00591 
00592 ********************************************************************************************/
00593 
00594 WORD FlashPlaceObject::GetBitmapCount ( void )
00595 {
00596     return mBitmapCount;
00597 }
00598 
00599 /********************************************************************************************
00600 
00601 >   static WORD FlashPlaceObject::GetFontCount ( void )
00602 
00603     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00604     Created:    22/10/99
00605     Inputs:     -
00606     Returns:    The current value of mFontCount.
00607     Purpose:    Access function to the static member variable mFontCount.
00608 
00609 ********************************************************************************************/
00610 
00611 WORD FlashPlaceObject::GetFontCount ( void )
00612 {
00613     return mFontCount;
00614 }
00615 
00616 /********************************************************************************************
00617 
00618 >   static WORD FlashPlaceObject::GetTextCount ( void )
00619 
00620     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00621     Created:    22/10/99
00622     Inputs:     -
00623     Returns:    The current value of mTextCount.
00624     Purpose:    Access function to the static member variable mTextCount.
00625 
00626 ********************************************************************************************/
00627 
00628 WORD FlashPlaceObject::GetTextCount ( void )
00629 {
00630     return mTextCount;
00631 }
00632 
00633 /********************************************************************************************
00634 
00635 >   static WORD FlashPlaceObject::GetShapeCount ( void )
00636 
00637     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00638     Created:    22/10/99
00639     Inputs:     -
00640     Returns:    The current value of mShapeCount.
00641     Purpose:    Access function to the static member variable mShapeCount.
00642 
00643 ********************************************************************************************/
00644 
00645 WORD FlashPlaceObject::GetShapeCount ( void )
00646 {
00647     return mShapeCount;
00648 }
00649 
00650 /********************************************************************************************
00651 
00652 >   static WORD FlashPlaceObject::GetSpriteCount ( void )
00653 
00654     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00655     Created:    22/10/99
00656     Inputs:     -
00657     Returns:    The current value of mSpriteCount.
00658     Purpose:    Access function to the static member variable mSpriteCount.
00659 
00660 ********************************************************************************************/
00661 
00662 WORD FlashPlaceObject::GetSpriteCount ( void )
00663 {
00664     return mSpriteCount;
00665 }
00666 
00667 /********************************************************************************************
00668 
00669 >   static WORD FlashPlaceObject::GetButtonCount ( void )
00670 
00671     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00672     Created:    22/10/99
00673     Inputs:     -
00674     Returns:    The current value of mButtonCount.
00675     Purpose:    Access function to the static member variable mButtonCount.
00676 
00677 ********************************************************************************************/
00678 
00679 WORD FlashPlaceObject::GetButtonCount ( void )
00680 {
00681     return mButtonCount;
00682 }

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