+++ /dev/null
-.deps
-.dirstamp
-*.dll
-*.dylib
-*.sl
-*.so
+++ /dev/null
-/*****************************************************************************
- * gtk2_api.cpp: Various gtk2-specific functions
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_api.cpp,v 1.16 2003/04/28 12:00:13 asmax Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-#ifdef GTK2_SKINS
-
-//--- GTK2 ------------------------------------------------------------------
-#include <glib.h>
-#include <gdk/gdk.h>
-
-//--- SKIN ------------------------------------------------------------------
-#include "../src/window.h"
-#include "../os_window.h"
-#include "../os_api.h"
-#include "../src/event.h" // for MAX_PARAM_SIZE
-
-#include <stdio.h>
-
-//---------------------------------------------------------------------------
-// Event API
-//---------------------------------------------------------------------------
-void OSAPI_SendMessage( SkinWindow *win, unsigned int message, unsigned int param1,
- long param2 )
-{
-/* if( win == NULL )
- SendMessage( NULL, message, param1, param2 );
- else
- SendMessage( ( (Win32Window *)win )->GetHandle(), message, param1,
- param2 );*/
-}
-//---------------------------------------------------------------------------
-void OSAPI_PostMessage( SkinWindow *win, unsigned int message, unsigned int param1,
- long param2 )
-{
- GdkEventClient *event = (GdkEventClient *) new GdkEvent;
-
- event->type = GDK_CLIENT_EVENT;
- if( win == NULL )
- {
- event->window = NULL;
- }
- else
- {
- event->window = ((GTK2Window *)win)->GetHandle();
- }
- event->send_event = 0;
- event->message_type = NULL;
- event->data_format = 32;
- event->data.l[0] = message;
- event->data.l[1] = param1;
- event->data.l[2] = param2;
- event->data.l[3] = 0;
- event->data.l[4] = 0;
-
- gdk_event_put( (GdkEvent *)event );
-
- delete event;
-}
-//---------------------------------------------------------------------------
-
-
-
-
-//---------------------------------------------------------------------------
-// Graphic API
-//---------------------------------------------------------------------------
-int OSAPI_GetNonTransparentColor( int c )
-{
-/* // Get desktop device context
- HDC DeskDC = GetWindowDC( GetDesktopWindow() );
-
- // If color is black or color is same as black wether pixel color depth
- if( c == 0 || SetPixel( DeskDC, 0, 0, c ) == 0 )
- {
- if( GetDeviceCaps( DeskDC, BITSPIXEL ) < 24 )
- c = RGB(8, 0, 0);
- else
- c = RGB(1, 0, 0);
- }
- ReleaseDC( GetDesktopWindow(), DeskDC );
- return c;*/
-}
-//---------------------------------------------------------------------------
-
-
-
-
-//---------------------------------------------------------------------------
-// General
-//---------------------------------------------------------------------------
-int OSAPI_GetTime()
-{
- GTimeVal time;
- g_get_current_time( &time );
- return ( time.tv_sec * 1000 + time.tv_usec / 1000 );
-}
-//---------------------------------------------------------------------------
-void OSAPI_GetScreenSize( int &w, int &h )
-{
- w = gdk_screen_width();
- h = gdk_screen_height();
-}
-//---------------------------------------------------------------------------
-void OSAPI_GetMousePos( int &x, int &y )
-{
- gdk_window_get_pointer( gdk_get_default_root_window(), &x, &y, NULL );
-}
-//---------------------------------------------------------------------------
-string OSAPI_GetWindowTitle( SkinWindow *win )
-{
- return ( (GTK2Window *)win )->GetName();
-}
-//---------------------------------------------------------------------------
-bool OSAPI_RmDir( string path )
-{
-/* WIN32_FIND_DATA find;
- string File;
- string FindFiles = path + "\\*.*";
- HANDLE handle = FindFirstFile( (char *)FindFiles.c_str(), &find );
-
- while( handle != INVALID_HANDLE_VALUE )
- {
- // If file is neither "." nor ".."
- if( strcmp( find.cFileName, "." ) && strcmp( find.cFileName, ".." ) )
- {
- // Set file name
- File = path + "\\" + (string)find.cFileName;
-
- // If file is a directory, delete it recursively
- if( find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
- {
- OSAPI_RmDir( File );
- }
- // Else, it is a file so simply delete it
- else
- {
- DeleteFile( (char *)File.c_str() );
- }
- }
-
- // If no more file in directory, exit while
- if( !FindNextFile( handle, &find ) )
- break;
- }
-
- // Now directory is empty so can be removed
- FindClose( handle );
- RemoveDirectory( (char *)path.c_str() );
-
- return true;*/
-}
-//---------------------------------------------------------------------------
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_bitmap.cpp: GTK2 implementation of the Bitmap class
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_bitmap.cpp,v 1.17 2003/04/28 12:00:13 asmax Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- * Emmanuel Puig <karibu@via.ecp.fr>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-#ifdef GTK2_SKINS
-
-//--- GTK2 -----------------------------------------------------------------
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gdk/gdk.h>
-
-//--- VLC -------------------------------------------------------------------
-#include <vlc/intf.h>
-
-//--- SKIN ------------------------------------------------------------------
-#include "../os_api.h"
-#include "../src/graphics.h"
-#include "gtk2_graphics.h"
-#include "../src/bitmap.h"
-#include "gtk2_bitmap.h"
-#include "../src/skin_common.h"
-
-
-//---------------------------------------------------------------------------
-// GTK2Bitmap
-//---------------------------------------------------------------------------
-GTK2Bitmap::GTK2Bitmap( intf_thread_t *p_intf, string FileName, int AColor )
- : Bitmap( p_intf, FileName, AColor )
-{
- AlphaColor = AColor;
-
- // Load the bitmap image
- Bmp = gdk_pixbuf_new_from_file( FileName.c_str(), NULL );
- if( Bmp == NULL )
- {
- if( FileName != "" )
- msg_Warn( p_intf, "Couldn't load bitmap: %s", FileName.c_str() );
- Width = 0;
- Height = 0;
- }
- else
- {
- Width = gdk_pixbuf_get_width( Bmp );
- Height = gdk_pixbuf_get_height( Bmp );
-
- if( AColor != 0 )
- {
- // Change black pixels to another color to avoid transparency
- int rowstride = gdk_pixbuf_get_rowstride( Bmp );
- guchar *pixel = gdk_pixbuf_get_pixels( Bmp );
- int pix_size = ( gdk_pixbuf_get_has_alpha( Bmp ) ? 4 : 3 );
-
- for( int y = 0; y < Height; y++ )
- {
- for( int x = 0; x < Width; x++ )
- {
- guint32 r = pixel[0];
- guint32 g = pixel[1]<<8;
- guint32 b = pixel[2]<<16;
- if( r+g+b == 0 )
- {
- pixel[2] = 10; // slight blue
- }
- pixel += pix_size;
- }
- }
- }
-
- Bmp = gdk_pixbuf_add_alpha( Bmp, TRUE, AColor & 0xff, (AColor>>8) & 0xff,
- (AColor>>16) & 0xff );
- }
-}
-//---------------------------------------------------------------------------
-GTK2Bitmap::GTK2Bitmap( intf_thread_t *p_intf, Graphics *from, int x, int y,
- int w, int h, int AColor ) : Bitmap( p_intf, from, x, y, w, h, AColor )
-{
-/* Width = w;
- Height = h;
- AlphaColor = AColor;
- HBITMAP HBmp;
- HDC fromDC = ( (GTK2Graphics *)from )->GetImageHandle();
-
- // Create image
- bmpDC = CreateCompatibleDC( fromDC );
- HBmp = CreateCompatibleBitmap( fromDC, Width, Height );
- SelectObject( bmpDC, HBmp );
- DeleteObject( HBmp );
- BitBlt( bmpDC, 0, 0, Width, Height, fromDC, x, y, SRCCOPY );*/
-}
-//---------------------------------------------------------------------------
-GTK2Bitmap::GTK2Bitmap( intf_thread_t *p_intf, Bitmap *c )
- : Bitmap( p_intf, c )
-{
-/* HBITMAP HBuf;
-
- // Copy attibutes
- c->GetSize( Width, Height );
- AlphaColor = c->GetAlphaColor();
-
- // Copy bmpDC
- bmpDC = CreateCompatibleDC( NULL );
- HBuf = CreateCompatibleBitmap( bmpDC, Width, Height );
- SelectObject( bmpDC, HBuf );
-
- BitBlt( bmpDC, 0, 0, Width, Height, ( (GTK2Bitmap *)c )->GetBmpDC(),
- 0, 0, SRCCOPY );
- DeleteObject( HBuf );*/
-}
-//---------------------------------------------------------------------------
-GTK2Bitmap::~GTK2Bitmap()
-{
- if( Bmp )
- g_object_unref( G_OBJECT( Bmp) );
-}
-//---------------------------------------------------------------------------
-void GTK2Bitmap::DrawBitmap( int x, int y, int w, int h, int xRef, int yRef,
- Graphics *dest )
-{
- if( Bmp )
- {
- GdkDrawable *destImg = ( (GTK2Graphics *)dest )->GetImage();
- GdkGC *destGC = ( (GTK2Graphics *)dest )->GetGC();
-
- gdk_pixbuf_render_to_drawable( Bmp, destImg, destGC, x, y, xRef, yRef,
- w, h, GDK_RGB_DITHER_NORMAL, 0, 0);
- }
-}
-//---------------------------------------------------------------------------
-bool GTK2Bitmap::Hit( int x, int y)
-{
- 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( !Bmp || x < 0 || x >= Width || y < 0 || y >= Height )
- return -1;
-
- guchar *pixels;
- int rowstride, offset;
- gboolean has_alpha;
-
- rowstride = gdk_pixbuf_get_rowstride( 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] << 8;
- int b = pixels [offset + 2] << 16;
-
- return r + g + b;
-}
-//---------------------------------------------------------------------------
-void GTK2Bitmap::SetBmpPixel( int x, int y, int color )
-{
-// SetPixelV( bmpDC, x, y, color );
-}
-//---------------------------------------------------------------------------
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_bitmap.h: GTK2 implementation of the Bitmap class
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_bitmap.h,v 1.3 2003/04/13 22:55:15 asmax Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-
-#ifndef VLC_GTK2_BITMAP
-#define VLC_GTK2_BITMAP
-
-//--- GTK2 -----------------------------------------------------------------
-#include <gdk/gdk.h>
-
-//--- GENERAL ---------------------------------------------------------------
-#include <string>
-using namespace std;
-
-//---------------------------------------------------------------------------
-struct intf_thread_t;
-class Bitmap;
-class Graphics;
-
-//---------------------------------------------------------------------------
-class GTK2Bitmap : public Bitmap
-{
- private:
- GdkPixbuf *Bmp;
-
- public:
- // Constructors
- GTK2Bitmap( intf_thread_t *p_intf, string FileName, int AColor );
- GTK2Bitmap( intf_thread_t *p_intf, Graphics *from, int x, int y,
- int w, int h, int AColor );
- GTK2Bitmap( intf_thread_t *p_intf, Bitmap *c );
-
- // Destructor
- virtual ~GTK2Bitmap();
-
- virtual void DrawBitmap( int x, int y, int w, int h, int xRef, int yRef,
- Graphics *dest );
- virtual bool Hit( int x, int y );
-
- virtual int GetBmpPixel( int x, int y );
- virtual void SetBmpPixel( int x, int y, int color );
-};
-//---------------------------------------------------------------------------
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_dragdrop.cpp: GTK2 implementation of the drag & drop
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_dragdrop.cpp,v 1.6 2003/04/28 12:00:13 asmax Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-#ifdef GTK2_SKINS
-
-//--- GTK2 -----------------------------------------------------------------
-#include <gdk/gdk.h>
-
-//--- VLC -------------------------------------------------------------------
-#include <vlc/intf.h>
-
-//--- SKIN ------------------------------------------------------------------
-#include "../src/event.h"
-#include "../os_api.h"
-#include "gtk2_dragdrop.h"
-
-
-//---------------------------------------------------------------------------
-GTK2DropObject::GTK2DropObject( intf_thread_t *_p_intf )
-{
- p_intf = _p_intf;
-}
-//---------------------------------------------------------------------------
-GTK2DropObject::~GTK2DropObject()
-{
-}
-//---------------------------------------------------------------------------
-void GTK2DropObject::HandleDropStart( GdkDragContext *context )
-{
- GdkAtom atom = gdk_drag_get_selection( context );
-
- guchar *buffer;
- GdkAtom prop_type;
- gint prop_format;
-
- // Get the owner of the selection
- GdkWindow *owner = gdk_selection_owner_get( atom );
-
- // Find the possible targets for the selection
- string target = "";
- gdk_selection_convert( owner, atom, gdk_atom_intern("TARGETS", FALSE),
- OSAPI_GetTime() );
- int len = gdk_selection_property_get( owner, &buffer, &prop_type,
- &prop_format );
- for( int i = 0; i < len / sizeof(GdkAtom); i++ )
- {
- GdkAtom atom = ( (GdkAtom*)buffer )[i];
- gchar *name = gdk_atom_name( atom );
- if( name )
- {
- string curTarget = name;
- if( (curTarget == "text/plain" || curTarget == "STRING") )
- {
- target = curTarget;
- break;
- }
- }
- }
-
- if( target == "" )
- {
- msg_Warn( p_intf, "Drag&Drop: target not found\n" );
- }
- else
- {
- gdk_selection_convert( owner, atom, gdk_atom_intern(target.c_str(),
- FALSE), OSAPI_GetTime() );
- len = gdk_selection_property_get( owner, &buffer, &prop_type,
- &prop_format);
- OSAPI_PostMessage( NULL, VLC_DROP, (unsigned int)buffer, 0 );
- }
-
-/* // Get number of files that are dropped into vlc
- int NbFiles = DragQueryFile( (HDROP)HDrop, 0xFFFFFFFF, NULL, 0 );
-
- // For each dropped files
- for( int i = 0; i < NbFiles; i++ )
- {
- // Get the name of the file
- int NameLength = DragQueryFile( (HDROP)HDrop, i, NULL, 0 ) + 1;
- char *FileName = new char[NameLength];
- DragQueryFile( (HDROP)HDrop, i, FileName, NameLength );
-
- // The pointer must not be deleted here because it will be deleted
- // in the VLC specific messages processing function
- PostMessage( NULL, VLC_DROP, (WPARAM)FileName, 0 );
- }
-
- DragFinish( (HDROP)HDrop );
-
-*/
- gdk_drop_finish( context, TRUE,OSAPI_GetTime() );
-}
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_dragdrop.h: GTK2 implementation of the drag & drop
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_dragdrop.h,v 1.3 2003/04/19 11:46:11 asmax Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-
-#ifndef VLC_SKIN_GTK2_DRAGDROP
-#define VLC_SKIN_GTK2_DRAGDROP
-
-//--- GTK2 -----------------------------------------------------------------
-#include <gdk/gdk.h>
-
-#include <stdio.h>
-
-//---------------------------------------------------------------------------
-class GTK2DropObject
-{
- private:
- intf_thread_t *p_intf;
-
- public:
- GTK2DropObject( intf_thread_t *_p_intf );
- virtual ~GTK2DropObject();
-
- void HandleDropStart( GdkDragContext *context );
-};
-//---------------------------------------------------------------------------
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_event.cpp: GTK2 implementation of the Event class
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_event.cpp,v 1.12 2003/04/28 12:00:13 asmax Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- * Emmanuel Puig <karibu@via.ecp.fr>
- * Olivier Teulière <ipkiss@via.ecp.fr>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-#ifdef GTK2_SKINS
-
-//--- GTK2 -----------------------------------------------------------------
-#include <gdk/gdk.h>
-
-//--- VLC -------------------------------------------------------------------
-#include <vlc/intf.h>
-
-//--- SKIN ------------------------------------------------------------------
-#include "../os_api.h"
-#include "../src/event.h"
-#include "../os_event.h"
-#include "../src/window.h"
-#include "../os_window.h"
-#include "../src/theme.h"
-#include "../os_theme.h"
-#include "../src/skin_common.h"
-
-
-//---------------------------------------------------------------------------
-// VLC Event
-//---------------------------------------------------------------------------
-GTK2Event::GTK2Event( intf_thread_t *p_intf, string Desc, string shortcut )
- : Event( p_intf, Desc, shortcut )
-{
- gWnd = NULL;
-}
-//---------------------------------------------------------------------------
-GTK2Event::GTK2Event( intf_thread_t *p_intf, GdkWindow *gwnd, unsigned int msg,
- unsigned int par1, long par2 ) : Event( p_intf, msg, par1, par2 )
-{
- gWnd = gwnd;
-}
-//---------------------------------------------------------------------------
-GTK2Event::GTK2Event( intf_thread_t *p_intf, SkinWindow *win, unsigned int msg,
- unsigned int par1, long par2 ) : Event( p_intf, msg, par1, par2 )
-{
- gWnd = ( (GTK2Window *)win )->GetHandle();
-}
-//---------------------------------------------------------------------------
-GTK2Event::~GTK2Event()
-{
-}
-//---------------------------------------------------------------------------
-bool GTK2Event::SendEvent()
-{
- if( Message != VLC_NOTHING )
- {
- // Find window matching with gwnd
- list<SkinWindow *>::const_iterator win;
- for( win = p_intf->p_sys->p_theme->WindowList.begin();
- win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
- {
- // If it is the correct window
- if( gWnd == ( (GTK2Window *)(*win) )->GetHandle() )
- {
- OSAPI_PostMessage( *win, Message, Param1, Param2 );
- PostSynchroMessage();
- return true;
- }
- }
- OSAPI_PostMessage( NULL, Message, Param1, Param2 );
- return true;
- }
-
- return false;
-}
-//---------------------------------------------------------------------------
-bool GTK2Event::IsEqual( Event *evt )
-{
- 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 )
-{
- // Find Parameters
- switch( Message )
- {
- case WINDOW_MOVE:
- gWnd = GetWindowFromName( para1 );
- break;
-
- case WINDOW_CLOSE:
- gWnd = GetWindowFromName( para1 );
- break;
-
- case WINDOW_OPEN:
- gWnd = GetWindowFromName( para1 );
- break;
-
- }
-}
-//---------------------------------------------------------------------------
-GdkWindow *GTK2Event::GetWindowFromName( string name )
-{
- GTK2Window *win = (GTK2Window *)
- p_intf->p_sys->p_theme->GetWindow( name );
-
- if( win == NULL )
- {
- return NULL;
- }
- else
- {
- return win->GetHandle();
- }
-}
-//---------------------------------------------------------------------------
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_event.h: GTK2 implementation of the Event class
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_event.h,v 1.2 2003/04/21 21:51:16 asmax Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-
-#ifndef VLC_SKIN_GTK2_EVENT
-#define VLC_SKIN_GTK2_EVENT
-
-//--- GENERAL ---------------------------------------------------------------
-#include <string>
-using namespace std;
-
-//--- GTK2 ------------------------------------------------------------------
-#include <gdk/gdk.h>
-
-//---------------------------------------------------------------------------
-struct intf_thread_t;
-class SkinWindow;
-
-//---------------------------------------------------------------------------
-class GTK2Event : Event
-{
- private:
- GdkWindow *GetWindowFromName( string name );
- GdkWindow *gWnd;
- public:
- // Constructor
- GTK2Event( intf_thread_t *p_intf, string Desc, string shortcut );
- GTK2Event( intf_thread_t *p_intf, GdkWindow *gwnd, unsigned int msg,
- unsigned int par1, long par2 );
- GTK2Event( intf_thread_t *p_intf, SkinWindow *win, unsigned int msg,
- unsigned int par1, long par2 );
-
- // Destructor
- virtual ~GTK2Event();
-
- // Event sending
- virtual bool SendEvent();
-
- // General operations on events
- virtual void CreateOSEvent( string para1, string para2, string para3 );
- virtual bool IsEqual( Event *evt );
-
- // Getters
- GdkWindow *GetWindow() { return gWnd; }
-};
-//---------------------------------------------------------------------------
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_font.cpp: GTK2 implementation of the Font class
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_font.cpp,v 1.15 2003/05/24 17:52:48 gbazin Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- * Emmanuel Puig <karibu@via.ecp.fr>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-#ifdef GTK2_SKINS
-
-//--- GTK2 -----------------------------------------------------------------
-#include <gdk/gdk.h>
-
-//--- VLC -------------------------------------------------------------------
-#include <vlc/intf.h>
-
-//--- SKIN ------------------------------------------------------------------
-#include "../src/graphics.h"
-#include "../os_graphics.h"
-#include "../src/font.h"
-#include "../os_font.h"
-
-
-
-//---------------------------------------------------------------------------
-// Font object
-//---------------------------------------------------------------------------
-GTK2Font::GTK2Font( intf_thread_t *_p_intf, string fontname, int size,
- int color, int weight, bool italic, bool underline )
- : SkinFont( _p_intf, fontname, size, color, weight, italic, underline )
-{
- Context = gdk_pango_context_get();
- Layout = pango_layout_new( Context );
- p_intf = _p_intf;
-
- // Text properties setting
- FontDesc = pango_font_description_new();
-
- pango_font_description_set_family( FontDesc, fontname.c_str() );
-
- pango_font_description_set_size( FontDesc, size * PANGO_SCALE );
-
- if( italic )
- {
- pango_font_description_set_style( FontDesc, PANGO_STYLE_ITALIC );
- }
- else
- {
- pango_font_description_set_style( FontDesc, PANGO_STYLE_NORMAL );
- }
-
- pango_font_description_set_weight( FontDesc, (PangoWeight)weight );
-
- //pango_context_set_font_description( Context, FontDesc );
- pango_layout_set_font_description( Layout, FontDesc );
-
- // Set attributes
- PangoAttrList *attrs = pango_attr_list_new();
- /* FIXME: doesn't work */
- if( underline )
- {
- pango_attr_list_insert( attrs,
- pango_attr_underline_new( PANGO_UNDERLINE_SINGLE ) );
- }
- pango_layout_set_attributes( Layout, attrs );
-}
-//---------------------------------------------------------------------------
-GTK2Font::~GTK2Font()
-{
-}
-//---------------------------------------------------------------------------
-void GTK2Font::AssignFont( Graphics *dest )
-{
-}
-//---------------------------------------------------------------------------
-void GTK2Font::GetSize( string text, int &w, int &h )
-{
- pango_layout_set_text( Layout, text.c_str(), text.length() );
- pango_layout_get_pixel_size( Layout, &w, &h );
-}
-//---------------------------------------------------------------------------
-void GTK2Font::GenericPrint( Graphics *dest, string text, int x, int y,
- int w, int h, int align, int color )
-{
- // Set text
- pango_layout_set_text( Layout, text.c_str(), -1 );
-
- // Set size
- pango_layout_set_width( Layout, -1 );
- int real_w, real_h;
-
- // Create buffer image
- Graphics* cov = (Graphics *)new OSGraphics( p_intf, w, h );
- cov->CopyFrom( 0, 0, w, h, dest, x, y, SRC_COPY );
-
- // Get handles
- GdkDrawable *drawable = ( (GTK2Graphics *)cov )->GetImage();
- GdkGC *gc = ( (GTK2Graphics *)cov )->GetGC();
-
- // Set width of text
- pango_layout_set_width( Layout, w * PANGO_SCALE );
-
- // Set attributes
- pango_layout_set_alignment( Layout, (PangoAlignment)align );
-
- // Avoid transârency for black text
- if( color == 0 ) color = 10;
- gdk_rgb_gc_set_foreground( gc, color );
-
- // Render text on buffer
- gdk_draw_layout( drawable, gc, 0, 0, Layout );
-
- // Copy buffer on dest graphics
- dest->CopyFrom( x, y, w, h, cov, 0, 0, SRC_COPY );
-
- // Free memory
- delete (OSGraphics *)cov;
-}
-
-//---------------------------------------------------------------------------
-void GTK2Font::Print( Graphics *dest, string text, int x, int y, int w,
- int h, int align )
-{
- GenericPrint( dest, text, x, y, w, h, align, Color );
-}
-//---------------------------------------------------------------------------
-void GTK2Font::PrintColor( Graphics *dest, string text, int x, int y, int w,
- int h, int align, int color )
-{
- GenericPrint( dest, text, x, y, w, h, align, color );
-}
-//---------------------------------------------------------------------------
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_font.h: GTK2 implementation of the Font class
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_font.h,v 1.7 2003/05/24 17:52:48 gbazin Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-
-#ifndef VLC_SKIN_GTK2_FONT
-#define VLC_SKIN_GTK2_FONT
-
-//--- GENERAL ---------------------------------------------------------------
-#include <string>
-using namespace std;
-
-//--- GTK2 -----------------------------------------------------------------
-#include <gdk/gdk.h>
-
-//---------------------------------------------------------------------------
-struct intf_thread_t;
-class Graphics;
-
-//---------------------------------------------------------------------------
-class GTK2Font : SkinFont
-{
- private:
- PangoContext *Context;
- PangoLayout *Layout;
- PangoFontDescription *FontDesc;
-
- // pointer to thread info
- intf_thread_t *p_intf;
-
- // Assign font to Device Context
- virtual void AssignFont( Graphics *dest );
-
- // Helper function
- virtual void GenericPrint( Graphics *dest, string text, int x, int y,
- int w, int h, int align, int color );
-
- public:
- // Constructor
- GTK2Font( intf_thread_t *_p_intf, string fontname, int size, int color,
- int weight, bool italic, bool underline );
-
- // Destructor
- virtual ~GTK2Font();
-
- // Get size of text
- virtual void GetSize( string text, int &w, int &h );
-
- // Draw text with boundaries
- virtual void Print( Graphics *dest, string text, int x, int y, int w,
- int h, int align );
-
- virtual void PrintColor( Graphics *dest, string text, int x, int y,
- int w, int h, int align, int color );
-
-};
-//---------------------------------------------------------------------------
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_graphics.cpp: GTK2 implementation of the Graphics and Region classes
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_graphics.cpp,v 1.18 2003/05/13 19:25:59 asmax Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- * Emmanuel Puig <karibu@via.ecp.fr>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-#ifdef GTK2_SKINS
-
-//--- GTK2 -----------------------------------------------------------------
-#include <gdk/gdk.h>
-
-//--- SKIN ------------------------------------------------------------------
-#include "../src/graphics.h"
-#include "../src/window.h"
-#include "../os_window.h"
-#include "gtk2_graphics.h"
-
-#include <stdio.h>
-#include <math.h>
-
-//---------------------------------------------------------------------------
-// GTK2 GRAPHICS
-//---------------------------------------------------------------------------
-GTK2Graphics::GTK2Graphics( intf_thread_t *p_intf, int w, int h, SkinWindow *from ) : Graphics( w, h )
-{
- if( from != NULL )
- {
- GdkWindow *fromWnd = ( (GTK2Window *)from )->GetHandle();
- Image = (GdkDrawable*) gdk_pixmap_new( fromWnd, w, h, -1 );
- Gc = gdk_gc_new( ( GdkDrawable* )fromWnd );
- }
- else
- {
- // FIXME: 8 -> screen depth
- Image = (GdkDrawable*) gdk_pixmap_new( NULL, w, h, 16 );
- gdk_drawable_set_colormap( Image, gdk_colormap_get_system() );
- Gc = gdk_gc_new( Image );
- }
-
- // Set the background color to black
- gdk_draw_rectangle( Image, Gc, TRUE, 0, 0, w, h );
-}
-//---------------------------------------------------------------------------
-GTK2Graphics::~GTK2Graphics()
-{
- g_object_unref( Gc );
- g_object_unref( Image );
-}
-//---------------------------------------------------------------------------
-void GTK2Graphics::CopyFrom( int dx, int dy, int dw, int dh, Graphics *Src,
- int sx, int sy, int Flag )
-{
- gdk_draw_drawable( Image, Gc, (( GTK2Graphics* )Src )->GetImage(),
- sx, sy, dx, dy, dw, dh );
-}
-//---------------------------------------------------------------------------
-void GTK2Graphics::DrawRect( int x, int y, int w, int h, int color )
-{
- gdk_rgb_gc_set_foreground( Gc, color );
- gdk_draw_rectangle( Image, Gc, TRUE, x, y, w, h);
-}
-//---------------------------------------------------------------------------
-void GTK2Graphics::SetClipRegion( SkinRegion *rgn )
-{
- gdk_gc_set_clip_region( Gc, ( (GTK2Region *)rgn )->GetHandle() );
-}
-//---------------------------------------------------------------------------
-void GTK2Graphics::ResetClipRegion()
-{
- GdkRectangle rect;
- rect.x = 0;
- rect.y = 0;
- rect.width = Width;
- rect.height = Height;
- GdkRegion *rgn = gdk_region_rectangle( &rect );
- gdk_gc_set_clip_region( Gc, rgn );
- gdk_region_destroy( rgn );
-}
-//---------------------------------------------------------------------------
-
-
-
-//---------------------------------------------------------------------------
-// GTK2 REGION
-//---------------------------------------------------------------------------
-GTK2Region::GTK2Region()
-{
- Rgn = gdk_region_new();
-}
-//---------------------------------------------------------------------------
-GTK2Region::GTK2Region( int x, int y, int w, int h )
-{
- GdkRectangle rect;
- rect.x = x;
- rect.y = y;
- rect.width = w;
- rect.height = h;
- Rgn = gdk_region_rectangle( &rect );
-}
-//---------------------------------------------------------------------------
-GTK2Region::~GTK2Region()
-{
- gdk_region_destroy( Rgn );
-}
-//---------------------------------------------------------------------------
-void GTK2Region::AddPoint( int x, int y )
-{
- AddRectangle( x, y, 1, 1 );
-}
-//---------------------------------------------------------------------------
-void GTK2Region::AddRectangle( int x, int y, int w, int h )
-{
- GdkRectangle rect;
- rect.x = x;
- rect.y = y;
- rect.width = w;
- rect.height = h;
- GdkRegion *Buffer = gdk_region_rectangle( &rect );
- gdk_region_union( Rgn, Buffer );
-}
-//---------------------------------------------------------------------------
-void GTK2Region::AddElipse( int x, int y, int w, int h )
-{
- GdkRegion *Buffer;
- GdkRectangle rect;
- rect.height = 1;
-
- double ex, ey;
- double a = w / 2;
- double b = h / 2;
-
- if( !a || !b )
- return;
-
- for( ey = 0; ey < h; ey++ )
- {
- // Calculate coords
- ex = a * sqrt( 1 - ey * ey / ( b * b ) );
-
- // Upper line
- rect.x = (gint)( x + a - ex );
- rect.y = (gint)( y + b - ey );
- rect.width = (gint)( 2 * ex );
- Buffer = gdk_region_rectangle( &rect );
- gdk_region_union( Rgn, Buffer );
- gdk_region_destroy( Buffer );
-
- // Lower line
- rect.y = (gint)( y + b + ey );
- Buffer = gdk_region_rectangle( &rect );
- gdk_region_union( Rgn, Buffer );
- gdk_region_destroy( Buffer );
- }
-}
-//---------------------------------------------------------------------------
-void GTK2Region::Move( int x, int y )
-{
- gdk_region_offset( Rgn, x, y );
-}
-//---------------------------------------------------------------------------
-bool GTK2Region::Hit( int x, int y )
-{
- return gdk_region_point_in( Rgn, x, y );
-}
-//---------------------------------------------------------------------------
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_graphics.h: GTK2 implementation of the Graphics and Region classes
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_graphics.h,v 1.7 2003/05/13 19:25:59 asmax Exp $
- *
- * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
- * Emmanuel Puig <karibu@via.ecp.fr>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-
-#ifndef VLC_SKIN_GTK2_GRAPHICS
-#define VLC_SKIN_GTK2_GRAPHICS
-
-//--- GTK2 ------------------------------------------------------------------
-#include <gdk/gdk.h>
-
-//---------------------------------------------------------------------------
-class SkinRegion;
-class SkinWindow;
-
-//---------------------------------------------------------------------------
-class GTK2Graphics : public Graphics
-{
- protected:
- GdkDrawable *Image;
- GdkGC *Gc;
-
- public:
- // Constructor
- GTK2Graphics( intf_thread_t *p_intf, int w, int h, SkinWindow *from = NULL );
- // Destructor
- virtual ~GTK2Graphics();
- // Drawing methods
- virtual void CopyFrom( int dx, int dy, int dw, int dh, Graphics *Src,
- int sx, int sy, int Flag );
- //virtual void CopyTo( Graphics *Dest, int dx, int dy, int dw, int dh,
- // int sx, int sy, int Flag );
- virtual void DrawRect( int x, int y, int w, int h, int color );
-
- // Clipping methods
- virtual void SetClipRegion( SkinRegion *rgn );
- virtual void ResetClipRegion();
-
- // Specific GTK2 methods
- GdkDrawable *GetImage() { return Image; };
- GdkGC *GetGC() { return Gc; };
-};
-//---------------------------------------------------------------------------
-class GTK2Region : public SkinRegion
-{
- private:
- GdkRegion *Rgn;
- public:
- // Constructor
- GTK2Region();
- GTK2Region( int x, int y, int w, int h );
- // Destructor
- ~GTK2Region();
- // Modify region
- virtual void AddPoint( int x, int y );
- virtual void AddRectangle( int x, int y, int w, int h );
- virtual void AddElipse( int x, int y, int w, int h );
- virtual void Move( int x, int y );
-
- virtual bool Hit( int x, int y );
-
- // Specific GTK2 methods
- GdkRegion *GetHandle() { return Rgn; };
-};
-//---------------------------------------------------------------------------
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_run.cpp:
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_run.cpp,v 1.26 2003/06/11 10:42:33 gbazin Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-#ifdef GTK2_SKINS
-
-//--- GTK2 ------------------------------------------------------------------
-#include <glib.h>
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-
-//--- VLC -------------------------------------------------------------------
-#include <vlc/intf.h>
-
-//--- SKIN ------------------------------------------------------------------
-#include "../os_api.h"
-#include "../src/event.h"
-#include "../os_event.h"
-#include "../src/banks.h"
-#include "../src/window.h"
-#include "../os_window.h"
-#include "../src/theme.h"
-#include "../os_theme.h"
-#include "../src/skin_common.h"
-#include "../src/vlcproc.h"
-
-//---------------------------------------------------------------------------
-class CallBackObjects
-{
- public:
- VlcProc *Proc;
- GMainLoop *Loop;
-};
-
-//---------------------------------------------------------------------------
-// Specific method
-//---------------------------------------------------------------------------
-bool IsVLCEvent( unsigned int msg );
-int SkinManage( intf_thread_t *p_intf );
-
-//---------------------------------------------------------------------------
-// GTK2 interface
-//---------------------------------------------------------------------------
-void GTK2Proc( GdkEvent *event, gpointer data )
-{
- // Get objects from data
- CallBackObjects *obj = (CallBackObjects *)data;
- VlcProc *proc = obj->Proc;
-
- // Get pointer to thread info
- intf_thread_t *p_intf = proc->GetpIntf();
-
- // Variables
- unsigned int msg;
- Event *evt;
- list<SkinWindow *>::const_iterator win;
- GdkWindow *gwnd = ((GdkEventAny *)event)->window;
-
- // Create event to dispatch in windows
- // Skin event
- if( event->type == GDK_CLIENT_EVENT )
- {
- msg = ( (GdkEventClient *)event )->data.l[0];
- evt = (Event *)new OSEvent( p_intf,
- ((GdkEventAny *)event)->window,
- msg,
- ( (GdkEventClient *)event )->data.l[1],
- ( (GdkEventClient *)event )->data.l[2] );
- }
- // System event
- else
- {
- msg = event->type;
- evt = (Event *)new OSEvent( p_intf,
- ((GdkEventAny *)event)->window, msg, 0, (long)event );
- }
-
- // Process keyboard shortcuts
- if( msg == GDK_KEY_PRESS )
- {
- int KeyModifier = 0;
- // If key is ALT
- if( ((GdkEventKey *)event)->state & GDK_MOD1_MASK )
- {
- KeyModifier = 1;
- }
- // If key is CTRL
- else if( ((GdkEventKey *)event)->state & GDK_CONTROL_MASK )
- {
- KeyModifier = 2;
- }
- int key = ((GdkEventKey *)event)->keyval;
- // Translate into lower case
- if( key >= 'a' && key <= 'z' )
- {
- key -= ('a' - 'A');
- }
- if( KeyModifier > 0 )
- p_intf->p_sys->p_theme->EvtBank->TestShortcut( key , KeyModifier );
- }
-
- // Send event
- else if( IsVLCEvent( msg ) )
- {
- if( !proc->EventProc( evt ) )
- {
- return; // Exit VLC !
- }
- }
- else if( gwnd == NULL )
- {
- for( win = p_intf->p_sys->p_theme->WindowList.begin();
- win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
- {
- (*win)->ProcessEvent( evt );
- }
- }
- else
- {
- // Find window matching with gwnd
- for( win = p_intf->p_sys->p_theme->WindowList.begin();
- win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
- {
- // If it is the correct window
- if( gwnd == ( (GTK2Window *)(*win) )->GetHandle() )
- {
- // Send event and check if processed
- if( (*win)->ProcessEvent( evt ) )
- {
- delete (OSEvent *)evt;
- return;
- }
- else
- {
- break;
- }
- }
- }
- }
-
- evt->DestructParameters();
- delete (OSEvent *)evt;
-
- // Check if vlc is closing
- proc->IsClosing();
-
-#if !defined(MODULE_NAME_IS_basic_skins)
- gtk_main_do_event( event );
-#endif
-
-}
-//---------------------------------------------------------------------------
-
-//---------------------------------------------------------------------------
-// REFRESH TIMER CALLBACK
-//---------------------------------------------------------------------------
-gboolean RefreshTimer( gpointer data )
-{
- intf_thread_t *p_intf = (intf_thread_t *)data;
- SkinManage( p_intf );
- return true;
-}
-//---------------------------------------------------------------------------
-
-
-//---------------------------------------------------------------------------
-// GTK2 interface
-//---------------------------------------------------------------------------
-void OSRun( intf_thread_t *p_intf )
-{
- static char *p_args[] = { "" };
-
- // Create VLC event object processing
- CallBackObjects *callbackobj = new CallBackObjects();
- callbackobj->Proc = new VlcProc( p_intf );
-
-#if !defined(MODULE_NAME_IS_basic_skins)
- wxTheApp = new Instance( p_intf, callbackobj );
- wxEntry( 1, p_args );
-#else
- gdk_event_handler_set( GTK2Proc, (gpointer)callbackobj, NULL );
- // Add timer
- g_timeout_add( 200, (GSourceFunc)RefreshTimer, (gpointer)p_intf );
-#endif
-
- delete callbackobj;
-}
-//---------------------------------------------------------------------------
-bool IsVLCEvent( unsigned int msg )
-{
- return( msg > VLC_MESSAGE && msg < VLC_WINDOW );
-}
-//---------------------------------------------------------------------------
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_theme.cpp: GTK2 implementation of the Theme class
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_theme.cpp,v 1.25 2003/04/28 12:00:13 asmax Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-#ifdef GTK2_SKINS
-
-//--- GTK2 -----------------------------------------------------------------
-#include <gdk/gdk.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <X11/Xlib.h>
-
-//--- VLC -------------------------------------------------------------------
-#include <vlc/intf.h>
-
-//--- SKIN ------------------------------------------------------------------
-#include "../os_api.h"
-#include "../src/banks.h"
-#include "../src/window.h"
-#include "../os_window.h"
-#include "../src/event.h"
-#include "../os_event.h"
-#include "../src/theme.h"
-#include "../os_theme.h"
-#include "../src/vlcproc.h"
-#include "../src/skin_common.h"
-
-
-//---------------------------------------------------------------------------
-void SkinManage( intf_thread_t *p_intf );
-
-
-//---------------------------------------------------------------------------
-// THEME
-//---------------------------------------------------------------------------
-GTK2Theme::GTK2Theme( intf_thread_t *_p_intf ) : Theme( _p_intf )
-{
- //Initialize value
- ParentWindow = NULL;
-}
-
-//---------------------------------------------------------------------------
-GTK2Theme::~GTK2Theme()
-{/*
- // Unregister the window class if needed
- WNDCLASS wndclass;
- if( GetClassInfo( hinst, "SkinWindow", &wndclass ) )
- {
- UnregisterClass( "SkinWindow", hinst );
- }
- if( GetClassInfo( hinst, "ParentWindow", &wndclass ) )
- {
- UnregisterClass( "ParentWindow", hinst );
- }
-
- // Delete tray icon if exists
- if( ShowInTray )
- {
- Shell_NotifyIcon( NIM_DELETE, &TrayIcon );
- }
-*/
- // Destroy parent window
- if( ParentWindow )
- {
- gdk_window_destroy( ParentWindow );
- }
-}
-//---------------------------------------------------------------------------
-void GTK2Theme::OnLoadTheme()
-{
-/* // The create menu
- CreateSystemMenu();
-*/
- // Set the parent window attributes
- GdkWindowAttr attr;
- attr.title = "VLC Media Player";
- attr.event_mask = GDK_ALL_EVENTS_MASK;
- attr.x = 0;
- attr.y = 0;
- attr.width = 0;
- attr.height = 0;
- attr.window_type = GDK_WINDOW_TOPLEVEL;
- attr.wclass = GDK_INPUT_ONLY;
- attr.override_redirect = FALSE;
-
- gint mask = GDK_WA_TITLE|GDK_WA_X|GDK_WA_Y|GDK_WA_NOREDIR;
-
- // Create the parent window
- ParentWindow = gdk_window_new( NULL, &attr, mask);
- if( !ParentWindow )
- {
- msg_Err( p_intf, "gdk_window_new failed" );
- return;
- }
-
- Display *display = XOpenDisplay( NULL );
- Window root = DefaultRootWindow( display );
-}
-//---------------------------------------------------------------------------
-void GTK2Theme::AddSystemMenu( string name, Event *event )
-{/*
- if( name == "SEPARATOR" )
- {
- AppendMenu( SysMenu, MF_SEPARATOR, 0, NULL );
- }
- else
- {
- AppendMenu( SysMenu, MF_STRING, (unsigned int)event,
- (char *)name.c_str() );
- }*/
-}
-//---------------------------------------------------------------------------
-void GTK2Theme::ChangeClientWindowName( string name )
-{/*
- SetWindowText( ParentWindow, name.c_str() );*/
-}
-//---------------------------------------------------------------------------
-void GTK2Theme::AddWindow( string name, int x, int y, bool visible,
- int fadetime, int alpha, int movealpha, bool dragdrop )
-{
- GdkWindowAttr attr;
- attr.title = (gchar *)name.c_str();
- attr.event_mask = GDK_ALL_EVENTS_MASK;
- attr.width = 0;
- attr.height = 0;
- attr.window_type = GDK_WINDOW_TOPLEVEL;
- attr.wclass = GDK_INPUT_OUTPUT;
- attr.override_redirect = FALSE;
-
- gint mask = GDK_WA_NOREDIR;
-
- // Create the window
- GdkWindow *gwnd = gdk_window_new( NULL, &attr, mask );
- if( !gwnd )
- {
- msg_Err( p_intf, "gdk_window_new failed" );
- return;
- }
-
- gdk_window_set_decorations( gwnd, (GdkWMDecoration)0 );
-
- gdk_window_show( gwnd );
-
- WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, gwnd, x, y, visible,
- fadetime, alpha, movealpha, dragdrop, name ) ) ;
-
-}
-//---------------------------------------------------------------------------
-void GTK2Theme::ChangeTray()
-{/*
- if( ShowInTray )
- {
- Shell_NotifyIcon( NIM_DELETE, &TrayIcon );
- ShowInTray = false;
- }
- else
- {
- Shell_NotifyIcon( NIM_ADD, &TrayIcon );
- ShowInTray = true;
- }*/
-}
-//---------------------------------------------------------------------------
-void GTK2Theme::ChangeTaskbar()
-{/*
- if( ShowInTaskbar )
- {
- ShowWindow( ParentWindow, SW_HIDE );
- SetWindowLongPtr( ParentWindow, GWL_EXSTYLE,
- WS_EX_LAYERED|WS_EX_TOOLWINDOW );
- ShowWindow( ParentWindow, SW_SHOW );
- ShowInTaskbar = false;
- }
- else
- {
- ShowWindow( ParentWindow, SW_HIDE );
- SetWindowLongPtr( ParentWindow, GWL_EXSTYLE,
- WS_EX_LAYERED|WS_EX_APPWINDOW );
- ShowWindow( ParentWindow, SW_SHOW );
- ShowInTaskbar = true;
- }*/
-}
-//---------------------------------------------------------------------------
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_theme.h: GTK2 implementation of the Theme class
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_theme.h,v 1.4 2003/04/21 21:51:16 asmax Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-
-#ifndef VLC_SKIN_GTK2_THEME
-#define VLC_SKIN_GTK2_THEME
-
-//--- GENERAL ---------------------------------------------------------------
-#include <string>
-using namespace std;
-
-//--- GTK2 -----------------------------------------------------------------
-#include <gdk/gdk.h>
-
-//---------------------------------------------------------------------------
-struct intf_thread_t;
-class SkinWindow;
-class EventBank;
-class BitmapBank;
-class FontBank;
-
-//---------------------------------------------------------------------------
-class GTK2Theme : public Theme
-{
- protected:
- // Handles
-// HINSTANCE hinst;
- GdkWindow *ParentWindow;
-/*
- // System tray icon
- NOTIFYICONDATA TrayIcon;
- HMENU SysMenu;
-*/
- public:
- // Constructor
- GTK2Theme( intf_thread_t *_p_intf );
- virtual void OnLoadTheme();
-
- // Destructor
- virtual ~GTK2Theme();
-/*
- // Specific windows methods
- HINSTANCE getInstance() { return hinst; } */
- GdkWindow *GetParentWindow() { return ParentWindow; }
-
- // !!!
- virtual void AddWindow( string name, int x, int y, bool visible,
- int fadetime, int alpha, int movealpha, bool dragdrop );
- virtual void ChangeClientWindowName( string name );
-
- // Taskbar && system tray
- virtual void AddSystemMenu( string name, Event *event );
- virtual void ChangeTray();
- virtual void ChangeTaskbar();
-// HMENU GetSysMenu() { return SysMenu; }
-};
-//---------------------------------------------------------------------------
-
-
-#endif
-
+++ /dev/null
-/*****************************************************************************
- * gtk2_window.cpp: GTK2 implementation of the Window class
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_window.cpp,v 1.29 2003/04/28 12:00:13 asmax Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-#ifdef GTK2_SKINS
-
-//--- GENERAL ---------------------------------------------------------------
-//#include <math.h>
-
-//--- VLC -------------------------------------------------------------------
-#include <vlc/intf.h>
-
-//--- GTK2 ------------------------------------------------------------------
-#include <gdk/gdk.h>
-#include <glib.h>
-
-//--- SKIN ------------------------------------------------------------------
-#include "../os_api.h"
-#include "../src/anchor.h"
-#include "../controls/generic.h"
-#include "../src/window.h"
-#include "../os_window.h"
-#include "../src/event.h"
-#include "../os_event.h"
-#include "../src/graphics.h"
-#include "../os_graphics.h"
-#include "../src/skin_common.h"
-#include "../src/theme.h"
-
-
-//---------------------------------------------------------------------------
-// Skinable Window
-//---------------------------------------------------------------------------
-GTK2Window::GTK2Window( intf_thread_t *p_intf, GdkWindow *gwnd, int x, int y,
- bool visible, int transition, int normalalpha, int movealpha,
- bool dragdrop, string name )
- : SkinWindow( p_intf, x, y, visible, transition, normalalpha, movealpha,
- dragdrop )
-{
- // Set handles
- gWnd = gwnd;
- gc = gdk_gc_new( gwnd );
-
- Name = name;
-
- LButtonDown = false;
- RButtonDown = false;
-
- // Removing fading effect
- Transition = 0;
-/*
- // Set position parameters
- CursorPos = new POINT;
- WindowPos = new POINT;
-
- // Create Tool Tip Window
- ToolTipWindow = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
- WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- hWnd, 0, GetModuleHandle( NULL ), 0);
-
- // Create Tool Tip infos
- ToolTipInfo.cbSize = sizeof(TOOLINFO);
- ToolTipInfo.uFlags = TTF_SUBCLASS|TTF_IDISHWND;
- ToolTipInfo.hwnd = hWnd;
- ToolTipInfo.hinst = GetModuleHandle( NULL );
- ToolTipInfo.uId = (unsigned int)hWnd;
- ToolTipInfo.lpszText = NULL;
- ToolTipInfo.rect.left = ToolTipInfo.rect.top = 0;
- ToolTipInfo.rect.right = ToolTipInfo.rect.bottom = 0;
-
- SendMessage( ToolTipWindow, TTM_ADDTOOL, 0,
- (LPARAM)(LPTOOLINFO) &ToolTipInfo );
-*/
- if( DragDrop )
- {
- // register the listview as a drop target
- DropObject = new GTK2DropObject( p_intf );
- gdk_window_register_dnd( gwnd );
- }
-
- // Create Tool Tip window
-/* GdkWindowAttr attr;
- attr.event_mask = GDK_ALL_EVENTS_MASK;
- attr.width = 100;
- attr.height = 100;
- attr.window_type = GDK_WINDOW_CHILD;
- attr.wclass = GDK_INPUT_OUTPUT;
- gint mask = 0;
- ToolTipWindow = gdk_window_new( gwnd, &attr, mask);*/
-
-}
-//---------------------------------------------------------------------------
-GTK2Window::~GTK2Window()
-{
-/* delete CursorPos;
- delete WindowPos;
-
- if( hWnd != NULL )
- {
- DestroyWindow( hWnd );
- }
- if( ToolTipWindow != NULL )
- {
- DestroyWindow( ToolTipWindow );
- }
- if( DragDrop )
- {
- // Remove the listview from the list of drop targets
- RevokeDragDrop( hWnd );
- DropTarget->Release();
- // Uninitialize the OLE library
- OleUninitialize();
- }*/
- if( gWnd )
- {
- gdk_window_destroy( gWnd );
- }
-}
-//---------------------------------------------------------------------------
-void GTK2Window::OSShow( bool show )
-{
- if( show )
- {
- gdk_window_show( gWnd );
- gdk_window_move( gWnd, Left, Top );
- }
- else
- {
- gdk_window_hide( gWnd );
- }
-}
-//---------------------------------------------------------------------------
-bool GTK2Window::ProcessOSEvent( Event *evt )
-{
- unsigned int msg = evt->GetMessage();
- unsigned int p1 = evt->GetParam1();
- int p2 = evt->GetParam2();
-
- switch( msg )
- {
- case GDK_EXPOSE:
- RefreshFromImage( 0, 0, Width, Height );
- return true;
-
- case GDK_MOTION_NOTIFY:
- if( LButtonDown )
- MouseMove( (int)( (GdkEventButton *)p2 )->x,
- (int)( (GdkEventButton *)p2 )->y, 1 );
- else if( RButtonDown )
- MouseMove( (int)( (GdkEventButton *)p2 )->x,
- (int)( (GdkEventButton *)p2 )->y, 2 );
- else
- MouseMove( (int)( (GdkEventButton *)p2 )->x,
- (int)( (GdkEventButton *)p2 )->y, 0 );
- gdk_window_get_pointer( gWnd, 0, 0, 0 );
- return true;
-
- case GDK_BUTTON_PRESS:
- // Raise all the windows
- for( list<SkinWindow *>::const_iterator win =
- p_intf->p_sys->p_theme->WindowList.begin();
- win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
- {
- gdk_window_raise( ( (GTK2Window *)(*win) )->GetHandle() );
- }
-
- switch( ( (GdkEventButton *)p2 )->button )
- {
- case 1:
- // Left button
- LButtonDown = true;
- MouseDown( (int)( (GdkEventButton *)p2 )->x,
- (int)( (GdkEventButton *)p2 )->y, 1 );
- break;
-
- case 3:
- // Right button
- RButtonDown = true;
- MouseDown( (int)( (GdkEventButton *)p2 )->x,
- (int)( (GdkEventButton *)p2 )->y, 2 );
- break;
-
- default:
- break;
- }
- return true;
-
- case GDK_BUTTON_RELEASE:
- switch( ( (GdkEventButton *)p2 )->button )
- {
- case 1:
- // Left button
- LButtonDown = false;
- MouseUp( (int)( (GdkEventButton *)p2 )->x,
- (int)( (GdkEventButton *)p2 )->y, 1 );
- break;
-
- case 3:
- // Right button
- RButtonDown = false;
- MouseUp( (int)( (GdkEventButton *)p2 )->x,
- (int)( (GdkEventButton *)p2 )->y, 2 );
- break;
-
- default:
- break;
- }
- return true;
-
- case GDK_LEAVE_NOTIFY:
- OSAPI_PostMessage( this, WINDOW_LEAVE, 0, 0 );
- return true;
-
- case GDK_2BUTTON_PRESS:
- MouseDblClick( (int)( (GdkEventButton *)p2 )->x,
- (int)( (GdkEventButton *)p2 )->y, 1 );
- return true;
-
- case GDK_DROP_START:
- DropObject->HandleDropStart( ( (GdkEventDND *)p2 )->context );
- return true;
-
- case GDK_SCROLL:
- switch( ( (GdkEventScroll *)p2 )->direction )
- {
- case GDK_SCROLL_UP:
- MouseScroll( ( (GdkEventScroll *)p2 )->x,
- ( (GdkEventScroll *)p2 )->y,
- MOUSE_SCROLL_UP);
- break;
- case GDK_SCROLL_DOWN:
- MouseScroll( ( (GdkEventScroll *)p2 )->x,
- ( (GdkEventScroll *)p2 )->y,
- MOUSE_SCROLL_DOWN);
- break;
- }
- return true;
-
- default:
- return false;
- }
-}
-//---------------------------------------------------------------------------
-void GTK2Window::SetTransparency( int Value )
-{
-/* if( Value > -1 )
- Alpha = Value;
- SetLayeredWindowAttributes( hWnd, 0, Alpha, LWA_ALPHA | LWA_COLORKEY );
- UpdateWindow( hWnd );*/
-}
-//---------------------------------------------------------------------------
-void GTK2Window::RefreshFromImage( int x, int y, int w, int h )
-{
- // Initialize painting
-/* HDC DC = GetWindowDC( hWnd );
-
- // Draw image on window
- BitBlt( DC, x, y, w, h, ( (GTK2Graphics *)Image )->GetImageHandle(),
- x, y, SRCCOPY );
-
- // Release window device context
- ReleaseDC( hWnd, DC );
-
-*/
- GdkDrawable *drawable = (( GTK2Graphics* )Image )->GetImage();
- GdkImage *image = gdk_drawable_get_image( drawable, 0, 0, Width, Height );
-
- gdk_draw_drawable( gWnd, gc, drawable, x, y, x, y, w, h );
-
- // Mask for transparency
- GdkRegion *region = gdk_region_new();
- for( int line = 0; line < Height; line++ )
- {
- int start = 0, end = 0;
- while( start < Width )
- {
- while( start < Width && gdk_image_get_pixel( image, start, line ) == 0 )
- {
- start++;
- }
- end = start;
- while( end < Width && gdk_image_get_pixel( image, end, line ) != 0)
- {
- end++;
- }
- GdkRectangle rect;
- rect.x = start;
- rect.y = line;
- rect.width = end - start + 1;
- rect.height = 1;
- GdkRegion *rectReg = gdk_region_rectangle( &rect );
- gdk_region_union( region, rectReg );
- gdk_region_destroy( rectReg );
- start = end + 1;
- }
- }
- gdk_window_shape_combine_region( gWnd, region, 0, 0 );
- gdk_region_destroy( region );
-}
-//---------------------------------------------------------------------------
-void GTK2Window::WindowManualMove()
-{
- // Get mouse cursor position
- int x, y;
- OSAPI_GetMousePos( x, y );
-
- // Move window and chek for magnetism
- p_intf->p_sys->p_theme->MoveSkinMagnet( this,
- WindowX + x - CursorX, WindowY + y - CursorY );
-
-}
-//---------------------------------------------------------------------------
-void GTK2Window::WindowManualMoveInit()
-{
- gdk_window_get_pointer( gdk_get_default_root_window(), &CursorX, &CursorY,
- NULL );
- WindowX = Left;
- WindowY = Top;
-}
-//---------------------------------------------------------------------------
-void GTK2Window::Move( int left, int top )
-{
- Left = left;
- Top = top;
- gdk_window_move( gWnd, left, top );
-}
-//---------------------------------------------------------------------------
-void GTK2Window::Size( int width, int height )
-{
- Width = width;
- Height = height;
- gdk_window_resize( gWnd, width, height );
-}
-//---------------------------------------------------------------------------
-void GTK2Window::ChangeToolTipText( string text )
-{
-/* if( text == "none" )
- {
- if( ToolTipText != "none" )
- {
- ToolTipText = "none";
- ToolTipInfo.lpszText = NULL;
- SendMessage( ToolTipWindow, TTM_ACTIVATE, 0 , 0 );
- }
- }
- else
- {
- if( text != ToolTipText )
- {
- ToolTipText = text;
- ToolTipInfo.lpszText = (char *)ToolTipText.c_str();
- SendMessage( ToolTipWindow, TTM_ACTIVATE, 1 , 0 );
- SendMessage( ToolTipWindow, TTM_UPDATETIPTEXT, 0,
- (LPARAM)(LPTOOLINFO)&ToolTipInfo );
- }
- }
-*/
-}
-//---------------------------------------------------------------------------
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * gtk2_window.h: GTK2 implementation of the Window class
- *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_window.h,v 1.7 2003/04/21 21:51:16 asmax Exp $
- *
- * Authors: Cyril Deguet <asmax@videolan.org>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
- * USA.
- *****************************************************************************/
-
-
-#ifndef VLC_SKIN_GTK2_WIN
-#define VLC_SKIN_GTK2_WIN
-
-//--- GTK2 -----------------------------------------------------------------
-#include <gdk/gdk.h>
-
-//---------------------------------------------------------------------------
-class Graphics;
-class Event;
-
-//---------------------------------------------------------------------------
-class GTK2Window : public SkinWindow
-{
- private:
- // General parameters
- GdkWindow *gWnd;
- GdkGC *gc;
- int CursorX;
- int CursorY;
- int WindowX;
- int WindowY;
- string Name;
-
- // Drag&Drop
- GTK2DropObject *DropObject;
-
- // Tooltip texts
- GdkWindow *ToolTipWindow;
-// TOOLINFO ToolTipInfo;
-
- // Left button down
- bool LButtonDown;
- bool RButtonDown;
-
- public:
- // Cosntructors
- GTK2Window( intf_thread_t *_p_intf, GdkWindow *gwnd, int x, int y,
- bool visible, int transition, int normalalpha, int movealpha,
- bool dragdrop, string name );
-
- // Destructors
- virtual ~GTK2Window();
-
- // Event processing
- virtual bool ProcessOSEvent( Event *evt );
-
- // Window graphic aspect
- virtual void OSShow( bool show );
- virtual void RefreshFromImage( int x, int y, int w, int h );
- virtual void SetTransparency( int Value = -1 );
- virtual void WindowManualMove();
- virtual void WindowManualMoveInit();
-
- // Window methods
- virtual void Move( int left, int top );
- virtual void Size( int width, int height );
-
- // Specific gtk2 methods
- GdkWindow *GetHandle() { return gWnd; };
-
- // Tooltip texts
- virtual void ChangeToolTipText( string text );
-
- // Getters
- string GetName() { return Name; }
-};
-//---------------------------------------------------------------------------
-
-#endif
* wrappers.cpp: Wrappers around C++ objects
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: wrappers.cpp,v 1.10 2003/04/21 21:51:16 asmax Exp $
+ * $Id: wrappers.cpp,v 1.11 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
void AddAnchor( char *x, char *y, char *len, char *priority )
{
int XOff, YOff;
- SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
+ SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
char *event, char *help )
{
int XOff, YOff;
- SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
+ SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
char *color, char *event, char *help )
{
int XOff, YOff;
- SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
+ SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
char *tooltiptext, char *help )
{
int XOff, YOff;
- SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
+ SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
char *tooltiptext1, char *tooltiptext2, char *help )
{
int XOff, YOff;
- SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
+ SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
ConvertCoords( abs, p_abs );
ConvertCoords( ord, p_ord );
- SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
+ SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
// Move control
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
ConvertCoords( abs, p_abs );
ConvertCoords( ord, p_ord );
- SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
+ SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
// Move control
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
char *help )
{
int XOff, YOff;
- SkinWindow *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
+ SkinWindow *vlcWin = SkinWindowList::Instance()->Back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
* event.cpp: Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: event.cpp,v 1.17 2003/06/20 21:34:37 ipkiss Exp $
+ * $Id: event.cpp,v 1.18 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
list<SkinWindow *>::const_iterator win;
unsigned int i;
- for( win = p_intf->p_sys->p_theme->WindowList.begin();
- win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
for( i = 0; i < (*win)->ControlList.size(); i++ )
{
* event.h: Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: event.h,v 1.10 2003/06/20 21:34:37 ipkiss Exp $
+ * $Id: event.h,v 1.11 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
// VLC messages
#define VLC_NOTHING (VLC_MESSAGE + 1)
-#define VLC_SHOW (VLC_MESSAGE + 2)
-#define VLC_HIDE (VLC_MESSAGE + 3)
+#define VLC_HIDE (VLC_MESSAGE + 2)
#define VLC_QUIT (VLC_MESSAGE + 4)
#define VLC_OPEN (VLC_MESSAGE + 5)
* theme.cpp: Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: theme.cpp,v 1.14 2003/06/09 12:33:16 asmax Exp $
+ * $Id: theme.cpp,v 1.15 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
{
// Delete the windows
list<SkinWindow *>::const_iterator win;
- for( win = WindowList.begin(); win != WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
delete (OSWindow *)(*win);
}
Event *evt2;
// Synchronize control to visible aspect
- for( win = WindowList.begin(); win != WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
// Synchronize windows visibility
if( (*win)->OnStartThemeVisible )
CheckAnchors();
// Show windows
- OSAPI_PostMessage( NULL, VLC_SHOW, 0, 0 );
+ for( list<SkinWindow *>::const_iterator win =
+ 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()
int x, y, v, scan;
// Get config for each window
- for( win = WindowList.begin(); win != WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
// Get config
scan = sscanf( &save[i * 13], "(%4d,%4d,%1d)", &x, &y, &v );
int x, y;
// Save config of every window
- for( win = WindowList.begin(); win != WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
// Print config
(*win)->GetPos( x, y );
//---------------------------------------------------------------------------
void Theme::InitWindows()
{
- for( list<SkinWindow *>::const_iterator win = WindowList.begin();
- win != WindowList.end(); win++ )
+ list<SkinWindow *>::const_iterator win;
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
(*win)->Init();
}
//---------------------------------------------------------------------------
void Theme::InitControls()
{
- for( list<SkinWindow *>::const_iterator win = WindowList.begin();
- win != WindowList.end(); win++ )
+ list<SkinWindow *>::const_iterator win;
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
for( unsigned int i = 0; i < (*win)->ControlList.size(); i++ )
{
//---------------------------------------------------------------------------
SkinWindow * Theme::GetWindow( string name )
{
- for( list<SkinWindow *>::const_iterator win = WindowList.begin();
- win != WindowList.end(); win++ )
+ list<SkinWindow *>::const_iterator win;
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
if( name == OSAPI_GetWindowTitle( *win ) )
{
// All windows can be moved
list<SkinWindow *>::const_iterator win;
- for( win = WindowList.begin(); win != WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
+ {
(*win)->Moved = false;
+ }
// Move Window
MoveSkin( wnd, NewLeft - Wx, NewTop - Wy );
list<Anchor *>::const_iterator win_anchor, wnd_anchor;
// Parse list of windows
- for( win = WindowList.begin(); win != WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
// If window is moved window
if( (*win) == wnd )
list<SkinWindow *>::const_iterator win;
int x, y;
- for( win = WindowList.begin(); win != WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
(*win)->GetPos( x, y );
HangToAnchors( (*win), x, y, true );
* theme.h: Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: theme.h,v 1.3 2003/04/21 21:51:16 asmax Exp $
+ * $Id: theme.h,v 1.4 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
FontBank *FntBank;
OffSetBank *OffBank;
- // List of the windows of the skin
- list<SkinWindow *> WindowList;
-
// Magetism
void HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init = false );
bool MoveSkinMagnet( SkinWindow *wnd, int left, int top );
* vlcproc.cpp: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.cpp,v 1.36 2003/06/20 19:50:29 ipkiss Exp $
+ * $Id: vlcproc.cpp,v 1.37 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
case VLC_HIDE:
for( list<SkinWindow *>::const_iterator win =
- p_intf->p_sys->p_theme->WindowList.begin();
- win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+ SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
(*win)->OnStartThemeVisible = !(*win)->IsHidden();
}
OSAPI_PostMessage( NULL, WINDOW_CLOSE, 1, 0 );
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:
p_intf->p_sys->p_dialogs->ShowOpen( true );
InterfaceRefresh();
list<SkinWindow *>::const_iterator win;
// If a window has been closed, test if all are closed !
- for( win = p_intf->p_sys->p_theme->WindowList.begin();
- win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
if( !(*win)->IsHidden() ) // Not all windows closed
{
* window.cpp: Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: window.cpp,v 1.30 2003/06/17 18:13:18 asmax Exp $
+ * $Id: window.cpp,v 1.31 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@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
* it under the terms of the GNU General Public License as published by
x = Left;
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();
+}
+//---------------------------------------------------------------------------
* window.h: Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: window.h,v 1.3 2003/04/21 21:51:16 asmax Exp $
+ * $Id: window.h,v 1.4 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
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
* win32_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: win32_run.cpp,v 1.18 2003/06/03 22:18:58 gbazin Exp $
+ * $Id: win32_run.cpp,v 1.19 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
while( GetMessage( &msg, NULL, 0, 0 ) )
{
- for( win = p_intf->p_sys->p_theme->WindowList.begin();
- win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
if( msg.hwnd == NULL ||
msg.hwnd == ((Win32Window*)(*win))->GetHandle() )
break;
}
}
- if( win == p_intf->p_sys->p_theme->WindowList.end() )
+ if( win == SkinWindowList::Instance()->End() )
{
// DispatchMessage( &msg );
// DefWindowProc( msg.hwnd, msg.message, msg.wParam, msg.lParam );
**********************/
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++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
(*win)->ProcessEvent( ProcessEvent );
}
* win32_theme.cpp: Win32 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: win32_theme.cpp,v 1.7 2003/04/29 12:54:57 gbazin Exp $
+ * $Id: win32_theme.cpp,v 1.8 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
// Find window matching with hwnd
list<SkinWindow *>::const_iterator win;
- for( win = p_intf->p_sys->p_theme->WindowList.begin();
- win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
// If it is the correct window
if( hwnd == ( (Win32Window *)(*win) )->GetHandle() )
SetWindowLongPtr( hwnd, GWLP_USERDATA, (LONG_PTR)p_intf );
- WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, hwnd, x, y,
- visible, fadetime, alpha, movealpha, dragdrop ) ) ;
+ SkinWindowList::Instance()->Add( (SkinWindow *)new OSWindow( p_intf,
+ hwnd, x, y, visible, fadetime, alpha, movealpha, dragdrop ) ) ;
}
//---------------------------------------------------------------------------
void Win32Theme::ChangeTray()
* x11_dragdrop.cpp: X11 implementation of the drag & drop
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_dragdrop.cpp,v 1.4 2003/06/09 00:32:58 asmax Exp $
+ * $Id: x11_dragdrop.cpp,v 1.5 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
break;
}
}
+ fprintf(stderr,"dndenter\n");
}
//---------------------------------------------------------------------------
void X11DropObject::DndPosition( ldata_t data )
// Tell the source whether we accept the drop
XSendEvent( display, src, False, 0, &event );
XUNLOCK;
+ fprintf(stderr,"dndpos\n");
}
//---------------------------------------------------------------------------
void X11DropObject::DndLeave( ldata_t data )
{
+ fprintf(stderr,"dndleave\n");
}
//---------------------------------------------------------------------------
void X11DropObject::DndDrop( ldata_t data )
char *name = new char[selection.size()+1];
strncpy( name, selection.c_str(), selection.size()+1 );
- msg_Dbg( p_intf, "drop: %s\n", name );
+ fprintf(stderr,"dnddrop %s\n", name);
OSAPI_PostMessage( NULL, VLC_DROP, (unsigned int)name, 0 );
}
* x11_event.cpp: x11 implementation of the Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_event.cpp,v 1.3 2003/06/09 12:33:16 asmax Exp $
+ * $Id: x11_event.cpp,v 1.4 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
* Emmanuel Puig <karibu@via.ecp.fr>
{
// Find window matching with Wnd
list<SkinWindow *>::const_iterator win;
- for( win = p_intf->p_sys->p_theme->WindowList.begin();
- win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
// If it is the correct window
if( Wnd == ( (X11Window *)(*win) )->GetHandle() )
* x11_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_run.cpp,v 1.21 2003/06/09 12:33:16 asmax Exp $
+ * $Id: x11_run.cpp,v 1.22 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
else if( wnd == p_intf->p_sys->mainWin )
{
// Broadcast event
- for( win = p_intf->p_sys->p_theme->WindowList.begin();
- win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
(*win)->ProcessEvent( evt );
}
else
{
// Find window matching with gwnd
- for( win = p_intf->p_sys->p_theme->WindowList.begin();
- win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+ for( win = SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
// If it is the correct window
if( wnd == ( (X11Window *)(*win) )->GetHandle() )
* x11_theme.cpp: X11 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_theme.cpp,v 1.13 2003/06/11 21:46:57 asmax Exp $
+ * $Id: x11_theme.cpp,v 1.14 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
XStoreName( display, wnd, name.c_str() );
XUNLOCK;
- WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, wnd, x, y,
- visible, fadetime, alpha, movealpha, dragdrop, name ) ) ;
+ SkinWindowList::Instance()->Add( (SkinWindow *)new OSWindow( p_intf, wnd,
+ x, y, visible, fadetime, alpha, movealpha, dragdrop, name ) ) ;
}
//---------------------------------------------------------------------------
void X11Theme::ChangeTray()
* x11_window.cpp: X11 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_window.cpp,v 1.24 2003/06/17 18:13:18 asmax Exp $
+ * $Id: x11_window.cpp,v 1.25 2003/06/22 00:00:28 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
case ButtonPress:
// Raise all the windows
for( list<SkinWindow *>::const_iterator win =
- p_intf->p_sys->p_theme->WindowList.begin();
- win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+ SkinWindowList::Instance()->Begin();
+ win != SkinWindowList::Instance()->End(); win++ )
{
XLOCK;
XRaiseWindow( display, ( (X11Window *)(*win) )->GetHandle() );
DropObject->DndDrop( ((XClientMessageEvent*)p2)->data.l );
return true;
}
+ else
+ {
+ fprintf( stderr, "Unsupported client event %s\n", type );
+ }
return false;
default: