Changeset da4dc63b33a3cbffa38513107882a05f2043d17c
- Timestamp:
- 27/06/05 13:41:16 (3 years ago)
- git-parent:
- Files:
-
- activex/Makefile.am (modified) (1 diff)
- activex/axvlc_rc.rc (modified) (1 diff)
- activex/main.cpp (modified) (1 diff)
- activex/oleobject.cpp (modified) (6 diffs)
- activex/persistpropbag.cpp (modified) (2 diffs)
- activex/persiststorage.cpp (modified) (2 diffs)
- activex/persiststreaminit.cpp (modified) (2 diffs)
- activex/plugin.cpp (modified) (8 diffs)
- activex/plugin.h (modified) (3 diffs)
- activex/utils.h (modified) (1 diff)
- activex/viewobject.cpp (modified) (2 diffs)
- activex/vlc16x16.bmp (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
activex/Makefile.am
rb9057a6 rda4dc63 53 53 axvlc.tlb \ 54 54 inplace.bmp \ 55 vlc16x16.bmp \ 55 56 test.html \ 56 57 $(NULL) activex/axvlc_rc.rc
rec19e63 rda4dc63 9 9 #define UGLY_KLUDGE( z ) #z 10 10 11 1 BITMAP "vlc16x16.bmp" 11 12 1 VERSIONINFO 12 13 FILETYPE 1 activex/main.cpp
r83974ce rda4dc63 187 187 RegCloseKey(hSubKey); 188 188 189 // ToolboxBitmap32 key value 190 hSubKey = keyCreate(hClassKey, TEXT("ToolboxBitmap32")); 191 strcpy(DllPath+DllPathLen, ",1"); 192 RegSetValueEx(hSubKey, NULL, 0, REG_SZ, 193 (const BYTE*)DllPath, DllPathLen+2); 194 DllPath[DllPathLen] = '\0'; 195 RegCloseKey(hSubKey); 196 189 197 #ifdef BUILD_LOCALSERVER 190 198 // LocalServer32 key value activex/oleobject.cpp
r1b75d79 rda4dc63 57 57 LONG lIndex, HWND hwndParent, LPCRECT lprcPosRect) 58 58 { 59 if( 0 != lIndex )60 return DV_E_LINDEX;61 62 59 switch( iVerb ) 63 60 { … … 105 102 { 106 103 if( S_OK != p_inPlaceSite->CanInPlaceActivate() ) 104 { 107 105 return OLEOBJ_S_CANNOT_DOVERB_NOW; 106 } 108 107 109 108 LPOLEINPLACEFRAME p_inPlaceFrame; … … 129 128 } 130 129 else if( NULL == hwndParent ) 130 { 131 131 return OLEOBJ_S_INVALIDHWND; 132 } 132 133 133 134 if( FAILED(_p_instance->onActivateInPlace(lpMsg, hwndParent, lprcPosRect, lprcClipRect)) ) … … 294 295 STDMETHODIMP VLCOleObject::SetClientSite(LPOLECLIENTSITE pClientSite) 295 296 { 296 if( NULL != _p_clientsite )297 _p_clientsite->Release();298 297 299 298 if( NULL != pClientSite ) … … 313 312 } 314 313 } 314 315 if( NULL != _p_clientsite ) 316 _p_clientsite->Release(); 317 315 318 _p_clientsite = pClientSite; 316 319 _p_instance->onClientSiteChanged(pClientSite); 320 317 321 return S_OK; 318 322 }; … … 338 342 if( SUCCEEDED(_p_clientsite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) ) 339 343 { 340 LPOLECONTROLSITE p_controlSite; 341 RECT posRect = _p_instance->getPosRect(); 342 343 if( SUCCEEDED(_p_clientsite->QueryInterface(IID_IOleControlSite, (void**)&p_controlSite)) ) 344 HWND hwnd; 345 346 if( SUCCEEDED(p_inPlaceSite->GetWindow(&hwnd)) ) 344 347 { 345 // use HIMETRIC to container transform 346 POINTL extent = { pSizel->cx, pSizel->cy }; 347 POINTF container; 348 if( SUCCEEDED(p_controlSite->TransformCoords(&extent, 349 &container, XFORMCOORDS_SIZE|XFORMCOORDS_HIMETRICTOCONTAINER)) ) 350 { 351 posRect.right = ((LONG)container.x)+posRect.left; 352 posRect.bottom = ((LONG)container.y)+posRect.top; 353 } 354 p_controlSite->Release(); 355 } 356 else { 357 // use HIMETRIC to display transform 358 HDC hDC = CreateDevDC(NULL); 348 // use HIMETRIC to pixel transform 349 RECT posRect = _p_instance->getPosRect(); 350 HDC hDC = GetDC(hwnd); 359 351 posRect.right = (pSizel->cx*GetDeviceCaps(hDC, LOGPIXELSX)/2540L)+posRect.left; 360 352 posRect.bottom = (pSizel->cy*GetDeviceCaps(hDC, LOGPIXELSY)/2540L)+posRect.top; 361 353 DeleteDC(hDC); 354 p_inPlaceSite->OnPosRectChange(&posRect); 362 355 } 363 p_inPlaceSite->OnPosRectChange(&posRect);364 356 p_inPlaceSite->Release(); 365 357 } activex/persistpropbag.cpp
r1b75d79 rda4dc63 41 41 STDMETHODIMP VLCPersistPropertyBag::InitNew(void) 42 42 { 43 return _p_instance->onInit( TRUE);43 return _p_instance->onInit(); 44 44 }; 45 45 … … 49 49 return E_POINTER; 50 50 51 HRESULT hr = _p_instance->onInit( FALSE);51 HRESULT hr = _p_instance->onInit(); 52 52 if( FAILED(hr) ) 53 53 return hr; activex/persiststorage.cpp
r1591dec rda4dc63 46 46 return E_POINTER; 47 47 48 return _p_instance->onInit( TRUE);48 return _p_instance->onInit(); 49 49 }; 50 50 … … 54 54 return E_POINTER; 55 55 56 return _p_instance->onInit( TRUE);56 return _p_instance->onInit(); 57 57 }; 58 58 activex/persiststreaminit.cpp
r1591dec rda4dc63 38 38 STDMETHODIMP VLCPersistStreamInit::InitNew(void) 39 39 { 40 return _p_instance->onInit( TRUE);40 return _p_instance->onInit(); 41 41 }; 42 42 … … 46 46 return E_POINTER; 47 47 48 return _p_instance->onInit( TRUE);48 return _p_instance->onInit(); 49 49 }; 50 50 activex/plugin.cpp
rfd5297c rda4dc63 35 35 #include "vlccontrol.h" 36 36 #include "viewobject.h" 37 #include "dataobject.h" 37 38 38 39 #include "utils.h" … … 511 512 }; 512 513 513 HRESULT VLCPlugin::onInit( BOOL isNew)514 HRESULT VLCPlugin::onInit(void) 514 515 { 515 516 if( 0 == _i_vlc ) … … 550 551 return E_FAIL; 551 552 } 552 553 if( isNew )554 {555 /*556 ** object has fully initialized,557 ** try to activate in place if container is ready558 */559 LPOLECLIENTSITE pActiveSite;560 561 if( SUCCEEDED(vlcOleObject->GetClientSite(&pActiveSite)) && (NULL != pActiveSite) )562 {563 vlcOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, pActiveSite, 0, NULL, NULL);564 pActiveSite->Release();565 }566 }567 553 return S_OK; 568 554 } … … 572 558 HRESULT VLCPlugin::onLoad(void) 573 559 { 574 /* 575 ** object has fully initialized, 576 ** try to activate in place if container is ready 577 */ 578 LPOLECLIENTSITE pActiveSite; 579 580 if( SUCCEEDED(vlcOleObject->GetClientSite(&pActiveSite)) && (NULL != pActiveSite) ) 581 { 582 vlcOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, pActiveSite, 0, NULL, NULL); 583 pActiveSite->Release(); 560 if( _b_mute ) 561 VLC_VolumeMute(_i_vlc); 562 563 if( NULL != _psz_src ) 564 { 565 // add default target to playlist 566 char *cOptions[1]; 567 int cOptionsCount = 0; 568 569 if( _b_loopmode ) 570 { 571 cOptions[cOptionsCount++] = "loop"; 572 } 573 VLC_AddTarget(_i_vlc, _psz_src, (const char **)&cOptions, cOptionsCount, PLAYLIST_APPEND, PLAYLIST_END); 584 574 } 585 575 return S_OK; … … 695 685 VLC_VariableSet(_i_vlc, "drawable", val); 696 686 697 if( NULL != _psz_src ) 698 { 699 // add target to playlist 700 char *cOptions[1]; 701 int cOptionsCount = 0; 702 703 if( _b_loopmode ) 704 { 705 cOptions[cOptionsCount++] = "loop"; 706 } 707 VLC_AddTarget(_i_vlc, _psz_src, (const char **)&cOptions, cOptionsCount, PLAYLIST_APPEND, PLAYLIST_END); 708 709 if( _b_autostart ) 710 { 711 VLC_Play(_i_vlc); 712 fireOnPlayEvent(); 713 } 687 if( _b_autostart & (VLC_PlaylistNumberOfItems(_i_vlc) > 0) ) 688 { 689 VLC_Play(_i_vlc); 690 fireOnPlayEvent(); 714 691 } 715 692 return S_OK; … … 750 727 void VLCPlugin::onPaint(HDC hdc, const RECT &bounds, const RECT &pr) 751 728 { 752 /* 753 ** if VLC is playing, it may not display any VIDEO content 754 ** hence, draw control logo 755 */ 756 int width = bounds.right-bounds.left; 757 int height = bounds.bottom-bounds.top; 758 759 HBITMAP pict = _p_class->getInPlacePict(); 760 if( NULL != pict ) 761 { 762 HDC hdcPict = CreateCompatibleDC(hdc); 763 if( NULL != hdcPict ) 764 { 765 BITMAP bm; 766 if( GetObject(pict, sizeof(BITMAPINFO), &bm) ) 729 if( getVisible() ) 730 { 731 /* 732 ** if VLC is playing, it may not display any VIDEO content 733 ** hence, draw control logo 734 */ 735 int width = bounds.right-bounds.left; 736 int height = bounds.bottom-bounds.top; 737 738 HBITMAP pict = _p_class->getInPlacePict(); 739 if( NULL != pict ) 740 { 741 HDC hdcPict = CreateCompatibleDC(hdc); 742 if( NULL != hdcPict ) 767 743 { 768 int dstWidth = bm.bmWidth; 769 if( dstWidth > width-4 ) 770 dstWidth = width-4; 771 772 int dstHeight = bm.bmHeight; 773 if( dstHeight > height-4 ) 774 dstHeight = height-4; 775 776 int dstX = bounds.left+(width-dstWidth)/2; 777 int dstY = bounds.top+(height-dstHeight)/2; 778 779 SelectObject(hdcPict, pict); 780 StretchBlt(hdc, dstX, dstY, dstWidth, dstHeight, 781 hdcPict, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); 782 DeleteDC(hdcPict); 783 ExcludeClipRect(hdc, dstX, dstY, dstWidth+dstX, dstHeight+dstY); 744 BITMAP bm; 745 if( GetObject(pict, sizeof(BITMAPINFO), &bm) ) 746 { 747 int dstWidth = bm.bmWidth; 748 if( dstWidth > width-4 ) 749 dstWidth = width-4; 750 751 int dstHeight = bm.bmHeight; 752 if( dstHeight > height-4 ) 753 dstHeight = height-4; 754 755 int dstX = bounds.left+(width-dstWidth)/2; 756 int dstY = bounds.top+(height-dstHeight)/2; 757 758 SelectObject(hdcPict, pict); 759 StretchBlt(hdc, dstX, dstY, dstWidth, dstHeight, 760 hdcPict, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); 761 DeleteDC(hdcPict); 762 ExcludeClipRect(hdc, dstX, dstY, dstWidth+dstX, dstHeight+dstY); 763 } 784 764 } 785 765 } 786 } 787 788 FillRect(hdc, &pr, (HBRUSH)GetStockObject(WHITE_BRUSH));789 SelectObject(hdc, GetStockObject(BLACK_BRUSH)); 790 791 MoveToEx(hdc, bounds.left, bounds.top, NULL);792 LineTo(hdc, bounds.left+width-1, bounds.top);793 LineTo(hdc, bounds.left+width-1, bounds.top+height-1);794 LineTo(hdc, bounds.left, bounds.top+height-1);795 LineTo(hdc, bounds.left, bounds.top);766 767 FillRect(hdc, &pr, (HBRUSH)GetStockObject(WHITE_BRUSH)); 768 SelectObject(hdc, GetStockObject(BLACK_BRUSH)); 769 770 MoveToEx(hdc, bounds.left, bounds.top, NULL); 771 LineTo(hdc, bounds.left+width-1, bounds.top); 772 LineTo(hdc, bounds.left+width-1, bounds.top+height-1); 773 LineTo(hdc, bounds.left, bounds.top+height-1); 774 LineTo(hdc, bounds.left, bounds.top); 775 } 796 776 }; 797 777 … … 802 782 803 783 /* 784 ** tell container that previous area needs redrawing 785 */ 786 787 InvalidateRect(GetParent(_inplacewnd), &_posRect, TRUE); 788 789 /* 804 790 ** record keeping of control geometry within container 805 */ 791 */ 792 806 793 _posRect = posRect; 807 794 … … 831 818 FALSE); 832 819 833 834 820 /* 835 821 ** force a full refresh of control content activex/plugin.h
r1b75d79 rda4dc63 85 85 REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; }; 86 86 87 HRESULT onInit( BOOL isNew);87 HRESULT onInit(void); 88 88 HRESULT onLoad(void); 89 89 HRESULT onClientSiteChanged(LPOLECLIENTSITE pActiveSite); … … 103 103 int getVLCObject(void) { return _i_vlc; }; 104 104 105 // control properties105 // persistent control properties, may be overriden by HTML & javascript 106 106 void setSourceURL(const char *url) { _psz_src = strdup(url); }; 107 107 void setAutoStart(BOOL autostart) { _b_autostart = autostart; }; 108 108 void setLoopMode(BOOL loopmode) { _b_loopmode = loopmode; }; 109 void setMute(BOOL mute) { 110 if( mute && _i_vlc ) 111 { 112 VLC_VolumeMute(_i_vlc); 113 } 114 }; 109 void setMute(BOOL mute) { _b_mute = mute; }; 115 110 void setSendEvents(BOOL sendevents) { _b_sendevents = sendevents; }; 116 111 void setVisible(BOOL fVisible); 117 112 BOOL getVisible(void) { return _b_visible; }; 118 119 113 120 114 // container events … … 168 162 BOOL _b_loopmode; 169 163 BOOL _b_visible; 164 BOOL _b_mute; 170 165 BOOL _b_sendevents; 171 166 int _i_vlc; activex/utils.h
r1b75d79 rda4dc63 61 61 // cloning is implemented by subclasses and must use copy constructor 62 62 //STDMETHODIMP Clone(VLCEnum<T> **); 63 // cloning is implemented by subclasses and must use copy constructor64 63 65 64 typedef void (*retainer)(T); activex/viewobject.cpp
r83974ce rda4dc63 34 34 if( dwAspect & DVASPECT_CONTENT ) 35 35 { 36 if( _p_instance->getVisible() ) 37 { 38 RECT bounds; 39 bounds.left = lprcBounds->left; 40 bounds.top = lprcBounds->top; 41 bounds.right = lprcBounds->right; 42 bounds.bottom = lprcBounds->bottom; 43 _p_instance->onPaint(hdcDraw, bounds, bounds); 44 } 36 RECT bounds; 37 bounds.left = lprcBounds->left; 38 bounds.top = lprcBounds->top; 39 bounds.right = lprcBounds->right; 40 bounds.bottom = lprcBounds->bottom; 41 _p_instance->onPaint(hdcDraw, bounds, bounds); 45 42 return S_OK; 46 43 } … … 85 82 LPADVISESINK pAdvSink) 86 83 { 87 _dwAspect = dwAspect; 88 _advf = advf; 84 85 if( NULL != pAdvSink ) 86 pAdvSink->AddRef(); 87 89 88 if( NULL != _pAdvSink ) 90 89 _pAdvSink->Release(); 91 90 91 _dwAspect = dwAspect; 92 _advf = advf; 92 93 _pAdvSink = pAdvSink; 93 if( NULL != pAdvSink ) 94 95 if( (dwAspect & DVASPECT_CONTENT) && (advf & ADVF_PRIMEFIRST) && (NULL != _pAdvSink) ) 94 96 { 95 pAdvSink->AddRef(); 97 _pAdvSink->OnViewChange(DVASPECT_CONTENT, -1); 98 } 96 99 97 if( dwAspect & DVASPECT_CONTENT )98 {99 pAdvSink->OnViewChange(DVASPECT_CONTENT, -1);100 }101 }102 100 return S_OK; 103 101 };
