00001
00002 #ifndef LIBSSWF_H
00003 #define LIBSSWF_H
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #include <stdarg.h>
00047 #include <stdio.h>
00048 #include <stdlib.h>
00049 #ifndef _MSVC
00050 #include <unistd.h>
00051 #endif
00052 #include <string.h>
00053 #include <limits.h>
00054 #include <errno.h>
00055 #include <zlib.h>
00056 #include <math.h>
00057 #include <ctype.h>
00058 #include <wctype.h>
00059 #ifdef STATIC_ICONV
00060 #include <iconv.h.static>
00061 #else
00062 #include <iconv.h>
00063 #endif
00064
00065 #if _MSVC
00066 typedef __int8 int8_t;
00067 typedef unsigned __int8 uint8_t;
00068 typedef __int16 int16_t;
00069 typedef unsigned __int16 uint16_t;
00070 typedef __int32 int32_t;
00071 typedef unsigned __int32 uint32_t;
00072 typedef __int64 int64_t;
00073 typedef unsigned __int64 uint64_t;
00074 #elif IRIX
00075 #include <inttypes.h>
00076 #else
00077 #include <stdint.h>
00078 #endif
00079
00080 #if IRIX
00081 #include <sys/endian.h>
00082 #endif
00083
00084 #include "sswf/libsswf-config.h"
00085
00086
00087 #ifndef _MSVC
00088 #ifndef __APPLE_CC__
00089 #ifndef _WINT_T
00090 #define _WINT_T
00091 typedef unsigned int wint_t;
00092 #endif
00093 #endif
00094 #endif
00095
00096 #ifndef M_PI
00097 #define M_PI 3.14159265358979323846
00098 #endif
00099
00100
00101 #ifdef _MSVC
00102 #define strcasecmp stricmp
00103 #define rint(x) ((double) (long) floor(x + 0.5))
00104 #endif
00105
00106 #ifdef _LIBICONV_H
00107 #define ICONV_INPUT_CAST
00108 #else
00109
00110
00111
00112
00113
00114 #define ICONV_INPUT_CAST (char**)
00115 #endif
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 #define exposed_class class
00129 #define invisible public
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160 namespace sswf
00161 {
00162
00163
00164
00165
00166 void assert(int cond, const char *format, ...)
00167 #ifndef _MSVC
00168 __attribute__ ((format (printf, 2, 3)))
00169 #endif
00170 ;
00171
00172
00173 #if DEBUG
00174 inline void assert(int cond, const char *format, ...)
00175 {
00176 va_list ap;
00177
00178
00179 if(cond) {
00180 return;
00181 }
00182 fflush(stdout);
00183 fflush(stderr);
00184 fprintf(stderr, "\n");
00185 va_start(ap, format);
00186 vfprintf(stderr, format, ap);
00187 va_end(ap);
00188 fprintf(stderr, ".\n");
00189 fflush(stderr);
00190 abort();
00191 }
00192 #else
00193 inline void assert(int , const char * , ...) {}
00194 #endif
00195
00196
00197 typedef unsigned short sswf_id_t;
00198 typedef unsigned short sswf_frame_t;
00199 typedef int32_t sswf_ucs4_t;
00200
00201
00202 #define SSWF_ID_NONE ((sswf_id_t) -1) // this is an invalid ID (it seems)
00203
00204
00205 extern void swap(void *s1, void *s2, size_t size);
00206 extern int wctomb(const sswf_ucs4_t *wc, size_t wc_len, char *mb, size_t& mb_size);
00207 extern int mbtowc(const char *mb, size_t mb_len, sswf_ucs4_t *& wc, size_t& wc_len);
00208 extern char * wcname(sswf_ucs4_t wc, char *result);
00209 extern long wcslen(sswf_ucs4_t *wcstr);
00210
00211 inline unsigned short swap_short(unsigned short s)
00212 {
00213 return (s >> 8) | (s << 8);
00214 }
00215
00216 inline unsigned int swap_int(unsigned int l)
00217 {
00218 return (l >> 24) | (l << 24)
00219 | ((l >> 8) & 0x0000FF00)
00220 | ((l << 8) & 0x00FF0000);
00221 }
00222
00223 extern const char * sswf_version(void);
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234 class ErrorManager
00235 {
00236 public:
00237 enum error_code_t {
00238 ERROR_CODE_NONE = 0,
00239
00240 ERROR_CODE_ACTION_OVERFLOW,
00241 ERROR_CODE_ALPHA_MISMATCH,
00242 ERROR_CODE_BAD_STATE_FLAGS,
00243 ERROR_CODE_BUTTON_MISSING_STATE,
00244 ERROR_CODE_CANNOT_CHANGE_STYLE,
00245 ERROR_CODE_CHILDREN_NOT_SUPPORTED,
00246 ERROR_CODE_COMPRESSED_SOUND_8BITS,
00247 ERROR_CODE_EMPTY_POSITION_RANGE,
00248 ERROR_CODE_ENDED_ACTION_SCRIPT,
00249 ERROR_CODE_ENHANCED_LINE_REQUIRES_ALPHA,
00250 ERROR_CODE_ENVELOPE_EXISTS,
00251 ERROR_CODE_ENVELOPE_OVERFLOW,
00252 ERROR_CODE_FILE_NOT_FOUND,
00253 ERROR_CODE_FORMAT_LOCKED,
00254 ERROR_CODE_GLYPH_DEFINED_TWICE,
00255 ERROR_CODE_ICONV_ENCODER_NOT_AVAILABLE,
00256 ERROR_CODE_ICONV_FAILED,
00257 ERROR_CODE_IO,
00258 ERROR_CODE_INCOMPATIBLE_CHILD,
00259 ERROR_CODE_INCOMPATIBLE_MORPH,
00260 ERROR_CODE_INTERNAL_ERROR,
00261 ERROR_CODE_INVALID_DEPTH,
00262 ERROR_CODE_INVALID_EM_SQUARE,
00263 ERROR_CODE_INVALID_FILL_PARAMETER,
00264 ERROR_CODE_INVALID_FOCAL,
00265 ERROR_CODE_INVALID_GLYPH,
00266 ERROR_CODE_INVALID_IDENTIFIER,
00267 ERROR_CODE_INVALID_IMAGE,
00268 ERROR_CODE_INVALID_INTERPOLATION_MODE,
00269 ERROR_CODE_INVALID_LINE_INFO,
00270 ERROR_CODE_INVALID_MORPH_INDEX,
00271 ERROR_CODE_INVALID_OBJECT_EXPORTED,
00272 ERROR_CODE_INVALID_POSITION,
00273 ERROR_CODE_INVALID_SHAPE,
00274 ERROR_CODE_INVALID_SPREAD_MODE,
00275 ERROR_CODE_INVALID_STYLE,
00276 ERROR_CODE_INVALID_TEXT_SETUP,
00277 ERROR_CODE_JPEG,
00278 ERROR_CODE_LOOP_ZERO,
00279 ERROR_CODE_MISSING_FRAME_NAME,
00280 ERROR_CODE_MISSING_SHAPE,
00281 ERROR_CODE_MORPH_GRADIENT_LIMIT,
00282 ERROR_CODE_MORPH_REQUIRES_ALPHA,
00283 ERROR_CODE_NAME_TOO_LONG,
00284 ERROR_CODE_NEGATIVE_MITER,
00285 ERROR_CODE_NO_FOCAL_WITH_MORPH,
00286 ERROR_CODE_NO_HEADER,
00287 ERROR_CODE_NO_STATES,
00288 ERROR_CODE_NO_SUCH_GLYPH,
00289 ERROR_CODE_LABEL_NOT_FOUND,
00290 ERROR_CODE_LABEL_OVERFLOW,
00291 ERROR_CODE_MORPH_MISMATCH,
00292 ERROR_CODE_OBJECT_NOT_FOUND,
00293 ERROR_CODE_REGISTER_OVERFLOW,
00294 ERROR_CODE_SIZE_MISMATCH,
00295 ERROR_CODE_START_SOUND_NO_INFO,
00296 ERROR_CODE_TOO_MANY_STYLES,
00297 ERROR_CODE_TWO_OR_MORE_JPEGTABLES,
00298 ERROR_CODE_TWO_OR_MORE_METADATA,
00299 ERROR_CODE_UNEXPECTED_EVENT_FLAG,
00300 ERROR_CODE_UNKNOWN_FORMAT,
00301 ERROR_CODE_UNKNOWN_OBJECT_EXPORTED,
00302 ERROR_CODE_UNSUPPORTED_IMAGE_FORMAT,
00303 ERROR_CODE_UNSUPPORTED_SOUND_FORMAT,
00304 ERROR_CODE_VERSION_UNSATISFIED,
00305 ERROR_CODE_VOLUME_OUT_OF_RANGE,
00306
00307 ERROR_CODE_max
00308 };
00309
00310 ErrorManager(void);
00311
00312 void Reset(void);
00313 int Count(void) const;
00314 static error_code_t KeepFirst(error_code_t a, error_code_t b);
00315
00316 error_code_t OnError(error_code_t errcode, const char *message, va_list ap) const;
00317
00318 public:
00319 class InternalErrorException {};
00320
00321 class ErrorHandler
00322 {
00323 public:
00324 virtual ~ErrorHandler();
00325 virtual error_code_t OnError(error_code_t errcode, const char *msg) = 0;
00326 };
00327
00328 ErrorHandler * SetErrorHandler(ErrorHandler *error_handler);
00329 error_code_t OnError(error_code_t errcode, const char *message, ...) const;
00330
00331 private:
00332 mutable int f_error_count;
00333 ErrorHandler * f_error_handler;
00334 };
00335
00336
00337
00338
00339
00340
00341 class Buffer;
00342 class MemBuffer
00343 {
00344 public:
00345 MemBuffer(void);
00346 virtual ~MemBuffer();
00347
00348 void AttachBuffer(Buffer *buffer);
00349 Buffer * GetBuffer(void) const;
00350
00351 private:
00352 Buffer * f_buffer;
00353 };
00354
00355
00356 class Buffer
00357 {
00358 public:
00359 Buffer(Buffer **head, size_t size, const char *info);
00360 Buffer(Buffer **head, MemBuffer *ptr, size_t size, const char *info);
00361
00362 ~Buffer();
00363
00364 void * Realloc(size_t size);
00365 void * Data(void) const { return f_data; }
00366 Buffer * Next(void) const { return (Buffer *) f_next; }
00367 Buffer * Previous(void) const { return (Buffer *) f_previous; }
00368 size_t Size(void) const { return f_size; }
00369 const char * Info(void) const { return f_info; }
00370
00371 static Buffer * FindBuffer(void *ptr);
00372 #if 0
00373
00374 static bool IsBuffer(void *ptr);
00375 #endif
00376
00377 private:
00378
00379 struct mem_buffer_t {
00380 unsigned long f_magic;
00381 Buffer * f_buffer;
00382 };
00383 enum {
00384 DMAGIC = (unsigned long) 0x53535746,
00385 OMAGIC = (unsigned long) 0x5353574F
00386 };
00387 #define SSWF_ALIGN(value, modulo) (((value) + ((modulo) - 1)) & - (long) (modulo))
00388 #define SSWF_SPACE SSWF_ALIGN(sizeof(mem_buffer_t), sizeof(double))
00389 #if DEBUG
00390 void Test(void);
00391 #define SSWF_SAFE (sizeof(double) * 32)
00392 #define SSWF_TEST ((long)0xBADC0FFE)
00393 #else
00394 #define SSWF_SAFE 0
00395 #endif
00396
00397 Buffer ** f_head;
00398 Buffer * f_next;
00399 Buffer * f_previous;
00400 const char * f_info;
00401 size_t f_size;
00402 mutable void * f_data;
00403 };
00404
00405
00406 class MemoryManager
00407 {
00408 public:
00409 MemoryManager(void);
00410 virtual ~MemoryManager();
00411
00412 void MemAttach(MemBuffer *ptr, size_t size, const char *info);
00413 void * MemAlloc(size_t size, const char *info);
00414 void * MemRealloc(void *ptr, size_t size, const char *info);
00415 void MemFree(void *ptr);
00416 void MemClean(void *ptr);
00417 char * StrDup(const char *string);
00418 char * StrCat(const char *s1, const char *s2);
00419 #if DEBUG
00420 void MemTest(void *ptr);
00421 #endif
00422 unsigned long Size(void *ptr);
00423
00424 private:
00425 Buffer * f_head;
00426 };
00427
00428
00429
00430 class ItemBase : public MemBuffer
00431 {
00432 public:
00433 ItemBase(void) {}
00434 virtual ~ItemBase() {}
00435 };
00436
00437
00438 class Vectors : public MemoryManager, public MemBuffer
00439 {
00440 public:
00441 Vectors(void);
00442 Vectors(const Vectors& vector);
00443 ~Vectors();
00444
00445 ItemBase * Get(int index) const;
00446 void Set(int index, ItemBase *vector);
00447 void Insert(int index, ItemBase *vector);
00448 void SetSize(int size);
00449 int Count(void) const { return f_count; }
00450 void Empty(void) { f_count = 0; }
00451
00452 public:
00453 Vectors& operator = (const Vectors& vectors);
00454
00455 private:
00456 int f_count;
00457 int f_max;
00458 ItemBase ** f_vectors;
00459 };
00460
00461
00462
00463
00464
00465
00466
00467 class Data : public MemoryManager
00468 {
00469 public:
00470 Data(void);
00471 ~Data();
00472
00473 void Empty(void) { f_pos = 0; }
00474 void Align(void);
00475 void Overwrite(size_t offset, const void *ptr, size_t size);
00476 void OverwriteByte(size_t offset, char c);
00477 void OverwriteShort(size_t offset, short s);
00478 void OverwriteLong(size_t offset, long l);
00479 void Write(const void *ptr, size_t size);
00480 void WriteBits(long value, size_t bits);
00481 void PutByte(char c);
00482 void PutShort(short s);
00483 void PutLong(long l);
00484 void PutDLong(int64_t ll);
00485 void PutShortFloat(float f);
00486 void PutLongFloat(float f);
00487 void PutDoubleFloat(double f);
00488 void PutString(const char *string);
00489 void Append(const Data& append);
00490
00491 void Read(void *& ptr, size_t& size);
00492
00493
00494 unsigned long ByteSize(void) const { return (f_pos + CHAR_BIT - 1) / CHAR_BIT; }
00495 unsigned long GetSize(void) const { return f_pos; }
00496 void SetSize(unsigned long size);
00497
00498 private:
00499 void AdjustSize(size_t size);
00500
00501 unsigned long f_pos;
00502 unsigned long f_size;
00503 char * f_data;
00504 };
00505
00506
00507
00508
00509
00510
00511
00512 class SRectangle
00513 {
00514 public:
00515 SRectangle(void);
00516
00517 void Reset(void);
00518 void Set(long xmin, long xmax, long ymin, long ymax);
00519 void SetReorder(long xmin, long xmax, long ymin, long ymax);
00520 long XMin(void) const;
00521 long XMax(void) const;
00522 long YMin(void) const;
00523 long YMax(void) const;
00524 bool IsEmpty(void) const;
00525
00526 void Save(Data& data) const;
00527
00528 private:
00529 long f_xmin;
00530 long f_xmax;
00531 long f_ymin;
00532 long f_ymax;
00533 };
00534
00535
00536 class Color
00537 {
00538 public:
00539 Color(void) { Reset(); }
00540
00541 void Reset(void);
00542 void Set(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 255);
00543 unsigned char Red(void) const { return f_red; }
00544 unsigned char Green(void) const { return f_green; }
00545 unsigned char Blue(void) const { return f_blue; }
00546 unsigned char Alpha(void) const { return f_alpha; }
00547
00548 void Save(Data& data, bool save_alpha = true);
00549
00550 bool IsSolid(void) const { return f_alpha == 255; }
00551 bool IsInvisible(void) const { return f_alpha == 0; }
00552
00553 public:
00554 bool operator == (const Color& color) const;
00555 bool operator != (const Color& color) const;
00556
00557 private:
00558 unsigned char f_red;
00559 unsigned char f_green;
00560 unsigned char f_blue;
00561 unsigned char f_alpha;
00562 };
00563
00564
00565
00566 class ColorTransform
00567 {
00568 public:
00569 ColorTransform(void);
00570
00571 void Reset(void);
00572 void SetAdd(double red, double green, double blue, double alpha = 0.0);
00573 void SetMult(double red, double green, double blue, double alpha = 1.0);
00574 double AddRed(void) const { return f_add_red; }
00575 double AddGreen(void) const { return f_add_green; }
00576 double AddBlue(void) const { return f_add_blue; }
00577 double AddAlpha(void) const { return f_add_alpha; }
00578 double MultRed(void) const { return f_add_red; }
00579 double MultGreen(void) const { return f_add_green; }
00580 double MultBlue(void) const { return f_add_blue; }
00581 double MultAlpha(void) const { return f_add_alpha; }
00582
00583 void Save(Data& data, bool save_alpha = true);
00584
00585 bool IsNull(bool with_alpha) const;
00586 bool IsSolidCompatible(void) const;
00587
00588 private:
00589 double f_add_red;
00590 double f_add_green;
00591 double f_add_blue;
00592 double f_add_alpha;
00593 double f_mult_red;
00594 double f_mult_green;
00595 double f_mult_blue;
00596 double f_mult_alpha;
00597 };
00598
00599
00600
00601 class Matrix
00602 {
00603 public:
00604 Matrix(void);
00605
00606 void Reset(void);
00607 void SetScale(double x, double y) { f_scale_x = x; f_scale_y = y; }
00608 void SetScale(double scale) { f_scale_x = scale; f_scale_y = scale; }
00609 void SetRotate(double rotate);
00610 void SetSkew(double skew0, double skew1) { f_skew_0 = skew0; f_skew_1 = skew1; }
00611 void SetTranslate(long x, long y) { f_translate_x = x; f_translate_y = y; }
00612
00613 void Save(Data& data);
00614
00615 bool IsNull(void) const;
00616
00617 public:
00618 bool operator == (const Matrix& matrix) const;
00619 bool operator != (const Matrix& matrix) const;
00620
00621 private:
00622
00623 struct signed_matrix_t {
00624 long m[4];
00625 };
00626
00627 void ComputeMatrix(signed_matrix_t& m) const;
00628
00629 double f_scale_x;
00630 double f_scale_y;
00631 double f_rotate;
00632 long f_translate_x;
00633 long f_translate_y;
00634 double f_skew_0;
00635 double f_skew_1;
00636 };
00637
00638
00639
00640 class Envelope : public ItemBase
00641 {
00642 public:
00643 Envelope(unsigned long p, unsigned short l, unsigned short r);
00644 Envelope(const Envelope& envelope);
00645
00646 unsigned long Position(void) const;
00647 unsigned short Left(void) const;
00648 unsigned short Right(void) const;
00649 void Save(Data& data) const;
00650
00651 private:
00652 unsigned long f_position;
00653 unsigned short f_left;
00654 unsigned short f_right;
00655 };
00656
00657
00658 class SoundInfo : public MemoryManager
00659 {
00660 public:
00661 SoundInfo(ErrorManager& error_manager);
00662
00663 void SetSoundID(sswf_id_t id);
00664 void StopSound(bool stop = true);
00665 void NoMultiple(bool no_multiple = true);
00666 void SetRange(unsigned long start, unsigned long end);
00667 void SetLoop(unsigned short loop);
00668 void AddEnvelope(const Envelope& envelope);
00669
00670 ErrorManager::error_code_t PreSave(void);
00671 void Save(Data& data) const;
00672
00673 private:
00674 ErrorManager& f_error_manager;
00675 sswf_id_t f_sound_id;
00676 bool f_stop;
00677 bool f_no_multiple;
00678 unsigned long f_start_position;
00679 unsigned long f_end_position;
00680 unsigned short f_loop;
00681 Vectors f_envelopes;
00682 };
00683
00684
00685
00686
00687 class BlendMode
00688 {
00689 public:
00690 enum blend_mode_t {
00691 BLEND_MODE_UNDEFINED = -1,
00692 BLEND_MODE_NORMAL = 1,
00693 BLEND_MODE_LAYER = 2,
00694 BLEND_MODE_MULTIPLY = 3,
00695 BLEND_MODE_SCREEN = 4,
00696 BLEND_MODE_LIGHTEN = 5,
00697 BLEND_MODE_DARKEN = 6,
00698 BLEND_MODE_DIFFERENCE = 7,
00699 BLEND_MODE_ADD = 8,
00700 BLEND_MODE_SUBTRACT = 9,
00701 BLEND_MODE_INVERT = 10,
00702 BLEND_MODE_ALPHA = 11,
00703 BLEND_MODE_ERASE = 12,
00704 BLEND_MODE_OVERLAY = 13,
00705 BLEND_MODE_HARDLIGHT = 14
00706 };
00707
00708 BlendMode(void);
00709
00710 bool HasBlendMode(void) const;
00711 void SetBlendMode(blend_mode_t blend_mode_value);
00712 bool SetBlendModeByName(const char *blend_mode_name);
00713 blend_mode_t GetBlendMode(void) const;
00714
00715 void Save(Data& data);
00716
00717 private:
00718 blend_mode_t f_blend_mode;
00719 };
00720
00721
00722 class State : public ItemBase
00723 {
00724 public:
00725
00726 enum state_flags_t {
00727 STATE_FLAG_UP = 0x01,
00728 STATE_FLAG_OVER = 0x02,
00729 STATE_FLAG_DOWN = 0x04,
00730 STATE_FLAG_HIT_TEST = 0x08,
00731
00732 STATE_ALL_FLAGS = 0x0F
00733 };
00734
00735 explicit State(ErrorManager& error_manager);
00736
00737 void Reset(void);
00738 void SetObjectID(sswf_id_t id);
00739 bool SetFlags(unsigned char flags);
00740 void SetLayer(unsigned short layer);
00741 void SetMatrix(const Matrix& matrix);
00742 void SetColorTransform(const ColorTransform& color_transform);
00743 bool HasColorTransform(void) const;
00744 void SetBlendMode(const BlendMode& blend_mode);
00745 ErrorManager::error_code_t Save(Data& data, bool color_transform = false);
00746
00747 unsigned char GetFlags(void) const;
00748
00749 private:
00750 ErrorManager& f_error_manager;
00751 sswf_id_t f_id;
00752 bool f_has_color_transform;
00753 unsigned char f_flags;
00754 unsigned short f_layer;
00755 Matrix f_matrix;
00756 ColorTransform f_color_transform;
00757 BlendMode f_blend_mode;
00758 };
00759
00760
00761
00762
00763
00764 class Action;
00765 class Event : public MemoryManager, public ItemBase
00766 {
00767 public:
00768 Event(void);
00769
00770 void Reset(void);
00771 void SetEvents(unsigned long events);
00772 void SetKey(unsigned char key);
00773 unsigned long Events(void) const;
00774 unsigned long Conditions(void) const;
00775 unsigned char Key(void) const;
00776 Vectors& Actions(void);
00777
00778 static unsigned long StringToEvents(const char *s);
00779 static unsigned char StringToKeyCode(const char *s);
00780
00781
00782
00783
00784
00785 enum event_flag_t {
00786 EVENT_COND_MENU_LEAVE = 0x80000000,
00787 EVENT_COND_MENU_ENTER = 0x40000000,
00788
00789 EVENT_CONSTRUCT = 0x00040000,
00790 EVENT_KEY_PRESS = 0x00020000,
00791 EVENT_POINTER_DRAG_LEAVE = 0x00010000,
00792 EVENT_POINTER_DRAG_ENTER = 0x00008000,
00793 EVENT_POINTER_LEAVE = 0x00004000,
00794 EVENT_POINTER_ENTER = 0x00002000,
00795 EVENT_POINTER_RELEASE_OUTSIDE = 0x00001000,
00796 EVENT_POINTER_RELEASE_INSIDE = 0x00000800,
00797 EVENT_POINTER_PUSH = 0x00000400,
00798 EVENT_INITIALIZE = 0x00000200,
00799 EVENT_DATA = 0x00000100,
00800 EVENT_KEY_UP = 0x00000080,
00801 EVENT_KEY_DOWN = 0x00000040,
00802 EVENT_POINTER_UP = 0x00000020,
00803 EVENT_POINTER_DOWN = 0x00000010,
00804 EVENT_POINTER_MOVE = 0x00000008,
00805 EVENT_UNLOAD = 0x00000004,
00806 EVENT_ENTER_FRAME = 0x00000002,
00807 EVENT_ONLOAD = 0x00000001
00808 };
00809 #define SSWF_EVENT_V5 0x0000FF01 // flags present in V5
00810 #define SSWF_EVENT_V6 0x000300FE // flags added in V6
00811 #define SSWF_EVENT_V7 0x00040000 // flag added in V7
00812 #define SSWF_EVENT_CONDITIONS 0xC001FC00 // flags used by conditions in DefineButton2
00813 #define SSWF_EVENT_COUNT 20
00814 struct event_names_t {
00815 event_flag_t f_flag;
00816 const char * f_name;
00817 };
00818
00819 enum condition_flag_t {
00820 CONDITION_KEY_MASK = 0xFE00,
00821 CONDITION_KEY_SHIFT = 9,
00822 CONDITION_MENU_LEAVE = 0x0100,
00823 CONDITION_MENU_ENTER = 0x0080,
00824 CONDITION_POINTER_RELEASE_OUTSIDE = 0x0040,
00825 CONDITION_POINTER_DRAG_ENTER = 0x0020,
00826 CONDITION_POINTER_DRAG_LEAVE = 0x0010,
00827 CONDITION_POINTER_RELEASE_INSIDE = 0x0008,
00828 CONDITION_POINTER_PUSH = 0x0004,
00829 CONDITION_POINTER_LEAVE = 0x0002,
00830 CONDITION_POINTER_ENTER = 0x0001
00831 };
00832
00833 enum key_code_t {
00834 KEY_CODE_NONE = 0,
00835 KEY_CODE_LEFT_ARROW = 1,
00836 KEY_CODE_RIGHT_ARROW = 2,
00837 KEY_CODE_HOME = 3,
00838 KEY_CODE_END = 4,
00839 KEY_CODE_INSERT = 5,
00840 KEY_CODE_DELETE = 6,
00841 KEY_CODE_BACKSPACE = 8,
00842 KEY_CODE_ENTER = 13,
00843 KEY_CODE_UP_ARROW = 14,
00844 KEY_CODE_DOWN_ARROW = 15,
00845 KEY_CODE_PAGE_UP = 16,
00846 KEY_CODE_PAGE_DOWN = 17,
00847 KEY_CODE_TAB = 18,
00848 KEY_CODE_ESCAPE = 19,
00849 KEY_CODE_SPACE = 20,
00850
00851 };
00852 #define SSWF_KEY_COUNT 15
00853 struct key_names_t {
00854 key_code_t f_code;
00855 const char * f_name;
00856 };
00857
00858 public:
00859 static const event_names_t g_event_names[SSWF_EVENT_COUNT];
00860 static const key_names_t g_key_names[SSWF_KEY_COUNT];
00861
00862 private:
00863 unsigned long f_events;
00864 unsigned char f_key;
00865 Vectors f_actions;
00866 };
00867
00868
00869
00870
00871
00872 class Style : public ItemBase
00873 {
00874 public:
00875 enum style_t {
00876 STYLE_TYPE_UNKNOWN = 0,
00877 STYLE_TYPE_NO_LINE,
00878 STYLE_TYPE_NO_FILL,
00879 STYLE_TYPE_LINE,
00880 STYLE_TYPE_ENHANCED_LINE,
00881 STYLE_TYPE_SOLID,
00882 STYLE_TYPE_GRADIENT_LINEAR,
00883 STYLE_TYPE_GRADIENT_RADIAL,
00884 STYLE_TYPE_GRADIENT_FOCAL,
00885 STYLE_TYPE_BITMAP_TILLED,
00886 STYLE_TYPE_BITMAP_CLIPPED,
00887 STYLE_TYPE_BITMAP_HARDEDGE_TILLED,
00888 STYLE_TYPE_BITMAP_HARDEDGE_CLIPPED,
00889
00890 STYLE_TYPE_MATRIX,
00891
00892
00893 STYLE_TYPE_max
00894 };
00895
00896 enum cap_t {
00897 STYLE_LINE_CAP_SAME = -1,
00898 STYLE_LINE_CAP_ROUND = 0,
00899 STYLE_LINE_CAP_NONE = 1,
00900 STYLE_LINE_CAP_SQUARE = 2
00901 };
00902
00903 enum join_t {
00904 STYLE_LINE_JOIN_UNKNOWN = -1,
00905 STYLE_LINE_JOIN_ROUND = 0,
00906 STYLE_LINE_JOIN_BEVEL = 1,
00907 STYLE_LINE_JOIN_MITER = 2
00908 };
00909
00910 enum spread_t {
00911 STYLE_GRADIENT_SPREAD_PAD = 0,
00912 STYLE_GRADIENT_SPREAD_REFLECT = 1,
00913 STYLE_GRADIENT_SPREAD_REPEAT = 2,
00914 };
00915
00916 enum interpolation_t {
00917 STYLE_GRADIENT_INTERPOLATION_NORMAL = 0,
00918 STYLE_GRADIENT_INTERPOLATION_LINEAR = 1
00919 };
00920
00921 explicit Style(ErrorManager& error_manager);
00922 virtual ~Style();
00923
00924 void Reset(void);
00925 style_t Type(void) const { return f_style; }
00926 signed char Gradients(void) const { return f_gradient; }
00927 bool HasMorph(void) const { return f_morph; }
00928 bool HasAlpha(void) const { return f_use_alpha; }
00929 bool HasHardEdges(void) const { return f_style == STYLE_TYPE_BITMAP_HARDEDGE_TILLED
00930 || f_style == STYLE_TYPE_BITMAP_HARDEDGE_CLIPPED; }
00931 bool SetType(style_t style_type);
00932 bool SetLine(int index, unsigned short width, const Color& color);
00933 bool SetLineCaps(cap_t start, cap_t end = STYLE_LINE_CAP_SAME);
00934 bool SetLineJoin(join_t join, float miter_limit_factor = 0.0f);
00935 bool SetLineScale(bool horiz, bool vert);
00936 bool SetLinePixelHinting(bool pixel_hinting);
00937 bool SetLineNoClose(bool no_close);
00938 bool SetLineFillStyle(const Style& fill_style);
00939 bool SetColor(int index, const Color& color);
00940 bool SetGradient(int index, int pos, const Color& color);
00941 bool SetGradientModes(spread_t spread, interpolation_t interpolation);
00942 bool SetGradientFocal(float focal);
00943 bool SetMatrix(int index, const Matrix& matrix);
00944 bool SetBitmap(sswf_id_t id_ref);
00945 bool SetClipping(void);
00946
00947 ErrorManager::error_code_t Save(Data& data, bool save_alpha, bool save_morph);
00948
00949 public:
00950
00951
00952
00953
00954
00955
00956
00957 static const signed char MAX_GRADIENTS = 15;
00958
00959 bool operator == (const Style& style) const;
00960
00961 private:
00962
00963 ErrorManager& f_error_manager;
00964
00965
00966 style_t f_style;
00967
00968
00969 bool f_morph;
00970
00971
00972 bool f_use_alpha;
00973
00974
00975 unsigned short f_line_width[2];
00976 cap_t f_start_cap_style;
00977 cap_t f_end_cap_style;
00978 join_t f_join_style;
00979 float f_miter_limit_factor;
00980 bool f_no_hscale;
00981 bool f_no_vscale;
00982 bool f_pixel_hinting;
00983 bool f_no_close;
00984 Style * f_fill_style;
00985
00986
00987 Color f_color[2];
00988
00989
00990 sswf_id_t f_bitmap_ref;
00991
00992
00993 Matrix f_matrix[2];
00994
00995
00996 signed char f_gradient;
00997 unsigned char f_gradient_pos[MAX_GRADIENTS * 2];
00998 Color f_gradient_color[MAX_GRADIENTS * 2];
00999 spread_t f_gradient_spread;
01000 interpolation_t f_gradient_interpolation;
01001 signed short f_gradient_focal;
01002 };
01003
01004
01005
01006
01007
01008 class Edges : public MemoryManager, public ItemBase
01009 {
01010 public:
01011
01012
01013 struct edge_t {
01014 long f_x;
01015 long f_y;
01016 long f_ctrl_x;
01017 long f_ctrl_y;
01018
01019 edge_t(void)
01020 {
01021 f_x = 0;
01022 f_y = 0;
01023 f_ctrl_x = LONG_MIN;
01024 f_ctrl_y = LONG_MIN;
01025 }
01026 edge_t(long x, long y)
01027 {
01028 f_x = x;
01029 f_y = y;
01030 f_ctrl_x = LONG_MIN;
01031 f_ctrl_y = LONG_MIN;
01032 }
01033 edge_t(long x, long y, long ctrl_x, long ctrl_y)
01034 {
01035 f_x = x;
01036 f_y = y;
01037 f_ctrl_x = ctrl_x;
01038 f_ctrl_y = ctrl_y;
01039 }
01040 edge_t(const edge_t& edge)
01041 {
01042 f_x = edge.f_x;
01043 f_y = edge.f_y;
01044 f_ctrl_x = edge.f_ctrl_x;
01045 f_ctrl_y = edge.f_ctrl_y;
01046 }
01047 edge_t& operator = (const edge_t& edge)
01048 {
01049 if(this != &edge) {
01050 f_x = edge.f_x;
01051 f_y = edge.f_y;
01052 f_ctrl_x = edge.f_ctrl_x;
01053 f_ctrl_y = edge.f_ctrl_y;
01054 }
01055 return *this;
01056 }
01057 bool IsLine(void) const { return f_ctrl_x == LONG_MIN || f_ctrl_y == LONG_MIN; }
01058 };
01059
01060 public:
01061
01062
01063 enum {
01064
01065 EDGE_BLOCK = 64
01066 };
01067
01068 Edges(void);
01069 virtual ~Edges();
01070
01071
01072 void Set(long x, long y) { edge_t edge(x, y); Set(-1, edge); }
01073 void Set(long x, long y, long ctrl_x, long ctrl_y) { edge_t edge(x, y, ctrl_x, ctrl_y); Set(-1, edge); }
01074 void Set(int index, long x, long y, long ctrl_x, long ctrl_y) { edge_t edge(x, y, ctrl_x, ctrl_y); Set(index, edge); }
01075
01076 void Save(Data& data, long& x, long& y);
01077
01078 public:
01079 void Set(const edge_t& edge) { Set(-1, edge); }
01080 void Set(int index, const edge_t& edge);
01081
01082 private:
01083
01084 struct array_edge_t : public ItemBase {
01085 edge_t f_edge[EDGE_BLOCK];
01086 };
01087
01088
01089 Edges(const Edges& edges) {}
01090 Edges& operator = (const Edges& edges) { return *this; }
01091
01092 void SaveEdge(Data& data, const edge_t& edge, long& x, long& y);
01093
01094 Vectors f_edges;
01095 int f_pos;
01096 array_edge_t f_array;
01097 };
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107 class TagHeader;
01108 class TagBase : public MemoryManager
01109 {
01110 public:
01111
01112 enum swf_tag_t {
01113 SWF_TAG_UNKNOWN = -1,
01114
01115
01116 SWF_TAG_END = 0,
01117 SWF_TAG_SHOW_FRAME = 1,
01118 SWF_TAG_DEFINE_SHAPE = 2,
01119 SWF_TAG_PLACE_OBJECT = 4,
01120 SWF_TAG_REMOVE_OBJECT = 5,
01121 SWF_TAG_DEFINE_BITS = 6,
01122 SWF_TAG_DEFINE_BITS_JPEG = 6,
01123 SWF_TAG_DEFINE_BUTTON = 7,
01124 SWF_TAG_JPEG_TABLES = 8,
01125 SWF_TAG_SET_BACKGROUND_COLOR = 9,
01126 SWF_TAG_DEFINE_FONT = 10,
01127 SWF_TAG_DEFINE_TEXT = 11,
01128 SWF_TAG_DO_ACTION = 12,
01129 SWF_TAG_DEFINE_FONT_INFO = 13,
01130
01131
01132 SWF_TAG_DEFINE_SOUND = 14,
01133 SWF_TAG_START_SOUND = 15,
01134 SWF_TAG_DEFINE_BUTTON_SOUND = 17,
01135 SWF_TAG_SOUND_STREAM_HEAD = 18,
01136 SWF_TAG_SOUND_STREAM_BLOCK = 19,
01137 SWF_TAG_DEFINE_BITS_LOSSLESS = 20,
01138 SWF_TAG_DEFINE_BITS_JPEG2 = 21,
01139 SWF_TAG_DEFINE_SHAPE2 = 22,
01140 SWF_TAG_DEFINE_BUTTON_COLOR_TRANSFORM = 23,
01141 SWF_TAG_PROTECT = 24,
01142
01143
01144 SWF_TAG_PLACE_OBJECT2 = 26,
01145 SWF_TAG_REMOVE_OBJECT2 = 28,
01146 SWF_TAG_DEFINE_SHAPE3 = 32,
01147 SWF_TAG_DEFINE_TEXT2 = 33,
01148 SWF_TAG_DEFINE_BUTTON2 = 34,
01149 SWF_TAG_DEFINE_BITS_JPEG3 = 35,
01150 SWF_TAG_DEFINE_BITS_LOSSLESS2 = 36,
01151 SWF_TAG_DEFINE_SPRITE = 39,
01152 SWF_TAG_PRODUCT_INFO = 41,
01153 SWF_TAG_FRAME_LABEL = 43,
01154 SWF_TAG_SOUND_STREAM_HEAD2 = 45,
01155 SWF_TAG_DEFINE_MORPH_SHAPE = 46,
01156 SWF_TAG_DEFINE_FONT2 = 48,
01157 SWF_TAG_DEFINE_INFO = 49,
01158
01159
01160 SWF_TAG_TEXT_FIELD = 37,
01161
01162
01163 SWF_TAG_EXPORT = 56,
01164 SWF_TAG_IMPORT = 57,
01165 SWF_TAG_PROTECT_DEBUG = 58,
01166
01167
01168 SWF_TAG_DO_INIT_ACTION = 59,
01169 SWF_TAG_DEFINE_FONT_INFO2 = 62,
01170 SWF_TAG_PROTECT_DEBUG2 = 64,
01171
01172
01173 SWF_TAG_SCRIPT_LIMITS = 65,
01174 SWF_TAG_SET_TAB_INDEX = 66,
01175
01176
01177 SWF_TAG_FILE_ATTRIBUTES = 69,
01178 SWF_TAG_PLACE_OBJECT3 = 70,
01179 SWF_TAG_IMPORT2 = 71,
01180 SWF_TAG_DEFINE_FONT_ALIGN_ZONES = 73,
01181 SWF_TAG_CSM_TEXT_SETTINGS = 74,
01182 SWF_TAG_DEFINE_FONT3 = 75,
01183 SWF_TAG_METADATA = 77,
01184 SWF_TAG_DEFINE_SCALING_GRID = 78,
01185 SWF_TAG_DEFINE_SHAPE4 = 83,
01186 SWF_TAG_DEFINE_MORPH_SHAPE2 = 84,
01187
01188
01189 SWF_TAG_ACTIONSCRIPT2 = 72,
01190 SWF_TAG_ACTIONSCRIPT2_INSTANTIATE = 76,
01191 SWF_TAG_ACTIONSCRIPT2_DEFINE = 82,
01192 SWF_TAG_SCENE_FRAME_DATA = 86,
01193 SWF_TAG_DEFINE_BINARY_DATA = 87,
01194 SWF_TAG_DEFINE_FONT_NAME = 88,
01195
01196 SWF_TAG_max
01197 };
01198 typedef long swf_type_t;
01199
01200 #define SWF_TYPE_DEFINE 0x00000001 // a definition tag, must be in the main movie
01201 #define SWF_TYPE_CONTROL 0x00000002 // a control tag, can be in sprites as well
01202 #define SWF_TYPE_UNIQUE 0x00000004 // a unique tag, can't be duplicated in the movie (merge if possible)
01203 #define SWF_TYPE_START 0x00000008 // if present, put it near the start of the movie
01204 #define SWF_TYPE_ONE 0x00000010 // (should) use at most one per frame
01205 #define SWF_TYPE_REFERENCE 0x00000020 // object includes references to other objects
01206 #define SWF_TYPE_HAS_ID 0x00000040 // this object was derived from TagBaseID and has an ID
01207
01208 #define SWF_TYPE_SCRIPT 0x20000000 // object can accept action scripts
01209 #define SWF_TYPE_SPRITE 0x40000000 // this is a sprite (can include other tags)
01210 #define SWF_TYPE_HEADER 0x80000000 // the header
01211
01212 virtual ~TagBase();
01213
01214 ErrorManager::error_code_t SaveString(Data& data, const char *string);
01215 static int SaveTag(Data& data, swf_tag_t tag, size_t size);
01216
01217 static long SIBitSize(long value);
01218 static long UIBitSize(unsigned long value);
01219 static long Double2Signed16(double value);
01220 static long Double2Signed(double value);
01221 static double Signed2Double(long value);
01222
01223 virtual void MinimumVersion(unsigned char version);
01224 virtual unsigned char Version(void) const;
01225
01226 const char * Name(void) const;
01227 const char * Label(void) const;
01228 void ResetFrames(void);
01229 void ShowFrame(void);
01230 sswf_frame_t FrameCount(void) const;
01231
01232 sswf_frame_t WhichFrame(void) const;
01233 void SetLabel(const char *label);
01234 TagBase * FindLabelledTag(const char *label) const;
01235 TagBase * FindTagWithID(sswf_id_t id, bool search_import = true) const;
01236 TagBase * Children(void);
01237 TagBase * Next(void);
01238 TagBase * Previous(void);
01239 TagBase * Parent(void);
01240 TagHeader * Header(void) const;
01241 virtual ErrorManager::error_code_t OnError(ErrorManager::error_code_t errcode, const char *message, va_list ap) const;
01242
01243 public:
01244 virtual ErrorManager::error_code_t Save(Data& data) = 0;
01245 virtual swf_type_t TypeFlags(void) const = 0;
01246 virtual ErrorManager::error_code_t OnError(ErrorManager::error_code_t errcode, const char *message, ...) const;
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257 void * f_userdata;
01258
01259 protected:
01260
01261 TagBase(const char *name, TagBase *parent);
01262 virtual ErrorManager::error_code_t PreSave(void);
01263 virtual ErrorManager::error_code_t PreSave2ndPass(void);
01264
01265 virtual ErrorManager::error_code_t OnNewChild(const char *child_name) const;
01266
01267 private:
01268 TagBase * FindLabel(const TagBase *p, const char *label) const;
01269 TagBase * FindID(const TagBase *p, sswf_id_t id, bool search_import) const;
01270
01271 const char * f_name;
01272 char * f_label;
01273
01274 TagBase * f_parent;
01275 TagBase * f_next;
01276 TagBase * f_previous;
01277 TagBase * f_children;
01278
01279 sswf_frame_t f_frames;
01280 };
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297 class TagHeader : public TagBase, public ErrorManager
01298 {
01299 public:
01300 TagHeader(void);
01301 virtual ~TagHeader();
01302
01303 virtual ErrorManager::error_code_t Save(Data& data);
01304 ErrorManager::error_code_t SaveEncodedString(Data& data, const char *string);
01305 virtual swf_type_t TypeFlags(void) const;
01306 virtual ErrorManager::error_code_t OnError(ErrorManager::error_code_t errcode, const char *message, va_list ap) const;
01307
01308 sswf_id_t NextID(void);
01309 void RemoveID(sswf_id_t id);
01310
01311
01312 virtual unsigned char Version(void) const;
01313 void SetVersion(unsigned char version);
01314 void SetMinimumVersion(unsigned char version);
01315 void SetMaximumVersion(unsigned char version);
01316
01317 void SetCompress(bool compress = true);
01318 void SetAutoOrder(bool auto_order = true);
01319 void SetUseNetwork(bool use_network = true);
01320 void SetFrame(const SRectangle& rect);
01321 const SRectangle& Frame(void) const;
01322
01323 void SetOutputEncoding(const char *encoding);
01324 void SetRate(float rate);
01325 float Rate(void) const;
01326
01327 public:
01328 virtual void MinimumVersion(unsigned char version);
01329 ErrorManager::error_code_t DefineMinimumVersion(int& min_version);
01330 virtual ErrorManager::error_code_t OnError(ErrorManager::error_code_t errcode, const char *message, ...) const;
01331
01332 protected:
01333 virtual ErrorManager::error_code_t PreSave(void);
01334 virtual ErrorManager::error_code_t OnNewChild(const char *child_name) const;
01335
01336 private:
01337
01338 unsigned char f_version;
01339 unsigned char f_min_version;
01340 unsigned char f_minimum_version;
01341 unsigned char f_maximum_version;
01342 SRectangle f_frame;
01343 float f_rate;
01344 bool f_compress;
01345 bool f_auto_order;
01346 bool f_use_network;
01347 bool f_has_metadata;
01348 bool f_has_jpegtables;
01349 sswf_id_t f_next_id;
01350 char * f_output_encoding;
01351 bool f_iconvertor_open;
01352 iconv_t f_iconvertor;
01353 #if DEBUG
01354 bool f_saving;
01355 #endif
01356 };
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386 class ActionLabel;
01387 class Action : public ItemBase
01388 {
01389 public:
01390 enum action_t {
01391 ACTION_UNKNOWN = -1,
01392 ACTION_LABEL = -2,
01393 ACTION_min = 0x00,
01394
01395
01396 ACTION_END = 0x00,
01397 ACTION_NEXT_FRAME = 0x04,
01398 ACTION_PREVIOUS_FRAME = 0x05,
01399 ACTION_PLAY = 0x06,
01400 ACTION_STOP = 0x07,
01401 ACTION_TOGGLE_QUALITY = 0x08,
01402 ACTION_STOP_SOUND = 0x09,
01403 ACTION_ADD = 0x0A,
01404
01405 ACTION_SUBTRACT = 0x0B,
01406 ACTION_MULTIPLY = 0x0C,
01407 ACTION_DIVIDE = 0x0D,
01408 ACTION_EQUAL = 0x0E,
01409 ACTION_LESS_THAN = 0x0F,
01410 ACTION_LOGICAL_AND = 0x10,
01411 ACTION_LOGICAL_OR = 0x11,
01412 ACTION_LOGICAL_NOT = 0x12,
01413 ACTION_STRING_EQUAL = 0x13,
01414 ACTION_STRING_LENGTH = 0x14,
01415 ACTION_SUB_STRING = 0x15,
01416 ACTION_POP = 0x17,
01417 ACTION_INTEGRAL_PART = 0x18,
01418 ACTION_GET_VARIABLE = 0x1C,
01419 ACTION_SET_VARIABLE = 0x1D,
01420 ACTION_SET_TARGET2 = 0x20,
01421 ACTION_CONCATENATE = 0x21,
01422 ACTION_GET_PROPERTY = 0x22,
01423 ACTION_SET_PROPERTY = 0x23,
01424 ACTION_DUPLICATE_SPRITE = 0x24,
01425 ACTION_REMOVE_SPRITE = 0x25,
01426 ACTION_TRACE = 0x26,
01427 ACTION_START_DRAG = 0x27,
01428 ACTION_STOP_DRAG = 0x28,
01429 ACTION_STRING_LESS_THAN = 0x29,
01430 ACTION_THROW = 0x2A,
01431 ACTION_CAST_OBJECT = 0x2B,
01432 ACTION_IMPLEMENTS = 0x2C,
01433 ACTION_FSCOMMAND2 = 0x2D,
01434 ACTION_RANDOM = 0x30,
01435 ACTION_MBSTRING_LENGTH = 0x31,
01436 ACTION_ORD = 0x32,
01437 ACTION_CHR = 0x33,
01438 ACTION_GET_TIMER = 0x34,
01439 ACTION_SUB_MBSTRING = 0x35,
01440 ACTION_MBORD = 0x36,
01441 ACTION_MBCHR = 0x37,
01442 ACTION_DELETE = 0x3A,
01443 ACTION_SET_LOCAL_VAR = 0x3C,
01444 ACTION_SET_LOCAL_VARIABLE = 0x3C,
01445 ACTION_CALL_FUNCTION = 0x3D,
01446 ACTION_RETURN = 0x3E,
01447 ACTION_MODULO = 0x3F,
01448 ACTION_NEW = 0x40,
01449 ACTION_DECLARE_LOCAL_VAR = 0x41,
01450 ACTION_DECLARE_LOCAL_VARIABLE = 0x41,
01451 ACTION_DECLARE_ARRAY = 0x42,
01452 ACTION_DECLARE_OBJECT = 0x43,
01453 ACTION_TYPE_OF = 0x44,
01454 ACTION_GET_TARGET = 0x45,
01455 ACTION_ENUMERATE = 0x46,
01456 ACTION_ADD_TYPED = 0x47,
01457 ACTION_LESS_THAN_TYPED = 0x48,
01458 ACTION_EQUAL_TYPED = 0x49,
01459 ACTION_NUMBER = 0x4A,
01460 ACTION_STRING = 0x4B,
01461 ACTION_DUPLICATE = 0x4C,
01462 ACTION_SWAP = 0x4D,
01463 ACTION_GET_MEMBER = 0x4E,
01464 ACTION_SET_MEMBER = 0x4F,
01465 ACTION_INCREMENT = 0x50,
01466 ACTION_DECREMENT = 0x51,
01467 ACTION_CALL_METHOD = 0x52,
01468 ACTION_NEW_METHOD = 0x53,
01469 ACTION_INSTANCE_OF = 0x54,
01470 ACTION_ENUMERATE_OBJECT = 0x55,
01471 ACTION_AND = 0x60,
01472 ACTION_OR = 0x61,
01473 ACTION_XOR = 0x62,
01474 ACTION_SHIFT_LEFT = 0x63,
01475 ACTION_SHIFT_RIGHT = 0x64,
01476 ACTION_SHIFT_RIGHT_UNSIGNED = 0x65,
01477 ACTION_STRICT_EQUAL = 0x66,
01478 ACTION_GREATER_THAN_TYPED = 0x67,
01479 ACTION_STRING_GREATER_THAN = 0x68,
01480 ACTION_EXTENDS = 0x69,
01481 ACTION_GOTO_FRAME = 0x81,
01482 ACTION_URL = 0x83,
01483 ACTION_STORE_REGISTER = 0x87,
01484 ACTION_DECLARE_DICTIONARY = 0x88,
01485 ACTION_STRICT_MODE = 0x89,
01486 ACTION_WAIT_FOR_FRAME = 0x8A,
01487 ACTION_SET_TARGET = 0x8B,
01488 ACTION_GOTO_LABEL = 0x8C,
01489 ACTION_WAIT_FOR_FRAME2 = 0x8D,
01490 ACTION_DECLARE_FUNCTION2 = 0x8E,
01491 ACTION_TRY = 0x8F,
01492 ACTION_WITH = 0x94,
01493 ACTION_PUSH_DATA = 0x96,
01494 ACTION_BRANCH_ALWAYS = 0x99,
01495 ACTION_URL2 = 0x9A,
01496 ACTION_DECLARE_FUNCTION = 0x9B,
01497 ACTION_BRANCH_IF_TRUE = 0x9D,
01498 ACTION_CALL_FRAME = 0x9E,
01499 ACTION_GOTO_EXPRESSION = 0x9F,
01500
01501 ACTION_max = 0xFF
01502 };
01503
01504 Action(TagBase *tag, action_t action);
01505 virtual ~Action() {}
01506
01507 virtual Action * Duplicate(void) const;
01508 unsigned long Offset(void) const { return f_offset; }
01509 virtual unsigned char Version(void) const { return f_min_version; }
01510
01511 ErrorManager::error_code_t Save(Data& data);
01512 virtual Vectors * SubList(void);
01513 ErrorManager::error_code_t SaveList(const Vectors *list, Data& data, const Vectors *extra = 0);
01514 static int MinimumListVersion(const Vectors& list);
01515 static int GetMaximumRegister(const Vectors& list);
01516 static ActionLabel * FindLabel(const Vectors& list, const char *label);
01517
01518 public:
01519 ErrorManager::error_code_t OnError(ErrorManager::error_code_t errcode, const char *message, ...) const;
01520
01521 protected:
01522 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01523 virtual ErrorManager::error_code_t Save2ndPass(const Vectors& list, Data& data);
01524 virtual int GetMaxRegister(void) const { return 0; }
01525 ErrorManager::error_code_t SaveString(Data& data, const char *string);
01526 TagBase * Tag(void) const { return const_cast<TagBase *>(f_tag); }
01527
01528 const action_t f_action;
01529 unsigned long f_offset;
01530
01531 private:
01532 #if DEBUG
01533
01534
01535
01536
01537 Action(const Action& action);
01538 Action& operator = (const Action& action);
01539 #endif
01540
01541 TagBase * f_tag;
01542 unsigned char f_min_version;
01543 };
01544
01545
01546 class ActionBranch : public Action, public MemoryManager
01547 {
01548 public:
01549
01550
01551
01552
01553 ActionBranch(TagBase *tag, action_t action = ACTION_BRANCH_ALWAYS);
01554
01555 void SetLabel(const char *label);
01556
01557 private:
01558 virtual Action * Duplicate(void) const;
01559 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01560 virtual ErrorManager::error_code_t Save2ndPass(const Vectors& list, Data& data);
01561
01562 char * f_label;
01563 };
01564
01565
01566
01567 class ActionCallFrame : public Action, public MemoryManager
01568 {
01569 public:
01570 ActionCallFrame(TagBase *tag);
01571
01572 private:
01573 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01574 };
01575
01576
01577
01578 class ActionDictionary : public Action, public MemoryManager
01579 {
01580 public:
01581 ActionDictionary(TagBase *tag);
01582
01583 void AddString(const char *string);
01584
01585 private:
01586
01587 struct string_t : public ItemBase
01588 {
01589
01590 char * f_string;
01591 };
01592
01593 virtual Action * Duplicate(void) const;
01594 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01595
01596
01597 Vectors f_strings;
01598 };
01599
01600
01601
01602 class ActionFunction : public Action, public MemoryManager
01603 {
01604 public:
01605
01606
01607
01608
01609 ActionFunction(TagBase *tag, action_t action = ACTION_DECLARE_FUNCTION);
01610
01611 enum action_function_t {
01612 ACTION_FUNCTION_LOAD_THIS = 0x0001,
01613 ACTION_FUNCTION_SUPPRESS_THIS = 0x0002,
01614 ACTION_FUNCTION_LOAD_ARGUMENTS = 0x0004,
01615 ACTION_FUNCTION_SUPPRESS_ARGUMENTS = 0x0008,
01616 ACTION_FUNCTION_LOAD_SUPER = 0x0010,
01617 ACTION_FUNCTION_SUPPRESS_SUPER = 0x0020,
01618 ACTION_FUNCTION_LOAD_ROOT = 0x0040,
01619 ACTION_FUNCTION_LOAD_PARENT = 0x0080,
01620 ACTION_FUNCTION_LOAD_GLOBAL = 0x0100
01621 };
01622
01623 void SetName(const char *name);
01624 void SetRegistersCount(unsigned int count);
01625 void AddParameter(const char *name, int register_number = -1);
01626 void AddAction(Action *action);
01627 virtual Vectors * SubList(void);
01628
01629
01630
01631 enum as_set_prop_flags_t {
01632 PROP_FLAG_IS_HIDDEN = 1,
01633 PROP_FLAG_CAN_DELETE = 2,
01634 PROP_FLAG_CAN_OVERWRITE = 4
01635 };
01636
01637 private:
01638
01639 struct parameter_t : public ItemBase
01640 {
01641
01642 char * f_name;
01643
01644 int f_register_number;
01645 };
01646
01647 virtual Action * Duplicate(void) const;
01648 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01649
01650 char * f_name;
01651 unsigned int f_registers_count;
01652 unsigned short f_flags;
01653 Vectors f_parameters;
01654 Vectors f_actions;
01655 };
01656
01657
01658
01659 class ActionGoto : public Action, public MemoryManager
01660 {
01661 public:
01662
01663
01664
01665
01666
01667 ActionGoto(TagBase *tag, action_t action = ACTION_GOTO_FRAME);
01668
01669 void SetFrameName(const char *frame_name);
01670 void SetPlay(bool play) { f_play = play; }
01671
01672 private:
01673 virtual Action * Duplicate(void) const;
01674 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01675
01676 char * f_frame_name;
01677 bool f_play;
01678 };
01679
01680
01681
01682 class ActionLabel : public Action, public MemoryManager
01683 {
01684 public:
01685 ActionLabel(TagBase *tag);
01686
01687 void SetLabel(const char *label);
01688 const char * GetLabel(void) const { return f_label; }
01689
01690 private:
01691 virtual Action * Duplicate(void) const;
01692
01693
01694 char * f_label;
01695 };
01696
01697
01698
01699
01700 class ActionPushData : public Action, public MemoryManager
01701 {
01702 public:
01703 ActionPushData(TagBase *tag);
01704
01705 void AddEmptyString(void) { AddString(0); }
01706 void AddString(const char *string);
01707 void AddTrue(void) { AddBoolean(true); }
01708 void AddFalse(void) { AddBoolean(false); }
01709 void AddBoolean(bool value);
01710 void AddInteger(long value);
01711 void AddFloat(float value);
01712 void AddDouble(double value);
01713 void AddNull(void);
01714 void AddLookup(unsigned short index);
01715 void AddRegister(unsigned char reg_index);
01716 void AddUndefined(void);
01717
01718 private:
01719 enum action_immediate_type_t
01720 {
01721 ACTION_IMMEDIATE_TYPE_UNKNOWN = -1,
01722 ACTION_IMMEDIATE_TYPE_STRING = 0x00,
01723 ACTION_IMMEDIATE_TYPE_FLOAT = 0x01,
01724 ACTION_IMMEDIATE_TYPE_NULL = 0x02,
01725 ACTION_IMMEDIATE_TYPE_UNDEFINED = 0x03,
01726 ACTION_IMMEDIATE_TYPE_REGISTER = 0x04,
01727 ACTION_IMMEDIATE_TYPE_BOOLEAN = 0x05,
01728 ACTION_IMMEDIATE_TYPE_DOUBLE = 0x06,
01729 ACTION_IMMEDIATE_TYPE_INTEGER = 0x07,
01730 ACTION_IMMEDIATE_TYPE_LOOKUP = 0x08,
01731 ACTION_IMMEDIATE_TYPE_LOOKUP_LARGE = 0x09
01732 };
01733
01734 struct action_immediate_t : public ItemBase
01735 {
01736 action_immediate_type_t f_type;
01737 union
01738 {
01739 char * f_string;
01740 float f_float32;
01741 double f_float64;
01742 bool f_boolean;
01743 long f_integer32;
01744 unsigned short f_lookup;
01745 unsigned char f_register;
01746 } f_data;
01747
01748 action_immediate_t(action_immediate_type_t type)
01749 {
01750 f_type = type;
01751 memset(&f_data, 0, sizeof(f_data));
01752 }
01753 };
01754
01755 virtual Action * Duplicate(void) const;
01756 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01757 virtual int GetMaxRegister(void) const;
01758
01759 Vectors f_data;
01760 };
01761
01762
01763
01764
01765 class ActionSetTarget : public Action, public MemoryManager
01766 {
01767 public:
01768 ActionSetTarget(TagBase *tag);
01769
01770 void SetTarget(const char *target);
01771
01772 private:
01773 virtual Action * Duplicate(void) const;
01774 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01775
01776 char * f_target;
01777 };
01778
01779
01780 class ActionStoreRegister : public Action, public MemoryManager
01781 {
01782 public:
01783 ActionStoreRegister(TagBase *tag);
01784
01785 void SetRegister(unsigned char reg);
01786
01787 private:
01788 virtual Action * Duplicate(void) const;
01789 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01790 virtual int GetMaxRegister(void) const;
01791
01792 unsigned char f_reg;
01793 };
01794
01795
01796 class ActionStrictMode : public Action, public MemoryManager
01797 {
01798 public:
01799 ActionStrictMode(TagBase *tag);
01800
01801 void SetStrict(bool strict);
01802
01803 private:
01804 virtual Action * Duplicate(void) const;
01805 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01806
01807 bool f_strict;
01808 };
01809
01810
01811 class ActionTry : public Action, public MemoryManager
01812 {
01813 public:
01814 ActionTry(TagBase *tag);
01815
01816 void AddTryAction(Action *action);
01817 void AddCatchAction(Action *action);
01818 void AddFinallyAction(Action *action);
01819 void SetIdentifier(int register_number);
01820 void SetIdentifier(const char *variable_name);
01821
01822 Vectors * SubListTry(void);
01823 Vectors * SubListCatch(void);
01824 Vectors * SubListFinally(void);
01825
01826 private:
01827 virtual Action * Duplicate(void) const;
01828 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01829 virtual int GetMaxRegister(void) const;
01830 virtual unsigned char Version(void) const;
01831
01832 int f_register;
01833 char * f_variable_name;
01834 bool f_has_catch;
01835 bool f_has_finally;
01836 Vectors f_actions_try;
01837 Vectors f_actions_catch;
01838 Vectors f_actions_finally;
01839 };
01840
01841
01842
01843 class ActionURL : public Action, public MemoryManager
01844 {
01845 public:
01846
01847
01848
01849
01850 ActionURL(TagBase *tag, action_t action = ACTION_URL);
01851
01852 enum url_method_t {
01853 URL_METHOD_UNDEFINED = -1,
01854 URL_METHOD_NOVARIABLE = 0,
01855 URL_METHOD_NOVARIABLES = URL_METHOD_NOVARIABLE,
01856 URL_METHOD_GET = 1,
01857 URL_METHOD_POST = 2
01858 };
01859
01860 void SetURL(const char *url, const char *target);
01861 void SetMethod(url_method_t method);
01862
01863 private:
01864 virtual Action * Duplicate(void) const;
01865 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01866
01867 char * f_url;
01868 char * f_target;
01869 url_method_t f_method;
01870 };
01871
01872
01873
01874 class ActionWaitForFrame : public Action, public MemoryManager
01875 {
01876 public:
01877
01878
01879
01880
01881 ActionWaitForFrame(TagBase *tag, action_t action = ACTION_WAIT_FOR_FRAME);
01882
01883 void SetFrameName(const char *name);
01884 void AddAction(Action *action);
01885 virtual Vectors * SubList(void);
01886
01887 private:
01888 virtual Action * Duplicate(void) const;
01889 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01890
01891 Vectors f_actions;
01892 char * f_frame_name;
01893 };
01894
01895
01896
01897 class ActionWith : public Action, public MemoryManager
01898 {
01899 public:
01900 ActionWith(TagBase *tag);
01901
01902 void AddAction(Action *action);
01903 virtual Vectors * SubList(void);
01904
01905 private:
01906 virtual Action * Duplicate(void) const;
01907 virtual ErrorManager::error_code_t SaveData(Data& data, Data& nested_data);
01908
01909 Vectors f_actions;
01910 };
01911
01912
01913
01914
01915
01916
01917 class TagDoAction : public TagBase
01918 {
01919 public:
01920
01921
01922
01923
01924 TagDoAction(TagBase *parent);
01925
01926 virtual ErrorManager::error_code_t Save(Data& data);
01927 virtual swf_type_t TypeFlags(void) const;
01928
01929
01930 void SetAction(const Action& action);
01931 void SetSprite(sswf_id_t sprite);
01932 Vectors& Actions(void) { return f_actions; }
01933
01934 private:
01935 virtual ErrorManager::error_code_t PreSave(void);
01936
01937 sswf_id_t f_sprite;
01938 Vectors f_actions;
01939 };
01940
01941
01942
01943
01944
01945 class TagMetadata : public TagBase
01946 {
01947 public:
01948 TagMetadata(TagBase *parent);
01949
01950 virtual ErrorManager::error_code_t Save(Data& data);
01951 virtual swf_type_t TypeFlags(void) const;
01952
01953
01954
01955
01956
01957
01958
01959
01960
01961
01962
01963
01964
01965
01966
01967
01968
01969
01970
01971
01972
01973
01974 void SetFilename(const char *filename);
01975 void SetMetadata(const char *xml);
01976 void SetTitle(const char *title);
01977 void SetDescription(const char *description);
01978 void SetAuthor(const char *description);
01979 void SetPublisher(const char *publisher);
01980 void SetCopyright(const char *copyright);
01981 void SetURL(const char *url);
01982
01983 private:
01984 virtual ErrorManager::error_code_t PreSave(void);
01985
01986 char * f_xml;
01987 char * f_filename;
01988 char * f_title;
01989 char * f_description;
01990 char * f_author;
01991 char * f_publisher;
01992 char * f_copyright;
01993 char * f_url;
01994 };
01995
01996
01997
01998
01999
02000 class TagPlace : public TagBase
02001 {
02002 public:
02003 TagPlace(TagBase *parent);
02004
02005 virtual ErrorManager::error_code_t Save(Data& data);
02006 virtual swf_type_t TypeFlags(void) const;
02007
02008
02009 void SetObjectID(sswf_id_t id);
02010 void SetDepth(int depth);
02011 void SetClip(int depth);
02012 void SetMatrix(const Matrix& matrix);
02013 void SetColorTransform(const ColorTransform& color_transform);
02014 void SetName(const char *name);
02015 void SetMorphPosition(int position);
02016 void SetBlendMode(const BlendMode& blend_mode);
02017 void SetBitmapCaching(int bitmap_caching);
02018 void Replace(void);
02019 void Place(void);
02020 bool AddEvent(Event *event);
02021
02022 private:
02023 virtual ErrorManager::error_code_t PreSave(void);
02024
02025 bool f_id_defined;
02026 sswf_id_t f_id;
02027 int f_replace;
02028 int f_depth;
02029 int f_clip_depth;
02030 char * f_name;
02031 unsigned long f_events_all_flags;
02032 int f_position;
02033 BlendMode f_blend_mode;
02034 int f_bitmap_caching;
02035 bool f_has_matrix;
02036 Matrix f_matrix;
02037 ColorTransform f_color_transform;
02038 Vectors f_events;
02039 };
02040
02041
02042
02043 class TagRemove : public TagBase
02044 {
02045 public:
02046 TagRemove(TagBase *parent);
02047
02048 virtual ErrorManager::error_code_t Save(Data& data);
02049 virtual swf_type_t TypeFlags(void) const;
02050
02051
02052 void SetDepth(int depth) { f_depth = depth; }
02053 void SetObjectID(sswf_id_t id) { f_id = id; }
02054
02055 private:
02056 virtual ErrorManager::error_code_t PreSave(void);
02057
02058 int f_depth;
02059 sswf_id_t f_id;
02060 };
02061
02062
02063
02064 class TagSceneFrameData : public TagBase
02065 {
02066 public:
02067 TagSceneFrameData(TagBase *parent);
02068
02069 virtual ErrorManager::error_code_t Save(Data& data);
02070 virtual swf_type_t TypeFlags(void) const;
02071
02072
02073 bool SetFileData(const char *filename);
02074 void SetSceneFrameData(const char *data, size_t size);
02075
02076 private:
02077 virtual ErrorManager::error_code_t PreSave(void);
02078
02079 char * f_data;
02080 size_t f_size;
02081 };
02082
02083
02084
02085
02086 class TagScriptLimits : public TagBase
02087 {
02088 public:
02089 TagScriptLimits(TagBase *parent);
02090
02091 virtual ErrorManager::error_code_t Save(Data& data);
02092 virtual swf_type_t TypeFlags(void) const;
02093
02094
02095 void SetMaxRecursionDepth(int depth);
02096 void SetTimeoutSeconds(int timeout);
02097 int GetMaxRecursionDepth(void) const;
02098 int GetTimeoutSeconds(void) const;
02099
02100 private:
02101 virtual ErrorManager::error_code_t PreSave(void);
02102
02103 int f_depth;
02104 int f_timeout;
02105 };
02106
02107
02108
02109 class TagSetTabIndex : public TagBase
02110 {
02111 public:
02112 TagSetTabIndex(TagBase *parent);
02113
02114 virtual ErrorManager::error_code_t Save(Data& data);
02115 virtual swf_type_t TypeFlags(void) const;
02116
02117
02118 void SetDepth(int depth);
02119 void SetIndex(int timeout);
02120 int GetDepth(void) const;
02121 int GetIndex(void) const;
02122
02123 private:
02124 virtual ErrorManager::error_code_t PreSave(void);
02125
02126 int f_depth;
02127 int f_index;
02128 };
02129
02130
02131
02132 class TagSetBackgroundColor : public TagBase
02133 {
02134 public:
02135 TagSetBackgroundColor(TagBase *parent);
02136
02137 virtual ErrorManager::error_code_t Save(Data& data);
02138 virtual swf_type_t TypeFlags(void) const;
02139
02140
02141 void SetColor(Color& color);
02142 Color& GetColor(void);
02143
02144 private:
02145 Color f_color;
02146 };
02147
02148
02149 class TagShowFrame : public TagBase
02150 {
02151 public:
02152 TagShowFrame(TagBase *parent);
02153
02154 virtual ErrorManager::error_code_t Save(Data& data);
02155 virtual swf_type_t TypeFlags(void) const;
02156 };
02157
02158
02159 class TagEnd : public TagBase
02160 {
02161 public:
02162 TagEnd(TagBase *parent);
02163
02164 virtual ErrorManager::error_code_t Save(Data& data);
02165 virtual swf_type_t TypeFlags(void) const;
02166 };
02167
02168
02169 class TagFrameLabel : public TagBase
02170 {
02171 public:
02172 TagFrameLabel(TagBase *parent);
02173
02174 virtual ErrorManager::error_code_t Save(Data& data);
02175 virtual swf_type_t TypeFlags(void) const;
02176
02177
02178 void SetFrameLabel(const char *label);
02179
02180 private:
02181 virtual ErrorManager::error_code_t PreSave(void);
02182
02183 char * f_label;
02184 };
02185
02186
02187
02188 class TagExport : public TagBase
02189 {
02190 public:
02191 TagExport(TagBase *parent);
02192
02193 virtual ErrorManager::error_code_t Save(Data& data);
02194 virtual swf_type_t TypeFlags(void) const;
02195
02196
02197 void SetObject(sswf_id_t id, const char *name, const char *used_glyphs);
02198
02199 private:
02200
02201 struct export_t : public ItemBase
02202 {
02203 sswf_id_t f_id;
02204 const char * f_name;
02205 const char * f_used_glyphs;
02206 };
02207
02208 virtual ErrorManager::error_code_t PreSave(void);
02209
02210 Vectors f_objects;
02211 };
02212
02213
02214
02215 class TagImport : public TagBase
02216 {
02217 public:
02218
02219
02220
02221
02222 TagImport(TagBase *parent);
02223
02224 virtual ErrorManager::error_code_t Save(Data& data);
02225 virtual swf_type_t TypeFlags(void) const;
02226 const char * HasID(sswf_id_t id) const;
02227 sswf_id_t HasName(const char *name) const;
02228
02229
02230 void SetURL(const char *url);
02231 void SetFilename(const char *filename);
02232 void AddName(const char *name, const char *type);
02233
02234 private:
02235
02236 struct import_t : public ItemBase
02237 {
02238 sswf_id_t f_id;
02239 const char * f_name;
02240 const char * f_type;
02241 };
02242
02243 virtual ErrorManager::error_code_t PreSave(void);
02244
02245 char * f_url;
02246 char * f_filename;
02247 Vectors f_objects;
02248 };
02249
02250
02251
02252 class TagProtect : public TagBase
02253 {
02254 public:
02255
02256
02257
02258
02259
02260
02261 TagProtect(TagBase *parent);
02262
02263 virtual ErrorManager::error_code_t Save(Data& data);
02264 virtual swf_type_t TypeFlags(void) const;
02265
02266
02267 void SetPassword(const char *password);
02268 void SetEncodedPassword(const char *password);
02269
02270 private:
02271 virtual ErrorManager::error_code_t PreSave(void);
02272
02273 char * f_password;
02274 };
02275
02276
02277
02278 class TagProductInfo : public TagBase
02279 {
02280 public:
02281 TagProductInfo(TagBase *parent);
02282
02283 virtual ErrorManager::error_code_t Save(Data& data);
02284 virtual swf_type_t TypeFlags(void) const;
02285
02286
02287 void SetProduct(long product_id);
02288 void SetEdition(long edition);
02289 void SetVersion(int major, int minor);
02290 void SetBuild(int64_t build_number);
02291 void SetCompileDate(int64_t date);
02292
02293 private:
02294 virtual ErrorManager::error_code_t PreSave(void);
02295
02296 long f_product_id;
02297 long f_edition;
02298 int f_major;
02299 int f_minor;
02300 int64_t f_build_number;
02301 int64_t f_date;
02302 };
02303
02304
02305
02306 class TagInfo : public TagBase
02307 {
02308 public:
02309 TagInfo(TagBase *parent);
02310
02311 virtual ErrorManager::error_code_t Save(Data& data);
02312 virtual swf_type_t TypeFlags(void) const;
02313
02314
02315 void SetInfo(const char *info);
02316 void SetVersion(long version);
02317
02318 private:
02319 virtual ErrorManager::error_code_t PreSave(void);
02320
02321 char * f_info;
02322 long f_version;
02323 };
02324
02325
02326 class TagStartSound : public TagBase
02327 {
02328 public:
02329 TagStartSound(TagBase *parent);
02330
02331 virtual ErrorManager::error_code_t Save(Data& data);
02332 virtual swf_type_t TypeFlags(void) const;
02333
02334
02335 void SetInfo(SoundInfo *sound_info);
02336
02337 private:
02338 virtual ErrorManager::error_code_t PreSave(void);
02339
02340 SoundInfo * f_sound_info;
02341 };
02342
02343
02344
02345
02346
02347
02348
02349
02350 class TagScalingGrid
02351 {
02352 public:
02353 virtual ~TagScalingGrid();
02354
02355 ErrorManager::error_code_t GridSave(Data& data, sswf_id_t id);
02356 ErrorManager::error_code_t GridPreSave(void);
02357
02358 const SRectangle& Grid(void) const;
02359
02360
02361 void SetGrid(const SRectangle& rect);
02362
02363 private:
02364 SRectangle f_grid;
02365 };
02366
02367
02368
02369
02370
02371
02372
02373
02374
02375
02376
02377
02378
02379
02380
02381
02382 class TagBaseID : public TagBase
02383 {
02384 public:
02385 virtual ~TagBaseID();
02386
02387 virtual sswf_id_t Identification(void) const;
02388 void NoIdentification(void);
02389 bool HasIdentification(void) const;
02390
02391 int SaveID(Data& data) const;
02392
02393 public:
02394 TagBaseID(const char *name, TagBase *parent);
02395
02396 private:
02397 sswf_id_t f_id;
02398 bool f_identified;
02399 };
02400
02401
02402
02403
02404
02405 class TagBinaryData : public TagBaseID
02406 {
02407 public:
02408 TagBinaryData(TagBase *parent);
02409 virtual ~TagBinaryData();
02410
02411 virtual ErrorManager::error_code_t Save(Data& data);
02412 virtual swf_type_t TypeFlags(void) const;
02413
02414
02415 void GetData(const char *& data, size_t& size) const;
02416 void SetData(const char *data, size_t size);
02417
02418 private:
02419 virtual ErrorManager::error_code_t PreSave(void);
02420
02421 char * f_data;
02422 size_t f_size;
02423 };
02424
02425
02426
02427
02428 class TagButton : public TagBaseID, public TagScalingGrid
02429 {
02430 public:
02431 TagButton(TagBase *parent);
02432
02433 virtual ErrorManager::error_code_t Save(Data& data);
02434 virtual swf_type_t TypeFlags(void) const;
02435
02436
02437 bool SetState(const State& state);
02438 void SetAction(const Action& action);
02439 void SetMenu(bool menu = true);
02440 Vectors& Actions(void);
02441 bool AddEvent(Event *event);
02442
02443 private:
02444 virtual ErrorManager::error_code_t PreSave(void);
02445
02446 bool f_save_button2;
02447 bool f_menu;
02448 Vectors f_states;
02449 Vectors f_actions;
02450 Vectors f_events;
02451 };
02452
02453
02454
02455 class TagCSMTextSettings
02456 {
02457 public:
02458 enum csm_text_renderer_t {
02459 CSM_TEXT_RENDERER_NORMAL = 0,
02460 CSM_TEXT_RENDERER_FLASH = 1
02461 };
02462 enum csm_text_gridfit_t {
02463 CSM_TEXT_GRIDFIT_NO_GRID = 0,
02464 CSM_TEXT_GRIDFIT_PIXEL = 1,
02465 CSM_TEXT_GRIDFIT_SUBPIXEL = 2
02466 };
02467
02468 TagCSMTextSettings(void);
02469 virtual ~TagCSMTextSettings(void);
02470
02471 bool IsCSMTextSettingsDefined(void) const;
02472
02473 void SetRenderer(csm_text_renderer_t csm_text_renderer);
02474 void SetGridFit(csm_text_gridfit_t csm_text_gridfit);
02475 void SetThickness(float thickness);
02476 void SetSharpness(float sharpness);
02477
02478 protected:
02479
02480 ErrorManager::error_code_t PreSaveCSMTextSettings(void);
02481 ErrorManager::error_code_t SaveCSMTextSettings(Data& data);
02482
02483 private:
02484 csm_text_renderer_t f_csm_text_renderer;
02485 csm_text_gridfit_t f_csm_text_gridfit;
02486 float f_thickness;
02487 float f_sharpness;
02488 };
02489
02490
02491 class TagShape;
02492 class TagFont : public TagBaseID
02493 {
02494 public:
02495 enum font_type_t {
02496 FONT_TYPE_BEST = 0,
02497 FONT_TYPE_ASCII,
02498 FONT_TYPE_UNICODE,
02499 FONT_TYPE_SHIFTJIS,
02500 };
02501 enum font_language_t {
02502 FONT_LANGUAGE_UNKNOWN = -1,
02503 FONT_LANGUAGE_LOCALE = 0,
02504 FONT_LANGUAGE_LATIN = 1,
02505 FONT_LANGUAGE_JAPANESE = 2,
02506 FONT_LANGUAGE_KOREAN = 3,
02507 FONT_LANGUAGE_SIMPLIFIED_CHINESE = 4,
02508 FONT_LANGUAGE_TRADITIONAL_CHINESE = 5,
02509
02510 FONT_LANGUAGE_max = 6
02511 };
02512 enum font_thickness_t {
02513 FONT_THICKNESS_UNKNOWN = -1,
02514 FONT_THICKNESS_THIN = 0,
02515 FONT_THICKNESS_MEDIUM = 1,
02516 FONT_THICKNESS_THICK = 2,
02517
02518 FONT_THICKNESS_max = 3
02519 };
02520 enum font_em_size_t {
02521 FONT_EM_SMALL = 0,
02522 FONT_EM_LARGE = 1
02523 };
02524
02525 #define SSWF_FONT_SPACE_INDEX static_cast<unsigned long>(-1)
02526
02527
02528 struct font_info_t {
02529 sswf_ucs4_t f_glyph;
02530 unsigned short f_saved_index;
02531 unsigned long f_index;
02532 unsigned long f_position;
02533 long f_advance;
02534 bool f_is_empty;
02535 };
02536
02537 TagFont(TagBase *parent);
02538
02539 virtual ErrorManager::error_code_t Save(Data& data);
02540 virtual swf_type_t TypeFlags(void) const;
02541 ErrorManager::error_code_t GlyphInfo(font_info_t& info) const;
02542 bool HasGlyph(void) const;
02543 bool FindGlyph(font_info_t& info, bool mark_empty_in_use = false) const;
02544 const char * FontName(void) const;
02545 long DefaultAscent(void) const;
02546 long DefaultDescent(void) const;
02547 long DefaultLeadingHeight(void) const;
02548 static font_language_t StringToLanguage(const char *language);
02549 static const char * LanguageToString(font_language_t language);
02550
02551
02552
02553
02554
02555
02556
02557
02558
02559 ErrorManager::error_code_t AddGlyph(sswf_ucs4_t name, const TagBase *ref, long advance = LONG_MIN);
02560 void SetName(const char *font_name);
02561 void SetDisplayName(const char *display_name);
02562 void SetCopyright(const char *copyright);
02563 void SetLayout(long ascent, long descent, long leading_height);
02564 void SetDefaultAdvance(long advance);
02565 void SetSpaceAdvance(long advance);
02566 void SetType(font_type_t type);
02567 void SetLanguage(font_language_t language);
02568 void SetBold(bool bold);
02569 void SetItalic(bool italic);
02570 void SetSmallText(bool small_text = true);
02571 void SetThickness(font_thickness_t thickness);
02572 void SetEMSize(font_em_size_t font_em_size);
02573 void SetWide(bool wide);
02574 ErrorManager::error_code_t SetUsedGlyphs(const char *used_glyphs, bool mark_empty_in_use = false);
02575 ErrorManager::error_code_t SetUsedGlyphs(const sswf_ucs4_t *used_glyphs, bool mark_empty_in_use = false);
02576 void SetUsedByEditText(bool used = true);
02577 void AddKern(sswf_ucs4_t code0, sswf_ucs4_t code1, long advance);
02578
02579 private:
02580
02581 struct font_glyph_t : public ItemBase
02582 {
02583 sswf_ucs4_t f_name;
02584 unsigned short f_index;
02585 const TagShape *f_shape;
02586 long f_advance;
02587 bool f_in_use;
02588 };
02589
02590 struct font_kern_t : public ItemBase
02591 {
02592 sswf_ucs4_t f_code[2];
02593 long f_advance;
02594 };
02595
02596 virtual ErrorManager::error_code_t PreSave(void);
02597 virtual ErrorManager::error_code_t PreSave2ndPass(void);
02598
02599 static const char * g_font_language_name[FONT_LANGUAGE_max];
02600 char * f_font_name;
02601 char * f_display_name;
02602 char * f_copyright;
02603 font_language_t f_language;
02604 font_type_t f_type;
02605 bool f_bold;
02606 bool f_italic;
02607 bool f_small_text;
02608 bool f_wide;
02609 bool f_has_wide_char;
02610 bool f_has_wide_offsets;
02611 bool f_has_layout;
02612 bool f_used_by_edit_text;
02613 bool f_define_font2;
02614 font_thickness_t f_thickness;
02615 font_em_size_t f_font_em_size;
02616 long f_ascent;
02617 long f_descent;
02618 long f_leading_height;
02619 long f_default_advance;
02620 long f_space_advance;
02621 long f_offsets_max;
02622 unsigned long * f_offsets;
02623 unsigned long f_count;
02624 Data f_save_glyphs;
02625 Vectors f_glyphs;
02626 Vectors f_kerns;
02627 };
02628
02629
02630
02631
02632
02633 class TagEditText : public TagBaseID, public TagCSMTextSettings
02634 {
02635 public:
02636 enum edit_text_alignment_t {
02637 EDIT_TEXT_ALIGNMENT_LEFT = 0,
02638 EDIT_TEXT_ALIGNMENT_RIGHT = 1,
02639 EDIT_TEXT_ALIGNMENT_CENTER = 2,
02640 EDIT_TEXT_ALIGNMENT_JUSTIFY = 3
02641 };
02642
02643 TagEditText(TagBase *parent);
02644
02645 virtual ErrorManager::error_code_t Save(Data& data);
02646 virtual swf_type_t TypeFlags(void) const;
02647
02648
02649 void SetText(const char *text);
02650 void SetVariableName(const char *name);
02651 void SetFont(const TagFont *font, long height);
02652 void SetMargins(long left, long right);
02653 void SetBounds(const SRectangle& bounds);
02654 void SetAlign(edit_text_alignment_t align);
02655 void SetIndent(long indent);
02656 void SetLeading(long leading);
02657 void SetColor(Color& color);
02658 void SetMaxLength(long length);
02659 void SetWordWrap(bool status = true);
02660 void SetMultiline(bool status = true);
02661 void SetPassword(bool status = true);
02662 void SetReadOnly(bool status = true);
02663 void SetNoSelect(bool status = true);
02664 void SetBorder(bool status = true);
02665 void SetOutline(bool status = true);
02666 void SetHTML(bool status = true);
02667 void SetAutoSize(bool status = true);
02668 void SetUsedGlyphs(const char *lists);
02669 void AddUsedString(const char *string);
02670
02671 private:
02672 virtual ErrorManager::error_code_t PreSave(void);
02673
02674 SRectangle f_bounds;
02675 edit_text_alignment_t f_align;
02676 long f_left_margin;
02677 long f_right_margin;
02678 long f_indent;
02679 long f_leading;
02680 const TagFont * f_font;
02681 unsigned short f_font_height;
02682 long f_max_length;
02683 char * f_var_name;
02684 char * f_text;
02685 sswf_ucs4_t * f_used_glyphs;
02686 sswf_ucs4_t * f_used_strings;
02687 Color f_color;
02688 bool f_has_color;
02689 bool f_word_wrap;
02690 bool f_multiline;
02691 bool f_password;
02692 bool f_readonly;
02693 bool f_no_select;
02694 bool f_border;
02695 bool f_outline;
02696 bool f_html;
02697 bool f_autosize;
02698 };
02699
02700
02701 class TagImage : public TagBaseID
02702 {
02703 public:
02704 enum image_format_t {
02705 IMAGE_FORMAT_UNKNOWN = 0,
02706 IMAGE_FORMAT_LOSSLESS_BEST,
02707 IMAGE_FORMAT_LOSSLESS_8,
02708 IMAGE_FORMAT_LOSSLESS_16,
02709 IMAGE_FORMAT_LOSSLESS_32,
02710 IMAGE_FORMAT_JPEG,
02711 IMAGE_FORMAT_max
02712 };
02713
02714 struct image_t {
02715 bool f_alpha;
02716 long f_width;
02717 long f_height;
02718 unsigned char * f_data;
02719 };
02720
02721 TagImage(TagBase *parent);
02722
02723
02724 virtual ErrorManager::error_code_t Save(Data& data);
02725 virtual swf_type_t TypeFlags(void) const;
02726 void GetImageData(image_t& image_data) { image_data = f_image; }
02727
02728
02729 void SetFormat(image_format_t format) { f_format = format; }
02730 void SetQuality(int quality) { f_quality = quality; }
02731 ErrorManager::error_code_t SetFilename(const char *image, const char *mask);
02732 void SetImage(long width, long height, unsigned char *data, bool alpha = false, long count = 0, unsigned char *colormap = 0);
02733
02734 ErrorManager::error_code_t LoadTGA(const char *filename, image_t& im);
02735 ErrorManager::error_code_t LoadJPEG(const char *filename, image_t& im);
02736 ErrorManager::error_code_t SaveJPEG(Data& encoding, Data& image);
02737 ErrorManager::error_code_t SetAlpha(image_t& im, const image_t& mask);
02738
02739 private:
02740 virtual ErrorManager::error_code_t PreSave(void);
02741
02742 image_format_t f_format;
02743 image_t f_image;
02744 int f_quality;
02745 long f_count;
02746 unsigned char * f_colormap;
02747 };
02748
02749
02750
02751 class TagShape : public TagBaseID
02752 {
02753 public:
02754 enum morph_t {
02755 MORPH_MODE_SHAPE0 = 0,
02756 MORPH_MODE_SHAPE1 = 1,
02757 MORPH_MODE_BOTH_SHAPES = 2
02758 };
02759 enum fill_t {
02760 SHAPE_FILL_EVEN = 0,
02761 SHAPE_FILL_ODD = 1
02762 };
02763
02764 TagShape(TagBase *parent);
02765
02766 virtual ErrorManager::error_code_t Save(Data& data);
02767 virtual swf_type_t TypeFlags(void) const;
02768 ErrorManager::error_code_t SaveWithoutStyles(Data& data);
02769 void SaveAlignZone(Data& data) const;
02770 bool HasAlignZone(void) const;
02771 bool HasBounds(void) const { return !f_bounds[0].IsEmpty() || !f_bounds[1].IsEmpty(); }
02772 const SRectangle& Bounds(int index) const { assert(index == 0 || index == 1, "invalid index to query bounds"); return f_bounds[index]; }
02773 bool IsGlyph(void) const;
02774 bool IsEmpty(void) const;
02775
02776
02777
02778 ErrorManager::error_code_t AddMove(morph_t morph_mode, long x, long y);
02779 ErrorManager::error_code_t AddEdge(morph_t morph_mode, long x, long y) { Edges::edge_t edge(x, y); return AddEdge(morph_mode, edge); }
02780 ErrorManager::error_code_t AddEdge(morph_t morph_mode, long x, long y, long ctrl_x, long ctrl_y) { Edges::edge_t edge(x, y, ctrl_x, ctrl_y); return AddEdge(morph_mode, edge); };
02781 void NewStyles(void);
02782 ErrorManager::error_code_t AddStyle(const Style& style, fill_t fill = SHAPE_FILL_EVEN);
02783 void SetAlignZone(const SRectangle& zone);
02784 ErrorManager::error_code_t SetBounds(int index, const SRectangle& rect, bool show = false);
02785 ErrorManager::error_code_t SetStrokesBounds(int index, const SRectangle& rect);
02786 void ShowBounds(bool show = true) { f_show_bounds = show; }
02787 void ShowOrigin(bool show = true) { f_show_origin = show; }
02788 void SetNonScalingStrokes(bool has_non_scaling_strokes) { f_has_non_scaling_strokes = has_non_scaling_strokes; }
02789 void SetScalingStrokes(bool has_scaling_strokes) { f_has_scaling_strokes = has_scaling_strokes; }
02790 void Glyph(void);
02791
02792 bool HasShowBounds(void) const { return f_show_bounds; }
02793
02794 public:
02795 ErrorManager::error_code_t AddEdge(morph_t morph_mode, const Edges::edge_t& edge);
02796
02797 private:
02798 enum what_t {
02799 SHAPE_EDGES,
02800 SHAPE_SETUP
02801 };
02802
02803
02804 struct shape_what_t : public ItemBase
02805 {
02806 what_t f_what;
02807 shape_what_t(what_t what) { f_what = what; }
02808 };
02809
02810 struct shape_edges_t : public shape_what_t
02811 {
02812 Edges f_edges;
02813 shape_edges_t(what_t what) : shape_what_t(what) {}
02814 };
02815
02816 struct shape_setup_t : public shape_what_t
02817 {
02818 int f_fill_ref[2];
02819 int f_line_ref;
02820 long f_x;
02821 long f_y;
02822
02823 shape_setup_t(what_t what, bool origin = false) : shape_what_t(what)
02824 {
02825 f_fill_ref[0] = f_fill_ref[1] = f_line_ref = -1;
02826 if(origin) {
02827 f_x = f_y = 0;
02828 }
02829 else {
02830 f_x = f_y = LONG_MIN;
02831 }
02832 }
02833 };
02834
02835
02836 struct shape_record_t : public ItemBase {
02837 Vectors * f_fill_styles;
02838 Vectors * f_line_styles;
02839 Vectors * f_record;
02840 };
02841
02842
02843 struct save_info_t {
02844 shape_record_t f_sr;
02845 bool f_save_alpha;
02846 bool f_ext_size;
02847 bool f_first;
02848 bool f_save_styles;
02849 bool f_shape4;
02850 Data f_data;
02851 int f_fill_bits_count;
02852 int f_line_bits_count;
02853 };
02854
02855 void RecordEdges(void);
02856 void RecordSetup(void);
02857 void NewEdges(void);
02858 void NewSetup(void);
02859 void SetMorph(void);
02860
02861
02862 virtual ErrorManager::error_code_t PreSave(void);
02863 ErrorManager::error_code_t SaveShape(save_info_t& info, shape_setup_t& last_setup);
02864
02865 ErrorManager::error_code_t SaveSetup(save_info_t& info, const shape_setup_t& setup, shape_setup_t& last);
02866 ErrorManager::error_code_t SaveStyles(save_info_t& info);
02867 ErrorManager::error_code_t SaveStylesCount(save_info_t& info, long count);
02868
02869 unsigned char f_version;
02870 bool f_morph;
02871 bool f_is_glyph;
02872 bool f_show_bounds;
02873 bool f_show_origin;
02874 bool f_has_non_scaling_strokes;
02875 bool f_has_scaling_strokes;
02876 SRectangle f_align_zone;
02877 SRectangle f_bounds[2];
02878 SRectangle f_strokes_bounds[2];
02879
02880 Vectors f_shapes;
02881
02882 shape_edges_t * f_edges;
02883 shape_edges_t * f_morph_edges;
02884 shape_setup_t * f_setup;
02885 Vectors f_fill_styles;
02886 Vectors f_line_styles;
02887 Vectors f_record;
02888 Vectors f_morph_record;
02889 };
02890
02891
02892
02893 class TagSound : public TagBaseID
02894 {
02895 public:
02896 enum sound_format_t {
02897 SOUND_FORMAT_UNKNOWN = -1,
02898 SOUND_FORMAT_RAW = 0,
02899 SOUND_FORMAT_ADPCM = 1,
02900 SOUND_FORMAT_MP3 = 2,
02901 SOUND_FORMAT_UNCOMPRESSED = 3,
02902 SOUND_FORMAT_NELLYMOSER = 6
02903 };
02904 enum sound_endian_t {
02905 SOUND_ENDIAN_LITTLE = 0,
02906 SOUND_ENDIAN_BIG,
02907 SOUND_ENDIAN_SAME,
02908 SOUND_ENDIAN_DONTUSE,
02909 SOUND_ENDIAN_UNKNOWN
02910 };
02911
02912 TagSound(TagBase *parent);
02913
02914 virtual ErrorManager::error_code_t Save(Data& data);
02915 virtual swf_type_t TypeFlags(void) const;
02916
02917 size_t GetSamplesCount(void) const;
02918
02919
02920 ErrorManager::error_code_t SetFilename(const char *filename);
02921 void SetFormat(sound_format_t format);
02922 int SetData(const void *data, size_t size, sound_endian_t endian, int width, unsigned int rate, bool stereo);
02923 void SetMono(void);
02924 void Set8Bits(void);
02925
02926 public:
02927 static const int g_sound_rates[4];
02928
02929 private:
02930
02931 struct sound_wave_t {
02932 short format;
02933 short channels;
02934 int rate;
02935 int average_rate;
02936 short align;
02937
02938 short width;
02939 };
02940
02941 virtual ErrorManager::error_code_t PreSave(void);
02942 short ReadSample(const unsigned char *data, unsigned short adjust, int in_fmt);
02943 void Resample(unsigned char *snd, unsigned int out_bytes, const unsigned char *src, size_t size, unsigned int in_bytes, size_t max, double fix, unsigned short adjust, int in_fmt);
02944 int LoadWaveFile(FILE *f);
02945 int LoadMP3File(FILE *f);
02946 int CheckMP3Header(FILE *f, unsigned char *header, int& frame_size);
02947 int ReadMP3Header(FILE *f, unsigned char *header);
02948
02949 static const int g_bitrates[2][16];
02950 static const int g_frequencies[4][4];
02951
02952 sound_format_t f_format;
02953 bool f_stereo;
02954 int f_rate;
02955 int f_width;
02956 size_t f_samples;
02957 int f_data_size;
02958 int f_data_maxsize;
02959 unsigned char * f_data;
02960 int f_latency_seek;
02961 };
02962
02963
02964
02965
02966
02967
02968 class TagSprite : public TagBaseID, public TagScalingGrid
02969 {
02970 public:
02971 TagSprite(TagBase *parent);
02972
02973 virtual ErrorManager::error_code_t Save(Data& data);
02974 virtual swf_type_t TypeFlags(void) const;
02975
02976
02977
02978
02979
02980
02981
02982
02983
02984 protected:
02985 virtual ErrorManager::error_code_t OnNewChild(const char *child_name) const;
02986
02987 private:
02988 virtual ErrorManager::error_code_t PreSave(void);
02989 };
02990
02991
02992
02993
02994 class TagText : public TagBaseID, public TagCSMTextSettings
02995 {
02996 public:
02997 TagText(TagBase *parent);
02998
02999 virtual ErrorManager::error_code_t Save(Data& data);
03000 virtual swf_type_t TypeFlags(void) const;
03001
03002
03003 void SetMatrix(const Matrix& matrix);
03004 void SetBounds(const SRectangle& bounds);
03005 ErrorManager::error_code_t AddText(const char *string, long advance = LONG_MIN);
03006 void AddFont(const TagFont *font, long height);
03007 void AddOffsets(long x, long y);
03008 void AddColor(Color& color);
03009
03010 private:
03011 enum text_type_t {
03012 TEXT_ENTRY_TEXT = 0,
03013 TEXT_ENTRY_SETUP
03014 };
03015
03016
03017 struct text_define_t : public ItemBase {
03018 const text_type_t f_type;
03019
03020 text_define_t(text_type_t type) : f_type(type) {}
03021 };
03022
03023
03024 struct text_setup_t : public text_define_t {
03025 bool f_has_font;
03026 const TagFont * f_font;
03027 unsigned short f_font_height;
03028 bool f_has_xadjust;
03029 long f_xadjust;
03030 bool f_has_xoffset;
03031 long f_x;
03032 bool f_has_yoffset;
03033 long f_y;
03034 bool f_has_color;
03035 Color f_color;
03036
03037 text_setup_t(void);
03038 text_setup_t(const text_setup_t& setup);
03039 void Unused(void);
03040 bool IsUsed(void) const;
03041 };
03042
03043
03044 struct text_entry_t : public text_define_t {
03045 sswf_ucs4_t * f_text;
03046 long f_advance;
03047 unsigned long f_length;
03048 unsigned long f_exact_length;
03049 TagFont::font_info_t * f_entries;
03050
03051 text_entry_t(sswf_ucs4_t *string, long advance);
03052 };
03053
03054 virtual ErrorManager::error_code_t PreSave(void);
03055 int DefineText(int start, text_setup_t *s, const TagFont *font, int font_height);
03056 ErrorManager::error_code_t RecordSetup(void);
03057 void NewSetup(void);
03058
03059 Matrix f_matrix;
03060 SRectangle f_bounds;
03061 text_setup_t f_setup;
03062 bool f_new_text;
03063 int f_version;
03064 Vectors f_records;
03065 };
03066
03067
03068
03069
03070
03071
03072
03073
03074
03075 };
03076 #endif