Commit 8329eed8 authored by Olivier Teulière's avatar Olivier Teulière

* skins2: Do not paint on the embedded video output, when a video is

   being played in it
parent 744c1b58
......@@ -58,6 +58,9 @@ class CtrlButton: public CtrlGeneric
/// Get the text of the tooltip
virtual UString getTooltipText() const { return m_tooltip; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "button"; }
private:
/// Finite state machine of the control
FSM m_fsm;
......
......@@ -2,7 +2,7 @@
* ctrl_checkbox.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_checkbox.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -65,6 +65,9 @@ class CtrlCheckbox: public CtrlGeneric
/// Get the text of the tooltip XXX
virtual UString getTooltipText() const { return *m_pTooltip; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "checkbox"; }
private:
/// Finite state machine of the control
FSM m_fsm;
......
......@@ -78,6 +78,9 @@ class CtrlGeneric: public SkinObject, public Observer<VarBool>
/// Return true if the control is visible
virtual bool isVisible() const;
/// Get the type of control (custom RTTI)
virtual string getType() const { return ""; }
protected:
// If pVisible is NULL, the control is always visible
CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp,
......
......@@ -2,7 +2,7 @@
* ctrl_image.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_image.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -50,6 +50,9 @@ class CtrlImage: public CtrlFlat
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "image"; }
private:
/// Bitmap
const GenericBitmap &m_rBitmap;
......
......@@ -59,6 +59,9 @@ class CtrlList: public CtrlGeneric, public Observer<VarList>,
/// Return true if the control can gain the focus
virtual bool isFocusable() const { return true; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "list"; }
private:
/// List associated to the control
VarList &m_rList;
......
......@@ -62,6 +62,9 @@ class CtrlMove: public CtrlFlat
static void transStillMoving( SkinObject *pCtrl );
static void transMovingStill( SkinObject *pCtrl );
/// Get the type of control (custom RTTI)
virtual string getType() const { return m_rCtrl.getType(); }
private:
FSM m_fsm;
/// Window manager
......
......@@ -2,7 +2,7 @@
* ctrl_radialslider.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_radialslider.hpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -57,6 +57,9 @@ class CtrlRadialSlider: public CtrlGeneric, public Observer<VarPercent>
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "radial_slider"; }
private:
/// Finite state machine of the control
FSM m_fsm;
......
......@@ -64,6 +64,9 @@ class CtrlResize: public CtrlFlat
static void transResizeStill( SkinObject *pCtrl );
static void transResizeResize( SkinObject *pCtrl );
/// Get the type of control (custom RTTI)
virtual string getType() const { return m_rCtrl.getType(); }
private:
FSM m_fsm;
/// Decorated CtrlFlat
......
......@@ -2,7 +2,7 @@
* ctrl_slider.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_slider.hpp,v 1.4 2004/03/02 21:45:15 ipkiss Exp $
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -63,6 +63,9 @@ class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent>
/// Get the text of the tooltip
virtual UString getTooltipText() const { return m_tooltip; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "slider_cursor"; }
private:
/// Finite state machine of the control
FSM m_fsm;
......@@ -125,6 +128,9 @@ class CtrlSliderBg: public CtrlGeneric
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "slider_bg"; }
private:
/// Cursor of the slider
CtrlSliderCursor &m_rCursor;
......
......@@ -2,7 +2,7 @@
* ctrl_text.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_text.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -60,6 +60,9 @@ class CtrlText: public CtrlGeneric, public Observer<VarText>
/// This takes effect immediatly
void setText( const UString &rText, uint32_t color = 0xFFFFFFFF );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "text"; }
private:
/// Finite state machine of the control
FSM m_fsm;
......
......@@ -48,6 +48,9 @@ class CtrlVideo: public CtrlGeneric
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "video"; }
private:
/// Vout window
VoutWindow *m_pVout;
......
......@@ -200,6 +200,7 @@ void GenericLayout::refreshRect( int x, int y, int width, int height )
{
// Draw all the controls of the layout
list<LayeredControl>::const_iterator iter;
list<LayeredControl>::const_iterator iterVideo = m_controlList.end();
for( iter = m_controlList.begin(); iter != m_controlList.end(); iter++ )
{
CtrlGeneric *pCtrl = (*iter).m_pControl;
......@@ -207,6 +208,10 @@ void GenericLayout::refreshRect( int x, int y, int width, int height )
if( pCtrl->isVisible() && pPos )
{
pCtrl->draw( *m_pImage, pPos->getLeft(), pPos->getTop() );
// Remember the video control (we assume there is at most one video
// control per layout)
if( pCtrl->getType() == "video" && pCtrl->getPosition() )
iterVideo = iter;
}
}
......@@ -224,7 +229,40 @@ void GenericLayout::refreshRect( int x, int y, int width, int height )
if( y + height > m_height )
height = m_height - y;
pWindow->refresh( x, y, width, height );
// Refresh the window... but do not paint on a video control!
if( iterVideo == m_controlList.end() )
{
// No video control, we can safely repain the rectangle
pWindow->refresh( x, y, width, height );
}
else
{
// Bad luck, there is a video control somewhere (not necessarily
// in the repainting zone, btw).
// We will divide the repainting into 4 regions (top, left, bottom
// and right). The overlapping parts (i.e. the corners) of these
// regions will be painted twice, because otherwise the algorithm
// becomes a real mess :)
// Use short variable names for convenience
int xx = iterVideo->m_pControl->getPosition()->getLeft();
int yy = iterVideo->m_pControl->getPosition()->getTop();
int ww = iterVideo->m_pControl->getPosition()->getWidth();
int hh = iterVideo->m_pControl->getPosition()->getHeight();
// Top part:
if( y < yy )
pWindow->refresh( x, y, width, yy - y );
// Left part:
if( x < xx )
pWindow->refresh( x, y, xx - x, height );
// Bottom part
if( y + height > yy + hh )
pWindow->refresh( x, yy + hh, width, y + height - (yy + hh) );
// Right part
if( x + width > xx + ww )
pWindow->refresh( xx + ww, y, x + width - (xx + ww), height );
}
}
}
......
......@@ -75,6 +75,9 @@ class GenericLayout: public SkinObject, public Box
/// Refresh the window
virtual void refreshAll();
/// Refresh a rectangular portion of the window
virtual void refreshRect( int x, int y, int width, int height );
/// Get the image of the layout
virtual OSGraphics *getImage() const { return m_pImage; }
......@@ -119,9 +122,6 @@ class GenericLayout: public SkinObject, public Box
virtual void addAnchor( Anchor *pAnchor );
private:
/// Refresh a rectangular portion of the window
void GenericLayout::refreshRect( int x, int y, int width, int height );
/// Parent window of the layout
TopWindow *m_pWindow;
/// Layout size
......
......@@ -32,6 +32,7 @@
#include "../commands/cmd_on_top.hpp"
#include "../commands/cmd_dialogs.hpp"
#include "../controls/ctrl_generic.hpp"
#include "../events/evt_refresh.hpp"
#include "../events/evt_enter.hpp"
#include "../events/evt_focus.hpp"
#include "../events/evt_leave.hpp"
......@@ -67,6 +68,24 @@ TopWindow::~TopWindow()
}
void TopWindow::processEvent( EvtRefresh &rEvtRefresh )
{
// We override the behaviour defined in GenericWindow, because we don't
// want to draw on a video control!
if( m_pActiveLayout == NULL )
{
GenericWindow::processEvent( rEvtRefresh );
}
else
{
m_pActiveLayout->refreshRect( rEvtRefresh.getXStart(),
rEvtRefresh.getYStart(),
rEvtRefresh.getWidth(),
rEvtRefresh.getHeight() );
}
}
void TopWindow::processEvent( EvtFocus &rEvtFocus )
{
// fprintf(stderr, rEvtFocus.getAsString().c_str()) ;
......
......@@ -48,6 +48,7 @@ class TopWindow: public GenericWindow
virtual ~TopWindow();
/// Methods to process OS events.
virtual void processEvent( EvtRefresh &rEvtRefresh );
virtual void processEvent( EvtFocus &rEvtFocus );
virtual void processEvent( EvtMotion &rEvtMotion );
virtual void processEvent( EvtMouse &rEvtMouse );
......
......@@ -65,6 +65,9 @@ class VlcProc: public SkinObject
/// Set the vout window handle
void setVoutWindow( void *pVoutWindow );
/// Indicate whether the embedded video output is currently used
bool isVoutUsed() const { return m_pVout; }
protected:
// Protected because it is a singleton
VlcProc( intf_thread_t *pIntf );
......@@ -92,7 +95,7 @@ class VlcProc: public SkinObject
VariablePtr m_cVarStopped;
VariablePtr m_cVarPaused;
VariablePtr m_cVarSeekable;
/// Vout window hanlde
/// Vout window handle
void *m_pVoutWindow;
/// Vout thread
vout_thread_t *m_pVout;
......
......@@ -22,6 +22,7 @@
*****************************************************************************/
#include "vout_window.hpp"
#include "vlcproc.hpp"
#include "os_factory.hpp"
#include "os_graphics.hpp"
#include "os_window.hpp"
......@@ -69,7 +70,14 @@ void VoutWindow::refresh( int left, int top, int width, int height )
{
if( m_pImage )
{
m_pImage->copyToWindow( *getOSWindow(), left, top, width, height, left,
top );
// Get the VlcProc
VlcProc *pVlcProc = getIntf()->p_sys->p_vlcProc;
// Refresh only when there is no video!
if( pVlcProc && !pVlcProc->isVoutUsed() )
{
m_pImage->copyToWindow( *getOSWindow(), left, top,
width, height, left, top );
}
}
}
......@@ -129,12 +129,7 @@ void Win32Loop::run()
Infos.rcPaint.right - Infos.rcPaint.left + 1,
Infos.rcPaint.bottom - Infos.rcPaint.top + 1 );
EndPaint( msg.hwnd, &Infos );
// Ignore all the painting events for the vout window,
// otherwise we are going to screw up the colorkey
if( win.getType() != "Vout" )
{
win.processEvent( evt );
}
win.processEvent( evt );
break;
}
case WM_MOUSEMOVE:
......
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