Commit c546e0f1 authored by Damien Fouilleul's avatar Damien Fouilleul

activex: remove logo when control runs in usermode and fill canvas with...

activex: remove logo when control runs in usermode and fill canvas with background color instead, which is settable as "BackColor" property (or bgcolor for web).
parent f166db42
......@@ -63,6 +63,8 @@ library AXVLC
const int VLCPlayListEnd = -666;
// DISPID definitions
const int DISPID_BackColor = -501;
const int DISPID_Visible = 100;
const int DISPID_Playing = 101;
const int DISPID_Position = 102;
......@@ -486,6 +488,11 @@ library AXVLC
[id(DISPID_Volume), propput, helpstring("Returns/sets default audio volume.")]
HRESULT Volume([in] long volume);
[id(DISPID_BackColor), propget, helpstring("Returns/sets background color.")]
HRESULT BackColor([out, retval] OLE_COLOR* backcolor);
[id(DISPID_BackColor), propput, helpstring("Returns/sets background color.")]
HRESULT BackColor([in] OLE_COLOR backcolor);
[propget, helpstring("Returns the audio object.")]
HRESULT audio([out, retval] IVLCAudio** obj);
......
No preview for this file type
/*** Autogenerated by WIDL 0.9.27 from axvlc.idl - Do not edit ***/
/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 6.00.0361 */
/* at Mon Jun 25 12:18:49 2007
*/
/* Compiler settings for axvlc.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING( )
#if !defined(_M_IA64) && !defined(_M_AMD64)
#pragma warning( disable: 4049 ) /* more than 64k source lines */
#ifdef __cplusplus
extern "C"{
#endif
#include <rpc.h>
#include <rpcndr.h>
#ifdef _MIDL_USE_GUIDDEF_
#ifndef INITGUID
#define INITGUID
#include <guiddef.h>
#ifdef __cplusplus
extern "C" {
#undef INITGUID
#else
#include <guiddef.h>
#endif
DEFINE_GUID(LIBID_AXVLC, 0xdf2bbe39, 0x40a8, 0x433b, 0xa2,0x79, 0x07,0x3f,0x48,0xda,0x94,0xb6);
DEFINE_GUID(IID_IVLCControl, 0xc2fa41d0, 0xb113, 0x476e, 0xac,0x8c, 0x9b,0xd1,0x49,0x99,0xc1,0xc1);
DEFINE_GUID(DIID_DVLCEvents, 0xdf48072f, 0x5ef8, 0x434e, 0x9b,0x40, 0xe2,0xf3,0xae,0x75,0x9b,0x5f);
DEFINE_GUID(IID_IVLCAudio, 0x9e0bd17b, 0x2d3c, 0x4656, 0xb9,0x4d, 0x03,0x08,0x4f,0x3f,0xd9,0xd4);
DEFINE_GUID(IID_IVLCInput, 0x49e0dbd1, 0x9440, 0x466c, 0x9c,0x97, 0x95,0xc6,0x71,0x90,0xc6,0x03);
DEFINE_GUID(IID_IVLCMessage, 0x9ed00afa, 0x7bcd, 0x4fff, 0x8d,0x48, 0x7d,0xd4,0xdb,0x2c,0x80,0x0d);
DEFINE_GUID(IID_IVLCMessageIterator, 0x15179cd8, 0xcc12, 0x4242, 0xa5,0x8e, 0xe4,0x12,0x21,0x7f,0xf3,0x43);
DEFINE_GUID(IID_IVLCMessages, 0x6c5ce55d, 0x2d6c, 0x4aad, 0x82,0x99, 0xc6,0x2d,0x23,0x71,0xf1,0x06);
DEFINE_GUID(IID_IVLCLog, 0x8e3bc3d9, 0x62e9, 0x48fb, 0x8a,0x6d, 0x99,0x3f,0x9a,0xbc,0x4a,0x0a);
DEFINE_GUID(IID_IVLCPlaylistItems, 0xfd37fe32, 0x82bc, 0x4a25, 0xb0,0x56, 0x31,0x5f,0x4d,0xbb,0x19,0x4d);
DEFINE_GUID(IID_IVLCPlaylist, 0x54613049, 0x40bf, 0x4035, 0x9e,0x70, 0x0a,0x93,0x12,0xc0,0x18,0x8d);
DEFINE_GUID(IID_IVLCVideo, 0x0aaedf0b, 0xd333, 0x4b27, 0xa0,0xc6, 0xbb,0xf3,0x14,0x13,0xa4,0x2e);
DEFINE_GUID(IID_IVLCControl2, 0x2d719729, 0x5333, 0x406c, 0xbf,0x12, 0x8d,0xe7,0x87,0xfd,0x65,0xe3);
DEFINE_GUID(CLSID_VLCPlugin, 0xe23fe9c6, 0x778e, 0x49d4, 0xb5,0x37, 0x38,0xfc,0xde,0x48,0x87,0xd8);
DEFINE_GUID(CLSID_VLCPlugin2, 0x9be31822, 0xfdad, 0x461b, 0xad,0x51, 0xbe,0x1d,0x1c,0x15,0x99,0x21);
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
#else // !_MIDL_USE_GUIDDEF_
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
#endif !_MIDL_USE_GUIDDEF_
MIDL_DEFINE_GUID(IID, LIBID_AXVLC,0xDF2BBE39,0x40A8,0x433b,0xA2,0x79,0x07,0x3F,0x48,0xDA,0x94,0xB6);
MIDL_DEFINE_GUID(IID, IID_IVLCControl,0xC2FA41D0,0xB113,0x476e,0xAC,0x8C,0x9B,0xD1,0x49,0x99,0xC1,0xC1);
MIDL_DEFINE_GUID(IID, IID_IVLCAudio,0x9E0BD17B,0x2D3C,0x4656,0xB9,0x4D,0x03,0x08,0x4F,0x3F,0xD9,0xD4);
MIDL_DEFINE_GUID(IID, IID_IVLCInput,0x49E0DBD1,0x9440,0x466C,0x9C,0x97,0x95,0xC6,0x71,0x90,0xC6,0x03);
MIDL_DEFINE_GUID(IID, IID_IVLCLog,0x8E3BC3D9,0x62E9,0x48FB,0x8A,0x6D,0x99,0x3F,0x9A,0xBC,0x4A,0x0A);
MIDL_DEFINE_GUID(IID, IID_IVLCMessage,0x9ED00AFA,0x7BCD,0x4FFF,0x8D,0x48,0x7D,0xD4,0xDB,0x2C,0x80,0x0D);
MIDL_DEFINE_GUID(IID, IID_IVLCMessageIterator,0x15179CD8,0xCC12,0x4242,0xA5,0x8E,0xE4,0x12,0x21,0x7F,0xF3,0x43);
MIDL_DEFINE_GUID(IID, IID_IVLCMessages,0x6C5CE55D,0x2D6C,0x4AAD,0x82,0x99,0xC6,0x2D,0x23,0x71,0xF1,0x06);
MIDL_DEFINE_GUID(IID, IID_IVLCPlaylist,0x54613049,0x40BF,0x4035,0x9E,0x70,0x0A,0x93,0x12,0xC0,0x18,0x8D);
MIDL_DEFINE_GUID(IID, IID_IVLCVideo,0x0AAEDF0B,0xD333,0x4B27,0xA0,0xC6,0xBB,0xF3,0x14,0x13,0xA4,0x2E);
MIDL_DEFINE_GUID(IID, IID_IVLCControl2,0x2D719729,0x5333,0x406C,0xBF,0x12,0x8D,0xE7,0x87,0xFD,0x65,0xE3);
MIDL_DEFINE_GUID(IID, DIID_DVLCEvents,0xDF48072F,0x5EF8,0x434e,0x9B,0x40,0xE2,0xF3,0xAE,0x75,0x9B,0x5F);
MIDL_DEFINE_GUID(IID, IID_IVLCPlaylistItems,0xFD37FE32,0x82BC,0x4A25,0xB0,0x56,0x31,0x5F,0x4D,0xBB,0x19,0x4D);
MIDL_DEFINE_GUID(CLSID, CLSID_VLCPlugin,0xE23FE9C6,0x778E,0x49D4,0xB5,0x37,0x38,0xFC,0xDE,0x48,0x87,0xD8);
MIDL_DEFINE_GUID(CLSID, CLSID_VLCPlugin2,0x9BE31822,0xFDAD,0x461B,0xAD,0x51,0xBE,0x1D,0x1C,0x15,0x99,0x21);
#undef MIDL_DEFINE_GUID
#ifdef __cplusplus
}
#endif
#endif /* !defined(_M_IA64) && !defined(_M_AMD64)*/
This diff is collapsed.
......@@ -182,6 +182,29 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr
VariantClear(&value);
}
V_VT(&value) = VT_I4;
if( S_OK == pPropBag->Read(OLESTR("backcolor"), &value, pErrorLog) )
{
_p_instance->setBackColor(V_I4(&value));
VariantClear(&value);
}
else
{
/*
** try alternative syntax
*/
V_VT(&value) = VT_BSTR;
if( S_OK == pPropBag->Read(OLESTR("bgcolor"), &value, pErrorLog) )
{
long backcolor;
if( swscanf(V_BSTR(&value), L"#%lX", &backcolor) )
{
_p_instance->setBackColor(backcolor);
}
VariantClear(&value);
}
}
return _p_instance->onLoad();
};
......@@ -238,6 +261,11 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt
pPropBag->Write(OLESTR("BaseURL"), &value);
VariantClear(&value);
V_VT(&value) = VT_I4;
V_I4(&value) = _p_instance->getBackColor();
pPropBag->Write(OLESTR("BackColor"), &value);
VariantClear(&value);
if( fClearDirty )
_p_instance->setDirty(FALSE);
......
......@@ -351,6 +351,7 @@ HRESULT VLCPlugin::onInit(void)
_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;
......@@ -559,6 +560,12 @@ HRESULT VLCPlugin::onAmbientChanged(LPUNKNOWN pContainer, DISPID dispID)
switch( dispID )
{
case DISPID_AMBIENT_BACKCOLOR:
VariantInit(&v);
V_VT(&v) = VT_I4;
if( SUCCEEDED(GetObjectProperty(pContainer, dispID, v)) )
{
setBackColor(V_I4(&v));
}
break;
case DISPID_AMBIENT_DISPLAYNAME:
break;
......@@ -782,6 +789,19 @@ void VLCPlugin::setVolume(int volume)
}
};
void VLCPlugin::setBackColor(OLE_COLOR backcolor)
{
if( _i_backcolor != backcolor )
{
_i_backcolor = backcolor;
if( isInPlaceActive() )
{
}
setDirty(TRUE);
}
};
void VLCPlugin::setTime(int seconds)
{
if( seconds < 0 )
......@@ -822,57 +842,80 @@ void VLCPlugin::onDraw(DVTARGETDEVICE * ptd, HDC hicTargetDev,
long height = lprcBounds->bottom-lprcBounds->top;
RECT bounds = { lprcBounds->left, lprcBounds->top, lprcBounds->right, lprcBounds->bottom };
FillRect(hdcDraw, &bounds, (HBRUSH)GetStockObject(WHITE_BRUSH));
LPPICTURE pict = getPicture();
if( NULL != pict )
if( isUserMode() )
{
OLE_XSIZE_HIMETRIC picWidth;
OLE_YSIZE_HIMETRIC picHeight;
pict->get_Width(&picWidth);
pict->get_Height(&picHeight);
SIZEL picSize = { picWidth, picHeight };
if( NULL != hicTargetDev )
/* VLC is in user mode, just draw background color */
COLORREF colorref = RGB(0, 0, 0);
OleTranslateColor(_i_backcolor, (HPALETTE)GetStockObject(DEFAULT_PALETTE), &colorref);
if( colorref != RGB(0, 0, 0) )
{
DPFromHimetric(hicTargetDev, (LPPOINT)&picSize, 1);
/* custom background */
HBRUSH colorbrush = CreateSolidBrush(colorref);
FillRect(hdcDraw, &bounds, colorbrush);
DeleteObject((HANDLE)colorbrush);
}
else if( NULL != (hicTargetDev = CreateDevDC(ptd)) )
else
{
DPFromHimetric(hicTargetDev, (LPPOINT)&picSize, 1);
DeleteDC(hicTargetDev);
/* black background */
FillRect(hdcDraw, &bounds, (HBRUSH)GetStockObject(BLACK_BRUSH));
}
}
else
{
/* VLC is in design mode, draw the VLC logo */
FillRect(hdcDraw, &bounds, (HBRUSH)GetStockObject(WHITE_BRUSH));
if( picSize.cx > width-4 )
picSize.cx = width-4;
if( picSize.cy > height-4 )
picSize.cy = height-4;
LPPICTURE pict = getPicture();
if( NULL != pict )
{
OLE_XSIZE_HIMETRIC picWidth;
OLE_YSIZE_HIMETRIC picHeight;
LONG dstX = lprcBounds->left+(width-picSize.cx)/2;
LONG dstY = lprcBounds->top+(height-picSize.cy)/2;
pict->get_Width(&picWidth);
pict->get_Height(&picHeight);
if( NULL != lprcWBounds )
{
RECT wBounds = { lprcWBounds->left, lprcWBounds->top, lprcWBounds->right, lprcWBounds->bottom };
pict->Render(hdcDraw, dstX, dstY, picSize.cx, picSize.cy,
0L, picHeight, picWidth, -picHeight, &wBounds);
}
else
pict->Render(hdcDraw, dstX, dstY, picSize.cx, picSize.cy,
0L, picHeight, picWidth, -picHeight, NULL);
SIZEL picSize = { picWidth, picHeight };
pict->Release();
}
if( NULL != hicTargetDev )
{
DPFromHimetric(hicTargetDev, (LPPOINT)&picSize, 1);
}
else if( NULL != (hicTargetDev = CreateDevDC(ptd)) )
{
DPFromHimetric(hicTargetDev, (LPPOINT)&picSize, 1);
DeleteDC(hicTargetDev);
}
if( picSize.cx > width-4 )
picSize.cx = width-4;
if( picSize.cy > height-4 )
picSize.cy = height-4;
LONG dstX = lprcBounds->left+(width-picSize.cx)/2;
LONG dstY = lprcBounds->top+(height-picSize.cy)/2;
SelectObject(hdcDraw, GetStockObject(BLACK_BRUSH));
if( NULL != lprcWBounds )
{
RECT wBounds = { lprcWBounds->left, lprcWBounds->top, lprcWBounds->right, lprcWBounds->bottom };
pict->Render(hdcDraw, dstX, dstY, picSize.cx, picSize.cy,
0L, picHeight, picWidth, -picHeight, &wBounds);
}
else
pict->Render(hdcDraw, dstX, dstY, picSize.cx, picSize.cy,
0L, picHeight, picWidth, -picHeight, NULL);
MoveToEx(hdcDraw, bounds.left, bounds.top, NULL);
LineTo(hdcDraw, bounds.left+width-1, bounds.top);
LineTo(hdcDraw, bounds.left+width-1, bounds.top+height-1);
LineTo(hdcDraw, bounds.left, bounds.top+height-1);
LineTo(hdcDraw, bounds.left, bounds.top);
pict->Release();
}
SelectObject(hdcDraw, GetStockObject(BLACK_BRUSH));
MoveToEx(hdcDraw, bounds.left, bounds.top, NULL);
LineTo(hdcDraw, bounds.left+width-1, bounds.top);
LineTo(hdcDraw, bounds.left+width-1, bounds.top+height-1);
LineTo(hdcDraw, bounds.left, bounds.top+height-1);
LineTo(hdcDraw, bounds.left, bounds.top);
}
}
};
......@@ -880,8 +923,7 @@ void VLCPlugin::onPaint(HDC hdc, const RECT &bounds, const RECT &clipRect)
{
if( isVisible() )
{
/** if VLC is playing, it may not display any VIDEO content
** hence, draw control logo*/
/* if VLC is in design mode, draw control logo */
HDC hdcDraw = CreateCompatibleDC(hdc);
if( NULL != hdcDraw )
{
......
......@@ -114,6 +114,9 @@ public:
void setVolume(int volume);
int getVolume(void) { return _i_volume; };
void setBackColor(OLE_COLOR backcolor);
OLE_COLOR getBackColor(void) { return _i_backcolor; };
void setVisible(BOOL fVisible);
BOOL getVisible(void) { return _b_visible; };
BOOL isVisible(void) { return _b_visible || (! _b_usermode); };
......@@ -251,6 +254,7 @@ private:
UINT _i_codepage;
BOOL _b_usermode;
RECT _posRect;
LPPICTURE _p_pict;
// persistable properties
BSTR _bstr_baseurl;
......@@ -262,7 +266,7 @@ private:
int _i_volume;
int _i_time;
SIZEL _extent;
LPPICTURE _p_pict;
OLE_COLOR _i_backcolor;
// indicates whether properties needs persisting
BOOL _b_dirty;
};
......
......@@ -2715,6 +2715,21 @@ STDMETHODIMP VLCControl2::put_Volume(long volume)
return NOERROR;
};
STDMETHODIMP VLCControl2::get_BackColor(OLE_COLOR *backcolor)
{
if( NULL == backcolor )
return E_POINTER;
*backcolor = _p_instance->getBackColor();
return NOERROR;
};
STDMETHODIMP VLCControl2::put_BackColor(OLE_COLOR backcolor)
{
_p_instance->setBackColor(backcolor);
return NOERROR;
};
STDMETHODIMP VLCControl2::get_audio(IVLCAudio** obj)
{
if( NULL == obj )
......
......@@ -586,6 +586,8 @@ public:
STDMETHODIMP put_Visible(VARIANT_BOOL visible);
STDMETHODIMP get_Volume(long *volume);
STDMETHODIMP put_Volume(long volume);
STDMETHODIMP get_BackColor(OLE_COLOR *backcolor);
STDMETHODIMP put_BackColor(OLE_COLOR backcolor);
STDMETHODIMP get_audio(IVLCAudio**);
STDMETHODIMP get_input(IVLCInput**);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment