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: Thu, 10 Apr 2008 21:45:21 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/04/10 21:45:21

Modified files:
        .              : ChangeLog 
        server         : edit_text_character.cpp edit_text_character.h 
        server/asobj   : TextFormat.cpp 
        testsuite/misc-ming.all: DefineEditTextTest.c 

Log message:
                * server/edit_text_character.{cpp,h}: add support for
                  block indentation (that is, indentation of every line
                  in a block of text, including those generated by word-wrap).
                * server/asobj/TextFormat.cpp: implement getter-setter for
                  blockIndent.
                * testsuite/misc-ming.all/DefineEditTextTest.c: test 
blockIndent.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6243&r2=1.6244
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.169&r2=1.170
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.73&r2=1.74
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/TextFormat.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DefineEditTextTest.c?cvsroot=gnash&r1=1.35&r2=1.36

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6243
retrieving revision 1.6244
diff -u -b -r1.6243 -r1.6244
--- ChangeLog   10 Apr 2008 18:14:03 -0000      1.6243
+++ ChangeLog   10 Apr 2008 21:45:20 -0000      1.6244
@@ -1,3 +1,12 @@
+2008-04-10 Sandro Santilli <address@hidden>
+
+       * server/edit_text_character.{cpp,h}: add support for
+         block indentation (that is, indentation of every line
+         in a block of text, including those generated by word-wrap).
+       * server/asobj/TextFormat.cpp: implement getter-setter for
+         blockIndent.
+       * testsuite/misc-ming.all/DefineEditTextTest.c: test blockIndent.
+
 2008-04-10 Udo Giacomozzi <address@hidden>
 
        * server/edit_text_character.cpp: get_topmost_mouse_entity() should

Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -b -r1.169 -r1.170
--- server/edit_text_character.cpp      10 Apr 2008 18:14:03 -0000      1.169
+++ server/edit_text_character.cpp      10 Apr 2008 21:45:20 -0000      1.170
@@ -170,6 +170,7 @@
        tf->alignSet(text->getTextAlignment());
        tf->sizeSet(text->getFontHeight());
        tf->indentSet(text->getIndent());
+       tf->blockIndentSet(text->getBlockIndent());
        tf->leadingSet(text->getLeading());
        tf->leftMarginSet(text->getLeftMargin());
        tf->rightMarginSet(text->getRightMargin());
@@ -234,6 +235,7 @@
        if ( tf->alignDefined() ) text->setAlignment(tf->align());
        if ( tf->sizeDefined() ) text->setFontHeight(tf->size()); // keep twips
        if ( tf->indentDefined() ) text->setIndent(tf->indent());
+       if ( tf->blockIndentDefined() ) text->setBlockIndent(tf->blockIndent());
        if ( tf->leadingDefined() ) text->setLeading(tf->leading());
        if ( tf->leftMarginDefined() ) text->setLeftMargin(tf->leftMargin());
        if ( tf->rightMarginDefined() ) text->setRightMargin(tf->rightMargin());
@@ -471,6 +473,7 @@
        _leading(m_def->get_leading()),
        _alignment(def->get_alignment()),
        _indent(def->get_indent()), 
+       _blockIndent(0),
        _leftMargin(def->get_left_margin()), 
        _rightMargin(def->get_right_margin()), 
        _fontHeight(def->get_font_height()), 
@@ -1281,11 +1284,12 @@
        boost::uint16_t leftMargin = getLeftMargin();
        boost::uint16_t rightMargin = getRightMargin();
        boost::uint16_t indent = getIndent();
+       boost::uint16_t blockIndent = getBlockIndent();
 
        text_glyph_record       rec;    // one to work on
        rec.m_style.setFont(_font.get());
        rec.m_style.m_color = getTextColor(); 
-       rec.m_style.m_x_offset = PADDING_TWIPS + std::max(0, leftMargin + 
indent); 
+       rec.m_style.m_x_offset = PADDING_TWIPS + std::max(0, leftMargin + 
indent + blockIndent);
        rec.m_style.m_y_offset = PADDING_TWIPS + fontHeight
                + (fontLeading - fontDescent);
        rec.m_style.m_text_height = fontHeight;
@@ -1550,8 +1554,8 @@
                                        // Close out this stretch of glyphs.
                                        m_text_glyph_records.push_back(rec);
                                        float   previous_x = x;
