Commit a2ce62f8 authored by Cyril Deguet's avatar Cyril Deguet

* controls/*, src/generic_window.cpp, src/generic_layout.cpp: a visibiliy

variable is now owned by CtrlGeneric, and handled directly by the layout
and the window (at the moment only the slider control uses it)
* theme/skin.dtd, parser/builder.cpp, parser, skin_parser.cpp: added
the "color" attribute for control text
parent 0925e59b
......@@ -2,7 +2,7 @@
* ctrl_button.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_button.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_button.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -33,9 +33,10 @@
CtrlButton::CtrlButton( intf_thread_t *pIntf, const GenericBitmap &rBmpUp,
const GenericBitmap &rBmpOver,
const GenericBitmap &rBmpDown, CmdGeneric &rCommand,
const UString &rTooltip, const UString &rHelp ):
CtrlGeneric( pIntf, rHelp ), m_fsm( pIntf ), m_rCommand( rCommand ),
m_tooltip( rTooltip ),
const UString &rTooltip, const UString &rHelp,
VarBool *pVisible ):
CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ),
m_rCommand( rCommand ), m_tooltip( rTooltip ),
m_cmdUpOverDownOver( this, &transUpOverDownOver ),
m_cmdDownOverUpOver( this, &transDownOverUpOver ),
m_cmdDownOverDown( this, &transDownOverDown ),
......
......@@ -2,7 +2,7 @@
* ctrl_button.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_button.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_button.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -42,7 +42,7 @@ class CtrlButton: public CtrlGeneric
const GenericBitmap &rBmpOver,
const GenericBitmap &rBmpDown,
CmdGeneric &rCommand, const UString &rTooltip,
const UString &rHelp );
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlButton();
......
......@@ -2,7 +2,7 @@
* ctrl_checkbox.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_checkbox.cpp,v 1.2 2004/01/18 19:54:46 asmax Exp $
* $Id: ctrl_checkbox.cpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -41,8 +41,10 @@ CtrlCheckbox::CtrlCheckbox( intf_thread_t *pIntf,
CmdGeneric &rCommand1, CmdGeneric &rCommand2,
const UString &rTooltip1,
const UString &rTooltip2,
VarBool &rVariable, const UString &rHelp ):
CtrlGeneric( pIntf, rHelp ), m_fsm( pIntf ), m_rVariable( rVariable ),
VarBool &rVariable, const UString &rHelp,
VarBool *pVisible ):
CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ),
m_rVariable( rVariable ),
m_rCommand1( rCommand1 ), m_rCommand2( rCommand2 ),
m_tooltip1( rTooltip1 ), m_tooltip2( rTooltip2 ),
m_cmdUpOverDownOver( this, &transUpOverDownOver ),
......@@ -247,7 +249,7 @@ void CtrlCheckbox::transHiddenUp( SkinObject *pCtrl )
}
void CtrlCheckbox::onUpdate( Subject<VarBool> &rVariable )
void CtrlCheckbox::onVarBoolUpdate( VarBool &rVariable )
{
changeButton();
}
......
......@@ -2,7 +2,7 @@
* ctrl_checkbox.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_checkbox.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_checkbox.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -32,11 +32,10 @@
class GenericBitmap;
class OSGraphics;
class CmdGeneric;
class VarBool;
/// Base class for checkbox controls
class CtrlCheckbox: public CtrlGeneric, public Observer<VarBool>
class CtrlCheckbox: public CtrlGeneric
{
public:
/// Create a checkbox with 6 images
......@@ -49,7 +48,8 @@ class CtrlCheckbox: public CtrlGeneric, public Observer<VarBool>
const GenericBitmap &rBmpDown2,
CmdGeneric &rCommand1, CmdGeneric &rCommand2,
const UString &rTooltip1, const UString &rTooltip2,
VarBool &rVariable, const UString &rHelp );
VarBool &rVariable, const UString &rHelp,
VarBool *pVisible);
virtual ~CtrlCheckbox();
......@@ -112,7 +112,7 @@ class CtrlCheckbox: public CtrlGeneric, public Observer<VarBool>
static void transHiddenUp( SkinObject *pCtrl );
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarBool> &rVariable );
virtual void onVarBoolUpdate( VarBool &rVariable );
/// Helper function to update the current state of images
void changeButton();
......
......@@ -2,7 +2,7 @@
* ctrl_flat.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_flat.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_flat.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -32,8 +32,10 @@
class CtrlFlat: public CtrlGeneric
{
protected:
CtrlFlat( intf_thread_t *pIntf, const UString &rHelp ):
CtrlGeneric( pIntf, rHelp ) {}
CtrlFlat( intf_thread_t *pIntf, const UString &rHelp,
VarBool *pVisible ):
CtrlGeneric( pIntf, rHelp, pVisible ) {}
virtual ~CtrlFlat() {}
};
......
......@@ -2,7 +2,7 @@
* ctrl_generic.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_generic.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_generic.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -27,12 +27,19 @@
#include "../src/generic_window.hpp"
#include "../src/os_graphics.hpp"
#include "../utils/position.hpp"
#include "../utils/var_bool.hpp"
CtrlGeneric::CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp ):
CtrlGeneric::CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp,
VarBool *pVisible):
SkinObject( pIntf ), m_pLayout( NULL ), m_pPosition( NULL ),
m_help( rHelp )
m_help( rHelp ), m_pVisible( pVisible )
{
// Observe the visibility variable
if( m_pVisible )
{
m_pVisible->addObserver( this );
}
}
......@@ -42,6 +49,10 @@ CtrlGeneric::~CtrlGeneric()
{
delete m_pPosition;
}
if( m_pVisible )
{
m_pVisible->delObserver( this );
}
}
......@@ -108,3 +119,25 @@ GenericWindow *CtrlGeneric::getWindow() const
return NULL;
}
bool CtrlGeneric::isVisible() const
{
return !m_pVisible || m_pVisible->get();
}
void CtrlGeneric::onUpdate( Subject<VarBool> &rVariable )
{
// Is it the visibily variable ?
if( &rVariable == m_pVisible )
{
// Redraw the layout
notifyLayout();
}
else
{
// Call the user-defined callback
onVarBoolUpdate( (VarBool&)rVariable );
}
}
......@@ -2,7 +2,7 @@
* ctrl_generic.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_generic.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_generic.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -29,16 +29,18 @@
#include "../utils/pointer.hpp"
#include "../utils/fsm.hpp"
#include "../utils/ustring.hpp"
#include "../utils/observer.hpp"
class EvtGeneric;
class OSGraphics;
class GenericLayout;
class Position;
class GenericWindow;
class VarBool;
/// Base class for controls
class CtrlGeneric: public SkinObject
class CtrlGeneric: public SkinObject, public Observer<VarBool>
{
public:
virtual ~CtrlGeneric();
......@@ -73,8 +75,13 @@ class CtrlGeneric: public SkinObject
/// Return true if the control can gain the focus
virtual bool isFocusable() const { return false; }
/// Return true if the control is visible
virtual bool isVisible() const;
protected:
CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp );
// If pVisible is NULL, the control is always visible
CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp,
VarBool *pVisible = NULL );
/// Tell the layout when the image has changed
virtual void notifyLayout() const;
......@@ -95,6 +102,9 @@ class CtrlGeneric: public SkinObject
/// the Position object is set
virtual void onPositionChange() {}
/// Overload this method to get notified of bool variable changes
virtual void onVarBoolUpdate( VarBool &rVar ) {}
private:
/// Associated layout
GenericLayout *m_pLayout;
......@@ -102,6 +112,11 @@ class CtrlGeneric: public SkinObject
Position *m_pPosition;
/// Help text
UString m_help;
/// Visibilty variable
VarBool *m_pVisible;
/// Method called when an observed bool variable is changed
virtual void onUpdate( Subject<VarBool> &rVariable );
};
typedef CountedPtr<CtrlGeneric> CtrlGenericPtr;
......
......@@ -2,7 +2,7 @@
* ctrl_image.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_image.cpp,v 1.2 2004/02/01 14:44:11 asmax Exp $
* $Id: ctrl_image.cpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -32,8 +32,8 @@
CtrlImage::CtrlImage( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
const UString &rHelp ):
CtrlFlat( pIntf, rHelp ), m_rBitmap( rBitmap )
const UString &rHelp, VarBool *pVisible ):
CtrlFlat( pIntf, rHelp, pVisible ), m_rBitmap( rBitmap )
{
OSFactory *pOsFactory = OSFactory::instance( pIntf );
// Create an initial unscaled image in the buffer
......
......@@ -2,7 +2,7 @@
* ctrl_image.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_image.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_image.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -38,7 +38,7 @@ class CtrlImage: public CtrlFlat
public:
// Create an image with the given bitmap (which is NOT copied)
CtrlImage( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
const UString &rHelp );
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlImage();
/// Handle an event on the control
......
......@@ -2,7 +2,7 @@
* ctrl_list.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_list.cpp,v 1.2 2004/02/27 13:24:12 gbazin Exp $
* $Id: ctrl_list.cpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -41,8 +41,8 @@
CtrlList::CtrlList( intf_thread_t *pIntf, VarList &rList, GenericFont &rFont,
uint32_t fgColor, uint32_t playColor, uint32_t bgColor1,
uint32_t bgColor2, uint32_t selColor,
const UString &rHelp ):
CtrlGeneric( pIntf, rHelp ), m_rList( rList ), m_rFont( rFont ),
const UString &rHelp, VarBool *pVisible ):
CtrlGeneric( pIntf, rHelp, pVisible ), m_rList( rList ), m_rFont( rFont ),
m_fgColor( fgColor ), m_playColor( playColor ), m_bgColor1( bgColor1 ),
m_bgColor2( bgColor2 ), m_selColor( selColor ), m_pLastSelected( NULL ),
m_pImage( NULL ), m_lastPos( 0 )
......
......@@ -2,7 +2,7 @@
* ctrl_list.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_list.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_list.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -41,7 +41,7 @@ class CtrlList: public CtrlGeneric, public Observer<VarList>,
CtrlList( intf_thread_t *pIntf, VarList &rList, GenericFont &rFont,
uint32_t fgcolor, uint32_t playcolor, uint32_t bgcolor1,
uint32_t bgcolor2, uint32_t selColor,
const UString &rHelp );
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlList();
/// Handle an event on the control.
......
......@@ -2,7 +2,7 @@
* ctrl_move.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_move.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_move.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -33,8 +33,8 @@
CtrlMove::CtrlMove( intf_thread_t *pIntf, WindowManager &rWindowManager,
CtrlFlat &rCtrl, GenericWindow &rWindow,
const UString &rHelp ):
CtrlFlat( pIntf, rHelp ), m_fsm( pIntf ),
const UString &rHelp, VarBool *pVisible ):
CtrlFlat( pIntf, rHelp, pVisible ), m_fsm( pIntf ),
m_rWindowManager( rWindowManager ),
m_rCtrl( rCtrl ), m_rWindow( rWindow ),
m_cmdMovingMoving( this, &transMovingMoving ),
......
......@@ -2,7 +2,7 @@
* ctrl_move.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_move.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_move.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -39,7 +39,7 @@ class CtrlMove: public CtrlFlat
public:
CtrlMove( intf_thread_t *pIntf, WindowManager &rWindowManager,
CtrlFlat &rCtrl, GenericWindow &rWindow,
const UString &rHelp );
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlMove() {}
/// Handle an event
......
......@@ -2,7 +2,7 @@
* ctrl_radialslider.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_radialslider.cpp,v 1.2 2004/01/11 17:12:17 asmax Exp $
* $Id: ctrl_radialslider.cpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -36,8 +36,9 @@
CtrlRadialSlider::CtrlRadialSlider( intf_thread_t *pIntf,
const GenericBitmap &rBmpSeq, int numImg,
VarPercent &rVariable, float minAngle,
float maxAngle, const UString &rHelp ):
CtrlGeneric( pIntf, rHelp ), m_fsm( pIntf ), m_numImg( numImg ),
float maxAngle, const UString &rHelp,
VarBool *pVisible ):
CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ), m_numImg( numImg ),
m_rVariable( rVariable ), m_minAngle( minAngle ), m_maxAngle( maxAngle ),
m_cmdUpDown( this, &transUpDown ), m_cmdDownUp( this, &transDownUp ),
m_cmdMove( this, &transMove ), m_position( 0 ), m_lastPos( 0 )
......
......@@ -2,7 +2,7 @@
* ctrl_radialslider.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_radialslider.hpp,v 1.2 2004/01/11 17:12:17 asmax Exp $
* $Id: ctrl_radialslider.hpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -43,7 +43,8 @@ class CtrlRadialSlider: public CtrlGeneric, public Observer<VarPercent>
/// composed of numImg subimages of the same size
CtrlRadialSlider( intf_thread_t *pIntf, const GenericBitmap &rBmpSeq,
int numImg, VarPercent &rVariable, float minAngle,
float maxAngle, const UString &rHelp );
float maxAngle, const UString &rHelp,
VarBool *pVisible );
virtual ~CtrlRadialSlider();
......
......@@ -2,7 +2,7 @@
* ctrl_resize.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_resize.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_resize.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -33,8 +33,9 @@
CtrlResize::CtrlResize( intf_thread_t *pIntf, CtrlFlat &rCtrl,
GenericLayout &rLayout, const UString &rHelp ):
CtrlFlat( pIntf, rHelp ), m_fsm( pIntf ), m_rCtrl( rCtrl ),
GenericLayout &rLayout, const UString &rHelp,
VarBool *pVisible ):
CtrlFlat( pIntf, rHelp, pVisible ), m_fsm( pIntf ), m_rCtrl( rCtrl ),
m_rLayout( rLayout ), m_cmdResizeResize( this, &transResizeResize ),
m_cmdStillResize( this, &transStillResize ),
m_cmdResizeStill( this, &transResizeStill )
......
......@@ -2,7 +2,7 @@
* ctrl_resize.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_resize.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_resize.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -37,7 +37,8 @@ class CtrlResize: public CtrlFlat
{
public:
CtrlResize( intf_thread_t *pIntf, CtrlFlat &rCtrl,
GenericLayout &rLayout, const UString &rHelp );
GenericLayout &rLayout, const UString &rHelp,
VarBool *pVisible );
virtual ~CtrlResize() {}
/// Handle an event
......
......@@ -2,7 +2,7 @@
* ctrl_slider.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_slider.cpp,v 1.3 2004/02/01 21:13:04 ipkiss Exp $
* $Id: ctrl_slider.cpp,v 1.4 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -47,8 +47,8 @@ CtrlSliderCursor::CtrlSliderCursor( intf_thread_t *pIntf,
VarBool *pVisible,
const UString &rTooltip,
const UString &rHelp ):
CtrlGeneric( pIntf, rHelp ), m_fsm( pIntf ), m_rVariable( rVariable ),
m_pVisible( pVisible ), m_tooltip( rTooltip ),
CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ),
m_rVariable( rVariable ), m_tooltip( rTooltip ),
m_width( rCurve.getWidth() ), m_height( rCurve.getHeight() ),
m_cmdOverDown( this, &transOverDown ),
m_cmdDownOver( this, &transDownOver ), m_cmdOverUp( this, &transOverUp ),
......@@ -91,12 +91,6 @@ CtrlSliderCursor::CtrlSliderCursor( intf_thread_t *pIntf,
// Observe the position variable
m_rVariable.addObserver( this );
// Observe the visibility variable
if( m_pVisible )
{
m_pVisible->addObserver( this );
}
// Initial position of the cursor
m_lastPercentage = m_rVariable.get();
}
......@@ -105,10 +99,6 @@ CtrlSliderCursor::CtrlSliderCursor( intf_thread_t *pIntf,
CtrlSliderCursor::~CtrlSliderCursor()
{
m_rVariable.delObserver( this );
if( m_pVisible )
{
m_pVisible->delObserver( this );
}
SKINS_DELETE( m_pImgUp );
SKINS_DELETE( m_pImgDown );
SKINS_DELETE( m_pImgOver );
......@@ -150,7 +140,7 @@ bool CtrlSliderCursor::mouseOver( int x, int y ) const
void CtrlSliderCursor::draw( OSGraphics &rImage, int xDest, int yDest )
{
if( m_pImg && (!m_pVisible || m_pVisible->get()) )
if( m_pImg )
{
// Compute the position of the cursor
int xPos, yPos;
......@@ -177,13 +167,6 @@ void CtrlSliderCursor::onUpdate( Subject<VarPercent> &rVariable )
}
void CtrlSliderCursor::onUpdate( Subject<VarBool> &rVariable )
{
// The visibility variable has changed
notifyLayout();
}
void CtrlSliderCursor::transOverDown( SkinObject *pCtrl )
{
CtrlSliderCursor *pThis = (CtrlSliderCursor*)pCtrl;
......@@ -320,8 +303,8 @@ CtrlSliderBg::CtrlSliderBg( intf_thread_t *pIntf, CtrlSliderCursor &rCursor,
const Bezier &rCurve, VarPercent &rVariable,
int thickness, VarBool *pVisible,
const UString &rHelp ):
CtrlGeneric( pIntf, rHelp ), m_rCursor( rCursor ), m_rVariable( rVariable ),
m_thickness( thickness ), m_pVisible( pVisible ), m_curve( rCurve ),
CtrlGeneric( pIntf, rHelp, pVisible ), m_rCursor( rCursor ),
m_rVariable( rVariable ), m_thickness( thickness ), m_curve( rCurve ),
m_width( rCurve.getWidth() ), m_height( rCurve.getHeight() )
{
}
......@@ -329,11 +312,6 @@ CtrlSliderBg::CtrlSliderBg( intf_thread_t *pIntf, CtrlSliderCursor &rCursor,
bool CtrlSliderBg::mouseOver( int x, int y ) const
{
if( m_pVisible && !m_pVisible->get() )
{
return false;
}
// Compute the resize factors
float factorX, factorY;
getResizeFactors( factorX, factorY );
......@@ -392,13 +370,6 @@ void CtrlSliderBg::handleEvent( EvtGeneric &rEvent )
}
void CtrlSliderBg::onUpdate( Subject<VarBool> &rVariable )
{
// The visibility variable has changed
notifyLayout();
}
void CtrlSliderBg::getResizeFactors( float &rFactorX, float &rFactorY ) const
{
// Get the position of the control
......
......@@ -2,7 +2,7 @@
* ctrl_slider.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_slider.hpp,v 1.2 2004/01/11 17:12:17 asmax Exp $
* $Id: ctrl_slider.hpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -34,12 +34,10 @@
class GenericBitmap;
class OSGraphics;
class VarPercent;
class VarBool;
/// Cursor of a slider
class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent>,
public Observer<VarBool>
class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent>
{
public:
/// Create a cursor with 3 images (which are NOT copied, be careful)
......@@ -70,8 +68,6 @@ class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent>,
FSM m_fsm;
/// Variable associated to the cursor
VarPercent &m_rVariable;
/// Visibility variable
VarBool *m_pVisible;
/// Tooltip text
const UString m_tooltip;
/// Initial size of the control
......@@ -109,9 +105,6 @@ class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent>,
/// Method called when the position variable is modified
virtual void onUpdate( Subject<VarPercent> &rVariable );
/// Method called when the visibility variable is modified
virtual void onUpdate( Subject<VarBool> &rVariable );
/// Methode to compute the resize factors
void getResizeFactors( float &rFactorX, float &rFactorY ) const;
};
......@@ -121,7 +114,6 @@ class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent>,
class CtrlSliderBg: public CtrlGeneric
{
public:
/// If pVisible is NULL, the control is always visible
CtrlSliderBg( intf_thread_t *pIntf, CtrlSliderCursor &rCursor,
const Bezier &rCurve, VarPercent &rVariable,
int thickness, VarBool *pVisible, const UString &rHelp );
......@@ -140,8 +132,6 @@ class CtrlSliderBg: public CtrlGeneric
VarPercent &m_rVariable;
/// Thickness of the curve
int m_thickness;
/// Visibility variable
VarBool *m_pVisible;
/// Bezier curve of the slider
const Bezier m_curve;
/// Initial size of the control
......@@ -149,9 +139,6 @@ class CtrlSliderBg: public CtrlGeneric
/// Methode to compute the resize factors
void getResizeFactors( float &rFactorX, float &rFactorY ) const;
/// Method called when the visibility variable is modified
virtual void onUpdate( Subject<VarBool> &rVariable );
};
......
......@@ -2,7 +2,7 @@
* ctrl_text.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_text.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_text.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -42,9 +42,9 @@
CtrlText::CtrlText( intf_thread_t *pIntf, VarText &rVariable,
const GenericFont &rFont, const UString &rHelp,
uint32_t color ):
CtrlGeneric( pIntf, rHelp ), m_fsm( pIntf ), m_rVariable( rVariable ),
m_cmdToManual( this, &transToManual ),
uint32_t color, VarBool *pVisible ):
CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ),
m_rVariable( rVariable ), m_cmdToManual( this, &transToManual ),
m_cmdManualMoving( this, &transManualMoving ),
m_cmdManualStill( this, &transManualStill ),
m_cmdMove( this, &transMove ),
......
......@@ -2,7 +2,7 @@
* ctrl_text.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_text.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: ctrl_text.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -44,7 +44,7 @@ class CtrlText: public CtrlGeneric, public Observer<VarText>
/// Create a text control with the optional given color
CtrlText( intf_thread_t *pIntf, VarText &rVariable,
const GenericFont &rFont, const UString &rHelp,
uint32_t color = 0 );
uint32_t color, VarBool *pVisible );
virtual ~CtrlText();
/// Handle an event
......
......@@ -2,7 +2,7 @@
* builder.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: builder.cpp,v 1.6 2004/02/27 13:24:12 gbazin Exp $
* $Id: builder.cpp,v 1.7 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -216,7 +216,7 @@ void Builder::addButton( const BuilderData::Button &rData )
CtrlButton *pButton = new CtrlButton( getIntf(), *pBmpUp, *pBmpOver,
*pBmpDown, *pCommand, UString( getIntf(), rData.m_tooltip.c_str() ),
UString( getIntf(), rData.m_help.c_str() ) );
UString( getIntf(), rData.m_help.c_str() ), NULL );
// Compute the position of the control
// XXX (we suppose all the images have the same size...)
......@@ -287,7 +287,7 @@ void Builder::addCheckbox( const BuilderData::Checkbox &rData )
*pBmpOver1, *pBmpDown1, *pBmpUp2, *pBmpOver2, *pBmpDown2, *pCommand1,
*pCommand2, UString( getIntf(), rData.m_tooltip1.c_str() ),
UString( getIntf(), rData.m_tooltip2.c_str() ), *pVar,
UString( getIntf(), rData.m_help.c_str() ) );
UString( getIntf(), rData.m_help.c_str() ), NULL );
// Compute the position of the control
// XXX (we suppose all the images have the same size...)
......@@ -322,7 +322,8 @@ void Builder::addImage( const BuilderData::Image &rData )
}
CtrlImage *pImage = new CtrlImage( getIntf(), *pBmp,
UString( getIntf(), rData.m_help.c_str() ) );
UString( getIntf(), rData.m_help.c_str() ),
NULL);
// Compute the position of the control
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
......@@ -334,13 +335,14 @@ void Builder::addImage( const BuilderData::Image &rData )
if( rData.m_onclickId == "move" )
{
CtrlMove *pMove = new CtrlMove( getIntf(), m_pTheme->getWindowManager(),
*pImage, *pWindow, UString( getIntf(), rData.m_help.c_str() ) );
*pImage, *pWindow, UString( getIntf(), rData.m_help.c_str() ),
NULL);
pLayout->addControl( pMove, pos, rData.m_layer );
}
else if( rData.m_onclickId == "resize" )
{
CtrlResize *pResize = new CtrlResize( getIntf(), *pImage, *pLayout,
UString( getIntf(), rData.m_help.c_str() ) );
UString( getIntf(), rData.m_help.c_str() ), NULL );
pLayout->addControl( pResize, pos, rData.m_layer );
}
else
......@@ -375,7 +377,7 @@ void Builder::addText( const BuilderData::Text &rData )
m_pTheme->m_vars.push_back( VariablePtr( pVar ) );
CtrlText *pText = new CtrlText( getIntf(), *pVar, *pFont,
UString( getIntf(), rData.m_help.c_str() ) );
UString( getIntf(), rData.m_help.c_str() ), rData.m_color, NULL );
int height = pFont->getSize();
......@@ -414,7 +416,8 @@ void Builder::addRadialSlider( const BuilderData::RadialSlider &rData )
CtrlRadialSlider *pRadial =
new CtrlRadialSlider( getIntf(), *pSeq, rData.m_nbImages, *pVar,
rData.m_minAngle, rData.m_maxAngle,
UString( getIntf(), rData.m_help.c_str() ) );
UString( getIntf(), rData.m_help.c_str() ),
NULL );
// XXX: resizing is not supported
// Compute the position of the control
......@@ -524,7 +527,7 @@ void Builder::addList( const BuilderData::List &rData )
CtrlList *pList = new CtrlList( getIntf(), *pVar, *pFont,
rData.m_fgColor, rData.m_playColor, rData.m_bgColor1,
rData.m_bgColor2, rData.m_selColor,
UString( getIntf(), rData.m_help.c_str() ) );
UString( getIntf(), rData.m_help.c_str() ), NULL );
// Compute the position of the control
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
......
......@@ -7,7 +7,7 @@ Anchor xPos:int yPos:int range:int priority:int windowId:string
Button id:string xPos:int yPos:int leftTop:string rightBottom:string upId:string downId:string overId:string actionId:string tooltip:string help:string layer:int windowId:string layoutId:string
Checkbox id:string xPos:int yPos:int leftTop:string rightBottom:string up1Id:string down1Id:string over1Id:string up2Id:string down2Id:string over2Id:string state:string action1:string action2:string tooltip1:string tooltip2:string help:string layer:int windowId:string layoutId:string
Image id:string xPos:int yPos:int leftTop:string rightBottom:string visible:bool bmpId:string onclickId:string help:string layer:int windowId:string layoutId:string
Text id:string xPos:int yPos:int fontId:string text:string width:int help:string layer:int windowId:string layoutId:string
Text id:string xPos:int yPos:int fontId:string text:string width:int color:uint32_t help:string layer:int windowId:string layoutId:string
RadialSlider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string sequence:string nbImages:int minAngle:float maxAngle:float value:string tooltip:string help:string layer:int windowId:string layoutId:string
Slider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string upId:string downId:string overId:string points:string thickness:int value:string tooltip:string help:string layer:int windowId:string layoutId:string
List id:string xPos:int yPos:int width:int height:int leftTop:string rightBottom:string fontId:string var:string fgColor:uint32_t playColor:uint32_t bgColor1:uint32_t bgColor2:uint32_t selColor:uint32_t help:string layer:int windowId:string layoutId:string
......@@ -2,7 +2,7 @@
* builder_data.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: builder_data.hpp,v 1.4 2004/02/27 13:24:12 gbazin Exp $
* $Id: builder_data.hpp,v 1.5 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -28,12 +28,13 @@
#ifndef BUILDER_DATA_HPP
#define BUILDER_DATA_HPP
using namespace std;
#include <vlc/vlc.h>
#include <list>
#include <map>
#include <string>
using namespace std;
/// Structure for mapping data from XML file
struct BuilderData
{
......@@ -206,8 +207,8 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom(
/// Type definition
struct Text
{
Text( const string & id, int xPos, int yPos, const string & fontId, const string & text, int width, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_fontId( fontId ), m_text( text ), m_width( width ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
Text( const string & id, int xPos, int yPos, const string & fontId, const string & text, int width, uint32_t color, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_fontId( fontId ), m_text( text ), m_width( width ), m_color( color ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
const string m_id;
int m_xPos;
......@@ -215,6 +216,7 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_fontId( fontId ), m_text( text ),
const string m_fontId;
const string m_text;
int m_width;
uint32_t m_color;
const string m_help;
int m_layer;
const string m_windowId;
......
......@@ -2,7 +2,7 @@
* skin_parser.cpp
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: skin_parser.cpp,v 1.1 2004/01/25 11:44:19 asmax Exp $
* $Id: skin_parser.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
......@@ -163,7 +163,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
{
const BuilderData::Text textData( attr["id"], atoi( attr["x"] ) +
m_xOffset, atoi( attr["y"] ) + m_yOffset, attr["font"],
attr["text"], atoi( attr["width"] ), attr["help"], m_curLayer,
attr["text"], atoi( attr["width"] ),
ConvertColor( attr["color"] ), attr["help"], m_curLayer,
m_curWindowId, m_curLayoutId );
m_curLayer++;
m_data.m_listText.push_back( textData );
......
......@@ -2,7 +2,7 @@
* generic_layout.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: generic_layout.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: generic_layout.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -123,6 +123,7 @@ const list<LayeredControl> &GenericLayout::getControlList() const
void GenericLayout::onControlUpdate( const CtrlGeneric &rCtrl )
{
// TODO: refresh only the needed area if possible
refreshAll();
}
......@@ -181,11 +182,11 @@ void GenericLayout::refreshAll()
list<LayeredControl>::const_iterator iter;
for( iter = m_controlList.begin(); iter != m_controlList.end(); iter++ )
{
const Position *pPos = (*iter).m_pControl->getPosition();
if( pPos )
CtrlGeneric *pCtrl = (*iter).m_pControl;
const Position *pPos = pCtrl->getPosition();
if( pCtrl->isVisible() && pPos )
{
(*iter).m_pControl->draw( *m_pImage, pPos->getLeft(),
pPos->getTop() );
pCtrl->draw( *m_pImage, pPos->getLeft(), pPos->getTop() );
}
}
......
......@@ -2,7 +2,7 @@
* generic_window.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: generic_window.cpp,v 1.2 2004/01/25 21:38:57 asmax Exp $
* $Id: generic_window.cpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -503,8 +503,9 @@ CtrlGeneric *GenericWindow::findHitControl( int xPos, int yPos )
int xRel = xPos - pos->getLeft();
int yRel = yPos - pos->getTop();
CtrlGeneric *pCtrl = (*iter).m_pControl;
// Control hit ?
if( (*iter).m_pControl->mouseOver( xRel, yRel ) )
if( pCtrl->isVisible() && pCtrl->mouseOver( xRel, yRel ) )
{
pNewHitControl = (*iter).m_pControl;
break;
......
......@@ -176,11 +176,8 @@
y CDATA "0"
text CDATA "\0"
font CDATA #REQUIRED
align CDATA "left"
color CDATA "#000000"
width CDATA "0"
display CDATA "none"
scroll CDATA "true"
scrollspace CDATA "20"
help CDATA "\0"
>
<!ELEMENT Playlist (Slider)>
......
......@@ -77,7 +77,7 @@
<Group x="0" y="0">
<Anchor x="7" y="151" priority="100"/>
<Image x="0" y="0" image="mainbody" onclick="move"/>
<Text font="default_font" width="70" x="287" y="79" text="$T"/>
<Text font="default_font" width="70" x="287" y="79" text="$T" color="#000000"/>
<Button x="42" y="42" up="preferences" down="preferences_onclick" over="preferences" action="dialogs.prefs()" tooltiptext="Preferences"/>
<Button x="17" y="64" up="stop" down="stop_onclick" over="stop" action="vlc.stop()" tooltiptext="Stop"/>
<CheckBox x="42" y="87" up1="playlist_button" down1="playlist_button_onclick" up2="playlist_button2" down2="playlist_button_onclick2" state="playlist_window.isVisible" action1="playlist_window.show()" action2="playlist_window.hide()" tooltiptext1="Show Playlist" tooltiptext2="Hide Playlist"/>
......
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