gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/Makefile.am server/asobj...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/Makefile.am server/asobj...
Date: Wed, 09 Apr 2008 20:52:46 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/04/09 20:52:46

Modified files:
        .              : ChangeLog 
        server         : Makefile.am 
        server/asobj   : Global.cpp Makefile.am 
        server/parser  : edit_text_character_def.h text_character_def.h 
Added files:
        server/asobj   : TextFormat.cpp TextFormat.h 
Removed files:
        server         : textformat.cpp textformat.h 

Log message:
                * server/Makefile.am, server/textformat.{cpp,h},
                  server/asobj/Global.cpp, server/asobj/Makefile.am,
                  server/asobj/TextFormat.{cpp,h}:
                  Move TextFormat stuff under asobj/
                * server/parser/edit_text_character_def.h,
                  server/parser/text_character_def.h: remove unused (and now
                  obsoleted) textformat.h include.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6230&r2=1.6231
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Makefile.am?cvsroot=gnash&r1=1.140&r2=1.141
http://cvs.savannah.gnu.org/viewcvs/gnash/server/textformat.cpp?cvsroot=gnash&r1=1.37&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/textformat.h?cvsroot=gnash&r1=1.24&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.107&r2=1.108
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Makefile.am?cvsroot=gnash&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/TextFormat.cpp?cvsroot=gnash&rev=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/TextFormat.h?cvsroot=gnash&rev=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/edit_text_character_def.h?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/text_character_def.h?cvsroot=gnash&r1=1.10&r2=1.11

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6230
retrieving revision 1.6231
diff -u -b -r1.6230 -r1.6231
--- ChangeLog   9 Apr 2008 20:34:50 -0000       1.6230
+++ ChangeLog   9 Apr 2008 20:52:44 -0000       1.6231
@@ -1,5 +1,15 @@
 2008-04-09 Sandro Santilli <address@hidden>
 
+       * server/Makefile.am, server/textformat.{cpp,h},
+         server/asobj/Global.cpp, server/asobj/Makefile.am,
+         server/asobj/TextFormat.{cpp,h}:
+         Move TextFormat stuff under asobj/
+       * server/parser/edit_text_character_def.h,
+         server/parser/text_character_def.h: remove unused (and now
+         obsoleted) textformat.h include.
+
+2008-04-09 Sandro Santilli <address@hidden>
+
        * server/textformat.{cpp,h}: stub TextFormat in the up-to-date way
        * server/asobj/ClassHierarchy.cpp: don't include textformat.h
        * server/asobj/Global.cpp: initialize TextFormat object in the 

Index: server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/Makefile.am,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -b -r1.140 -r1.141
--- server/Makefile.am  28 Mar 2008 21:30:22 -0000      1.140
+++ server/Makefile.am  9 Apr 2008 20:52:45 -0000       1.141
@@ -101,7 +101,6 @@
        stream.cpp \
        styles.cpp \
        text.cpp \
-       textformat.cpp \
        timers.cpp \
        types.cpp       \
        $(FREETYPE_SOURCES) \
@@ -180,7 +179,6 @@
        swf_event.h \
        swf_function.h \
        text.h \
-       textformat.h \
        timers.h \
        types.h \
        video_stream_instance.h \

Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -b -r1.107 -r1.108
--- server/asobj/Global.cpp     9 Apr 2008 20:34:53 -0000       1.107
+++ server/asobj/Global.cpp     9 Apr 2008 20:52:45 -0000       1.108
@@ -54,7 +54,7 @@
 #include "Sound.h"
 #include "Stage.h"
 #include "System.h"
-#include "textformat.h"
+#include "TextFormat.h"
 #include "TextSnapshot.h"
 #include "video_stream_instance.h"
 #include "extension.h"

Index: server/asobj/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Makefile.am,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- server/asobj/Makefile.am    28 Mar 2008 21:30:23 -0000      1.51
+++ server/asobj/Makefile.am    9 Apr 2008 20:52:46 -0000       1.52
@@ -76,7 +76,8 @@
        Sound.cpp \
        Stage.cpp \
        System.cpp \
