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 @@
* skin-main.cpp: skins plugin for VLC
*****************************************************************************
* 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>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -117,7 +117,7 @@ static int Open ( vlc_object_t *p_this )
// Initialize conditions and mutexes
vlc_mutex_init( p_intf, &p_intf->p_sys->init_lock );
vlc_cond_init( p_intf, &p_intf->p_sys->init_cond );
p_intf->p_sys->p_theme = (Theme *)new OSTheme( p_intf );
return( 0 );
......@@ -150,7 +150,7 @@ static void Close ( vlc_object_t *p_this )
// Destroy conditions and mutexes
vlc_cond_destroy( &p_intf->p_sys->init_cond );
vlc_mutex_destroy( &p_intf->p_sys->init_lock );
// Destroy structure
free( p_intf->p_sys );
}
......@@ -302,7 +302,7 @@ int SkinManage( intf_thread_t *p_intf )
// 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 )
{
#define p_area p_input->stream.p_selected_area
......
......@@ -2,7 +2,7 @@
* window.cpp: Window class
*****************************************************************************
* 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>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -98,7 +98,7 @@ void SkinWindow::Open()
Changing = true;
if( Transition )
if( Transition && IS_WINNT )
{
SetTransparency( 0 );
OSAPI_PostMessage( this, WINDOW_SHOW, 0, 0 );
......@@ -114,7 +114,7 @@ void SkinWindow::Close()
{
Changing = true;
if( Transition )
if( Transition && IS_WINNT )
Fade( 0, Transition, WINDOW_HIDE );
else
OSAPI_PostMessage( this, WINDOW_FADE, WINDOW_HIDE, 1242 );
......@@ -140,13 +140,17 @@ void SkinWindow::Hide()
//---------------------------------------------------------------------------
void SkinWindow::Fade( int To, int Time, unsigned int evt )
{
StartAlpha = Alpha;
EndAlpha = To;
StartTime = OSAPI_GetTime();
EndTime = StartTime + Time;
Lock++;
// No fading effect on win9x
if( IS_WINNT )
{
StartAlpha = Alpha;
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 )
......@@ -245,24 +249,27 @@ bool SkinWindow::ProcessEvent( Event *evt )
//---------------------------------------------------------------------------
bool SkinWindow::ChangeAlpha( int time )
{
if( time >= EndTime )
if( IS_WINNT )
{
if( Lock )
if( time >= EndTime )
{
SetTransparency( EndAlpha );
Lock = 0;
if( Lock )
{
SetTransparency( EndAlpha );
Lock = 0;
}
return false;
}
return false;
}
int NewAlpha = StartAlpha + (EndAlpha - StartAlpha) * (time - StartTime)
/ (EndTime - StartTime);
if( NewAlpha != Alpha )
SetTransparency( NewAlpha );
if( NewAlpha == EndAlpha )
{
Lock = 0;
return false;
int NewAlpha = StartAlpha + (EndAlpha - StartAlpha) * (time - StartTime)
/ (EndTime - StartTime);
if( NewAlpha != Alpha )
SetTransparency( NewAlpha );
if( NewAlpha == EndAlpha )
{
Lock = 0;
return false;
}
}
return true;
}
......
......@@ -2,7 +2,7 @@
* win32_bitmap.cpp: Win32 implementation of the Bitmap class
*****************************************************************************
* 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>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -73,7 +73,7 @@ Win32Bitmap::Win32Bitmap( intf_thread_t *p_intf, string FileName, int AColor )
Width = Bmp.bmWidth;
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
if( (int)AlphaColor != OSAPI_GetNonTransparentColor( 0 ) )
{
......@@ -91,7 +91,17 @@ Win32Bitmap::Win32Bitmap( intf_thread_t *p_intf, string FileName, int AColor )
DeleteObject( Brush );
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 );
DeleteDC( bufDC );
DeleteObject( HBuf );
......@@ -147,9 +157,16 @@ void Win32Bitmap::DrawBitmap( int x, int y, int w, int h, int xRef, int yRef,
{
HDC destDC = ( (Win32Graphics *)dest )->GetImageHandle();
// New method, not available in win95
TransparentBlt( destDC, xRef, yRef, w, h, bmpDC, x, y, w, h, AlphaColor );
if( IS_WINNT )
{
// 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)
......
......@@ -2,7 +2,7 @@
* win32_run.cpp:
*****************************************************************************
* 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>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -99,7 +99,7 @@ bool Instance::OnInit()
vlc_mutex_lock( &p_intf->p_sys->init_lock );
vlc_cond_signal( &p_intf->p_sys->init_cond );
vlc_mutex_unlock( &p_intf->p_sys->init_lock );
return TRUE;
}
......@@ -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
// 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 */
wxTheApp = new Instance( p_intf );
......@@ -138,7 +136,7 @@ DWORD WINAPI ThreadFunc( LPVOID lpParam )
wxEntry( 1, p_args );
#endif
return 0;
return;
}
......@@ -167,13 +165,16 @@ void OSRun( intf_thread_t *p_intf )
int KeyModifier = 0;
// Create a new thread for wxWindows
HANDLE hThread;
hThread = CreateThread( NULL, 0, ThreadFunc, (LPVOID) p_intf, 0, 0 );
if( vlc_thread_create( p_intf, "Skins Dialogs Thread", SkinsDialogsThread,
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
SetTimer( ((OSTheme *)p_intf->p_sys->p_theme)->GetParentWindow(), 42, 200,
(TIMERPROC)RefreshTimer );
......@@ -183,9 +184,10 @@ void OSRun( intf_thread_t *p_intf )
{
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;
}
......@@ -224,8 +226,10 @@ void OSRun( intf_thread_t *p_intf )
if( msg.wParam == 17 )
KeyModifier = 2;
else if( KeyModifier > 0 )
{
p_intf->p_sys->p_theme->EvtBank->TestShortcut(
msg.wParam, KeyModifier );
}
}
else if( msg.message == WM_SYSKEYDOWN )
{
......@@ -257,12 +261,12 @@ void OSRun( intf_thread_t *p_intf )
}
/**********************
* Broadcsated message *
* Broadcasted message *
**********************/
else if( msg.hwnd == NULL )
{
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 );
}
......
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