[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11040: Merge with trunk.
From: |
Bob Naugle |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11040: Merge with trunk. |
Date: |
Mon, 08 Jun 2009 12:33:47 -0600 |
User-agent: |
Bazaar (1.13.1) |
------------------------------------------------------------
revno: 11040
committer: Bob Naugle <address@hidden>
branch nick: trunk
timestamp: Mon 2009-06-08 12:33:47 -0600
message:
Merge with trunk.
removed:
libcore/asobj/TextFormat_as.cpp
libcore/asobj/TextFormat_as.h
modified:
libcore/ClassHierarchy.cpp
libcore/TextField.cpp
libcore/asobj/Global.cpp
libcore/asobj/Makefile.am
libcore/asobj/flash.am
libcore/asobj/flash/text/TextFormat_as.cpp
libcore/asobj/flash/text/TextFormat_as.h
libcore/asobj/flash/text/text.am
------------------------------------------------------------
revno: 11039.1.1
committer: Bob Naugle <address@hidden>
branch nick: development
timestamp: Mon 2009-06-08 12:31:05 -0600
message:
Migrated TextFormat to new file and directory. Modified makefiles and
dependencies accordingly.
removed:
libcore/asobj/TextFormat_as.cpp
libcore/asobj/TextFormat_as.h
modified:
libcore/ClassHierarchy.cpp
libcore/TextField.cpp
libcore/asobj/Global.cpp
libcore/asobj/Makefile.am
libcore/asobj/flash.am
libcore/asobj/flash/text/TextFormat_as.cpp
libcore/asobj/flash/text/TextFormat_as.h
libcore/asobj/flash/text/text.am
=== modified file 'libcore/ClassHierarchy.cpp'
--- a/libcore/ClassHierarchy.cpp 2009-06-08 17:00:03 +0000
+++ b/libcore/ClassHierarchy.cpp 2009-06-08 18:31:05 +0000
@@ -52,7 +52,7 @@
#include "Stage_as.h"
#include "System_as.h"
#include "flash/text/TextSnapshot_as.h"
-#include "TextFormat_as.h"
+#include "flash/text/TextFormat_as.h"
#include "Video.h"
#include "extension.h"
#include "VM.h"
=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp 2009-04-15 05:33:51 +0000
+++ b/libcore/TextField.cpp 2009-06-08 18:31:05 +0000
@@ -41,7 +41,7 @@
#include "Array_as.h" // for _listeners construction
#include "AsBroadcaster.h" // for initializing self as a broadcaster
#include "StringPredicates.h"
-#include "TextFormat_as.h" // for getTextFormat/setTextFormat
+#include "text/TextFormat_as.h" // for getTextFormat/setTextFormat
#include "GnashKey.h" // key::code
#include "TextRecord.h"
#include "Point2d.h"
=== modified file 'libcore/asobj/Global.cpp'
--- a/libcore/asobj/Global.cpp 2009-06-08 17:00:03 +0000
+++ b/libcore/asobj/Global.cpp 2009-06-08 18:31:05 +0000
@@ -53,7 +53,7 @@
#include "SharedObject_as.h"
#include "Stage_as.h"
#include "System_as.h"
-#include "TextFormat_as.h"
+#include "flash/text/TextFormat_as.h"
#include "flash/text/TextSnapshot_as.h"
#include "Video.h"
#include "extension.h"
=== modified file 'libcore/asobj/Makefile.am'
--- a/libcore/asobj/Makefile.am 2009-06-08 16:10:02 +0000
+++ b/libcore/asobj/Makefile.am 2009-06-08 18:31:05 +0000
@@ -78,8 +78,6 @@
Sound_as.cpp \
Stage_as.cpp \
System_as.cpp \
- TextFormat_as.cpp \
- TextSnapshot_as.cpp \
MovieClipLoader.cpp\
String_as.cpp \
XMLSocket_as.cpp \
@@ -112,8 +110,6 @@
Sound_as.h \
Stage_as.h \
System_as.h \
- TextFormat_as.h \
- TextSnapshot_as.h \
String_as.h \
XMLSocket_as.h \
LoadableObject.h \
=== removed file 'libcore/asobj/TextFormat_as.cpp'
--- a/libcore/asobj/TextFormat_as.cpp 2009-05-26 18:02:16 +0000
+++ b/libcore/asobj/TextFormat_as.cpp 1970-01-01 00:00:00 +0000
@@ -1,600 +0,0 @@
-// textformat.cpp: ActionScript text formatting decorators, for Gnash.
-//
-// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-//
-
-#include "log.h"
-#include "Object.h" // for getObjectInterface
-#include "TextFormat_as.h"
-#include "fn_call.h"
-#include "builtin_function.h" // for getter/setter properties
-#include "namedStrings.h"
-#include "VM.h"
-#include "RGBA.h" // for rgba type
-#include "StringPredicates.h" // for parseAlignString
-#include "smart_ptr.h" // intrusive_ptr
-#include "GnashNumeric.h"
-
-namespace gnash {
-
-// Forward declarations
-
-namespace {
-
- as_value textformat_new(const fn_call& fn);
- as_object* getTextFormatInterface();
- void attachTextFormatInterface(as_object& o);
- const char* getAlignString(TextField::TextAlignment a);
- TextField::TextAlignment parseAlignString(const std::string& align);
-
- as_value textformat_display(const fn_call& fn);
- as_value textformat_bullet(const fn_call& fn);
- as_value textformat_tabStops(const fn_call& fn);
- as_value textformat_blockIndent(const fn_call& fn);
- as_value textformat_leading(const fn_call& fn);
- as_value textformat_indent(const fn_call& fn);
- as_value textformat_rightMargin(const fn_call& fn);
- as_value textformat_leftMargin(const fn_call& fn);
- as_value textformat_align(const fn_call& fn);
- as_value textformat_underline(const fn_call& fn);
- as_value textformat_italic(const fn_call& fn);
- as_value textformat_bold(const fn_call& fn);
- as_value textformat_target(const fn_call& fn);
- as_value textformat_url(const fn_call& fn);
- as_value textformat_color(const fn_call& fn);
- as_value textformat_size(const fn_call& fn);
- as_value textformat_font(const fn_call& fn);
- as_value textformat_getTextExtent(const fn_call& fn);
-
-}
-
-void
-TextFormat_as::alignSet(const std::string& align)
-{
- alignSet(parseAlignString(align));
-}
-
-
-void
-TextFormat_as::registerNative(as_object& o)
-{
- VM& vm = o.getVM();
-
- //vm.registerNative(110, 0) // [_global] TextFormat
- vm.registerNative(textformat_font, 110, 1);
- vm.registerNative(textformat_font, 110, 2);
- vm.registerNative(textformat_size, 110, 3);
- vm.registerNative(textformat_size, 110, 4);
- vm.registerNative(textformat_color, 110, 5);
- vm.registerNative(textformat_color, 110, 6);
- vm.registerNative(textformat_url, 110, 7);
- vm.registerNative(textformat_url, 110, 8);
- vm.registerNative(textformat_target, 110, 9);
- vm.registerNative(textformat_target, 110, 10);
- vm.registerNative(textformat_bold, 110, 11);
- vm.registerNative(textformat_bold, 110, 12);
- vm.registerNative(textformat_italic, 110, 13);
- vm.registerNative(textformat_italic, 110, 14);
- vm.registerNative(textformat_underline, 110, 15);
- vm.registerNative(textformat_underline, 110, 16);
- vm.registerNative(textformat_align, 110, 17);
- vm.registerNative(textformat_align, 110, 18);
- vm.registerNative(textformat_leftMargin, 110, 19);
- vm.registerNative(textformat_leftMargin, 110, 20);
- vm.registerNative(textformat_rightMargin, 110, 21);
- vm.registerNative(textformat_rightMargin, 110, 22);
- vm.registerNative(textformat_indent, 110, 23);
- vm.registerNative(textformat_indent, 110, 24);
- vm.registerNative(textformat_leading, 110, 25);
- vm.registerNative(textformat_leading, 110, 26);
- vm.registerNative(textformat_blockIndent, 110, 27);
- vm.registerNative(textformat_blockIndent, 110, 28);
- vm.registerNative(textformat_tabStops, 110, 29);
- vm.registerNative(textformat_tabStops, 110, 30);
- vm.registerNative(textformat_bullet, 110, 31);
- vm.registerNative(textformat_bullet, 110, 32);
- vm.registerNative(textformat_getTextExtent, 110, 33);
-
-}
-
-TextFormat_as::TextFormat_as()
- :
- as_object(getTextFormatInterface()),
- _flags(0),
- _underline(false),
- _bold(false),
- _italic(false),
- _bullet(false),
- _align(TextField::ALIGN_LEFT),
- _blockIndent(-1),
- _color(),
- _indent(-1),
- _leading(-1),
- _leftMargin(-1),
- _rightMargin(-1),
- _pointSize(-1),
- _tabStops(-1),
- _target()
-{
- init_member("getTextExtent", new builtin_function(
- textformat_getTextExtent));
-}
-
-
-// extern (used by Global.cpp)
-void
-TextFormat_as::init(as_object& global)
-{
- // This is going to be the global Color "class"/"function"
- static boost::intrusive_ptr<builtin_function> cl;
-
- if ( cl == NULL )
- {
- cl=new builtin_function(&textformat_new,
getTextFormatInterface());
- }
-
- // Register _global.Color
- global.init_member("TextFormat", cl.get());
-
-}
-
-
-namespace {
-
-/// new TextFormat([font, [size, [color, [bold, [italic, [underline, [url,
[target, [align,[leftMargin, [rightMargin, [indent, [leading]]]]]]]]]]]]])
-as_value
-textformat_new(const fn_call& fn)
-{
-
- boost::intrusive_ptr<TextFormat_as> tf = new TextFormat_as;
-
- const unsigned int args = fn.nargs;
-
- switch (args)
- {
- default:
- log_error(_("Too many args (%d) passed to TextFormat"), args);
- case 13:
- tf->leadingSet(pixelsToTwips(fn.arg(12).to_int()));
- case 12:
- tf->indentSet(pixelsToTwips(fn.arg(11).to_int()));
- case 11:
- tf->rightMarginSet(pixelsToTwips(fn.arg(10).to_int()));
- case 10:
- tf->leftMarginSet(pixelsToTwips(fn.arg(9).to_int()));
- case 9:
- tf->alignSet(fn.arg(8).to_string());
- case 8:
- tf->targetSet(fn.arg(7).to_string());
- case 7:
- tf->urlSet(fn.arg(6).to_string());
- case 6:
- tf->underlinedSet(fn.arg(5).to_bool());
- case 5:
- tf->italicedSet(fn.arg(4).to_bool());
- case 4:
- tf->boldSet(fn.arg(3).to_bool());
- case 3:
- {
- rgba col;
- col.parseRGB(fn.arg(2).to_int());
- tf->colorSet(col);
- }
- case 2:
- tf->sizeSet(pixelsToTwips(fn.arg(1).to_int()));
- case 1:
- tf->fontSet(fn.arg(0).to_string());
- break;
- case 0:
- // What happens here?
- break;
- }
-
- return as_value(tf.get());
-}
-
-as_value
-textformat_display(const fn_call& /*fn*/)
-{
- LOG_ONCE( log_unimpl("TextFormat.display") );
- return as_value();
-}
-
-as_value
-textformat_bullet(const fn_call& fn)
-{
- // Has the right return values, but not properly implemented
- LOG_ONCE( log_unimpl("TextFormat.bullet") );
-
- boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
-
- as_value ret;
-
- if ( fn.nargs == 0 ) // getter
- {
- if ( ptr->bulletDefined() ) ret.set_bool(ptr->bullet());
- else ret.set_null();
- }
- else // setter
- {
- // Boolean
- ptr->bulletSet(fn.arg(0).to_bool());
- }
-
- return ret;
-}
-
-as_value
-textformat_tabStops(const fn_call& /*fn*/)
-{
- LOG_ONCE( log_unimpl("TextFormat.tabStops") );
- return as_value();
-}
-
-as_value
-textformat_blockIndent(const fn_call& fn)
-{
- boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
-
- as_value ret;
-
- if ( fn.nargs == 0 ) // getter
- {
- if ( ptr->blockIndentDefined() )
ret.set_double(twipsToPixels(ptr->blockIndent()));
- else ret.set_null();
- }
- else // setter
- {
- ptr->blockIndentSet(pixelsToTwips(fn.arg(0).to_int()));
- }
-
- return ret;
-}
-
-as_value
-textformat_leading(const fn_call& fn)
-{
- boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
-
- as_value ret;
-
- if ( fn.nargs == 0 ) // getter
- {
- if ( ptr->leadingDefined() )
ret.set_double(twipsToPixels(ptr->leading()));
- else ret.set_null();
- }
- else // setter
- {
- ptr->leadingSet(pixelsToTwips(fn.arg(0).to_int()));
- }
-
- return ret;
-}
-
-as_value
-textformat_indent(const fn_call& fn)
-{
- boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
-
- as_value ret;
-
- if ( fn.nargs == 0 ) // getter
- {
- if ( ptr->indentDefined() )
ret.set_double(twipsToPixels(ptr->indent()));
- else ret.set_null();
- }
- else // setter
- {
- ptr->indentSet(pixelsToTwips(fn.arg(0).to_int()));
- }
-
- return ret;
-}
-
-as_value
-textformat_rightMargin(const fn_call& fn)
-{
- boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
-
- as_value ret;
-
- if ( fn.nargs == 0 ) // getter
- {
- if ( ptr->rightMarginDefined() )
ret.set_double(twipsToPixels(ptr->rightMargin()));
- else ret.set_null();
- }
- else // setter
- {
- ptr->rightMarginSet(pixelsToTwips(fn.arg(0).to_int()));
- }
-
- return ret;
-}
-
-as_value
-textformat_leftMargin(const fn_call& fn)
-{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
-
- as_value ret;
-
- if ( fn.nargs == 0 ) // getter
- {
- if (ptr->leftMarginDefined()) {
- ret.set_double(twipsToPixels(ptr->leftMargin()));
- }
- else ret.set_null();
- }
- else // setter
- {
- ptr->leftMarginSet(pixelsToTwips(fn.arg(0).to_int()));
- }
-
- return ret;
-}
-
-as_value
-textformat_align(const fn_call& fn)
-{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
-
- as_value ret;
-
- if ( fn.nargs == 0 ) // getter
- {
- if ( ptr->alignDefined() ) {
- ret.set_string(getAlignString(ptr->align()));
- }
- else ret.set_null();
- }
- else // setter
- {
- ptr->alignSet(fn.arg(0).to_string());
- }
-
- return ret;
-}
-
-as_value
-textformat_underline(const fn_call& fn)
-{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
-
- as_value ret;
-
- if ( fn.nargs == 0 ) // getter
- {
- if ( ptr->underlinedDefined() ) ret.set_bool(ptr->underlined());
- else ret.set_null();
- }
- else // setter
- {
- ptr->underlinedSet(fn.arg(0).to_bool());
- }
-
- return ret;
-}
-
-as_value
-textformat_italic(const fn_call& fn)
-{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
-
- as_value ret;
-
- if ( fn.nargs == 0 ) // getter
- {
- if ( ptr->italicedDefined() ) ret.set_bool(ptr->italiced());
- else ret.set_null();
- }
- else // setter
- {
- ptr->italicedSet(fn.arg(0).to_bool());
- }
-
- return ret;
-}
-
-as_value
-textformat_bold(const fn_call& fn)
-{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
-
- as_value ret;
-
- if ( fn.nargs == 0 ) // getter
- {
- if ( ptr->boldDefined() ) ret.set_bool(ptr->bold());
- else ret.set_null();
- }
- else // setter
- {
- ptr->boldSet(fn.arg(0).to_bool());
- }
-
- return ret;
-}
-
-as_value
-textformat_target(const fn_call& /*fn*/)
-{
- LOG_ONCE( log_unimpl("TextFormat.target") );
- return as_value();
-}
-
-as_value
-textformat_url(const fn_call& /*fn*/)
-{
- LOG_ONCE( log_unimpl("TextFormat.url") );
- return as_value();
-}
-
-as_value
-textformat_color(const fn_call& fn)
-{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
-
- as_value ret;
-
- if ( fn.nargs == 0 ) // getter
- {
- if ( ptr->colorDefined() )
ret.set_double(ptr->color().toRGB());
- else ret.set_null();
- }
- else // setter
- {
- rgba newcolor;
- newcolor.parseRGB(fn.arg(0).to_int());
- ptr->colorSet(newcolor);
- }
-
- return ret;
-}
-
-as_value
-textformat_size(const fn_call& fn)
-{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
-
- as_value ret;
-
- if ( fn.nargs == 0 ) // getter
- {
- if ( ptr->sizeDefined() )
ret.set_double(twipsToPixels(ptr->size()));
- else ret.set_null();
- }
- else // setter
- {
- ptr->sizeSet(pixelsToTwips(fn.arg(0).to_int()));
- }
-
- return ret;
-}
-
-as_value
-textformat_font(const fn_call& fn)
-{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
-
- as_value ret;
-
- if ( fn.nargs == 0 ) // getter
- {
- if ( ptr->fontDefined() ) ret.set_string(ptr->font());
- else ret.set_null();
- }
- else // setter
- {
- ptr->fontSet(fn.arg(0).to_string());
- }
-
- return ret;
-}
-
-
-as_value
-textformat_getTextExtent(const fn_call& /*fn*/)
-{
- LOG_ONCE( log_unimpl("TextFormat.getTextExtent") );
- return as_value();
-}
-
-
-void
-attachTextFormatInterface(as_object& o)
-{
- int flags = 0; // for sure we want to enum, dunno about deleting yet
-
- o.init_property("display", textformat_display, textformat_display,
flags);
- o.init_property("bullet", textformat_bullet, textformat_bullet, flags);
- o.init_property("tabStops", textformat_tabStops,
- textformat_tabStops, flags);
- o.init_property("blockIndent", textformat_blockIndent,
- textformat_blockIndent, flags);
- o.init_property("leading", textformat_leading, textformat_leading,
flags);
- o.init_property("indent", textformat_indent, textformat_indent, flags);
- o.init_property("rightMargin", textformat_rightMargin,
- textformat_rightMargin, flags);
- o.init_property("leftMargin", textformat_leftMargin,
- textformat_leftMargin, flags);
- o.init_property("align", textformat_align, textformat_align, flags);
- o.init_property("underline", textformat_underline,
- textformat_underline, flags);
- o.init_property("italic", textformat_italic, textformat_italic, flags);
- o.init_property("bold", textformat_bold, textformat_bold, flags);
- o.init_property("target", textformat_target, textformat_target, flags);
- o.init_property("url", textformat_url, textformat_url, flags);
- o.init_property("color", textformat_color, textformat_color, flags);
- o.init_property("size", textformat_size, textformat_size, flags);
- o.init_property("font", textformat_font, textformat_font, flags);
-}
-
-as_object*
-getTextFormatInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if (!o) {
- o = new as_object(getObjectInterface());
- VM::get().addStatic(o.get());
- attachTextFormatInterface(*o);
- }
- return o.get();
-}
-
-
-TextField::TextAlignment
-parseAlignString(const std::string& align)
-{
- StringNoCaseEqual cmp;
- if ( cmp(align, "left") ) return TextField::ALIGN_LEFT;
- if ( cmp(align, "center") ) return TextField::ALIGN_CENTER;
- if ( cmp(align, "right") ) return TextField::ALIGN_RIGHT;
- if ( cmp(align, "justify") ) return TextField::ALIGN_JUSTIFY;
-
- log_debug("Invalid align string %s, taking as left", align);
- return TextField::ALIGN_LEFT;
-}
-
-const char*
-getAlignString(TextField::TextAlignment a)
-{
- switch (a)
- {
- case TextField::ALIGN_LEFT:
- return "left";
- case TextField::ALIGN_CENTER:
- return "center";
- case TextField::ALIGN_RIGHT:
- return "right";
- case TextField::ALIGN_JUSTIFY:
- return "justify";
- default:
- log_error("Uknown alignment value: %d, take as left",
a);
- return "left";
- }
-}
-
-} // anonymous namespace
-} // end of gnash namespace
=== removed file 'libcore/asobj/TextFormat_as.h'
--- a/libcore/asobj/TextFormat_as.h 2009-04-03 09:18:40 +0000
+++ b/libcore/asobj/TextFormat_as.h 1970-01-01 00:00:00 +0000
@@ -1,244 +0,0 @@
-//
-// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-//
-//
-
-#ifndef GNASH_TEXTFORMAT_H
-#define GNASH_TEXTFORMAT_H
-
-#include "as_object.h" // for inheritance of TextFormat
-#include "TextField.h" // for TextAlignment enum
-#include "RGBA.h" // for rgba
-#include <boost/cstdint.hpp> // for boost::uint32_t
-#include <string>
-
-namespace gnash {
-
-class TextFormat_as : public as_object
-{
-public:
-
- TextFormat_as();
- ~TextFormat_as() {}
-
- static void registerNative(as_object& global);
-
- /// Initialize the global Color class
- static void init(as_object& global);
-
- /// Return a Boolean value that indicates whether the text is
underlined.
- bool underlined() const { return _underline; }
- bool underlinedDefined() const { return _flags&DEFunderline; }
-
- /// Return a Boolean value that indicates whether the text is
italicized.
- bool italiced() const { return _italic; }
- bool italicedDefined() const { return _flags&DEFitalic; }
-
- /// Return a Boolean value that indicates whether the text is boldface.
- bool bold() const { return _bold; }
- bool boldDefined() const { return _flags&DEFbold; }
-
- bool bullet() const { return _bullet; }
- bool bulletDefined() const { return _flags&DEFbullet; }
-
- /// Return the color of text using this text format.
- const rgba& color() const { return _color; }
- bool colorDefined() const { return _flags&DEFcolor; }
-
- /// \brief
- /// Return an integer that indicates the indentation from the left
- /// margin to the first DisplayObject in the paragraph
- boost::uint16_t indent() const { return _indent; }
- bool indentDefined() const { return _flags&DEFindent; }
-
- /// Return the alignment of the paragraph.
- TextField::TextAlignment align() const { return _align; }
- bool alignDefined() const { return _flags&DEFalign; }
-
- /// Return the name of a font for text as a string.
- const std::string& font() const { return _font; }
- bool fontDefined() const { return _flags&DEFfont; }
-
- // See doc for _target member
- const std::string& target() const { return _target; }
- bool targetDefined() const { return _flags&DEFtarget; }
-
- // See doc for _target member
- void targetSet(const std::string& s) { _target=s; _flags |= DEFtarget; }
-
- // See doc for _url member
- const std::string& url() const { return _url; }
- bool urlDefined() const { return _flags&DEFurl; }
-
- // See doc for _url member
- void urlSet(const std::string& s) { _url=s; _flags |= DEFurl; }
-
- ///
- boost::uint16_t blockIndent() { return _blockIndent; }
- bool blockIndentDefined() const { return _flags&DEFblockIndent; }
-
- /// Return a number that indicates the amount of leading vertical
- /// space between lines.
- boost::uint16_t leading() { return _leading; }
- bool leadingDefined() const { return _flags&DEFleading; }
-
- /// Indicates the left margin of the paragraph, in points.
- boost::uint16_t leftMargin() { return _leftMargin; }
- bool leftMarginDefined() const { return _flags&DEFleftMargin; }
-
- /// Indicates the right margin of the paragraph, in points.
- boost::uint16_t rightMargin() { return _rightMargin; }
- bool rightMarginDefined() const { return _flags&DEFrightMargin; }
-
- /// Return a float that indicates the point size in twips.
- boost::uint16_t size() { return _pointSize; }
- bool sizeDefined() const { return _flags&DEFsize; }
-
- void underlinedSet(bool x) { _underline = x; _flags |= DEFunderline; }
- void italicedSet(bool x) { _italic = x; _flags |= DEFitalic; }
- void boldSet(bool x) { _bold = x; _flags |= DEFbold; }
- void bulletSet(bool x) { _bullet = x; _flags |= DEFbullet; }
- void colorSet(const rgba& x) { _color = x; _flags |= DEFcolor; }
- void indentSet(boost::uint16_t x) { _indent = x; _flags |=
DEFindent; }
- void fontSet(const std::string& font) { _font=font; _flags |= DEFfont; }
-
- void alignSet(TextField::TextAlignment x) {
- _align = x;
- _flags |= DEFalign;
- }
-
- void alignSet(const std::string& align);
-
- void blockIndentSet(boost::uint16_t x) {
- _blockIndent = x;
- _flags |= DEFblockIndent;
- }
-
- void leadingSet(boost::uint16_t x) {
- _leading = x;
- _flags |= DEFleading;
- }
-
- void leftMarginSet(boost::uint16_t x) {
- _leftMargin = x;
- _flags |= DEFleftMargin;
- }
-
- void rightMarginSet(boost::uint16_t x) {
- _rightMargin = x;
- _flags |= DEFrightMargin;
- }
-
- /// Set font point size in twips
- void sizeSet(boost::uint16_t x) {
- _pointSize = x;
- _flags |= DEFsize;
- }
-
-private:
-
- enum {
- DEFunderline =1<<0,
- DEFbold =1<<1,
- DEFitalic =1<<2,
- DEFbullet =1<<3,
- DEFalign =1<<4,
- DEFblockIndent =1<<5,
- DEFcolor =1<<6,
- DEFfont =1<<7,
- DEFindent =1<<8,
- DEFleading =1<<9,
- DEFleftMargin =1<<10,
- DEFrightMargin =1<<11,
- DEFpointSize =1<<12,
- DEFtabStops =1<<13,
- DEFtarget =1<<14,
- DEFurl =1<<15,
- DEFsize =1<<16
- };
-
- // need at least 17 bit here... (1<<16)
- boost::uint32_t _flags;
-
- /// A Boolean value that indicates whether the text is underlined.
- bool _underline;
-
- /// A Boolean value that indicates whether the text is boldface.
- bool _bold;
-
- /// A Boolean value that indicates whether the text is italicized.
- bool _italic;
-
- //
- bool _bullet;
-
- /// The alignment of the paragraph, represented as a string.
- //
- /// If "left", the paragraph is left-aligned. If "center", the
- /// paragraph is centered. If "right", the paragraph is
- /// right-aligned. If "justify", the paragraph is justified.
- ///
- TextField::TextAlignment _align;
-
- //
- boost::uint16_t _blockIndent;
-
- /// The color of text using this text format.
- //
- /// A number containing three 8-bit RGB components; for example,
- /// 0xFF0000 is red, 0x00FF00 is green.
- rgba _color;
-
- // The name of a font for text as a string.
- std::string _font;
-
- /// An integer that indicates the indentation from the left
- /// margin to the first DisplayObject in the paragraph (twips)
- boost::uint16_t _indent;
-
- /// A number that indicates the amount of leading vertical
- /// space between lines (twips)
- boost::uint16_t _leading;
-
- /// Indicates the left margin of the paragraph, in points (twips)
- boost::uint16_t _leftMargin;
-
- /// Indicates the right margin of the paragraph, in points (twips).
- boost::uint16_t _rightMargin;
-
- /// Point size in twips.
- boost::uint16_t _pointSize;
-
- ///
- int _tabStops;
-
- /// The target window where the hyperlink is displayed.
- /// If the target window is an empty string, the text is displayed in
- /// the default target window _self. If the url parameter is
- /// set to an empty string or to the value null, you can get
- /// or set this property, but the property will have no effect.
- std::string _target;
-
- /// The URL to which the text in this text format hyperlinks.
- /// If url is an empty string, the text does not have a hyperlink
- std::string _url;
-};
-
-} // end of gnash namespace
-
-#endif
=== modified file 'libcore/asobj/flash.am'
--- a/libcore/asobj/flash.am 2009-06-08 17:13:40 +0000
+++ b/libcore/asobj/flash.am 2009-06-08 18:31:05 +0000
@@ -52,7 +52,6 @@
asobj/Sound_as.cpp \
asobj/Stage_as.cpp \
asobj/System_as.cpp \
- asobj/TextFormat_as.cpp \
asobj/MovieClipLoader.cpp\
asobj/String_as.cpp \
asobj/XMLSocket_as.cpp \
@@ -85,7 +84,6 @@
asobj/Sound_as.h \
asobj/Stage_as.h \
asobj/System_as.h \
- asobj/TextFormat_as.h \
asobj/String_as.h \
asobj/XMLSocket_as.h \
asobj/LoadableObject.h \
=== modified file 'libcore/asobj/flash/text/TextFormat_as.cpp'
--- a/libcore/asobj/flash/text/TextFormat_as.cpp 2009-05-28 17:11:27
+0000
+++ b/libcore/asobj/flash/text/TextFormat_as.cpp 2009-06-08 18:31:05
+0000
@@ -27,6 +27,11 @@
#include "smart_ptr.h" // for boost intrusive_ptr
#include "builtin_function.h" // need builtin_function
#include "GnashException.h" // for ActionException
+#include "TextField.h"
+#include "VM.h"
+#include "RGBA.h" // for rgba type
+#include "namedStrings.h"
+#include "GnashNumeric.h"
namespace gnash {
@@ -36,22 +41,80 @@
void attachTextFormatInterface(as_object& o);
void attachTextFormatStaticInterface(as_object& o);
as_object* getTextFormatInterface();
-
-}
-
-class TextFormat_as : public as_object
-{
-
-public:
-
- TextFormat_as()
- :
- as_object(getTextFormatInterface())
- {}
-};
+ const char* getAlignString(TextField::TextAlignment a);
+ TextField::TextAlignment parseAlignString(const std::string& align);
+
+ as_value textformat_display(const fn_call& fn);
+ as_value textformat_bullet(const fn_call& fn);
+ as_value textformat_tabStops(const fn_call& fn);
+ as_value textformat_blockIndent(const fn_call& fn);
+ as_value textformat_leading(const fn_call& fn);
+ as_value textformat_indent(const fn_call& fn);
+ as_value textformat_rightMargin(const fn_call& fn);
+ as_value textformat_leftMargin(const fn_call& fn);
+ as_value textformat_align(const fn_call& fn);
+ as_value textformat_underline(const fn_call& fn);
+ as_value textformat_italic(const fn_call& fn);
+ as_value textformat_bold(const fn_call& fn);
+ as_value textformat_target(const fn_call& fn);
+ as_value textformat_url(const fn_call& fn);
+ as_value textformat_color(const fn_call& fn);
+ as_value textformat_size(const fn_call& fn);
+ as_value textformat_font(const fn_call& fn);
+ as_value textformat_getTextExtent(const fn_call& fn);
+
+}
+
+void
+TextFormat_as::alignSet(const std::string& align)
+{
+ alignSet(parseAlignString(align));
+}
+
+void
+TextFormat_as::registerNative(as_object& o)
+{
+ VM& vm = o.getVM();
+
+ //vm.registerNative(110, 0) // [_global] TextFormat
+ vm.registerNative(textformat_font, 110, 1);
+ vm.registerNative(textformat_font, 110, 2);
+ vm.registerNative(textformat_size, 110, 3);
+ vm.registerNative(textformat_size, 110, 4);
+ vm.registerNative(textformat_color, 110, 5);
+ vm.registerNative(textformat_color, 110, 6);
+ vm.registerNative(textformat_url, 110, 7);
+ vm.registerNative(textformat_url, 110, 8);
+ vm.registerNative(textformat_target, 110, 9);
+ vm.registerNative(textformat_target, 110, 10);
+ vm.registerNative(textformat_bold, 110, 11);
+ vm.registerNative(textformat_bold, 110, 12);
+ vm.registerNative(textformat_italic, 110, 13);
+ vm.registerNative(textformat_italic, 110, 14);
+ vm.registerNative(textformat_underline, 110, 15);
+ vm.registerNative(textformat_underline, 110, 16);
+ vm.registerNative(textformat_align, 110, 17);
+ vm.registerNative(textformat_align, 110, 18);
+ vm.registerNative(textformat_leftMargin, 110, 19);
+ vm.registerNative(textformat_leftMargin, 110, 20);
+ vm.registerNative(textformat_rightMargin, 110, 21);
+ vm.registerNative(textformat_rightMargin, 110, 22);
+ vm.registerNative(textformat_indent, 110, 23);
+ vm.registerNative(textformat_indent, 110, 24);
+ vm.registerNative(textformat_leading, 110, 25);
+ vm.registerNative(textformat_leading, 110, 26);
+ vm.registerNative(textformat_blockIndent, 110, 27);
+ vm.registerNative(textformat_blockIndent, 110, 28);
+ vm.registerNative(textformat_tabStops, 110, 29);
+ vm.registerNative(textformat_tabStops, 110, 30);
+ vm.registerNative(textformat_bullet, 110, 31);
+ vm.registerNative(textformat_bullet, 110, 32);
+ vm.registerNative(textformat_getTextExtent, 110, 33);
+
+}
// extern (used by Global.cpp)
-void textformat_class_init(as_object& global)
+void TextFormat_as::init(as_object& global)
{
static boost::intrusive_ptr<builtin_function> cl;
@@ -64,11 +127,58 @@
global.init_member("TextFormat", cl.get());
}
+TextFormat_as::TextFormat_as()
+ :
+ as_object(getTextFormatInterface()),
+ _flags(0),
+ _underline(false),
+ _bold(false),
+ _italic(false),
+ _bullet(false),
+ _align(TextField::ALIGN_LEFT),
+ _blockIndent(-1),
+ _color(),
+ _indent(-1),
+ _leading(-1),
+ _leftMargin(-1),
+ _rightMargin(-1),
+ _pointSize(-1),
+ _tabStops(-1),
+ _target()
+{
+ init_member("getTextExtent", new builtin_function(
+ textformat_getTextExtent));
+}
+
namespace {
void
attachTextFormatInterface(as_object& o)
{
+ int flags = 0; // for sure we want to enum, dunno about deleting yet
+
+ o.init_property("display", textformat_display, textformat_display,
flags);
+ o.init_property("bullet", textformat_bullet, textformat_bullet, flags);
+ o.init_property("tabStops", textformat_tabStops,
+ textformat_tabStops, flags);
+ o.init_property("blockIndent", textformat_blockIndent,
+ textformat_blockIndent, flags);
+ o.init_property("leading", textformat_leading, textformat_leading,
flags);
+ o.init_property("indent", textformat_indent, textformat_indent, flags);
+ o.init_property("rightMargin", textformat_rightMargin,
+ textformat_rightMargin, flags);
+ o.init_property("leftMargin", textformat_leftMargin,
+ textformat_leftMargin, flags);
+ o.init_property("align", textformat_align, textformat_align, flags);
+ o.init_property("underline", textformat_underline,
+ textformat_underline, flags);
+ o.init_property("italic", textformat_italic, textformat_italic, flags);
+ o.init_property("bold", textformat_bold, textformat_bold, flags);
+ o.init_property("target", textformat_target, textformat_target, flags);
+ o.init_property("url", textformat_url, textformat_url, flags);
+ o.init_property("color", textformat_color, textformat_color, flags);
+ o.init_property("size", textformat_size, textformat_size, flags);
+ o.init_property("font", textformat_font, textformat_font, flags);
}
void
@@ -96,6 +206,352 @@
return as_value(obj.get()); // will keep alive
}
+as_value
+textformat_display(const fn_call& /*fn*/)
+{
+ LOG_ONCE( log_unimpl("TextFormat.display") );
+ return as_value();
+}
+
+as_value
+textformat_bullet(const fn_call& fn)
+{
+ // Has the right return values, but not properly implemented
+ LOG_ONCE( log_unimpl("TextFormat.bullet") );
+
+ boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
+
+ as_value ret;
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ if ( ptr->bulletDefined() ) ret.set_bool(ptr->bullet());
+ else ret.set_null();
+ }
+ else // setter
+ {
+ // Boolean
+ ptr->bulletSet(fn.arg(0).to_bool());
+ }
+
+ return ret;
+}
+
+as_value
+textformat_tabStops(const fn_call& /*fn*/)
+{
+ LOG_ONCE( log_unimpl("TextFormat.tabStops") );
+ return as_value();
+}
+
+as_value
+textformat_blockIndent(const fn_call& fn)
+{
+ boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
+
+ as_value ret;
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ if ( ptr->blockIndentDefined() )
ret.set_double(twipsToPixels(ptr->blockIndent()));
+ else ret.set_null();
+ }
+ else // setter
+ {
+ ptr->blockIndentSet(pixelsToTwips(fn.arg(0).to_int()));
+ }
+
+ return ret;
+}
+
+as_value
+textformat_leading(const fn_call& fn)
+{
+ boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
+
+ as_value ret;
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ if ( ptr->leadingDefined() )
ret.set_double(twipsToPixels(ptr->leading()));
+ else ret.set_null();
+ }
+ else // setter
+ {
+ ptr->leadingSet(pixelsToTwips(fn.arg(0).to_int()));
+ }
+
+ return ret;
+}
+
+as_value
+textformat_indent(const fn_call& fn)
+{
+ boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
+
+ as_value ret;
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ if ( ptr->indentDefined() )
ret.set_double(twipsToPixels(ptr->indent()));
+ else ret.set_null();
+ }
+ else // setter
+ {
+ ptr->indentSet(pixelsToTwips(fn.arg(0).to_int()));
+ }
+
+ return ret;
+}
+
+as_value
+textformat_rightMargin(const fn_call& fn)
+{
+ boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
+
+ as_value ret;
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ if ( ptr->rightMarginDefined() )
ret.set_double(twipsToPixels(ptr->rightMargin()));
+ else ret.set_null();
+ }
+ else // setter
+ {
+ ptr->rightMarginSet(pixelsToTwips(fn.arg(0).to_int()));
+ }
+
+ return ret;
+}
+
+as_value
+textformat_leftMargin(const fn_call& fn)
+{
+ boost::intrusive_ptr<TextFormat_as> ptr =
+ ensureType<TextFormat_as>(fn.this_ptr);
+
+ as_value ret;
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ if (ptr->leftMarginDefined()) {
+ ret.set_double(twipsToPixels(ptr->leftMargin()));
+ }
+ else ret.set_null();
+ }
+ else // setter
+ {
+ ptr->leftMarginSet(pixelsToTwips(fn.arg(0).to_int()));
+ }
+
+ return ret;
+}
+
+as_value
+textformat_align(const fn_call& fn)
+{
+ boost::intrusive_ptr<TextFormat_as> ptr =
+ ensureType<TextFormat_as>(fn.this_ptr);
+
+ as_value ret;
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ if ( ptr->alignDefined() ) {
+ ret.set_string(getAlignString(ptr->align()));
+ }
+ else ret.set_null();
+ }
+ else // setter
+ {
+ ptr->alignSet(fn.arg(0).to_string());
+ }
+
+ return ret;
+}
+
+as_value
+textformat_underline(const fn_call& fn)
+{
+ boost::intrusive_ptr<TextFormat_as> ptr =
+ ensureType<TextFormat_as>(fn.this_ptr);
+
+ as_value ret;
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ if ( ptr->underlinedDefined() ) ret.set_bool(ptr->underlined());
+ else ret.set_null();
+ }
+ else // setter
+ {
+ ptr->underlinedSet(fn.arg(0).to_bool());
+ }
+
+ return ret;
+}
+
+as_value
+textformat_italic(const fn_call& fn)
+{
+ boost::intrusive_ptr<TextFormat_as> ptr =
+ ensureType<TextFormat_as>(fn.this_ptr);
+
+ as_value ret;
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ if ( ptr->italicedDefined() ) ret.set_bool(ptr->italiced());
+ else ret.set_null();
+ }
+ else // setter
+ {
+ ptr->italicedSet(fn.arg(0).to_bool());
+ }
+
+ return ret;
+}
+
+as_value
+textformat_bold(const fn_call& fn)
+{
+ boost::intrusive_ptr<TextFormat_as> ptr =
+ ensureType<TextFormat_as>(fn.this_ptr);
+
+ as_value ret;
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ if ( ptr->boldDefined() ) ret.set_bool(ptr->bold());
+ else ret.set_null();
+ }
+ else // setter
+ {
+ ptr->boldSet(fn.arg(0).to_bool());
+ }
+
+ return ret;
+}
+
+as_value
+textformat_target(const fn_call& /*fn*/)
+{
+ LOG_ONCE( log_unimpl("TextFormat.target") );
+ return as_value();
+}
+
+as_value
+textformat_url(const fn_call& /*fn*/)
+{
+ LOG_ONCE( log_unimpl("TextFormat.url") );
+ return as_value();
+}
+
+as_value
+textformat_color(const fn_call& fn)
+{
+ boost::intrusive_ptr<TextFormat_as> ptr =
+ ensureType<TextFormat_as>(fn.this_ptr);
+
+ as_value ret;
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ if ( ptr->colorDefined() )
ret.set_double(ptr->color().toRGB());
+ else ret.set_null();
+ }
+ else // setter
+ {
+ rgba newcolor;
+ newcolor.parseRGB(fn.arg(0).to_int());
+ ptr->colorSet(newcolor);
+ }
+
+ return ret;
+}
+
+as_value
+textformat_size(const fn_call& fn)
+{
+ boost::intrusive_ptr<TextFormat_as> ptr =
+ ensureType<TextFormat_as>(fn.this_ptr);
+
+ as_value ret;
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ if ( ptr->sizeDefined() )
ret.set_double(twipsToPixels(ptr->size()));
+ else ret.set_null();
+ }
+ else // setter
+ {
+ ptr->sizeSet(pixelsToTwips(fn.arg(0).to_int()));
+ }
+
+ return ret;
+}
+
+as_value
+textformat_font(const fn_call& fn)
+{
+ boost::intrusive_ptr<TextFormat_as> ptr =
+ ensureType<TextFormat_as>(fn.this_ptr);
+
+ as_value ret;
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ if ( ptr->fontDefined() ) ret.set_string(ptr->font());
+ else ret.set_null();
+ }
+ else // setter
+ {
+ ptr->fontSet(fn.arg(0).to_string());
+ }
+
+ return ret;
+}
+
+
+as_value
+textformat_getTextExtent(const fn_call& /*fn*/)
+{
+ LOG_ONCE( log_unimpl("TextFormat.getTextExtent") );
+ return as_value();
+}
+
+TextField::TextAlignment
+parseAlignString(const std::string& align)
+{
+ StringNoCaseEqual cmp;
+ if ( cmp(align, "left") ) return TextField::ALIGN_LEFT;
+ if ( cmp(align, "center") ) return TextField::ALIGN_CENTER;
+ if ( cmp(align, "right") ) return TextField::ALIGN_RIGHT;
+ if ( cmp(align, "justify") ) return TextField::ALIGN_JUSTIFY;
+
+ log_debug("Invalid align string %s, taking as left", align);
+ return TextField::ALIGN_LEFT;
+}
+
+const char*
+getAlignString(TextField::TextAlignment a)
+{
+ switch (a)
+ {
+ case TextField::ALIGN_LEFT:
+ return "left";
+ case TextField::ALIGN_CENTER:
+ return "center";
+ case TextField::ALIGN_RIGHT:
+ return "right";
+ case TextField::ALIGN_JUSTIFY:
+ return "justify";
+ default:
+ log_error("Uknown alignment value: %d, take as left",
a);
+ return "left";
+ }
+}
+
} // anonymous namespace
} // gnash namespace
=== modified file 'libcore/asobj/flash/text/TextFormat_as.h'
--- a/libcore/asobj/flash/text/TextFormat_as.h 2009-05-28 17:29:17 +0000
+++ b/libcore/asobj/flash/text/TextFormat_as.h 2009-06-08 18:31:05 +0000
@@ -21,18 +21,228 @@
#define GNASH_ASOBJ3_TEXTFORMAT_H
#ifdef HAVE_CONFIG_H
+#include "as_object.h" // for inheritance of TextFormat
#include "gnashconfig.h"
+#include "TextField.h" // for TextAlignment enum
+#include "RGBA.h" // for rgba
+#include <boost/cstdint.hpp> // for boost::uint32_t
+#include <string>
#endif
namespace gnash {
// Forward declarations
-class as_object;
-
-/// Initialize the global TextFormat class
-void textformat_class_init(as_object& global);
-
+class TextFormat_as : public as_object
+{
+
+public:
+
+ TextFormat_as();
+ ~TextFormat_as() {}
+
+ static void registerNative(as_object& global);
+
+ /// Initialize the global Color class
+ static void init(as_object& global);
+
+ /// Return a Boolean value that indicates whether the text is
underlined.
+ bool underlined() const { return _underline; }
+ bool underlinedDefined() const { return _flags&DEFunderline; }
+
+ /// Return a Boolean value that indicates whether the text is
italicized.
+ bool italiced() const { return _italic; }
+ bool italicedDefined() const { return _flags&DEFitalic; }
+
+ /// Return a Boolean value that indicates whether the text is boldface.
+ bool bold() const { return _bold; }
+ bool boldDefined() const { return _flags&DEFbold; }
+
+ bool bullet() const { return _bullet; }
+ bool bulletDefined() const { return _flags&DEFbullet; }
+
+ /// Return the color of text using this text format.
+ const rgba& color() const { return _color; }
+ bool colorDefined() const { return _flags&DEFcolor; }
+
+ /// \brief
+ /// Return an integer that indicates the indentation from the left
+ /// margin to the first DisplayObject in the paragraph
+ boost::uint16_t indent() const { return _indent; }
+ bool indentDefined() const { return _flags&DEFindent; }
+
+ /// Return the alignment of the paragraph.
+ TextField::TextAlignment align() const { return _align; }
+ bool alignDefined() const { return _flags&DEFalign; }
+
+ /// Return the name of a font for text as a string.
+ const std::string& font() const { return _font; }
+ bool fontDefined() const { return _flags&DEFfont; }
+
+ // See doc for _target member
+ const std::string& target() const { return _target; }
+ bool targetDefined() const { return _flags&DEFtarget; }
+
+ // See doc for _target member
+ void targetSet(const std::string& s) { _target=s; _flags |= DEFtarget; }
+
+ // See doc for _url member
+ const std::string& url() const { return _url; }
+ bool urlDefined() const { return _flags&DEFurl; }
+
+ // See doc for _url member
+ void urlSet(const std::string& s) { _url=s; _flags |= DEFurl; }
+
+ ///
+ boost::uint16_t blockIndent() { return _blockIndent; }
+ bool blockIndentDefined() const { return _flags&DEFblockIndent; }
+
+ /// Return a number that indicates the amount of leading vertical
+ /// space between lines.
+ boost::uint16_t leading() { return _leading; }
+ bool leadingDefined() const { return _flags&DEFleading; }
+
+ /// Indicates the left margin of the paragraph, in points.
+ boost::uint16_t leftMargin() { return _leftMargin; }
+ bool leftMarginDefined() const { return _flags&DEFleftMargin; }
+
+ /// Indicates the right margin of the paragraph, in points.
+ boost::uint16_t rightMargin() { return _rightMargin; }
+ bool rightMarginDefined() const { return _flags&DEFrightMargin; }
+
+ /// Return a float that indicates the point size in twips.
+ boost::uint16_t size() { return _pointSize; }
+ bool sizeDefined() const { return _flags&DEFsize; }
+
+ void underlinedSet(bool x) { _underline = x; _flags |= DEFunderline; }
+ void italicedSet(bool x) { _italic = x; _flags |= DEFitalic; }
+ void boldSet(bool x) { _bold = x; _flags |= DEFbold; }
+ void bulletSet(bool x) { _bullet = x; _flags |= DEFbullet; }
+ void colorSet(const rgba& x) { _color = x; _flags |= DEFcolor; }
+ void indentSet(boost::uint16_t x) { _indent = x; _flags |=
DEFindent; }
+ void fontSet(const std::string& font) { _font=font; _flags |= DEFfont; }
+
+ void alignSet(TextField::TextAlignment x) {
+ _align = x;
+ _flags |= DEFalign;
+ }
+
+ void alignSet(const std::string& align);
+
+ void blockIndentSet(boost::uint16_t x) {
+ _blockIndent = x;
+ _flags |= DEFblockIndent;
+ }
+
+ void leadingSet(boost::uint16_t x) {
+ _leading = x;
+ _flags |= DEFleading;
+ }
+
+ void leftMarginSet(boost::uint16_t x) {
+ _leftMargin = x;
+ _flags |= DEFleftMargin;
+ }
+
+ void rightMarginSet(boost::uint16_t x) {
+ _rightMargin = x;
+ _flags |= DEFrightMargin;
+ }
+
+ /// Set font point size in twips
+ void sizeSet(boost::uint16_t x) {
+ _pointSize = x;
+ _flags |= DEFsize;
+ }
+
+ private:
+
+ enum {
+ DEFunderline =1<<0,
+ DEFbold =1<<1,
+ DEFitalic =1<<2,
+ DEFbullet =1<<3,
+ DEFalign =1<<4,
+ DEFblockIndent =1<<5,
+ DEFcolor =1<<6,
+ DEFfont =1<<7,
+ DEFindent =1<<8,
+ DEFleading =1<<9,
+ DEFleftMargin =1<<10,
+ DEFrightMargin =1<<11,
+ DEFpointSize =1<<12,
+ DEFtabStops =1<<13,
+ DEFtarget =1<<14,
+ DEFurl =1<<15,
+ DEFsize =1<<16
+ };
+
+ // need at least 17 bit here... (1<<16)
+ boost::uint32_t _flags;
+
+ /// A Boolean value that indicates whether the text is underlined.
+ bool _underline;
+
+ /// A Boolean value that indicates whether the text is boldface.
+ bool _bold;
+
+ /// A Boolean value that indicates whether the text is italicized.
+ bool _italic;
+
+ //
+ bool _bullet;
+
+ /// The alignment of the paragraph, represented as a string.
+ //
+ /// If "left", the paragraph is left-aligned. If "center", the
+ /// paragraph is centered. If "right", the paragraph is
+ /// right-aligned. If "justify", the paragraph is justified.
+ ///
+ TextField::TextAlignment _align;
+
+ //
+ boost::uint16_t _blockIndent;
+
+ /// The color of text using this text format.
+ //
+ /// A number containing three 8-bit RGB components; for example,
+ /// 0xFF0000 is red, 0x00FF00 is green.
+ rgba _color;
+
+ // The name of a font for text as a string.
+ std::string _font;
+
+ /// An integer that indicates the indentation from the left
+ /// margin to the first DisplayObject in the paragraph (twips)
+ boost::uint16_t _indent;
+
+ /// A number that indicates the amount of leading vertical
+ /// space between lines (twips)
+ boost::uint16_t _leading;
+
+ /// Indicates the left margin of the paragraph, in points (twips)
+ boost::uint16_t _leftMargin;
+
+ /// Indicates the right margin of the paragraph, in points (twips).
+ boost::uint16_t _rightMargin;
+
+ /// Point size in twips.
+ boost::uint16_t _pointSize;
+
+ ///
+ int _tabStops;
+
+ /// The target window where the hyperlink is displayed.
+ /// If the target window is an empty string, the text is displayed in
+ /// the default target window _self. If the url parameter is
+ /// set to an empty string or to the value null, you can get
+ /// or set this property, but the property will have no effect.
+ std::string _target;
+
+ /// The URL to which the text in this text format hyperlinks.
+ /// If url is an empty string, the text does not have a hyperlink
+ std::string _url;
+};
} // gnash namespace
// GNASH_ASOBJ3_TEXTFORMAT_H
=== modified file 'libcore/asobj/flash/text/text.am'
--- a/libcore/asobj/flash/text/text.am 2009-06-08 17:00:03 +0000
+++ b/libcore/asobj/flash/text/text.am 2009-06-08 18:31:05 +0000
@@ -96,7 +96,7 @@
# FIXME: already exists
if BUILD_TEXTFORMAT_AS3
-# TEXT_SOURCES += asobj/flash/text/TextFormat_as.cpp
+TEXT_SOURCES += asobj/flash/text/TextFormat_as.cpp
TEXT_HEADERS += asobj/flash/text/TextFormat_as.h
endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11040: Merge with trunk.,
Bob Naugle <=