From 04e7bd8471c3470615f8a42fbe9d51aa857b1073 Mon Sep 17 00:00:00 2001 From: Jean-Paul Saman Date: Fri, 11 Apr 2008 16:56:37 +0200 Subject: [PATCH] Files belonging to patch from, thannoy: Allow future control toolbar to be hidden (default) or shown. --- projects/activex/README.TXT | 63 +++++++++++++++++++---------- projects/activex/persistpropbag.cpp | 12 ++++++ projects/activex/plugin.cpp | 17 ++++---- projects/activex/plugin.h | 8 ++++ projects/activex/vlccontrol2.cpp | 32 +++++++++++++++ projects/activex/vlccontrol2.h | 2 + 6 files changed, 105 insertions(+), 29 deletions(-) diff --git a/projects/activex/README.TXT b/projects/activex/README.TXT index 8783c8f90f..aa339ca025 100644 --- a/projects/activex/README.TXT +++ b/projects/activex/README.TXT @@ -28,8 +28,14 @@ export PATH=$PATH:"/cygdrive/c/Program Files/Microsoft Visual Studio/COMMON/MSDe export INCLUDE='C:\Program Files\Microsoft Visual Studio\VC98\Include' export MIDL="midl" -if you are cross-compiling on Linux, you may be able to use 'widl' which is part of -the WINE project (http://www.winehq.com), however I have not tested it. +If you are cross-compiling on Linux, you can use 'widl' which is part of +the WINE project (http://www.winehq.com). At leat wine-dev-0.9.57 works, +the comand line to compile IDL should looks like the following : + +widl -I/usr/include/wine/windows/ \ + -h -H axvlc_idl.h -t -T axvlc.tlb -u -U axvlc_idl.c \ + axvlc.idl +NOTE: widl breaks compatibility with Visual Basic. If that is important to you then use midl. II. Debugging @@ -64,7 +70,7 @@ by using the REGSVR32 command, as per following example: REGSVR32 C:\WINDOWS\AXVLC.DLL -if the control needs to use external VLC plugins (i.e other than built-in ones), +If the control needs to use external VLC plugins (i.e other than built-in ones), make sure that the plugin path is set in the registry as per following example: [HKEY_LOCAL_MACHINE\Software\VideoLAN\VLC] @@ -95,23 +101,25 @@ V. Controlling the plugin 1) Properties the following public properties can be used to control the plugin from HTML, -the property panel of Visual Basic and most ActiveX aware applications - -+==========+=========+================================+===============+ -| Name: | Type: | Description: | Alias: | -+==========+=========+================================+===============+ -| autoplay | boolean | play when control is activated | autostart | -+----------+---------+--------------------------------+---------------+ -| autoloop | boolean | loop the playlist | loop | -+----------+---------+--------------------------------+---------------+ -| mrl | string | initial MRL in playlist | src, filename | -+----------+---------+--------------------------------+---------------+ -| mute | boolean | mute audio volume | | -+----------+---------+--------------------------------+---------------+ -| visible | boolean | show/hide control viewport | showdisplay | -+----------+---------+--------------------------------+---------------+ -| volume | integer | set/get audio volume | | -+----------+---------+--------------------------------+---------------+ +the property panel of Visual Basic and most ActiveX aware applications. + ++==========+=========+===================================+===============+ +| Name: | Type: | Description: | Alias: | ++==========+=========+===================================+===============+ +| autoplay | boolean | play when control is activated | autostart | ++----------+---------+-----------------------------------+---------------+ +| autoloop | boolean | loop the playlist | loop | ++----------+---------+-----------------------------------+---------------+ +| mrl | string | initial MRL in playlist | src, filename | ++----------+---------+-----------------------------------+---------------+ +| mute | boolean | mute audio volume | | ++----------+---------+-----------------------------------+---------------+ +| visible | boolean | show/hide control viewport | showdisplay | ++----------+---------+-----------------------------------+---------------+ +| volume | integer | set/get audio volume | | ++----------+---------+-----------------------------------+---------------+ +| toolbar | boolean | set/get visibility of the toolbar | | ++----------+---------+-----------------------------------+---------------+ the alias column allows to specify an alternative for the property in internet explorer, which is useful to maintain compatibility @@ -149,12 +157,25 @@ Variables: Methods: + *** current interface (0.8.6+) *** +UUID : 9BE31822-FDAD-461B-AD51-BE1D1C159921 +defined in axvlc.idl as "coclass VLCPlugin2", "interface IVLCControl2" + +This interface organize API with several object (like .audio.mute) +It is currently documented on videolan wiki (may change) at +http://wiki.videolan.org/Documentation:Play_HowTo/Advanced_Use_of_VLC + + + *** old interface (deprecated) *** +UUID : E23FE9C6-778E-49D4-B537-38FCDE4887D8 +defined in axvlc.idl as "coclass VLCPlugin", "interface IVLCControl" + play() Play current item the playlist pause() Pause current item in the playlist - + stop() Stop playing current item in playlist diff --git a/projects/activex/persistpropbag.cpp b/projects/activex/persistpropbag.cpp index b53c5113fc..85a31be23a 100644 --- a/projects/activex/persistpropbag.cpp +++ b/projects/activex/persistpropbag.cpp @@ -101,6 +101,13 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr } } + V_VT(&value) = VT_BOOL; + if( S_OK == pPropBag->Read(OLESTR("toolbar"), &value, pErrorLog) ) + { + _p_instance->setShowToolbar(V_BOOL(&value) != VARIANT_FALSE); + VariantClear(&value); + } + SIZEL size = _p_instance->getExtent(); V_VT(&value) = VT_I4; if( S_OK == pPropBag->Read(OLESTR("extentwidth"), &value, pErrorLog) ) @@ -227,6 +234,11 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt pPropBag->Write(OLESTR("AutoPlay"), &value); VariantClear(&value); + V_VT(&value) = VT_BOOL; + V_BOOL(&value) = _p_instance->getShowToolbar()? VARIANT_TRUE : VARIANT_FALSE; + pPropBag->Write(OLESTR("Toolbar"), &value); + VariantClear(&value); + SIZEL size = _p_instance->getExtent(); V_VT(&value) = VT_I4; V_I4(&value) = size.cx; diff --git a/projects/activex/plugin.cpp b/projects/activex/plugin.cpp index 1f0e942636..5aa6400e4c 100644 --- a/projects/activex/plugin.cpp +++ b/projects/activex/plugin.cpp @@ -349,15 +349,16 @@ HRESULT VLCPlugin::onInit(void) if( NULL == _p_libvlc ) { // initialize persistable properties - _b_autoplay = TRUE; - _b_autoloop = FALSE; + _b_autoplay = TRUE; + _b_autoloop = FALSE; + _b_toolbar = FALSE; _bstr_baseurl = NULL; - _bstr_mrl = NULL; - _b_visible = TRUE; - _b_mute = FALSE; - _i_volume = 50; - _i_time = 0; - _i_backcolor = 0; + _bstr_mrl = NULL; + _b_visible = TRUE; + _b_mute = FALSE; + _i_volume = 50; + _i_time = 0; + _i_backcolor = 0; // set default/preferred size (320x240) pixels in HIMETRIC HDC hDC = CreateDevDC(NULL); _extent.cx = 320; diff --git a/projects/activex/plugin.h b/projects/activex/plugin.h index c2612e4879..ebf1702986 100644 --- a/projects/activex/plugin.h +++ b/projects/activex/plugin.h @@ -111,6 +111,13 @@ public: }; inline BOOL getAutoLoop(void) { return _b_autoloop;}; + inline void setShowToolbar(BOOL showtoolbar) + { + _b_toolbar = showtoolbar; + setDirty(TRUE); + }; + inline BOOL getShowToolbar(void) { return _b_toolbar;}; + void setVolume(int volume); int getVolume(void) { return _i_volume; }; @@ -261,6 +268,7 @@ private: BSTR _bstr_mrl; BOOL _b_autoplay; BOOL _b_autoloop; + BOOL _b_toolbar; BOOL _b_visible; BOOL _b_mute; int _i_volume; diff --git a/projects/activex/vlccontrol2.cpp b/projects/activex/vlccontrol2.cpp index 21acf54471..26548c0ac0 100644 --- a/projects/activex/vlccontrol2.cpp +++ b/projects/activex/vlccontrol2.cpp @@ -2728,6 +2728,38 @@ STDMETHODIMP VLCControl2::put_MRL(BSTR mrl) return S_OK; }; + +STDMETHODIMP VLCControl2::get_Toolbar(VARIANT_BOOL *visible) +{ + if( NULL == visible ) + return E_POINTER; + + /* + * Note to developpers + * + * Returning the _b_toolbar is closer to the method specification. + * But returning True when toolbar is not implemented so not displayed + * could be bad for ActiveX users which rely on this value to show their + * own toolbar if not provided by the ActiveX. + * + * This is the reason why FALSE is returned, until toolbar get implemented. + */ + + /* DISABLED for now */ + // *visible = _p_instance->getShowToolbar() ? VARIANT_TRUE: VARIANT_FALSE; + + *visible = VARIANT_FALSE; + + return S_OK; +}; + +STDMETHODIMP VLCControl2::put_Toolbar(VARIANT_BOOL visible) +{ + _p_instance->setShowToolbar((VARIANT_FALSE != visible) ? TRUE: FALSE); + return S_OK; +}; + + STDMETHODIMP VLCControl2::get_StartTime(long *seconds) { if( NULL == seconds ) diff --git a/projects/activex/vlccontrol2.h b/projects/activex/vlccontrol2.h index 1e73729be0..7596676d0a 100644 --- a/projects/activex/vlccontrol2.h +++ b/projects/activex/vlccontrol2.h @@ -582,6 +582,8 @@ public: STDMETHODIMP put_BaseURL(BSTR url); STDMETHODIMP get_MRL(BSTR *mrl); STDMETHODIMP put_MRL(BSTR mrl); + STDMETHODIMP get_Toolbar(VARIANT_BOOL *visible); + STDMETHODIMP put_Toolbar(VARIANT_BOOL visible); STDMETHODIMP get_StartTime(long *seconds); STDMETHODIMP put_StartTime(long seconds); STDMETHODIMP get_VersionInfo(BSTR *version); -- 2.39.2