[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/button_character_instanc...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/button_character_instanc... |
Date: |
Thu, 17 Jan 2008 08:56:57 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/01/17 08:56:57
Modified files:
. : ChangeLog
server : button_character_instance.cpp
button_character_instance.h
Log message:
Cleanups in get_topmost_mouse_entity. One effect is supporting multiple
'hit' characters and honour visibility of them.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5421&r2=1.5422
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.cpp?cvsroot=gnash&r1=1.71&r2=1.72
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.h?cvsroot=gnash&r1=1.30&r2=1.31
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5421
retrieving revision 1.5422
diff -u -b -r1.5421 -r1.5422
--- ChangeLog 17 Jan 2008 08:21:06 -0000 1.5421
+++ ChangeLog 17 Jan 2008 08:56:56 -0000 1.5422
@@ -1,5 +1,9 @@
2008-01-17 Sandro Santilli <address@hidden>
+ * server/button_character_instance.{cpp,h}: drop dead enum,
+ add HIT state to e_mouse_state enum, rework
+ get_topmost_mouse_entity to use pointInVisibleShape and
+ the get_active_characters method.
* macros/firefox.m4: make --with-npapi-plugindir switch work.
2008-01-16 Rob Savoye <address@hidden>
Index: server/button_character_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/button_character_instance.cpp,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -b -r1.71 -r1.72
--- server/button_character_instance.cpp 16 Jan 2008 11:31:07 -0000
1.71
+++ server/button_character_instance.cpp 17 Jan 2008 08:56:57 -0000
1.72
@@ -440,34 +440,36 @@
// Return the topmost entity that the given point covers. NULL if none.
// I.e. check against ourself.
{
- if ((get_visible() == false) || (get_enabled() == false)) {
+ if ( (!get_visible()) || (!get_enabled()))
+ {
return false;
}
- matrix m = get_matrix();
- point p;
- m.transform_by_inverse(&p, point(x, y));
+ // Find hit characters
+ std::vector<character*> hitChars;
+ get_active_characters(hitChars, HIT);
+ if ( hitChars.empty() ) return false;
- {for (size_t i = 0; i < m_def->m_button_records.size(); i++)
- {
- button_record& rec = m_def->m_button_records[i];
- if (rec.m_character_id < 0 || rec.m_hit_test == false)
+ // point is in parent's space,
+ // we need to convert it in world space
+ point wp(x,y);
+ character* parent = get_parent();
+ if ( parent )
{
- continue;
+ parent->get_world_matrix().transform(wp);
}
- // Find the mouse position in button-record space.
- point sub_p;
- rec.m_button_matrix.transform_by_inverse(&sub_p, p);
+ for (size_t i=0, e=hitChars.size(); i<e; ++i)
+ {
+ character* ch = m_record_character[i].get();
+ if ( ! ch ) continue;
- if (rec.m_character_def->point_test_local(sub_p.x, sub_p.y))
+ if ( ch->pointInVisibleShape(wp.x, wp.y) )
{
// The mouse is inside the shape.
return this;
- // @@ Are there any circumstances where this is correct:
- //return m_record_character[i].get();
}
- }}
+ }
return NULL;
}
@@ -637,7 +639,8 @@
}
if ((state == UP && rec.m_up)
|| (state == DOWN && rec.m_down)
- || (state == OVER && rec.m_over))
+ || (state == OVER && rec.m_over)
+ || (state == HIT && rec.m_hit_test))
{
list.push_back(m_record_character[i].get());
}
Index: server/button_character_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/button_character_instance.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- server/button_character_instance.h 16 Jan 2008 11:31:07 -0000 1.30
+++ server/button_character_instance.h 17 Jan 2008 08:56:57 -0000 1.31
@@ -21,7 +21,7 @@
// SWF buttons. Mouse-sensitive update/display, actions, etc.
-/* $Id: button_character_instance.h,v 1.30 2008/01/16 11:31:07 strk Exp $ */
+/* $Id: button_character_instance.h,v 1.31 2008/01/17 08:56:57 strk Exp $ */
#ifndef GNASH_BUTTON_CHARACTER_INSTANCE_H
#define GNASH_BUTTON_CHARACTER_INSTANCE_H
@@ -40,13 +40,6 @@
// button characters
//
-enum mouse_state
-{
- MOUSE_UP,
- MOUSE_DOWN,
- MOUSE_OVER
-};
-
//
// button_character_instance
//
@@ -76,7 +69,8 @@
{
UP = 0,
DOWN,
- OVER
+ OVER,
+ HIT
};
e_mouse_state m_mouse_state;
@@ -102,9 +96,25 @@
void set_current_state(e_mouse_state new_state);
- /// Returns all characters that are currently visible based on the
- /// current button state. The "_visible" property does not matter here.
+ /// Returns all characters that are active based on the current state.
+ //
+ /// The "_visible" property does not matter here.
+ ///
+ /// @param list
+ /// The vector to push active characters into
+ ///
void get_active_characters(std::vector<character*>& list);
+
+ /// Returns all characters that should be active on the given state.
+ //
+ /// The "_visible" property does not matter here.
+ ///
+ /// @param list
+ /// The vector to push active characters into
+ ///
+ /// @param state
+ /// The state we're interested in
+ ///
void get_active_characters(std::vector<character*>& list, e_mouse_state
state);