gnash-commit
[Top][All Lists]
Advanced

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

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


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog server/movie_root.cpp server/mo...
Date: Thu, 24 Apr 2008 08:02:39 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/04/24 08:02:38

Modified files:
        .              : ChangeLog 
        server         : movie_root.cpp movie_root.h 
        server/asobj   : Stage.cpp Stage.h 

Log message:
                * server/movie_root.{cpp,h}: rename get{Width,Height} to
                  getStage{Width,Height}. Move implementation of Stage.width and
                  Stage.height to movie_root. Add docs.
                * server/asobj/Stage.{h,cpp}: drop class members moved to 
movie_root.
                  Handle setScaleMode in the getter/setter (no need for a 
duplicated
                  method in the Stage class). Update docs.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6375&r2=1.6376
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.187&r2=1.188
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.126&r2=1.127
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Stage.cpp?cvsroot=gnash&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Stage.h?cvsroot=gnash&r1=1.19&r2=1.20

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6375
retrieving revision 1.6376
diff -u -b -r1.6375 -r1.6376
--- ChangeLog   24 Apr 2008 06:55:57 -0000      1.6375
+++ ChangeLog   24 Apr 2008 08:02:38 -0000      1.6376
@@ -1,3 +1,12 @@
+2008-04-24 Benjamin Wolsey <address@hidden>
+
+       * server/movie_root.{cpp,h}: rename get{Width,Height} to
+         getStage{Width,Height}. Move implementation of Stage.width and
+         Stage.height to movie_root. Add docs.
+       * server/asobj/Stage.{h,cpp}: drop class members moved to movie_root.
+         Handle setScaleMode in the getter/setter (no need for a duplicated
+         method in the Stage class). Update docs.
+
 2008-04-24 Zou Lunkai <address@hidden>
 
        * server/sprite_instance.cpp, server/BitmapMovieInstance.cpp:

Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -b -r1.187 -r1.188
--- server/movie_root.cpp       23 Apr 2008 20:35:37 -0000      1.187
+++ server/movie_root.cpp       24 Apr 2008 08:02:38 -0000      1.188
@@ -962,6 +962,28 @@
        dragChar->set_matrix(local);
 }
 
+/// Get current viewport width, in pixels
+unsigned int
+movie_root::getStageWidth() const
+{
+    if (_scaleMode == noScale)
+    {
+        return m_viewport_width;    
+    }
+    return static_cast<unsigned 
int>(get_movie_definition()->get_width_pixels());
+}
+
+/// Get current viewport height, in pixels
+unsigned int
+movie_root::getStageHeight() const
+{
+    if (_scaleMode == noScale)
+    {
+        return m_viewport_height;    
+    }
+    return static_cast<unsigned 
int>(get_movie_definition()->get_height_pixels());
+}
+
 unsigned int
 movie_root::add_interval_timer(std::auto_ptr<Timer> timer, bool internal)
 {
@@ -1325,7 +1347,6 @@
         }
     }
   
-
     _scaleMode = sm;
     if (interfaceHandle) (*interfaceHandle)("Stage.align", "");    
 

Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -b -r1.126 -r1.127
--- server/movie_root.h 23 Apr 2008 17:47:10 -0000      1.126
+++ server/movie_root.h 24 Apr 2008 08:02:38 -0000      1.127
@@ -235,17 +235,15 @@
     ///
     void set_display_viewport(int x0, int y0, int w, int h);
 
-    /// Get current viewport width, in pixels
-    unsigned getWidth() const
-    {
-        return m_viewport_width;
-    }
+    /// \brief
+    /// Return the notional width of the stage, value depending
+    /// on scaleMode
+    unsigned getStageWidth() const;
 
-    /// Get current viewport height, in pixels
-    unsigned getHeight() const
-    {
-        return m_viewport_height;
-    }
+    /// \brief
+    /// Return the notional height of the stage, actual value depending
+    /// on scaleMode
+    unsigned getStageHeight() const;
 
     /// \brief
     /// The host app can use this to tell the movie when
@@ -494,6 +492,7 @@
 
     bool testInvariant() const;
 
+    /// enum for the values of Stage.scaleMode
     enum ScaleMode {
         showAll,
         noScale,
@@ -501,27 +500,34 @@
         noBorder
     };
 
+    /// enum for horizonal position of the Stage
     enum StageHorizontalAlign {
         STAGE_H_ALIGN_C,
         STAGE_H_ALIGN_L,
         STAGE_H_ALIGN_R,
     };
 
-
+    /// enum for vertical position of the Stage
     enum StageVerticalAlign {
         STAGE_V_ALIGN_C,
         STAGE_V_ALIGN_T,       
         STAGE_V_ALIGN_B
     };    
 
+    /// Sets movie_root's horizontal and vertical alignment to one
+    /// of the three possible positions for each dimension.
     void setStageAlignment(StageHorizontalAlign v, StageVerticalAlign h);
 
     typedef std::pair<StageHorizontalAlign, StageVerticalAlign> StageAlign;
 
+    /// Returns the current alignment of the stage (left/right/centre, top/
+    /// bottom/centre) as a std::pair
     StageAlign getStageAlignment() const;
 
+    /// Sets the Stage object's align mode.
     void setScaleMode(ScaleMode sm);
     
+    /// Returns the Stage object's align mode.
     ScaleMode getScaleMode() const { return _scaleMode; }
 
     /// Action priority levels

Index: server/asobj/Stage.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Stage.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- server/asobj/Stage.cpp      23 Apr 2008 16:43:36 -0000      1.41
+++ server/asobj/Stage.cpp      24 Apr 2008 08:02:38 -0000      1.42
@@ -45,6 +45,7 @@
 as_value stage_height_getset(const fn_call& fn);
 as_value stage_displaystate_getset(const fn_call& fn);
 
