[Mplayerplug-in-cvs] mplayerplug-in/Source nsIScriptableMplayerPlugin.h, 1.20, 1.21 nsIScriptableM
Brought to you by:
kdekorte
From: Kevin D. <kde...@us...> - 2007-08-06 19:30:31
|
Update of /cvsroot/mplayerplug-in/mplayerplug-in/Source In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7180/Source Modified Files: nsIScriptableMplayerPlugin.h nsIScriptableMplayerPlugin.idl nsIScriptableMplayerPlugin.xpt nsScriptablePeer.cpp plugin.cpp plugin.h Log Message: Add the ability to set the onClick callback via a javascript method Index: nsIScriptableMplayerPlugin.h =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/nsIScriptableMplayerPlugin.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** nsIScriptableMplayerPlugin.h 2 Nov 2006 20:54:19 -0000 1.20 --- nsIScriptableMplayerPlugin.h 6 Aug 2007 19:30:23 -0000 1.21 *************** *** 241,244 **** --- 241,247 ---- NS_IMETHOD GetControls(nsIScriptableWMPPlugin * *aControls) = 0; + /* void onClick (in string event); */ + NS_IMETHOD OnClick(const char *event) = 0; + }; *************** *** 286,290 **** NS_IMETHOD SetShowlogo(PRBool aShowlogo); \ NS_IMETHOD GetPlayState(PRInt32 *aPlayState); \ ! NS_IMETHOD GetControls(nsIScriptableWMPPlugin * *aControls); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ --- 289,294 ---- NS_IMETHOD SetShowlogo(PRBool aShowlogo); \ NS_IMETHOD GetPlayState(PRInt32 *aPlayState); \ ! NS_IMETHOD GetControls(nsIScriptableWMPPlugin * *aControls); \ ! NS_IMETHOD OnClick(const char *event); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ *************** *** 331,335 **** NS_IMETHOD SetShowlogo(PRBool aShowlogo) { return _to SetShowlogo(aShowlogo); } \ NS_IMETHOD GetPlayState(PRInt32 *aPlayState) { return _to GetPlayState(aPlayState); } \ ! NS_IMETHOD GetControls(nsIScriptableWMPPlugin * *aControls) { return _to GetControls(aControls); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ --- 335,340 ---- NS_IMETHOD SetShowlogo(PRBool aShowlogo) { return _to SetShowlogo(aShowlogo); } \ NS_IMETHOD GetPlayState(PRInt32 *aPlayState) { return _to GetPlayState(aPlayState); } \ ! NS_IMETHOD GetControls(nsIScriptableWMPPlugin * *aControls) { return _to GetControls(aControls); } \ ! NS_IMETHOD OnClick(const char *event) { return _to OnClick(event); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ *************** *** 376,380 **** NS_IMETHOD SetShowlogo(PRBool aShowlogo) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetShowlogo(aShowlogo); } \ NS_IMETHOD GetPlayState(PRInt32 *aPlayState) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPlayState(aPlayState); } \ ! NS_IMETHOD GetControls(nsIScriptableWMPPlugin * *aControls) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetControls(aControls); } #if 0 --- 381,386 ---- NS_IMETHOD SetShowlogo(PRBool aShowlogo) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetShowlogo(aShowlogo); } \ NS_IMETHOD GetPlayState(PRInt32 *aPlayState) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPlayState(aPlayState); } \ ! NS_IMETHOD GetControls(nsIScriptableWMPPlugin * *aControls) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetControls(aControls); } \ ! NS_IMETHOD OnClick(const char *event) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnClick(event); } #if 0 *************** *** 654,657 **** --- 660,669 ---- } + /* void onClick (in string event); */ + NS_IMETHODIMP nsScriptableMplayerPlugin::OnClick(const char *event) + { + return NS_ERROR_NOT_IMPLEMENTED; + } + /* End of implementation class template. */ #endif Index: plugin.h =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin.h,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** plugin.h 7 Jun 2007 13:34:39 -0000 1.111 --- plugin.h 6 Aug 2007 19:30:24 -0000 1.112 *************** *** 116,119 **** --- 116,120 ---- void PlaylistAppend(const char *item); void PlaylistClear(PRBool *_retval); + void SetOnClick(const char *event); Index: nsIScriptableMplayerPlugin.idl =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/nsIScriptableMplayerPlugin.idl,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** nsIScriptableMplayerPlugin.idl 2 Nov 2006 20:54:19 -0000 1.18 --- nsIScriptableMplayerPlugin.idl 6 Aug 2007 19:30:23 -0000 1.19 *************** *** 49,51 **** --- 49,52 ---- readonly attribute long playState; readonly attribute nsIScriptableWMPPlugin controls; + void onClick(in string event); }; Index: plugin.cpp =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin.cpp,v retrieving revision 1.342 retrieving revision 1.343 diff -C2 -d -r1.342 -r1.343 *** plugin.cpp 6 Aug 2007 14:04:07 -0000 1.342 --- plugin.cpp 6 Aug 2007 19:30:24 -0000 1.343 *************** *** 3228,3231 **** --- 3228,3245 ---- } + void nsPluginInstance::SetOnClick(const char *event) + { + if(mouseClickCallback != NULL) { + NPN_MemFree(mouseClickCallback); + } + mouseClickCallback = (char *)NPN_MemAlloc(strlen(event) + + 12); + if (strncasecmp(event, "javascript:", 11) == 0) { + snprintf(mouseClickCallback, strlen(event),"%s", event); + } else { + snprintf(mouseClickCallback, strlen(event)+12,"javascript:%s", event); + } + } + // ============================== // ! Scriptability related code ! Index: nsIScriptableMplayerPlugin.xpt =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/nsIScriptableMplayerPlugin.xpt,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 Binary files /tmp/cvsv8cNn9 and /tmp/cvs1DkBMw differ Index: nsScriptablePeer.cpp =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/nsScriptablePeer.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** nsScriptablePeer.cpp 23 Dec 2006 15:37:36 -0000 1.29 --- nsScriptablePeer.cpp 6 Aug 2007 19:30:24 -0000 1.30 *************** *** 436,439 **** --- 436,445 ---- } + NS_IMETHODIMP nsScriptablePeer::OnClick(const char *event) + { + mPlugin->SetOnClick(event); + return NS_OK; + } + NS_IMETHODIMP nsScriptablePeer::GetControls(nsIScriptableWMPPlugin * |