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, 15 Jun 2006 21:38:51 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/06/15 21:38:51

Modified files:
        .              : ChangeLog 
        server         : edit_text_character.cpp edit_text_character.h 

Log message:
                * server/edit_text_character.cpp: don't abort when text doesn't
                fit into the defined boundaries (fixes bug #16637).
                * server/edit_text_character.h: more stuff made private.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.407&r2=1.408
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.2&r2=1.3

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.407
retrieving revision 1.408
diff -u -b -r1.407 -r1.408
--- ChangeLog   15 Jun 2006 18:43:28 -0000      1.407
+++ ChangeLog   15 Jun 2006 21:38:51 -0000      1.408
@@ -1,10 +1,15 @@
+2006-06-15 Sandro Santilli <address@hidden>
+
+       * server/edit_text_character.cpp: don't abort when text doesn't
+       fit into the defined boundaries (fixes bug #16637).
+       * server/edit_text_character.h: more stuff made private.
+
 2006-06-15 Vitaly Alexeev <address@hidden>
+
        * server/action.h:  add clip_event_keypress & clip_event_construct hack
        * server/action.cpp:   add clip_event_keypress & clip_event_construct 
hack
        * backend/gnash.cpp:  add SDLK_0 -- SDLK_9
        * server/swf/tag_loaders.cpp:  add clip_event_keypress & 
clip_event_construct hack
-
-2006-06-15 Vitaly Alexeev <address@hidden>
        * server/movie_root.cpp: small optimization
        * server/sprite_instance.cpp:  small optimization
 

Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/edit_text_character.cpp      18 May 2006 15:17:57 -0000      1.2
+++ server/edit_text_character.cpp      15 Jun 2006 21:38:51 -0000      1.3
@@ -228,11 +228,20 @@
                edit_text_character_def::alignment align,
                int last_line_start_record, float x)
 {
+       GNASH_REPORT_FUNCTION;
        assert(m_def);
 
        float   extra_space = (m_def->width() -
                        m_def->get_right_margin()) - x - WIDTH_FUDGE;
-       assert(extra_space >= 0.0f);
+
+       //assert(extra_space >= 0.0f);
+       if (extra_space <= 0.0f)
+       {
+               log_warning("TextField text doesn't fit in it's boundaries");
+               log_warning(" m_def->width() == %g", m_def->width());
+               log_warning(" m_def->get_right_margin() == %d", 
m_def->get_right_margin());
+               return;
+       }
 
        float   shift_right = 0.0f;
 
@@ -466,7 +475,13 @@
                
                if (x >= m_def->width() - m_def->get_right_margin() - 
WIDTH_FUDGE)
                {
-                       // Whoops, we just exceeded the box width.  Do 
word-wrap.
+                       // Whoops, we just exceeded the box width. 
+                       // Do word-wrap if requested to do so.
+
+                       if ( ! m_def->do_word_wrap() )
+                       {
+                               log_warning("FIXME: implement no word wrap");
+                       }
 
                        // Insert newline.
 

Index: server/edit_text_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/edit_text_character.h        18 May 2006 15:17:57 -0000      1.2
+++ server/edit_text_character.h        15 Jun 2006 21:38:51 -0000      1.3
@@ -36,8 +36,6 @@
 //
 //
 
-// Code for the text tags.
-
 
 #ifndef _GNASH_EDIT_TEXT_CHARACTER_H_
 #define _GNASH_EDIT_TEXT_CHARACTER_H_
@@ -53,25 +51,11 @@
 struct text_character_def; 
 struct text_glyph_record; 
 
-/// An instance of an edit_text_character_def (I presume)
+/// An instance of an edit_text_character_def 
 struct edit_text_character : public character
 {
-       /// immutable definition of this object, as read
-       /// from the SWF stream. Assured to be not-NULL
-       /// by constructor. This might change in the future
-       edit_text_character_def*        m_def;
 
-       std::vector<text_glyph_record>  m_text_glyph_records;
-
-       /// used to pass a color on to shape_character::display()
-       std::vector<fill_style> m_dummy_style;
-
-       std::vector<line_style> m_dummy_line_style;
-
-       /// bounds of dynamic text, as laid out
-       rect    m_text_bounding_box;
-
-       tu_string       m_text;
+public:
 
        edit_text_character(movie* parent, edit_text_character_def* def,
                        int id);
@@ -80,21 +64,11 @@
        {
        }
 
-       virtual const char* get_text_name() const {
-               return m_def->get_default_name().c_str();
-       }
-
-
-       /// Reset our text bounding box to the given point.
-       void    reset_bounding_box(float x, float y)
+       virtual const char* get_text_name() const
        {
-               m_text_bounding_box.m_x_min = x;
-               m_text_bounding_box.m_x_max = x;
-               m_text_bounding_box.m_y_min = y;
-               m_text_bounding_box.m_y_max = y;
+               return m_def->get_default_name().c_str();
        }
 
-
        /// Set our text to the given string.
        virtual void    set_text_value(const char* new_text);
 
@@ -103,31 +77,53 @@
                return m_text.c_str();
        }
 
-
        /// We have a "text" member.
        void set_member(const tu_stringi& name, const as_value& val);
 
-
        bool get_member(const tu_stringi& name, as_value* val);
 
+       /// Draw the dynamic string.
+       void    display();
 
-       /// Does LEFT/CENTER/RIGHT alignment on the records in
-       /// m_text_glyph_records[], starting with
-       /// last_line_start_record and going through the end of
-       /// m_text_glyph_records.
-       void align_line(edit_text_character_def::alignment align,
-                       int last_line_start_record, float x);
+private:
+
+       /// The actual text
+       tu_string       m_text;
+
+       /// immutable definition of this object, as read
+       /// from the SWF stream. Assured to be not-NULL
+       /// by constructor. This might change in the future
+       edit_text_character_def*        m_def;
 
+       /// bounds of dynamic text, as laid out
+       rect    m_text_bounding_box;
+
+       /// Reset our text bounding box to the given point.
+       void    reset_bounding_box(float x, float y)
+       {
+               m_text_bounding_box.m_x_min = x;
+               m_text_bounding_box.m_x_max = x;
+               m_text_bounding_box.m_y_min = y;
+               m_text_bounding_box.m_y_max = y;
+       }
+
+       std::vector<text_glyph_record>  m_text_glyph_records;
+
+       /// used to pass a color on to shape_character::display()
+       std::vector<fill_style> m_dummy_style;
+
+       std::vector<line_style> m_dummy_line_style;
 
        /// Convert the characters in m_text into a series of
        /// text_glyph_records to be rendered.
        void    format_text();
 
-
-       /// Draw the dynamic string.
-       void    display();
-
-private:
+       /// Does LEFT/CENTER/RIGHT alignment on the records in
+       /// m_text_glyph_records[], starting with
+       /// last_line_start_record and going through the end of
+       /// m_text_glyph_records.
+       void align_line(edit_text_character_def::alignment align,
+                       int last_line_start_record, float x);
 
        /// Set our font, return previously set one.
        /// This is private for now, but might eventally




reply via email to

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