Changeset 1b75d79ed2680352f5ed1f67d57e9c205dd73162
- Timestamp:
- 04/18/05 13:35:18
(3 years ago)
- Author:
- Damien Fouilleul <damienf@videolan.org>
- git-committer:
- Damien Fouilleul <damienf@videolan.org> 1113824118 +0000
- git-parent:
[ad67acad03c34bf97e9815c476fc1071902ea633]
- git-author:
- Damien Fouilleul <damienf@videolan.org> 1113824118 +0000
- Message:
- source cleanup
- few bugs fixed
- added suport to Ole Extent measurments to improve compatibilty
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| ra6cb895 |
r1b75d79 |
|
| 344 | 344 | S: France |
|---|
| 345 | 345 | |
|---|
| | 346 | N: Damien Fouilleul |
|---|
| | 347 | E: Damien.Fouilleul@laposte.net |
|---|
| | 348 | C: Quovodis |
|---|
| | 349 | D: ActiveX control |
|---|
| | 350 | S: Germany |
|---|
| | 351 | |
|---|
| r18631b5 |
r1b75d79 |
|
| 68 | 68 | InstallDir="C:\Program Files\VideoLAN\VLC" |
|---|
| 69 | 69 | |
|---|
| 70 | | The InstallDir must contain the 'plugins' directory. |
|---|
| | 70 | The InstallDir must be the parent directory of the 'plugins' directory. |
|---|
| 71 | 71 | |
|---|
| 72 | 72 | WARNING: Both control and plugins must come from the same build source tree. |
|---|
| r1591dec |
r1b75d79 |
|
| 226 | 226 | STDMETHODIMP VLCOleObject::GetExtent(DWORD dwDrawAspect, SIZEL *pSizel) |
|---|
| 227 | 227 | { |
|---|
| | 228 | if( NULL == pSizel ) |
|---|
| | 229 | return E_POINTER; |
|---|
| | 230 | |
|---|
| | 231 | if( dwDrawAspect & DVASPECT_CONTENT ) |
|---|
| | 232 | { |
|---|
| | 233 | *pSizel = _p_instance->getExtent(); |
|---|
| | 234 | return S_OK; |
|---|
| | 235 | } |
|---|
| | 236 | pSizel->cx= 0L; |
|---|
| | 237 | pSizel->cy= 0L; |
|---|
| 228 | 238 | return E_NOTIMPL; |
|---|
| 229 | 239 | }; |
|---|
| … | … | |
| 315 | 325 | STDMETHODIMP VLCOleObject::SetExtent(DWORD dwDrawAspect, SIZEL *pSizel) |
|---|
| 316 | 326 | { |
|---|
| | 327 | if( NULL == pSizel ) |
|---|
| | 328 | return E_POINTER; |
|---|
| | 329 | |
|---|
| | 330 | if( dwDrawAspect & DVASPECT_CONTENT ) |
|---|
| | 331 | { |
|---|
| | 332 | _p_instance->setExtent(*pSizel); |
|---|
| | 333 | |
|---|
| | 334 | if( _p_instance->isInPlaceActive() ) |
|---|
| | 335 | { |
|---|
| | 336 | LPOLEINPLACESITE p_inPlaceSite; |
|---|
| | 337 | |
|---|
| | 338 | if( SUCCEEDED(_p_clientsite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) ) |
|---|
| | 339 | { |
|---|
| | 340 | LPOLECONTROLSITE p_controlSite; |
|---|
| | 341 | RECT posRect = _p_instance->getPosRect(); |
|---|
| | 342 | |
|---|
| | 343 | if( SUCCEEDED(_p_clientsite->QueryInterface(IID_IOleControlSite, (void**)&p_controlSite)) ) |
|---|
| | 344 | { |
|---|
| | 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); |
|---|
| | 359 | posRect.right = (pSizel->cx*GetDeviceCaps(hDC, LOGPIXELSX)/2540L)+posRect.left; |
|---|
| | 360 | posRect.bottom = (pSizel->cy*GetDeviceCaps(hDC, LOGPIXELSY)/2540L)+posRect.top; |
|---|
| | 361 | DeleteDC(hDC); |
|---|
| | 362 | } |
|---|
| | 363 | p_inPlaceSite->OnPosRectChange(&posRect); |
|---|
| | 364 | p_inPlaceSite->Release(); |
|---|
| | 365 | } |
|---|
| | 366 | } |
|---|
| | 367 | return S_OK; |
|---|
| | 368 | } |
|---|
| 317 | 369 | return E_NOTIMPL; |
|---|
| 318 | 370 | }; |
|---|
| r1591dec |
r1b75d79 |
|
| 117 | 117 | }; |
|---|
| 118 | 118 | |
|---|
| 119 | | STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDiry, BOOL fSaveAllProperties) |
|---|
| | 119 | STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties) |
|---|
| 120 | 120 | { |
|---|
| 121 | 121 | if( NULL == pPropBag ) |
|---|
| rb9057a6 |
r1b75d79 |
|
| 251 | 251 | vlcControl = new VLCControl(this); |
|---|
| 252 | 252 | vlcViewObject = new VLCViewObject(this); |
|---|
| | 253 | |
|---|
| | 254 | // set default/preferred size (320x240) pixels in HIMETRIC |
|---|
| | 255 | HDC hDC = CreateDevDC(NULL); |
|---|
| | 256 | _extent.cx = (320*2540L)/GetDeviceCaps(hDC, LOGPIXELSX); |
|---|
| | 257 | _extent.cy = (240*2540L)/GetDeviceCaps(hDC, LOGPIXELSY); |
|---|
| | 258 | DeleteDC(hDC); |
|---|
| 253 | 259 | }; |
|---|
| 254 | 260 | |
|---|
| … | … | |
| 384 | 390 | return NOERROR; |
|---|
| 385 | 391 | } |
|---|
| | 392 | else if( IID_IViewObject2 == riid ) |
|---|
| | 393 | { |
|---|
| | 394 | AddRef(); |
|---|
| | 395 | *ppv = reinterpret_cast<LPVOID>(vlcViewObject); |
|---|
| | 396 | return NOERROR; |
|---|
| | 397 | } |
|---|
| 386 | 398 | |
|---|
| 387 | 399 | *ppv = NULL; |
|---|
| … | … | |
| 408 | 420 | |
|---|
| 409 | 421 | /* |
|---|
| 410 | | ** we use an in-place child window to represent plugin viewport, |
|---|
| 411 | | ** whose size is limited by the clipping rectangle |
|---|
| 412 | | ** all drawing within this window must follow |
|---|
| 413 | | ** cartesian coordinate system represented by _bounds. |
|---|
| | 422 | ** we use a window to represent plugin viewport, |
|---|
| | 423 | ** whose geometry is limited by the clipping rectangle |
|---|
| | 424 | ** all drawing within this window must follow must |
|---|
| | 425 | ** follow coordinates system described in lprPosRect |
|---|
| 414 | 426 | */ |
|---|
| 415 | 427 | |
|---|
| 416 | | void VLCPlugin::calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect) |
|---|
| 417 | | { |
|---|
| 418 | | _bounds.right = lprPosRect->right-lprPosRect->left; |
|---|
| 419 | | |
|---|
| 420 | | if( lprcClipRect->left <= lprPosRect->left ) |
|---|
| | 428 | static void getViewportCoords(LPRECT lprPosRect, LPRECT lprClipRect) |
|---|
| | 429 | { |
|---|
| | 430 | RECT bounds; |
|---|
| | 431 | bounds.right = lprPosRect->right-lprPosRect->left; |
|---|
| | 432 | |
|---|
| | 433 | if( lprClipRect->left <= lprPosRect->left ) |
|---|
| 421 | 434 | { |
|---|
| 422 | 435 | // left side is not clipped out |
|---|
| 423 | | _bounds.left = 0; |
|---|
| 424 | | |
|---|
| 425 | | if( lprcClipRect->right >= lprPosRect->right ) |
|---|
| | 436 | bounds.left = 0; |
|---|
| | 437 | |
|---|
| | 438 | if( lprClipRect->right >= lprPosRect->right ) |
|---|
| 426 | 439 | { |
|---|
| 427 | 440 | // right side is not clipped out, no change |
|---|
| 428 | 441 | } |
|---|
| 429 | | else if( lprcClipRect->right >= lprPosRect->left ) |
|---|
| | 442 | else if( lprClipRect->right >= lprPosRect->left ) |
|---|
| 430 | 443 | { |
|---|
| 431 | 444 | // right side is clipped out |
|---|
| 432 | | lprPosRect->right = lprcClipRect->right; |
|---|
| | 445 | lprPosRect->right = lprClipRect->right; |
|---|
| 433 | 446 | } |
|---|
| 434 | 447 | else |
|---|
| … | … | |
| 441 | 454 | { |
|---|
| 442 | 455 | // left side is clipped out |
|---|
| 443 | | _bounds.left = lprPosRect->left-lprcClipRect->left; |
|---|
| 444 | | _bounds.right += _bounds.left; |
|---|
| 445 | | |
|---|
| 446 | | lprPosRect->left = lprcClipRect->left; |
|---|
| 447 | | if( lprcClipRect->right >= lprPosRect->right ) |
|---|
| | 456 | bounds.left = lprPosRect->left-lprClipRect->left; |
|---|
| | 457 | bounds.right += bounds.left; |
|---|
| | 458 | |
|---|
| | 459 | lprPosRect->left = lprClipRect->left; |
|---|
| | 460 | if( lprClipRect->right >= lprPosRect->right ) |
|---|
| 448 | 461 | { |
|---|
| 449 | 462 | // right side is not clipped out |
|---|
| … | … | |
| 452 | 465 | { |
|---|
| 453 | 466 | // right side is clipped out |
|---|
| 454 | | lprPosRect->right = lprcClipRect->right; |
|---|
| 455 | | } |
|---|
| 456 | | } |
|---|
| 457 | | |
|---|
| 458 | | _bounds.bottom = lprPosRect->bottom-lprPosRect->top; |
|---|
| 459 | | |
|---|
| 460 | | if( lprcClipRect->top <= lprPosRect->top ) |
|---|
| | 467 | lprPosRect->right = lprClipRect->right; |
|---|
| | 468 | } |
|---|
| | 469 | } |
|---|
| | 470 | |
|---|
| | 471 | bounds.bottom = lprPosRect->bottom-lprPosRect->top; |
|---|
| | 472 | |
|---|
| | 473 | if( lprClipRect->top <= lprPosRect->top ) |
|---|
| 461 | 474 | { |
|---|
| 462 | 475 | // top side is not clipped out |
|---|
| 463 | | _bounds.top = 0; |
|---|
| 464 | | |
|---|
| 465 | | if( lprcClipRect->bottom >= lprPosRect->bottom ) |
|---|
| | 476 | bounds.top = 0; |
|---|
| | 477 | |
|---|
| | 478 | if( lprClipRect->bottom >= lprPosRect->bottom ) |
|---|
| 466 | 479 | { |
|---|
| 467 | 480 | // bottom side is not clipped out, no change |
|---|
| 468 | 481 | } |
|---|
| 469 | | else if( lprcClipRect->bottom >= lprPosRect->top ) |
|---|
| | 482 | else if( lprClipRect->bottom >= lprPosRect->top ) |
|---|
| 470 | 483 | { |
|---|
| 471 | 484 | // bottom side is clipped out |
|---|
| 472 | | lprPosRect->bottom = lprcClipRect->bottom; |
|---|
| | 485 | lprPosRect->bottom = lprClipRect->bottom; |
|---|
| 473 | 486 | } |
|---|
| 474 | 487 | else |
|---|
| … | … | |
| 480 | 493 | else |
|---|
| 481 | 494 | { |
|---|
| 482 | | _bounds.top = lprPosRect->top-lprcClipRect->top; |
|---|
| 483 | | _bounds.bottom += _bounds.top; |
|---|
| 484 | | |
|---|
| 485 | | lprPosRect->top = lprcClipRect->top; |
|---|
| 486 | | if( lprcClipRect->bottom >= lprPosRect->bottom ) |
|---|
| | 495 | bounds.top = lprPosRect->top-lprClipRect->top; |
|---|
| | 496 | bounds.bottom += bounds.top; |
|---|
| | 497 | |
|---|
| | 498 | lprPosRect->top = lprClipRect->top; |
|---|
| | 499 | if( lprClipRect->bottom >= lprPosRect->bottom ) |
|---|
| 487 | 500 | { |
|---|
| 488 | 501 | // bottom side is not clipped out |
|---|
| … | … | |
| 491 | 504 | { |
|---|
| 492 | 505 | // bottom side is clipped out |
|---|
| 493 | | lprPosRect->bottom = lprcClipRect->bottom; |
|---|
| 494 | | } |
|---|
| 495 | | } |
|---|
| | 506 | lprPosRect->bottom = lprClipRect->bottom; |
|---|
| | 507 | } |
|---|
| | 508 | } |
|---|
| | 509 | *lprClipRect = *lprPosRect; |
|---|
| | 510 | *lprPosRect = bounds; |
|---|
| 496 | 511 | }; |
|---|
| 497 | 512 | |
|---|
| … | … | |
| 523 | 538 | } |
|---|
| 524 | 539 | |
|---|
| 525 | | #if 0 |
|---|
| | 540 | #if 1 |
|---|
| 526 | 541 | ppsz_argv[0] = "C:\\cygwin\\home\\Damien_Fouilleul\\dev\\videolan\\vlc-trunk\\vlc"; |
|---|
| 527 | 542 | #endif |
|---|
| … | … | |
| 611 | 626 | { |
|---|
| 612 | 627 | RECT posRect = *lprcPosRect; |
|---|
| 613 | | |
|---|
| 614 | | calcPositionChange(&posRect, lprcClipRect); |
|---|
| 615 | | |
|---|
| | 628 | RECT clipRect = *lprcClipRect; |
|---|
| | 629 | |
|---|
| | 630 | /* |
|---|
| | 631 | ** record keeping of control geometry within container |
|---|
| | 632 | */ |
|---|
| | 633 | _posRect = posRect; |
|---|
| | 634 | |
|---|
| | 635 | /* |
|---|
| | 636 | ** convert posRect & clipRect to match control viewport coordinates |
|---|
| | 637 | */ |
|---|
| | 638 | getViewportCoords(&posRect, &clipRect); |
|---|
| | 639 | |
|---|
| | 640 | /* |
|---|
| | 641 | ** Create a window for in place activated control. |
|---|
| | 642 | ** the window geometry represents the control viewport |
|---|
| | 643 | ** so that embedded video is always properly clipped. |
|---|
| | 644 | */ |
|---|
| 616 | 645 | _inplacewnd = CreateWindow(_p_class->getInPlaceWndClassName(), |
|---|
| 617 | 646 | "VLC Plugin In-Place Window", |
|---|
| 618 | 647 | WS_CHILD|WS_CLIPCHILDREN|WS_TABSTOP, |
|---|
| 619 | | posRect.left, |
|---|
| 620 | | posRect.top, |
|---|
| 621 | | posRect.right-posRect.left, |
|---|
| 622 | | posRect.bottom-posRect.top, |
|---|
| | 648 | clipRect.left, |
|---|
| | 649 | clipRect.top, |
|---|
| | 650 | clipRect.right-clipRect.left, |
|---|
| | 651 | clipRect.bottom-clipRect.top, |
|---|
| 623 | 652 | hwndParent, |
|---|
| 624 | 653 | 0, |
|---|
| … | … | |
| 632 | 661 | SetWindowLongPtr(_inplacewnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); |
|---|
| 633 | 662 | |
|---|
| | 663 | /* |
|---|
| | 664 | ** VLC embedded video geometry automatically matches parent window. |
|---|
| | 665 | ** hence create a child window so that video position and size |
|---|
| | 666 | ** is always correct relative to the viewport bounds |
|---|
| | 667 | */ |
|---|
| 634 | 668 | _videownd = CreateWindow(_p_class->getVideoWndClassName(), |
|---|
| 635 | 669 | "VLC Plugin Video Window", |
|---|
| 636 | 670 | WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE, |
|---|
| 637 | | _bounds.left, |
|---|
| 638 | | _bounds.top, |
|---|
| 639 | | _bounds.right-_bounds.left, |
|---|
| 640 | | _bounds.bottom-_bounds.top, |
|---|
| | 671 | posRect.left, |
|---|
| | 672 | posRect.top, |
|---|
| | 673 | posRect.right-posRect.left, |
|---|
| | 674 | posRect.bottom-posRect.top, |
|---|
| 641 | 675 | _inplacewnd, |
|---|
| 642 | 676 | 0, |
|---|
| … | … | |
| 764 | 798 | void VLCPlugin::onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect) |
|---|
| 765 | 799 | { |
|---|
| 766 | | RECT posRect = *lprcPosRect; |
|---|
| 767 | | |
|---|
| 768 | | calcPositionChange(&posRect, lprcClipRect); |
|---|
| | 800 | RECT clipRect = *lprcClipRect; |
|---|
| | 801 | RECT posRect = *lprcPosRect; |
|---|
| | 802 | |
|---|
| | 803 | /* |
|---|
| | 804 | ** record keeping of control geometry within container |
|---|
| | 805 | */ |
|---|
| | 806 | _posRect = posRect; |
|---|
| | 807 | |
|---|
| | 808 | /* |
|---|
| | 809 | ** convert posRect & clipRect to match control viewport coordinates |
|---|
| | 810 | */ |
|---|
| | 811 | getViewportCoords(&posRect, &clipRect); |
|---|
| 769 | 812 | |
|---|
| 770 | 813 | /* |
|---|
| … | … | |
| 772 | 815 | */ |
|---|
| 773 | 816 | MoveWindow(_inplacewnd, |
|---|
| | 817 | clipRect.left, |
|---|
| | 818 | clipRect.top, |
|---|
| | 819 | clipRect.right-clipRect.left, |
|---|
| | 820 | clipRect.bottom-clipRect.top, |
|---|
| | 821 | FALSE); |
|---|
| | 822 | |
|---|
| | 823 | /* |
|---|
| | 824 | ** change video window geometry to match object bounds within clipping region |
|---|
| | 825 | */ |
|---|
| | 826 | MoveWindow(_videownd, |
|---|
| 774 | 827 | posRect.left, |
|---|
| 775 | 828 | posRect.top, |
|---|
| … | … | |
| 778 | 831 | FALSE); |
|---|
| 779 | 832 | |
|---|
| 780 | | /* |
|---|
| 781 | | ** change video window geometry to match object bounds within clipping region |
|---|
| | 833 | |
|---|
| | 834 | /* |
|---|
| | 835 | ** force a full refresh of control content |
|---|
| 782 | 836 | */ |
|---|
| 783 | | MoveWindow(_videownd, |
|---|
| 784 | | _bounds.left, |
|---|
| 785 | | _bounds.top, |
|---|
| 786 | | _bounds.right-_bounds.left, |
|---|
| 787 | | _bounds.bottom-_bounds.top, |
|---|
| 788 | | FALSE); |
|---|
| 789 | | |
|---|
| 790 | 837 | RECT updateRect; |
|---|
| 791 | | |
|---|
| 792 | | updateRect.left = -_bounds.left; |
|---|
| 793 | | updateRect.top = -_bounds.top; |
|---|
| 794 | | updateRect.right = _bounds.right-_bounds.left; |
|---|
| 795 | | updateRect.bottom = _bounds.bottom-_bounds.top; |
|---|
| | 838 | updateRect.left = -posRect.left; |
|---|
| | 839 | updateRect.top = -posRect.top; |
|---|
| | 840 | updateRect.right = posRect.right-posRect.left; |
|---|
| | 841 | updateRect.bottom = posRect.bottom-posRect.top; |
|---|
| 796 | 842 | |
|---|
| 797 | 843 | ValidateRect(_videownd, NULL); |
|---|
| rb9057a6 |
r1b75d79 |
|
| 117 | 117 | BOOL getVisible(void) { return _b_visible; }; |
|---|
| 118 | 118 | |
|---|
| | 119 | |
|---|
| 119 | 120 | // container events |
|---|
| 120 | 121 | void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect); |
|---|
| … | … | |
| 127 | 128 | void fireOnStopEvent(void); |
|---|
| 128 | 129 | |
|---|
| | 130 | // control size in HIMETRIC |
|---|
| | 131 | const SIZEL& getExtent(void) { return _extent; }; |
|---|
| | 132 | void setExtent(const SIZEL& extent) { _extent = extent; }; |
|---|
| | 133 | |
|---|
| | 134 | // control geometry within container |
|---|
| | 135 | RECT getPosRect(void) { return _posRect; }; |
|---|
| | 136 | |
|---|
| 129 | 137 | protected: |
|---|
| 130 | 138 | |
|---|
| … | … | |
| 132 | 140 | |
|---|
| 133 | 141 | private: |
|---|
| 134 | | |
|---|
| 135 | | void calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect); |
|---|
| 136 | 142 | |
|---|
| 137 | 143 | //implemented interfaces |
|---|
| … | … | |
| 153 | 159 | // video window (Drawing window) |
|---|
| 154 | 160 | HWND _videownd; |
|---|
| 155 | | RECT _bounds; |
|---|
| 156 | 161 | |
|---|
| 157 | 162 | VLCPluginClass *_p_class; |
|---|
| … | … | |
| 164 | 169 | BOOL _b_visible; |
|---|
| 165 | 170 | BOOL _b_sendevents; |
|---|
| 166 | | int _i_vlc; |
|---|
| | 171 | int _i_vlc; |
|---|
| | 172 | |
|---|
| | 173 | SIZEL _extent; |
|---|
| | 174 | RECT _posRect; |
|---|
| 167 | 175 | }; |
|---|
| 168 | 176 | |
|---|
| r3d831e0 |
r1b75d79 |
|
| 99 | 99 | }; |
|---|
| 100 | 100 | |
|---|
| | 101 | HDC CreateDevDC(DVTARGETDEVICE *ptd) |
|---|
| | 102 | { |
|---|
| | 103 | HDC hdc=NULL; |
|---|
| | 104 | LPDEVNAMES lpDevNames; |
|---|
| | 105 | LPDEVMODE lpDevMode; |
|---|
| | 106 | LPTSTR lpszDriverName; |
|---|
| | 107 | LPTSTR lpszDeviceName; |
|---|
| | 108 | LPTSTR lpszPortName; |
|---|
| 101 | 109 | |
|---|
| | 110 | if (ptd == NULL) { |
|---|
| | 111 | hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); |
|---|
| | 112 | goto errReturn; |
|---|
| | 113 | } |
|---|
| | 114 | |
|---|
| | 115 | lpDevNames = (LPDEVNAMES) ptd; // offset for size field |
|---|
| | 116 | |
|---|
| | 117 | if (ptd->tdExtDevmodeOffset == 0) { |
|---|
| | 118 | lpDevMode = NULL; |
|---|
| | 119 | }else{ |
|---|
| | 120 | lpDevMode = (LPDEVMODE) ((LPTSTR)ptd + ptd->tdExtDevmodeOffset); |
|---|
| | 121 | } |
|---|
| | 122 | |
|---|
| | 123 | lpszDriverName = (LPTSTR) lpDevNames + ptd->tdDriverNameOffset; |
|---|
| | 124 | lpszDeviceName = (LPTSTR) lpDevNames + ptd->tdDeviceNameOffset; |
|---|
| | 125 | lpszPortName = (LPTSTR) lpDevNames + ptd->tdPortNameOffset; |
|---|
| | 126 | |
|---|
| | 127 | hdc = CreateDC(lpszDriverName, lpszDeviceName, lpszPortName, lpDevMode); |
|---|
| | 128 | |
|---|
| | 129 | errReturn: |
|---|
| | 130 | return hdc; |
|---|
| | 131 | }; |
|---|
| | 132 | |
|---|
| | 133 | |
|---|
| r3d831e0 |
r1b75d79 |
|
| 34 | 34 | // properties |
|---|
| 35 | 35 | extern HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v); |
|---|
| | 36 | |
|---|
| | 37 | // properties |
|---|
| | 38 | extern HDC CreateDevDC(DVTARGETDEVICE *ptd); |
|---|
| 36 | 39 | |
|---|
| 37 | 40 | // enumeration |
|---|
| rb9057a6 |
r1b75d79 |
|
| 24 | 24 | #include "viewobject.h" |
|---|
| 25 | 25 | |
|---|
| 26 | | #include <iostream> |
|---|
| | 26 | #include "utils.h" |
|---|
| 27 | 27 | |
|---|
| 28 | 28 | using namespace std; |
|---|
| … | … | |
| 32 | 32 | LPCRECTL lprcWBounds, BOOL(CALLBACK *pfnContinue)(DWORD), DWORD dwContinue) |
|---|
| 33 | 33 | { |
|---|
| 34 | | switch( dwAspect ) |
|---|
| | 34 | if( dwAspect & DVASPECT_CONTENT ) |
|---|
| 35 | 35 | { |
|---|
| 36 | | case DVASPECT_CONTENT: |
|---|
| 37 | | if( _p_instance->getVisible() ) |
|---|
| 38 | | { |
|---|
| 39 | | RECT bounds; |
|---|
| 40 | | bounds.left = lprcBounds->left; |
|---|
| 41 | | bounds.top = lprcBounds->top; |
|---|
| 42 | | bounds.right = lprcBounds->right; |
|---|
| 43 | | bounds.bottom = lprcBounds->bottom; |
|---|
| 44 | | _p_instance->onPaint(hdcDraw, bounds, bounds); |
|---|
| 45 | | } |
|---|
| 46 | | return S_OK; |
|---|
| 47 | | case DVASPECT_THUMBNAIL: |
|---|
| 48 | | break; |
|---|
| 49 | | case DVASPECT_ICON: |
|---|
| 50 | | break; |
|---|
| 51 | | case DVASPECT_DOCPRINT: |
|---|
| 52 | | break; |
|---|
| | 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 | } |
|---|
| | 45 | return S_OK; |
|---|
| 53 | 46 | } |
|---|
| 54 | 47 | return E_NOTIMPL; |
|---|
| … | … | |
| 61 | 54 | return E_INVALIDARG; |
|---|
| 62 | 55 | |
|---|
| 63 | | return OLE_E_BLANK; |
|---|
| | 56 | return E_NOTIMPL; |
|---|
| 64 | 57 | }; |
|---|
| 65 | 58 | |
|---|
| … | … | |
| 67 | 60 | LPADVISESINK *ppAdviseSink) |
|---|
| 68 | 61 | { |
|---|
| 69 | | return E_NOTIMPL; |
|---|
| | 62 | if( NULL != pdwAspect ) |
|---|
| | 63 | *pdwAspect = 0; |
|---|
| | 64 | |
|---|
| | 65 | if( NULL != padvf ) |
|---|
| | 66 | *padvf = 0; |
|---|
| | 67 | |
|---|
| | 68 | if( NULL != ppAdviseSink ) |
|---|
| | 69 | *ppAdviseSink = NULL; |
|---|
| | 70 | |
|---|
| | 71 | return S_OK; |
|---|
| 70 | 72 | }; |
|---|
| 71 | 73 | |
|---|
| … | … | |
| 73 | 75 | PVOID pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LPLOGPALETTE *ppColorSet) |
|---|
| 74 | 76 | { |
|---|
| 75 | | return E_NOTIMPL; |
|---|
| | 77 | return S_FALSE; |
|---|
| 76 | 78 | }; |
|---|
| 77 | 79 | |
|---|
| … | … | |
| 87 | 89 | }; |
|---|
| 88 | 90 | |
|---|
| | 91 | STDMETHODIMP VLCViewObject::GetExtent(DWORD dwAspect, LONG lindex, |
|---|
| | 92 | DVTARGETDEVICE *ptd, LPSIZEL lpSizel) |
|---|
| | 93 | { |
|---|
| | 94 | if( dwAspect & DVASPECT_CONTENT ) |
|---|
| | 95 | { |
|---|
| | 96 | *lpSizel = _p_instance->getExtent(); |
|---|
| | 97 | return S_OK; |
|---|
| | 98 | } |
|---|
| | 99 | lpSizel->cx= 0L; |
|---|
| | 100 | lpSizel->cy= 0L; |
|---|
| | 101 | return E_NOTIMPL; |
|---|
| | 102 | }; |
|---|
| | 103 | |
|---|
| rb9057a6 |
r1b75d79 |
|
| 26 | 26 | #include <oleidl.h> |
|---|
| 27 | 27 | |
|---|
| 28 | | class VLCViewObject : public IViewObject |
|---|
| | 28 | class VLCViewObject : public IViewObject2 |
|---|
| 29 | 29 | { |
|---|
| 30 | 30 | |
|---|
| … | … | |
| 40 | 40 | && (IID_IUnknown == riid) |
|---|
| 41 | 41 | && (IID_IPersist == riid) |
|---|
| 42 | | && (IID_IViewObject == riid) ) { |
|---|
| | 42 | && (IID_IViewObject == riid) |
|---|
| | 43 | && (IID_IViewObject2 == riid) ) { |
|---|
| 43 | 44 | AddRef(); |
|---|
| 44 | 45 | *ppv = reinterpret_cast<LPVOID>(this); |
|---|
| … | … | |
| 59 | 60 | STDMETHODIMP Unfreeze(DWORD); |
|---|
| 60 | 61 | |
|---|
| | 62 | // IViewObject2 methods |
|---|
| | 63 | STDMETHODIMP GetExtent(DWORD,LONG,DVTARGETDEVICE *,LPSIZEL); |
|---|
| | 64 | |
|---|
| 61 | 65 | private: |
|---|
| 62 | 66 | |
|---|
| r3d831e0 |
r1b75d79 |
|
| 55 | 55 | STDMETHODIMP VLCControl::GetTypeInfoCount(UINT* pctInfo) |
|---|
| 56 | 56 | { |
|---|
| | 57 | if( NULL == pctInfo ) |
|---|
| | 58 | return E_INVALIDARG; |
|---|
| | 59 | |
|---|
| 57 | 60 | if( SUCCEEDED(getTypeInfo()) ) |
|---|
| 58 | 61 | *pctInfo = 1; |
|---|
| … | … | |
| 103 | 106 | { |
|---|
| 104 | 107 | if( NULL == pvarValue ) |
|---|
| 105 | | return E_INVALIDARG; |
|---|
| | 108 | return E_POINTER; |
|---|
| 106 | 109 | |
|---|
| 107 | 110 | V_VT(pvarValue) = VT_BOOL; |
|---|
| … | … | |
| 128 | 131 | { |
|---|
| 129 | 132 | if( NULL == isVisible ) |
|---|
| 130 | | return E_INVALIDARG; |
|---|
| | 133 | return E_POINTER; |
|---|
| 131 | 134 | |
|---|
| 132 | 135 | *isVisible = _p_instance->getVisible(); |
|---|
| … | … | |
| 181 | 184 | { |
|---|
| 182 | 185 | if( NULL == isPlaying ) |
|---|
| 183 | | return E_INVALIDARG; |
|---|
| | 186 | return E_POINTER; |
|---|
| 184 | 187 | |
|---|
| 185 | 188 | int i_vlc = _p_instance->getVLCObject(); |
|---|
| … | … | |
| 216 | 219 | { |
|---|
| 217 | 220 | if( NULL == position ) |
|---|
| 218 | | return E_INVALIDARG; |
|---|
| | 221 | return E_POINTER; |
|---|
| 219 | 222 | |
|---|
| 220 | 223 | int i_vlc = _p_instance->getVLCObject(); |
|---|
| … | … | |
| 242 | 245 | { |
|---|
| 243 | 246 | if( NULL == seconds ) |
|---|
| 244 | | return E_INVALIDARG; |
|---|
| | 247 | return E_POINTER; |
|---|
| 245 | 248 | |
|---|
| 246 | 249 | int i_vlc = _p_instance->getVLCObject(); |
|---|
| … | … | |
| 290 | 293 | { |
|---|
| 291 | 294 | if( NULL == seconds ) |
|---|
| 292 | | return E_INVALIDARG; |
|---|
| | 295 | return E_POINTER; |
|---|
| 293 | 296 | |
|---|
| 294 | 297 | int i_vlc = _p_instance->getVLCObject(); |
|---|
| … | … | |
| 327 | 330 | { |
|---|
| 328 | 331 | if( NULL == volume ) |
|---|
| 329 | | return E_INVALIDARG; |
|---|
| | 332 | return E_POINTER; |
|---|
| 330 | 333 | |
|---|
| 331 | 334 | int i_vlc = _p_instance->getVLCObject(); |
|---|
| … | … | |
| 558 | 561 | STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistMode mode, int position) |
|---|
| 559 | 562 | { |
|---|
| 560 | | if( NULL == uri ) |
|---|
| | 563 | if( 0 == SysStringLen(uri) ) |
|---|
| 561 | 564 | return E_INVALIDARG; |
|---|
| 562 | 565 | |
|---|
| … | … | |
| 589 | 592 | { |
|---|
| 590 | 593 | if( NULL == index ) |
|---|
| 591 | | return E_INVALIDARG; |
|---|
| | 594 | return E_POINTER; |
|---|
| 592 | 595 | |
|---|
| 593 | 596 | int i_vlc = _p_instance->getVLCObject(); |
|---|
| … | … | |
| 648 | 651 | { |
|---|
| 649 | 652 | if( NULL == version ) |
|---|
| 650 | | return E_INVALIDARG; |
|---|
| | 653 | return E_POINTER; |
|---|
| 651 | 654 | |
|---|
| 652 | 655 | const char *versionStr = VLC_Version(); |
|---|