-       TextSnapshot.cpp\
+       TextFormat.cpp \
+       TextSnapshot.cpp \
        MovieClipLoader.cpp\
        string.cpp \
        xml.cpp \
@@ -127,6 +128,7 @@
        SoundMad.h \
        Stage.h \
        System.h \
+       TextFormat.h \
        TextSnapshot.h \
        gstring.h \
        xml.h \

Index: server/parser/edit_text_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/edit_text_character_def.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/parser/edit_text_character_def.h     9 Apr 2008 20:34:53 -0000       
1.26
+++ server/parser/edit_text_character_def.h     9 Apr 2008 20:52:46 -0000       
1.27
@@ -21,7 +21,6 @@
 #include "types.h"
 #include "character_def.h" // for inheritance
 #include "rect.h" // for composition
-#include "textformat.h" // for composition
 
 namespace gnash {
 

Index: server/parser/text_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/text_character_def.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/parser/text_character_def.h  21 Jan 2008 20:56:01 -0000      1.10
+++ server/parser/text_character_def.h  9 Apr 2008 20:52:46 -0000       1.11
@@ -27,7 +27,6 @@
 
 #include "character_def.h" // for inheritance
 #include "text.h" // for text_glyph_record
-#include "textformat.h" // maybe we should include it here
 #include "styles.h" 
 #include "rect.h" // for composition
 

Index: server/asobj/TextFormat.cpp
===================================================================
RCS file: server/asobj/TextFormat.cpp
diff -N server/asobj/TextFormat.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/asobj/TextFormat.cpp 9 Apr 2008 20:52:46 -0000       1.3
@@ -0,0 +1,248 @@
+// textformat.cpp:  ActionScript text formatting decorators, for Gnash.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008 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.h"
+#include "fn_call.h"
+#include "builtin_function.h" // for getter/setter properties
+#include "namedStrings.h"
+#include "VM.h"
+
+#define ONCE(x) { static bool warned=false; if (!warned) { warned=true; x; } }
+
+namespace gnash {
+
+static as_value textformat_new(const fn_call& fn);
+static as_object* getTextFormatInterface();
+static void attachTextFormatInterface(as_object& o);
+
+
+TextFormat::TextFormat()
+       :
+       as_object(getTextFormatInterface()),
+       _underline(false),
+       _bold(false),
+       _italic(false),
+       _bullet(false),
+       _block_indent(-1),
+       _color(0),
+       _indent(-1),
+       _leading(-1),
+       _left_margin(-1),
+       _right_margin(-1),
+       _point_size(-1),
+       _tab_stops(-1),
+       _target(-1)
+{
+       //log_debug("%s:", __FUNCTION__);
+       init_member("getTextExtent", new 
builtin_function(TextFormat::getTextExtent_method));
+}
+
+/// new TextFormat([font, [size, [color, [bold, [italic, [underline, [url, 
[target, [align,[leftMargin, [rightMargin, [indent, [leading]]]]]]]]]]]]])
+static as_value
+textformat_new(const fn_call& /* fn */)
+{
+  //GNASH_REPORT_FUNCTION;
+  //log_debug(_("%s: args=%d"), __FUNCTION__, nargs);
+
+  boost::intrusive_ptr<TextFormat> text_obj = new TextFormat;
+  ONCE(log_unimpl("TextFormat")); // need to handle args too..
+  
+  return as_value(text_obj.get());
+}
+
+as_value
+TextFormat::display_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.display") );
+       return as_value();
+}
+
+as_value
+TextFormat::bullet_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.bullet") );
+       return as_value();
+}
+
+as_value
+TextFormat::tabStops_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.tabStops") );
+       return as_value();
+}
+
+as_value
+TextFormat::blockIndent_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.blockIndent") );
+       return as_value();
+}
+
+as_value
+TextFormat::leading_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.leading") );
+       return as_value();
+}
+
+as_value
+TextFormat::indent_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.indent") );
+       return as_value();
+}
+
+as_value
+TextFormat::rightMargin_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.rightMargin") );
+       return as_value();
+}
+
+as_value
+TextFormat::leftMargin_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.leftMargin") );
+       return as_value();
+}
+
+as_value
+TextFormat::align_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.align") );
+       return as_value();
+}
+
+as_value
+TextFormat::underline_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.underline") );
+       return as_value();
+}
+
+as_value
+TextFormat::italic_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.italic") );
+       return as_value();
+}
+
+as_value
+TextFormat::bold_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.bold") );
+       return as_value();
+}
+
+as_value
+TextFormat::target_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.target") );
+       return as_value();
+}
+
+as_value
+TextFormat::url_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.url") );
+       return as_value();
+}
+
+as_value
+TextFormat::color_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.color") );
+       return as_value();
+}
+
+as_value
+TextFormat::size_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.size") );
+       return as_value();
+}
+
+as_value
+TextFormat::font_getset(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.font") );
+       return as_value();
+}
+
+as_value
+TextFormat::getTextExtent_method(const fn_call& /*fn*/)
+{
+       ONCE( log_unimpl("TextField.getTextExtent") );
+       return as_value();
+}
+
+static void
+attachTextFormatInterface(as_object& o)
+{
+       o.init_readonly_property("display", &TextFormat::display_getset);
+       o.init_readonly_property("bullet", &TextFormat::bullet_getset);
+       o.init_readonly_property("tabStops", &TextFormat::tabStops_getset);
+       o.init_readonly_property("blockIndent", 
&TextFormat::blockIndent_getset);
+       o.init_readonly_property("leading", &TextFormat::leading_getset);
+       o.init_readonly_property("indent", &TextFormat::indent_getset);
+       o.init_readonly_property("rightMargin", 
&TextFormat::rightMargin_getset);
+       o.init_readonly_property("leftMargin", &TextFormat::leftMargin_getset);
+       o.init_readonly_property("align", &TextFormat::align_getset);
+       o.init_readonly_property("underline", &TextFormat::underline_getset);
+       o.init_readonly_property("italic", &TextFormat::italic_getset);
+       o.init_readonly_property("bold", &TextFormat::bold_getset);
+       o.init_readonly_property("target", &TextFormat::target_getset);
+       o.init_readonly_property("url", &TextFormat::url_getset);
+       o.init_readonly_property("color", &TextFormat::color_getset);
+       o.init_readonly_property("size", &TextFormat::size_getset);
+       o.init_readonly_property("font", &TextFormat::font_getset);
+}
+
+static as_object*
+getTextFormatInterface()
+{
+       static boost::intrusive_ptr<as_object> o;
+       if ( ! o )
+       {
+               o = new as_object(getObjectInterface());
+               attachTextFormatInterface(*o);
+       }
+       return o.get();
+}
+
+// extern (used by Global.cpp)
+void textformat_class_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());
+
+}
+
+} // end of gnash namespace

