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 ...@@ -58,6 +58,9 @@ class CtrlButton: public CtrlGeneric
/// Get the text of the tooltip /// Get the text of the tooltip
virtual UString getTooltipText() const { return m_tooltip; } virtual UString getTooltipText() const { return m_tooltip; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "button"; }
private: private:
/// Finite state machine of the control /// Finite state machine of the control
FSM m_fsm; FSM m_fsm;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ctrl_checkbox.hpp * ctrl_checkbox.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -65,6 +65,9 @@ class CtrlCheckbox: public CtrlGeneric ...@@ -65,6 +65,9 @@ class CtrlCheckbox: public CtrlGeneric
/// Get the text of the tooltip XXX /// Get the text of the tooltip XXX
virtual UString getTooltipText() const { return *m_pTooltip; } virtual UString getTooltipText() const { return *m_pTooltip; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "checkbox"; }
private: private:
/// Finite state machine of the control /// Finite state machine of the control
FSM m_fsm; FSM m_fsm;
......
...@@ -78,6 +78,9 @@ class CtrlGeneric: public SkinObject, public Observer<VarBool> ...@@ -78,6 +78,9 @@ class CtrlGeneric: public SkinObject, public Observer<VarBool>
/// Return true if the control is visible /// Return true if the control is visible
virtual bool isVisible() const; virtual bool isVisible() const;
/// Get the type of control (custom RTTI)
virtual string getType() const { return ""; }
protected: protected:
// If pVisible is NULL, the control is always visible // If pVisible is NULL, the control is always visible
CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp, CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ctrl_image.hpp * ctrl_image.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -50,6 +50,9 @@ class CtrlImage: public CtrlFlat ...@@ -50,6 +50,9 @@ class CtrlImage: public CtrlFlat
/// Draw the control on the given graphics /// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest ); virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "image"; }
private: private:
/// Bitmap /// Bitmap
const GenericBitmap &m_rBitmap; const GenericBitmap &m_rBitmap;
......
...@@ -59,6 +59,9 @@ class CtrlList: public CtrlGeneric, public Observer<VarList>, ...@@ -59,6 +59,9 @@ class CtrlList: public CtrlGeneric, public Observer<VarList>,
/// Return true if the control can gain the focus /// Return true if the control can gain the focus
virtual bool isFocusable() const { return true; } virtual bool isFocusable() const { return true; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "list"; }
private: private:
/// List associated to the control /// List associated to the control
VarList &m_rList; VarList &m_rList;
......
...@@ -62,6 +62,9 @@ class CtrlMove: public CtrlFlat ...@@ -62,6 +62,9 @@ class CtrlMove: public CtrlFlat
static void transStillMoving( SkinObject *pCtrl ); static void transStillMoving( SkinObject *pCtrl );
static void transMovingStill( SkinObject *pCtrl ); static void transMovingStill( SkinObject *pCtrl );
/// Get the type of control (custom RTTI)
virtual string getType() const { return m_rCtrl.getType(); }
private: private:
FSM m_fsm; FSM m_fsm;
/// Window manager /// Window manager
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ctrl_radialslider.hpp * ctrl_radialslider.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr> * Olivier Teulière <ipkiss@via.ecp.fr>
...@@ -57,6 +57,9 @@ class CtrlRadialSlider: public CtrlGeneric, public Observer<VarPercent> ...@@ -57,6 +57,9 @@ class CtrlRadialSlider: public CtrlGeneric, public Observer<VarPercent>
/// Draw the control on the given graphics /// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest ); virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "radial_slider"; }
private: private:
/// Finite state machine of the control /// Finite state machine of the control
FSM m_fsm; FSM m_fsm;
......
...@@ -64,6 +64,9 @@ class CtrlResize: public CtrlFlat ...@@ -64,6 +64,9 @@ class CtrlResize: public CtrlFlat
static void transResizeStill( SkinObject *pCtrl ); static void transResizeStill( SkinObject *pCtrl );
static void transResizeResize( SkinObject *pCtrl ); static void transResizeResize( SkinObject *pCtrl );
/// Get the type of control (custom RTTI)
virtual string getType() const { return m_rCtrl.getType(); }
private: private:
FSM m_fsm; FSM m_fsm;
/// Decorated CtrlFlat /// Decorated CtrlFlat
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ctrl_slider.hpp * ctrl_slider.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr> * Olivier Teulière <ipkiss@via.ecp.fr>
...@@ -63,6 +63,9 @@ class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent> ...@@ -63,6 +63,9 @@ class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent>
/// Get the text of the tooltip /// Get the text of the tooltip
virtual UString getTooltipText() const { return m_tooltip; } virtual UString getTooltipText() const { return m_tooltip; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "slider_cursor"; }
private: private:
/// Finite state machine of the control /// Finite state machine of the control
FSM m_fsm; FSM m_fsm;
...@@ -125,6 +128,9 @@ class CtrlSliderBg: public CtrlGeneric ...@@ -125,6 +128,9 @@ class CtrlSliderBg: public CtrlGeneric
/// Handle an event /// Handle an event
virtual void handleEvent( EvtGeneric &rEvent ); virtual void handleEvent( EvtGeneric &rEvent );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "slider_bg"; }
private: private:
/// Cursor of the slider /// Cursor of the slider
CtrlSliderCursor &m_rCursor; CtrlSliderCursor &m_rCursor;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ctrl_text.hpp * ctrl_text.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr> * Olivier Teulière <ipkiss@via.ecp.fr>
...@@ -60,6 +60,9 @@ class CtrlText: public CtrlGeneric, public Observer<VarText> ...@@ -60,6 +60,9 @@ class CtrlText: public CtrlGeneric, public Observer<VarText>
/// This takes effect immediatly /// This takes effect immediatly
void setText( const UString &rText, uint32_t color = 0xFFFFFFFF ); void setText( const UString &rText, uint32_t color = 0xFFFFFFFF );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "text"; }
private: private:
/// Finite state machine of the control /// Finite state machine of the control
FSM m_fsm; FSM m_fsm;
......
...@@ -48,6 +48,9 @@ class CtrlVideo: public CtrlGeneric ...@@ -48,6 +48,9 @@ class CtrlVideo: public CtrlGeneric
/// Draw the control on the given graphics /// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest ); virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "video"; }
private: private:
/// Vout window /// Vout window
VoutWindow *m_pVout; VoutWindow *m_pVout;
......
...@@ -200,6 +200,7 @@ void GenericLayout::refreshRect( int x, int y, int width, int height ) ...@@ -200,6 +200,7 @@ void GenericLayout::refreshRect( int x, int y, int width, int height )
{ {
// Draw all the controls of the layout // Draw all the controls of the layout
list<LayeredControl>::const_iterator iter; list<LayeredControl>::const_iterator iter;
list<LayeredControl>::const_iterator iterVideo = m_controlList.end();
for( iter = m_controlList.begin(); iter != m_controlList.end(); iter++ ) for( iter = m_controlList.begin(); iter != m_controlList.end(); iter++ )
{ {
CtrlGeneric *pCtrl = (*iter).m_pControl; CtrlGeneric *pCtrl = (*iter).m_pControl;
...@@ -207,6 +208,10 @@ void GenericLayout::refreshRect( int x, int y, int width, int height ) ...@@ -207,6 +208,10 @@ void GenericLayout::refreshRect( int x, int y, int width, int height )
if( pCtrl->isVisible() && pPos ) if( pCtrl->isVisible() && pPos )
{ {
pCtrl->draw( *m_pImage, pPos->getLeft(), pPos->getTop() ); 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,8 +229,41 @@ void GenericLayout::refreshRect( int x, int y, int width, int height ) ...@@ -224,8 +229,41 @@ void GenericLayout::refreshRect( int x, int y, int width, int height )
if( y + height > m_height ) if( y + height > m_height )
height = m_height - y; height = m_height - y;
// 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 ); 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 ...@@ -75,6 +75,9 @@ class GenericLayout: public SkinObject, public Box
/// Refresh the window /// Refresh the window
virtual void refreshAll(); 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 /// Get the image of the layout
virtual OSGraphics *getImage() const { return m_pImage; } virtual OSGraphics *getImage() const { return m_pImage; }
...@@ -119,9 +122,6 @@ class GenericLayout: public SkinObject, public Box ...@@ -119,9 +122,6 @@ class GenericLayout: public SkinObject, public Box
virtual void addAnchor( Anchor *pAnchor ); virtual void addAnchor( Anchor *pAnchor );
private: private:
/// Refresh a rectangular portion of the window
void GenericLayout::refreshRect( int x, int y, int width, int height );
/// Parent window of the layout /// Parent window of the layout
TopWindow *m_pWindow; TopWindow *m_pWindow;
/// Layout size /// Layout size
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "../commands/cmd_on_top.hpp" #include "../commands/cmd_on_top.hpp"
#include "../commands/cmd_dialogs.hpp" #include "../commands/cmd_dialogs.hpp"
#include "../controls/ctrl_generic.hpp" #include "../controls/ctrl_generic.hpp"
#include "../events/evt_refresh.hpp"
#include "../events/evt_enter.hpp" #include "../events/evt_enter.hpp"
#include "../events/evt_focus.hpp" #include "../events/evt_focus.hpp"
#include "../events/evt_leave.hpp" #include "../events/evt_leave.hpp"
...@@ -67,6 +68,24 @@ TopWindow::~TopWindow() ...@@ -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 ) void TopWindow::processEvent( EvtFocus &rEvtFocus )
{ {
// fprintf(stderr, rEvtFocus.getAsString().c_str()) ; // fprintf(stderr, rEvtFocus.getAsString().c_str()) ;
......
...@@ -48,6 +48,7 @@ class TopWindow: public GenericWindow ...@@ -48,6 +48,7 @@ class TopWindow: public GenericWindow
virtual ~TopWindow(); virtual ~TopWindow();
/// Methods to process OS events. /// Methods to process OS events.
virtual void processEvent( EvtRefresh &rEvtRefresh );
virtual void processEvent( EvtFocus &rEvtFocus ); virtual void processEvent( EvtFocus &rEvtFocus );
virtual void processEvent( EvtMotion &rEvtMotion ); virtual void processEvent( EvtMotion &rEvtMotion );
virtual void processEvent( EvtMouse &rEvtMouse ); virtual void processEvent( EvtMouse &rEvtMouse );
......
...@@ -65,6 +65,9 @@ class VlcProc: public SkinObject ...@@ -65,6 +65,9 @@ class VlcProc: public SkinObject
/// Set the vout window handle /// Set the vout window handle
void setVoutWindow( void *pVoutWindow ); void setVoutWindow( void *pVoutWindow );
/// Indicate whether the embedded video output is currently used
bool isVoutUsed() const { return m_pVout; }
protected: protected:
// Protected because it is a singleton // Protected because it is a singleton
VlcProc( intf_thread_t *pIntf ); VlcProc( intf_thread_t *pIntf );
...@@ -92,7 +95,7 @@ class VlcProc: public SkinObject ...@@ -92,7 +95,7 @@ class VlcProc: public SkinObject
VariablePtr m_cVarStopped; VariablePtr m_cVarStopped;
VariablePtr m_cVarPaused; VariablePtr m_cVarPaused;
VariablePtr m_cVarSeekable; VariablePtr m_cVarSeekable;
/// Vout window hanlde /// Vout window handle
void *m_pVoutWindow; void *m_pVoutWindow;
/// Vout thread /// Vout thread
vout_thread_t *m_pVout; vout_thread_t *m_pVout;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
*****************************************************************************/ *****************************************************************************/
#include "vout_window.hpp" #include "vout_window.hpp"
#include "vlcproc.hpp"
#include "os_factory.hpp" #include "os_factory.hpp"
#include "os_graphics.hpp" #include "os_graphics.hpp"
#include "os_window.hpp" #include "os_window.hpp"
...@@ -69,7 +70,14 @@ void VoutWindow::refresh( int left, int top, int width, int height ) ...@@ -69,7 +70,14 @@ void VoutWindow::refresh( int left, int top, int width, int height )
{ {
if( m_pImage ) if( m_pImage )
{ {
m_pImage->copyToWindow( *getOSWindow(), left, top, width, height, left, // Get the VlcProc
top ); 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() ...@@ -129,12 +129,7 @@ void Win32Loop::run()
Infos.rcPaint.right - Infos.rcPaint.left + 1, Infos.rcPaint.right - Infos.rcPaint.left + 1,
Infos.rcPaint.bottom - Infos.rcPaint.top + 1 ); Infos.rcPaint.bottom - Infos.rcPaint.top + 1 );
EndPaint( msg.hwnd, &Infos ); 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; break;
} }
case WM_MOUSEMOVE: 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