gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. 4e755513d3f06822065e


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 4e755513d3f06822065e343b62be214f895a6f41
Date: Mon, 25 Oct 2010 13:34:50 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  4e755513d3f06822065e343b62be214f895a6f41 (commit)
       via  ca933d82652edf1c34648173b244c54e563fdaba (commit)
       via  879ee0a1bb540f30f8f02f88a4cd78198c1e3c4a (commit)
      from  2e20bb92dacdfdb0ecbaffd8ce43ea9ce1a7de0d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=4e755513d3f06822065e343b62be214f895a6f41


commit 4e755513d3f06822065e343b62be214f895a6f41
Merge: ca933d8 2e20bb9
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Oct 25 15:34:28 2010 +0200

    Merge branch 'master' of git.sv.gnu.org:/srv/git/gnash


http://git.savannah.gnu.org/cgit//commit/?id=ca933d82652edf1c34648173b244c54e563fdaba


commit ca933d82652edf1c34648173b244c54e563fdaba
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Oct 25 14:08:05 2010 +0200

    Tabs to spaces.

diff --git a/libcore/DragState.h b/libcore/DragState.h
index d9a71b7..db88eae 100644
--- a/libcore/DragState.h
+++ b/libcore/DragState.h
@@ -34,100 +34,100 @@ class DragState
 {
 public:
 
-       DragState(DisplayObject* d)
-               :
-               _hasbounds(false),
-               _bounds(),
-               _displayObject(d),
-               _lock_centered(false)
-       {
-       }
-
-       bool isLockCentered() const {
-               return _lock_centered;
-       }
-
-       void setLockCentered(bool lock) {
-               _lock_centered = lock;
-       }
-
-       /// Set displacement offset from origin
-       /// at time of drag start.
-       /// Coordinates are in stage space (twips)
-       ///
-       void setOffset(boost::int32_t x, boost::int32_t y) {
-               _xoffset = x;
-               _yoffset = y;
-       }
-
-       boost::int32_t xOffset() const { return _xoffset; }
-       boost::int32_t yOffset() const { return _yoffset; }
-
-       bool hasBounds() const {
+    DragState(DisplayObject* d)
+        :
+        _hasbounds(false),
+        _bounds(),
+        _displayObject(d),
+        _lock_centered(false)
+    {
+    }
+
+    bool isLockCentered() const {
+        return _lock_centered;
+    }
+
+    void setLockCentered(bool lock) {
+        _lock_centered = lock;
+    }
+
+    /// Set displacement offset from origin
+    /// at time of drag start.
+    /// Coordinates are in stage space (twips)
+    ///
+    void setOffset(boost::int32_t x, boost::int32_t y) {
+        _xoffset = x;
+        _yoffset = y;
+    }
+
+    boost::int32_t xOffset() const { return _xoffset; }
+    boost::int32_t yOffset() const { return _yoffset; }
+
+    bool hasBounds() const {
         return _hasbounds;
     }
 
-       /// \brief
-       /// Get the boundaries to constraint
-       /// the drag into.
-       //
-       /// Coordinates of the rectangle are
-       /// expected in TWIPS.
-       ///
-       /// Note that if hasBounds() is false
-       /// the returned rectangle is the NULL
-       /// rectangle - see SWFRect::is_null().
-       ///
-       const SWFRect& getBounds() const { return _bounds; }
-
-       /// \brief
-       /// Set the boundaries to constraint
-       /// the drag into.
-       //
-       /// Coordinates of the rectangle are
-       /// expected in TWIPS.
-       ///
-       void setBounds(const SWFRect& bounds) {
-               _bounds = bounds;
-               _hasbounds = true;
-       }
-
-       /// May return NULL !!
-       DisplayObject* getCharacter() const {
-               return _displayObject;
-       }
-
-       /// Reset drag state to its initial condition
-       void reset() {
-               _displayObject = 0;
-               _hasbounds = false;
-               _bounds.set_null();
-               _lock_centered = false;
-       }
-
-       /// Mark DisplayObject as reachable (if any)
-       void markReachableResources() const {
-               if (_displayObject) _displayObject->setReachable();
-       }
+    /// \brief
+    /// Get the boundaries to constraint
+    /// the drag into.
+    //
+    /// Coordinates of the rectangle are
+    /// expected in TWIPS.
+    ///
+    /// Note that if hasBounds() is false
+    /// the returned rectangle is the NULL
+    /// rectangle - see SWFRect::is_null().
+    ///
+    const SWFRect& getBounds() const { return _bounds; }
+
+    /// \brief
+    /// Set the boundaries to constraint
+    /// the drag into.
+    //
+    /// Coordinates of the rectangle are
+    /// expected in TWIPS.
+    ///
+    void setBounds(const SWFRect& bounds) {
+        _bounds = bounds;
+        _hasbounds = true;
+    }
+
+    /// May return NULL !!
+    DisplayObject* getCharacter() const {
+        return _displayObject;
+    }
+
+    /// Reset drag state to its initial condition
+    void reset() {
+        _displayObject = 0;
+        _hasbounds = false;
+        _bounds.set_null();
+        _lock_centered = false;
+    }
+
+    /// Mark DisplayObject as reachable (if any)
+    void markReachableResources() const {
+        if (_displayObject) _displayObject->setReachable();
+    }
 
 private:
 
-       bool _hasbounds;
+    bool _hasbounds;
 
-       /// Boundaries to constrain the drag into.
-       /// Coordinates in TWIPS.
-       SWFRect _bounds;
+    /// Boundaries to constrain the drag into.
+    /// Coordinates in TWIPS.
+    SWFRect _bounds;
 
-       DisplayObject* _displayObject;
+    DisplayObject* _displayObject;
 
-       bool _lock_centered;
+    bool _lock_centered;
 
-       /// Offsets of displacement from DisplayObject origin
-       /// at time of drag start. These are used for non
-       /// lock-centered dragging.
-       /// Coordinates are in stage space (TWIPS)
-       boost::int32_t _xoffset;
-       boost::int32_t _yoffset;
+    /// Offsets of displacement from DisplayObject origin
+    /// at time of drag start. These are used for non
+    /// lock-centered dragging.
+    /// Coordinates are in stage space (TWIPS)
+    boost::int32_t _xoffset;
+    boost::int32_t _yoffset;
 
 };
 

http://git.savannah.gnu.org/cgit//commit/?id=879ee0a1bb540f30f8f02f88a4cd78198c1e3c4a


commit 879ee0a1bb540f30f8f02f88a4cd78198c1e3c4a
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Oct 25 14:04:54 2010 +0200

    Minor cleanups and encapsulation in drag state.

diff --git a/libcore/DisplayObject.cpp b/libcore/DisplayObject.cpp
index 3e2d901..6e3513f 100644
--- a/libcore/DisplayObject.cpp
+++ b/libcore/DisplayObject.cpp
@@ -32,9 +32,8 @@
 #include "smart_ptr.h" // GNASH_USE_GC
 #include "movie_root.h"
 #include "MovieClip.h"
-#include "drag_state.h" // for do_mouse_drag (to be moved in movie_root)
-#include "VM.h" // for do_mouse_drag (to be moved in movie_root)
-#include "fn_call.h" // for shared ActionScript getter-setters
+#include "VM.h" 
+#include "fn_call.h"
 #include "GnashException.h" 
 #include "ExecutableCode.h"
 #include "namedStrings.h"
diff --git a/libcore/drag_state.h b/libcore/DragState.h
similarity index 83%
rename from libcore/drag_state.h
rename to libcore/DragState.h
index 5054592..d9a71b7 100644
--- a/libcore/drag_state.h
+++ b/libcore/DragState.h
@@ -16,43 +16,33 @@
 // 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_DRAG_STATE_H
 #define GNASH_DRAG_STATE_H
 
-#include "SWFRect.h" // for composition
-
-namespace gnash
-{
+#include "SWFRect.h"
+#include "DisplayObject.h"
 
 // Forward declarations
-class DisplayObject;
+namespace gnash {
+    class DisplayObject;
+}
 
+namespace gnash {
 
 /// What is being dragged and how
-class drag_state
+class DragState
 {
-
-       bool _hasbounds;
-
-       /// Boundaries to constrain the drag into.
-       /// Coordinates in TWIPS.
-       SWFRect _bounds;
-
-       DisplayObject* _displayObject;
-
-       bool    _lock_centered;
-
-       /// Offsets of displacement from DisplayObject origin
-       /// at time of drag start. These are used for non
-       /// lock-centered dragging.
-       /// Coordinates are in stage space (TWIPS)
-       boost::int32_t  _xoffset;
-       boost::int32_t  _yoffset;
-
 public:
 
+       DragState(DisplayObject* d)
+               :
+               _hasbounds(false),
+               _bounds(),
+               _displayObject(d),
+               _lock_centered(false)
+       {
+       }
+
        bool isLockCentered() const {
                return _lock_centered;
        }
@@ -65,8 +55,7 @@ public:
        /// at time of drag start.
        /// Coordinates are in stage space (twips)
        ///
-       void setOffset(boost::int32_t x, boost::int32_t y)
-       {
+       void setOffset(boost::int32_t x, boost::int32_t y) {
                _xoffset = x;
                _yoffset = y;
        }
@@ -74,7 +63,9 @@ public:
        boost::int32_t xOffset() const { return _xoffset; }
        boost::int32_t yOffset() const { return _yoffset; }
 
-       bool hasBounds() const {return _hasbounds; }
+       bool hasBounds() const {
+        return _hasbounds;
+    }
 
        /// \brief
        /// Get the boundaries to constraint
@@ -106,34 +97,38 @@ public:
                return _displayObject;
        }
 
-       /// Stores DisplayObject in an intrusive pointer
-       void setCharacter(DisplayObject* ch) {
-               _displayObject = ch;
-       }
-
        /// Reset drag state to its initial condition
-       void reset()
-       {
-               _displayObject = NULL;
+       void reset() {
+               _displayObject = 0;
                _hasbounds = false;
                _bounds.set_null();
                _lock_centered = false;
        }
 
-       drag_state()
-               :
-               _hasbounds(false),
-               _bounds(),
-               _displayObject(0),
-               _lock_centered(false)
-       {
-       }
-
        /// Mark DisplayObject as reachable (if any)
-       void markReachableResources() const
-       {
+       void markReachableResources() const {
                if (_displayObject) _displayObject->setReachable();
        }
+
+private:
+
+       bool _hasbounds;
+
+       /// Boundaries to constrain the drag into.
+       /// Coordinates in TWIPS.
+       SWFRect _bounds;
+
+       DisplayObject* _displayObject;
+
+       bool _lock_centered;
+
+       /// Offsets of displacement from DisplayObject origin
+       /// at time of drag start. These are used for non
+       /// lock-centered dragging.
+       /// Coordinates are in stage space (TWIPS)
+       boost::int32_t _xoffset;
+       boost::int32_t _yoffset;
+
 };
 
 
diff --git a/libcore/Makefile.am b/libcore/Makefile.am
index 9fa2f61..dc88788 100644
--- a/libcore/Makefile.am
+++ b/libcore/Makefile.am
@@ -241,7 +241,7 @@ EXTENSIONS_API = \
        as_environment.h \
        movie_root.h \
        MouseButtonState.h \
-       drag_state.h \
+       DragState.h \
        InteractiveObject.h \
        SWFRect.h \
        GnashKey.h \
diff --git a/libcore/asobj/MovieClip_as.cpp b/libcore/asobj/MovieClip_as.cpp
index c864006..b9b0162 100644
--- a/libcore/asobj/MovieClip_as.cpp
+++ b/libcore/asobj/MovieClip_as.cpp
@@ -1895,18 +1895,15 @@ movieclip_startDrag(const fn_call& fn)
 {
     MovieClip* movieclip = ensure<IsDisplayObject<MovieClip> >(fn);
 
-    drag_state st;
-    st.setCharacter(movieclip);
+    DragState st(movieclip);
 
     // mark this DisplayObject is transformed.
     movieclip->transformedByScript();
 
-    if ( fn.nargs )
-    {
+    if (fn.nargs) {
         st.setLockCentered(toBool(fn.arg(0), getVM(fn)));
 
-        if ( fn.nargs >= 5)
-        {
+        if (fn.nargs > 4) {
             double x0 = toNumber(fn.arg(1), getVM(fn));
             double y0 = toNumber(fn.arg(2), getVM(fn));
             double x1 = toNumber(fn.arg(3), getVM(fn));
@@ -1934,7 +1931,7 @@ movieclip_startDrag(const fn_call& fn)
             IF_VERBOSE_ASCODING_ERRORS(
                 if (gotinf || swapped) {
                     std::stringstream ss; fn.dump_args(ss);
-                    if ( swapped ) { 
+                    if (swapped) { 
                         log_aserror(_("min/max bbox values in "
                             "MovieClip.startDrag(%s) swapped, fixing"),
                             ss.str());
@@ -1953,7 +1950,7 @@ movieclip_startDrag(const fn_call& fn)
         }
     }
 
-    getRoot(fn).set_drag_state(st);
+    getRoot(fn).setDragState(st);
 
     return as_value();
 }
diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index 154e9e8..ed5486e 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -142,7 +142,7 @@ movie_root::movie_root(const movie_definition& def,
     _lastTimerId(0),
     _lastKeyEvent(key::INVALID),
     _currentFocus(0),
-    m_drag_state(),
+    _dragState(0),
     _movies(),
     _rootMovie(0),
     _invalidated(true),
@@ -743,22 +743,11 @@ movie_root::get_mouse_state(boost::int32_t& x, 
boost::int32_t& y)
 }
 
 void
-movie_root::get_drag_state(drag_state& st)
+movie_root::setDragState(const DragState& st)
 {
-    assert(testInvariant());
-
-    st = m_drag_state;
-
-    assert(testInvariant());
-}
-
-void
-movie_root::set_drag_state(const drag_state& st)
-{
-    m_drag_state = st;
+    _dragState = st;
     DisplayObject* ch = st.getCharacter();
-    if ( ch && ! st.isLockCentered() )
-    {
+    if (ch && !st.isLockCentered()) {
         // Get coordinates of the DisplayObject's origin
         point origin(0, 0);
         SWFMatrix chmat = getWorldMatrix(*ch);
@@ -771,7 +760,7 @@ movie_root::set_drag_state(const drag_state& st)
         boost::int32_t xoffset = world_mouse.x - world_origin.x;
         boost::int32_t yoffset = world_mouse.y - world_origin.y;
 
-        m_drag_state.setOffset(xoffset, yoffset);
+        _dragState.setOffset(xoffset, yoffset);
     }
     assert(testInvariant());
 }
@@ -784,7 +773,7 @@ movie_root::doMouseDrag()
 
     if (dragChar->unloaded()) {
         // Reset drag state if dragging char was unloaded
-        m_drag_state.reset();
+        _dragState.reset();
         return; 
     }
 
@@ -796,16 +785,16 @@ movie_root::doMouseDrag()
         parent_world_mat = getWorldMatrix(*p);
     }
 
-    if (!m_drag_state.isLockCentered()) {
-        world_mouse.x -= m_drag_state.xOffset();
-        world_mouse.y -= m_drag_state.yOffset();
+    if (!_dragState.isLockCentered()) {
+        world_mouse.x -= _dragState.xOffset();
+        world_mouse.y -= _dragState.yOffset();
     }
 
-    if (m_drag_state.hasBounds()) {
+    if (_dragState.hasBounds()) {
         SWFRect bounds;
         // bounds are in local coordinate space
         bounds.enclose_transformed_rect(parent_world_mat,
-                m_drag_state.getBounds());
+                _dragState.getBounds());
         // Clamp mouse coords within a defined SWFRect.
         bounds.clamp(world_mouse);
     }
@@ -1109,7 +1098,7 @@ movie_root::getActiveEntityUnderPointer() const
 DisplayObject*
 movie_root::getDraggingCharacter() const
 {
-    return m_drag_state.getCharacter();
+    return _dragState.getCharacter();
 }
 
 const DisplayObject*
@@ -1737,7 +1726,7 @@ movie_root::markReachableResources() const
     if (_currentFocus) _currentFocus->setReachable();
 
     // Mark DisplayObject being dragged, if any
-    m_drag_state.markReachableResources();
+    _dragState.markReachableResources();
 
     // NOTE: cleanupDisplayList() should have cleaned up all
     // unloaded live characters. The remaining ones should be marked
diff --git a/libcore/movie_root.h b/libcore/movie_root.h
index 3095b8f..b2e7e8c 100644
--- a/libcore/movie_root.h
+++ b/libcore/movie_root.h
@@ -81,7 +81,7 @@
 #include "smart_ptr.h" // GNASH_USE_GC
 #include "dsodefs.h" // DSOEXPORT
 #include "MouseButtonState.h" // for composition
-#include "drag_state.h" // for composition
+#include "DragState.h" // for composition
 #include "GnashKey.h" // key::code
 #include "Movie.h"
 #include "GnashEnums.h" 
@@ -300,13 +300,10 @@ public:
     /// Coordinates are in PIXELS, NOT TWIPS.
     void get_mouse_state(boost::int32_t& x, boost::int32_t& y);
 
-    void get_drag_state(drag_state& st);
-
-    void set_drag_state(const drag_state& st);
+    void setDragState(const DragState& st);
 
     /// @return the originating root movie (not necessarely _level0)
-    const Movie& getRootMovie() const
-    {
+    const Movie& getRootMovie() const {
         return *_rootMovie;
     }
 
@@ -315,8 +312,7 @@ public:
     /// TODO: create MovieClips without this and drop. It's deliberately
     /// different from getRootMovie() so it doesn't end up getting used
     /// in the same way.
-    Movie* topLevelMovie() const
-    {
+    Movie* topLevelMovie() const {
         return _rootMovie;
     }
 
@@ -327,9 +323,8 @@ public:
         return _rootMovie->frameRate();
     }
 
-    void stop_drag()
-    {
-        m_drag_state.reset();
+    void stop_drag() {
+        _dragState.reset();
     }
 
     /// Add an interval timer
@@ -1078,7 +1073,7 @@ private:
     DisplayObject* _currentFocus;
 
     /// @todo fold this into m_mouse_button_state?
-    drag_state m_drag_state;
+    DragState _dragState;
 
     typedef std::map<int, MovieClip*> Levels;
 
diff --git a/libcore/vm/ASHandlers.cpp b/libcore/vm/ASHandlers.cpp
index d43d716..d0a4283 100644
--- a/libcore/vm/ASHandlers.cpp
+++ b/libcore/vm/ASHandlers.cpp
@@ -40,9 +40,9 @@
 #include "URL.h"
 #include "action_buffer.h"
 #include "as_object.h"
-#include "drag_state.h"
+#include "DragState.h"
 #include "VM.h" // for getting the root
-#include "movie_root.h" // for set_drag_state (ActionStartDragMovie)
+#include "movie_root.h" // for set_DragState (ActionStartDragMovie)
 #include "sound_handler.h"
 #include "namedStrings.h"
 #include "utf8.h"
@@ -1208,18 +1208,17 @@ ActionStartDragMovie(ActionExec& thread)
     assert(thread.atActionTag(SWF::ACTION_STARTDRAGMOVIE));
 #endif
 
-    drag_state st;
     DisplayObject* tgt = env.find_target(env.top(0).to_string());
     if (tgt) {
         // mark this DisplayObject as script transformed.
         tgt->transformedByScript();
-        st.setCharacter( tgt );
     }
     else {
         IF_VERBOSE_ASCODING_ERRORS(
             log_aserror(_("startDrag: unknown target '%s'"), env.top(0));
         );
     }
+    DragState st(tgt);
 
     st.setLockCentered(toBool(env.top(1), getVM(env)));
 
@@ -1256,7 +1255,7 @@ ActionStartDragMovie(ActionExec& thread)
 
     if (tgt) {
         VM& vm = getVM(env);
-        vm.getRoot().set_drag_state(st);
+        vm.getRoot().setDragState(st);
     }
 }
 
@@ -1265,8 +1264,8 @@ ActionStopDragMovie(ActionExec& thread)
 {
     as_environment& env = thread.env;
     DisplayObject* tgtch = env.get_target();
-    MovieClip *root_movie = tgtch ? tgtch->get_root() : 0;
-    if ( root_movie ) root_movie->stop_drag();
+    MovieClip* root_movie = tgtch ? tgtch->get_root() : 0;
+    if (root_movie) root_movie->stop_drag();
     else log_debug(_("ActionStopDragMovie: as_environment target is null or 
not a sprite"));
 }
 

-----------------------------------------------------------------------

Summary of changes:
 libcore/DisplayObject.cpp      |    5 +-
 libcore/DragState.h            |  137 ++++++++++++++++++++++++++++++++++++++
 libcore/Makefile.am            |    2 +-
 libcore/asobj/MovieClip_as.cpp |   13 ++--
 libcore/drag_state.h           |  142 ----------------------------------------
 libcore/movie_root.cpp         |   37 ++++-------
 libcore/movie_root.h           |   19 ++----
 libcore/vm/ASHandlers.cpp      |   13 ++--
 8 files changed, 171 insertions(+), 197 deletions(-)
 create mode 100644 libcore/DragState.h
 delete mode 100644 libcore/drag_state.h


hooks/post-receive
-- 
Gnash



reply via email to

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