gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ...
Date: Sun, 22 Jul 2007 03:29:26 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/07/22 03:29:26

Modified files:
        .              : ChangeLog 
        server         : edit_text_character.cpp edit_text_character.h 
                         types.h 
        server/parser  : edit_text_character_def.h 

Log message:
                * server/types.h (rgba::toRGB): const-corrected.
                * server/edit_text_character.{cpp,h}: Add a member for text 
color,
                  make 'textColor' a proper property.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3779&r2=1.3780
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.84&r2=1.85
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/gnash/server/types.h?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/edit_text_character_def.h?cvsroot=gnash&r1=1.16&r2=1.17

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3779
retrieving revision 1.3780
diff -u -b -r1.3779 -r1.3780
--- ChangeLog   21 Jul 2007 01:08:38 -0000      1.3779
+++ ChangeLog   22 Jul 2007 03:29:25 -0000      1.3780
@@ -1,3 +1,9 @@
+2007-07-21 Sandro Santilli <address@hidden>
+
+       * server/types.h (rgba::toRGB): const-corrected.
+       * server/edit_text_character.{cpp,h}: Add a member for text color,
+         make 'textColor' a proper property.
+
 2007-07-21 Markus Gothe <address@hidden>
 
        * gui/Makefile.am: Added BUILD_GUI_AQUA.

Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -b -r1.84 -r1.85
--- server/edit_text_character.cpp      20 Jul 2007 16:42:35 -0000      1.84
+++ server/edit_text_character.cpp      22 Jul 2007 03:29:25 -0000      1.85
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: edit_text_character.cpp,v 1.84 2007/07/20 16:42:35 udog Exp $ */
+/* $Id: edit_text_character.cpp,v 1.85 2007/07/22 03:29:25 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -67,6 +67,7 @@
 static as_value textfield_border_getset(const fn_call& fn);
 static as_value textfield_backgroundColor_getset(const fn_call& fn);
 static as_value textfield_borderColor_getset(const fn_call& fn);
+static as_value textfield_textColor_getset(const fn_call& fn);
 
        namespace
        {
@@ -322,6 +323,8 @@
        o.init_property("border", *getset, *getset);
        getset = new builtin_function(textfield_borderColor_getset);
        o.init_property("borderColor", *getset, *getset);
+       getset = new builtin_function(textfield_textColor_getset);
+       o.init_property("textColor", *getset, *getset);
 
 
        if ( target_version  < 7 ) return;
@@ -381,7 +384,8 @@
        _drawBackground(m_def->has_border()),
        _backgroundColor(255,255,255,255),
        _drawBorder(m_def->has_border()),
-       _borderColor(0,0,0,255)
+       _borderColor(0,0,0,255),
+       _textColor(m_def->get_text_color())
 {
        assert(parent);
        assert(m_def);
@@ -446,16 +450,9 @@
        if ( drawBorder || drawBackground )
        {
                matrix  mat = get_world_matrix();
-               
-               // @@ hm, should we apply the color xform?  It seems logical; 
need to test.
-               // cxform       cx = get_world_cxform();
-
-               // Show white background + black bounding box.
                render::set_matrix(mat);
-               //mat.print();
 
                point   coords[4];
-               
                coords[0] = def_bounds.get_corner(0);
                coords[1] = def_bounds.get_corner(1);
                coords[2] = def_bounds.get_corner(2);
@@ -760,20 +757,6 @@
                set_cxform(cx);
                return;
        }
-       case M_TEXTCOLOR:
-               //else if (name == "textColor")
-       {       
-               // The arg is 0xRRGGBB format.
-               uint32_t        rgb = (uint32_t) val.to_number();
-
-               cxform  cx = get_cxform();
-               cx.m_[0][0] = fclamp(((rgb >> 16) & 255) / 255.0f, 0, 1);
-               cx.m_[1][0] = fclamp(((rgb >>  8) & 255) / 255.0f, 0, 1);
-               cx.m_[2][0] = fclamp(((rgb      ) & 255) / 255.0f, 0, 1);
-               set_cxform(cx);
-
-               return;
-       }
        // @@ TODO see TextField members in Flash MX docs
        }       // end switch
 
@@ -815,17 +798,6 @@
                val->set_double(cx.m_[3][0] * 100.f);
                return true;
        }
-       case M_TEXTCOLOR:
-               //else if (name == "textColor")
-       {
-               // Return color in 0xRRGGBB format
-               const cxform&   cx = get_cxform();
-               int     r = iclamp(int(cx.m_[0][0] * 255), 0, 255);
-               int     g = iclamp(int(cx.m_[0][0] * 255), 0, 255);
-               int     b = iclamp(int(cx.m_[0][0] * 255), 0, 255);
-               val->set_int((r << 16) + (g << 8) + b);
-               return true;
-       }
        case M_X:
                //else if (name == "_x")
        {
@@ -950,7 +922,7 @@
 
        text_glyph_record       rec;    // one to work on
        rec.m_style.m_font = _font;
-       rec.m_style.m_color = m_def->get_text_color();
+       rec.m_style.m_color = getTextColor(); 
        rec.m_style.m_x_offset = PADDING_TWIPS + std::max(0, 
m_def->get_left_margin() + m_def->get_indent());
        rec.m_style.m_y_offset = PADDING_TWIPS + m_def->get_font_height()
                + (_font->get_leading() - _font->get_descent()) * scale;
@@ -1436,6 +1408,16 @@
        }
 }
 
+void
+edit_text_character::setTextColor(const rgba& col)
+{
+       if ( _textColor != col )
+       {
+               set_invalidated();
+               _textColor = col;
+       }
+}
+
 cxform 
 edit_text_character::get_world_cxform() const
 {
@@ -1522,6 +1504,25 @@
        return as_value();
 }
 
+static as_value
+textfield_textColor_getset(const fn_call& fn)
+{
+       boost::intrusive_ptr<edit_text_character> ptr = 
ensureType<edit_text_character>(fn.this_ptr);
+
+       if ( fn.nargs == 0 ) // getter
+       {
+               return as_value(ptr->getTextColor().toRGB());
+       }
+       else // setter
+       {
+               rgba newColor;
+               newColor.parseRGB( fn.arg(0).to_number<uint32_t>(&fn.env()) );
+               ptr->setTextColor(newColor);
+       }
+
+       return as_value();
+}
+
 } // namespace gnash
 
 

Index: server/edit_text_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- server/edit_text_character.h        20 Jul 2007 16:42:35 -0000      1.38
+++ server/edit_text_character.h        22 Jul 2007 03:29:25 -0000      1.39
@@ -135,6 +135,16 @@
        ///
        void setBorderColor(const rgba& col);
 
+       /// Return color of the text
+       const rgba& getTextColor() const 
+       {
+               return _textColor;
+       }
+
+       /// Set color of the text
+       void setTextColor(const rgba& col);
+
+
 private:
 
        /// Return true if HTML text is allowed 
@@ -237,6 +247,8 @@
 
        rgba _borderColor;
 
+       rgba _textColor;
+
 protected:
 
 #ifdef GNASH_USE_GC

Index: server/types.h
===================================================================
RCS file: /sources/gnash/gnash/server/types.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/types.h      18 Jul 2007 11:10:54 -0000      1.15
+++ server/types.h      22 Jul 2007 03:29:25 -0000      1.16
@@ -80,7 +80,7 @@
                /// This function is meant to be used to
                /// output ActionScript colors in numeric format.
                ///
-               uint32_t toRGB()
+               uint32_t toRGB() const
                {
                        return (m_r<<16) + (m_g<<8) + m_b;
                }

Index: server/parser/edit_text_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/edit_text_character_def.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/parser/edit_text_character_def.h     11 Jul 2007 16:52:47 -0000      
1.16
+++ server/parser/edit_text_character_def.h     22 Jul 2007 03:29:25 -0000      
1.17
@@ -184,6 +184,11 @@
                return m_color;
        }
 
+       /// Set color of the text
+       void set_text_color(const rgba& col) {
+               m_color = col;
+       }
+
        /// \brief
        /// Get extra space between lines (in twips).
        //




reply via email to

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