src/var_manager.hpp \
src/vlcproc.cpp \
src/vlcproc.hpp \
+ src/vout_window.cpp \
+ src/vout_window.hpp \
src/window_manager.cpp \
src/window_manager.hpp \
\
#include "../src/os_factory.hpp"
#include "../src/generic_bitmap.hpp"
#include "../src/generic_window.hpp"
+#include "../src/vout_window.hpp"
#include "../src/anchor.hpp"
#include "../src/ft2_font.hpp"
#include "../src/theme.hpp"
ADD_OBJECTS( RadialSlider );
ADD_OBJECTS( Slider );
ADD_OBJECTS( List );
+ ADD_OBJECTS( Video );
return m_pTheme;
}
}
+void Builder::addVideo( const BuilderData::Video &rData )
+{
+ GenericWindow *pWindow = m_pTheme->m_windows[rData.m_windowId].get();
+ if( pWindow == NULL )
+ {
+ msg_Err( getIntf(), "unknown window id: %s", rData.m_windowId.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 ) );
+}
+
+
const Position Builder::makePosition( const string &rLeftTop,
const string &rRightBottom,
int xPos, int yPos, int width,
* builder.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: builder.hpp,v 1.4 2004/03/01 18:33:31 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
void addRadialSlider( const BuilderData::RadialSlider &rData );
void addSlider( const BuilderData::Slider &rData );
void addList( const BuilderData::List &rData );
+ void addVideo( const BuilderData::Video &rData );
/// Compute the position of a control
const Position makePosition( const string &rLeftTop,
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
+Video id:string xPos:int yPos:int width:int height:int leftTop:string rightBottom:string visible:bool help:string layer:int windowId:string layoutId:string
/// List
list<List> m_listList;
+ /// Type definition
+ struct Video
+ {
+ Video( const string & id, int xPos, int yPos, int width, int height, const string & leftTop, const string & rightBottom, bool visible, const string & help, int layer, const string & windowId, const string & layoutId ):
+m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_width( width ), m_height( height ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_visible( visible ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
+
+ const string m_id;
+ int m_xPos;
+ int m_yPos;
+ int m_width;
+ int m_height;
+ const string m_leftTop;
+ const string m_rightBottom;
+ bool m_visible;
+ const string m_help;
+ int m_layer;
+ const string m_windowId;
+ const string m_layoutId;
+ };
+ /// List
+ list<Video> m_listVideo;
+
};
* builder_data.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: gen_builder.py,v 1.2 2004/03/02 21:45:15 ipkiss Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
attr["author"] );
}
+ else if( rName == "Video" )
+ {
+ const BuilderData::Video videoData( uniqueId( attr["id"] ),
+ atoi( attr["x"] ) + m_xOffset, atoi( attr["y"] ) + m_yOffset,
+ atoi( attr["width"] ), atoi( attr["height" ]),
+ attr["lefttop"], attr["rightbottom"],
+ ConvertBoolean( attr["visible"] ), attr["help"], m_curLayer,
+ m_curWindowId, m_curLayoutId );
+ m_curLayer++;
+ m_data.m_listVideo.push_back( videoData );
+ }
+
else if( rName == "Window" )
{
m_curWindowId = uniqueId( attr["id"] );
GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
WindowManager &rWindowManager,
- bool dragDrop, bool playOnDrop ):
+ bool dragDrop, bool playOnDrop,
+ GenericWindow *pParent ):
SkinObject( pIntf ), m_rWindowManager( rWindowManager ),
m_left( left ), m_top( top ), m_width( 0 ), m_height( 0 ),
- m_pActiveLayout( NULL ), m_pLastHitControl( NULL ),
+ m_isChild( true ), m_pActiveLayout( NULL ), m_pLastHitControl( NULL ),
m_pCapturingControl( NULL ), m_pFocusControl( NULL ), m_varVisible( pIntf ),
m_currModifier( 0 )
{
- // Register as a moving window
- m_rWindowManager.registerWindow( *this );
-
- // Get the OSFactory
+ // Get the OSFactory
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+ // Get the parent OSWindow, if any
+ OSWindow *pOSParent = NULL;
+ if( pParent )
+ {
+ pOSParent = pParent->m_pOsWindow;
+ }
+
// Create an OSWindow to handle OS specific processing
- m_pOsWindow = pOsFactory->createOSWindow( *this, dragDrop, playOnDrop );
+ m_pOsWindow = pOsFactory->createOSWindow( *this, dragDrop, playOnDrop,
+ pOSParent );
+
+ // Child windows don't need that
+ if( !pParent )
+ {
+ m_isChild = false;
+ // Register as a moving window
+ m_rWindowManager.registerWindow( *this );
+ }
// Observe the visibility variable
m_varVisible.addObserver( this );
GenericWindow::~GenericWindow()
{
+ if( !m_isChild )
+ {
+ // Unregister from the window manager
+ m_rWindowManager.unregisterWindow( *this );
+ }
m_varVisible.delObserver( this );
- // Unregister from the window manager
- m_rWindowManager.unregisterWindow( *this );
if( m_pOsWindow )
{
public:
GenericWindow( intf_thread_t *pIntf, int xPos, int yPos,
WindowManager &rWindowManager,
- bool dragDrop, bool playOnDrop );
+ bool dragDrop, bool playOnDrop,
+ GenericWindow *pParent = NULL );
virtual ~GenericWindow();
/// Methods to process OS events.
WindowManager &m_rWindowManager;
/// Window position and size
int m_left, m_top, m_width, m_height;
+ /// Flag set if the window has a parent
+ bool m_isChild;
/// OS specific implementation
OSWindow *m_pOsWindow;
/// Current active layout of the window
/// Instantiate an object OSWindow.
virtual OSWindow *createOSWindow( GenericWindow &rWindow,
- bool dragDrop, bool playOnDrop ) = 0;
+ bool dragDrop, bool playOnDrop,
+ OSWindow *pParent ) = 0;
/// Instantiate an object OSTooltip.
virtual OSTooltip *createOSTooltip() = 0;
* theme.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: theme.cpp,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>
saveConfig();
// Be sure things are destroyed in the right order (XXX check)
+ m_vouts.clear();
m_layouts.clear();
m_controls.clear();
m_windows.clear();
* theme.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: theme.hpp,v 1.3 2004/02/01 16:15:40 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
#include "../src/generic_bitmap.hpp"
#include "../src/generic_font.hpp"
-#include "../src/generic_window.hpp"
+#include "../src/vout_window.hpp"
#include "../src/generic_layout.hpp"
#include "../src/window_manager.hpp"
#include "../commands/cmd_generic.hpp"
list<BezierPtr> m_curves;
/// Store the variables
list<VariablePtr> m_vars;
+ /// Store the vout windows
+ list<VoutWindowPtr> m_vouts;
private:
WindowManager m_windowManager;
#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 )
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;
}
--- /dev/null
+/*****************************************************************************
+ * vout_window.cpp
+ *****************************************************************************
+ * Copyright (C) 2003 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 "vout_window.hpp"
+#include "os_factory.hpp"
+#include "os_window.hpp"
+
+
+VoutWindow::VoutWindow( intf_thread_t *pIntf, int left, int top,
+ WindowManager &rWindowManager,
+ bool dragDrop, bool playOnDrop, GenericWindow &rParent ):
+ GenericWindow( pIntf, left, top, rWindowManager, dragDrop, playOnDrop,
+ &rParent )
+{
+}
+
+
+VoutWindow::~VoutWindow()
+{
+ // XXX we should stop the vout before destroying the window!
+}
+
--- /dev/null
+/*****************************************************************************
+ * vout_window.hpp
+ *****************************************************************************
+ * Copyright (C) 2003 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 VOUT_WINDOW_HPP
+#define VOUT_WINDOW_HPP
+
+#include "generic_window.hpp"
+
+
+/// Class to handle a video output window
+class VoutWindow: public GenericWindow
+{
+ public:
+ VoutWindow( intf_thread_t *pIntf, int xPos, int yPos,
+ WindowManager &rWindowManager,
+ bool dragDrop, bool playOnDrop, GenericWindow &rParent );
+ virtual ~VoutWindow();
+};
+
+typedef CountedPtr<VoutWindow> VoutWindowPtr;
+
+#endif
maxheight CDATA "-1"
>
<!ELEMENT Group (Group|Image|Button|Playlist|Slider|RadialSlider|Text|CheckBox|
- Anchor)+>
+ Anchor|Video)+>
<!ATTLIST Group
x CDATA "0"
y CDATA "0"
selcolor CDATA "#0000FF"
help CDATA ""
>
+<!ELEMENT Video EMPTY>
+ <!ATTLIST Video
+ id CDATA "none"
+ visible CDATA "true"
+ x CDATA "0"
+ y CDATA "0"
+ width CDATA "0"
+ height CDATA "0"
+ lefttop CDATA "lefttop"
+ rightbottom CDATA "lefttop"
+ help CDATA ""
+ >
<Bitmap id="stop_disabled" file="stop_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="stop_onclick" file="stop_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="volume_radial" file="volume.png" alphacolor="#FF0000"/>
+ <Bitmap id="vout" file="vout.png" alphacolor="#FF0000"/>
+
<Font id="default_font" font="FreeSansBold.ttf" size="15"/>
<Font id="playlist_font" font="FreeSansBold.ttf" size="12"/>
</Group>
</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>
+ </Layout>
+ </Window>
+
</Theme>
/// Instantiate an OSWindow object
virtual OSWindow *createOSWindow( GenericWindow &rWindow,
- bool dragDrop, bool playOnDrop );
+ bool dragDrop, bool playOnDrop,
+ OSWindow *pParent );
/// Instantiate an object OSTooltip.
virtual OSTooltip *createOSTooltip();
* x11_display.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_display.cpp,v 1.4 2004/01/25 18:46:37 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
{
// Open a connection to the X Server
m_pDisplay = XOpenDisplay( NULL );
+
if( m_pDisplay == NULL )
{
MSG_ERR( "Cannot open display" );
* x11_display.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_display.hpp,v 1.2 2004/01/25 18:41:08 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
/// Get the pixel value corresponding to the given colors
unsigned long getPixelValue( uint8_t r, uint8_t g, uint8_t b ) const;
+ //XXX
+ Window m_voutWindow;
+
private:
/// Display parameters
Display *m_pDisplay;
* x11_factory.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_factory.cpp,v 1.2 2004/01/25 13:59:33 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
OSWindow *X11Factory::createOSWindow( GenericWindow &rWindow, bool dragDrop,
- bool playOnDrop )
+ bool playOnDrop, OSWindow *pParent )
{
return new X11Window( getIntf(), rWindow, *m_pDisplay, dragDrop,
- playOnDrop );
+ playOnDrop, (X11Window*)pParent );
}
/// Instantiate an OSWindow object
virtual OSWindow *createOSWindow( GenericWindow &rWindow,
- bool dragDrop, bool playOnDrop );
+ bool dragDrop, bool playOnDrop,
+ OSWindow *pParent );
/// Instantiate an object OSTooltip.
virtual OSTooltip *createOSTooltip();
* x11_graphics.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_graphics.cpp,v 1.2 2004/01/25 18:41:08 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
XGCValues xgcvalues;
xgcvalues.graphics_exposures = False;
m_gc = XCreateGC( XDISPLAY, m_pixmap, GCGraphicsExposures, &xgcvalues );
-
}
X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
- X11Display &rDisplay, bool dragDrop, bool playOnDrop ):
+ X11Display &rDisplay, bool dragDrop, bool playOnDrop,
+ X11Window *pParentWindow ):
OSWindow( pIntf ), m_rDisplay( rDisplay ), m_dragDrop( dragDrop )
{
- Window root = DefaultRootWindow( XDISPLAY );
+ Window parent;
+ if (pParentWindow)
+ {
+ parent = pParentWindow->m_wnd;
+ }
+ else
+ {
+ parent = DefaultRootWindow( XDISPLAY );
+ }
XSetWindowAttributes attr;
// Create the window
- m_wnd = XCreateWindow( XDISPLAY, root, 0, 0, 1, 1, 0, 0,
+ m_wnd = XCreateWindow( XDISPLAY, parent, 0, 0, 1, 1, 0, 0,
InputOutput, CopyFromParent, 0, &attr );
// Set the colormap for 8bpp mode
}
// Select events received by the window
- XSelectInput( XDISPLAY, m_wnd, ExposureMask|KeyPressMask|PointerMotionMask|
- ButtonPressMask|ButtonReleaseMask|LeaveWindowMask|
- FocusChangeMask );
+ XSelectInput( XDISPLAY, m_wnd, ExposureMask|KeyPressMask|
+ PointerMotionMask|ButtonPressMask|ButtonReleaseMask|
+ LeaveWindowMask|FocusChangeMask );
// Store a pointer on the generic window in a map
X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() );
// Change the window title XXX
XStoreName( XDISPLAY, m_wnd, "VLC" );
+
+ // XXX Kludge to tell VLC that this window is the vout
+ if (pParentWindow)
+ {
+ vlc_value_t value;
+ value.i_int = (int) (ptrdiff_t) (void *) m_wnd;
+ var_Set( getIntf()->p_vlc, "drawable", value );
+ }
}
{
public:
X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
- X11Display &rDisplay, bool dragDrop, bool playOnDrop );
+ X11Display &rDisplay, bool dragDrop, bool playOnDrop,
+ X11Window *pParentWindow );
virtual ~X11Window();