* 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>
*
//--- GTK2 ------------------------------------------------------------------
-#include <gtk/gtk.h>
+#include <gdk/gdk.h>
//--- SKIN ------------------------------------------------------------------
#include "window.h"
//---------------------------------------------------------------------------
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 )
* 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>
*
//--- GTK2 -----------------------------------------------------------------
-//#include <windows.h>
+#include <gdk/gdk.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
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()
PostSynchroMessage();
return true;
}
-
- return true;
*/
+ return true;
+
}
//---------------------------------------------------------------------------
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();
+ }
}
//---------------------------------------------------------------------------
* 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>
*
//--- GTK2 -----------------------------------------------------------------
-//#include <windows.h>
+#include <gdk/gdk.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
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(
// 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 );*/
}
//---------------------------------------------------------------------------
// 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,
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 );
}
//---------------------------------------------------------------------------
* 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>
*
#include <string>
using namespace std;
+//--- GTK2 -----------------------------------------------------------------
+#include <gdk/gdk.h>
+
//---------------------------------------------------------------------------
struct intf_thread_t;
class Graphics;
class GTK2Font : Font
{
private:
+ GdkFont *GFont;
// Assign font to Device Context
virtual void AssignFont( Graphics *dest );
// void AssignGTK2Font( HDC DC );
* 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>
*
//--- GTK2 -----------------------------------------------------------------
-//#include <windows.h>
+#include <gdk/gdk.h>
//--- SKIN ------------------------------------------------------------------
#include "graphics.h"
}
SelectObject( Image, HImage );
DeleteObject( HImage );*/
+
+/* Image = ( GdkDrawable* )( (GTK2Window *)from )->GetHandle();
+ Gc = gdk_gc_new( Image );*/
}
//---------------------------------------------------------------------------
GTK2Graphics::~GTK2Graphics()
//---------------------------------------------------------------------------
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 )
* 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>
#ifndef VLC_SKIN_GTK2_GRAPHICS
#define VLC_SKIN_GTK2_GRAPHICS
+//--- GTK2 ------------------------------------------------------------------
+#include <gdk/gdk.h>
+
//---------------------------------------------------------------------------
class Region;
class Window;
private:
int Width;
int Height;
- // HDC Image;
+ GdkDrawable *Image;
+ GdkGC *Gc;
public:
// Constructor
GTK2Graphics( int w, int h, Window *from = NULL );
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();
virtual bool Hit( int x, int y );
// Specific GTK2 methods
-// HRGN GetHandle() { return Rgn; };
+ GdkRegion *GetHandle() { return Rgn; };
};
//---------------------------------------------------------------------------
* 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>
*
//--- GTK2 ------------------------------------------------------------------
-//#include <windows.h>
+#include <glib.h>
+#include <gdk/gdk.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
Proc->IsClosing();
}
#endif
+
+ // Main event loop
+ GMainLoop *loop = g_main_loop_new( NULL, TRUE );
+ g_main_loop_run( loop );
+
}
//---------------------------------------------------------------------------
bool IsVLCEvent( unsigned int msg )
* 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>
*
//--- GTK2 -----------------------------------------------------------------
-#include <gtk/gtk.h>
+#include <gdk/gdk.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
return;
}
}
-
+*/
//Initialize value
ParentWindow = NULL;
-*/
+
}
//---------------------------------------------------------------------------
// 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 )
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()
* 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>
*
using namespace std;
//--- GTK2 -----------------------------------------------------------------
-//#include <shellapi.h>
+#include <gdk/gdk.h>
//---------------------------------------------------------------------------
struct intf_thread_t;
{
protected:
// Handles
-/* HINSTANCE hinst;
- HWND ParentWindow;
-
+// HINSTANCE hinst;
+ GdkWindow *ParentWindow;
+/*
// System tray icon
NOTIFYICONDATA TrayIcon;
HMENU SysMenu;
/*
// 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 );
* 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>
*
#include <vlc/intf.h>
//--- GTK2 ------------------------------------------------------------------
-//#include <windows.h>
+#include <gdk/gdk.h>
//--- SKIN ------------------------------------------------------------------
#include "os_api.h"
dragdrop )
{
// Set handles
-/* hWnd = hwnd;
-
+ gWnd = gwnd;
+/*
// Set position parameters
CursorPos = new POINT;
WindowPos = new POINT;
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()
{
/* if( show )
{
- ShowWindow( hWnd, SW_SHOW );
+ gdk_window_show( gWnd );
}
else
{
- ShowWindow( hWnd, SW_HIDE );
+ gdk_window_hide( gWnd );
}*/
}
//---------------------------------------------------------------------------
* 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>
*
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
* 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 Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
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 ) );
* 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 Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
//---------------------------------------------------------------------------
void Event::CreateEvent()
{
- // Initiatization
+ // Initialization
int x, y;
char *msg = new char[MAX_EVENT_SIZE];
char *para1 = new char[MAX_PARAM_SIZE];
* 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 Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
//---------------------------------------------------------------------------
static void Run( intf_thread_t *p_intf )
{
+
+#if !defined WIN32
+/* FIXME: should be elsewhere ? */
+ // Initialize GDK
+ int i_args = 1;
+ char *p_args[] = { "", NULL };
+ char **pp_args = p_args;
+
+ gdk_init( &i_args, &pp_args );
+#endif
+
int a = OSAPI_GetTime();
// Load a theme
DIRECTORY_SEPARATOR + "default" +
DIRECTORY_SEPARATOR + "theme.xml";
#else
-/* FIXME: find VLC directory */
- string default_dir = (string)"." +
+// FIXME: find VLC directory
+ string default_dir = (string)"/home/cyril/videolan/vlc/share" +
DIRECTORY_SEPARATOR + "skins" +
DIRECTORY_SEPARATOR + "default" +
DIRECTORY_SEPARATOR + "theme.xml";
* theme.cpp: Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: theme.cpp,v 1.5 2003/03/21 00:17:00 karibu Exp $
+ * $Id: theme.cpp,v 1.6 2003/04/13 17:46:23 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
void Theme::InitTheme()
{
// Initialize the events
- EvtBank->Init();
+/* FIXME */
+fprintf(stderr, "FIXME in theme.cpp !\n");
+// EvtBank->Init();
// Initialize the controls
InitControls();
// Initialize the windows
- InitWindows();
+// InitWindows();
}
//---------------------------------------------------------------------------
void Theme::InitWindows()
* themeloader.cpp: ThemeLoader class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: themeloader.cpp,v 1.4 2003/04/12 21:43:27 asmax Exp $
+ * $Id: themeloader.cpp,v 1.5 2003/04/13 17:46:23 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
#include "themeloader.h"
#include "skin_common.h"
+#include "anchor.h"
+#include "window.h"
+
#define DEFAULT_XML_FILE "theme.xml"
//---------------------------------------------------------------------------
// Start the parser
int lex = yylex();
+
fclose( yyin );
if( lex )
{
* window.cpp: Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: window.cpp,v 1.5 2003/04/12 21:43:27 asmax Exp $
+ * $Id: window.cpp,v 1.6 2003/04/13 17:46:23 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
#ifdef WIN32
Image->CopyFrom( x, y, w, h, Buffer, 0, 0, SRC_COPY );
#else
- fprintf(stderr, "WARNING: FIXME in window.cpp !!!!");
+ fprintf(stderr, "%X WARNING: FIXME in window.cpp !!!!", Buffer);
#endif
// Free memory