-                                       x = getLeftMargin() + PADDING_TWIPS;
-                                       y += getFontHeight() + leading;
+                                       x = leftMargin + blockIndent + 
PADDING_TWIPS;
+                                       y += fontHeight + leading;
 
 
                                        // Start a new record on the next line.
@@ -1997,6 +2001,17 @@
 }
 
 void
+edit_text_character::setBlockIndent(boost::uint16_t h)
+{
+       if ( _blockIndent != h )
+       {
+               set_invalidated();
+               _blockIndent = h;
+               format_text();
+       }
+}
+
+void
 edit_text_character::setRightMargin(boost::uint16_t h)
 {
        if ( _rightMargin != h )

Index: server/edit_text_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.h,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- server/edit_text_character.h        10 Apr 2008 00:41:07 -0000      1.73
+++ server/edit_text_character.h        10 Apr 2008 21:45:20 -0000      1.74
@@ -368,6 +368,13 @@
 
        void setIndent(boost::uint16_t h);
 
+       boost::uint16_t getBlockIndent() const
+       {
+               return _blockIndent;
+       }
+
+       void setBlockIndent(boost::uint16_t h);
+
        edit_text_character_def::alignment getAlignment() const
        {
                return _alignment;
@@ -463,6 +470,10 @@
 
        boost::uint16_t _indent;
 
+       /// Indentation for every line (including the ones created by
+       /// effect of a word-wrap.
+       boost::uint16_t _blockIndent;
+
        boost::uint16_t _leftMargin;
 
        boost::uint16_t _rightMargin;

Index: server/asobj/TextFormat.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/TextFormat.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/asobj/TextFormat.cpp 10 Apr 2008 15:33:18 -0000      1.10
+++ server/asobj/TextFormat.cpp 10 Apr 2008 21:45:21 -0000      1.11
@@ -107,10 +107,23 @@
 }
 
 as_value
-TextFormat::blockIndent_getset(const fn_call& /*fn*/)
+TextFormat::blockIndent_getset(const fn_call& fn)
 {
-       ONCE( log_unimpl("TextField.blockIndent") );
-       return as_value();
+       boost::intrusive_ptr<TextFormat> ptr = 
ensureType<TextFormat>(fn.this_ptr);
+
+       as_value ret;
+
+       if ( fn.nargs == 0 ) // getter
+       {
+               if ( ptr->blockIndentDefined() ) 
ret.set_double(TWIPS_TO_PIXELS(ptr->blockIndent()));
+               else ret.set_null();
+       }
+       else // setter
+       {
+               ptr->blockIndentSet(PIXELS_TO_TWIPS(fn.arg(0).to_int()));
+       }
+
+       return ret;
 }
 
 as_value
@@ -348,6 +361,9 @@
 {
        int flags = 0; // for sure we want to enum, dunno about deleting yet
 
+       // TODO: register natives, see
+       // http://osflash.org/flashcoders/undocumented/asnative
+
        o.init_property("display", &TextFormat::display_getset, 
&TextFormat::display_getset, flags);
        o.init_property("bullet", &TextFormat::bullet_getset, 
&TextFormat::bullet_getset, flags);
        o.init_property("tabStops", &TextFormat::tabStops_getset, 
&TextFormat::tabStops_getset, flags);

Index: testsuite/misc-ming.all/DefineEditTextTest.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/DefineEditTextTest.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- testsuite/misc-ming.all/DefineEditTextTest.c        10 Apr 2008 10:13:31 
-0000      1.35
+++ testsuite/misc-ming.all/DefineEditTextTest.c        10 Apr 2008 21:45:21 
-0000      1.36
@@ -294,6 +294,10 @@
   check_equals(mo, "typeof(dtext2.tf.color)", "'number'");
   check_equals(mo, "etext1.tf.color", "7237488");
   check_equals(mo, "dtext2.tf.color", "7895418");
+  check_equals(mo, "typeof(etext1.tf.blockIndent)", "'number'");
+  check_equals(mo, "typeof(dtext2.tf.blockIndent)", "'number'");
+  check_equals(mo, "etext1.tf.blockIndent", "0");
+  check_equals(mo, "dtext2.tf.blockIndent", "0");
 
   add_actions(mo, "dtext1.background = true;"
                   "etext1.background = true;"




reply via email to

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