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: Wed, 23 Apr 2008 16:35:54 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/04/23 16:35:54

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

Log message:
                * server/movie_root.{cpp,h}: store scaleMode in movie_root,
                  add methods to set and query scale and align mode. Notify
                  Player when scaleMode changes. The method isRescalingAllowed
                  still works, probably not necessary.
                * server/asobj/Stage.cpp: leave scaleMode entirely to movie_root
                  as there's no point duplicating it.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6363&r2=1.6364
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.183&r2=1.184
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.123&r2=1.124
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Stage.cpp?cvsroot=gnash&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Stage.h?cvsroot=gnash&r1=1.17&r2=1.18

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6363
retrieving revision 1.6364
diff -u -b -r1.6363 -r1.6364
--- ChangeLog   23 Apr 2008 16:23:03 -0000      1.6363
+++ ChangeLog   23 Apr 2008 16:35:53 -0000      1.6364
@@ -1,3 +1,12 @@
+2008-04-23 Benjamin Wolsey <address@hidden>
+
+       * server/movie_root.{cpp,h}: store scaleMode in movie_root,
+         add methods to set and query scale and align mode. Notify
+         Player when scaleMode changes. The method isRescalingAllowed
+         still works, probably not necessary.
+       * server/asobj/Stage.cpp: leave scaleMode entirely to movie_root
+         as there's no point duplicating it.
+
 2008-04-23 Sandro Santilli <address@hidden>
 
        * testsuite/actionscript.all/Stage.as: test other valid values

Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -b -r1.183 -r1.184
--- server/movie_root.cpp       23 Apr 2008 15:31:21 -0000      1.183
+++ server/movie_root.cpp       23 Apr 2008 16:35:54 -0000      1.184
@@ -33,6 +33,7 @@
 #include "sound_handler.h"
 #include "timers.h" // for Timer use
 
+#include <utility>
 #include <iostream>
 #include <string>
 #include <map>
@@ -49,8 +50,6 @@
 //#define GNASH_DEBUG_LOADMOVIE_REQUESTS_PROCESSING 1
 //#define GNASH_DEBUG_TIMERS_EXPIRATION 1
 
-using namespace std;
-
 namespace gnash
 {
 
@@ -90,11 +89,13 @@
        m_drag_state(),
        _movies(),
        _rootMovie(),
-       _allowRescale(true),
        _invalidated(true),
        _disableScripts(false),
        _processingActionLevel(movie_root::apSIZE),
-       _hostfd(-1)
+       _hostfd(-1),
+       _valign(STAGE_V_ALIGN_C),
+       _halign(STAGE_H_ALIGN_C),
+       _scaleMode(showAll)
 {
 }
 
@@ -1269,6 +1270,7 @@
        return dropChar;
 }
 
+
 bool
 movie_root::isMouseOverActiveEntity() const
 {
@@ -1285,6 +1287,7 @@
        return true;
 }
 
+
 void
 movie_root::setStageAlignment(StageHorizontalAlign h, StageVerticalAlign v)
 {
@@ -1295,6 +1298,22 @@
     if (interfaceHandle) (*interfaceHandle)("Stage.align", "");
 }
 
+
+movie_root::StageAlign
+movie_root::getStageAlignment() const
+{
+    return std::make_pair(_halign, _valign);
+}
+
+
+void
+movie_root::setScaleMode(ScaleMode sm)
+{
+    _scaleMode = sm;
+    if (interfaceHandle) (*interfaceHandle)("Stage.align", "");    
+}
+
+
 void
 movie_root::add_invalidated_bounds(InvalidatedRanges& ranges, bool force)
 {
@@ -1534,7 +1553,7 @@
                        unsigned long elapsed;
                        if ( timer->expired(now, elapsed) )
                        {
-                               expiredTimers.insert( make_pair(elapsed, timer) 
);
+                               expiredTimers.insert( std::make_pair(elapsed, 
timer) );
                        }
                }
 
@@ -1831,10 +1850,10 @@
        //       case... just not tested)
        as_object* o = _movies.begin()->second.get();
 
-       string::size_type from = 0;
-       while ( string::size_type to=tgtstr.find_first_of('.', from) )
+       std::string::size_type from = 0;
+       while ( std::string::size_type to=tgtstr.find_first_of('.', from) )
        {
-               string part(tgtstr, from, to-from);
+               std::string part(tgtstr, from, to-from);
                o = o->get_path_element(st.find(part));
                if ( ! o ) {
 #ifdef GNASH_DEBUG_TARGET_RESOLUTION
@@ -1843,7 +1862,7 @@
 #endif
                        return NULL;
                }
-               if ( to == string::npos ) break;
+               if ( to == std::string::npos ) break;
                from = to+1;
        }
        return o->to_character();
@@ -1864,7 +1883,7 @@
     bool usePost = r.usePost();
     const std::string& postData = r.getPostData();
 
