Ejemplo n.º 1
0
void
add_text_field(SWFMovie mo, const char* name, const char* varname, const char* initial_label, int depth, int x, int y)
{
	SWFDisplayItem it;
	SWFTextField tf = newSWFTextField();
	SWFTextField_setFont(tf, (void*)font);
	SWFTextField_addChars(tf, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345689:.,/\\#@?!");
	SWFTextField_setVariableName(tf, varname);
	SWFTextField_addString(tf, "Idle");
	SWFTextField_setBounds(tf, 120, 12);
	SWFTextField_setFlags(tf, SWFTEXTFIELD_DRAWBOX|SWFTEXTFIELD_NOEDIT);

	it = SWFMovie_add(mo, (SWFBlock)tf);
	SWFDisplayItem_moveTo(it, x, y+2);
	SWFDisplayItem_setDepth(it, depth);
	SWFDisplayItem_setName(it, name); // "textfield");

	// Label 
	tf = newSWFTextField();
	SWFTextField_setFont(tf, (void*)font);
	SWFTextField_addString(tf, initial_label);
	SWFTextField_setFlags(tf, SWFTEXTFIELD_DRAWBOX|SWFTEXTFIELD_NOEDIT);
	it = SWFMovie_add(mo, (SWFBlock)tf);
	SWFDisplayItem_scale(it, 0.3, 0.3);
	SWFDisplayItem_setDepth(it, depth*10);
	SWFDisplayItem_moveTo(it, x, y);
}
Ejemplo n.º 2
0
EXPORT BOOL WINAPI tf_addString(void *p1, char *string, int p3, int p4)
{
#ifdef JAMING
	unsigned char *out;
	lstrcpy(funcname, "tf_addString");
	out = toutf8(string);
	SWFTextField_addString(mhsp_field, (char *)out);
	free(out);
#else
	lstrcpy(funcname, "tf_addString");
	SWFTextField_addString(mhsp_field, string);
#endif
	return 0;
}
Ejemplo n.º 3
0
int main()
{
    SWFMovie m = newSWFMovie();
    SWFText text = newSWFText();
    SWFTextField textfield = newSWFTextField();
    SWFDisplayItem it;

    SWFFont font = newSWFFont_fromFile(MEDIADIR "/font01.fdb");
    if(font == NULL)
    {
        perror(MEDIADIR "/font01.fdb");
        exit(EXIT_FAILURE);
    }

    SWFText_setFont(text, font);
    SWFText_setColor(text, 0, 0, 0xff, 0xff);
    SWFText_setHeight(text, 20);
    SWFText_moveTo(text, 100, 100);
    SWFText_addString(text, "1234567890", NULL);

    SWFTextField_setFont(textfield, font);
    SWFTextField_addString(textfield, "1234567890");
    SWFTextField_setColor(textfield, 0xff, 0, 0, 0xff);
    SWFTextField_setHeight(textfield, 20);

    SWFMovie_add(m, text);
    it = SWFMovie_add(m, textfield);
    SWFDisplayItem_moveTo(it, 100, 120);
    SWFMovie_nextFrame(m);
    SWFMovie_save(m, "test04.swf");

    return 0;
}
Ejemplo n.º 4
0
SWFDisplayItem
add_text_field(SWFMovie mo, SWFBlock font, const char* text, float indent,
		float leftMargin, float rightMargin,
		SWFTextFieldAlignment align, float lineSpacing,
		unsigned int textR, unsigned int textG,
		unsigned int textB, unsigned int textA)
{
  SWFTextField tf;

  tf = newSWFTextField();

  SWFTextField_setFont(tf, font);
  SWFTextField_setIndentation(tf, indent);
  SWFTextField_setLeftMargin(tf, leftMargin);
  SWFTextField_setRightMargin(tf, rightMargin);
  SWFTextField_setAlignment(tf, align);
  SWFTextField_setLineSpacing(tf, lineSpacing);
  SWFTextField_setColor(tf, textR, textG, textB, textA);

  SWFTextField_setFlags(tf, SWFTEXTFIELD_DRAWBOX);
  SWFTextField_addChars(tf, text);

  SWFTextField_addString(tf, text);

  SWFTextField_setBounds(tf, 80, 16);
  
  return SWFMovie_add(mo, (SWFBlock)tf);
}
Ejemplo n.º 5
0
SWFTextField
get_label(const char* label, SWFFont font)
{
	SWFTextField tf = newSWFTextField();
	SWFTextField_setFont(tf, (void*)font);
	SWFTextField_addChars(tf, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345689:.,/\\#@?!");
	SWFTextField_addString(tf, label);
	return tf;
}
Ejemplo n.º 6
0
void
add_xtrace_function_clip(SWFMovieClip mc, SWFBlock font, int depth, int x, int y, int width, int height)
{
	SWFTextField tf;
	SWFDisplayItem it;
	int flags;

	tf = newSWFTextField();

	SWFTextField_setFont(tf, font);

	/* setting flags seem unneeded */
	flags = 0;
	//flags |= SWFTEXTFIELD_USEFONT;
	flags |= SWFTEXTFIELD_WORDWRAP;
	//flags |= SWFTEXTFIELD_NOEDIT;
	SWFTextField_setFlags(tf, flags);

	/* Add all ascii chars */
	SWFTextField_addChars(tf, asciichars);
	SWFTextField_addString(tf, " - xtrace enabled -\n");

	SWFTextField_setBounds(tf, width, height);

	/*
	 * Hopefully we have a *single* _root.
	 */
	SWFTextField_setVariableName(tf, "_root._trace_text");

	/*
	 * Set flags explicitly so that the field is selectable
	 * and you can cut&paste results.
	 * (the default seems to include SWFTEXTFIELD_NOSELECT)
	 */
	SWFTextField_setFlags(tf, SWFTEXTFIELD_NOEDIT);

	/*SWFTextField_setHeight(tf, 240);*/
	/*SWFTextField_setColor(tf, 0x00, 0x00, 0x00, 0xff);*/
	/*SWFTextField_setAlignment(tf, SWFTEXTFIELD_ALIGN_LEFT);*/
	/*SWFTextField_setLeftMargin(tf, 0);*/
	/*SWFTextField_setRightMargin(tf, 0);*/
	/*SWFTextField_setIndentation(tf, 0);*/
	/*SWFTextField_setLineSpacing(tf, 40);*/
	/*SWFTextField_setLineSpacing(tf, 40);*/

	it = SWFMovieClip_add(mc, (SWFBlock)tf);
	SWFDisplayItem_moveTo(it, x, y);
	SWFDisplayItem_setDepth(it, depth);
	SWFDisplayItem_setName(it, "_xtrace_win");

	add_clip_actions(mc,
		" _root.xtrace = function (msg) { "
		" _root._trace_text += msg + '\n'; "
		"};");

}
Ejemplo n.º 7
0
SWFDisplayItem
add_text_field(SWFMovie mo, SWFBlock font, const char* text, float indent,
		float leftMargin, float rightMargin,
		SWFTextFieldAlignment align, float lineSpacing,
		unsigned int textR, unsigned int textG,
		unsigned int textB, unsigned int textA)
{
  SWFTextField tf;

  tf = newSWFTextField();

  SWFTextField_setFont(tf, font);
  SWFTextField_setIndentation(tf, indent);
  SWFTextField_setLeftMargin(tf, leftMargin);
  SWFTextField_setRightMargin(tf, rightMargin);
  SWFTextField_setAlignment(tf, align);
  SWFTextField_setLineSpacing(tf, lineSpacing);
  SWFTextField_setColor(tf, textR, textG, textB, textA);

  /* setting flags seem unneeded */
  /*SWFTextField_setFlags(tf, SWFTEXTFIELD_USEFONT|SWFTEXTFIELD_NOEDIT);*/
  SWFTextField_addChars(tf, text);

  SWFTextField_addString(tf, text);

  /*
   * Bounds computed by Ming (if we omit the setBounds call)
   * are 2640, 240. This means that we're shrinking the available
   * space with this explicit setting. Gnash chokes in this case.
   *
   * Ref: https://savannah.gnu.org/bugs/?func=detailitem&item_id=16637.
   */
  SWFTextField_setBounds(tf, 100, 100);
  //SWFTextField_setBounds(tf, 60000, 338);

  /*
   * The following settings (found in the reported SWF)
   * are not needed to exploit the bug.
   */
 
  /*SWFTextField_setHeight(tf, 240);*/
  /*SWFTextField_setColor(tf, 0x00, 0x00, 0x00, 0xff);*/
  /*SWFTextField_setAlignment(tf, SWFTEXTFIELD_ALIGN_LEFT);*/
  /*SWFTextField_setLeftMargin(tf, 0);*/
  /*SWFTextField_setRightMargin(tf, 0);*/
  /*SWFTextField_setIndentation(tf, 0);*/
  /*SWFTextField_setLineSpacing(tf, 40);*/
  /*SWFTextField_setLineSpacing(tf, 40);*/

  return SWFMovie_add(mo, (SWFBlock)tf);
}
Ejemplo n.º 8
0
void
add_xtrace_function(SWFMovie mo, SWFBlock font, int depth, int x, int y, int width, int height)
{
	SWFTextField tf;
	SWFDisplayItem it;

	tf = newSWFTextField();

	SWFTextField_setFont(tf, font);

	/* setting flags seem unneeded */
	/*SWFTextField_setFlags(tf, SWFTEXTFIELD_USEFONT|SWFTEXTFIELD_NOEDIT);*/

	/* Add all ascii chars */
	SWFTextField_addChars(tf, asciichars);
	SWFTextField_addString(tf, " - xtrace enabled -\n");

	SWFTextField_setBounds(tf, width, height);

	/*
	 * Hopefully we have a *single* _root.
	 */
	SWFTextField_setVariableName(tf, "_root._trace_text");

	/*SWFTextField_setHeight(tf, 240);*/
	/*SWFTextField_setColor(tf, 0x00, 0x00, 0x00, 0xff);*/
	/*SWFTextField_setAlignment(tf, SWFTEXTFIELD_ALIGN_LEFT);*/
	/*SWFTextField_setLeftMargin(tf, 0);*/
	/*SWFTextField_setRightMargin(tf, 0);*/
	/*SWFTextField_setIndentation(tf, 0);*/
	/*SWFTextField_setLineSpacing(tf, 40);*/
	/*SWFTextField_setLineSpacing(tf, 40);*/

	it = SWFMovie_add(mo, (SWFBlock)tf);
	SWFDisplayItem_moveTo(it, x, y);
	SWFDisplayItem_setDepth(it, depth);
	SWFDisplayItem_setName(it, "_xtrace_win");

	add_actions(mo,
		" _root.xtrace = function (msg) { "
		" trace (msg); "
		" _root._trace_text += msg + '\n'; "
		"};");
}
Ejemplo n.º 9
0
int main()
{
	SWFMovie m = newSWFMovie();
	SWFTextField text = newSWFTextField();
	
	SWFFont font = newSWFFont_fromFile(MEDIADIR "/test.ttf");
	if(font == NULL)
	{
		perror(MEDIADIR "/test.tff");
		exit(EXIT_FAILURE);
	}
	
	SWFTextField_setFont(text, font);
	SWFTextField_setColor(text, 0, 0, 0, 0xff);
	SWFTextField_setHeight(text, 20);
	SWFTextField_setFlags(text, SWFTEXTFIELD_NOEDIT);
	SWFTextField_addString(text, "The quick brown fox jumps over the lazy dog. 1234567890");
	
	SWFMovie_add(m, text);
	SWFMovie_nextFrame(m);
	SWFMovie_save(m, "test01.swf");

	return 0;
}