gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog gui/gui.cpp server/movie_root.c...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog gui/gui.cpp server/movie_root.c...
Date: Fri, 25 Jan 2008 11:33:36 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/01/25 11:33:36

Modified files:
        .              : ChangeLog 
        gui            : gui.cpp 
        server         : movie_root.cpp movie_root.h 

Log message:
        Show dragging character (if any) and topmost character under the mouse 
        in movie properties

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5489&r2=1.5490
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.130&r2=1.131
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.153&r2=1.154
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.104&r2=1.105

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5489
retrieving revision 1.5490
diff -u -b -r1.5489 -r1.5490
--- ChangeLog   24 Jan 2008 20:19:25 -0000      1.5489
+++ ChangeLog   25 Jan 2008 11:33:35 -0000      1.5490
@@ -1,3 +1,10 @@
+2008-01-25 Sandro Santilli <address@hidden>
+
+       * gui/gui.cpp (getMovieInfo): add dragging character
+         and character under the pointer.
+       * server/movie_root.{cpp,h}: expose a method to query 
+         entity under the mouse and dragging char.
+
 2008-01-24 Sandro Santilli <address@hidden>
 
        * testsuite/Makefile.am: distribute simple.exp

Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -b -r1.130 -r1.131
--- gui/gui.cpp 25 Jan 2008 09:20:21 -0000      1.130
+++ gui/gui.cpp 25 Jan 2008 11:33:36 -0000      1.131
@@ -861,7 +861,7 @@
     snprintf(buf, 16, "SWF%d", vmSWFVersion); buf[15] = '\0';
     ret->insert(ret->begin(), StringPair("VM", buf));
 
-    // Print info about levels (only level0 for now, then will be extended)
+    // Print info about levels (only originating movie for now, then will be 
extended)
     movie_root& stage = vm.getRoot();
     boost::intrusive_ptr<movie_instance> level0 = stage.getRootMovie();
     movie_definition* def0 = level0->get_movie_definition();
@@ -869,16 +869,38 @@
     snprintf(buf, 16, "SWF%d", def0->get_version()); buf[15] = '\0';
     ret->insert(ret->begin(), StringPair("_level0 SWFVersion", 
std::string(buf)));
     ret->insert(ret->begin(), StringPair("_level0 URL", def0->get_url()));
+
+    // Print info about scripts state (enabled/disabled)
     ret->insert(ret->begin(), StringPair("Stage scripts", 
stage.scriptsDisabled() ? " disabled" : "enabled"));
 
-    character* ch = stage.getActiveEntityUnderPointer();
-    std::stringstream ss;
-    if ( ! ch ) ss << "NONE";
-    else
+    // Print info about mouse entities
+
+    using std::string;
+    const character* ch;
+
+    ch = stage.getActiveEntityUnderPointer();
+    if ( ch )
     {
-        ss << ch->getTarget() << " (" << typeName(*ch) << ")";
+       std::stringstream ss;
+       ss << ch->getTarget() << " (" + typeName(*ch) << " - id:" << 
ch->get_id() << " depth:" << ch->get_depth();
+       ret->insert(ret->begin(), StringPair("Active mouse entity: ", 
ss.str()));
     }
+
+    ch = stage.getEntityUnderPointer();
+    if ( ch )
+    {
+       std::stringstream ss;
+       ss << ch->getTarget() << " (" + typeName(*ch) << " - id:" << 
ch->get_id() << " depth:" << ch->get_depth();
     ret->insert(ret->begin(), StringPair("Topmost mouse entity: ", ss.str()));
+    }
+
+    ch = stage.getDraggingCharacter();
+    if ( ch ) 
+    {
+       std::stringstream ss;
+       ss << ch->getTarget() << " (" + typeName(*ch) << " - id:" << 
ch->get_id() << " depth:" << ch->get_depth();
+       ret->insert(ret->begin(), StringPair("Dragging character: ", ss.str()));
+    }
 
     return ret;
 }

Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -b -r1.153 -r1.154
--- server/movie_root.cpp       24 Jan 2008 12:05:04 -0000      1.153
+++ server/movie_root.cpp       25 Jan 2008 11:33:36 -0000      1.154
@@ -805,7 +805,7 @@
 
     // Set _droptarget if dragging a sprite
     sprite_instance* dragging = 0;
