Commit fbe7f701 authored by Cyril Deguet's avatar Cyril Deguet

* reverted my previous commit: cannot work as expected

* src/theme.cpp: fixed a delete[] / free mismatch
parent e265882b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wrappers.cpp: Wrappers around C++ objects * wrappers.cpp: Wrappers around C++ objects
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -117,7 +117,7 @@ void EndControlGroup() ...@@ -117,7 +117,7 @@ void EndControlGroup()
void AddAnchor( char *x, char *y, char *len, char *priority ) void AddAnchor( char *x, char *y, char *len, char *priority )
{ {
int XOff, YOff; 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 ); g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
...@@ -137,7 +137,7 @@ void AddImage( char *id, char *visible, char *x, char *y, char *image, ...@@ -137,7 +137,7 @@ void AddImage( char *id, char *visible, char *x, char *y, char *image,
char *event, char *help ) char *event, char *help )
{ {
int XOff, YOff; 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 ); g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
...@@ -150,7 +150,7 @@ void AddRectangle( char *id, char *visible, char *x, char *y, char *w, char *h, ...@@ -150,7 +150,7 @@ void AddRectangle( char *id, char *visible, char *x, char *y, char *w, char *h,
char *color, char *event, char *help ) char *color, char *event, char *help )
{ {
int XOff, YOff; 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 ); g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
...@@ -168,7 +168,7 @@ void AddButton( ...@@ -168,7 +168,7 @@ void AddButton(
char *tooltiptext, char *help ) char *tooltiptext, char *help )
{ {
int XOff, YOff; 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 ); g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
...@@ -193,7 +193,7 @@ void AddCheckBox( ...@@ -193,7 +193,7 @@ void AddCheckBox(
char *tooltiptext1, char *tooltiptext2, char *help ) char *tooltiptext1, char *tooltiptext2, char *help )
{ {
int XOff, YOff; 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 ); g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
...@@ -231,7 +231,7 @@ void AddSlider( char *id, char *visible, char *x, char *y, char *type, char *up, ...@@ -231,7 +231,7 @@ void AddSlider( char *id, char *visible, char *x, char *y, char *type, char *up,
ConvertCoords( abs, p_abs ); ConvertCoords( abs, p_abs );
ConvertCoords( ord, p_ord ); ConvertCoords( ord, p_ord );
SkinWindow *vlcWin = SkinWindowList::Instance()->Back(); SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
// Move control // Move control
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff ); g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
...@@ -286,7 +286,7 @@ void AddPlayList( char *id, char *visible, char *x, char *y, char *width, ...@@ -286,7 +286,7 @@ void AddPlayList( char *id, char *visible, char *x, char *y, char *width,
ConvertCoords( abs, p_abs ); ConvertCoords( abs, p_abs );
ConvertCoords( ord, p_ord ); ConvertCoords( ord, p_ord );
SkinWindow *vlcWin = SkinWindowList::Instance()->Back(); SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
// Move control // Move control
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff ); g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
...@@ -319,7 +319,7 @@ void AddText( char *id, char *visible, char *x, char *y, char *text, char *font, ...@@ -319,7 +319,7 @@ void AddText( char *id, char *visible, char *x, char *y, char *text, char *font,
char *help ) char *help )
{ {
int XOff, YOff; 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 ); g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* event.cpp: Event class * event.cpp: Event class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -344,8 +344,8 @@ GenericControl * Event::FindControl( string id ) ...@@ -344,8 +344,8 @@ GenericControl * Event::FindControl( string id )
list<SkinWindow *>::const_iterator win; list<SkinWindow *>::const_iterator win;
unsigned int i; unsigned int i;
for( win = SkinWindowList::Instance()->Begin(); for( win = p_intf->p_sys->p_theme->WindowList.begin();
win != SkinWindowList::Instance()->End(); win++ ) win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{ {
for( i = 0; i < (*win)->ControlList.size(); i++ ) for( i = 0; i < (*win)->ControlList.size(); i++ )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* event.h: Event class * event.h: Event class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -52,7 +52,8 @@ using namespace std; ...@@ -52,7 +52,8 @@ using namespace std;
// VLC messages // VLC messages
#define VLC_NOTHING (VLC_MESSAGE + 1) #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_QUIT (VLC_MESSAGE + 4)
#define VLC_OPEN (VLC_MESSAGE + 5) #define VLC_OPEN (VLC_MESSAGE + 5)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* theme.cpp: Theme class * theme.cpp: Theme class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -63,8 +63,7 @@ Theme::~Theme() ...@@ -63,8 +63,7 @@ Theme::~Theme()
{ {
// Delete the windows // Delete the windows
list<SkinWindow *>::const_iterator win; list<SkinWindow *>::const_iterator win;
for( win = SkinWindowList::Instance()->Begin(); for( win = WindowList.begin(); win != WindowList.end(); win++ )
win != SkinWindowList::Instance()->End(); win++ )
{ {
delete (OSWindow *)(*win); delete (OSWindow *)(*win);
} }
...@@ -88,8 +87,7 @@ void Theme::ShowTheme() ...@@ -88,8 +87,7 @@ void Theme::ShowTheme()
Event *evt2; Event *evt2;
// Synchronize control to visible aspect // Synchronize control to visible aspect
for( win = SkinWindowList::Instance()->Begin(); for( win = WindowList.begin(); win != WindowList.end(); win++ )
win != SkinWindowList::Instance()->End(); win++ )
{ {
// Synchronize windows visibility // Synchronize windows visibility
if( (*win)->OnStartThemeVisible ) if( (*win)->OnStartThemeVisible )
...@@ -110,14 +108,7 @@ void Theme::ShowTheme() ...@@ -110,14 +108,7 @@ void Theme::ShowTheme()
CheckAnchors(); CheckAnchors();
// Show windows // Show windows
for( list<SkinWindow *>::const_iterator win = OSAPI_PostMessage( NULL, VLC_SHOW, 0, 0 );
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;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void Theme::CreateSystemMenu() void Theme::CreateSystemMenu()
...@@ -142,8 +133,7 @@ void Theme::LoadConfig() ...@@ -142,8 +133,7 @@ void Theme::LoadConfig()
int x, y, v, scan; int x, y, v, scan;
// Get config for each window // Get config for each window
for( win = SkinWindowList::Instance()->Begin(); for( win = WindowList.begin(); win != WindowList.end(); win++ )
win != SkinWindowList::Instance()->End(); win++ )
{ {
// Get config // Get config
scan = sscanf( &save[i * 13], "(%4d,%4d,%1d)", &x, &y, &v ); scan = sscanf( &save[i * 13], "(%4d,%4d,%1d)", &x, &y, &v );
...@@ -169,8 +159,7 @@ void Theme::SaveConfig() ...@@ -169,8 +159,7 @@ void Theme::SaveConfig()
int x, y; int x, y;
// Save config of every window // Save config of every window
for( win = SkinWindowList::Instance()->Begin(); for( win = WindowList.begin(); win != WindowList.end(); win++ )
win != SkinWindowList::Instance()->End(); win++ )
{ {
// Print config // Print config
(*win)->GetPos( x, y ); (*win)->GetPos( x, y );
...@@ -209,9 +198,8 @@ void Theme::InitTheme() ...@@ -209,9 +198,8 @@ void Theme::InitTheme()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void Theme::InitWindows() void Theme::InitWindows()
{ {
list<SkinWindow *>::const_iterator win; for( list<SkinWindow *>::const_iterator win = WindowList.begin();
for( win = SkinWindowList::Instance()->Begin(); win != WindowList.end(); win++ )
win != SkinWindowList::Instance()->End(); win++ )
{ {
(*win)->Init(); (*win)->Init();
} }
...@@ -219,9 +207,8 @@ void Theme::InitWindows() ...@@ -219,9 +207,8 @@ void Theme::InitWindows()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void Theme::InitControls() void Theme::InitControls()
{ {
list<SkinWindow *>::const_iterator win; for( list<SkinWindow *>::const_iterator win = WindowList.begin();
for( win = SkinWindowList::Instance()->Begin(); win != WindowList.end(); win++ )
win != SkinWindowList::Instance()->End(); win++ )
{ {
for( unsigned int i = 0; i < (*win)->ControlList.size(); i++ ) for( unsigned int i = 0; i < (*win)->ControlList.size(); i++ )
{ {
...@@ -232,9 +219,8 @@ void Theme::InitControls() ...@@ -232,9 +219,8 @@ void Theme::InitControls()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
SkinWindow * Theme::GetWindow( string name ) SkinWindow * Theme::GetWindow( string name )
{ {
list<SkinWindow *>::const_iterator win; for( list<SkinWindow *>::const_iterator win = WindowList.begin();
for( win = SkinWindowList::Instance()->Begin(); win != WindowList.end(); win++ )
win != SkinWindowList::Instance()->End(); win++ )
{ {
if( name == OSAPI_GetWindowTitle( *win ) ) if( name == OSAPI_GetWindowTitle( *win ) )
{ {
...@@ -307,11 +293,8 @@ bool Theme::MoveSkinMagnet( SkinWindow *wnd, int left, int top ) ...@@ -307,11 +293,8 @@ bool Theme::MoveSkinMagnet( SkinWindow *wnd, int left, int top )
// All windows can be moved // All windows can be moved
list<SkinWindow *>::const_iterator win; list<SkinWindow *>::const_iterator win;
for( win = SkinWindowList::Instance()->Begin(); for( win = WindowList.begin(); win != WindowList.end(); win++ )
win != SkinWindowList::Instance()->End(); win++ )
{
(*win)->Moved = false; (*win)->Moved = false;
}
// Move Window // Move Window
MoveSkin( wnd, NewLeft - Wx, NewTop - Wy ); MoveSkin( wnd, NewLeft - Wx, NewTop - Wy );
...@@ -327,8 +310,7 @@ void Theme::HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init ) ...@@ -327,8 +310,7 @@ void Theme::HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init )
list<Anchor *>::const_iterator win_anchor, wnd_anchor; list<Anchor *>::const_iterator win_anchor, wnd_anchor;
// Parse list of windows // Parse list of windows
for( win = SkinWindowList::Instance()->Begin(); for( win = WindowList.begin(); win != WindowList.end(); win++ )
win != SkinWindowList::Instance()->End(); win++ )
{ {
// If window is moved window // If window is moved window
if( (*win) == wnd ) if( (*win) == wnd )
...@@ -410,8 +392,7 @@ void Theme::CheckAnchors() ...@@ -410,8 +392,7 @@ void Theme::CheckAnchors()
list<SkinWindow *>::const_iterator win; list<SkinWindow *>::const_iterator win;
int x, y; int x, y;
for( win = SkinWindowList::Instance()->Begin(); for( win = WindowList.begin(); win != WindowList.end(); win++ )
win != SkinWindowList::Instance()->End(); win++ )
{ {
(*win)->GetPos( x, y ); (*win)->GetPos( x, y );
HangToAnchors( (*win), x, y, true ); HangToAnchors( (*win), x, y, true );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* theme.h: Theme class * theme.h: Theme class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -80,6 +80,9 @@ class Theme ...@@ -80,6 +80,9 @@ class Theme
FontBank *FntBank; FontBank *FntBank;
OffSetBank *OffBank; OffSetBank *OffBank;
// List of the windows of the skin
list<SkinWindow *> WindowList;
// Magetism // Magetism
void HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init = false ); void HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init = false );
bool MoveSkinMagnet( SkinWindow *wnd, int left, int top ); bool MoveSkinMagnet( SkinWindow *wnd, int left, int top );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlcproc.cpp: VlcProc class * vlcproc.cpp: VlcProc class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -71,8 +71,8 @@ bool VlcProc::EventProc( Event *evt ) ...@@ -71,8 +71,8 @@ bool VlcProc::EventProc( Event *evt )
case VLC_HIDE: case VLC_HIDE:
for( list<SkinWindow *>::const_iterator win = for( list<SkinWindow *>::const_iterator win =
SkinWindowList::Instance()->Begin(); p_intf->p_sys->p_theme->WindowList.begin();
win != SkinWindowList::Instance()->End(); win++ ) win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{ {
(*win)->OnStartThemeVisible = !(*win)->IsHidden(); (*win)->OnStartThemeVisible = !(*win)->IsHidden();
} }
...@@ -80,6 +80,17 @@ bool VlcProc::EventProc( Event *evt ) ...@@ -80,6 +80,17 @@ bool VlcProc::EventProc( Event *evt )
OSAPI_PostMessage( NULL, WINDOW_CLOSE, 1, 0 ); OSAPI_PostMessage( NULL, WINDOW_CLOSE, 1, 0 );
return true; 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: case VLC_OPEN:
p_intf->p_sys->p_dialogs->ShowOpen( true ); p_intf->p_sys->p_dialogs->ShowOpen( true );
InterfaceRefresh(); InterfaceRefresh();
...@@ -168,8 +179,8 @@ bool VlcProc::EventProcEnd() ...@@ -168,8 +179,8 @@ bool VlcProc::EventProcEnd()
list<SkinWindow *>::const_iterator win; list<SkinWindow *>::const_iterator win;
// If a window has been closed, test if all are closed ! // If a window has been closed, test if all are closed !
for( win = SkinWindowList::Instance()->Begin(); for( win = p_intf->p_sys->p_theme->WindowList.begin();
win != SkinWindowList::Instance()->End(); win++ ) win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{ {
if( !(*win)->IsHidden() ) // Not all windows closed if( !(*win)->IsHidden() ) // Not all windows closed
{ {
...@@ -350,7 +361,7 @@ void VlcProc::LoadSkin() ...@@ -350,7 +361,7 @@ void VlcProc::LoadSkin()
delete Loader; delete Loader;
// Uninitialize new theme // 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; p_intf->p_sys->p_new_theme_file = NULL;
} }
} }
......
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
* window.cpp: Window class * window.cpp: Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@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 * 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 * it under the terms of the GNU General Public License as published by
...@@ -545,42 +544,5 @@ void SkinWindow::GetPos( int &x, int &y ) ...@@ -545,42 +544,5 @@ void SkinWindow::GetPos( int &x, int &y )
x = Left; x = Left;
y = Top; 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();
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* window.h: Window class * window.h: Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -146,21 +146,5 @@ class SkinWindow ...@@ -146,21 +146,5 @@ class SkinWindow
intf_thread_t *GetIntf() { return p_intf; } 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 #endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* win32_run.cpp: * win32_run.cpp:
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -81,8 +81,8 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -81,8 +81,8 @@ void OSRun( intf_thread_t *p_intf )
while( GetMessage( &msg, NULL, 0, 0 ) ) while( GetMessage( &msg, NULL, 0, 0 ) )
{ {
for( win = SkinWindowList::Instance()->Begin(); for( win = p_intf->p_sys->p_theme->WindowList.begin();
win != SkinWindowList::Instance()->End(); win++ ) win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{ {
if( msg.hwnd == NULL || if( msg.hwnd == NULL ||
msg.hwnd == ((Win32Window*)(*win))->GetHandle() ) msg.hwnd == ((Win32Window*)(*win))->GetHandle() )
...@@ -90,7 +90,7 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -90,7 +90,7 @@ void OSRun( intf_thread_t *p_intf )
break; break;
} }
} }
if( win == SkinWindowList::Instance()->End() ) if( win == p_intf->p_sys->p_theme->WindowList.end() )
{ {
// DispatchMessage( &msg ); // DispatchMessage( &msg );
// DefWindowProc( msg.hwnd, msg.message, msg.wParam, msg.lParam ); // DefWindowProc( msg.hwnd, msg.message, msg.wParam, msg.lParam );
...@@ -163,8 +163,8 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -163,8 +163,8 @@ void OSRun( intf_thread_t *p_intf )
**********************/ **********************/
else if( msg.hwnd == NULL ) else if( msg.hwnd == NULL )
{ {
for( win = SkinWindowList::Instance()->Begin(); for( win = p_intf->p_sys->p_theme->WindowList.begin();
win != SkinWindowList::Instance()->End(); win++ ) win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{ {
(*win)->ProcessEvent( ProcessEvent ); (*win)->ProcessEvent( ProcessEvent );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* win32_theme.cpp: Win32 implementation of the Theme class * win32_theme.cpp: Win32 implementation of the Theme class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -72,8 +72,8 @@ LRESULT CALLBACK Win32Proc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) ...@@ -72,8 +72,8 @@ LRESULT CALLBACK Win32Proc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
// Find window matching with hwnd // Find window matching with hwnd
list<SkinWindow *>::const_iterator win; list<SkinWindow *>::const_iterator win;
for( win = SkinWindowList::Instance()->Begin(); for( win = p_intf->p_sys->p_theme->WindowList.begin();
win != SkinWindowList::Instance()->End(); win++ ) win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{ {
// If it is the correct window // If it is the correct window
if( hwnd == ( (Win32Window *)(*win) )->GetHandle() ) if( hwnd == ( (Win32Window *)(*win) )->GetHandle() )
...@@ -301,8 +301,8 @@ void Win32Theme::AddWindow( string name, int x, int y, bool visible, ...@@ -301,8 +301,8 @@ void Win32Theme::AddWindow( string name, int x, int y, bool visible,
SetWindowLongPtr( hwnd, GWLP_USERDATA, (LONG_PTR)p_intf ); SetWindowLongPtr( hwnd, GWLP_USERDATA, (LONG_PTR)p_intf );
SkinWindowList::Instance()->Add( (SkinWindow *)new OSWindow( p_intf, WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, hwnd, x, y,
hwnd, x, y, visible, fadetime, alpha, movealpha, dragdrop ) ) ; visible, fadetime, alpha, movealpha, dragdrop ) ) ;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void Win32Theme::ChangeTray() void Win32Theme::ChangeTray()
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_run.cpp: * x11_run.cpp:
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -113,8 +113,8 @@ int ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event ) ...@@ -113,8 +113,8 @@ int ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
else if( wnd == p_intf->p_sys->mainWin ) else if( wnd == p_intf->p_sys->mainWin )
{ {
// Broadcast event // Broadcast event
for( win = SkinWindowList::Instance()->Begin(); for( win = p_intf->p_sys->p_theme->WindowList.begin();
win != SkinWindowList::Instance()->End(); win++ ) win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{ {
(*win)->ProcessEvent( evt ); (*win)->ProcessEvent( evt );
} }
...@@ -122,8 +122,8 @@ int ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event ) ...@@ -122,8 +122,8 @@ int ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
else else
{ {
// Find window matching with gwnd // Find window matching with gwnd
for( win = SkinWindowList::Instance()->Begin(); for( win = p_intf->p_sys->p_theme->WindowList.begin();
win != SkinWindowList::Instance()->End(); win++ ) win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{ {
// If it is the correct window // If it is the correct window
if( wnd == ( (X11Window *)(*win) )->GetHandle() ) if( wnd == ( (X11Window *)(*win) )->GetHandle() )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_theme.cpp: X11 implementation of the Theme class * x11_theme.cpp: X11 implementation of the Theme class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -126,8 +126,8 @@ void X11Theme::AddWindow( string name, int x, int y, bool visible, ...@@ -126,8 +126,8 @@ void X11Theme::AddWindow( string name, int x, int y, bool visible,
XStoreName( display, wnd, name.c_str() ); XStoreName( display, wnd, name.c_str() );
XUNLOCK; XUNLOCK;
SkinWindowList::Instance()->Add( (SkinWindow *)new OSWindow( p_intf, wnd, WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, wnd, x, y,
x, y, visible, fadetime, alpha, movealpha, dragdrop, name ) ) ; visible, fadetime, alpha, movealpha, dragdrop, name ) ) ;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void X11Theme::ChangeTray() void X11Theme::ChangeTray()
......
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