* wrappers.cpp: Wrappers around C++ objects
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: wrappers.cpp,v 1.11 2003/06/22 00:00:28 asmax Exp $
+ * $Id: wrappers.cpp,v 1.12 2003/06/22 12:46:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
void AddAnchor( char *x, char *y, char *len, char *priority )
{
int XOff, YOff;
- SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
+ SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
char *event, char *help )
{
int XOff, YOff;
- SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
+ SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
char *color, char *event, char *help )
{
int XOff, YOff;
- SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
+ SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
char *tooltiptext, char *help )
{
int XOff, YOff;
- SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
+ SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
char *tooltiptext1, char *tooltiptext2, char *help )
{
int XOff, YOff;
- SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
+ SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
ConvertCoords( abs, p_abs );
ConvertCoords( ord, p_ord );
- SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
+ SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
// Move control
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
ConvertCoords( abs, p_abs );
ConvertCoords( ord, p_ord );
- SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
+ SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
// Move control
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
char *help )
{
int XOff, YOff;
- SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
+ SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
* event.cpp: Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: event.cpp,v 1.18 2003/06/22 00:00:28 asmax Exp $
+ * $Id: event.cpp,v 1.19 2003/06/22 12:46:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
list<SkinWindow *>::const_iterator win;
unsigned int i;
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( win = p_intf->p_sys->p_theme->WindowList.begin();
+ win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
for( i = 0; i < (*win)->ControlList.size(); i++ )
{
* event.h: Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: event.h,v 1.11 2003/06/22 00:00:28 asmax Exp $
+ * $Id: event.h,v 1.12 2003/06/22 12:46:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
// VLC messages
#define VLC_NOTHING (VLC_MESSAGE + 1)
-#define VLC_HIDE (VLC_MESSAGE + 2)
+#define VLC_SHOW (VLC_MESSAGE + 2)
+#define VLC_HIDE (VLC_MESSAGE + 3)
#define VLC_QUIT (VLC_MESSAGE + 4)
#define VLC_OPEN (VLC_MESSAGE + 5)
* theme.cpp: Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: theme.cpp,v 1.15 2003/06/22 00:00:28 asmax Exp $
+ * $Id: theme.cpp,v 1.16 2003/06/22 12:46:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
{
// Delete the windows
list<SkinWindow *>::const_iterator win;
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( win = WindowList.begin(); win != WindowList.end(); win++ )
{
delete (OSWindow *)(*win);
}
Event *evt2;
// Synchronize control to visible aspect
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( win = WindowList.begin(); win != WindowList.end(); win++ )
{
// Synchronize windows visibility
if( (*win)->OnStartThemeVisible )
CheckAnchors();
// Show windows
- for( list<SkinWindow *>::const_iterator win =
- SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
- {
- if( (*win)->OnStartThemeVisible )
- OSAPI_PostMessage( (*win), WINDOW_OPEN, 1, 0 );
- }
- p_intf->p_sys->b_all_win_closed = false;
+ OSAPI_PostMessage( NULL, VLC_SHOW, 0, 0 );
}
//---------------------------------------------------------------------------
void Theme::CreateSystemMenu()
int x, y, v, scan;
// Get config for each window
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( win = WindowList.begin(); win != WindowList.end(); win++ )
{
// Get config
scan = sscanf( &save[i * 13], "(%4d,%4d,%1d)", &x, &y, &v );
int x, y;
// Save config of every window
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( win = WindowList.begin(); win != WindowList.end(); win++ )
{
// Print config
(*win)->GetPos( x, y );
//---------------------------------------------------------------------------
void Theme::InitWindows()
{
- list<SkinWindow *>::const_iterator win;
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( list<SkinWindow *>::const_iterator win = WindowList.begin();
+ win != WindowList.end(); win++ )
{
(*win)->Init();
}
//---------------------------------------------------------------------------
void Theme::InitControls()
{
- list<SkinWindow *>::const_iterator win;
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( list<SkinWindow *>::const_iterator win = WindowList.begin();
+ win != WindowList.end(); win++ )
{
for( unsigned int i = 0; i < (*win)->ControlList.size(); i++ )
{
//---------------------------------------------------------------------------
SkinWindow * Theme::GetWindow( string name )
{
- list<SkinWindow *>::const_iterator win;
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( list<SkinWindow *>::const_iterator win = WindowList.begin();
+ win != WindowList.end(); win++ )
{
if( name == OSAPI_GetWindowTitle( *win ) )
{
// All windows can be moved
list<SkinWindow *>::const_iterator win;
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
- {
+ for( win = WindowList.begin(); win != WindowList.end(); win++ )
(*win)->Moved = false;
- }
// Move Window
MoveSkin( wnd, NewLeft - Wx, NewTop - Wy );
list<Anchor *>::const_iterator win_anchor, wnd_anchor;
// Parse list of windows
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( win = WindowList.begin(); win != WindowList.end(); win++ )
{
// If window is moved window
if( (*win) == wnd )
list<SkinWindow *>::const_iterator win;
int x, y;
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( win = WindowList.begin(); win != WindowList.end(); win++ )
{
(*win)->GetPos( x, y );
HangToAnchors( (*win), x, y, true );
* theme.h: Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: theme.h,v 1.4 2003/06/22 00:00:28 asmax Exp $
+ * $Id: theme.h,v 1.5 2003/06/22 12:46:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
FontBank *FntBank;
OffSetBank *OffBank;
+ // List of the windows of the skin
+ list<SkinWindow *> WindowList;
+
// Magetism
void HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init = false );
bool MoveSkinMagnet( SkinWindow *wnd, int left, int top );
* vlcproc.cpp: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.cpp,v 1.37 2003/06/22 00:00:28 asmax Exp $
+ * $Id: vlcproc.cpp,v 1.38 2003/06/22 12:46:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
case VLC_HIDE:
for( list<SkinWindow *>::const_iterator win =
- SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ p_intf->p_sys->p_theme->WindowList.begin();
+ win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
(*win)->OnStartThemeVisible = !(*win)->IsHidden();
}
OSAPI_PostMessage( NULL, WINDOW_CLOSE, 1, 0 );
return true;
+ case VLC_SHOW:
+ for( list<SkinWindow *>::const_iterator win =
+ p_intf->p_sys->p_theme->WindowList.begin();
+ win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+ {
+ if( (*win)->OnStartThemeVisible )
+ OSAPI_PostMessage( (*win), WINDOW_OPEN, 1, 0 );
+ }
+ p_intf->p_sys->b_all_win_closed = false;
+ return true;
+
case VLC_OPEN:
p_intf->p_sys->p_dialogs->ShowOpen( true );
InterfaceRefresh();
list<SkinWindow *>::const_iterator win;
// If a window has been closed, test if all are closed !
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( win = p_intf->p_sys->p_theme->WindowList.begin();
+ win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
if( !(*win)->IsHidden() ) // Not all windows closed
{
delete Loader;
// Uninitialize new theme
- delete (char *)p_intf->p_sys->p_new_theme_file;
+ delete[] p_intf->p_sys->p_new_theme_file;
p_intf->p_sys->p_new_theme_file = NULL;
}
}
* window.cpp: Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: window.cpp,v 1.31 2003/06/22 00:00:28 asmax Exp $
+ * $Id: window.cpp,v 1.32 2003/06/22 12:46:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
- * Cyril Deguet <asmax@videolan.org>
*
* 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
x = Left;
y = Top;
}
-
-//---------------------------------------------------------------------------
-// List of all the Skin Windows (singleton)
-//---------------------------------------------------------------------------
-SkinWindowList *SkinWindowList::_instance = NULL;
-//---------------------------------------------------------------------------
-SkinWindowList::SkinWindowList()
-{
-}
-//---------------------------------------------------------------------------
-SkinWindowList *SkinWindowList::Instance()
-{
- if( _instance == NULL )
- {
- _instance = new SkinWindowList;
- }
- return _instance;
-}
-//---------------------------------------------------------------------------
-void SkinWindowList::Add( SkinWindow *win )
-{
- _list.push_back( win );
-}
-//---------------------------------------------------------------------------
-SkinWindow *SkinWindowList::Back()
-{
- return _list.back();
-}
-//---------------------------------------------------------------------------
-list<SkinWindow*>::const_iterator SkinWindowList::Begin()
-{
- return _list.begin();
-}
-//---------------------------------------------------------------------------
-list<SkinWindow*>::const_iterator SkinWindowList::End()
-{
- return _list.end();
-}
//---------------------------------------------------------------------------
+
* window.h: Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: window.h,v 1.4 2003/06/22 00:00:28 asmax Exp $
+ * $Id: window.h,v 1.5 2003/06/22 12:46:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
intf_thread_t *GetIntf() { return p_intf; }
};
//---------------------------------------------------------------------------
-class SkinWindowList
-{
- private:
- static SkinWindowList *_instance;
- list<SkinWindow*> _list;
-
- SkinWindowList();
-
- public:
- static SkinWindowList *Instance();
- void Add( SkinWindow *win );
- SkinWindow *Back();
- list<SkinWindow*>::const_iterator Begin();
- list<SkinWindow*>::const_iterator End();
-};
-//---------------------------------------------------------------------------
#endif
* win32_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: win32_run.cpp,v 1.19 2003/06/22 00:00:28 asmax Exp $
+ * $Id: win32_run.cpp,v 1.20 2003/06/22 12:46:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
while( GetMessage( &msg, NULL, 0, 0 ) )
{
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( win = p_intf->p_sys->p_theme->WindowList.begin();
+ win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
if( msg.hwnd == NULL ||
msg.hwnd == ((Win32Window*)(*win))->GetHandle() )
break;
}
}
- if( win == SkinWindowList::Instance()->End() )
+ if( win == p_intf->p_sys->p_theme->WindowList.end() )
{
// DispatchMessage( &msg );
// DefWindowProc( msg.hwnd, msg.message, msg.wParam, msg.lParam );
**********************/
else if( msg.hwnd == NULL )
{
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( win = p_intf->p_sys->p_theme->WindowList.begin();
+ win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
(*win)->ProcessEvent( ProcessEvent );
}
* win32_theme.cpp: Win32 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: win32_theme.cpp,v 1.8 2003/06/22 00:00:28 asmax Exp $
+ * $Id: win32_theme.cpp,v 1.9 2003/06/22 12:46:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
// Find window matching with hwnd
list<SkinWindow *>::const_iterator win;
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( win = p_intf->p_sys->p_theme->WindowList.begin();
+ win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
// If it is the correct window
if( hwnd == ( (Win32Window *)(*win) )->GetHandle() )
SetWindowLongPtr( hwnd, GWLP_USERDATA, (LONG_PTR)p_intf );
- SkinWindowList::Instance()->Add( (SkinWindow *)new OSWindow( p_intf,
- hwnd, x, y, visible, fadetime, alpha, movealpha, dragdrop ) ) ;
+ WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, hwnd, x, y,
+ visible, fadetime, alpha, movealpha, dragdrop ) ) ;
}
//---------------------------------------------------------------------------
void Win32Theme::ChangeTray()
* x11_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_run.cpp,v 1.22 2003/06/22 00:00:28 asmax Exp $
+ * $Id: x11_run.cpp,v 1.23 2003/06/22 12:46:49 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
else if( wnd == p_intf->p_sys->mainWin )
{
// Broadcast event
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( win = p_intf->p_sys->p_theme->WindowList.begin();
+ win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
(*win)->ProcessEvent( evt );
}
else
{
// Find window matching with gwnd
- for( win = SkinWindowList::Instance()->Begin();
- win != SkinWindowList::Instance()->End(); win++ )
+ for( win = p_intf->p_sys->p_theme->WindowList.begin();
+ win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
// If it is the correct window
if( wnd == ( (X11Window *)(*win) )->GetHandle() )
* x11_theme.cpp: X11 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_theme.cpp,v 1.14 2003/06/22 00:00:28 asmax Exp $
+ * $Id: x11_theme.cpp,v 1.15 2003/06/22 12:46:49 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
XStoreName( display, wnd, name.c_str() );
XUNLOCK;
- SkinWindowList::Instance()->Add( (SkinWindow *)new OSWindow( p_intf, wnd,
- x, y, visible, fadetime, alpha, movealpha, dragdrop, name ) ) ;
+ WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, wnd, x, y,
+ visible, fadetime, alpha, movealpha, dragdrop, name ) ) ;
}
//---------------------------------------------------------------------------
void X11Theme::ChangeTray()