-    if ( target.compare(0, 6, "_level") == 0 && 
target.find_first_not_of("0123456789", 7) == string::npos )
+    if ( target.compare(0, 6, "_level") == 0 && 
target.find_first_not_of("0123456789", 7) == std::string::npos )
     {
         unsigned int levelno = atoi(target.c_str()+6);
         log_debug(_("processLoadMovieRequest: Testing _level loading (level 
%u)"), levelno);

Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -b -r1.123 -r1.124
--- server/movie_root.h 23 Apr 2008 15:13:49 -0000      1.123
+++ server/movie_root.h 23 Apr 2008 16:35:54 -0000      1.124
@@ -247,21 +247,6 @@
         return m_viewport_height;
     }
 
-    /// Set whether rescaling is allowed or not.
-    //
-    /// When rescaling is not allowed the Stage listeners
-    /// will get notified on any resize attempt.
-    ///
-    void allowRescaling(bool v)
-    {
-        _allowRescale=v;
-    }
-
-    bool isRescalingAllowed()
-    {
-        return _allowRescale;
-    }
-
     /// \brief
     /// The host app can use this to tell the movie when
     /// user's mouse pointer has moved.
@@ -509,6 +494,13 @@
 
     bool testInvariant() const;
 
+    enum ScaleMode {
+        showAll,
+               noScale,
+               exactFill,
+               noBorder
+    };
+
     enum StageHorizontalAlign {
         STAGE_H_ALIGN_C,
         STAGE_H_ALIGN_L,
@@ -522,8 +514,26 @@
         STAGE_V_ALIGN_B
     };    
 
+    /// Set whether rescaling is allowed or not.
+    //
+    /// When rescaling is not allowed the Stage listeners
+    /// will get notified on any resize attempt.
+    ///
+    bool isRescalingAllowed()
+    {
+        return (_allowRescale != noScale);
+    }
+
     void setStageAlignment(StageHorizontalAlign v, StageVerticalAlign h);
 
+    typedef std::pair<StageHorizontalAlign, StageVerticalAlign> StageAlign;
+
+    StageAlign getStageAlignment() const;
+
+    void setScaleMode(ScaleMode sm);
+    
+    ScaleMode getScaleMode() const { return _scaleMode; }
+
     /// Action priority levels
     enum ActionPriorityLevel {
 
@@ -991,6 +1001,8 @@
     
     StageVerticalAlign _valign;
     StageHorizontalAlign _halign;
+    
+    ScaleMode _scaleMode;
 };
 
 

Index: server/asobj/Stage.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Stage.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- server/asobj/Stage.cpp      23 Apr 2008 15:31:21 -0000      1.39
+++ server/asobj/Stage.cpp      23 Apr 2008 16:35:54 -0000      1.40
@@ -22,6 +22,7 @@
 #endif
 
 #include "Stage.h"
+#include "movie_root.h"
 #include "as_object.h" // for inheritance
 #include "log.h"
 #include "fn_call.h"
@@ -108,7 +109,6 @@
 Stage::Stage()
        :
        as_object(getObjectInterface()),
-       _scaleMode(showAll),
        _alignMode(""),
        _displayState(normal)
 {
@@ -146,7 +146,7 @@
 
     movie_root& m = VM::get().getRoot();
 
-    if (_scaleMode == noScale)
+    if (m.getScaleMode() == movie_root::noScale)
     {
         return m.getWidth();    
     }
@@ -160,7 +160,7 @@
 
     movie_root& m = VM::get().getRoot();
 
-    if (_scaleMode == noScale)
+    if (m.getScaleMode() == movie_root::noScale)
     {
         return m.getHeight();    
     }
@@ -187,24 +187,19 @@
                "exactFill",
                "noBorder" };
 
-       return modeName[_scaleMode];
+    movie_root& m = VM::get().getRoot();
+
+       return modeName[m.getScaleMode()];
 }
 
 void
-Stage::setScaleMode(ScaleMode mode)
+Stage::setScaleMode(movie_root::ScaleMode mode)
 {
-       if ( _scaleMode == mode ) return; // nothing to do
+    movie_root& m = VM::get().getRoot();
 
-       _scaleMode = mode;
+       if ( m.getScaleMode() == mode ) return; // nothing to do
 
-       if ( _scaleMode == noScale )
-       {
-               VM::get().getRoot().allowRescaling(false);
-       }
-       else
-       {
-               VM::get().getRoot().allowRescaling(true);
-       }
+       m.setScaleMode(mode);
 }
 
 void
@@ -275,12 +270,12 @@
        }
        else // setter
        {
-               Stage::ScaleMode mode = Stage::showAll;
+               movie_root::ScaleMode mode = movie_root::showAll;
 
                const std::string& str = fn.arg(0).to_string();
-               if ( str == "noScale" ) mode = Stage::noScale;
-               else if ( str == "exactFill" ) mode = Stage::exactFill;
-               else if ( str == "noBorder" ) mode = Stage::noBorder;
+               if ( str == "noScale" ) mode = movie_root::noScale;
+               else if ( str == "exactFill" ) mode = movie_root::exactFill;
+               else if ( str == "noBorder" ) mode = movie_root::noBorder;
 
                stage->setScaleMode(mode);
                return as_value();

Index: server/asobj/Stage.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Stage.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/asobj/Stage.h        23 Apr 2008 15:13:50 -0000      1.17
+++ server/asobj/Stage.h        23 Apr 2008 16:35:54 -0000      1.18
@@ -20,6 +20,7 @@
 #define __GNASH_ASOBJ_STAGE_H__
 
 #include "as_object.h" // for inheritance
+#include "movie_root.h" // for access to scaleMode
 
 #include <list>
 
@@ -35,13 +36,6 @@
 
 public:
 
-       enum ScaleMode {
-               showAll,
-               noScale,
-               exactFill,
-               noBorder
-       };
-    
     enum DisplayState {
                normal,
                fullScreen
@@ -66,7 +60,7 @@
        unsigned getHeight() const;
 
        /// Set scale mode 
-       void setScaleMode(ScaleMode mode);
+       void setScaleMode(movie_root::ScaleMode mode);
 
        /// \brief
        /// Return the string representation for current
@@ -96,8 +90,6 @@
        /// Notify all listeners about a resize event
        void notifyResize();
 
-       ScaleMode _scaleMode;
-       
        std::string _alignMode;
        
        DisplayState _displayState;




reply via email to

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