author | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
commit | 15318cad33835e4e2dc620d033e43cd930676cdd (patch) (side-by-side diff) | |
tree | c2fa0399a2c47fda8e2cd0092c73a809d17f68eb /core/multimedia/opieplayer/libflash/character.cc | |
download | opie-15318cad33835e4e2dc620d033e43cd930676cdd.zip opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2 |
Initial revision
Diffstat (limited to 'core/multimedia/opieplayer/libflash/character.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libflash/character.cc | 233 |
1 files changed, 233 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/libflash/character.cc b/core/multimedia/opieplayer/libflash/character.cc new file mode 100644 index 0000000..4b5ce36 --- a/dev/null +++ b/core/multimedia/opieplayer/libflash/character.cc @@ -0,0 +1,233 @@ +///////////////////////////////////////////////////////////// +// Flash Plugin and Player +// Copyright (C) 1998 Olivier Debon +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +/////////////////////////////////////////////////////////////// +// Author : Olivier Debon <odebon@club-internet.fr> +// + +#include "swf.h" + +#ifdef RCSID +static char *rcsid = "$Id$"; +#endif + +///// Character member definitions + +Character::Character(ObjectType objectType, long tagid) +{ + type = objectType; + tagId = tagid; + name = NULL; +} + +Character::~Character() +{ + delete name; +} + +int +Character::execute(GraphicDevice *gd, Matrix *matrix, Cxform *cxform) +{ + printf("Cannot be executed\n"); + return 0; +} + +ActionRecord * +Character::eventHandler(GraphicDevice *gd, FlashEvent *ev) +{ + fprintf(stderr,"Unable to handle event !!!\n"); + return 0; +} + +int +Character::isButton() +{ + return 0; +} + +int +Character::isSprite(void) +{ + return 0; +} + +char * +Character::getName() +{ + return name; +} + +void +Character::getBoundingBox(Rect *bb, DisplayListEntry *e) +{ + //fprintf(stderr,"Unable to handle getBoundingBox !!!\n"); + bb->xmin = LONG_MAX; + bb->ymin = LONG_MAX; + bb->ymax = LONG_MIN; + bb->ymax = LONG_MIN; + return; +} + +void +Character::getRegion(GraphicDevice *gd, Matrix *matrix, + void *id, ScanLineFunc scan_line_func) +{ + fprintf(stderr,"Unable to handle getRegion !!!\n"); + return; +} + +long +Character::getTagId() +{ + return tagId; +} + +void +Character::reset() +{ +} + +ObjectType +Character::getType() +{ + return type; +} + +char * +Character::getTypeString() +{ + switch (type) { + case BitmapType: + return "Bitmap"; + case FontType: + return "Font"; + case ButtonType: + return "Button"; + case SpriteType: + return "Sprite"; + case ShapeType: + return "Shape"; + case SoundType: + return "Sound"; + case TextType: + return "Text"; + default: + return "Unknown"; + } +} + +void +Character::setName(char* string) +{ + name = strdup(string); +} + +///// Dict methods definitions + +Dict::Dict() +{ + head = 0; +} + +Dict::~Dict() +{ + struct sCharCell *cell,*del; + + for(cell = head; cell;) + { + del = cell; + cell = cell->next; + delete del->elt; + delete del; + } +} + +void +Dict::addCharacter(Character *character) +{ + struct sCharCell *cell; + + cell = new sCharCell; + if (cell == NULL) { + delete character; + return; + } + cell->elt = character; + cell->next = head; + + head = cell; +} + +Character * +Dict::getCharacter(long id) +{ + struct sCharCell *cell; + + for(cell = head; cell; cell = cell->next) + { + if (id == cell->elt->getTagId()) return cell->elt; + } + return 0; +} + +void +Dict::dictRewind() +{ + currentCell = head; +} + +Character * +Dict::dictNextCharacter() +{ + if (currentCell) { + struct sCharCell *cell; + + cell = currentCell; + currentCell = currentCell->next; + return cell->elt; + } else { + return 0; + } +} + +void +Dict::nameCharacter(long id, char *string) +{ + struct sCharCell *cell; + + for(cell = head; cell; cell = cell->next) + { + if (cell->elt->getTagId() == id) { + cell->elt->setName(string); + break; + } + } +} + +#ifdef DUMP +void +Dict::dictSetUnsaved() +{ + struct sCharCell *cell; + + for(cell = head; cell; cell = cell->next) + { + cell->elt->saved = 0; + } +} +#endif |