home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 10 / AU_CD10.iso / Archived / Updates / Flash / flashplayer / flashlib / h / program < prev    next >
Encoding:
Text File  |  2000-06-04  |  4.2 KB  |  187 lines

  1. /////////////////////////////////////////////////////////////
  2. // Flash Plugin and Player
  3. // Copyright (C) 1998 Olivier Debon
  4. //
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU General Public License
  7. // as published by the Free Software Foundation; either version 2
  8. // of the License, or (at your option) any later version.
  9. //
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18. //
  19. ///////////////////////////////////////////////////////////////
  20. #ifndef _PROGRAM_H_
  21. #define _PROGRAM_H_
  22.  
  23. enum ControlType {
  24.     ctrlPlaceObject,
  25.     ctrlPlaceObject2,
  26.     ctrlRemoveObject,
  27.     ctrlRemoveObject2,
  28.     ctrlDoAction,
  29.     ctrlStartSound,
  30.     ctrlStopSound,
  31.     ctrlBackgroundColor
  32. };
  33.  
  34. enum PlaceFlags {
  35.     placeIsMove        = 0x01,
  36.     placeHasCharacter    = 0x02,
  37.     placeHasMatrix        = 0x04,
  38.     placeHasColorXform    = 0x08,
  39.     placeHasRatio        = 0x10,
  40.     placeHasName        = 0x20,
  41.     placeHasClip        = 0x40
  42. };
  43.  
  44. struct Control {
  45.     ControlType    type;
  46.  
  47.     // Place, Remove, Sound
  48.     Character    *character;
  49.     long         depth;
  50.  
  51.         // Sound
  52.         long loops, syncflags;
  53.  
  54.     // Place 1&2
  55.     PlaceFlags     flags;
  56.     Matrix         matrix;
  57.     Cxform         cxform;
  58.     long         ratio;
  59.     long         clipDepth;
  60.     char        *name;
  61.  
  62.     // BackgroundColor
  63.     Color         color;
  64.  
  65.     // DoAction
  66.     ActionRecord    *actionRecords;
  67.  
  68.     struct Control *next;
  69.  
  70.  
  71.     // Methods
  72.  
  73.     void addActionRecord( ActionRecord   *ar)
  74.     {
  75.         ar->next = 0;
  76.  
  77.         if (actionRecords == 0) {
  78.             actionRecords = ar;
  79.         } else {
  80.             ActionRecord *current;
  81.  
  82.             for(current = actionRecords; current->next; current = current->next);
  83.  
  84.             current->next = ar;
  85.         }
  86.     };
  87.  
  88.     Control()
  89.     {
  90.         actionRecords = 0;
  91.         cxform.aa = 1.0; cxform.ab = 0;
  92.         cxform.ra = 1.0; cxform.rb = 0;
  93.         cxform.ga = 1.0; cxform.gb = 0;
  94.         cxform.ba = 1.0; cxform.bb = 0;
  95.         ratio = 0;
  96.         clipDepth = 0;
  97.         name = 0;
  98.     };
  99.  
  100.     ~Control()
  101.     {
  102.         ActionRecord    *ar,*del;
  103.         for(ar = actionRecords; ar;)
  104.         {
  105.             del = ar;
  106.             ar = ar->next;
  107.             delete del;
  108.         }
  109.         if (name) {
  110.             free(name);
  111.         }
  112.     };
  113. };
  114.  
  115. struct Frame {
  116.     char *label;
  117.     Control *controls;    // Controls for this frame
  118. };
  119.  
  120. enum MovieStatus {
  121.     MoviePaused,
  122.     MoviePlay
  123. };
  124.  
  125. struct FlashMovie;
  126.  
  127. struct Program {
  128.         DisplayList    *dl;
  129.  
  130.     Frame        *frames;    // Array
  131.     long         nbFrames;    // Number of valid frames
  132.     long           currentFrame;
  133.     long           loadingFrame;
  134.     long           totalFrames;    // Total expected number of frames
  135.     long           nextFrame;
  136.     int         movieWait;    // If true freeze movie until next loaded frame
  137.     MovieStatus      movieStatus;
  138.     Sound        *currentSound;
  139.     long         settings;
  140.         FlashMovie      *movie;
  141.     long         render;    // True if needed to be rendered
  142.  
  143.     Program(FlashMovie *movie,long n);
  144.     ~Program();
  145.  
  146.     void     rewindMovie();
  147.     void     pauseMovie();
  148.     void     continueMovie();
  149.     void     nextStepMovie();
  150.     void     gotoFrame(GraphicDevice *gd, long f);
  151.  
  152.     long     processMovie(GraphicDevice *, SoundMixer *);
  153.     long     nestedMovie(GraphicDevice *, SoundMixer *, Matrix *, Cxform *);
  154.     long     runFrame(GraphicDevice *, SoundMixer *, long f, long action=1);
  155.     long     handleEvent(GraphicDevice *, SoundMixer *, FlashEvent *);
  156.     long     doAction(GraphicDevice *gd, ActionRecord *action, SoundMixer *);
  157.     void     setCurrentFrameLabel(char *label);
  158.     void     advanceFrame();
  159.     void     addControlInCurrentFrame(Control *ctrl);
  160.     void     setGetUrlMethod( void (*)(char *, char *, void *), void *);
  161.     void     modifySettings(long flags);
  162.     long     searchFrame(GraphicDevice *gd, char *, char *);
  163.     void     validateLoadingFrame();
  164.  
  165.     Frame    *getFrames();
  166.     long     getNbFrames();
  167.  
  168.     DisplayList *getDisplayList();
  169.  
  170. #ifdef DUMP
  171.     void     dump(BitStream *bs);
  172. static  void     dumpActions(BitStream *bs, ActionRecord *actions);
  173. #endif
  174. };
  175.  
  176. DisplayListEntry *findFocus(DisplayList *dl);
  177. void setFlashTimer(struct timeval *tv, int time_ms);
  178. int checkFlashTimer(struct timeval *tv);
  179.  
  180. void loadNewSwf(FlashMovie *movie, char *url, int level);
  181.  
  182. void computeBBox(FlashMovie *movie, Rect *rect, DisplayListEntry *e);
  183.  
  184. long processMovie(FlashMovie *movie);
  185.  
  186. #endif /* _PROGRAM_H_ */
  187.