Commit db008d07 authored by Cyril Deguet's avatar Cyril Deguet

* Gtk2 skins: it doesn't work but it runs without any segfault, so

  I commit ;)
  (I probably broke skins under windows....)
parent eb3609cd
......@@ -2,7 +2,7 @@
* gtk2_api.cpp: Various gtk2-specific functions
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_api.cpp,v 1.2 2003/04/12 22:50:42 asmax Exp $
* $Id: gtk2_api.cpp,v 1.3 2003/04/13 17:46:22 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -24,7 +24,7 @@
//--- GTK2 ------------------------------------------------------------------
#include <gtk/gtk.h>
#include <gdk/gdk.h>
//--- SKIN ------------------------------------------------------------------
#include "window.h"
......@@ -109,12 +109,14 @@ void OSAPI_GetMousePos( int &x, int &y )
//---------------------------------------------------------------------------
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;*/
// char *buffer = new char[MAX_PARAM_SIZE];
// GetWindowText( ((GTK2Window *)win)->GetHandle(), buffer, MAX_PARAM_SIZE );
// string Title = buffer;
/* FIXME */
string Title = "";
// delete buffer;
return Title;
}
//---------------------------------------------------------------------------
bool OSAPI_RmDir( string path )
......
......@@ -2,7 +2,7 @@
* gtk2_event.cpp: GTK2 implementation of the Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_event.cpp,v 1.2 2003/04/12 22:50:42 asmax Exp $
* $Id: gtk2_event.cpp,v 1.3 2003/04/13 17:46:22 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -24,7 +24,7 @@
//--- GTK2 -----------------------------------------------------------------
//#include <windows.h>
#include <gdk/gdk.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
......@@ -45,19 +45,19 @@
GTK2Event::GTK2Event( intf_thread_t *p_intf, string Desc, string shortcut )
: Event( p_intf, Desc, shortcut )
{
/* hWnd = NULL;*/
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 )
{
/* hWnd = hwnd;*/
gWnd = gwnd;
}
//---------------------------------------------------------------------------
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();*/
gWnd = ( (GTK2Window *)win )->GetHandle();
}
//---------------------------------------------------------------------------
GTK2Event::~GTK2Event()
......@@ -72,9 +72,9 @@ bool GTK2Event::SendEvent()
PostSynchroMessage();
return true;
}
return true;
*/
return true;
}
//---------------------------------------------------------------------------
bool GTK2Event::IsEqual( Event *evt )
......@@ -86,34 +86,35 @@ bool GTK2Event::IsEqual( Event *evt )
//---------------------------------------------------------------------------
void GTK2Event::CreateOSEvent( string para1, string para2, string para3 )
{
/*
// Find Parameters
switch( Message )
{
case WINDOW_MOVE:
hWnd = GetWindowFromName( para1 );
gWnd = GetWindowFromName( para1 );
break;
case WINDOW_CLOSE:
hWnd = GetWindowFromName( para1 );
gWnd = GetWindowFromName( para1 );
break;
case WINDOW_OPEN:
hWnd = GetWindowFromName( para1 );
gWnd = GetWindowFromName( para1 );
break;
}
*/
}
//---------------------------------------------------------------------------
GdkWindow *GTK2Event::GetWindowFromName( string name )
{
/* GTK2Window *win = (GTK2Window *)
GTK2Window *win = (GTK2Window *)
p_intf->p_sys->p_theme->GetWindow( name );
if( win == NULL )
if( win == NULL )
{
return NULL;
else
return win->GetHandle();*/
}
else {
return win->GetHandle();
}
}
//---------------------------------------------------------------------------
......@@ -2,7 +2,7 @@
* gtk2_font.cpp: GTK2 implementation of the Font class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_font.cpp,v 1.2 2003/04/12 22:50:42 asmax Exp $
* $Id: gtk2_font.cpp,v 1.3 2003/04/13 17:46:22 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -24,7 +24,7 @@
//--- GTK2 -----------------------------------------------------------------
//#include <windows.h>
#include <gdk/gdk.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
......@@ -44,13 +44,19 @@ 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 )
{
/* FIXME */
/* GFont = gdk_font_load( "-adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1" );
if( GFont == NULL )
{
msg_Err( _p_intf, "Could not load font %s", fontname.c_str());
}*/
}
//---------------------------------------------------------------------------
GTK2Font::~GTK2Font()
{
}
//---------------------------------------------------------------------------
/*void GTK2Font::AssignGTK2Font( HDC DC )
/*void GTK2Font::AssignGTK2Font( GdkDrawable *DC )
{
// Create font
HGDIOBJ fontObj = CreateFont(
......@@ -75,11 +81,13 @@ GTK2Font::~GTK2Font()
// Free memory
DeleteObject( fontObj );
// GdkGC *gc = gdk_gc_new( DC );
// gdk_gc_set_font( GFont, gc );
}*/
//---------------------------------------------------------------------------
void GTK2Font::AssignFont( Graphics *dest )
{/*
HDC DC = ( (GTK2Graphics *)dest )->GetImageHandle();
{
/* GdkDrawable *DC = ( (GTK2Graphics *)dest )->GetImageHandle();
AssignGTK2Font( DC );*/
}
//---------------------------------------------------------------------------
......@@ -99,6 +107,11 @@ void GTK2Font::GetSize( string text, int &w, int &h )
// Release screen device context
ReleaseDC( GetDesktopWindow(), DeskDC );*/
/*FIXME*/
/* w = gdk_text_width( GFont, text.c_str(), text.length() );
h = gdk_text_height( GFont, text.c_str(), text.length() );*/
w = 0;
h = 0;
}
//---------------------------------------------------------------------------
void GTK2Font::GenericPrint( Graphics *dest, string text, int x, int y,
......@@ -135,13 +148,13 @@ void GTK2Font::GenericPrint( Graphics *dest, string text, int x, int y,
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 );*/
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 );*/
GenericPrint( dest, text, x, y, w, h, align, color );
}
//---------------------------------------------------------------------------
......@@ -2,7 +2,7 @@
* 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 $
* $Id: gtk2_font.h,v 1.2 2003/04/13 17:46:22 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -30,6 +30,9 @@
#include <string>
using namespace std;
//--- GTK2 -----------------------------------------------------------------
#include <gdk/gdk.h>
//---------------------------------------------------------------------------
struct intf_thread_t;
class Graphics;
......@@ -38,6 +41,7 @@ class Graphics;
class GTK2Font : Font
{
private:
GdkFont *GFont;
// Assign font to Device Context
virtual void AssignFont( Graphics *dest );
// void AssignGTK2Font( HDC DC );
......
......@@ -2,7 +2,7 @@
* gtk2_graphics.cpp: GTK2 implementation of the Graphics and Region classes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_graphics.cpp,v 1.2 2003/04/12 22:50:42 asmax Exp $
* $Id: gtk2_graphics.cpp,v 1.3 2003/04/13 17:46:22 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -24,7 +24,7 @@
//--- GTK2 -----------------------------------------------------------------
//#include <windows.h>
#include <gdk/gdk.h>
//--- SKIN ------------------------------------------------------------------
#include "graphics.h"
......@@ -52,6 +52,9 @@ GTK2Graphics::GTK2Graphics( int w, int h, Window *from ) : Graphics( w, h )
}
SelectObject( Image, HImage );
DeleteObject( HImage );*/
/* Image = ( GdkDrawable* )( (GTK2Window *)from )->GetHandle();
Gc = gdk_gc_new( Image );*/
}
//---------------------------------------------------------------------------
GTK2Graphics::~GTK2Graphics()
......@@ -76,15 +79,7 @@ void GTK2Graphics::CopyFrom( int dx, int dy, int dw, int dh, Graphics *Src,
//---------------------------------------------------------------------------
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;*/
// gdk_draw_rectangle( Image, Gc, TRUE, x, y, w, h);
}
//---------------------------------------------------------------------------
void GTK2Graphics::SetClipRegion( Region *rgn )
......
......@@ -2,7 +2,7 @@
* 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 $
* $Id: gtk2_graphics.h,v 1.2 2003/04/13 17:46:22 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -27,6 +27,9 @@
#ifndef VLC_SKIN_GTK2_GRAPHICS
#define VLC_SKIN_GTK2_GRAPHICS
//--- GTK2 ------------------------------------------------------------------
#include <gdk/gdk.h>
//---------------------------------------------------------------------------
class Region;
class Window;
......@@ -37,7 +40,8 @@ class GTK2Graphics : public Graphics
private:
int Width;
int Height;
// HDC Image;
GdkDrawable *Image;
GdkGC *Gc;
public:
// Constructor
GTK2Graphics( int w, int h, Window *from = NULL );
......@@ -54,13 +58,13 @@ class GTK2Graphics : public Graphics
virtual void SetClipRegion( Region *rgn );
// Specific GTK2 methods
// HDC GetImageHandle() { return Image; };
GdkDrawable *GetImageHandle() { return Image; };
};
//---------------------------------------------------------------------------
class GTK2Region : public Region
{
private:
// HRGN Rgn;
GdkRegion *Rgn;
public:
// Constructor
GTK2Region();
......@@ -76,7 +80,7 @@ class GTK2Region : public Region
virtual bool Hit( int x, int y );
// Specific GTK2 methods
// HRGN GetHandle() { return Rgn; };
GdkRegion *GetHandle() { return Rgn; };
};
//---------------------------------------------------------------------------
......
......@@ -2,7 +2,7 @@
* gtk2_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_run.cpp,v 1.2 2003/04/12 22:50:42 asmax Exp $
* $Id: gtk2_run.cpp,v 1.3 2003/04/13 17:46:22 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -24,7 +24,8 @@
//--- GTK2 ------------------------------------------------------------------
//#include <windows.h>
#include <glib.h>
#include <gdk/gdk.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
......@@ -171,6 +172,11 @@ void OSRun( intf_thread_t *p_intf )
Proc->IsClosing();
}
#endif
// Main event loop
GMainLoop *loop = g_main_loop_new( NULL, TRUE );
g_main_loop_run( loop );
}
//---------------------------------------------------------------------------
bool IsVLCEvent( unsigned int msg )
......
......@@ -2,7 +2,7 @@
* gtk2_theme.cpp: GTK2 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_theme.cpp,v 1.1 2003/04/12 21:43:27 asmax Exp $
* $Id: gtk2_theme.cpp,v 1.2 2003/04/13 17:46:22 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -24,7 +24,7 @@
//--- GTK2 -----------------------------------------------------------------
#include <gtk/gtk.h>
#include <gdk/gdk.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
......@@ -160,10 +160,10 @@ GTK2Theme::GTK2Theme( intf_thread_t *_p_intf ) : Theme( _p_intf )
return;
}
}
*/
//Initialize value
ParentWindow = NULL;
*/
}
//---------------------------------------------------------------------------
......@@ -258,6 +258,19 @@ 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.width = 100;
attr.height = 100;
attr.window_type = GDK_WINDOW_TOPLEVEL;
attr.wclass = GDK_INPUT_OUTPUT;
gint mask = GDK_WA_TITLE;
// Create the parent window
ParentWindow = gdk_window_new( NULL, &attr, mask);
}
//---------------------------------------------------------------------------
void GTK2Theme::AddSystemMenu( string name, Event *event )
......@@ -297,6 +310,31 @@ void GTK2Theme::AddWindow( string name, int x, int y, bool visible,
WindowList.push_back( (Window *)new OSWindow( p_intf, hwnd, x, y, visible,
fadetime, alpha, movealpha, dragdrop ) ) ;*/
GdkWindowAttr attr;
attr.event_mask = GDK_ALL_EVENTS_MASK;
attr.width = 100;
attr.height = 100;
//attr.window_type = GDK_WINDOW_CHILD;
attr.window_type = GDK_WINDOW_TOPLEVEL;
attr.wclass = GDK_INPUT_OUTPUT;
gint mask =0;
// Create the parent window
// GdkWindow *gwnd = gdk_window_new( ParentWindow, &attr, mask);
GdkWindow *gwnd = gdk_window_new( NULL, &attr, mask);
if( !gwnd )
{
msg_Err( p_intf, "CreateWindow failed" );
return;
}
WindowList.push_back( (Window *)new OSWindow( p_intf, gwnd, x, y, visible,
fadetime, alpha, movealpha, dragdrop ) ) ;
gdk_window_show( ParentWindow );
}
//---------------------------------------------------------------------------
/*HWND GTK2Theme::GetLogHandle()
......
......@@ -2,7 +2,7 @@
* 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 $
* $Id: gtk2_theme.h,v 1.2 2003/04/13 17:46:22 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -31,7 +31,7 @@
using namespace std;
//--- GTK2 -----------------------------------------------------------------
//#include <shellapi.h>
#include <gdk/gdk.h>
//---------------------------------------------------------------------------
struct intf_thread_t;
......@@ -46,9 +46,9 @@ class GTK2Theme : public Theme
{
protected:
// Handles
/* HINSTANCE hinst;
HWND ParentWindow;
// HINSTANCE hinst;
GdkWindow *ParentWindow;
/*
// System tray icon
NOTIFYICONDATA TrayIcon;
HMENU SysMenu;
......@@ -63,9 +63,9 @@ class GTK2Theme : public Theme
/*
// Specific windows methods
HINSTANCE getInstance() { return hinst; }
HWND GetLogHandle();
HWND GetParentWindow() { return ParentWindow; }
*/
HWND GetLogHandle();*/
GdkWindow *GetParentWindow() { return ParentWindow; }
// !!!
virtual void AddWindow( string name, int x, int y, bool visible,
int fadetime, int alpha, int movealpha, bool dragdrop );
......
......@@ -2,7 +2,7 @@
* gtk2_window.cpp: GTK2 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_window.cpp,v 1.2 2003/04/12 22:50:42 asmax Exp $
* $Id: gtk2_window.cpp,v 1.3 2003/04/13 17:46:22 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -30,7 +30,7 @@
#include <vlc/intf.h>
//--- GTK2 ------------------------------------------------------------------
//#include <windows.h>
#include <gdk/gdk.h>
//--- SKIN ------------------------------------------------------------------
#include "os_api.h"
......@@ -68,8 +68,8 @@ GTK2Window::GTK2Window( intf_thread_t *p_intf, GdkWindow *gwnd, int x, int y,
dragdrop )
{
// Set handles
/* hWnd = hwnd;
gWnd = gwnd;
/*
// Set position parameters
CursorPos = new POINT;
WindowPos = new POINT;
......@@ -103,6 +103,16 @@ GTK2Window::GTK2Window( intf_thread_t *p_intf, GdkWindow *gwnd, int x, int y,
RegisterDragDrop( hWnd, DropTarget );
}
*/
// 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()
......@@ -133,11 +143,11 @@ void GTK2Window::OSShow( bool show )
{
/* if( show )
{
ShowWindow( hWnd, SW_SHOW );
gdk_window_show( gWnd );
}
else
{
ShowWindow( hWnd, SW_HIDE );
gdk_window_hide( gWnd );
}*/
}
//---------------------------------------------------------------------------
......
......@@ -2,7 +2,7 @@
* 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 $
* $Id: gtk2_window.h,v 1.2 2003/04/13 17:46:22 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -39,15 +39,15 @@ class GTK2Window : public Window
private:
// General parameters
GdkWindow *gWnd;
/* LPPOINT CursorPos;
LPPOINT WindowPos;
// LPPOINT CursorPos;
// LPPOINT WindowPos;
// Tooltip texts
HWND ToolTipWindow;
TOOLINFO ToolTipInfo;
GdkWindow *ToolTipWindow;
// TOOLINFO ToolTipInfo;
// Drag & drop
LPDROPTARGET DropTarget;*/
// LPDROPTARGET DropTarget;
public:
// Cosntructors
......
......@@ -2,7 +2,7 @@
* wrappers.cpp: Wrappers around C++ objects
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: wrappers.cpp,v 1.5 2003/04/12 21:43:27 asmax Exp $
* $Id: wrappers.cpp,v 1.6 2003/04/13 17:46:22 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -120,6 +120,7 @@ void AddAnchor( char *x, char *y, char *len, char *priority )
Window *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
vlcWin->AnchorList.push_back( new Anchor( g_pIntf, atoi( x ) + XOff,
atoi( y ) + YOff, atoi( len ),
atoi( priority ), vlcWin ) );
......
......@@ -2,7 +2,7 @@
* event.cpp: Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: event.cpp,v 1.5 2003/04/11 22:08:06 videolan Exp $
* $Id: event.cpp,v 1.6 2003/04/13 17:46:23 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -229,7 +229,7 @@ unsigned int Event::GetMessageType( string Desc )
//---------------------------------------------------------------------------
void Event::CreateEvent()
{
// Initiatization
// Initialization
int x, y;
char *msg = new char[MAX_EVENT_SIZE];
char *para1 = new char[MAX_PARAM_SIZE];
......
......@@ -2,7 +2,7 @@
* skin-main.cpp: skins plugin for VLC
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin_main.cpp,v 1.6 2003/04/12 21:43:27 asmax Exp $
* $Id: skin_main.cpp,v 1.7 2003/04/13 17:46:23 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -145,6 +145,17 @@ static void Close ( vlc_object_t *p_this )
//---------------------------------------------------------------------------
static void Run( intf_thread_t *p_intf )
{
#if !defined WIN32
/* FIXME: should be elsewhere ? */