Commit a5ca00dc authored by Cyril Deguet's avatar Cyril Deguet

* all: the vout window is now managed by a resizable control

    (on-the-fly resize still doesn't work; the vout has to be re-opened)
parent 02e2368f
......@@ -47,6 +47,8 @@ SOURCES_skins2 = \
controls/ctrl_radialslider.hpp \
controls/ctrl_text.hpp \
controls/ctrl_text.cpp \
controls/ctrl_video.cpp \
controls/ctrl_video.hpp \
\
events/evt_enter.hpp \
events/evt_generic.hpp \
......
/*****************************************************************************
* ctrl_video.cpp
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "ctrl_video.hpp"
#include "../src/theme.hpp"
#include "../src/vout_window.hpp"
#include "../src/os_graphics.hpp"
CtrlVideo::CtrlVideo( intf_thread_t *pIntf, WindowManager &rWindowManager,
const UString &rHelp, VarBool *pVisible ):
CtrlGeneric( pIntf, rHelp, pVisible ), m_rWindowManager( rWindowManager ),
m_pVout( NULL )
{
}
CtrlVideo::~CtrlVideo()
{
if( m_pVout )
{
delete m_pVout;
}
}
void CtrlVideo::handleEvent( EvtGeneric &rEvent )
{
}
bool CtrlVideo::mouseOver( int x, int y ) const
{
return false;
}
void CtrlVideo::onResize()
{
const Position *pPos = getPosition();
if( pPos && m_pVout )
{
m_pVout->move( pPos->getLeft(), pPos->getTop() );
m_pVout->resize( pPos->getWidth(), pPos->getHeight() );
}
}
void CtrlVideo::draw( OSGraphics &rImage, int xDest, int yDest )
{
GenericWindow *pParent = getWindow();
const Position *pPos = getPosition();
if( pParent && pPos )
{
// Draw a black rectangle under the video to avoid transparency
rImage.fillRect( pPos->getLeft(), pPos->getTop(), pPos->getWidth(),
pPos->getHeight(), 0 );
// Create a child window for the vout if it doesn't exist yet
if (!m_pVout)
{
m_pVout = new VoutWindow( getIntf(), pPos->getLeft(),
pPos->getTop(), m_rWindowManager, false,
false, *pParent );
m_pVout->resize( pPos->getWidth(), pPos->getHeight() );
m_pVout->show();
}
}
}
/*****************************************************************************
* ctrl_video.hpp
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef CTRL_VIDEO_HPP
#define CTRL_VIDEO_HPP
#include "ctrl_generic.hpp"
class VoutWindow;
class WindowManager;
/// Control video
class CtrlVideo: public CtrlGeneric
{
public:
CtrlVideo( intf_thread_t *pIntf, WindowManager &rWindowManager,
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlVideo();
/// Handle an event on the control
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Callback for layout resize
virtual void onResize();
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
private:
/// Window manager
WindowManager &m_rWindowManager;
/// Vout window
VoutWindow *m_pVout;
};
#endif
......@@ -43,6 +43,7 @@
#include "../controls/ctrl_slider.hpp"
#include "../controls/ctrl_radialslider.hpp"
#include "../controls/ctrl_text.hpp"
#include "../controls/ctrl_video.hpp"
#include "../utils/position.hpp"
#include "../utils/var_bool.hpp"
#include "../utils/var_text.hpp"
......@@ -562,17 +563,26 @@ void Builder::addList( const BuilderData::List &rData )
void Builder::addVideo( const BuilderData::Video &rData )
{
GenericWindow *pWindow = m_pTheme->m_windows[rData.m_windowId].get();
if( pWindow == NULL )
GenericLayout *pLayout = m_pTheme->m_layouts[rData.m_layoutId].get();
if( pLayout == NULL )
{
msg_Err( getIntf(), "unknown window id: %s", rData.m_windowId.c_str() );
msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
return;
}
VoutWindow *pVout = new VoutWindow( getIntf(), rData.m_xPos,
rData.m_yPos, m_pTheme->getWindowManager(), false, false,
*pWindow );
m_pTheme->m_vouts.push_back( VoutWindowPtr( pVout ) );
CtrlVideo *pVideo =
new CtrlVideo( getIntf(), m_pTheme->getWindowManager(),
UString( getIntf(), rData.m_help.c_str() ), NULL);
// Compute the position of the control
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
rData.m_xPos, rData.m_yPos,
rData.m_width, rData.m_height,
*pLayout );
pLayout->addControl( pVideo, pos, rData.m_layer );
m_pTheme->m_controls[rData.m_id] = CtrlGenericPtr( pVideo );
}
......
......@@ -30,7 +30,6 @@ Theme::~Theme()
saveConfig();
// Be sure things are destroyed in the right order (XXX check)
m_vouts.clear();
m_layouts.clear();
m_controls.clear();
m_windows.clear();
......
......@@ -27,7 +27,6 @@
#include "../src/generic_bitmap.hpp"
#include "../src/generic_font.hpp"
#include "../src/vout_window.hpp"
#include "../src/generic_layout.hpp"
#include "../src/window_manager.hpp"
#include "../commands/cmd_generic.hpp"
......@@ -77,8 +76,6 @@ class Theme: public SkinObject
list<BezierPtr> m_curves;
/// Store the variables
list<VariablePtr> m_vars;
/// Store the vout windows
list<VoutWindowPtr> m_vouts;
private:
WindowManager m_windowManager;
......
......@@ -28,7 +28,6 @@
#include "../parser/skin_parser.hpp"
#include "../src/os_factory.hpp"
#include "../src/window_manager.hpp"
#include "../src/vout_window.hpp"
#include <fcntl.h>
#if !defined( WIN32 )
......@@ -89,15 +88,6 @@ bool ThemeLoader::load( const string &fileName )
pNewTheme->getWindowManager().showAll();
}
// XXX show the vout window
list<VoutWindowPtr> &vouts = getIntf()->p_sys->p_theme->m_vouts;
if (vouts.size() > 0)
{
VoutWindow *pVout = (vouts.back()).get();
// XXX hardcoded
pVout->resize(350,220);
pVout->show();
}
return true;
}
......
......@@ -119,14 +119,23 @@
</Layout>
</Window>
<Window x="10" y="10" dragdrop="false">
<Layout width="410" height="250">
<Group x="0" y="0">
<Image x="0" y="0" image="vout" action="move"/>
<Video x="15" y="13" width="350" height="220"/>
</Group>
<Window x="10" y="10" visible="false">
<Layout width="410" height="250" minwidth="200" minheight="150" maxwidth="1000" maxheight="800">
<Group x="0" y="0">
<Image image="playlist1" x="0" y="0" lefttop="lefttop" rightbottom="lefttop" action="move"/>
<Image image="playlist2" x="17" y="0" lefttop="lefttop" rightbottom="righttop" action="move"/>
<Image image="playlist3" x="350" y="0" lefttop="righttop" rightbottom="righttop" action="move"/>
<Image image="playlist4" x="0" y="70" lefttop="lefttop" rightbottom="leftbottom" action="move"/>
<Image image="playlist6" x="350" y="70" lefttop="righttop" rightbottom="rightbottom" action="move"/>
<Image image="playlist7" x="0" y="200" lefttop="leftbottom" rightbottom="leftbottom" action="move"/>
<Image image="playlist8" x="17" y="200" lefttop="leftbottom" rightbottom="rightbottom" action="move"/>
<Image image="playlist9" x="350" y="200" lefttop="rightbottom" rightbottom="rightbottom" action="move"/>
<Image image="resize" x="392" y="232" lefttop="rightbottom" rightbottom="rightbottom" action="resize"/>
<Video x="15" y="13" width="350" height="220" lefttop="lefttop" rightbottom="rightbottom"/>
</Group>
</Layout>
</Window>
</Theme>
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