Index: server/asobj/TextFormat.h
===================================================================
RCS file: server/asobj/TextFormat.h
diff -N server/asobj/TextFormat.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/asobj/TextFormat.h   9 Apr 2008 20:52:46 -0000       1.3
@@ -0,0 +1,204 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008 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 __TEXTFORMAT_H__
+#define __TEXTFORMAT_H__
+
+#include "as_object.h" // for inheritance of TextFormat
+#include <boost/cstdint.hpp> // for boost::uint32_t
+#include <string>
+
+// Forward declarations
+namespace gnash {  
+       //class as_object;
+}
+
+namespace gnash {  
+
+class DSOEXPORT TextFormat : public as_object
+{
+public:
+  
+       TextFormat();
+       ~TextFormat() {}
+
+       /// Return a Boolean value that indicates whether the text is 
underlined.
+       bool underlined()  { return _underline; }
+
+       /// Return a Boolean value that indicates whether the text is 
italicized.
+       bool italiced()    { return _italic; }
+
+       /// Return a Boolean value that indicates whether the text is boldface.
+       bool bold()        { return _bold; }
+
+       bool bullet()      { return _bullet; }
+
+       /// Return the color of text using this text format.
+       //
+       /// A number containing three 8-bit RGB components; for example,
+        /// 0xFF0000 is red, 0x00FF00 is green.
+       boost::uint32_t color() const { return _color; }
+
+       /// \brief
+       /// Return ann integer that indicates the indentation from the left
+        /// margin to the first character in the paragraph
+       float indent() const { return _indent; }
+
+       /// Return 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.
+       ///
+       /// FIXME: use an enum !
+       ///
+       const std::string& align() const { return _align; }
+
+       /// Return the name of a font for text as a string.
+       const std::string& font() const { return _font; }
+
+       ///
+       float blockIndent() { return _block_indent; }
+
+       /// Return a number that indicates the amount of leading vertical
+       /// space between lines.
+       float leading()     { return _leading; }
+
+       /// Indicates the left margin of the paragraph, in points.
+       float leftMargin()  { return _left_margin; }
+
+       /// Indicates the right margin of the paragraph, in points.
+       float RightMargin() { return _right_margin; }
+
+       /// Return a float that indicates the point size.
+       float size()        { return _point_size; }
+
+       void underlinedSet(bool x)   { _underline = x; }
+       void italicedSet(bool x)     { _italic = x; }
+       void boldSet(bool x)         { _bold = x; }
+       void bulletSet(bool x)       { _bullet = x; }
+       void colorSet(boost::uint32_t x)      { _color = x; }
+       void indentSet(float x)      { _indent = x; }
+
+       void alignSet(const std::string& x)  { _align = x; }
+
+       void blockIndentSet(float x)   { _block_indent = x; }
+       void leadingSet(float x)     { _leading = x; }
+       void leftMarginSet(float x)  { _left_margin = x; }
+       void rightMarginSet(float x) { _right_margin = x; }
+       void sizeSet(float x)        { _point_size = x; }
+
+       static as_value display_getset(const fn_call& fn);
+       static as_value bullet_getset(const fn_call& fn);
+       static as_value tabStops_getset(const fn_call& fn);
+       static as_value blockIndent_getset(const fn_call& fn);
+       static as_value leading_getset(const fn_call& fn);
+       static as_value indent_getset(const fn_call& fn);
+       static as_value rightMargin_getset(const fn_call& fn);
+       static as_value leftMargin_getset(const fn_call& fn);
+       static as_value align_getset(const fn_call& fn);
+       static as_value underline_getset(const fn_call& fn);
+       static as_value italic_getset(const fn_call& fn);
+       static as_value bold_getset(const fn_call& fn);
+       static as_value target_getset(const fn_call& fn);
+       static as_value url_getset(const fn_call& fn);
+       static as_value color_getset(const fn_call& fn);
+       static as_value size_getset(const fn_call& fn);
+       static as_value font_getset(const fn_call& fn);
+       static as_value getTextExtent_method(const fn_call& fn);
+
+  
+private:
+
+
+       /// 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.
+       ///
+       /// FIXME: use an enum !
+       ///
+       std::string _align;
+
+       // 
+       float           _block_indent;
+
+       /// The color of text using this text format.
+       //
+       /// A number containing three 8-bit RGB components; for example,
+        /// 0xFF0000 is red, 0x00FF00 is green.
+       boost::uint32_t _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 character in the paragraph
+       float           _indent;
+
+       /// A number that indicates the amount of leading vertical
+       /// space between lines.
+       float           _leading;
+
+       /// Indicates the left margin of the paragraph, in points.
+       float           _left_margin;
+
+       /// Indicates the right margin of the paragraph, in points.
+       float           _right_margin;
+
+       /// An float that indicates the point size.
+       float           _point_size;
+
+       ///
+       int             _tab_stops;
+
+       /// 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.
+       int             _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;  
+
+};
+ 
+
+/// Initialize the global Color class
+void textformat_class_init(as_object& global);
+
+} // end of gnash namespace
+
+#endif // __TEXTFORMAT_H__