+
 static void
 attachStageInterface(as_object& o)
 {
@@ -106,6 +107,7 @@
 
 }
 
+
 Stage::Stage()
        :
        as_object(getObjectInterface()),
@@ -114,13 +116,14 @@
 {
        attachStageInterface(*this);
 
-       int swfversion = _vm.getSWFVersion();
+       const int swfversion = _vm.getSWFVersion();
        if ( swfversion > 5 )
        {
                AsBroadcaster::initialize(*this);
        }
 }
 
+
 void
 Stage::onResize()
 {
@@ -131,6 +134,7 @@
        }
 }
 
+
 void
 Stage::notifyResize()
 {
@@ -140,33 +144,6 @@
 
 /// Expected behaviour is that the original movie size is aways returned
 /// as long as scaling is allowed.
-unsigned int
-Stage::getWidth() const
-{
-
-    movie_root& m = VM::get().getRoot();
-
-    if (m.getScaleMode() == movie_root::noScale)
-    {
-        return m.getWidth();    
-    }
-    return static_cast<unsigned 
int>(m.get_movie_definition()->get_width_pixels());
-       
-}
-
-unsigned int
-Stage::getHeight() const
-{
-
-    movie_root& m = VM::get().getRoot();
-
-    if (m.getScaleMode() == movie_root::noScale)
-    {
-        return m.getHeight();    
-    }
-    return static_cast<unsigned 
int>(m.get_movie_definition()->get_height_pixels());
-
-}
 
 const char*
 Stage::getDisplayStateString()
@@ -178,6 +155,7 @@
        return displayStateName[_displayState];
 }
 
+
 const char*
 Stage::getScaleModeString()
 {
@@ -192,15 +170,6 @@
        return modeName[m.getScaleMode()];
 }
 
-void
-Stage::setScaleMode(movie_root::ScaleMode mode)
-{
-    movie_root& m = VM::get().getRoot();
-
-       if ( m.getScaleMode() == mode ) return; // nothing to do
-
-       m.setScaleMode(mode);
-}
 
 void
 Stage::setDisplayState(DisplayState state)
@@ -222,6 +191,7 @@
 
 }
 
+
 void
 Stage::setAlignMode(const std::string& mode)
 {
@@ -277,7 +247,11 @@
                else if ( str == "exactFit" ) mode = movie_root::exactFit;
                else if ( str == "noBorder" ) mode = movie_root::noBorder;
 
-               stage->setScaleMode(mode);
+        movie_root& m = VM::get().getRoot();
+
+        if ( m.getScaleMode() == mode ) return as_value(); // nothing to do
+
+           m.setScaleMode(mode);
                return as_value();
        }
 }
@@ -286,38 +260,41 @@
 stage_width_getset(const fn_call& fn)
 {
        boost::intrusive_ptr<Stage> stage = ensureType<Stage>(fn.this_ptr);
+       UNUSED(stage);
 
-       if ( fn.nargs == 0 ) // getter
-       {
-               return as_value(stage->getWidth());
-       }
-       else // setter
+       if ( fn.nargs > 0 ) // setter
        {
                IF_VERBOSE_ASCODING_ERRORS(
                log_aserror(_("Stage.width is a read-only property!"));
                );
                return as_value();
        }
+
+    // getter
+    movie_root& m = VM::get().getRoot();
+    return as_value(m.getStageWidth());
 }
 
 as_value
 stage_height_getset(const fn_call& fn)
 {
        boost::intrusive_ptr<Stage> stage = ensureType<Stage>(fn.this_ptr);
+       UNUSED(stage);
 
-       if ( fn.nargs == 0 ) // getter
-       {
-               return as_value(stage->getHeight());
-       }
-       else // setter
+       if ( fn.nargs > 0 ) // setter
        {
                IF_VERBOSE_ASCODING_ERRORS(
                log_aserror(_("Stage.height is a read-only property!"));
                );
                return as_value();
        }
+
+    // getter
+    movie_root& m = VM::get().getRoot();
+    return as_value(m.getStageHeight());
 }
 
+
 as_value
 stage_align_getset(const fn_call& fn)
 {

Index: server/asobj/Stage.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Stage.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/asobj/Stage.h        23 Apr 2008 20:35:37 -0000      1.19
+++ server/asobj/Stage.h        24 Apr 2008 08:02:38 -0000      1.20
@@ -28,9 +28,14 @@
 
 /// This is the Stage ActionScript object.
 //
-/// It is currently not used as it should, in particular
-/// it should control resize behaviour, while it's not.
+/// Some Stage methods are implemented in movie_root, because
+/// it provides the interface to the Gui and/or all the values
+/// required are necessarily in movie_root:
 ///
+/// - scaleMode
+/// - width
+/// - height
+
 class Stage: public as_object
 {
 
@@ -41,30 +46,14 @@
                fullScreen
        };
 
-
        Stage();
 
-       // override from as_object ?
-       //std::string get_text_value() const { return "Stage"; }
-
-       // override from as_object ?
-       //double get_numeric_value() const { return 0; }
-       
-       /// Recive a resize event.
+       /// Receive a resize event.
        void onResize();
 
        /// Notify all listeners about a resize event
        void notifyResize();
 
-       /// Get current stage width, in pixels
-       unsigned getWidth() const;
-
-       /// Get current stage height, in pixels
-       unsigned getHeight() const;
-
-       /// Set scale mode 
-       void setScaleMode(movie_root::ScaleMode mode);
-
        /// \brief
        /// Return the string representation for current
        /// scale mode.




reply via email to

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