Commit d01ae076 authored by Olivier Teulière's avatar Olivier Teulière

* ./modules/gui/skins/*: first attempt at porting the skins to Win9x

   There is still a lot to do but some things are working.
parent c556378f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* skin-main.cpp: skins plugin for VLC * skin-main.cpp: skins plugin for VLC
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: skin_main.cpp,v 1.18 2003/04/23 10:29:52 asmax Exp $ * $Id: skin_main.cpp,v 1.19 2003/04/28 00:18:27 ipkiss 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 @@ static int Open ( vlc_object_t *p_this ) ...@@ -117,7 +117,7 @@ static int Open ( vlc_object_t *p_this )
// Initialize conditions and mutexes // Initialize conditions and mutexes
vlc_mutex_init( p_intf, &p_intf->p_sys->init_lock ); vlc_mutex_init( p_intf, &p_intf->p_sys->init_lock );
vlc_cond_init( p_intf, &p_intf->p_sys->init_cond ); vlc_cond_init( p_intf, &p_intf->p_sys->init_cond );
p_intf->p_sys->p_theme = (Theme *)new OSTheme( p_intf ); p_intf->p_sys->p_theme = (Theme *)new OSTheme( p_intf );
return( 0 ); return( 0 );
...@@ -150,7 +150,7 @@ static void Close ( vlc_object_t *p_this ) ...@@ -150,7 +150,7 @@ static void Close ( vlc_object_t *p_this )
// Destroy conditions and mutexes // Destroy conditions and mutexes
vlc_cond_destroy( &p_intf->p_sys->init_cond ); vlc_cond_destroy( &p_intf->p_sys->init_cond );
vlc_mutex_destroy( &p_intf->p_sys->init_lock ); vlc_mutex_destroy( &p_intf->p_sys->init_lock );
// Destroy structure // Destroy structure
free( p_intf->p_sys ); free( p_intf->p_sys );
} }
...@@ -302,7 +302,7 @@ int SkinManage( intf_thread_t *p_intf ) ...@@ -302,7 +302,7 @@ int SkinManage( intf_thread_t *p_intf )
// Refresh slider // Refresh slider
// if( p_input->stream.b_seekable && p_intf->p_sys->b_playing ) // if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
if( p_input->stream.b_seekable ) if( p_input->stream.b_seekable )
{ {
#define p_area p_input->stream.p_selected_area #define p_area p_input->stream.p_selected_area
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* window.cpp: Window class * window.cpp: Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: window.cpp,v 1.19 2003/04/21 21:51:16 asmax Exp $ * $Id: window.cpp,v 1.20 2003/04/28 00:18:27 ipkiss 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>
...@@ -98,7 +98,7 @@ void SkinWindow::Open() ...@@ -98,7 +98,7 @@ void SkinWindow::Open()
Changing = true; Changing = true;
if( Transition ) if( Transition && IS_WINNT )
{ {
SetTransparency( 0 ); SetTransparency( 0 );
OSAPI_PostMessage( this, WINDOW_SHOW, 0, 0 ); OSAPI_PostMessage( this, WINDOW_SHOW, 0, 0 );
...@@ -114,7 +114,7 @@ void SkinWindow::Close() ...@@ -114,7 +114,7 @@ void SkinWindow::Close()
{ {
Changing = true; Changing = true;
if( Transition ) if( Transition && IS_WINNT )
Fade( 0, Transition, WINDOW_HIDE ); Fade( 0, Transition, WINDOW_HIDE );
else else
OSAPI_PostMessage( this, WINDOW_FADE, WINDOW_HIDE, 1242 ); OSAPI_PostMessage( this, WINDOW_FADE, WINDOW_HIDE, 1242 );
...@@ -140,13 +140,17 @@ void SkinWindow::Hide() ...@@ -140,13 +140,17 @@ void SkinWindow::Hide()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void SkinWindow::Fade( int To, int Time, unsigned int evt ) void SkinWindow::Fade( int To, int Time, unsigned int evt )
{ {
StartAlpha = Alpha; // No fading effect on win9x
EndAlpha = To; if( IS_WINNT )
StartTime = OSAPI_GetTime(); {
EndTime = StartTime + Time; StartAlpha = Alpha;
Lock++; EndAlpha = To;
StartTime = OSAPI_GetTime();
EndTime = StartTime + Time;
Lock++;
OSAPI_PostMessage( this, WINDOW_FADE, evt, Lock ); OSAPI_PostMessage( this, WINDOW_FADE, evt, Lock );
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool SkinWindow::ProcessEvent( Event *evt ) bool SkinWindow::ProcessEvent( Event *evt )
...@@ -245,24 +249,27 @@ bool SkinWindow::ProcessEvent( Event *evt ) ...@@ -245,24 +249,27 @@ bool SkinWindow::ProcessEvent( Event *evt )
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool SkinWindow::ChangeAlpha( int time ) bool SkinWindow::ChangeAlpha( int time )
{ {
if( time >= EndTime ) if( IS_WINNT )
{ {
if( Lock ) if( time >= EndTime )
{ {
SetTransparency( EndAlpha ); if( Lock )
Lock = 0; {
SetTransparency( EndAlpha );
Lock = 0;
}
return false;
} }
return false;
}
int NewAlpha = StartAlpha + (EndAlpha - StartAlpha) * (time - StartTime) int NewAlpha = StartAlpha + (EndAlpha - StartAlpha) * (time - StartTime)
/ (EndTime - StartTime); / (EndTime - StartTime);
if( NewAlpha != Alpha ) if( NewAlpha != Alpha )
SetTransparency( NewAlpha ); SetTransparency( NewAlpha );
if( NewAlpha == EndAlpha ) if( NewAlpha == EndAlpha )
{ {
Lock = 0; Lock = 0;
return false; return false;
}
} }
return true; return true;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* win32_bitmap.cpp: Win32 implementation of the Bitmap class * win32_bitmap.cpp: Win32 implementation of the Bitmap class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: win32_bitmap.cpp,v 1.4 2003/04/16 21:40:07 ipkiss Exp $ * $Id: win32_bitmap.cpp,v 1.5 2003/04/28 00:18:27 ipkiss 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>
...@@ -73,7 +73,7 @@ Win32Bitmap::Win32Bitmap( intf_thread_t *p_intf, string FileName, int AColor ) ...@@ -73,7 +73,7 @@ Win32Bitmap::Win32Bitmap( intf_thread_t *p_intf, string FileName, int AColor )
Width = Bmp.bmWidth; Width = Bmp.bmWidth;
Height = Bmp.bmHeight; Height = Bmp.bmHeight;
// If alpha color is not 0, then change 0 colors to non black color to avoid // If alpha color is not 0, then change 0 color to non black color to avoid
// window transparency // window transparency
if( (int)AlphaColor != OSAPI_GetNonTransparentColor( 0 ) ) if( (int)AlphaColor != OSAPI_GetNonTransparentColor( 0 ) )
{ {
...@@ -91,7 +91,17 @@ Win32Bitmap::Win32Bitmap( intf_thread_t *p_intf, string FileName, int AColor ) ...@@ -91,7 +91,17 @@ Win32Bitmap::Win32Bitmap( intf_thread_t *p_intf, string FileName, int AColor )
DeleteObject( Brush ); DeleteObject( Brush );
delete r; delete r;
TransparentBlt( bufDC, 0, 0, Width, Height, bmpDC, 0, 0, Width, Height, 0 ); if( IS_WINNT )
{
// This function contains a memory leak on win95/win98
TransparentBlt( bufDC, 0, 0, Width, Height, bmpDC, 0, 0,
Width, Height, 0 );
}
else
{
BitBlt( bufDC, 0, 0, Width, Height, bmpDC, 0, 0, SRCCOPY );
}
BitBlt( bmpDC, 0, 0, Width, Height, bufDC, 0, 0, SRCCOPY ); BitBlt( bmpDC, 0, 0, Width, Height, bufDC, 0, 0, SRCCOPY );
DeleteDC( bufDC ); DeleteDC( bufDC );
DeleteObject( HBuf ); DeleteObject( HBuf );
...@@ -147,9 +157,16 @@ void Win32Bitmap::DrawBitmap( int x, int y, int w, int h, int xRef, int yRef, ...@@ -147,9 +157,16 @@ void Win32Bitmap::DrawBitmap( int x, int y, int w, int h, int xRef, int yRef,
{ {
HDC destDC = ( (Win32Graphics *)dest )->GetImageHandle(); HDC destDC = ( (Win32Graphics *)dest )->GetImageHandle();
// New method, not available in win95 if( IS_WINNT )
TransparentBlt( destDC, xRef, yRef, w, h, bmpDC, x, y, w, h, AlphaColor ); {
// This function contains a memory leak on win95/win98
TransparentBlt( destDC, xRef, yRef, w, h, bmpDC, x, y, w, h,
AlphaColor );
}
else
{
BitBlt( destDC, xRef, yRef, w, h, bmpDC, x, y, SRCCOPY );
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool Win32Bitmap::Hit( int x, int y) bool Win32Bitmap::Hit( int x, int y)
......
...@@ -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.9 2003/04/21 21:51:16 asmax Exp $ * $Id: win32_run.cpp,v 1.10 2003/04/28 00:18:27 ipkiss 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>
...@@ -99,7 +99,7 @@ bool Instance::OnInit() ...@@ -99,7 +99,7 @@ bool Instance::OnInit()
vlc_mutex_lock( &p_intf->p_sys->init_lock ); vlc_mutex_lock( &p_intf->p_sys->init_lock );
vlc_cond_signal( &p_intf->p_sys->init_cond ); vlc_cond_signal( &p_intf->p_sys->init_cond );
vlc_mutex_unlock( &p_intf->p_sys->init_lock ); vlc_mutex_unlock( &p_intf->p_sys->init_lock );
return TRUE; return TRUE;
} }
...@@ -121,10 +121,8 @@ DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) ...@@ -121,10 +121,8 @@ DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
// We create all wxWindows dialogs in a separate thread because we don't want // We create all wxWindows dialogs in a separate thread because we don't want
// any interaction with our own message loop // any interaction with our own message loop
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
DWORD WINAPI ThreadFunc( LPVOID lpParam ) void SkinsDialogsThread( intf_thread_t *p_intf )
{ {
intf_thread_t *p_intf = (intf_thread_t *)lpParam;
/* Hack to pass the p_intf pointer to the new wxWindow Instance object */ /* Hack to pass the p_intf pointer to the new wxWindow Instance object */
wxTheApp = new Instance( p_intf ); wxTheApp = new Instance( p_intf );
...@@ -138,7 +136,7 @@ DWORD WINAPI ThreadFunc( LPVOID lpParam ) ...@@ -138,7 +136,7 @@ DWORD WINAPI ThreadFunc( LPVOID lpParam )
wxEntry( 1, p_args ); wxEntry( 1, p_args );
#endif #endif
return 0; return;
} }
...@@ -167,13 +165,16 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -167,13 +165,16 @@ void OSRun( intf_thread_t *p_intf )
int KeyModifier = 0; int KeyModifier = 0;
// Create a new thread for wxWindows // Create a new thread for wxWindows
HANDLE hThread; if( vlc_thread_create( p_intf, "Skins Dialogs Thread", SkinsDialogsThread,
hThread = CreateThread( NULL, 0, ThreadFunc, (LPVOID) p_intf, 0, 0 ); 0, 0 ) ) {
msg_Err( p_intf, "cannot create SkinsDialogsThread" );
// Don't even enter the main loop
return;
}
// vlc_mutex_lock( &p_intf->p_sys->init_lock );
// vlc_cond_wait( &p_intf->p_sys->init_cond, &p_intf->p_sys->init_lock );
// vlc_mutex_unlock( &p_intf->p_sys->init_lock );
vlc_mutex_lock( &p_intf->p_sys->init_lock );
vlc_cond_wait( &p_intf->p_sys->init_cond, &p_intf->p_sys->init_lock );
vlc_mutex_unlock( &p_intf->p_sys->init_lock );
// Create refresh timer // Create refresh timer
SetTimer( ((OSTheme *)p_intf->p_sys->p_theme)->GetParentWindow(), 42, 200, SetTimer( ((OSTheme *)p_intf->p_sys->p_theme)->GetParentWindow(), 42, 200,
(TIMERPROC)RefreshTimer ); (TIMERPROC)RefreshTimer );
...@@ -183,9 +184,10 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -183,9 +184,10 @@ void OSRun( intf_thread_t *p_intf )
{ {
for( win = p_intf->p_sys->p_theme->WindowList.begin(); for( win = p_intf->p_sys->p_theme->WindowList.begin();
win != p_intf->p_sys->p_theme->WindowList.end(); win++ ) win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{ {
if( msg.hwnd == NULL || msg.hwnd == ((Win32Window*)(*win))->GetHandle() ) if( msg.hwnd == NULL ||
msg.hwnd == ((Win32Window*)(*win))->GetHandle() )
{ {
break; break;
} }
...@@ -224,8 +226,10 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -224,8 +226,10 @@ void OSRun( intf_thread_t *p_intf )
if( msg.wParam == 17 ) if( msg.wParam == 17 )
KeyModifier = 2; KeyModifier = 2;
else if( KeyModifier > 0 ) else if( KeyModifier > 0 )
{
p_intf->p_sys->p_theme->EvtBank->TestShortcut( p_intf->p_sys->p_theme->EvtBank->TestShortcut(
msg.wParam, KeyModifier ); msg.wParam, KeyModifier );
}
} }
else if( msg.message == WM_SYSKEYDOWN ) else if( msg.message == WM_SYSKEYDOWN )
{ {
...@@ -257,12 +261,12 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -257,12 +261,12 @@ void OSRun( intf_thread_t *p_intf )
} }
/********************** /**********************
* Broadcsated message * * Broadcasted message *
**********************/ **********************/
else if( msg.hwnd == NULL ) else if( msg.hwnd == NULL )
{ {
for( win = p_intf->p_sys->p_theme->WindowList.begin(); for( win = p_intf->p_sys->p_theme->WindowList.begin();
win != p_intf->p_sys->p_theme->WindowList.end(); win++ ) win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{ {
(*win)->ProcessEvent( ProcessEvent ); (*win)->ProcessEvent( ProcessEvent );
} }
......
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