-    character* draggingChar = m_drag_state.getCharacter();
+    character* draggingChar = getDraggingCharacter();
     if ( draggingChar ) dragging = draggingChar->to_movie();
     if ( dragging )
     {
@@ -889,7 +889,7 @@
 void
 movie_root::doMouseDrag()
 {
-       character* dragChar = m_drag_state.getCharacter();
+       character* dragChar = getDraggingCharacter(); 
        if ( ! dragChar ) return; // nothing to do
 
        if ( dragChar->isUnloaded() )
@@ -1222,6 +1222,21 @@
        return m_mouse_button_state.m_active_entity.get();
 }
 
+character*
+movie_root::getDraggingCharacter() const
+{
+       return m_drag_state.getCharacter();
+}
+
+const character*
+movie_root::getEntityUnderPointer() const
+{
+       float x = PIXELS_TO_TWIPS(m_mouse_x);
+       float y = PIXELS_TO_TWIPS(m_mouse_y);
+        const character* dropChar = findDropTarget(x, y, 
getDraggingCharacter()); 
+       return dropChar;
+}
+
 bool
 movie_root::isMouseOverActiveEntity() const
 {

Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -b -r1.104 -r1.105
--- server/movie_root.h 21 Jan 2008 20:55:51 -0000      1.104
+++ server/movie_root.h 25 Jan 2008 11:33:36 -0000      1.105
@@ -15,7 +15,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: movie_root.h,v 1.104 2008/01/21 20:55:51 rsavoye Exp $ */
+/* $Id: movie_root.h,v 1.105 2008/01/25 11:33:36 strk Exp $ */
 
 /// \page events_handling Handling of user events
 ///
@@ -305,7 +305,7 @@
 
     void set_drag_state(const drag_state& st);
 
-    /// @return current top-level root sprite (_level0)
+    /// @return the originating root movie (not necessarely _level0)
     movie_instance* getRootMovie() const
     {
        return _rootMovie.get();
@@ -316,9 +316,9 @@
         m_drag_state.reset();
     }
 
-    /// Return definition of _level0 
+    /// Return definition of originating root movie 
     //
-    /// TODO: drop this function ?
+    /// TODO: rename to getOriginatingDefinition ?
     ///
     movie_definition* get_movie_definition() const
     {
@@ -345,22 +345,16 @@
     ///
     bool clear_interval_timer(unsigned int x);
 
-    /// Return 0-based frame index of _level0
+    /// Return 0-based frame index of originating root movie
     //
     /// TODO: drop this function (currently used by gprocessor)
+    ///       or change it to to delegate to _level0 ?
     ///
     size_t get_current_frame() const
     {
        return getRootMovie()->get_current_frame();
     }
 
-#if 0
-    // @@ should this be in movie_instance ?
-    float get_frame_rate() const {
-        return get_movie_definition()->get_frame_rate();
-    }
-#endif
-
     /// \brief
     /// Return the size of a logical movie pixel as
     /// displayed on-screen, with the current device
@@ -370,16 +364,6 @@
         return m_pixel_scale;
     }
 
-#if 0
-    // @@ Is this one necessary?
-    //
-    // TODO: drop this
-    character* get_character(int character_id)
-    {
-       return getRootMovie()->get_character(character_id);
-    }
-#endif
-
     void set_background_color(const rgba& color);
 
     void set_background_alpha(float alpha);
@@ -402,7 +386,7 @@
     ///
     void advance();
 
-    /// 0-based!! delegates to _level0
+    /// 0-based!! delegates to originating root movie
     //
     /// TODO: drop this method. currently used by gprocessor.
     ///
@@ -413,7 +397,7 @@
 
     void display();
 
-    /// Delegate to _level0
+    /// Delegate to originating root movie
     //
     /// TODO: drop ?
     ///
@@ -502,6 +486,17 @@
     ///
     character* getActiveEntityUnderPointer() const;
 
+    /// Return the topmost non-dragging entity under the pointer
+    //
+    /// This method triggers a displaylist scan
+    ///
+    /// @return the topmost non-dragging entity under pointer or NULL if none
+    ///
+    const character* getEntityUnderPointer() const;
+
+    /// Return the character currently being dragged, if any
+    character* getDraggingCharacter() const;
+
     /// Return true if the mouse pointer is over an active entity
     bool isMouseOverActiveEntity() const;
 




reply via email to

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