[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10769: Correct silly mistake in cla
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10769: Correct silly mistake in class naming. Other minor cleanups. |
Date: |
Sat, 04 Apr 2009 18:17:24 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10769
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Sat 2009-04-04 18:17:24 +0200
message:
Correct silly mistake in class naming. Other minor cleanups.
renamed:
libcore/InteractiveDisplayObject.cpp => libcore/InteractiveObject.cpp
libcore/InteractiveDisplayObject.h => libcore/InteractiveObject.h
modified:
libcore/Button.cpp
libcore/Button.h
libcore/DisplayObject.h
libcore/Makefile.am
libcore/MouseButtonState.h
libcore/MovieClip.cpp
libcore/MovieClip.h
libcore/TextField.cpp
libcore/TextField.h
libcore/movie_root.cpp
libcore/movie_root.h
testsuite/DummyCharacter.h
libcore/InteractiveObject.cpp
libcore/InteractiveObject.h
------------------------------------------------------------
revno: 10768.1.1
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Sat 2009-04-04 15:55:42 +0200
message:
Make can_handle_mouse_event a pure virtual and rename to mouseEnabled().
modified:
libcore/Button.h
libcore/DisplayObject.h
libcore/InteractiveDisplayObject.h
libcore/MovieClip.cpp
libcore/MovieClip.h
libcore/TextField.h
------------------------------------------------------------
revno: 10768.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Sat 2009-04-04 16:40:00 +0200
message:
Drop some old code from movie_root, clean up unnecessarily verbose
functions.
modified:
libcore/DisplayObject.h
libcore/movie_root.cpp
libcore/movie_root.h
testsuite/DummyCharacter.h
------------------------------------------------------------
revno: 10768.1.3
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Sat 2009-04-04 17:35:18 +0200
message:
Rename InteractiveDisplayObject to InteractiveObject, as it should have
been from the beginning.
renamed:
libcore/InteractiveDisplayObject.cpp => libcore/InteractiveObject.cpp
libcore/InteractiveDisplayObject.h => libcore/InteractiveObject.h
modified:
libcore/Button.cpp
libcore/Button.h
libcore/DisplayObject.h
libcore/Makefile.am
libcore/MouseButtonState.h
libcore/MovieClip.cpp
libcore/MovieClip.h
libcore/TextField.cpp
libcore/TextField.h
libcore/movie_root.cpp
libcore/movie_root.h
testsuite/DummyCharacter.h
libcore/InteractiveObject.cpp
libcore/InteractiveObject.h
=== modified file 'libcore/Button.cpp'
--- a/libcore/Button.cpp 2009-04-03 12:16:58 +0000
+++ b/libcore/Button.cpp 2009-04-04 15:35:18 +0000
@@ -296,7 +296,7 @@
Button::Button(SWF::DefineButtonTag& def, DisplayObject* parent, int id)
:
- InteractiveDisplayObject(parent, id),
+ InteractiveObject(parent, id),
m_last_mouse_flags(IDLE),
m_mouse_flags(IDLE),
m_mouse_state(UP),
@@ -389,7 +389,7 @@
// Return the topmost entity that the given point covers. NULL if none.
// I.e. check against ourself.
-InteractiveDisplayObject*
+InteractiveObject*
Button::topmostMouseEntity(boost::int32_t x, boost::int32_t y)
{
if (!isVisible() || !isEnabled())
@@ -418,7 +418,7 @@
{
DisplayObject* ch = *it;
if ( ! ch->isVisible() ) continue;
- InteractiveDisplayObject *hit = ch->topmostMouseEntity(p.x, p.y);
+ InteractiveObject *hit = ch->topmostMouseEntity(p.x, p.y);
if ( hit ) return hit;
}
}
=== modified file 'libcore/Button.h'
--- a/libcore/Button.h 2009-04-03 12:16:58 +0000
+++ b/libcore/Button.h 2009-04-04 15:35:18 +0000
@@ -23,7 +23,7 @@
#define GNASH_BUTTON_H
#include "smart_ptr.h" // GNASH_USE_GC
-#include "InteractiveDisplayObject.h" // for inheritance
+#include "InteractiveObject.h" // for inheritance
#include <vector>
#include <set>
@@ -41,7 +41,7 @@
// Button
//
-class Button : public InteractiveDisplayObject
+class Button : public InteractiveObject
{
public:
@@ -86,7 +86,7 @@
bool get_member(string_table::key name, as_value* val,
string_table::key nsname = 0);
- bool can_handle_mouse_event() const { return true; }
+ bool mouseEnabled() const { return true; }
// called from keypress listener only
bool on_event(const event_id& id);
@@ -103,7 +103,7 @@
//
/// I.e. check against ourself.
///
- virtual InteractiveDisplayObject* topmostMouseEntity(boost::int32_t x,
+ virtual InteractiveObject* topmostMouseEntity(boost::int32_t x,
boost::int32_t y);
virtual bool wantsInstanceName() const
=== modified file 'libcore/DisplayObject.h'
--- a/libcore/DisplayObject.h 2009-04-04 10:33:21 +0000
+++ b/libcore/DisplayObject.h 2009-04-04 15:35:18 +0000
@@ -52,7 +52,7 @@
class action_buffer;
class movie_definition;
class StaticText;
- class InteractiveDisplayObject;
+ class InteractiveObject;
namespace SWF {
class TextRecord;
}
@@ -65,7 +65,7 @@
/// It represents a single active element in a movie. This class does not
/// provide any interactivity.
//
-/// Derived classes include InteractiveDisplayObject, StaticText, Bitmap,
+/// Derived classes include InteractiveObject, StaticText, Bitmap,
/// Video, and Shape.
class DisplayObject : public as_object
{
@@ -308,7 +308,7 @@
///
bool isDynamicMask() const
{
- return _maskee;
+ return (_maskee);
}
DisplayObject* toDisplayObject() { return this; }
@@ -626,8 +626,8 @@
/// DisplayObjects are not a mouse entity by default.
//
- /// Override this function for InteractiveDisplayObjects.
- virtual InteractiveDisplayObject* topmostMouseEntity(boost::int32_t,
+ /// Override this function for InteractiveObjects.
+ virtual InteractiveObject* topmostMouseEntity(boost::int32_t,
boost::int32_t) {
return 0;
}
@@ -727,9 +727,8 @@
/// clear_invalidated() even if display() is not necessary.
///
/// Not doing so will result in a stale invalidated flag which in turn will
- /// prevent the parent to be informed when this DisplayObject (or a child)
is
- /// invalidated again (see set_invalidated() recursion).
- ///
+ /// prevent the parent to be informed when this DisplayObject (or a
+ /// child) is invalidated again (see set_invalidated() recursion).
void clear_invalidated() {
m_invalidated = false;
m_child_invalidated = false;
@@ -755,10 +754,10 @@
/// Only instances with m_invalidated flag set are checked unless
/// force is set.
///
- virtual void add_invalidated_bounds(InvalidatedRanges& ranges,
- bool force);
+ virtual void add_invalidated_bounds(InvalidatedRanges& ranges, bool force);
- /// Called instead of display() when the DisplayObject is not visible on
stage.
+ /// Called instead of display() when the DisplayObject is not visible
+ /// on stage.
/// Used to clear the invalidated flags.
virtual void omit_display() { clear_invalidated(); };
@@ -845,11 +844,6 @@
///
std::string DSOEXPORT getTarget() const;
-#ifdef NEW_KEY_LISTENER_LIST_DESIGN
- boost::intrusive_ptr<as_function> getUserDefinedEventHandler(
- const std::string& name) const;
-#endif
-
/// Return true if this DisplayObject is a selectable TextField
//
/// This method is used by Gui to set up an appropriate cursor
@@ -1019,7 +1013,7 @@
const Events& get_event_handlers() const
{
- return _event_handlers;
+ return _event_handlers;
}
/// Return a user defined event handler, if any
@@ -1033,7 +1027,8 @@
/// A function if a member with the given name exists and
/// casts to an as_function. A NULL pointer otherwise.
///
- boost::intrusive_ptr<as_function> getUserDefinedEventHandler(const
std::string& name) const;
+ boost::intrusive_ptr<as_function> getUserDefinedEventHandler(
+ const std::string& name) const;
/// Return a user defined event handler, if any
//
@@ -1044,7 +1039,8 @@
/// A function if a member with the given key exists and
/// casts to an as_function. A NULL pointer otherwise.
///
- boost::intrusive_ptr<as_function>
getUserDefinedEventHandler(string_table::key key) const;
+ boost::intrusive_ptr<as_function> getUserDefinedEventHandler(
+ string_table::key key) const;
void set_event_handlers(const Events& copyfrom);
@@ -1081,17 +1077,17 @@
/// Bounds of this DisplayObject instance before first invalidation
/// since last call to clear_invalidated().
///
- /// This stores the bounds of the DisplayObject before it has been
changed, ie.
- /// the position when set_invalidated() is being called. While drawing,
both
- /// the old and the new bounds are updated (rendered). When moving a
- /// DisplayObject A to B then both the position A needs to be re-rendered
(to
- /// reveal the backgrond) and the position B needs to be re-rendered (to
- /// show the DisplayObject in its new position). The bounds may be
identical or
- /// overlap, but SnappingRanges takes care of that.
+ /// This stores the bounds of the DisplayObject before it has been
+ /// changed, ie. the position when set_invalidated() is being called.
+ /// While drawing, both the old and the new bounds are updated (rendered).
+ /// When moving a DisplayObject A to B then both the position A needs
+ /// to be re-rendered (to reveal the backgrond) and the position B
+ /// needs to be re-rendered (to show the DisplayObject in its new
+ /// position). The bounds may be identical or overlap, but
+ /// SnappingRanges takes care of that.
///
/// Will be set by set_invalidated() and used by
/// get_invalidated_bounds().
- ///
InvalidatedRanges m_old_invalidated_ranges;
private:
@@ -1105,8 +1101,8 @@
int m_id;
int m_depth;
- cxform m_color_transform;
- SWFMatrix m_matrix;
+ cxform m_color_transform;
+ SWFMatrix m_matrix;
/// Cache values for ActionScript access.
/// NOTE: not all DisplayObjects need this, just the
@@ -1121,11 +1117,11 @@
/// need this (assuming soft ref don't rebind to other
/// kind of DisplayObjects).
///
- int _volume;
+ int _volume;
- int m_ratio;
+ int m_ratio;
int m_clip_depth;
- Events _event_handlers;
+ Events _event_handlers;
/// Used to assign a name to unnamed instances
static unsigned int _lastUnnamedInstanceNum;
=== renamed file 'libcore/InteractiveDisplayObject.cpp' =>
'libcore/InteractiveObject.cpp'
--- a/libcore/InteractiveDisplayObject.cpp 2009-04-03 09:51:53 +0000
+++ b/libcore/InteractiveObject.cpp 2009-04-04 15:35:18 +0000
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#include "InteractiveDisplayObject.h"
+#include "InteractiveObject.h"
namespace gnash
{
=== renamed file 'libcore/InteractiveDisplayObject.h' =>
'libcore/InteractiveObject.h'
--- a/libcore/InteractiveDisplayObject.h 2009-04-03 14:54:49 +0000
+++ b/libcore/InteractiveObject.h 2009-04-04 15:35:18 +0000
@@ -36,33 +36,31 @@
/// The base class for interactive objects.
//
-/// Objects of type InteractiveDisplayObject can receive focus, mouse events,
+/// Objects of type InteractiveObject can receive focus, mouse events,
/// and key events for user interaction.
//
/// Derived classes include TextField, Button, and MovieClip.
-class InteractiveDisplayObject : public DisplayObject
+class InteractiveObject : public DisplayObject
{
public:
- InteractiveDisplayObject(DisplayObject* parent, int id)
+ InteractiveObject(DisplayObject* parent, int id)
:
DisplayObject(parent, id)
{
}
- virtual ~InteractiveDisplayObject() {}
+ virtual ~InteractiveObject() {}
- /// Render this InteractiveDisplayObject
+ /// Render this InteractiveObject
virtual void display() = 0;
/// Whether the DisplayObject can handle a mouse event.
//
/// @return true if the DisplayObject can handle mouse
/// events
- virtual bool can_handle_mouse_event() const {
- return false;
- }
+ virtual bool mouseEnabled() const = 0;
/// Allow extraction of static text.
//
@@ -104,7 +102,7 @@
/// @param y
/// Y ordinate of the pointer, in parent's coordiante space.
///
- virtual InteractiveDisplayObject* topmostMouseEntity(boost::int32_t /*x*/,
+ virtual InteractiveObject* topmostMouseEntity(boost::int32_t /*x*/,
boost::int32_t /*y*/) = 0;
virtual void mouseEvent(const event_id& id)
=== modified file 'libcore/Makefile.am'
--- a/libcore/Makefile.am 2009-04-03 09:18:40 +0000
+++ b/libcore/Makefile.am 2009-04-04 15:35:18 +0000
@@ -75,7 +75,7 @@
BevelFilter.cpp \
GradientBevelFilter.cpp \
parser/filter_factory.cpp \
- InteractiveDisplayObject.cpp \
+ InteractiveObject.cpp \
SWFMatrix.cpp \
movie_instance.cpp \
movie_root.cpp \
@@ -165,7 +165,7 @@
fontlib.h \
Shape.h \
StaticText.h \
- InteractiveDisplayObject.h \
+ InteractiveObject.h \
gnash.h \
GnashKey.h \
impl.h \
=== modified file 'libcore/MouseButtonState.h'
--- a/libcore/MouseButtonState.h 2009-04-03 12:05:21 +0000
+++ b/libcore/MouseButtonState.h 2009-04-04 15:35:18 +0000
@@ -10,7 +10,7 @@
#include "smart_ptr.h" // GNASH_USE_GC
#include "character_def.h"
#include "smart_ptr.h" // for composition and inlines
-#include "InteractiveDisplayObject.h" // for use in intrusive_ptr
+#include "InteractiveObject.h" // for use in intrusive_ptr
// Forward declarations
namespace gnash {
@@ -32,10 +32,10 @@
};
/// entity that currently owns the mouse pointer
- boost::intrusive_ptr<InteractiveDisplayObject> activeEntity;
+ boost::intrusive_ptr<InteractiveObject> activeEntity;
/// what's underneath the mouse right now
- boost::intrusive_ptr<InteractiveDisplayObject> topmostEntity;
+ boost::intrusive_ptr<InteractiveObject> topmostEntity;
/// previous state of mouse button
bool previousButtonState;
=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp 2009-04-03 11:48:02 +0000
+++ b/libcore/MovieClip.cpp 2009-04-04 15:35:18 +0000
@@ -277,7 +277,7 @@
for (Candidates::reverse_iterator i=_candidates.rbegin(),
e=_candidates.rend(); i!=e; ++i) {
DisplayObject* ch = *i;
- InteractiveDisplayObject* te = ch->topmostMouseEntity(_pp.x,
_pp.y);
+ InteractiveObject* te = ch->topmostMouseEntity(_pp.x, _pp.y);
if (te) {
_m = te;
break;
@@ -286,7 +286,7 @@
_checked = true;
}
- InteractiveDisplayObject* getEntity()
+ InteractiveObject* getEntity()
{
checkCandidates();
#ifdef DEBUG_MOUSE_ENTITY_FINDING
@@ -311,7 +311,7 @@
///
int _highestHiddenDepth;
- InteractiveDisplayObject* _m;
+ InteractiveObject* _m;
typedef std::vector<DisplayObject*> Candidates;
Candidates _candidates;
@@ -481,7 +481,7 @@
MovieClip::MovieClip(movie_definition* def, movie_instance* r,
DisplayObject* parent, int id)
:
- InteractiveDisplayObject(parent, id),
+ InteractiveObject(parent, id),
m_root(r),
_drawable(new DynamicShape()),
_drawable_inst(_drawable->createDisplayObject(this, 0)),
@@ -1685,7 +1685,7 @@
// If focusEnabled doesn't evaluate to true or for SWF5, return true
// only if at least one mouse event handler is defined.
- return can_handle_mouse_event();
+ return mouseEnabled();
}
bool
@@ -1701,7 +1701,7 @@
MovieClip::pointInVisibleShape(boost::int32_t x, boost::int32_t y) const
{
if ( ! isVisible() ) return false;
- if ( isDynamicMask() && ! can_handle_mouse_event() )
+ if ( isDynamicMask() && ! mouseEnabled() )
{
// see testsuite/misc-ming.all/masks_test.swf
#ifdef GNASH_DEBUG_HITTEST
@@ -1729,7 +1729,7 @@
bool
MovieClip::pointInHitableShape(boost::int32_t x, boost::int32_t y) const
{
- if ( isDynamicMask() && !can_handle_mouse_event() )
+ if ( isDynamicMask() && !mouseEnabled() )
{
return false;
}
@@ -1753,7 +1753,7 @@
}
}
-InteractiveDisplayObject*
+InteractiveObject*
MovieClip::topmostMouseEntity(boost::int32_t x, boost::int32_t y)
{
//GNASH_REPORT_FUNCTION;
@@ -1773,7 +1773,7 @@
parent->getWorldMatrix().transform(wp);
}
- if ( can_handle_mouse_event() )
+ if ( mouseEnabled() )
{
if ( pointInVisibleShape(wp.x, wp.y) ) return this;
else return NULL;
@@ -1785,7 +1785,7 @@
MouseEntityFinder finder(wp, pp);
m_display_list.visitAll(finder);
- InteractiveDisplayObject* ch = finder.getEntity();
+ InteractiveObject* ch = finder.getEntity();
// It doesn't make any sense to query _drawable_inst, as it's
// a generic DisplayObject and not a referencable DisplayObject.
@@ -1934,7 +1934,7 @@
}
bool
-MovieClip::can_handle_mouse_event() const
+MovieClip::mouseEnabled() const
{
if ( ! isEnabled() ) return false;
=== modified file 'libcore/MovieClip.h'
--- a/libcore/MovieClip.h 2009-04-03 11:48:02 +0000
+++ b/libcore/MovieClip.h 2009-04-04 15:35:18 +0000
@@ -27,7 +27,7 @@
#include "movie_definition.h" // for inlines
#include "DisplayList.h" // DisplayList
-#include "InteractiveDisplayObject.h"
+#include "InteractiveObject.h"
#include "log.h"
#include "as_environment.h" // for composition
#include "DynamicShape.h" // for composition
@@ -68,7 +68,7 @@
/// This means that they define a variable scope (see
/// the as_environment member) and are divided into "frames"
///
-class MovieClip : public InteractiveDisplayObject, boost::noncopyable
+class MovieClip : public InteractiveObject, boost::noncopyable
{
public:
@@ -243,13 +243,13 @@
//
/// NOTE: this function currently does not consider
/// general mouse event handlers MOUSE_MOVE, MOUSE
- virtual bool can_handle_mouse_event() const;
+ virtual bool mouseEnabled() const;
/// \brief
/// Return the topmost entity that the given point
/// covers that can receive mouse events. NULL if
/// none. Coords are in parent's frame.
- virtual InteractiveDisplayObject* topmostMouseEntity(boost::int32_t x,
+ virtual InteractiveObject* topmostMouseEntity(boost::int32_t x,
boost::int32_t y);
// see dox in DisplayObject.h
=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp 2009-04-03 11:48:02 +0000
+++ b/libcore/TextField.cpp 2009-04-04 15:35:18 +0000
@@ -112,7 +112,7 @@
TextField::TextField(DisplayObject* parent, const SWF::DefineEditTextTag& def,
int id)
:
- InteractiveDisplayObject(parent, id),
+ InteractiveObject(parent, id),
_tag(&def),
_textDefined(def.hasText()),
_underlined(false),
@@ -170,7 +170,7 @@
TextField::TextField(DisplayObject* parent, const rect& bounds)
:
// the id trick is to fool assertions in DisplayObject ctor
- InteractiveDisplayObject(parent, parent ? 0 : -1),
+ InteractiveObject(parent, parent ? 0 : -1),
_textDefined(false),
_underlined(false),
_leading(0),
@@ -500,7 +500,7 @@
return true;
}
-InteractiveDisplayObject*
+InteractiveObject*
TextField::topmostMouseEntity(boost::int32_t x, boost::int32_t y)
{
=== modified file 'libcore/TextField.h'
--- a/libcore/TextField.h 2009-04-03 11:48:02 +0000
+++ b/libcore/TextField.h 2009-04-04 15:35:18 +0000
@@ -18,7 +18,7 @@
#ifndef GNASH_TEXTFIELD_H
#define GNASH_TEXTFIELD_H
-#include "InteractiveDisplayObject.h" // for inheritance
+#include "InteractiveObject.h" // for inheritance
#include "styles.h" // for line_style
#include "fill_style.h"
#include "Range2d.h"
@@ -36,7 +36,7 @@
namespace gnash {
/// An instance of a DefineEditTextTag
-class TextField : public InteractiveDisplayObject
+class TextField : public InteractiveObject
{
public:
@@ -91,9 +91,9 @@
~TextField();
// TODO: should this return isSelectable() ?
- bool can_handle_mouse_event() const { return true; }
+ bool mouseEnabled() const { return true; }
- InteractiveDisplayObject* topmostMouseEntity(boost::int32_t x,
+ InteractiveObject* topmostMouseEntity(boost::int32_t x,
boost::int32_t y);
bool wantsInstanceName() const
=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp 2009-04-03 15:20:47 +0000
+++ b/libcore/movie_root.cpp 2009-04-04 15:35:18 +0000
@@ -1168,7 +1168,7 @@
// remove unloaded DisplayObject listeners from movie_root
for (CharacterList::iterator iter = ll.begin(); iter != ll.end(); )
{
- DisplayObject* ch = iter->get();
+ DisplayObject* const ch = *iter;
if ( ch->isUnloaded() )
{
if ( ! ch->isDestroyed() )
@@ -1205,7 +1205,7 @@
iter != itEnd; ++iter)
{
// sprite, button & input_edit_text DisplayObjects
- DisplayObject* ch = iter->get();
+ DisplayObject* const ch = *iter;
if ( ! ch->isUnloaded() )
{
if(down)
@@ -1231,17 +1231,13 @@
}
}
-/* static private */
void
movie_root::add_listener(CharacterList& ll, DisplayObject* listener)
{
assert(listener);
- for(CharacterList::const_iterator i = ll.begin(), e = ll.end(); i != e;
++i)
- {
- // Conceptually, we don't need to add the same DisplayObject
twice.
- // but see TextField::setFocus()...
- if(*i == listener) return;
- }
+
+ // Don't add the same listener twice (why not use a set?)
+ if (std::find(ll.begin(), ll.end(), listener) != ll.end()) return;
ll.push_front(listener);
}
@@ -1251,23 +1247,19 @@
movie_root::remove_listener(CharacterList& ll, DisplayObject* listener)
{
assert(listener);
-
- ll.remove_if(std::bind2nd(
- std::equal_to<boost::intrusive_ptr<DisplayObject> >(),
listener));
+ ll.remove_if(std::bind2nd(std::equal_to<DisplayObject*>(), listener));
}
void
movie_root::notify_mouse_listeners(const event_id& event)
{
- //log_debug("Notifying %d listeners about %s",
- // m_mouse_listeners.size(), event);
CharacterList copy = m_mouse_listeners;
for (CharacterList::iterator iter = copy.begin(), itEnd=copy.end();
iter != itEnd; ++iter)
{
- DisplayObject* ch = iter->get();
- if ( ! ch->isUnloaded() )
+ DisplayObject* const ch = *iter;
+ if (!ch->isUnloaded())
{
ch->on_event(event);
}
@@ -1289,7 +1281,8 @@
}
catch (ActionLimitException &e)
{
- log_error(_("ActionLimits hit notifying mouse events: %s."),
e.what());
+ log_error(_("ActionLimits hit notifying mouse events: %s."),
+ e.what());
clearActionQueue();
}
@@ -1297,8 +1290,7 @@
assert(testInvariant());
- if( ! copy.empty() )
- {
+ if (!copy.empty()) {
// process actions queued in the above step
processActionQueue();
}
@@ -1318,7 +1310,8 @@
// Nothing to do if current focus is the same as the new focus.
// _level0 also seems unable to receive focus under any circumstances
// TODO: what about _level1 etc ?
- if (to == _currentFocus || to ==
static_cast<DisplayObject*>(getRootMovie())) {
+ if (to == _currentFocus ||
+ to == static_cast<DisplayObject*>(getRootMovie())) {
return false;
}
@@ -1387,14 +1380,7 @@
movie_root::isMouseOverActiveEntity() const
{
assert(testInvariant());
-
- boost::intrusive_ptr<DisplayObject> entity (
m_mouse_button_state.activeEntity );
- if ( ! entity.get() ) {
- return false;
- }
- else {
- return true;
- }
+ return (m_mouse_button_state.activeEntity);
}
void
@@ -1654,7 +1640,6 @@
if ( _disableScripts )
{
- //log_debug(_("Scripts are disabled, global instance list has
%d elements"), _liveChars.size());
/// cleanup anything pushed later..
clearActionQueue();
return;
@@ -1705,18 +1690,6 @@
movie_root::pushAction(std::auto_ptr<ExecutableCode> code, int lvl)
{
assert(lvl >= 0 && lvl < apSIZE);
-
-#if 0
- // Immediately execute code targetted at a lower level while processing
- // an higher level.
- if ( processingActions() && lvl < _processingActionLevel )
- {
- log_debug("Action pushed in level %d executed immediately (as
we are currently executing level %d)", lvl, _processingActionLevel);
- code->execute();
- return;
- }
-#endif
-
_actionQueue[lvl].push_back(code.release());
}
@@ -1910,21 +1883,21 @@
}
#endif // GNASH_USE_GC
-InteractiveDisplayObject*
+InteractiveObject*
movie_root::getTopmostMouseEntity(boost::int32_t x, boost::int32_t y) const
{
for (Childs::const_reverse_iterator i=_childs.rbegin(),
e=_childs.rend();
i != e; ++i)
{
- InteractiveDisplayObject* ret =
i->second->topmostMouseEntity(x, y);
+ InteractiveObject* ret = i->second->topmostMouseEntity(x, y);
if (ret) return ret;
}
for (Levels::const_reverse_iterator i=_movies.rbegin(),
e=_movies.rend();
i != e; ++i)
{
- InteractiveDisplayObject* ret =
i->second->topmostMouseEntity(x, y);
+ InteractiveObject* ret = i->second->topmostMouseEntity(x, y);
if (ret) return ret;
}
@@ -1932,19 +1905,23 @@
}
const DisplayObject *
-movie_root::findDropTarget(boost::int32_t x, boost::int32_t y, DisplayObject*
dragging) const
+movie_root::findDropTarget(boost::int32_t x, boost::int32_t y,
+ DisplayObject* dragging) const
{
- for (Childs::const_reverse_iterator i=_childs.rbegin(),
e=_childs.rend(); i!=e; ++i)
- {
- const DisplayObject* ret = i->second->findDropTarget(x, y,
dragging);
- if ( ret ) return ret;
- }
- for (Levels::const_reverse_iterator i=_movies.rbegin(),
e=_movies.rend(); i!=e; ++i)
- {
- const DisplayObject* ret = i->second->findDropTarget(x, y,
dragging);
- if ( ret ) return ret;
- }
- return NULL;
+ for (Childs::const_reverse_iterator i=_childs.rbegin(),
e=_childs.rend();
+ i!=e; ++i) {
+
+ const DisplayObject* ret = i->second->findDropTarget(x, y,
dragging);
+ if ( ret ) return ret;
+ }
+
+ for (Levels::const_reverse_iterator i=_movies.rbegin(), e=_movies.rend();
+ i!=e; ++i) {
+
+ const DisplayObject* ret = i->second->findDropTarget(x, y, dragging);
+ if ( ret ) return ret;
+ }
+ return 0;
}
void
@@ -1959,29 +1936,29 @@
#endif
// Let every sprite cleanup the local DisplayList
- //
- // TODO: we might skip this additinal scan by delegating
- // cleanup of the local DisplayLists in the ::display
- // method of each sprite, but that will introduce
- // problems when we'll implement skipping ::display()
- // when late on FPS. Alternatively we may have the
- // MovieClip::markReachableResources take care
- // of cleaning up unloaded... but that will likely
- // introduce problems when allowing the GC to run
- // at arbitrary times.
- // The invariant to keep is that cleanup of unloaded
DisplayObjects
- // in local display lists must happen at the *end* of global
action
- // queue processing.
- //
- for (Childs::reverse_iterator i=_childs.rbegin(), e=_childs.rend();
i!=e; ++i)
- {
- MovieClip* mc = dynamic_cast<MovieClip*>(i->second);
- if ( mc ) mc->cleanupDisplayList();
- }
- for (Levels::reverse_iterator i=_movies.rbegin(), e=_movies.rend();
i!=e; ++i)
- {
- i->second->cleanupDisplayList();
- }
+ //
+ // TODO: we might skip this additinal scan by delegating
+ // cleanup of the local DisplayLists in the ::display
+ // method of each sprite, but that will introduce
+ // problems when we'll implement skipping ::display()
+ // when late on FPS. Alternatively we may have the
+ // MovieClip::markReachableResources take care
+ // of cleaning up unloaded... but that will likely
+ // introduce problems when allowing the GC to run
+ // at arbitrary times.
+ // The invariant to keep is that cleanup of unloaded DisplayObjects
+ // in local display lists must happen at the *end* of global action
+ // queue processing.
+ //
+ for (Childs::reverse_iterator i=_childs.rbegin(), e=_childs.rend(); i!=e;
++i)
+ {
+ MovieClip* mc = dynamic_cast<MovieClip*>(i->second);
+ if ( mc ) mc->cleanupDisplayList();
+ }
+ for (Levels::reverse_iterator i=_movies.rbegin(), e=_movies.rend(); i!=e;
++i)
+ {
+ i->second->cleanupDisplayList();
+ }
// Now remove from the instance list any unloaded DisplayObject
// Note that some DisplayObjects may be unloaded but not yet destroyed,
@@ -2057,7 +2034,6 @@
}
-/*static private*/
void
movie_root::advanceLiveChar(boost::intrusive_ptr<DisplayObject> ch)
{
@@ -2071,7 +2047,8 @@
}
#ifdef GNASH_DEBUG
else {
- log_debug(" DisplayObject %s is unloaded, not advancing it",
ch->getTarget());
+ log_debug(" DisplayObject %s is unloaded, not advancing it",
+ ch->getTarget());
}
#endif
}
@@ -2081,24 +2058,24 @@
{
#ifdef GNASH_DEBUG
- log_debug("---- movie_root::advance: %d live DisplayObjects in the
global list", _liveChars.size());
+ log_debug("---- movie_root::advance: %d live DisplayObjects in "
+ "the global list", _liveChars.size());
#endif
- std::for_each(_liveChars.begin(), _liveChars.end(),
boost::bind(advanceLiveChar, _1));
+ std::for_each(_liveChars.begin(), _liveChars.end(),
+ boost::bind(advanceLiveChar, _1));
}
void
movie_root::set_background_color(const rgba& color)
{
- //GNASH_REPORT_FUNCTION;
if ( m_background_color_set ) return;
m_background_color_set = true;
- if ( m_background_color != color )
- {
+ if ( m_background_color != color ) {
setInvalidated();
- m_background_color = color;
+ m_background_color = color;
}
}
@@ -2109,19 +2086,16 @@
boost::uint8_t newAlpha = clamp<int>(frnd(alpha * 255.0f), 0, 255);
- if ( m_background_color.m_a != newAlpha )
- {
+ if (m_background_color.m_a != newAlpha) {
setInvalidated();
- m_background_color.m_a = newAlpha;
+ m_background_color.m_a = newAlpha;
}
}
DisplayObject*
-movie_root::findCharacterByTarget(const std::string& tgtstr_orig) const
+movie_root::findCharacterByTarget(const std::string& tgtstr) const
{
- if ( tgtstr_orig.empty() ) return NULL;
-
- std::string tgtstr = PROPNAME(tgtstr_orig);
+ if (tgtstr.empty()) return 0;
string_table& st = _vm.getStringTable();
@@ -2132,19 +2106,19 @@
as_object* o = _movies.begin()->second.get();
std::string::size_type from = 0;
- while ( std::string::size_type to=tgtstr.find_first_of('.', from) )
+ while (std::string::size_type to = tgtstr.find('.', from))
{
- std::string part(tgtstr, from, to-from);
+ std::string part(tgtstr, from, to - from);
o = o->get_path_element(st.find(part));
- if ( ! o ) {
+ if (!o) {
#ifdef GNASH_DEBUG_TARGET_RESOLUTION
- log_debug("Evaluating DisplayObject target path:
element '%s' of path '%s' not found",
- part, tgtstr);
+ log_debug("Evaluating DisplayObject target path:
element "
+ "'%s' of path '%s' not found", part, tgtstr);
#endif
return NULL;
}
- if ( to == std::string::npos ) break;
- from = to+1;
+ if (to == std::string::npos) break;
+ from = to + 1;
}
return o->toDisplayObject();
}
@@ -2446,7 +2420,8 @@
/// Stage: number of live DisplayObjects
std::ostringstream os;
os << _liveChars.size();
- localIter = tr.append_child(it, StringPair(_("Live DisplayObjects"),
os.str()));
+ localIter = tr.append_child(it, StringPair(_("Live DisplayObjects"),
+ os.str()));
/// Live DisplayObjects tree
for (LiveChars::const_iterator i=_liveChars.begin(), e=_liveChars.end();
@@ -2484,7 +2459,9 @@
void
movie_root::addChild(DisplayObject* ch)
{
- int newDepth = _childs.empty() ? 0 :
_childs.rbegin()->second->get_depth()+1;
+ int newDepth = _childs.empty() ? 0 :
+ _childs.rbegin()->second->get_depth()+1;
+
ch->set_depth(newDepth);
assert(!_childs[newDepth]);
=== modified file 'libcore/movie_root.h'
--- a/libcore/movie_root.h 2009-04-03 18:45:30 +0000
+++ b/libcore/movie_root.h 2009-04-04 15:35:18 +0000
@@ -907,7 +907,7 @@
void processLoadMovieRequest(const LoadMovieRequest& r);
/// Listeners container
- typedef std::list< boost::intrusive_ptr<DisplayObject> > CharacterList;
+ typedef std::list<DisplayObject*> CharacterList;
/// key and mouse listeners container
typedef CharacterList KeyListeners;
@@ -1066,7 +1066,7 @@
/// @param y
/// Y ordinate of the pointer, in world coordiante space (twips).
///
- InteractiveDisplayObject* getTopmostMouseEntity(boost::int32_t x,
+ InteractiveObject* getTopmostMouseEntity(boost::int32_t x,
boost::int32_t y) const;
/// Delete DisplayObjects removed from the stage
=== modified file 'testsuite/DummyCharacter.h'
--- a/testsuite/DummyCharacter.h 2009-04-03 15:34:59 +0000
+++ b/testsuite/DummyCharacter.h 2009-04-04 15:35:18 +0000
@@ -18,7 +18,7 @@
#ifndef GNASH_DUMMYCHARACTER_H
#define GNASH_DUMMYCHARACTER_H
-#include "InteractiveDisplayObject.h" // for inheritance
+#include "InteractiveObject.h" // for inheritance
#include "rect.h" // for composition
#include "movie_instance.h" // for create_movie_instance
#include "snappingrange.h" // for InvalidatedRanges typedef (don't like it)
@@ -40,14 +40,14 @@
/// values for XXXXXXXXXXXXXXXXXXXXXXXXXX etc..
///
///
-class DummyCharacter : public InteractiveDisplayObject
+class DummyCharacter : public InteractiveObject
{
public:
DummyCharacter(DisplayObject* parent)
:
- InteractiveDisplayObject(parent, parent ? 0 : -1)
+ InteractiveObject(parent, parent ? 0 : -1)
{
}
@@ -55,7 +55,9 @@
virtual rect getBounds() const { return rect(); }
- InteractiveDisplayObject* topmostMouseEntity(boost::int32_t,
boost::int32_t)
+ virtual bool mouseEnabled() const { return true; }
+
+ InteractiveObject* topmostMouseEntity(boost::int32_t, boost::int32_t)
{
return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10769: Correct silly mistake in class naming. Other minor cleanups.,
Benjamin Wolsey <=