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>
......
...@@ -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,6 +140,9 @@ void SkinWindow::Hide() ...@@ -140,6 +140,9 @@ void SkinWindow::Hide()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void SkinWindow::Fade( int To, int Time, unsigned int evt ) void SkinWindow::Fade( int To, int Time, unsigned int evt )
{ {
// No fading effect on win9x
if( IS_WINNT )
{
StartAlpha = Alpha; StartAlpha = Alpha;
EndAlpha = To; EndAlpha = To;
StartTime = OSAPI_GetTime(); StartTime = OSAPI_GetTime();
...@@ -147,6 +150,7 @@ void SkinWindow::Fade( int To, int Time, unsigned int evt ) ...@@ -147,6 +150,7 @@ void SkinWindow::Fade( int To, int Time, unsigned int evt )
Lock++; 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,6 +249,8 @@ bool SkinWindow::ProcessEvent( Event *evt ) ...@@ -245,6 +249,8 @@ bool SkinWindow::ProcessEvent( Event *evt )
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool SkinWindow::ChangeAlpha( int time ) bool SkinWindow::ChangeAlpha( int time )
{ {
if( IS_WINNT )
{
if( time >= EndTime ) if( time >= EndTime )
{ {
if( Lock ) if( Lock )
...@@ -264,6 +270,7 @@ bool SkinWindow::ChangeAlpha( int time ) ...@@ -264,6 +270,7 @@ bool SkinWindow::ChangeAlpha( int time )
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>
...@@ -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,12 +165,15 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -167,12 +165,15 @@ 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" );
vlc_mutex_lock( &p_intf->p_sys->init_lock ); // Don't even enter the main loop
vlc_cond_wait( &p_intf->p_sys->init_cond, &p_intf->p_sys->init_lock ); return;
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,
...@@ -185,7 +186,8 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -185,7 +186,8 @@ 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,9 +226,11 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -224,9 +226,11 @@ 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 )
{ {
// If key is ALT // If key is ALT
...@@ -257,7 +261,7 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -257,7 +261,7 @@ void OSRun( intf_thread_t *p_intf )
} }
/********************** /**********************
* Broadcsated message * * Broadcasted message *
**********************/ **********************/
else if( msg.hwnd == NULL ) else if( msg.hwnd == NULL )
{ {
......
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