Commit f3bcd927 authored by Cyril Deguet's avatar Cyril Deguet

* at last made the skin module compile under linux !

  It does absolutely nothing, but it compiles ;)
parent 84b3b12b
......@@ -15,7 +15,7 @@ bool 'GTK+ support' CONFIG_GTK
dep_bool ' Gnome interface support' CONFIG_GNOME $CONFIG_GTK
bool 'GTK2 support' CONFIG_GTK2
dep_bool ' Gnome2 support' CONFIG_GNOME2 $CONFIG_GTK2
bool 'Win32 skins module' CONFIG_SKINS
bool 'Skins module' CONFIG_SKINS
bool 'Familiar GTK+ support' CONFIG_FAMILIAR
bool 'wxWindows support' CONFIG_WXWINDOWS
bool 'Qt interface support' CONFIG_QT
......
......@@ -2305,6 +2305,11 @@ if test "x${enable_skins}" != "xno"; then
PLUGINS="${PLUGINS} skins"
CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -fno-rtti -Imodules/gui/skins -Imodules/gui/skins/src -Imodules/gui/skins/win32 -Imodules/gui/skins/controls"
LDFLAGS_skins="${LDFLAGS_skins} -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32 -lmsimg32"
else
PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
PLUGINS="${PLUGINS} skins"
CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -fno-rtti -Imodules/gui/skins -Imodules/gui/skins/src -Imodules/gui/skins/gtk2 -Imodules/gui/skins/controls -Imodules/gui/skins/parser ${GTK2_CFLAGS}"
LDFLAGS_skins="${LDFLAGS_skins} -lstdc++ ${GTK2_LIBS}"
fi
fi
......
......@@ -77,6 +77,25 @@ SOURCES_skins = \
modules/gui/skins/win32/win32_theme.h \
modules/gui/skins/win32/win32_window.cpp \
modules/gui/skins/win32/win32_window.h \
\
modules/gui/skins/gtk2/gtk2_api.cpp \
modules/gui/skins/gtk2/gtk2_bitmap.cpp \
modules/gui/skins/gtk2/gtk2_bitmap.h \
modules/gui/skins/gtk2/gtk2_dialog.cpp \
modules/gui/skins/gtk2/gtk2_dialog.h \
modules/gui/skins/gtk2/gtk2_dragdrop.cpp \
modules/gui/skins/gtk2/gtk2_dragdrop.h \
modules/gui/skins/gtk2/gtk2_event.cpp \
modules/gui/skins/gtk2/gtk2_event.h \
modules/gui/skins/gtk2/gtk2_font.cpp \
modules/gui/skins/gtk2/gtk2_font.h \
modules/gui/skins/gtk2/gtk2_graphics.cpp \
modules/gui/skins/gtk2/gtk2_graphics.h \
modules/gui/skins/gtk2/gtk2_run.cpp \
modules/gui/skins/gtk2/gtk2_theme.cpp \
modules/gui/skins/gtk2/gtk2_theme.h \
modules/gui/skins/gtk2/gtk2_window.cpp \
modules/gui/skins/gtk2/gtk2_window.h \
$(NULL)
EXTRA_DIST += \
......
......@@ -2,7 +2,7 @@
* slider.cpp: Slider control
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: slider.cpp,v 1.2 2003/03/21 00:17:00 karibu Exp $
* $Id: slider.cpp,v 1.3 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -78,7 +78,12 @@ ControlSlider::~ControlSlider()
{
delete[] CursorX;
delete[] CursorY;
/* FIXME: kludge */
#ifdef WIN32
DeleteObject( HitRgn );
#else
fprintf(stderr, "WARNING: fixme in slider.cpp!!!!!");
#endif
}
//---------------------------------------------------------------------------
void ControlSlider::Init()
......
/*****************************************************************************
* gtk2_api.cpp: Various gtk2-specific functions
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_api.cpp,v 1.1 2003/04/12 21:43:27 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.
*****************************************************************************/
//--- GTK2 ------------------------------------------------------------------
#include <gtk/gtk.h>
//--- SKIN ------------------------------------------------------------------
#include "window.h"
#include "os_window.h"
#include "os_api.h"
#include "event.h" // for MAX_PARAM_SIZE
/*
//---------------------------------------------------------------------------
// Event API
//---------------------------------------------------------------------------
void OSAPI_SendMessage( Window *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( Window *win, unsigned int message, unsigned int param1,
long param2 )
{
if( win == NULL )
PostMessage( NULL, message, param1, param2 );
else
PostMessage( ( (Win32Window *)win )->GetHandle(), message, param1,
param2 );
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// 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()
{
return GetTickCount();
}
//---------------------------------------------------------------------------
void OSAPI_GetScreenSize( int &w, int &h )
{
w = GetSystemMetrics(SM_CXSCREEN);
h = GetSystemMetrics(SM_CYSCREEN);
}
//---------------------------------------------------------------------------
void OSAPI_GetMousePos( int &x, int &y )
{
LPPOINT MousePos = new POINT;
GetCursorPos( MousePos );
x = MousePos->x;
y = MousePos->y;
delete MousePos;
}
//---------------------------------------------------------------------------
string OSAPI_GetWindowTitle( Window *win )
{
char *buffer = new char[MAX_PARAM_SIZE];
GetWindowText( ((Win32Window *)win)->GetHandle(), buffer, MAX_PARAM_SIZE );
string Title = buffer;
delete buffer;
return Title;
}
//---------------------------------------------------------------------------
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;
}
//---------------------------------------------------------------------------
*/
/*****************************************************************************
* gtk2_bitmap.cpp: GTK2 implementation of the Bitmap class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_bitmap.cpp,v 1.1 2003/04/12 21:43:27 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.
*****************************************************************************/
//--- GTK2 -----------------------------------------------------------------
//#define WINVER 0x0500
//#include <windows.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
//--- SKIN ------------------------------------------------------------------
#include "os_api.h"
#include "graphics.h"
#include "gtk2_graphics.h"
#include "bitmap.h"
#include "gtk2_bitmap.h"
#include "skin_common.h"
//---------------------------------------------------------------------------
// GTK2Bitmap
//---------------------------------------------------------------------------
GTK2Bitmap::GTK2Bitmap( intf_thread_t *p_intf, string FileName, int AColor )
: Bitmap( p_intf, FileName, AColor )
{
/* HBITMAP HBitmap;
HBITMAP HBuf;
BITMAP Bmp;
HDC bufDC;
AlphaColor = AColor;
// Create image from file if it exists
HBitmap = (HBITMAP) LoadImage( NULL, FileName.c_str(), IMAGE_BITMAP,
0, 0, LR_LOADFROMFILE );
if( HBitmap == NULL )
{
if( FileName != "" )
msg_Warn( p_intf, "Couldn't load bitmap: %s", FileName.c_str() );
HBitmap = CreateBitmap( 0, 0, 1, 32, NULL );
}
// Create device context
bmpDC = CreateCompatibleDC( NULL );
SelectObject( bmpDC, HBitmap );
// Get size of image
GetObject( HBitmap, sizeof( Bmp ), &Bmp );
Width = Bmp.bmWidth;
Height = Bmp.bmHeight;
// If alpha color is not 0, then change 0 colors to non black color to avoid
// window transparency
if( (int)AlphaColor != OSAPI_GetNonTransparentColor( 0 ) )
{
bufDC = CreateCompatibleDC( bmpDC );
HBuf = CreateCompatibleBitmap( bmpDC, Width, Height );
SelectObject( bufDC, HBuf );
LPRECT r = new RECT;
HBRUSH Brush = CreateSolidBrush( OSAPI_GetNonTransparentColor( 0 ) );
r->left = 0;
r->top = 0;
r->right = Width;
r->bottom = Height;
FillRect( bufDC, r, Brush );
DeleteObject( Brush );
delete r;
TransparentBlt( bufDC, 0, 0, Width, Height, bmpDC, 0, 0, Width, Height, 0 );
BitBlt( bmpDC, 0, 0, Width, Height, bufDC, 0, 0, SRCCOPY );
DeleteDC( bufDC );
DeleteObject( HBuf );
}
// Delete objects
DeleteObject( HBitmap );*/
}
//---------------------------------------------------------------------------
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()
{
/* DeleteDC( bmpDC );*/
}
//---------------------------------------------------------------------------
void GTK2Bitmap::DrawBitmap( int x, int y, int w, int h, int xRef, int yRef,
Graphics *dest )
{
/* HDC destDC = ( (GTK2Graphics *)dest )->GetImageHandle();
// New method, not available in win95
TransparentBlt( destDC, xRef, yRef, w, h, bmpDC, x, y, w, h, AlphaColor );
*/
}
//---------------------------------------------------------------------------
bool GTK2Bitmap::Hit( int x, int y)
{
/* unsigned int c = GetPixel( bmpDC, x, y );
if( c == AlphaColor || c == CLR_INVALID )
return false;
else
return true;
*/
}
//---------------------------------------------------------------------------
int GTK2Bitmap::GetBmpPixel( int x, int y )
{
// return GetPixel( bmpDC, x, y );
}
//---------------------------------------------------------------------------
void GTK2Bitmap::SetBmpPixel( int x, int y, int color )
{
// SetPixelV( bmpDC, x, y, color );
}
//---------------------------------------------------------------------------
/*****************************************************************************
* gtk2_bitmap.h: GTK2 implementation of the Bitmap class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_bitmap.h,v 1.1 2003/04/12 21:43:27 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 <windows.h>
//--- GENERAL ---------------------------------------------------------------
#include <string>
using namespace std;
//---------------------------------------------------------------------------
struct intf_thread_t;
class Bitmap;
class Graphics;
//---------------------------------------------------------------------------
class GTK2Bitmap : public Bitmap
{
private:
// HDC bmpDC;
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 );
// HDC GetBmpDC() { return bmpDC; }
};
//---------------------------------------------------------------------------
#endif
This diff is collapsed.
/*****************************************************************************
* gtk2_dialog.h: GTK2 implementation of some dialog boxes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_dialog.h,v 1.1 2003/04/12 21:43:27 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_DIALOG
#define VLC_SKIN_GTK2_DIALOG
//--- GENERAL ---------------------------------------------------------------
#include <string>
using namespace std;
//---------------------------------------------------------------------------
class GTK2OpenFileDialog : OpenFileDialog
{
private:
protected:
public:
// Constructors
GTK2OpenFileDialog( intf_thread_t *_p_intf, string title,
bool multiselect );
// Destructors
virtual ~GTK2OpenFileDialog();
virtual void AddFilter( string name, string type );
virtual bool Open();
};
//---------------------------------------------------------------------------
class GTK2LogWindow : LogWindow
{
private:
/* HWND hWindow;
HWND hRichCtrl;
string RtfHeader;*/
public:
// Constructors
GTK2LogWindow( intf_thread_t *_p_intf );
// Destructors
virtual ~GTK2LogWindow();
virtual void Clear();
virtual void AddLine( string line );
virtual void ChangeColor( int color, bool bold = false );
virtual void Show();
virtual void Hide();
/*
// Specific methods
HWND GetRichCtrl() { return hRichCtrl; };
HWND GetWindow() { return hWindow; };*/
};
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* gtk2_dragdrop.cpp: GTK2 implementation of the drag & drop
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_dragdrop.cpp,v 1.1 2003/04/12 21:43:27 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.
*****************************************************************************/
//--- GTK2 -----------------------------------------------------------------
//#include <windows.h>
//--- SKIN ------------------------------------------------------------------
#include "event.h"
#include "gtk2_dragdrop.h"
/*
//---------------------------------------------------------------------------
GTK2DropObject::GTK2DropObject() : IDropTarget()
{
References = 1;
}
//---------------------------------------------------------------------------
GTK2DropObject::~GTK2DropObject()
{
}
//---------------------------------------------------------------------------
void GTK2DropObject::HandleDrop( HDROP HDrop )
{
// 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 );
}
//---------------------------------------------------------------------------
STDMETHODIMP GTK2DropObject::QueryInterface( REFIID iid, void FAR* FAR* ppv )
{
// Tell other objects about our capabilities
if( iid == IID_IUnknown || iid == IID_IDropTarget )
{
*ppv = this;
AddRef();
return S_OK;
}
*ppv = NULL;
return ResultFromScode( E_NOINTERFACE );
}
//---------------------------------------------------------------------------
STDMETHODIMP_(ULONG) GTK2DropObject::AddRef()
{
return ++References;
}
//---------------------------------------------------------------------------
STDMETHODIMP_(ULONG) GTK2DropObject::Release()
{
if( --References == 0 )
{
delete this;
return 0;
}
return References;
}
//---------------------------------------------------------------------------
STDMETHODIMP GTK2DropObject::DragEnter( LPDATAOBJECT pDataObj,
DWORD grfKeyState, POINTL pt, DWORD *pdwEffect )
{
FORMATETC fmtetc;
fmtetc.cfFormat = CF_HDROP;
fmtetc.ptd = NULL;
fmtetc.dwAspect = DVASPECT_CONTENT;
fmtetc.lindex = -1;
fmtetc.tymed = TYMED_HGLOBAL;
// Check that the drag source provides CF_HDROP,
// which is the only format we accept
if( pDataObj->QueryGetData( &fmtetc ) == S_OK )
*pdwEffect = DROPEFFECT_COPY;
else
*pdwEffect = DROPEFFECT_NONE;
return S_OK;
}
//---------------------------------------------------------------------------
STDMETHODIMP GTK2DropObject::DragOver( DWORD grfKeyState, POINTL pt,
DWORD *pdwEffect )
{
// For visual feedback
// TODO
return S_OK;
}
//---------------------------------------------------------------------------
STDMETHODIMP GTK2DropObject::DragLeave()
{
// Remove visual feedback
// TODO
return S_OK;
}
//---------------------------------------------------------------------------
STDMETHODIMP GTK2DropObject::Drop( LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, DWORD *pdwEffect )
{
// User has dropped on us -- get the CF_HDROP data from drag source
FORMATETC fmtetc;
fmtetc.cfFormat = CF_HDROP;
fmtetc.ptd = NULL;
fmtetc.dwAspect = DVASPECT_CONTENT;
fmtetc.lindex = -1;
fmtetc.tymed = TYMED_HGLOBAL;
STGMEDIUM medium;
HRESULT hr = pDataObj->GetData( &fmtetc, &medium );
if( !FAILED(hr) )
{
// Grab a pointer to the data
HGLOBAL HFiles = medium.hGlobal;
HDROP HDrop = (HDROP)GlobalLock( HFiles );
// Notify the Form of the drop
HandleDrop( HDrop );
// Release the pointer to the memory
GlobalUnlock( HFiles );
// ReleaseStgMedium( &medium );
}
else
{
*pdwEffect = DROPEFFECT_NONE;
return hr;
}
return S_OK;
}
*/
/*****************************************************************************
* gtk2_dragdrop.h: GTK2 implementation of the drag & drop
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_dragdrop.h,v 1.1 2003/04/12 21:43:27 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 <shellapi.h>
//#include <ole2.h>
//---------------------------------------------------------------------------
/*
class GTK2DropObject : public IDropTarget
{
public:
GTK2DropObject();
virtual ~GTK2DropObject();
protected:
// IUnknown methods
STDMETHOD(QueryInterface)( REFIID riid, void FAR* FAR* ppvObj );
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
// IDropTarget methods
STDMETHOD(DragEnter)( LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, DWORD *pdwEffect );
STDMETHOD(DragOver)( DWORD grfKeyState, POINTL pt, DWORD *pdwEffect );
STDMETHOD(DragLeave)();
STDMETHOD(Drop)( LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, DWORD *pdwEffect );
private:
unsigned long References;
// Helper function
void HandleDrop( HDROP HDrop );
};*/
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* gtk2_event.cpp: GTK2 implementation of the Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_event.cpp,v 1.1 2003/04/12 21:43:27 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.
*****************************************************************************/
//--- GTK2 -----------------------------------------------------------------
//#include <windows.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
//--- SKIN ------------------------------------------------------------------
#include "event.h"
#include "os_event.h"
#include "window.h"
#include "os_window.h"
#include "theme.h"
#include "os_theme.h"
#include "skin_common.h"
/*
//---------------------------------------------------------------------------
// VLC Event
//---------------------------------------------------------------------------
GTK2Event::GTK2Event( intf_thread_t *p_intf, string Desc, string shortcut )
: Event( p_intf, Desc, shortcut )
{
hWnd = NULL;
}
//---------------------------------------------------------------------------
GTK2Event::GTK2Event( intf_thread_t *p_intf, HWND hwnd, unsigned int msg,
unsigned int par1, long par2 ) : Event( p_intf, msg, par1, par2 )
{
hWnd = hwnd;
}
//---------------------------------------------------------------------------
GTK2Event::GTK2Event( intf_thread_t *p_intf, Window *win, unsigned int msg,
unsigned int par1, long par2 ) : Event( p_intf, msg, par1, par2 )
{
hWnd = ( (GTK2Window *)win )->GetHandle();
}
//---------------------------------------------------------------------------
GTK2Event::~GTK2Event()
{
}
//---------------------------------------------------------------------------
bool GTK2Event::SendEvent()
{
if( Message != VLC_NOTHING )
{
PostMessage( hWnd, Message, Param1, Param2 );
PostSynchroMessage();
return true;
}
return true;
}
//---------------------------------------------------------------------------
bool GTK2Event::IsEqual( Event *evt )
{
GTK2Event *WinEvt = (GTK2Event *)evt;
return( WinEvt->GetWindow() == hWnd && WinEvt->GetMessage() == Message &&
WinEvt->GetParam1() == Param1 && WinEvt->GetParam2() == Param2 );
}
//---------------------------------------------------------------------------
void GTK2Event::CreateOSEvent( string para1, string para2, string para3 )
{
// Find Parameters
switch( Message )
{
case WINDOW_MOVE:
hWnd = GetWindowFromName( para1 );
break;
case WINDOW_CLOSE:
hWnd = GetWindowFromName( para1 );
break;
case WINDOW_OPEN:
hWnd = GetWindowFromName( para1 );
break;
}
}
//---------------------------------------------------------------------------
HWND GTK2Event::GetWindowFromName( string name )
{
GTK2Window *win = (GTK2Window *)
p_intf->p_sys->p_theme->GetWindow( name );
if( win == NULL )
return NULL;
else
return win->GetHandle();
}
//---------------------------------------------------------------------------
*/
/*****************************************************************************
* gtk2_event.h: GTK2 implementation of the Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_event.h,v 1.1 2003/04/12 21:43:27 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 Window;
//---------------------------------------------------------------------------
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, Window *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
/*****************************************************************************
* gtk2_font.cpp: GTK2 implementation of the Font class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_font.cpp,v 1.1 2003/04/12 21:43:27 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.
*****************************************************************************/
//--- GTK2 -----------------------------------------------------------------
//#include <windows.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
//--- SKIN ------------------------------------------------------------------
#include "graphics.h"
#include "gtk2_graphics.h"
#include "font.h"
#include "gtk2_font.h"
/*
//---------------------------------------------------------------------------
// Font object
//---------------------------------------------------------------------------
GTK2Font::GTK2Font( intf_thread_t *_p_intf, string fontname, int size,
int color, int weight, bool italic, bool underline )
: Font( _p_intf, fontname, size, color, weight, italic, underline )
{
}
//---------------------------------------------------------------------------
GTK2Font::~GTK2Font()
{
}
//---------------------------------------------------------------------------
void GTK2Font::AssignGTK2Font( HDC DC )
{
// Create font
HGDIOBJ fontObj = CreateFont(
-MulDiv( Size, GetDeviceCaps( DC, LOGPIXELSX ), 72 ),
0,
0, // angle of escapement
0, // base-line orientation angle
Weight, // font weight
Italic, // italic attribute flag
Underline, // underline attribute flag
0, // strikeout attribute flag
ANSI_CHARSET, // character set identifier
OUT_TT_PRECIS, // output precision
0, // clipping precision
ANTIALIASED_QUALITY, // output quality
0, // pitch and family
FontName.c_str() // pointer to typeface name string
);
// Assign font to DC
SelectObject( DC, fontObj );
// Free memory
DeleteObject( fontObj );
}
//---------------------------------------------------------------------------
void GTK2Font::AssignFont( Graphics *dest )
{
HDC DC = ( (GTK2Graphics *)dest )->GetImageHandle();
AssignGTK2Font( DC );
}
//---------------------------------------------------------------------------
void GTK2Font::GetSize( string text, int &w, int &h )
{
// Get device context of screen
HDC DeskDC = GetWindowDC( GetDesktopWindow() );
// Get size
LPRECT rect = new RECT;;
rect->left = 0;
rect->top = 0;
AssignGTK2Font( DeskDC );
DrawText( DeskDC, text.c_str(), text.length(), rect, DT_CALCRECT);
w = rect->right - rect->left;
h = rect->bottom - rect->top;
// Release screen device context
ReleaseDC( GetDesktopWindow(), DeskDC );
}
//---------------------------------------------------------------------------
void GTK2Font::GenericPrint( Graphics *dest, string text, int x, int y,
int w, int h, int align, int color )
{
HDC DC = ( (GTK2Graphics *)dest )->GetImageHandle();
// Set boundaries
LPRECT r = new RECT;
r->left = x;
r->top = y;
r->right = x + w;
r->bottom = y + h;
// Get desktop Device Context
SetBkMode( DC, TRANSPARENT );
// Modify desktop attributes
AssignFont( dest );
// Change text color
SetTextColor( DC, color );
// Draw text on screen
DrawText( DC, text.c_str(), text.length(), r, align );
// Set text color to black to avoid graphic bugs
SetTextColor( DC, 0 );
// Free memory
delete r;
}
//---------------------------------------------------------------------------
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 );
}
//---------------------------------------------------------------------------
*/
/*****************************************************************************
* gtk2_font.h: GTK2 implementation of the Font class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_font.h,v 1.1 2003/04/12 21:43:27 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_FONT
#define VLC_SKIN_GTK2_FONT
//--- GENERAL ---------------------------------------------------------------
#include <string>
using namespace std;
//---------------------------------------------------------------------------
struct intf_thread_t;
class Graphics;
//---------------------------------------------------------------------------
class GTK2Font : Font
{
private:
// Assign font to Device Context
virtual void AssignFont( Graphics *dest );
// void AssignGTK2Font( HDC DC );
// 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
/*****************************************************************************
* gtk2_graphics.cpp: GTK2 implementation of the Graphics and Region classes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_graphics.cpp,v 1.1 2003/04/12 21:43:27 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.
*****************************************************************************/
//--- GTK2 -----------------------------------------------------------------
//#include <windows.h>
//--- SKIN ------------------------------------------------------------------
#include "graphics.h"
#include "window.h"
#include "os_window.h"
#include "gtk2_graphics.h"
/*
//---------------------------------------------------------------------------
// GTK2 GRAPHICS
//---------------------------------------------------------------------------
GTK2Graphics::GTK2Graphics( int w, int h, Window *from ) : Graphics( w, h )
{
HBITMAP HImage ;
Image = CreateCompatibleDC( NULL );
if( from != NULL )
{
HDC DC = GetWindowDC( ( (GTK2Window *)from )->GetHandle() );
HImage = CreateCompatibleBitmap( DC, w, h );
ReleaseDC( ( (GTK2Window *)from )->GetHandle(), DC );
}
else
{
HImage = CreateCompatibleBitmap( Image, w, h );
}
SelectObject( Image, HImage );
DeleteObject( HImage );
}
//---------------------------------------------------------------------------
GTK2Graphics::~GTK2Graphics()
{
DeleteDC( Image );
}
//---------------------------------------------------------------------------
void GTK2Graphics::CopyFrom( int dx, int dy, int dw, int dh, Graphics *Src,
int sx, int sy, int Flag )
{
BitBlt( Image, dx, dy, dw, dh, ( (GTK2Graphics *)Src )->GetImageHandle(),
sx, sy, Flag );
}
*/
//---------------------------------------------------------------------------
/*void GTK2Graphics::CopyTo( Graphics *Dest, int dx, int dy, int dw, int dh,
int sx, int sy, int Flag )
{
BitBlt( ( (GTK2Graphics *)Dest )->GetImageHandle(), dx, dy, dw, dh, Image,
sx, sy, Flag );
}*//*
//---------------------------------------------------------------------------
void GTK2Graphics::DrawRect( int x, int y, int w, int h, int color )
{
LPRECT r = new RECT;
HBRUSH Brush = CreateSolidBrush( color );
r->left = x;
r->top = y;
r->right = x + w;
r->bottom = y + h;
FillRect( Image, r, Brush );
DeleteObject( Brush );
delete r;
}
//---------------------------------------------------------------------------
void GTK2Graphics::SetClipRegion( Region *rgn )
{
SelectClipRgn( Image, ( (GTK2Region *)rgn )->GetHandle() );
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// GTK2 REGION
//---------------------------------------------------------------------------
GTK2Region::GTK2Region()
{
Rgn = CreateRectRgn( 0, 0, 0, 0 );
}
//---------------------------------------------------------------------------
GTK2Region::GTK2Region( int x, int y, int w, int h )
{
Rgn = CreateRectRgn( x, y, x + w, y + h );
}
//---------------------------------------------------------------------------
GTK2Region::~GTK2Region()
{
DeleteObject( Rgn );
}
//---------------------------------------------------------------------------
void GTK2Region::AddPoint( int x, int y )
{
AddRectangle( x, y, x + 1, y + 1 );
}
//---------------------------------------------------------------------------
void GTK2Region::AddRectangle( int x, int y, int w, int h )
{
HRGN Buffer;
Buffer = CreateRectRgn( x, y, x + w, y + h );
CombineRgn( Rgn, Buffer, Rgn, 0x2 );
DeleteObject( Buffer );
}
//---------------------------------------------------------------------------
void GTK2Region::AddElipse( int x, int y, int w, int h )
{
HRGN Buffer;
Buffer = CreateEllipticRgn( x, y, x + w, y + h );
CombineRgn( Rgn, Buffer, Rgn, 0x2 );
DeleteObject( Buffer );
}
//---------------------------------------------------------------------------
void GTK2Region::Move( int x, int y )
{
OffsetRgn( Rgn, x, y );
}
//---------------------------------------------------------------------------
bool GTK2Region::Hit( int x, int y )
{
return PtInRegion( Rgn, x, y );
}
//---------------------------------------------------------------------------
*/
/*****************************************************************************
* gtk2_graphics.h: GTK2 implementation of the Graphics and Region classes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_graphics.h,v 1.1 2003/04/12 21:43:27 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
//---------------------------------------------------------------------------
class Region;
class Window;
//---------------------------------------------------------------------------
class GTK2Graphics : public Graphics
{
private:
int Width;
int Height;
// HDC Image;
public:
// Constructor
GTK2Graphics( int w, int h, Window *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( Region *rgn );
// Specific GTK2 methods
// HDC GetImageHandle() { return Image; };
};
//---------------------------------------------------------------------------
class GTK2Region : public Region
{
private:
// HRGN 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
// HRGN GetHandle() { return Rgn; };
};
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* gtk2_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_run.cpp,v 1.1 2003/04/12 21:43:27 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.
*****************************************************************************/
//--- GTK2 ------------------------------------------------------------------
//#include <windows.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
//--- SKIN ------------------------------------------------------------------
#include "os_api.h"
#include "event.h"
#include "os_event.h"
#include "banks.h"
#include "window.h"
#include "os_window.h"
#include "theme.h"
#include "os_theme.h"
#include "skin_common.h"
#include "vlcproc.h"
#if 0
//---------------------------------------------------------------------------
// Specific method
//---------------------------------------------------------------------------
bool IsVLCEvent( unsigned int msg );
int SkinManage( intf_thread_t *p_intf );
//---------------------------------------------------------------------------
// REFRESH TIMER CALLBACK
//---------------------------------------------------------------------------
void CALLBACK RefreshTimer( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime )
{
intf_thread_t *p_intf = (intf_thread_t *)GetWindowLongPtr( hwnd,
GWLP_USERDATA );
SkinManage( p_intf );
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// GTK2 interface
//---------------------------------------------------------------------------
void OSRun( intf_thread_t *p_intf )
{
VlcProc *Proc = new VlcProc( p_intf );
MSG msg;
list<Window *>::const_iterator win;
Event *ProcessEvent;
int KeyModifier = 0;
// Create refresh timer
SetTimer( ((OSTheme *)p_intf->p_sys->p_theme)->GetParentWindow(), 42, 200,
(TIMERPROC)RefreshTimer );
// Compute windows message list
while( GetMessage( &msg, NULL, 0, 0 ) )
{
// Translate keys
TranslateMessage( &msg );
// Create event
ProcessEvent = (Event *)new OSEvent( p_intf, msg.hwnd, msg.message,
msg.wParam, msg.lParam );
/*****************************
* Process keyboard shortcuts *
*****************************/
if( msg.message == WM_KEYUP )
{
msg_Err( p_intf, "Key : %i (%i)", msg.wParam, KeyModifier );
// If key is CTRL
if( msg.wParam == 17 )
KeyModifier = 0;
else if( KeyModifier == 0 )
{
p_intf->p_sys->p_theme->EvtBank->TestShortcut(
msg.wParam, 0 );
}
}
else if( msg.message == WM_KEYDOWN )
{
// If key is control
if( msg.wParam == 17 )
KeyModifier = 2;
else if( KeyModifier > 0 )
p_intf->p_sys->p_theme->EvtBank->TestShortcut(
msg.wParam, KeyModifier );
}
else if( msg.message == WM_SYSKEYDOWN )
{
// If key is ALT
if( msg.wParam == 18 )
KeyModifier = 1;
}
else if( msg.message == WM_SYSKEYUP )
{
// If key is a system key
KeyModifier = 0;
}
/************************
* Process timer message *
************************/
else if( msg.message == WM_TIMER )
{
DispatchMessage( &msg );
}
/***********************
* VLC specific message *
***********************/
else if( IsVLCEvent( msg.message ) )
{
if( !Proc->EventProc( ProcessEvent ) )
break; // Exit VLC !
}
/**********************
* Broadcsated message *
**********************/
else if( msg.hwnd == NULL )
{
for( win = p_intf->p_sys->p_theme->WindowList.begin();
win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
(*win)->ProcessEvent( ProcessEvent );
}
}
/***********************
* Process window event *
***********************/
else
{
DispatchMessage( &msg );
}
// Delete event
ProcessEvent->DestructParameters();
delete (OSEvent *)ProcessEvent;
// Check if vlc is closing
Proc->IsClosing();
}
}
//---------------------------------------------------------------------------
bool IsVLCEvent( unsigned int msg )
{
return( msg > VLC_MESSAGE && msg < VLC_WINDOW );
}
//---------------------------------------------------------------------------
#endif
This diff is collapsed.
/*****************************************************************************
* gtk2_theme.h: GTK2 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_theme.h,v 1.1 2003/04/12 21:43:27 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 <shellapi.h>
//---------------------------------------------------------------------------
struct intf_thread_t;
class Window;
class EventBank;
class BitmapBank;
class FontBank;
class LogWindow;
//---------------------------------------------------------------------------
class GTK2Theme : public Theme
{
protected:
// Handles
/* HINSTANCE hinst;
HWND 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; }
HWND GetLogHandle();
HWND 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
/*****************************************************************************
* gtk2_window.cpp: GTK2 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_window.cpp,v 1.1 2003/04/12 21:43:27 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.
*****************************************************************************/
//--- GENERAL ---------------------------------------------------------------
//#include <math.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
//--- GTK2 ------------------------------------------------------------------
//#include <windows.h>
//--- SKIN ------------------------------------------------------------------
#include "os_api.h"
#include "anchor.h"
#include "generic.h"
#include "window.h"
#include "os_window.h"
#include "event.h"
#include "os_event.h"
#include "graphics.h"
#include "os_graphics.h"
#include "skin_common.h"
#include "theme.h"
/*
//---------------------------------------------------------------------------
// Fading API
//---------------------------------------------------------------------------
#define LWA_COLORKEY 0x00000001
#define LWA_ALPHA 0x00000002
typedef BOOL (WINAPI *SLWA)(HWND, COLORREF, BYTE, DWORD);
HMODULE hModule = LoadLibrary( "user32.dll" );
SLWA SetLayeredWindowAttributes =
(SLWA)GetProcAddress( hModule, "SetLayeredWindowAttributes" );
//---------------------------------------------------------------------------
// Skinable Window
//---------------------------------------------------------------------------
GTK2Window::GTK2Window( intf_thread_t *p_intf, HWND hwnd, int x, int y,
bool visible, int transition, int normalalpha, int movealpha,
bool dragdrop )
: Window( p_intf, x, y, visible, transition, normalalpha, movealpha,
dragdrop )
{
// Set handles
hWnd = hwnd;
// 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 );
// Drag & drop
if( DragDrop )
{
// Initialize the OLE library
OleInitialize( NULL );
DropTarget = (LPDROPTARGET) new GTK2DropObject();
// register the listview as a drop target
RegisterDragDrop( hWnd, DropTarget );
}
}
//---------------------------------------------------------------------------
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();
}
}
//---------------------------------------------------------------------------
void GTK2Window::OSShow( bool show )
{
if( show )
{
ShowWindow( hWnd, SW_SHOW );
}
else
{
ShowWindow( hWnd, SW_HIDE );
}
}
//---------------------------------------------------------------------------
bool GTK2Window::ProcessOSEvent( Event *evt )
{
unsigned int msg = evt->GetMessage();
unsigned int p1 = evt->GetParam1();
int p2 = evt->GetParam2();
switch( msg )
{
case WM_PAINT:
HDC DC;
PAINTSTRUCT Infos;
DC = BeginPaint( hWnd , &Infos );
EndPaint( hWnd , &Infos );
RefreshFromImage( 0, 0, Width, Height );
return true;
case WM_MOUSEMOVE:
TRACKMOUSEEVENT TrackEvent;
TrackEvent.cbSize = sizeof( TRACKMOUSEEVENT );
TrackEvent.dwFlags = TME_LEAVE;
TrackEvent.hwndTrack = hWnd;
TrackEvent.dwHoverTime = 1;
TrackMouseEvent( &TrackEvent );
if( p1 == MK_LBUTTON )
MouseMove( LOWORD( p2 ), HIWORD( p2 ), 1 );
else if( p1 == MK_RBUTTON )
MouseMove( LOWORD( p2 ), HIWORD( p2 ), 2 );
else
MouseMove( LOWORD( p2 ), HIWORD( p2 ), 0 );
return true;
case WM_LBUTTONDOWN:
SetCapture( hWnd );
MouseDown( LOWORD( p2 ), HIWORD( p2 ), 1 );
return true;
case WM_LBUTTONUP:
ReleaseCapture();
MouseUp( LOWORD( p2 ), HIWORD( p2 ), 1 );
return true;
case WM_RBUTTONDOWN:
MouseDown( LOWORD( p2 ), HIWORD( p2 ), 2 );
return true;
case WM_RBUTTONUP:
MouseUp( LOWORD( p2 ), HIWORD( p2 ), 2 );
return true;
case WM_LBUTTONDBLCLK:
MouseDblClick( LOWORD( p2 ), HIWORD( p2 ), 1 );
return true;
case WM_MOUSELEAVE:
OSAPI_PostMessage( this, WINDOW_LEAVE, 0, 0 );
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 );
}
//---------------------------------------------------------------------------
void GTK2Window::WindowManualMove()
{
// Get mouse cursor position
LPPOINT NewPos = new POINT;
GetCursorPos( NewPos );
// Move window and chek for magnetism
p_intf->p_sys->p_theme->MoveSkinMagnet( this,
WindowPos->x + NewPos->x - CursorPos->x,
WindowPos->y + NewPos->y - CursorPos->y );
// Free memory
delete[] NewPos;
}
//---------------------------------------------------------------------------
void GTK2Window::WindowManualMoveInit()
{
GetCursorPos( CursorPos );
WindowPos->x = Left;
WindowPos->y = Top;
}
//---------------------------------------------------------------------------
void GTK2Window::Move( int left, int top )
{
Left = left;
Top = top;
//SetWindowPos( hWnd, HWND_TOP, Left, Top, Width, Height,
// SWP_NOSIZE|SWP_NOREDRAW|SWP_NOZORDER );
MoveWindow( hWnd, Left, Top, Width, Height, false );
}
//---------------------------------------------------------------------------
void GTK2Window::Size( int width, int height )
{
Width = width;
Height = height;
SetWindowPos( hWnd, HWND_TOP, Left, Top, Width, Height,
SWP_NOMOVE|SWP_NOREDRAW|SWP_NOZORDER );
}
//---------------------------------------------------------------------------
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 );
}
}
}
//---------------------------------------------------------------------------
*/
/*****************************************************************************
* gtk2_window.h: GTK2 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_window.h,v 1.1 2003/04/12 21:43:27 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 Window
{
private:
// General parameters
GdkWindow *gWnd;
/* LPPOINT CursorPos;
LPPOINT WindowPos;
// Tooltip texts
HWND ToolTipWindow;
TOOLINFO ToolTipInfo;
// Drag & drop
LPDROPTARGET DropTarget;*/
public:
// Cosntructors
GTK2Window( intf_thread_t *_p_intf, GdkWindow *gwnd, int x, int y,
bool visible, int transition, int normalalpha, int movealpha,
bool dragdrop );
// 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 );
};
//---------------------------------------------------------------------------
#endif
......@@ -2,7 +2,7 @@
* os_api.h: Wrapper for some os-specific functions
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: os_api.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: os_api.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -29,6 +29,8 @@
#if defined( WIN32 )
#define DIRECTORY_SEPARATOR '\\'
#else
#define DIRECTORY_SEPARATOR '/'
#endif
......
......@@ -2,7 +2,7 @@
* os_bitmap.h: Wrapper for the Bitmap class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: os_bitmap.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: os_bitmap.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -27,6 +27,9 @@
#if defined( WIN32 )
#include "win32_bitmap.h"
#define OSBitmap Win32Bitmap
#else
#include "gtk2_bitmap.h"
#define OSBitmap GTK2Bitmap
#endif
......@@ -2,7 +2,7 @@
* os_dialog.h: Wrapper for the common dialogs
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: os_dialog.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: os_dialog.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -28,6 +28,10 @@
#include "win32_dialog.h"
#define OSOpenFileDialog Win32OpenFileDialog
#define OSLogWindow Win32LogWindow
#else
#include "gtk2_dialog.h"
#define OSOpenFileDialog GTK2OpenFileDialog
#define OSLogWindow GTK2LogWindow
#endif
......
......@@ -2,7 +2,7 @@
* os_event.h: Wrapper for the Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: os_event.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: os_event.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -27,5 +27,8 @@
#if defined( WIN32 )
#include "win32_event.h"
#define OSEvent Win32Event
#else
#include "gtk2_event.h"
#define OSEvent GTK2Event
#endif
......@@ -2,7 +2,7 @@
* os_font.h: Wrapper for the OSFont class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: os_font.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: os_font.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -27,4 +27,7 @@
#if defined( WIN32 )
#include "win32_font.h"
#define OSFont Win32Font
#else
#include "gtk2_font.h"
#define OSFont GTK2Font
#endif
......@@ -2,7 +2,7 @@
* os_graphics.h: Wrapper for the Graphics and Region classes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: os_graphics.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: os_graphics.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -26,11 +26,15 @@
#if defined( WIN32 )
#include "win32_graphics.h"
#define SRC_COPY SRCCOPY
#define SRC_AND SRCAND
#define OSGraphics Win32Graphics
#define OSRegion Win32Region
#else
#include "gtk2_graphics.h"
#define SRC_COPY SRCCOPY
#define SRC_AND SRCAND
#define OSGraphics GTK2Graphics
#define OSRegion GTK2Region
#endif
......@@ -2,7 +2,7 @@
* os_theme.h: Wrapper for the OSTheme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: os_theme.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: os_theme.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -27,4 +27,7 @@
#if defined( WIN32 )
#include "win32_theme.h"
#define OSTheme Win32Theme
#else
#include "gtk2_theme.h"
#define OSTheme GTK2Theme
#endif
......@@ -2,7 +2,7 @@
* os_window.h: Wrapper for the OSWindow class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: os_window.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: os_window.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -28,4 +28,8 @@
#include "win32_dragdrop.h"
#include "win32_window.h"
#define OSWindow Win32Window
#else
#include "gtk2_dragdrop.h"
#include "gtk2_window.h"
#define OSWindow GTK2Window
#endif
......@@ -2,7 +2,7 @@
* wrappers.cpp: Wrappers around C++ objects
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: wrappers.cpp,v 1.4 2003/03/19 17:14:50 karibu Exp $
* $Id: wrappers.cpp,v 1.5 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -37,6 +37,7 @@ extern intf_thread_t *g_pIntf;
#include "anchor.h"
#include "banks.h"
#include "controls.h"
#include "font.h"
#include "window.h"
#include "theme.h"
#include "skin_common.h"
......
......@@ -2,7 +2,7 @@
* dialog.cpp: Classes for some dialog boxes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: dialog.cpp,v 1.2 2003/03/20 09:29:07 karibu Exp $
* $Id: dialog.cpp,v 1.3 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -87,6 +87,8 @@ void LogWindow::Update( msg_subscription_t *Sub )
{
/* FIXME: kludge */
#ifdef WIN32
// Append all messages to log window
switch( Sub->p_msg[i_start].i_type )
{
......@@ -99,6 +101,21 @@ void LogWindow::Update( msg_subscription_t *Sub )
default:
ChangeColor( RGB( 128, 128, 128 ) );
break;
#else
fprintf(stderr, "WARNING: FIXME in dialog.cpp");
// Append all messages to log window
switch( Sub->p_msg[i_start].i_type )
{
case VLC_MSG_ERR:
// ChangeColor( RGB( 255, 0, 0 ), true );
break;
case VLC_MSG_WARN:
// ChangeColor( RGB( 255, 128, 0 ), true );
break;
default:
// ChangeColor( RGB( 128, 128, 128 ) );
break;
#endif
}
// Add message
......
......@@ -2,7 +2,7 @@
* event.h: Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: event.h,v 1.4 2003/04/11 22:08:06 videolan Exp $
* $Id: event.h,v 1.5 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -41,6 +41,10 @@ using namespace std;
#define MAX_EVENT_SIZE 30
#define MAX_PARAM_SIZE 20
#if !defined _WIN32
#define WM_APP 0x8000
#endif
#define VLC_MESSAGE (WM_APP)
#define VLC_WINDOW (WM_APP + 1000)
#define VLC_CONTROL (WM_APP + 2000)
......
......@@ -2,7 +2,7 @@
* font.h: Font class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: font.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: font.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -31,6 +31,12 @@
#include <string>
using namespace std;
/* FIXME :kludge */
#define DT_TOP 0 // 0x0000
#define DT_LEFT 0 // 0x0000
#define DT_CENTER 1 // 0x0001
#define DT_RIGHT 2 // 0x0002
//---------------------------------------------------------------------------
struct intf_thread_t;
class Graphics;
......
......@@ -2,7 +2,7 @@
* skin-main.cpp: skins plugin for VLC
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin_main.cpp,v 1.5 2003/04/06 17:57:11 ipkiss Exp $
* $Id: skin_main.cpp,v 1.6 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -53,8 +53,10 @@ intf_thread_t *g_pIntf;
//---------------------------------------------------------------------------
// Exported interface functions.
//---------------------------------------------------------------------------
#ifdef WIN32
extern "C" __declspec( dllexport )
int __VLC_SYMBOL( vlc_entry ) ( module_t *p_module );
#endif
//---------------------------------------------------------------------------
// Local prototypes.
......@@ -155,10 +157,18 @@ static void Run( intf_thread_t *p_intf )
#if 0
if( ! Loader->Load( DEFAULT_SKIN_FILE ) )
#else
#ifdef WIN32
string default_dir = (string)p_intf->p_libvlc->psz_vlcpath +
DIRECTORY_SEPARATOR + "skins" +
DIRECTORY_SEPARATOR + "default" +
DIRECTORY_SEPARATOR + "theme.xml";
#else
/* FIXME: find VLC directory */
string default_dir = (string)"." +
DIRECTORY_SEPARATOR + "skins" +
DIRECTORY_SEPARATOR + "default" +
DIRECTORY_SEPARATOR + "theme.xml";
#endif
if( ! Loader->Load( default_dir ) )
#endif
{
......@@ -326,6 +336,6 @@ int SkinManage( intf_thread_t *p_intf )
//-------------------------------------------------------------------------
vlc_mutex_unlock( &p_intf->change_lock );
return( TRUE );
return( VLC_TRUE );
}
//---------------------------------------------------------------------------
......@@ -2,7 +2,7 @@
* themeloader.cpp: ThemeLoader class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: themeloader.cpp,v 1.3 2003/03/19 03:11:14 karibu Exp $
* $Id: themeloader.cpp,v 1.4 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -27,6 +27,9 @@
//--- GENERAL ---------------------------------------------------------------
#include <string>
#include <fcntl.h>
#if !defined WIN32
#include <unistd.h>
#endif
//--- VLC -------------------------------------------------------------------
#include <vlc/vlc.h>
......@@ -180,8 +183,13 @@ bool ThemeLoader::Parse( const string XmlFile )
msg_Dbg( p_intf, "Using skin file: %s", XmlFile.c_str() );
// Save current working directory
#ifdef WIN32
char *cwd = new char[MAX_PATH];
getcwd( cwd, MAX_PATH );
#else
char *cwd = new char[PATH_MAX];
getcwd( cwd, PATH_MAX );
#endif
// Directory separator is different in each OS !
int p = XmlFile.rfind( DIRECTORY_SEPARATOR, XmlFile.size() );
......
......@@ -2,7 +2,7 @@
* vlcproc.cpp: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: vlcproc.cpp,v 1.4 2003/04/11 22:08:06 videolan Exp $
* $Id: vlcproc.cpp,v 1.5 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -581,10 +581,15 @@ void VlcProc::ChangeVolume( unsigned int msg, long param )
}
aout_VolumeGet( p_intf, &volume );
/* FIXME: kludge */
#ifdef WIN32
PostMessage( NULL, CTRL_SET_SLIDER,
(unsigned int)
p_intf->p_sys->p_theme->EvtBank->Get( "volume_refresh" ),
(int)( volume * SLIDER_RANGE / AOUT_VOLUME_MAX ) );
#else
fprintf(stderr, "WARNING: FIXME in vlcproc.cpp !!!");
#endif
}
//---------------------------------------------------------------------------
......@@ -594,7 +599,7 @@ void VlcProc::ChangeVolume( unsigned int msg, long param )
//---------------------------------------------------------------------------
void VlcProc::AddNetworkUDP( int port )
{
config_PutInt( p_intf, "network-channel", FALSE );
config_PutInt( p_intf, "network-channel", VLC_FALSE );
// Build source name
char *s_port = new char[5];
......
......@@ -2,7 +2,7 @@
* window.cpp: Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: window.cpp,v 1.4 2003/03/20 09:29:07 karibu Exp $
* $Id: window.cpp,v 1.5 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -278,7 +278,12 @@ void Window::RefreshImage( int x, int y, int w, int h )
ControlList[i]->Draw( x, y, w, h, Buffer );
// Copy buffer in Image
/* FIXME: kludge */
#ifdef WIN32
Image->CopyFrom( x, y, w, h, Buffer, 0, 0, SRC_COPY );
#else
fprintf(stderr, "WARNING: FIXME in window.cpp !!!!");
#endif
// Free memory
delete Buffer;
......
......@@ -2,7 +2,7 @@
* win32_api.cpp: Various win32-specific functions
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_api.cpp,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: win32_api.cpp,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
//--- WIN32 -----------------------------------------------------------------
#include <windows.h>
......@@ -159,3 +160,4 @@ bool OSAPI_RmDir( string path )
}
//---------------------------------------------------------------------------
#endif
......@@ -2,7 +2,7 @@
* win32_bitmap.cpp: Win32 implementation of the Bitmap class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_bitmap.cpp,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: win32_bitmap.cpp,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
//--- WIN32 -----------------------------------------------------------------
#define WINVER 0x0500
......@@ -173,3 +174,4 @@ void Win32Bitmap::SetBmpPixel( int x, int y, int color )
}
//---------------------------------------------------------------------------
#endif
......@@ -2,7 +2,7 @@
* win32_bitmap.h: Win32 implementation of the Bitmap class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_bitmap.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: win32_bitmap.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
#ifndef VLC_WIN32_BITMAP
#define VLC_WIN32_BITMAP
......@@ -67,3 +68,5 @@ class Win32Bitmap : public Bitmap
//---------------------------------------------------------------------------
#endif
#endif
......@@ -2,7 +2,7 @@
* win32_dialog.cpp: Win32 implementation of some dialog boxes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_dialog.cpp,v 1.2 2003/03/20 09:29:07 karibu Exp $
* $Id: win32_dialog.cpp,v 1.3 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
......@@ -359,3 +360,4 @@ void Win32LogWindow::Hide()
}
//---------------------------------------------------------------------------
#endif
......@@ -2,7 +2,7 @@
* win32_dialog.h: Win32 implementation of some dialog boxes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_dialog.h,v 1.2 2003/03/20 09:29:07 karibu Exp $
* $Id: win32_dialog.h,v 1.3 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
#ifndef VLC_SKIN_WIN32_DIALOG
#define VLC_SKIN_WIN32_DIALOG
......@@ -81,3 +82,4 @@ class Win32LogWindow : LogWindow
#endif
#endif
......@@ -2,7 +2,7 @@
* win32_dragdrop.cpp: Win32 implementation of the drag & drop
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_dragdrop.cpp,v 1.2 2003/03/18 04:56:58 ipkiss Exp $
* $Id: win32_dragdrop.cpp,v 1.3 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
//--- WIN32 -----------------------------------------------------------------
#include <windows.h>
......@@ -164,3 +165,4 @@ STDMETHODIMP Win32DropObject::Drop( LPDATAOBJECT pDataObj, DWORD grfKeyState,
return S_OK;
}
#endif
......@@ -2,7 +2,7 @@
* win32_dragdrop.h: Win32 implementation of the drag & drop
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_dragdrop.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: win32_dragdrop.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
#ifndef VLC_SKIN_WIN32_DRAGDROP
#define VLC_SKIN_WIN32_DRAGDROP
......@@ -60,3 +61,5 @@ class Win32DropObject : public IDropTarget
};
//---------------------------------------------------------------------------
#endif
#endif
......@@ -2,7 +2,7 @@
* win32_event.cpp: Win32 implementation of the Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_event.cpp,v 1.2 2003/03/19 17:14:50 karibu Exp $
* $Id: win32_event.cpp,v 1.3 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
//--- WIN32 -----------------------------------------------------------------
#include <windows.h>
......@@ -119,3 +120,4 @@ HWND Win32Event::GetWindowFromName( string name )
}
//---------------------------------------------------------------------------
#endif
......@@ -2,7 +2,7 @@
* win32_event.h: Win32 implementation of the Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_event.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: win32_event.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
#ifndef VLC_SKIN_WIN32_EVENT
#define VLC_SKIN_WIN32_EVENT
......@@ -65,3 +66,5 @@ class Win32Event : Event
//---------------------------------------------------------------------------
#endif
#endif
......@@ -2,7 +2,7 @@
* win32_font.cpp: Win32 implementation of the Font class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_font.cpp,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: win32_font.cpp,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
//--- WIN32 -----------------------------------------------------------------
#include <windows.h>
......@@ -147,3 +148,4 @@ void Win32Font::PrintColor( Graphics *dest, string text, int x, int y, int w,
//---------------------------------------------------------------------------
#endif
......@@ -2,7 +2,7 @@
* win32_font.h: Win32 implementation of the Font class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_font.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: win32_font.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
#ifndef VLC_SKIN_WIN32_FONT
#define VLC_SKIN_WIN32_FONT
......@@ -69,3 +70,5 @@ class Win32Font : Font
//---------------------------------------------------------------------------
#endif
#endif
......@@ -2,7 +2,7 @@
* win32_graphics.cpp: Win32 implementation of the Graphics and Region classes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_graphics.cpp,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: win32_graphics.cpp,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
//--- WIN32 -----------------------------------------------------------------
#include <windows.h>
......@@ -146,3 +147,5 @@ bool Win32Region::Hit( int x, int y )
return PtInRegion( Rgn, x, y );
}
//---------------------------------------------------------------------------
#endif
......@@ -2,7 +2,7 @@
* win32_graphics.h: Win32 implementation of the Graphics and Region classes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_graphics.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: win32_graphics.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
#ifndef VLC_SKIN_WIN32_GRAPHICS
#define VLC_SKIN_WIN32_GRAPHICS
......@@ -81,3 +82,5 @@ class Win32Region : public Region
//---------------------------------------------------------------------------
#endif
#endif
......@@ -2,7 +2,7 @@
* win32_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_run.cpp,v 1.3 2003/03/20 09:29:07 karibu Exp $
* $Id: win32_run.cpp,v 1.4 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
//--- WIN32 -----------------------------------------------------------------
#include <windows.h>
......@@ -179,4 +180,4 @@ bool IsVLCEvent( unsigned int msg )
}
//---------------------------------------------------------------------------
#endif
......@@ -2,7 +2,7 @@
* win32_theme.cpp: Win32 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_theme.cpp,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: win32_theme.cpp,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
//--- WIN32 -----------------------------------------------------------------
#include <windows.h>
......@@ -341,3 +342,4 @@ void Win32Theme::ChangeTaskbar()
}
//---------------------------------------------------------------------------
#endif
......@@ -2,7 +2,7 @@
* win32_theme.h: Win32 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_theme.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: win32_theme.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
#ifndef VLC_SKIN_WIN32_THEME
#define VLC_SKIN_WIN32_THEME
......@@ -83,3 +84,4 @@ class Win32Theme : public Theme
#endif
#endif
......@@ -2,7 +2,7 @@
* win32_window.cpp: Win32 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_window.cpp,v 1.3 2003/03/20 09:29:07 karibu Exp $
* $Id: win32_window.cpp,v 1.4 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
//--- GENERAL ---------------------------------------------------------------
//#include <math.h>
......@@ -293,3 +294,4 @@ void Win32Window::ChangeToolTipText( string text )
}
//---------------------------------------------------------------------------
#endif
......@@ -2,7 +2,7 @@
* win32_window.h: Win32 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_window.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: win32_window.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#ifdef WIN32
#ifndef VLC_SKIN_WIN32_WIN
#define VLC_SKIN_WIN32_WIN
......@@ -82,3 +83,5 @@ class Win32Window : public Window
//---------------------------------------------------------------------------
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment