|
From: Bradley D. L. <br...@lt...> - 2002-08-19 17:02:53
|
I don't know what the procedure for getting stuff into CVS is,
so I send this patch to the list. Please tell me if there is
a preferred way. Thank you.
Regards,
Brad
--- ming.h 18 Aug 2002 20:16:42 -0000 1.26
+++ ming.h 19 Aug 2002 16:54:09 -0000
@@ -275,7 +275,7 @@
/* SWFBrowserFont */
-SWFFont newSWFBrowserFont(char *name);
+SWFFont newSWFBrowserFont(const char *name);
void destroySWFBrowserFont(SWFFont font);
@@ -378,7 +378,7 @@
typedef void *SWFAction;
-SWFAction compileSWFActionCode(char *script);
+SWFAction compileSWFActionCode(const char *script);
void destroySWFAction(SWFAction action);
@@ -648,6 +648,10 @@
void SWFMovie_setDimension(SWFMovie movie, float x, float y);
void SWFMovie_setNumberOfFrames(SWFMovie movie, int frames);
+
+int SWFMovie_getCurrentFrame(SWFMovie movie);
+
+int SWFMovie_getRate(SWFMovie movie);
void SWFMovie_addExport(SWFMovie movie, SWFBlock block, char *name);
--- mingpp.h 22 Jul 2002 22:37:22 -0000 1.13
+++ mingpp.h 19 Aug 2002 16:54:16 -0000
@@ -17,6 +17,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifndef MINGPP_H
+#define MINGPP_H
+
#include <stdio.h>
/* mask the c type names so that we can replace them with classes.
@@ -98,7 +101,7 @@
class SWFBlock
{
public:
- virtual c_SWFBlock getBlock()
+ virtual c_SWFBlock getBlock() const
{ return NULL; }
};
@@ -110,13 +113,13 @@
public:
c_SWFCharacter character;
- float getWidth()
+ float getWidth() const
{ return SWFCharacter_getWidth(this->character); }
- float getHeight()
+ float getHeight() const
{ return SWFCharacter_getHeight(this->character); }
- virtual c_SWFBlock getBlock()
+ virtual c_SWFBlock getBlock() const
{ return NULL; }
};
@@ -128,13 +131,13 @@
public:
c_SWFAction action;
- SWFAction(char *script)
+ SWFAction(const char *script)
{ this->action = compileSWFActionCode(script); }
// movies, buttons, etc. destroy the c_SWFAction..
virtual ~SWFAction() {}
- c_SWFBlock getBlock()
+ c_SWFBlock getBlock() const
{ return (c_SWFBlock)this->action; }
};
@@ -158,7 +161,7 @@
void rotateTo(float degrees)
{ SWFDisplayItem_rotateTo(this->item, degrees); }
- void getRotation(float *degrees)
+ void getRotation(float *degrees) const
{ SWFDisplayItem_getRotation(this->item, degrees); }
void move(float x, float y)
@@ -167,7 +170,7 @@
void moveTo(float x, float y)
{ SWFDisplayItem_moveTo(this->item, x, y); }
- void getPosition(float *x, float *y)
+ void getPosition(float *x, float *y) const
{ SWFDisplayItem_getPosition(this->item, x, y); }
void scale(float xScale, float yScale)
@@ -182,7 +185,7 @@
void scaleTo(float scale)
{ SWFDisplayItem_scaleTo(this->item, scale, scale); }
- void getScale(float *xScale, float *yScale)
+ void getScale(float *xScale, float *yScale) const
{ SWFDisplayItem_getScale(this->item, xScale, yScale); }
void skewX(float skew)
@@ -197,10 +200,10 @@
void skewYTo(float skew)
{ SWFDisplayItem_skewYTo(this->item, skew); }
- void getSkew(float *xSkew, float *ySkew)
+ void getSkew(float *xSkew, float *ySkew) const
{ SWFDisplayItem_getSkew(this->item, xSkew, ySkew); }
- int getDepth()
+ int getDepth() const
{ return SWFDisplayItem_getDepth(this->item); }
void setDepth(int depth)
@@ -273,6 +276,12 @@
void setFrames(int nFrames)
{ SWFMovie_setNumberOfFrames(this->movie, nFrames); }
+ int getCurrentFrame() const
+ { return SWFMovie_getCurrentFrame(this->movie); }
+
+ int getRate() const
+ { return SWFMovie_getRate(this->movie); }
+
void setBackground(int r, int g, int b)
{ SWFMovie_setBackground(this->movie, r, g, b); }
@@ -291,10 +300,10 @@
void labelFrame(char *label)
{ SWFMovie_labelFrame(this->movie, label); }
- int output()
- { return SWFMovie_output(this->movie, fileOutputMethod, stdout); }
+ int output(FILE * f = stdout) const
+ { return SWFMovie_output(this->movie, fileOutputMethod, f); }
- int save(const char *filename)
+ int save(const char *filename) const
{
FILE *fp = fopen(filename, "wb");
const int result = SWFMovie_output(this->movie, fileOutputMethod, fp);
@@ -392,7 +401,7 @@
public:
c_SWFBitmap bitmap;
- SWFBitmap(char *filename, char *alpha=NULL)
+ SWFBitmap(const char *filename, const char *alpha=NULL)
{
if(strlen(filename) > 4)
{
@@ -419,10 +428,10 @@
virtual ~SWFBitmap()
{ destroySWFBitmap(this->bitmap); }
- float getWidth()
+ float getWidth() const
{ return SWFBitmap_getWidth(this->bitmap); }
- float getHeight()
+ float getHeight() const
{ return SWFBitmap_getHeight(this->bitmap); }
};
@@ -440,7 +449,7 @@
SWFFont(FILE *file)
{ this->font = loadSWFFontFromFile(file); }
- SWFFont(char *name)
+ SWFFont(const char *name)
{
if(strlen(name) > 4 &&
strcmp(name + strlen(name) - 4, ".fdb") == 0)
@@ -452,22 +461,22 @@
virtual ~SWFFont()
{ destroySWFFont(this->font); }
- c_SWFBlock getBlock()
+ c_SWFBlock getBlock() const
{ return (c_SWFBlock)this->font; }
- float getStringWidth(char *string)
+ float getStringWidth(char *string) const
{ return SWFFont_getStringWidth(this->font, string); }
- float getWidth(char *string)
+ float getWidth(char *string) const
{ return SWFFont_getStringWidth(this->font, string); }
- float getAscent()
+ float getAscent() const
{ return SWFFont_getAscent(this->font); }
- float getDescent()
+ float getDescent() const
{ return SWFFont_getDescent(this->font); }
- float getLeading()
+ float getLeading() const
{ return SWFFont_getLeading(this->font); }
};
@@ -488,7 +497,7 @@
virtual ~SWFShape()
{ destroySWFShape(this->shape); }
- c_SWFBlock getBlock()
+ c_SWFBlock getBlock() const
{ return (c_SWFBlock)this->shape; }
void movePen(float x, float y)
@@ -518,19 +527,19 @@
void end()
{ SWFShape_end(this->shape); }
- SWFFill *addSolidFill(int r, int g, int b, int a=0xff)
+ SWFFill *addFill(int r, int g, int b, int a=0xff)
{ return new SWFFill(SWFShape_addSolidFill(this->shape, r, g, b, a)); }
- SWFFill *addGradientFill(SWFGradient *gradient, byte flags=0)
+ SWFFill *addFill(const SWFGradient *gradient, byte flags=0)
{ return new SWFFill(SWFShape_addGradientFill(this->shape, gradient->gradient, flags)); }
- SWFFill *addBitmapFill(SWFBitmap *bitmap, byte flags=0)
+ SWFFill *addFill(const SWFBitmap *bitmap, byte flags=0)
{ return new SWFFill(SWFShape_addBitmapFill(this->shape, bitmap->bitmap, flags)); }
- void setLeftFill(SWFFill *fill)
+ void setLeftFill(const SWFFill *fill)
{ SWFShape_setLeftFill(this->shape, fill->fill); }
- void setRightFill(SWFFill *fill)
+ void setRightFill(const SWFFill *fill)
{ SWFShape_setRightFill(this->shape, fill->fill); }
void setLine(unsigned short width, int r, int g, int b, int a=0xff)
@@ -542,7 +551,7 @@
void drawCircle(float r)
{ SWFShape_drawCircle(this->shape, r); }
- void drawGlyph(SWFFont *font, unsigned char c, int size=0)
+ void drawGlyph(const SWFFont *font, unsigned char c, int size=0)
{ SWFShape_drawSizedGlyph(this->shape, font->font, c, size); }
// deprecated?
@@ -564,7 +573,7 @@
virtual ~SWFSprite()
{ destroySWFMovieClip(this->clip); }
- c_SWFBlock getBlock()
+ c_SWFBlock getBlock() const
{ return (c_SWFBlock)this->clip; }
void setNumberOfFrames(int nFrames)
@@ -597,7 +606,7 @@
virtual ~SWFMorph()
{ destroySWFMorph(this->morph); }
- c_SWFBlock getBlock()
+ c_SWFBlock getBlock() const
{ return (c_SWFBlock)this->morph; }
SWFShape *getShape1()
@@ -621,10 +630,10 @@
virtual ~SWFText()
{ destroySWFText(this->text); }
- c_SWFBlock getBlock()
+ c_SWFBlock getBlock() const
{ return (c_SWFBlock)this->text; }
- void setFont(SWFBlock *font)
+ void setFont(const SWFBlock *font)
{ SWFText_setFont(this->text, font->getBlock()); }
void setHeight(float height)
@@ -643,10 +652,10 @@
void setSpacing(float spacing)
{ SWFText_setSpacing(this->text, spacing); }
- float getStringWidth(const char *string)
+ float getStringWidth(const char *string) const
{ return SWFText_getStringWidth(this->text, string); }
- float getWidth(const char *string)
+ float getWidth(const char *string) const
{ return SWFText_getStringWidth(this->text, string); }
};
@@ -663,7 +672,7 @@
virtual ~SWFTextField()
{ destroySWFTextField(this->textField); }
- c_SWFBlock getBlock()
+ c_SWFBlock getBlock() const
{ return (c_SWFBlock)this->textField; }
void setFont(SWFBlock *font)
@@ -723,12 +732,26 @@
virtual ~SWFButton()
{ destroySWFButton(this->button); }
- c_SWFBlock getBlock()
+ c_SWFBlock getBlock() const
{ return (c_SWFBlock)this->button; }
- void addShape(SWFCharacter *character, byte flags)
+ void addShape(const SWFCharacter *character, byte flags)
{ SWFButton_addShape(this->button, (c_SWFCharacter)character->getBlock(), flags); }
- void addAction(SWFAction *action, int flags)
+ void setUp(const SWFCharacter *character)
+ { SWFButton_addShape(this->button, (c_SWFCharacter)character->getBlock(), SWFBUTTON_UP); }
+
+ void setOver(const SWFCharacter *character)
+ { SWFButton_addShape(this->button, (c_SWFCharacter)character->getBlock(), SWFBUTTON_OVER); }
+
+ void setDown(const SWFCharacter *character)
+ { SWFButton_addShape(this->button, (c_SWFCharacter)character->getBlock(), SWFBUTTON_DOWN); }
+
+ void setHit(const SWFCharacter *character)
+ { SWFButton_addShape(this->button, (c_SWFCharacter)character->getBlock(), SWFBUTTON_HIT); }
+
+ void addAction(const SWFAction *action, int flags)
{ SWFButton_addAction(this->button, action->action, flags); }
};
+
+#endif // MINGPP_H
--- src/movie.c 19 Aug 2002 15:58:02 -0000 1.18
+++ src/movie.c 19 Aug 2002 16:54:20 -0000
@@ -132,6 +132,15 @@
return newSWFMovieWithVersion(SWF_versionNum);
}
+int SWFMovie_getCurrentFrame(SWFMovie movie)
+{
+ return movie->nFrames;
+}
+
+int SWFMovie_getRate(SWFMovie movie)
+{
+ return movie->rate;
+}
void
SWFMovie_setRate(SWFMovie movie, float rate)
--- src/movie.h 18 Aug 2002 20:16:42 -0000 1.13
+++ src/movie.h 19 Aug 2002 16:54:22 -0000
@@ -42,6 +42,9 @@
void
SWFMovie_setRate(SWFMovie movie, float rate);
+int
+SWFMovie_getRate(SWFMovie movie);
+
void
SWFMovie_setDimension(SWFMovie movie, float x, float y);
@@ -74,6 +77,9 @@
void
SWFMovie_nextFrame(SWFMovie movie);
+
+int
+SWFMovie_getCurrentFrame(SWFMovie movie);
void
SWFMovie_labelFrame(SWFMovie movie, char *label);
--- src/actioncompiler/compile.h 22 Jul 2002 22:37:23 -0000 1.8
+++ src/actioncompiler/compile.h 19 Aug 2002 16:54:22 -0000
@@ -73,7 +73,7 @@
void checkByteOrder();
/* This is the only function needs be visible: */
-SWFAction compileSWFActionCode(char *script);
+SWFAction compileSWFActionCode(const char *script);
/* create/destroy buffer object */
Buffer newBuffer();
@@ -117,8 +117,8 @@
void bufferResolveJumps(Buffer out);
/* rather than setting globals... */
-void swf4ParseInit(char *string, int debug);
-void swf5ParseInit(char *string, int debug);
+void swf4ParseInit(const char *string, int debug);
+void swf5ParseInit(const char *string, int debug);
int swf4parse(void *b);
int swf5parse(void *b);
--- src/actioncompiler/compileaction.c 7 Aug 2002 23:33:44 -0000 1.7
+++ src/actioncompiler/compileaction.c 19 Aug 2002 16:54:22 -0000
@@ -30,7 +30,7 @@
extern int SWF_versionNum;
-SWFAction compileSWFActionCode(char *script)
+SWFAction compileSWFActionCode(const char *script)
{
SWFOutput output;
Buffer b;
Index: src/actioncompiler/swf4compiler.flex
--- src/actioncompiler/swf4compiler.flex 26 Jul 2001 00:10:56 -0000 1.5
+++ src/actioncompiler/swf4compiler.flex 19 Aug 2002 16:54:23 -0000
@@ -9,7 +9,7 @@
int swf4debug;
-static char *lexBuffer = NULL;
+static const char *lexBuffer = NULL;
static int lexBufferLen = 0;
static int sLineNumber = 0;
@@ -58,7 +58,7 @@
}
}
-void swf4ParseInit(char *script, int debug)
+void swf4ParseInit(const char *script, int debug)
{
checkByteOrder();
yyrestart(NULL);
--- src/actioncompiler/swf5compiler.flex 18 Jul 2001 01:05:41 -0000 1.5
+++ src/actioncompiler/swf5compiler.flex 19 Aug 2002 16:54:26 -0000
@@ -9,7 +9,7 @@
int swf5debug;
-static char *lexBuffer = NULL;
+static const char *lexBuffer = NULL;
static int lexBufferLen = 0;
static int sLineNumber = 0;
@@ -59,7 +59,7 @@
}
}
-void swf5ParseInit(char *script, int debug)
+void swf5ParseInit(const char *script, int debug)
{
checkByteOrder();
yyrestart(NULL);
|