* Events work better: controls are working, not still perfectly...
* button.cpp: Button control
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: button.cpp,v 1.6 2003/04/15 20:33:58 karibu Exp $
+ * $Id: button.cpp,v 1.7 2003/04/16 19:22:53 karibu Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
// If hit in the button
if( Img[1]->Hit( x - Left, y - Top ) )
{
+ fprintf( stderr, " Button up ! (%i;%i)\n", button, (int)Selected );
if( !Enabled )
return true;
{
if( Img[0]->Hit( x - Left, y - Top ) )
{
+ fprintf( stderr, " Button down ! (%i)\n", button );
if( !Enabled )
return true;
+ fprintf( stderr, " Button down ! (%i)\n", button );
if( button == 1 )
{
State = 0;
Selected = true;
+ fprintf( stderr, " Button down ! (%i)\n", (int)Selected );
ParentWindow->Refresh( Left, Top, Width, Height );
+ fprintf( stderr, " Button down ! (%i)\n", (int)Selected );
return true;
}
- fprintf( stderr, "button\n" );
}
return false;
* gtk2_api.cpp: Various gtk2-specific functions
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: gtk2_api.cpp,v 1.9 2003/04/16 14:38:04 asmax Exp $
+ * $Id: gtk2_api.cpp,v 1.10 2003/04/16 19:22:53 karibu Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
event->data.l[1] = param1;
event->data.l[2] = param2;
- if( message == VLC_HIDE )
- {
- fprintf( stderr, "======= message %i %x\n", message, event );
- }
-
gdk_event_put( (GdkEvent *)event );
delete event;
* gtk2_bitmap.cpp: GTK2 implementation of the Bitmap class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: gtk2_bitmap.cpp,v 1.11 2003/04/16 14:38:04 asmax Exp $
+ * $Id: gtk2_bitmap.cpp,v 1.12 2003/04/16 19:22:53 karibu Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
HBITMAP HBuf;
BITMAP Bmp;
HDC bufDC;
- AlphaColor = AColor;
// Create image from file if it exists
HBitmap = (HBITMAP) LoadImage( NULL, FileName.c_str(), IMAGE_BITMAP,
//---------------------------------------------------------------------------
bool GTK2Bitmap::Hit( int x, int y)
{
- if( x < 0 || x >= Width || y < 0 || y >= Height )
+ unsigned int c = (unsigned int)GetBmpPixel( x, y );
+
+ if( c == -1 || c == AlphaColor )
return false;
+ else
+ return true;
+}
+//---------------------------------------------------------------------------
+int GTK2Bitmap::GetBmpPixel( int x, int y )
+{
+ if( x < 0 || x >= Width || y < 0 || y >= Height )
+ return -1;
-/* FIXME */
guchar *pixels;
int rowstride, offset;
gboolean has_alpha;
rowstride = gdk_pixbuf_get_rowstride( Bmp );
- pixels = gdk_pixbuf_get_pixels( Bmp );
+ pixels = gdk_pixbuf_get_pixels( Bmp );
has_alpha = gdk_pixbuf_get_has_alpha( Bmp );
offset = y * rowstride + ( x * (has_alpha ? 4 : 3) );
int r = pixels [offset];
- int g = pixels [offset + 1];
- int b = pixels [offset + 2];
- unsigned int c = r + g * 256 + b * 65536;
- /* If has_alpha == TRUE, then the alpha component is in
- pixels [offset + 3] */
+ int g = pixels [offset + 1] << 8;
+ int b = pixels [offset + 2] << 16;
- if( c == AlphaColor )
- return false;
- else
- return true;
-}
-//---------------------------------------------------------------------------
-int GTK2Bitmap::GetBmpPixel( int x, int y )
-{
-// return GetPixel( bmpDC, x, y );
+ return r + g + b;
}
//---------------------------------------------------------------------------
void GTK2Bitmap::SetBmpPixel( int x, int y, int color )
* gtk2_event.cpp: GTK2 implementation of the Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: gtk2_event.cpp,v 1.7 2003/04/15 20:54:58 karibu Exp $
+ * $Id: gtk2_event.cpp,v 1.8 2003/04/16 19:22:53 karibu Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
//---------------------------------------------------------------------------
bool GTK2Event::IsEqual( Event *evt )
{
-/* GTK2Event *WinEvt = (GTK2Event *)evt;
- return( WinEvt->GetWindow() == hWnd && WinEvt->GetMessage() == Message &&
- WinEvt->GetParam1() == Param1 && WinEvt->GetParam2() == Param2 );*/
+ GTK2Event *GTKEvt = (GTK2Event *)evt;
+ return( GTKEvt->GetWindow() == gWnd && GTKEvt->GetMessage() == Message &&
+ GTKEvt->GetParam1() == Param1 && GTKEvt->GetParam2() == Param2 );
}
//---------------------------------------------------------------------------
void GTK2Event::CreateOSEvent( string para1, string para2, string para3 )
* gtk2_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: gtk2_run.cpp,v 1.8 2003/04/15 20:42:04 karibu Exp $
+ * $Id: gtk2_run.cpp,v 1.9 2003/04/16 19:22:53 karibu Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
((GdkEventAny *)event)->window, msg, 0, (long)event );
}
+ // Send event
if( IsVLCEvent( msg ) )
{
if( !proc->EventProc( evt ) )
+ {
+ fprintf( stderr, "Quit\n" );
+ g_main_context_unref( g_main_context_default() );
return; // Exit VLC !
+ }
}
else if( gwnd == NULL )
{
}
}
+ evt->DestructParameters();
delete (OSEvent *)evt;
+ // Check if vlc is closing
+ proc->IsClosing();
+
#if 0
// If Window is parent window
if( hwnd == ( (GTK2Theme *)p_intf->p_sys->p_theme )->GetParentWindow() )
* bitmap.cpp: Bitmap class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: bitmap.cpp,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
+ * $Id: bitmap.cpp,v 1.2 2003/04/16 19:22:53 karibu Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
//---------------------------------------------------------------------------
Bitmap::Bitmap( intf_thread_t *_p_intf, string FileName, int AColor )
{
- p_intf = _p_intf;
+ p_intf = _p_intf;
+ AlphaColor = AColor;
}
//---------------------------------------------------------------------------
Bitmap::Bitmap( intf_thread_t *_p_intf, Graphics *from, int x, int y,
int w, int h, int AColor )
{
- p_intf = _p_intf;
+ p_intf = _p_intf;
+ AlphaColor = AColor;
}
//---------------------------------------------------------------------------
Bitmap::Bitmap( intf_thread_t *_p_intf, Bitmap *c )
* event.cpp: Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: event.cpp,v 1.9 2003/04/16 14:38:04 asmax Exp $
+ * $Id: event.cpp,v 1.10 2003/04/16 19:22:53 karibu Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
{
char *txt = new char[text.size()+1];
strcpy( txt, text.c_str() );
- // OSAPI_PostMessage( NULL, CTRL_SET_TEXT, (unsigned int)this, (long)txt );
-/* FIXME */
- fprintf(stderr, "posttext %s\n", text.c_str());
+ OSAPI_PostMessage( NULL, CTRL_SET_TEXT, (unsigned int)this, (long)txt );
}
//---------------------------------------------------------------------------
unsigned int Event::GetMessageType( string Desc )
* window.cpp: Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: window.cpp,v 1.13 2003/04/16 15:34:36 asmax Exp $
+ * $Id: window.cpp,v 1.14 2003/04/16 19:22:53 karibu Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
if( Hidden )
return;
+ fprintf( stderr, "Refresh: %i %i %i %i\n", x, y, w, h );
+
// And copy buffer to window
RefreshFromImage( x, y, w, h );
// Checking event in controls
for( i = ControlList.size() - 1; i >= 0 ; i-- )
{
+ fprintf( stderr, " -> Control\n" );
if( ControlList[i]->MouseUp( x, y, button ) )
+ {
+ int x, y;
+ //ControlList[i]->GetSize( x, y );
+ fprintf( stderr, " x: %i\n y: %i\n",
+ ControlList[i]->Left, ControlList[i]->Top );
+
return;
+ }
}
}
//---------------------------------------------------------------------------
* win32_bitmap.cpp: Win32 implementation of the Bitmap class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: win32_bitmap.cpp,v 1.2 2003/04/12 21:43:27 asmax Exp $
+ * $Id: win32_bitmap.cpp,v 1.3 2003/04/16 19:22:53 karibu Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
HBITMAP HBuf;
BITMAP Bmp;
HDC bufDC;
- AlphaColor = AColor;
// Create image from file if it exists
HBitmap = (HBITMAP) LoadImage( NULL, FileName.c_str(), IMAGE_BITMAP,