]> git.sesse.net Git - vlc/commitdiff
* at last made the skin module compile under linux !
authorCyril Deguet <asmax@videolan.org>
Sat, 12 Apr 2003 21:43:27 +0000 (21:43 +0000)
committerCyril Deguet <asmax@videolan.org>
Sat, 12 Apr 2003 21:43:27 +0000 (21:43 +0000)
  It does absolutely nothing, but it compiles ;)

56 files changed:
config.in
configure.ac.in
modules/gui/skins/Modules.am
modules/gui/skins/controls/slider.cpp
modules/gui/skins/gtk2/gtk2_api.cpp [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_bitmap.cpp [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_bitmap.h [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_dialog.cpp [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_dialog.h [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_dragdrop.cpp [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_dragdrop.h [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_event.cpp [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_event.h [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_font.cpp [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_font.h [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_graphics.cpp [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_graphics.h [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_run.cpp [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_theme.cpp [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_theme.h [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_window.cpp [new file with mode: 0644]
modules/gui/skins/gtk2/gtk2_window.h [new file with mode: 0644]
modules/gui/skins/os_api.h
modules/gui/skins/os_bitmap.h
modules/gui/skins/os_dialog.h
modules/gui/skins/os_event.h
modules/gui/skins/os_font.h
modules/gui/skins/os_graphics.h
modules/gui/skins/os_theme.h
modules/gui/skins/os_window.h
modules/gui/skins/parser/wrappers.cpp
modules/gui/skins/src/dialog.cpp
modules/gui/skins/src/event.h
modules/gui/skins/src/font.h
modules/gui/skins/src/skin_main.cpp
modules/gui/skins/src/themeloader.cpp
modules/gui/skins/src/vlcproc.cpp
modules/gui/skins/src/window.cpp
modules/gui/skins/win32/win32_api.cpp
modules/gui/skins/win32/win32_bitmap.cpp
modules/gui/skins/win32/win32_bitmap.h
modules/gui/skins/win32/win32_dialog.cpp
modules/gui/skins/win32/win32_dialog.h
modules/gui/skins/win32/win32_dragdrop.cpp
modules/gui/skins/win32/win32_dragdrop.h
modules/gui/skins/win32/win32_event.cpp
modules/gui/skins/win32/win32_event.h
modules/gui/skins/win32/win32_font.cpp
modules/gui/skins/win32/win32_font.h
modules/gui/skins/win32/win32_graphics.cpp
modules/gui/skins/win32/win32_graphics.h
modules/gui/skins/win32/win32_run.cpp
modules/gui/skins/win32/win32_theme.cpp
modules/gui/skins/win32/win32_theme.h
modules/gui/skins/win32/win32_window.cpp
modules/gui/skins/win32/win32_window.h

index b199383d9f6bf29da35f1c96a3488ae7b1345fee..4857b03b57308b7240f6d23c458f23c87a67c772 100644 (file)
--- a/config.in
+++ b/config.in
@@ -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
index 7ae8b535b0db27f4f91234749c558e6ee71a122a..3c2944cb566cac3f6d90c74b5a52f17f98d09959 100644 (file)
@@ -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
 
index c2f841c4e726a6f8cf0df0f1ec5baed78f0cfd17..2cda3f2a9fd32c5191f06132c3fd4c5ea7dacac6 100644 (file)
@@ -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 += \
index 3745ff563f8ebeebb41edb1af345340e4c24a6df..4cac27f005f336dfc9e5137bcbc24f4bd5c06907 100644 (file)
@@ -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 Teulière <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()
diff --git a/modules/gui/skins/gtk2/gtk2_api.cpp b/modules/gui/skins/gtk2/gtk2_api.cpp
new file mode 100644 (file)
index 0000000..6e13296
--- /dev/null
@@ -0,0 +1,160 @@
+/*****************************************************************************
+ * 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;
+}
+//---------------------------------------------------------------------------
+*/
diff --git a/modules/gui/skins/gtk2/gtk2_bitmap.cpp b/modules/gui/skins/gtk2/gtk2_bitmap.cpp
new file mode 100644 (file)
index 0000000..caef11b
--- /dev/null
@@ -0,0 +1,173 @@
+/*****************************************************************************
+ * 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 );
+}
+//---------------------------------------------------------------------------
+
diff --git a/modules/gui/skins/gtk2/gtk2_bitmap.h b/modules/gui/skins/gtk2/gtk2_bitmap.h
new file mode 100644 (file)
index 0000000..b857315
--- /dev/null
@@ -0,0 +1,68 @@
+/*****************************************************************************
+ * 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
diff --git a/modules/gui/skins/gtk2/gtk2_dialog.cpp b/modules/gui/skins/gtk2/gtk2_dialog.cpp
new file mode 100644 (file)
index 0000000..355591c
--- /dev/null
@@ -0,0 +1,360 @@
+/*****************************************************************************
+ * gtk2_dialog.cpp: GTK2 implementation of some dialog boxes
+ *****************************************************************************
+ * Copyright (C) 2003 VideoLAN
+ * $Id: gtk2_dialog.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.
+ *****************************************************************************/
+
+
+//--- VLC -------------------------------------------------------------------
+#include <vlc/intf.h>
+extern intf_thread_t *g_pIntf;
+
+//--- GTK2 -----------------------------------------------------------------
+#define _GTK2_IE 0x0400    // Yes, i think it's a fucking kludge !
+//#include <windows.h>
+//#include <commdlg.h>
+//#include <commctrl.h>
+//#include <richedit.h>
+
+//--- SKIN ------------------------------------------------------------------
+#include "banks.h"
+#include "dialog.h"
+#include "os_dialog.h"
+#include "skin_common.h"
+#include "window.h"
+#include "os_window.h"
+#include "theme.h"
+#include "os_theme.h"
+#include "event.h"
+#include "os_api.h"
+
+/*
+//---------------------------------------------------------------------------
+// Open file dialog box
+//---------------------------------------------------------------------------
+GTK2OpenFileDialog::GTK2OpenFileDialog( intf_thread_t *_p_intf, string title,
+    bool multiselect ) : OpenFileDialog( _p_intf, title, multiselect )
+{
+}
+//---------------------------------------------------------------------------
+GTK2OpenFileDialog::~GTK2OpenFileDialog()
+{
+}
+//---------------------------------------------------------------------------
+void GTK2OpenFileDialog::AddFilter( string name, string type )
+{
+    unsigned int i;
+
+    for( i = 0; i < name.length(); i++ )
+        Filter[FilterLength++] = name[i];
+
+    Filter[FilterLength++] = ' ';
+    Filter[FilterLength++] = '(';
+
+    for( i = 0; i < type.length(); i++ )
+        Filter[FilterLength++] = type[i];
+
+    Filter[FilterLength++] = ')';
+    Filter[FilterLength++] = '\0';
+
+    for( i = 0; i < type.length(); i++ )
+        Filter[FilterLength++] = type[i];
+
+    Filter[FilterLength++] = '\0';
+
+    // Ending null character if this filter is the last
+    Filter[FilterLength] = '\0';
+}
+//---------------------------------------------------------------------------
+bool GTK2OpenFileDialog::Open()
+{
+    // Initailize dialog box
+    OPENFILENAME OpenFile;
+    memset( &OpenFile, 0, sizeof( OpenFile ) );
+    OpenFile.lStructSize  = sizeof( OPENFILENAME );
+    OpenFile.hwndOwner = NULL;
+    OpenFile.lpstrFile = new char[MAX_PATH];
+    OpenFile.lpstrFile[0] = '\0';
+    OpenFile.nMaxFile = MAX_PATH;
+    if( MultiSelect )
+    {
+        OpenFile.Flags = OFN_ALLOWMULTISELECT | OFN_EXPLORER;
+    }
+    else
+    {
+        OpenFile.Flags = OFN_EXPLORER;
+    }
+    OpenFile.lpstrTitle  = Title.c_str();
+    OpenFile.lpstrFilter = Filter;
+
+    // Remove mouse tracking event to avoid non process due to modal open box
+    if( p_intf != NULL && p_intf->p_sys->p_theme != NULL )
+    {
+        TRACKMOUSEEVENT TrackEvent;
+        TrackEvent.cbSize      = sizeof( TRACKMOUSEEVENT );\r
+        TrackEvent.dwFlags     = TME_LEAVE|TME_CANCEL;\r
+        TrackEvent.dwHoverTime = 1;
+
+        list<Window *>::const_iterator win;
+        for( win = g_pIntf->p_sys->p_theme->WindowList.begin();
+            win != g_pIntf->p_sys->p_theme->WindowList.end(); win++ )
+        {
+            TrackEvent.hwndTrack   = ( (GTK2Window *)(*win) )->GetHandle();
+            TrackMouseEvent( &TrackEvent );
+        }
+    }
+
+    // Show dialog box
+    if( !GetOpenFileName( &OpenFile ) )
+    {
+        OSAPI_PostMessage( NULL, WINDOW_LEAVE, 0, 0 );
+        return false;
+    }
+
+    // Tell windows that mouse cursor has left window because it has been
+    // unactivated
+    OSAPI_PostMessage( NULL, WINDOW_LEAVE, 0, 0 );
+
+    // Find files in string result
+    char * File = OpenFile.lpstrFile;
+    int i       = OpenFile.nFileOffset;
+    int last    = OpenFile.nFileOffset;
+    string path;
+    string tmpFile;
+
+
+    // If only one file has been selected
+    if( File[OpenFile.nFileOffset - 1] != '\0' )
+    {
+        FileList.push_back( (string)File );
+    }
+    // If multiple files have been selected
+    else
+    {
+        // Add \ if not present at end of path
+        if( File[OpenFile.nFileOffset - 2] != '\\' )
+        {
+            path = (string)File + '\\';
+        }
+        else
+        {
+            path = (string)File;
+        }
+
+        // Search filenames
+        while( true )
+        {
+            if( File[i] == '\0' )
+            {
+                if( i == last )
+                    break;
+                else
+                {
+                    // Add file
+                    FileList.push_back( path + (string)&File[last] );
+                    last = i + 1;
+                }
+            }
+            i++;
+        }
+    }
+
+    // Free memory
+    delete[] OpenFile.lpstrFile;
+
+    return true;
+}
+//---------------------------------------------------------------------------
+
+
+
+
+//---------------------------------------------------------------------------
+// CALLBACKs
+//---------------------------------------------------------------------------
+LRESULT CALLBACK LogWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam,
+                                LPARAM lParam )
+{
+    intf_thread_t *p_intf = (intf_thread_t *)GetWindowLongPtr( hwnd,
+        GWLP_USERDATA );
+
+    //msg_Err( p_intf, "Message to hwnd %i (%i)", (int)hwnd, (int)uMsg );
+    switch( uMsg )
+    {
+        case WM_PAINT:
+            PAINTSTRUCT Infos;
+            BeginPaint( hwnd , &Infos );
+            EndPaint( hwnd , &Infos );
+            return 0;
+
+        case WM_SIZE:
+            if( ( (GTK2Theme *)p_intf->p_sys->p_theme )
+                ->GetLogHandle() == hwnd )
+            {
+                SetWindowPos( ( (GTK2LogWindow *)
+                    p_intf->p_sys->p_theme->GetLogWindow() )->GetRichCtrl(),
+                    0, 0, 0, LOWORD( lParam ), HIWORD( lParam ),
+                    SWP_NOREDRAW|SWP_NOZORDER|SWP_NOMOVE );
+            }
+            return 0;
+
+        case WM_CLOSE:
+            OSAPI_PostMessage( NULL, VLC_LOG_SHOW, 0, (int)false );
+            p_intf->p_sys->p_theme->EvtBank->Get( "hide_log" )
+                ->PostSynchroMessage();
+            return 0;
+
+    }
+    return DefWindowProc( hwnd, uMsg, wParam, lParam );
+}
+//---------------------------------------------------------------------------
+DWORD CALLBACK LogWindowStream( DWORD_PTR dwCookie, LPBYTE pbBuff,
+                                LONG cb, LONG *pcb )
+{
+    int i;
+    char *text = (char *)( (string *)dwCookie )->c_str();
+
+    if( strlen( text ) < (unsigned int)cb )
+    {
+        *pcb = strlen( text );
+        for( i = 0; i < *pcb; i++ )
+            pbBuff[i] = text[i];
+    }
+    else
+    {
+        *pcb = cb;
+        for( i = 0; i < *pcb; i++ )
+            pbBuff[i] = text[i];
+    }
+    delete (string *)dwCookie;
+    return 0;
+}
+//---------------------------------------------------------------------------
+
+
+
+//---------------------------------------------------------------------------
+// GTK2 Log Window class
+//---------------------------------------------------------------------------
+GTK2LogWindow::GTK2LogWindow( intf_thread_t *_p_intf ) : LogWindow( _p_intf )
+{
+    hWindow   = NULL;
+    hRichCtrl = NULL;
+
+    // Define window class
+    WNDCLASS WindowClass;
+    WindowClass.style = CS_VREDRAW|CS_HREDRAW;
+    WindowClass.lpfnWndProc = (WNDPROC)LogWindowProc;
+    WindowClass.lpszClassName = "LogWindow";
+    WindowClass.lpszMenuName = NULL;
+    WindowClass.cbClsExtra = 0;
+    WindowClass.cbWndExtra = 0;
+    WindowClass.hbrBackground = HBRUSH (COLOR_WINDOW);
+    WindowClass.hCursor = LoadCursor( NULL , IDC_ARROW );
+    WindowClass.hIcon = LoadIcon( GetModuleHandle( NULL ), "VLC_ICON" );
+    WindowClass.hInstance = GetModuleHandle( NULL );
+
+    // Register window class
+    RegisterClass( &WindowClass );
+
+    // Load library
+    LoadLibrary("riched20.dll");
+
+    // Init common controls
+    InitCommonControlsEx( NULL );
+
+    // Create log window
+    hWindow = CreateWindowEx( 0, "LogWindow", "Log Window",
+        WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 500, 300, 0, 0,
+        GetModuleHandle( NULL ), NULL );
+    // Store with it a pointer to the interface thread
+    SetWindowLongPtr( hWindow, GWLP_USERDATA, (LONG_PTR)p_intf );
+
+    // Create rich text control
+    hRichCtrl = CreateWindowEx( 0, RICHEDIT_CLASS, NULL,
+        WS_CHILD|WS_VISIBLE|WS_BORDER|ES_MULTILINE|ES_READONLY|WS_VSCROLL,
+        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+        hWindow, 0, GetModuleHandle( NULL ), 0);
+
+    // Change text format
+    SendMessage( hRichCtrl, EM_SETBKGNDCOLOR, 0, RGB(0,0,0) );
+    ChangeColor( RGB( 128, 128, 128 ) );
+    RtfHeader = "{\\rtf1 ";
+
+    Clear();
+}
+//---------------------------------------------------------------------------
+GTK2LogWindow::~GTK2LogWindow()
+{
+    DestroyWindow( hRichCtrl );
+    DestroyWindow( hWindow );
+}
+//---------------------------------------------------------------------------
+void GTK2LogWindow::Clear()
+{
+    EDITSTREAM *Stream;
+    Stream = new EDITSTREAM;
+    string *buffer = new string( RtfHeader );
+    Stream->dwCookie = (DWORD)buffer;
+    Stream->dwError  = 0;
+    Stream->pfnCallback = (EDITSTREAMCALLBACK)LogWindowStream;
+    SendMessage( hRichCtrl, EM_STREAMIN, SF_RTF, (LPARAM)Stream );
+}
+//---------------------------------------------------------------------------
+void GTK2LogWindow::AddLine( string line )
+{
+    // Initialize stream
+        EDITSTREAM *Stream;
+        string *buffer      = new string( RtfHeader + line + "\\par }" );
+        Stream              = new EDITSTREAM;
+        Stream->dwCookie    = (DWORD)buffer;
+        Stream->dwError     = 0;
+        Stream->pfnCallback = (EDITSTREAMCALLBACK)LogWindowStream;
+
+    SendMessage( hRichCtrl, EM_STREAMIN, SF_RTF|SFF_SELECTION, (LPARAM)Stream );
+
+    SendMessage( hRichCtrl, WM_VSCROLL, SB_BOTTOM, 0 );
+}
+//---------------------------------------------------------------------------
+void GTK2LogWindow::ChangeColor( int color, bool bold )
+{
+    CHARFORMAT format;
+    memset(&format, 0, sizeof(CHARFORMAT));
+    format.cbSize      = sizeof(CHARFORMAT);
+    format.dwMask      = bold ? CFM_COLOR|CFM_BOLD : CFM_COLOR;
+    format.dwEffects   = bold ? CFE_BOLD           : 0;
+    format.crTextColor = color;
+    SendMessage( hRichCtrl, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&format );
+}
+//---------------------------------------------------------------------------
+void GTK2LogWindow::Show()
+{
+    ShowWindow( hWindow, SW_SHOW );
+    Visible = true;
+}
+//---------------------------------------------------------------------------
+void GTK2LogWindow::Hide()
+{
+    ShowWindow( hWindow, SW_HIDE );
+    Visible = false;
+}
+//---------------------------------------------------------------------------
+*/
diff --git a/modules/gui/skins/gtk2/gtk2_dialog.h b/modules/gui/skins/gtk2/gtk2_dialog.h
new file mode 100644 (file)
index 0000000..09ccd92
--- /dev/null
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * 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
+
diff --git a/modules/gui/skins/gtk2/gtk2_dragdrop.cpp b/modules/gui/skins/gtk2/gtk2_dragdrop.cpp
new file mode 100644 (file)
index 0000000..da185ae
--- /dev/null
@@ -0,0 +1,165 @@
+/*****************************************************************************
+ * 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;
+}
+*/
diff --git a/modules/gui/skins/gtk2/gtk2_dragdrop.h b/modules/gui/skins/gtk2/gtk2_dragdrop.h
new file mode 100644 (file)
index 0000000..f1e47eb
--- /dev/null
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ * 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
diff --git a/modules/gui/skins/gtk2/gtk2_event.cpp b/modules/gui/skins/gtk2/gtk2_event.cpp
new file mode 100644 (file)
index 0000000..3a99079
--- /dev/null
@@ -0,0 +1,120 @@
+/*****************************************************************************
+ * 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();
+}
+//---------------------------------------------------------------------------
+*/
diff --git a/modules/gui/skins/gtk2/gtk2_event.h b/modules/gui/skins/gtk2/gtk2_event.h
new file mode 100644 (file)
index 0000000..7ed3c95
--- /dev/null
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * 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
diff --git a/modules/gui/skins/gtk2/gtk2_font.cpp b/modules/gui/skins/gtk2/gtk2_font.cpp
new file mode 100644 (file)
index 0000000..1e0b385
--- /dev/null
@@ -0,0 +1,148 @@
+/*****************************************************************************
+ * 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 );
+}
+//---------------------------------------------------------------------------
+
+*/
diff --git a/modules/gui/skins/gtk2/gtk2_font.h b/modules/gui/skins/gtk2/gtk2_font.h
new file mode 100644 (file)
index 0000000..cd7b8b7
--- /dev/null
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * 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
diff --git a/modules/gui/skins/gtk2/gtk2_graphics.cpp b/modules/gui/skins/gtk2/gtk2_graphics.cpp
new file mode 100644 (file)
index 0000000..aacc438
--- /dev/null
@@ -0,0 +1,149 @@
+/*****************************************************************************
+ * 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 );
+}
+//---------------------------------------------------------------------------
+*/
diff --git a/modules/gui/skins/gtk2/gtk2_graphics.h b/modules/gui/skins/gtk2/gtk2_graphics.h
new file mode 100644 (file)
index 0000000..6029a37
--- /dev/null
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ * 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
diff --git a/modules/gui/skins/gtk2/gtk2_run.cpp b/modules/gui/skins/gtk2/gtk2_run.cpp
new file mode 100644 (file)
index 0000000..90b9a7d
--- /dev/null
@@ -0,0 +1,183 @@
+/*****************************************************************************
+ * 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
diff --git a/modules/gui/skins/gtk2/gtk2_theme.cpp b/modules/gui/skins/gtk2/gtk2_theme.cpp
new file mode 100644 (file)
index 0000000..448a6f1
--- /dev/null
@@ -0,0 +1,344 @@
+/*****************************************************************************
+ * 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 $
+ *
+ * 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>
+
+//--- VLC -------------------------------------------------------------------
+#include <vlc/intf.h>
+
+//--- SKIN ------------------------------------------------------------------
+#include "os_api.h"
+#include "banks.h"
+#include "window.h"
+#include "os_window.h"
+#include "event.h"
+#include "os_event.h"
+#include "theme.h"
+#include "os_theme.h"
+#include "dialog.h"
+#include "os_dialog.h"
+#include "vlcproc.h"
+#include "skin_common.h"
+
+
+//---------------------------------------------------------------------------
+void SkinManage( intf_thread_t *p_intf );
+
+/*
+
+//---------------------------------------------------------------------------
+// GTK2 interface
+//---------------------------------------------------------------------------
+LRESULT CALLBACK GTK2Proc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
+{
+    // Get pointer to thread info
+    intf_thread_t *p_intf = (intf_thread_t *)GetWindowLongPtr( hwnd,
+        GWLP_USERDATA );
+
+    // If doesn't exist, treat windows message normally
+    if( p_intf == NULL )
+        return DefWindowProc( hwnd, uMsg, wParam, lParam );
+
+    // Create event to dispatch in windows
+    Event *evt = (Event *)new OSEvent( p_intf, hwnd, uMsg, wParam, lParam );
+
+
+    // Find window matching with hwnd
+    list<Window *>::const_iterator win;
+    for( win = p_intf->p_sys->p_theme->WindowList.begin();
+         win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+    {
+        // If it is the correct window
+        if( hwnd == ( (GTK2Window *)(*win) )->GetHandle() )
+        {
+            // Send event and check if processed
+            if( (*win)->ProcessEvent( evt ) )
+            {
+                delete (OSEvent *)evt;
+                return 0;
+            }
+            else
+            {
+                break;
+            }
+        }
+    }
+    delete (OSEvent *)evt;
+
+
+    // If Window is parent window
+    if( hwnd == ( (GTK2Theme *)p_intf->p_sys->p_theme )->GetParentWindow() )
+    {
+        if( uMsg == WM_SYSCOMMAND )
+        {
+            if( (Event *)wParam != NULL )
+                ( (Event *)wParam )->SendEvent();
+            return 0;
+        }
+        else if( uMsg == WM_RBUTTONDOWN && wParam == 42 &&
+                 lParam == WM_RBUTTONDOWN )
+        {
+            int x, y;
+            OSAPI_GetMousePos( x, y );
+            TrackPopupMenu(
+                ( (GTK2Theme *)p_intf->p_sys->p_theme )->GetSysMenu(),
+                0, x, y, 0, hwnd, NULL );
+        }
+    }
+
+
+    // If closing parent window
+    if( uMsg == WM_CLOSE )
+    {
+        OSAPI_PostMessage( NULL, VLC_HIDE, VLC_QUIT, 0 );
+        return 0;
+    }
+
+    // If hwnd does not match any window or message not processed
+    return DefWindowProc( hwnd, uMsg, wParam, lParam );
+}
+//---------------------------------------------------------------------------
+
+
+*/
+
+//---------------------------------------------------------------------------
+// THEME
+//---------------------------------------------------------------------------
+GTK2Theme::GTK2Theme( intf_thread_t *_p_intf ) : Theme( _p_intf )
+{
+/*
+    // Get instance handle
+    hinst = GetModuleHandle( NULL );
+
+    // Create window class
+    WNDCLASS SkinWindow;
+
+    SkinWindow.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
+    SkinWindow.lpfnWndProc = (WNDPROC) GTK2Proc;
+    SkinWindow.lpszClassName = "SkinWindow";
+    SkinWindow.lpszMenuName = NULL;
+    SkinWindow.cbClsExtra = 0;
+    SkinWindow.cbWndExtra = 0;
+    SkinWindow.hbrBackground = HBRUSH (COLOR_WINDOW);
+    SkinWindow.hCursor = LoadCursor( NULL , IDC_ARROW );
+    SkinWindow.hIcon = LoadIcon( hinst, "VLC_ICON" );
+    SkinWindow.hInstance = hinst;
+
+    if( !RegisterClass( &SkinWindow ) )
+    {
+        WNDCLASS wndclass;
+
+        // Check why it failed. If it's because the class already exists
+        // then fine, otherwise return with an error.
+        if( !GetClassInfo( hinst, "SkinWindow", &wndclass ) )
+        {
+            msg_Err( p_intf, "Cannot register window class" );
+            return;
+        }
+    }
+
+    //Initialize value
+    ParentWindow = NULL;
+*/
+}
+
+//---------------------------------------------------------------------------
+GTK2Theme::~GTK2Theme()
+{/*
+    // Unregister the window class if needed
+    WNDCLASS wndclass;
+    if( GetClassInfo( hinst, "SkinWindow", &wndclass ) )
+    {
+        UnregisterClass( "SkinWindow", hinst );
+    }
+    if( GetClassInfo( hinst, "LogWindow", &wndclass ) )
+    {
+        UnregisterClass( "LogWindow", hinst );
+    }
+    if( GetClassInfo( hinst, "ParentWindow", &wndclass ) )
+    {
+        UnregisterClass( "ParentWindow", hinst );
+    }
+
+    // Delete tray icon if exists
+    if( ShowInTray )
+    {
+        Shell_NotifyIcon( NIM_DELETE, &TrayIcon );
+    }
+
+    // Destroy parent window
+    if( ParentWindow )
+    {
+        DestroyWindow( ParentWindow );
+    }*/
+}
+//---------------------------------------------------------------------------
+void GTK2Theme::OnLoadTheme()
+{/*
+    // Create window class
+    WNDCLASS ParentClass;
+    ParentClass.style = CS_VREDRAW|CS_HREDRAW|CS_DBLCLKS;
+    ParentClass.lpfnWndProc = (WNDPROC) GTK2Proc;
+    ParentClass.lpszClassName = "ParentWindow";
+    ParentClass.lpszMenuName = NULL;
+    ParentClass.cbClsExtra = 0;
+    ParentClass.cbWndExtra = 0;
+    ParentClass.hbrBackground = HBRUSH (COLOR_WINDOW);
+    ParentClass.hCursor = LoadCursor( NULL , IDC_ARROW );
+    ParentClass.hIcon = LoadIcon( hinst, "VLC_ICON" );
+    ParentClass.hInstance = hinst;
+
+    // register class and check it
+    if( !RegisterClass( &ParentClass ) )
+    {
+        WNDCLASS wndclass;
+
+        // Check why it failed. If it's because the class already exists
+        // then fine, otherwise return with an error.
+        if( !GetClassInfo( hinst, "ParentWindow", &wndclass ) )
+        {
+            msg_Err( p_intf, "Cannot register window class" );
+            return;
+        }
+    }
+
+    // Create Window
+    ParentWindow = CreateWindowEx( WS_EX_LAYERED|WS_EX_TOOLWINDOW,
+        "ParentWindow", "VLC Media Player",
+        WS_SYSMENU,
+        0, 0, 0, 0, 0, 0, hinst, NULL );
+
+    // Store with it a pointer to the interface thread
+    SetWindowLongPtr( ParentWindow, GWLP_USERDATA, (LONG_PTR)p_intf );
+    ShowWindow( ParentWindow, SW_SHOW );
+
+    // System tray icon
+    TrayIcon.cbSize = sizeof( PNOTIFYICONDATA );\r
+    TrayIcon.hWnd = ParentWindow;\r
+    TrayIcon.uID = 42;\r
+    TrayIcon.uFlags = NIF_ICON|NIF_TIP|NIF_MESSAGE;\r
+    TrayIcon.uCallbackMessage = WM_RBUTTONDOWN;\r
+    TrayIcon.hIcon = LoadIcon( hinst, "VLC_ICON" );
+    strcpy( TrayIcon.szTip, "VLC Media Player" );
+
+    // Remove default entries from system menu popup
+    SysMenu = GetSystemMenu( ParentWindow, false );
+    RemoveMenu( SysMenu, SC_RESTORE,  MF_BYCOMMAND );
+    RemoveMenu( SysMenu, SC_MOVE,     MF_BYCOMMAND );
+    RemoveMenu( SysMenu, SC_SIZE,     MF_BYCOMMAND );
+    RemoveMenu( SysMenu, SC_MINIMIZE, MF_BYCOMMAND );
+    RemoveMenu( SysMenu, SC_MAXIMIZE, MF_BYCOMMAND );
+    RemoveMenu( SysMenu, SC_CLOSE,    MF_BYCOMMAND );
+    RemoveMenu( SysMenu, 0,           MF_BYPOSITION );
+
+    // The create menu
+    CreateSystemMenu();
+*/
+}
+//---------------------------------------------------------------------------
+void GTK2Theme::AddSystemMenu( string name, Event *event )
+{/*
+    if( name == "SEPARATOR" )
+    {
+        AppendMenu( SysMenu, MF_SEPARATOR, 0, NULL );
+    }
+    else
+    {
+        AppendMenu( SysMenu, MF_STRING, (unsigned int)event,
+                    (char *)name.c_str() );
+    }*/
+}
+//---------------------------------------------------------------------------
+void GTK2Theme::ChangeClientWindowName( string name )
+{/*
+    SetWindowText( ParentWindow, name.c_str() );*/
+}
+//---------------------------------------------------------------------------
+void GTK2Theme::AddWindow( string name, int x, int y, bool visible,
+    int fadetime, int alpha, int movealpha, bool dragdrop )
+{/*
+    HWND hwnd;
+
+    hwnd = CreateWindowEx( WS_EX_LAYERED|WS_EX_TOOLWINDOW,
+        "SkinWindow", name.c_str(), WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT,
+        0, 0, ParentWindow, 0, hinst, NULL );
+
+    if( !hwnd )
+    {
+        msg_Err( p_intf, "CreateWindow failed" );
+        return;
+    }
+
+    SetWindowLongPtr( hwnd, GWLP_USERDATA, (LONG_PTR)p_intf );
+
+    WindowList.push_back( (Window *)new OSWindow( p_intf, hwnd, x, y, visible,
+        fadetime, alpha, movealpha, dragdrop ) ) ;*/
+}
+//---------------------------------------------------------------------------
+/*HWND GTK2Theme::GetLogHandle()
+{
+    if( Log != NULL )
+        return ( (GTK2LogWindow *)Log )->GetWindow();
+    else
+        return NULL;
+}*/
+//---------------------------------------------------------------------------
+void GTK2Theme::ChangeTray()
+{/*
+    if( ShowInTray )
+    {
+        Shell_NotifyIcon( NIM_DELETE, &TrayIcon );
+        ShowInTray = false;
+    }
+    else
+    {
+        Shell_NotifyIcon( NIM_ADD, &TrayIcon );
+        ShowInTray = true;
+    }*/
+}
+//---------------------------------------------------------------------------
+void GTK2Theme::ChangeTaskbar()
+{/*
+    if( ShowInTaskbar )
+    {
+        ShowWindow( ParentWindow, SW_HIDE );
+        SetWindowLongPtr( ParentWindow, GWL_EXSTYLE,
+                          WS_EX_LAYERED|WS_EX_TOOLWINDOW );
+        ShowWindow( ParentWindow, SW_SHOW );
+        ShowInTaskbar = false;
+    }
+    else
+    {
+        ShowWindow( ParentWindow, SW_HIDE );
+        SetWindowLongPtr( ParentWindow, GWL_EXSTYLE,
+                          WS_EX_LAYERED|WS_EX_APPWINDOW );
+        ShowWindow( ParentWindow, SW_SHOW );
+        ShowInTaskbar = true;
+    }*/
+}
+//---------------------------------------------------------------------------
+
diff --git a/modules/gui/skins/gtk2/gtk2_theme.h b/modules/gui/skins/gtk2/gtk2_theme.h
new file mode 100644 (file)
index 0000000..b4d8f06
--- /dev/null
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * 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
+
diff --git a/modules/gui/skins/gtk2/gtk2_window.cpp b/modules/gui/skins/gtk2/gtk2_window.cpp
new file mode 100644 (file)
index 0000000..77a2395
--- /dev/null
@@ -0,0 +1,294 @@
+/*****************************************************************************
+ * 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 );\r
+            TrackEvent.dwFlags     = TME_LEAVE;\r
+            TrackEvent.hwndTrack   = hWnd;\r
+            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 );
+        }
+    }
+
+}
+//---------------------------------------------------------------------------
+*/
diff --git a/modules/gui/skins/gtk2/gtk2_window.h b/modules/gui/skins/gtk2/gtk2_window.h
new file mode 100644 (file)
index 0000000..4b728c6
--- /dev/null
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ * 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
index 09318b8a634f0ca4c69fad545a076073227ef88a..011697ca1b53a9aab659bbf450e53a930568b455 100644 (file)
@@ -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
 
 
index 2477c322a3f6621625d9d3eb71478fb996d2bc72..4ff9e633ed883ec678d11ccd63d3eca8de4919ce 100644 (file)
@@ -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 Teulière <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
 
 
index c031be76352b1daf3271d045cc50653698099330..f78b63b5cf6a3f3e0a64556e89ac0851458aa02e 100644 (file)
@@ -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 Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
     #include "win32_dialog.h"
     #define OSOpenFileDialog Win32OpenFileDialog
     #define OSLogWindow Win32LogWindow
+#else    
+    #include "gtk2_dialog.h"
+    #define OSOpenFileDialog GTK2OpenFileDialog
+    #define OSLogWindow GTK2LogWindow
 #endif
 
 
index 6a404ee38fa9028c4191c785002adbad9a225285..d75a48b7dd2fd8614af17e876d013d0f197108bf 100644 (file)
@@ -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
 
index be37b3c1e5ce86f07bd0329b2ee10ab4c5b832ff..42892b8d9b10d76b10e7f542356bb4487d3d06a5 100644 (file)
@@ -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
index 3c8229e89b3ceeb339174b18dc591462fca1ef9c..4374e9f913c778dd70585aae76e277ce8a332a5d 100644 (file)
@@ -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>
 
 #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
 
index 4cece17c31381236cfa942cc77a4af37a53f1b16..5ed91d672e7d60a229038f9ece0ee1653c8c9ef5 100644 (file)
@@ -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
index c75d8130a32e40deb43f0ec1e7d326db3e45f1d9..65d5092e6f48a1db72fe8e888f76c7b833804dfa 100644 (file)
@@ -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 Teulière <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
index e758c66f1e038b7618f63c127a3c49eb4d93db79..a81ddb3bf2fd2ba472ed23dbecb1a6f50ab77e20 100644 (file)
@@ -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 Teulière <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"
index 456f646aa367ca8f89949ca31b3b5a42a0442173..24d36dbe0c424edb11c0ada6a7f30603774ca1f3 100644 (file)
@@ -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 Teulière <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
index ed2a2b87d31cf274c1ab7d1a7ccfa1c45ab9256a..9f39d888e985cb71278b17da5e87b6818170f8f1 100644 (file)
@@ -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 Teulière <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)
index 0e857b00c2de24a04d35eacccd74cc4ec7f775bb..c532015c755d8b92575218cbab10ec99b86833f6 100644 (file)
@@ -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>
 #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;
index 70dcfb53f9e4475bf151018e874b8ff8b3c15ad2..ef07ca797b0046b5622ded45a87e1fc990c8a5f0 100644 (file)
@@ -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 Teulière <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 );
 }
 //---------------------------------------------------------------------------
index 7cb398effbdae1ff8b968cfefca04aa6f86d06ef..96659dbc301c9825e152cd9382bcfef3d0f3c855 100644 (file)
@@ -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 Teulière <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() );
index 658d623138a78a8b05e8daa6489aa9d7555ab307..b347cc7286acce1a0be284320ec66d941aba463b 100644 (file)
@@ -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 Teulière <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];
index 11b03a93a6b5211993d02a6c6cdf1e4f6f7a9f1f..dab72af35eead5a7176b61c6ad1d64ecaffb4bd6 100644 (file)
@@ -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 Teulière <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;
index 4c940d0de275073d9a238fa6ec04350dac020ef7..3782600c127b555c97e40bc0fe3aa900e2b4f7ff 100644 (file)
@@ -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 Teulière <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
index e189b59173d3a572dfda3d35697956d8c33c73a6..c955a0b0b63a6ad924354625ce680f6b4d12eb82 100644 (file)
@@ -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 Teulière <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
index efcb1d008f5fba6930fdbe2fe8f7b2da19ec045e..7d1dc3ea98c8fc1207b4c1510e1cd563547caf39 100644 (file)
@@ -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 Teulière <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
index 41995cafa54bc2d1f85a113fbb7aead66b461179..ef59ad8bda8b321d83b5cfc853b00dcbf646b037 100644 (file)
@@ -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 Teulière <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
index 0e4b7809f5d4f2af0d85d3f4be0575edacb10162..49cef311735207a0cda136efa9934a78091a4a37 100644 (file)
@@ -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 Teulière <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
index d39be9f832fc538ed2bcf8f452d7eddbc5589015..426be85dbaaf1e35c08663353a9227faf4cf61c8 100644 (file)
@@ -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 Teulière <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
index 1748c0a31993cb98f8b44e6645f8deaeaef894ad..a4ff3ebfc212e22f97be8f98ab2d454077f88302 100644 (file)
@@ -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 Teulière <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
index 5630bb92245b8302f21d5cac24d7b3891dfcef41..61e8d9bbc6e1d8a6b561233911a2e1118291546b 100644 (file)
@@ -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 Teulière <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
index 7f7c75e4ac91b4d1df79765827466a7eb2922612..3db48a9f9560544cb9f64a4ba1b5610c19d98f3b 100644 (file)
@@ -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
index 70eaa131ce8fd98341a51dfc12279fe38173306d..66d22f36b655a0d073a06132e0aa34ff11d86fe2 100644 (file)
@@ -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 Teulière <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
index 0e388b96b5ed9c903a206fb27dbec5eb059764d5..ef275b57529da9f28570c5c08727a5ed96260379 100644 (file)
@@ -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
index df72992231e7f10ab4a9d943acd5db382f9fd481..0563fd7ae0551bfa771ff5c836619f6142a78eed 100644 (file)
@@ -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 Teulière <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
index 823d7be4380bfad2cc61ba90b81ae861193f1977..5d21d1dddc005f58f1c92e625df06181a29816f0 100644 (file)
@@ -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
index dbd74dfc14a3efffea29ef0a3c2d1ed6fdb8ed00..913ee32a5cdd5af23b5ad801dc9c7ffa5f7b3f93 100644 (file)
@@ -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 Teulière <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
index a5f4243fe3695756fb024094310f9d4d39efaa16..d54813f1922bfe943d01e4a9f03d171a2d951c89 100644 (file)
@@ -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 Teulière <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
index 931ca6b23cadf99d1579dee3e9dfb4a648c7c375..d7b99710453644d02018ebe86371083156af4d2a 100644 (file)
@@ -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 Teulière <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
index dfdfaeeef4ed08ea0986de1b7804d783bf648784..eb5da312ea065be65481bd7007fb59afd4dd0733 100644 (file)
@@ -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 Teulière <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
index e5197c5392ba1b141e00e153ab9b8e5d89a3d497..0a56f2dee09d3aa34cafbdb65877df411a873933 100644 (file)
@@ -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 Teulière <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