Index: server/textformat.cpp
===================================================================
RCS file: server/textformat.cpp
diff -N server/textformat.cpp
--- server/textformat.cpp       9 Apr 2008 20:34:51 -0000       1.37
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,441 +0,0 @@
-// textformat.cpp:  ActionScript text formatting decorators, for Gnash.
-// 
-//   Copyright (C) 2005, 2006, 2007, 2008 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.h"
-#include "fn_call.h"
-#include "builtin_function.h" // for getter/setter properties
-#include "namedStrings.h"
-#include "VM.h"
-
-#define ONCE(x) { static bool warned=false; if (!warned) { warned=true; x; } }
-
-namespace gnash {
-
-static as_value textformat_new(const fn_call& fn);
-static as_object* getTextFormatInterface();
-static void attachTextFormatInterface(as_object& o);
-
-class DSOEXPORT TextFormat : public as_object
-{
-public:
-  
-       TextFormat();
-       ~TextFormat() {}
-
-       /// Return a Boolean value that indicates whether the text is 
underlined.
-       bool underlined()  { return _underline; }
-
-       /// Return a Boolean value that indicates whether the text is 
italicized.
-       bool italiced()    { return _italic; }
-
-       /// Return a Boolean value that indicates whether the text is boldface.
-       bool bold()        { return _bold; }
-
-       bool bullet()      { return _bullet; }
-
-       /// Return the color of text using this text format.
-       //
-       /// A number containing three 8-bit RGB components; for example,
-        /// 0xFF0000 is red, 0x00FF00 is green.
-       boost::uint32_t color() const { return _color; }
-
-       /// \brief
-       /// Return ann integer that indicates the indentation from the left
-        /// margin to the first character in the paragraph
-       float indent() const { return _indent; }
-
-       /// Return 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.
-       ///
-       /// FIXME: use an enum !
-       ///
-       const std::string& align() const { return _align; }
-
-       /// Return the name of a font for text as a string.
-       const std::string& font() const { return _font; }
-
-       ///
-       float blockIndent() { return _block_indent; }
-
-       /// Return a number that indicates the amount of leading vertical
-       /// space between lines.
-       float leading()     { return _leading; }
-
-       /// Indicates the left margin of the paragraph, in points.
-       float leftMargin()  { return _left_margin; }
-
-       /// Indicates the right margin of the paragraph, in points.
-       float RightMargin() { return _right_margin; }
-
-       /// Return a float that indicates the point size.
-       float size()        { return _point_size; }
-
-       void underlinedSet(bool x)   { _underline = x; }
-       void italicedSet(bool x)     { _italic = x; }
-       void boldSet(bool x)         { _bold = x; }
-       void bulletSet(bool x)       { _bullet = x; }
-       void colorSet(boost::uint32_t x)      { _color = x; }
-       void indentSet(float x)      { _indent = x; }
-
-       void alignSet(const std::string& x)  { _align = x; }
-
-       void blockIndentSet(float x)   { _block_indent = x; }
-       void leadingSet(float x)     { _leading = x; }
-       void leftMarginSet(float x)  { _left_margin = x; }
-       void rightMarginSet(float x) { _right_margin = x; }
-       void sizeSet(float x)        { _point_size = x; }
-
-       // In a paragraph, change the format of a range of characters.
-       void setTextFormat (TextFormat &format);
-       void setTextFormat (int index, TextFormat &format);
-       void setTextFormat (int start, int end, TextFormat &format);
-
-       TextFormat &getTextFormat ();
-       TextFormat &getTextFormat (int index);
-       TextFormat &getTextFormat (int start, int end);
-
-       int getTextExtant();
-
-       static as_value display_getset(const fn_call& fn);
-       static as_value bullet_getset(const fn_call& fn);
-       static as_value tabStops_getset(const fn_call& fn);
-       static as_value blockIndent_getset(const fn_call& fn);
-       static as_value leading_getset(const fn_call& fn);
-       static as_value indent_getset(const fn_call& fn);
-       static as_value rightMargin_getset(const fn_call& fn);
-       static as_value leftMargin_getset(const fn_call& fn);
-       static as_value align_getset(const fn_call& fn);
-       static as_value underline_getset(const fn_call& fn);
-       static as_value italic_getset(const fn_call& fn);
-       static as_value bold_getset(const fn_call& fn);
-       static as_value target_getset(const fn_call& fn);
-       static as_value url_getset(const fn_call& fn);
-       static as_value color_getset(const fn_call& fn);
-       static as_value size_getset(const fn_call& fn);
-       static as_value font_getset(const fn_call& fn);
-       static as_value getTextExtent_method(const fn_call& fn);
-
-  
-private:
-
-
-       /// 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.
-       ///
-       /// FIXME: use an enum !
-       ///
-       std::string _align;
-
-       // 
-       float           _block_indent;
-
-       /// The color of text using this text format.
-       //
-       /// A number containing three 8-bit RGB components; for example,
-        /// 0xFF0000 is red, 0x00FF00 is green.
-       boost::uint32_t _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 character in the paragraph
-       float           _indent;
-
-       /// A number that indicates the amount of leading vertical
-       /// space between lines.
-       float           _leading;
-
-       /// Indicates the left margin of the paragraph, in points.
-       float           _left_margin;
-
-       /// Indicates the right margin of the paragraph, in points.
-       float           _right_margin;
-
-       /// An float that indicates the point size.
-       float           _point_size;
-
-       ///
-       int             _tab_stops;
-
-       /// 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.
-       int             _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;  
-
-};
- 
-
-TextFormat::TextFormat()
-       :
-       as_object(getTextFormatInterface()),
-       _underline(false),
-       _bold(false),
-       _italic(false),
-       _bullet(false),
-       _block_indent(-1),
-       _color(0),
-       _indent(-1),
-       _leading(-1),
-       _left_margin(-1),
-       _right_margin(-1),
-       _point_size(-1),
-       _tab_stops(-1),
-       _target(-1)
-{
-       //log_debug("%s:", __FUNCTION__);
-       init_member("getTextExtent", new 
builtin_function(TextFormat::getTextExtent_method));
-}
-
-// In a paragraph, change the format of a range of characters.
-void
-TextFormat::setTextFormat (TextFormat& /*format*/)
-{
-  //GNASH_REPORT_FUNCTION;
-}
-
-void
-TextFormat::setTextFormat (int /*index*/, TextFormat& /*format*/)
-{
-  //GNASH_REPORT_FUNCTION;
-}
-
-void
-TextFormat::setTextFormat (int /*start*/, int /*end*/, TextFormat& /*format*/)
-{
-  //GNASH_REPORT_FUNCTION;
-}
-
-/// new TextFormat([font, [size, [color, [bold, [italic, [underline, [url, 
[target, [align,[leftMargin, [rightMargin, [indent, [leading]]]]]]]]]]]]])
-static as_value
-textformat_new(const fn_call& /* fn */)
-{
-  //GNASH_REPORT_FUNCTION;
-  //log_debug(_("%s: args=%d"), __FUNCTION__, nargs);
-
-  boost::intrusive_ptr<TextFormat> text_obj = new TextFormat;
-  ONCE(log_unimpl("TextFormat")); // need to handle args too..
-  
-  return as_value(text_obj.get());
-}
-
-as_value
-TextFormat::display_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.display") );
-       return as_value();
-}
-
-as_value
-TextFormat::bullet_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.bullet") );
-       return as_value();
-}
-
-as_value
-TextFormat::tabStops_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.tabStops") );
-       return as_value();
-}
-
-as_value
-TextFormat::blockIndent_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.blockIndent") );
-       return as_value();
-}
-
-as_value
-TextFormat::leading_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.leading") );
-       return as_value();
-}
-
-as_value
-TextFormat::indent_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.indent") );
-       return as_value();
-}
-
-as_value
-TextFormat::rightMargin_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.rightMargin") );
-       return as_value();
-}
-
-as_value
-TextFormat::leftMargin_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.leftMargin") );
-       return as_value();
-}
-
-as_value
-TextFormat::align_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.align") );
-       return as_value();
-}
-
-as_value
-TextFormat::underline_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.underline") );
-       return as_value();
-}
-
-as_value
-TextFormat::italic_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.italic") );
-       return as_value();
-}
-
-as_value
-TextFormat::bold_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.bold") );
-       return as_value();
-}
-
-as_value
-TextFormat::target_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.target") );
-       return as_value();
-}
-
-as_value
-TextFormat::url_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.url") );
-       return as_value();
-}
-
-as_value
-TextFormat::color_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.color") );
-       return as_value();
-}
-
-as_value
-TextFormat::size_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.size") );
-       return as_value();
-}
-
-as_value
-TextFormat::font_getset(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.font") );
-       return as_value();
-}
-
-as_value
-TextFormat::getTextExtent_method(const fn_call& /*fn*/)
-{
-       ONCE( log_unimpl("TextField.getTextExtent") );
-       return as_value();
-}
-
-static void
-attachTextFormatInterface(as_object& o)
-{
-       o.init_readonly_property("display", &TextFormat::display_getset);
-       o.init_readonly_property("bullet", &TextFormat::bullet_getset);
-       o.init_readonly_property("tabStops", &TextFormat::tabStops_getset);
-       o.init_readonly_property("blockIndent", 
&TextFormat::blockIndent_getset);
-       o.init_readonly_property("leading", &TextFormat::leading_getset);
-       o.init_readonly_property("indent", &TextFormat::indent_getset);
-       o.init_readonly_property("rightMargin", 
&TextFormat::rightMargin_getset);
-       o.init_readonly_property("leftMargin", &TextFormat::leftMargin_getset);
-       o.init_readonly_property("align", &TextFormat::align_getset);
-       o.init_readonly_property("underline", &TextFormat::underline_getset);
-       o.init_readonly_property("italic", &TextFormat::italic_getset);
-       o.init_readonly_property("bold", &TextFormat::bold_getset);
-       o.init_readonly_property("target", &TextFormat::target_getset);
-       o.init_readonly_property("url", &TextFormat::url_getset);
-       o.init_readonly_property("color", &TextFormat::color_getset);
-       o.init_readonly_property("size", &TextFormat::size_getset);
-       o.init_readonly_property("font", &TextFormat::font_getset);
-}
-
-static as_object*
-getTextFormatInterface()
-{
-       static boost::intrusive_ptr<as_object> o;
-       if ( ! o )
-       {
-               o = new as_object(getObjectInterface());
-               attachTextFormatInterface(*o);
-       }
-       return o.get();
-}
-
-// extern (used by Global.cpp)
-void textformat_class_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());
-
-}
-
-} // end of gnash namespace

Index: server/textformat.h
===================================================================
RCS file: server/textformat.h
diff -N server/textformat.h
--- server/textformat.h 9 Apr 2008 20:34:52 -0000       1.24
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006, 2007, 2008 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 __TEXTFORMAT_H__
-#define __TEXTFORMAT_H__
-
-// Forward declarations
-namespace gnash {  
-       class as_object;
-}
-
-namespace gnash {  
-
-/// Initialize the global Color class
-void textformat_class_init(as_object& global);
-
-} // end of gnash namespace
-
-#endif // __TEXTFORMAT_H__




reply via email to

[Prev in Thread] Current Thread [Next in Thread]