Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

program.h

Go to the documentation of this file.
00001 
00002 // Flash Plugin and Player
00003 // Copyright (C) 1998 Olivier Debon
00004 // 
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 // 
00020 #ifndef _PROGRAM_H_
00021 #define _PROGRAM_H_
00022 
00023 enum ControlType {
00024         ctrlPlaceObject,
00025         ctrlPlaceObject2,
00026         ctrlRemoveObject,
00027         ctrlRemoveObject2,
00028         ctrlDoAction,
00029         ctrlStartSound,
00030         ctrlStopSound,
00031         ctrlBackgroundColor
00032 };
00033 
00034 enum PlaceFlags {
00035         placeIsMove             = 0x01,
00036         placeHasCharacter       = 0x02,
00037         placeHasMatrix          = 0x04,
00038         placeHasColorXform      = 0x08,
00039         placeHasRatio           = 0x10,
00040         placeHasName            = 0x20,
00041         placeHasClip            = 0x40
00042 };
00043 
00044 struct Control {
00045         ControlType     type;
00046 
00047         // Place, Remove, Sound
00048         Character       *character;
00049         long             depth;
00050 
00051         // Place 1&2
00052         PlaceFlags       flags;
00053         Matrix           matrix;
00054         Cxform           cxform;
00055         long             ratio;
00056         long             clipDepth;
00057         char            *name;
00058 
00059         // BackgroundColor
00060         Color            color;
00061 
00062         // DoAction
00063         ActionRecord    *actionRecords;
00064 
00065         struct Control *next;
00066 
00067 
00068         // Methods
00069 
00070         void addActionRecord( ActionRecord   *ar)
00071         {
00072                 ar->next = 0;
00073 
00074                 if (actionRecords == 0) {
00075                         actionRecords = ar;
00076                 } else {
00077                         ActionRecord *current;
00078 
00079                         for(current = actionRecords; current->next; current = current->next);
00080 
00081                         current->next = ar;
00082                 }
00083         };
00084 
00085         Control()
00086         {
00087                 actionRecords = 0;
00088                 cxform.aa = 1.0; cxform.ab = 0;
00089                 cxform.ra = 1.0; cxform.rb = 0;
00090                 cxform.ga = 1.0; cxform.gb = 0;
00091                 cxform.ba = 1.0; cxform.bb = 0;
00092                 ratio = 0;
00093                 clipDepth = 0;
00094                 name = 0;
00095         };
00096 
00097         ~Control()
00098         {
00099                 ActionRecord    *ar,*del;
00100                 for(ar = actionRecords; ar;)
00101                 {
00102                         del = ar;
00103                         ar = ar->next;
00104                         delete del;
00105                 }
00106                 if (name) {
00107                         free(name);
00108                 }
00109         };
00110 };
00111 
00112 struct Frame {
00113         char *label;
00114         Control *controls;      // Controls for this frame
00115 };
00116 
00117 enum MovieStatus {
00118         MoviePaused,
00119         MoviePlay
00120 };
00121 
00122 struct FlashMovie;
00123 
00124 struct Program {
00125         DisplayList     *dl;
00126 
00127         Frame           *frames;        // Array
00128         long             nbFrames;      // Number of valid frames
00129         long             currentFrame;
00130         long             loadingFrame;
00131         long             totalFrames;   // Total expected number of frames
00132         long             nextFrame;
00133         int              movieWait;     // If true freeze movie until next loaded frame
00134         MovieStatus      movieStatus;
00135         Sound           *currentSound;
00136         long             settings;
00137         FlashMovie      *movie;
00138         long             render;        // True if needed to be rendered
00139 
00140         Program(FlashMovie *movie,long n);
00141         ~Program();
00142 
00143         void     rewindMovie();
00144         void     pauseMovie();
00145         void     continueMovie();
00146         void     nextStepMovie();
00147         void     gotoFrame(GraphicDevice *gd, long f);
00148 
00149         long     processMovie(GraphicDevice *, SoundMixer *);
00150         long     nestedMovie(GraphicDevice *, SoundMixer *, Matrix *, Cxform *);
00151         long     runFrame(GraphicDevice *, SoundMixer *, long f, long action=1);
00152         long     handleEvent(GraphicDevice *, SoundMixer *, FlashEvent *);
00153         long     doAction(GraphicDevice *gd, ActionRecord *action, SoundMixer *);
00154         void     setCurrentFrameLabel(char *label);
00155         void     advanceFrame();
00156         void     addControlInCurrentFrame(Control *ctrl);
00157         void     setGetUrlMethod( void (*)(char *, char *, void *), void *);
00158         void     modifySettings(long flags);
00159         long     searchFrame(GraphicDevice *gd, char *, char *);
00160         void     validateLoadingFrame();
00161         long     getCurrentFrame();
00162         void     setCurrentFrame(long);
00163 
00164         Frame   *getFrames();
00165         long     getNbFrames();
00166 
00167         DisplayList *getDisplayList();
00168 
00169 #ifdef DUMP
00170         void     dump(BitStream *bs);
00171 static  void     dumpActions(BitStream *bs, ActionRecord *actions);
00172 #endif
00173 };
00174 
00175 DisplayListEntry *findFocus(DisplayList *dl);
00176 void setFlashTimer(struct timeval *tv, int time_ms);
00177 int checkFlashTimer(struct timeval *tv);
00178 
00179 void loadNewSwf(FlashMovie *movie, char *url, int level);
00180 
00181 void computeBBox(FlashMovie *movie, Rect *rect, DisplayListEntry *e);
00182 
00183 long processMovie(FlashMovie *movie);
00184 
00185 #endif /* _PROGRAM_H_ */

Generated on Sat Nov 5 16:15:36 2005 for OPIE by  doxygen 1.4.2