~ubuntu-branches/ubuntu/saucy/gnash/saucy-proposed

« back to all changes in this revision

Viewing changes to libcore/asobj/CustomActions.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2008-10-13 14:29:49 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20081013142949-f6qdvnu4mn05ltdc
Tags: 0.8.4~~bzr9980-0ubuntu1
* new upstream release 0.8.4 (LP: #240325)
* ship new lib usr/lib/gnash/libmozsdk.so.* in mozilla-plugin-gnash
  - update debian/mozilla-plugin-gnash.install
* ship new lib usr/lib/gnash/libgnashnet.so.* in gnash-common
  - update debian/gnash-common.install
* add basic debian/build_head script to build latest CVS head packages.
  - add debian/build_head
* new sound architecture requires build depend on libsdl1.2-dev
  - update debian/control
* head build script now has been completely migrated to bzr (upstream +
  ubuntu)
  - update debian/build_head
* disable kde gui until klash/qt4 has been fixed; keep kde packages as empty
  packages for now.
  - update debian/rules
  - debian/klash.install
  - debian/klash.links
  - debian/klash.manpages
  - debian/konqueror-plugin-gnash.install
* drop libkonq5-dev build dependency accordingly
  - update debian/control
* don't install headers manually anymore. gnash doesnt provide a -dev
  package after all
  - update debian/rules
* update libs installed in gnash-common; libgnashserver-*.so is not available
  anymore (removed); in turn we add the new libgnashcore-*.so
  - update debian/gnash-common.install
* use -Os for optimization and properly pass CXXFLAGS=$(CFLAGS) to configure
  - update debian/rules
* touch firefox .autoreg in postinst of mozilla plugin
  - update debian/mozilla-plugin-gnash.postinst
* link gnash in ubufox plugins directory for the plugin alternative switcher
  - add debian/mozilla-plugin-gnash.links
* suggest ubufox accordingly
  - update debian/control
* add new required build-depends on libgif-dev
  - update debian/control
* add Xb-Npp-Description and Xb-Npp-File as new plugin database meta data
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// CustomActions.cpp:  ActionScript CustomActions class, for Gnash.
 
2
// 
 
3
//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
4
//
 
5
// This program is free software; you can redistribute it and/or modify
 
6
// it under the terms of the GNU General Public License as published by
 
7
// the Free Software Foundation; either version 3 of the License, or
 
8
// (at your option) any later version.
 
9
//
 
10
// This program is distributed in the hope that it will be useful,
 
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
// GNU General Public License for more details.
 
14
//
 
15
// You should have received a copy of the GNU General Public License
 
16
// along with this program; if not, write to the Free Software
 
17
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
//
 
19
 
 
20
#ifdef HAVE_CONFIG_H
 
21
#include "gnashconfig.h"
 
22
#endif
 
23
 
 
24
#include "CustomActions.h"
 
25
#include "as_object.h" // for inheritance
 
26
#include "log.h"
 
27
#include "fn_call.h"
 
28
#include "smart_ptr.h" // for boost intrusive_ptr
 
29
#include "builtin_function.h" // need builtin_function
 
30
#include "Object.h" // for getObjectInterface
 
31
 
 
32
namespace gnash {
 
33
 
 
34
as_value customactions_get(const fn_call& fn);
 
35
as_value customactions_install(const fn_call& fn);
 
36
as_value customactions_list(const fn_call& fn);
 
37
as_value customactions_uninstall(const fn_call& fn);
 
38
as_value customactions_ctor(const fn_call& fn);
 
39
 
 
40
static void
 
41
attachCustomActionsInterface(as_object& o)
 
42
{
 
43
        o.init_member("get", new builtin_function(customactions_get));
 
44
        o.init_member("install", new builtin_function(customactions_install));
 
45
        o.init_member("list", new builtin_function(customactions_list));
 
46
        o.init_member("uninstall", new builtin_function(customactions_uninstall));
 
47
}
 
48
 
 
49
static as_object*
 
50
getCustomActionsInterface()
 
51
{
 
52
        static boost::intrusive_ptr<as_object> o;
 
53
        if ( ! o )
 
54
        {
 
55
                o = new as_object(getObjectInterface());
 
56
                attachCustomActionsInterface(*o);
 
57
        }
 
58
        return o.get();
 
59
}
 
60
 
 
61
class customactions_as_object: public as_object
 
62
{
 
63
 
 
64
public:
 
65
 
 
66
        customactions_as_object()
 
67
                :
 
68
                as_object(getCustomActionsInterface())
 
69
        {}
 
70
 
 
71
        // override from as_object ?
 
72
        //std::string get_text_value() const { return "CustomActions"; }
 
73
 
 
74
        // override from as_object ?
 
75
        //double get_numeric_value() const { return 0; }
 
76
};
 
77
 
 
78
as_value customactions_get(const fn_call& /*fn*/) {
 
79
    log_unimpl (__FUNCTION__);
 
80
    return as_value();
 
81
}
 
82
as_value customactions_install(const fn_call& /*fn*/) {
 
83
    log_unimpl (__FUNCTION__);
 
84
    return as_value();
 
85
}
 
86
as_value customactions_list(const fn_call& /*fn*/) {
 
87
    log_unimpl (__FUNCTION__);
 
88
    return as_value();
 
89
}
 
90
as_value customactions_uninstall(const fn_call& /*fn*/) {
 
91
    log_unimpl (__FUNCTION__);
 
92
    return as_value();
 
93
}
 
94
 
 
95
as_value
 
96
customactions_ctor(const fn_call& /* fn */)
 
97
{
 
98
        boost::intrusive_ptr<as_object> obj = new customactions_as_object;
 
99
        
 
100
        return as_value(obj.get()); // will keep alive
 
101
}
 
102
 
 
103
// extern (used by Global.cpp)
 
104
void customactions_class_init(as_object& global)
 
105
{
 
106
        // This is going to be the global CustomActions "class"/"function"
 
107
        static boost::intrusive_ptr<builtin_function> cl;
 
108
 
 
109
        if ( cl == NULL )
 
110
        {
 
111
                cl=new builtin_function(&customactions_ctor, getCustomActionsInterface());
 
112
                // replicate all interface to class, to be able to access
 
113
                // all methods as static functions
 
114
                attachCustomActionsInterface(*cl);
 
115
                     
 
116
        }
 
117
 
 
118
        // Register _global.CustomActions
 
119
        global.init_member("CustomActions", cl.get());
 
120
 
 
121
}
 
122
 
 
123
 
 
124
} // end of gnash namespace
 
125