Commit 51bf1028 authored by Olivier Teulière's avatar Olivier Teulière

* added wxwindows Open and Messages dialog boxes into the windows skins

   (it may break things on linux...)
parent 0cda1774
......@@ -2310,18 +2310,6 @@ dnl
AC_ARG_ENABLE(skins,
[ --enable-skins Win32 skins module (default enabled on Win32)])
if test "x${enable_skins}" != "xno"; then
if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; 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
if test "x${enable_skins}" = "xyes"; then
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
WXWINDOWS_PATH="${PATH}"
AC_ARG_WITH(wx-config-path,
[ --with-wx-config-path=PATH wx-config path (default search in \$PATH)],
......@@ -2340,6 +2328,19 @@ if test "x${enable_skins}" != "xno"; then
CPPFLAGS_skins="${CPPFLAGS_skins} `${WX_CONFIG} --cxxflags`"
LDFLAGS_skins="${LDFLAGS_skins} `${WX_CONFIG} --libs`"
fi
if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
PLUGINS="${PLUGINS} skins"
CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -U_OFF_T_ -U_off_t -fno-rtti -Imodules/gui/skins"
LDFLAGS_skins="${LDFLAGS_skins} -loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32 -lmsimg32"
else
if test "x${enable_skins}" = "xyes"; then
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
fi
dnl
......
......@@ -58,6 +58,7 @@ SOURCES_skins = \
modules/gui/skins/src/vlcproc.h \
modules/gui/skins/src/window.cpp \
modules/gui/skins/src/window.h \
modules/gui/skins/src/wxdialogs.h \
\
modules/gui/skins/win32/win32_api.cpp \
modules/gui/skins/win32/win32_bitmap.cpp \
......@@ -96,6 +97,9 @@ SOURCES_skins = \
modules/gui/skins/gtk2/gtk2_theme.h \
modules/gui/skins/gtk2/gtk2_window.cpp \
modules/gui/skins/gtk2/gtk2_window.h \
\
modules/gui/wxwindows/messages.cpp \
modules/gui/wxwindows/open.cpp \
$(NULL)
EXTRA_DIST += \
......
......@@ -2,7 +2,7 @@
* gtk2_dialog.cpp: GTK2 implementation of some dialog boxes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_dialog.cpp,v 1.4 2003/04/16 21:40:07 ipkiss Exp $
* $Id: gtk2_dialog.cpp,v 1.5 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -110,8 +110,8 @@ bool GTK2OpenFileDialog::Open()
if( p_intf != NULL && p_intf->p_sys->p_theme != NULL )
{
TRACKMOUSEEVENT TrackEvent;
TrackEvent.cbSize = sizeof( TRACKMOUSEEVENT );
TrackEvent.dwFlags = TME_LEAVE|TME_CANCEL;
TrackEvent.cbSize = sizeof( TRACKMOUSEEVENT );
TrackEvent.dwFlags = TME_LEAVE|TME_CANCEL;
TrackEvent.dwHoverTime = 1;
list<Window *>::const_iterator win;
......@@ -185,178 +185,4 @@ bool GTK2OpenFileDialog::Open()
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// 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;*/
}
//---------------------------------------------------------------------------
#endif
......@@ -2,7 +2,7 @@
* 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 $
* $Id: gtk2_dialog.h,v 1.2 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -51,32 +51,6 @@ class GTK2OpenFileDialog : OpenFileDialog
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
......@@ -2,7 +2,7 @@
* gtk2_theme.cpp: GTK2 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_theme.cpp,v 1.19 2003/04/20 16:16:34 asmax Exp $
* $Id: gtk2_theme.cpp,v 1.20 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -100,10 +100,6 @@ GTK2Theme::~GTK2Theme()
{
UnregisterClass( "SkinWindow", hinst );
}
if( GetClassInfo( hinst, "LogWindow", &wndclass ) )
{
UnregisterClass( "LogWindow", hinst );
}
if( GetClassInfo( hinst, "ParentWindow", &wndclass ) )
{
UnregisterClass( "ParentWindow", hinst );
......@@ -269,14 +265,6 @@ void GTK2Theme::AddWindow( string name, int x, int y, bool visible,
}
//---------------------------------------------------------------------------
/*HWND GTK2Theme::GetLogHandle()
{
if( Log != NULL )
return ( (GTK2LogWindow *)Log )->GetWindow();
else
return NULL;
}*/
//---------------------------------------------------------------------------
void GTK2Theme::ChangeTray()
{/*
if( ShowInTray )
......
......@@ -2,7 +2,7 @@
* gtk2_theme.h: GTK2 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_theme.h,v 1.2 2003/04/13 17:46:22 asmax Exp $
* $Id: gtk2_theme.h,v 1.3 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -39,7 +39,6 @@ class Window;
class EventBank;
class BitmapBank;
class FontBank;
class LogWindow;
//---------------------------------------------------------------------------
class GTK2Theme : public Theme
......@@ -62,8 +61,7 @@ class GTK2Theme : public Theme
virtual ~GTK2Theme();
/*
// Specific windows methods
HINSTANCE getInstance() { return hinst; }
HWND GetLogHandle();*/
HINSTANCE getInstance() { return hinst; } */
GdkWindow *GetParentWindow() { return ParentWindow; }
// !!!
......
......@@ -2,7 +2,7 @@
* os_dialog.h: Wrapper for the common dialogs
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: os_dialog.h,v 1.3 2003/04/16 21:40:07 ipkiss Exp $
* $Id: os_dialog.h,v 1.4 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -27,11 +27,9 @@
#if defined( WIN32 )
#include "win32/win32_dialog.h"
#define OSOpenFileDialog Win32OpenFileDialog
#define OSLogWindow Win32LogWindow
#else
#else
#include "gtk2/gtk2_dialog.h"
#define OSOpenFileDialog GTK2OpenFileDialog
#define OSLogWindow GTK2LogWindow
#endif
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,7 +4,7 @@
* skin.act: FleXML actions file
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin.act,v 1.3 2003/03/19 17:14:50 karibu Exp $
* $Id: skin.act,v 1.4 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -140,7 +140,7 @@
</end>
<start tag="Theme">
<![CDATA[
StartTheme( {log}, {magnet} );
StartTheme( {magnet} );
]]>
</start>
<end tag="Theme">
......
/* XML application for skin.dtd (Id: skin.dtd,v 1.3 2003/03/19 17:14:50 karibu Exp).
* Includes actions from skin.act.
* Generated 2003/04/08 20:19:55.
* Generated 2003/04/20 20:23:13.
*
* This program was generated with the FleXML XML processor generator,
* (Id: flexml.pl,v 1.24 1999/12/13 16:18:30 krisrose Exp).
......@@ -226,7 +226,7 @@ void STag_Theme(void)
#line 141 "skin.act"
StartTheme( A_Theme_log, A_Theme_magnet );
StartTheme( A_Theme_magnet );
} /* STag_Theme */
......
......@@ -3,7 +3,7 @@
* skin.dtd: DTD for the VLC skins
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin.dtd,v 1.3 2003/03/19 17:14:50 karibu Exp $
* $Id: skin.dtd,v 1.4 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -29,7 +29,6 @@
<!ELEMENT Theme (ThemeInfo,(Bitmap|Font|Window|Event)*)>
<!ATTLIST Theme
magnet CDATA "9"
log CDATA "false"
>
<!-- main elements -->
......
/* XML processor/application API for skin.dtd (Id: skin.dtd,v 1.3 2003/03/19 17:14:50 karibu Exp).
* Generated 2003/04/08 20:19:55.
* Generated 2003/04/20 20:23:13.
*
* This program was generated with the FleXML XML processor generator,
* (Id: flexml.pl,v 1.24 1999/12/13 16:18:30 krisrose Exp).
......@@ -174,8 +174,6 @@ typedef char* AT_PlayListControl_abs;
#define AU_PlayListControl_abs NULL
typedef char* AT_ImageControl_visible;
#define AU_ImageControl_visible NULL
typedef char* AT_Theme_log;
#define AU_Theme_log NULL
typedef char* AT_PlayListControl_width;
#define AU_PlayListControl_width NULL
typedef char* AT_SliderControl_help;
......@@ -350,7 +348,6 @@ extern AT_ControlGroup_y A_ControlGroup_y;
extern AT_PlayListControl_longfilename A_PlayListControl_longfilename;
extern AT_PlayListControl_abs A_PlayListControl_abs;
extern AT_ImageControl_visible A_ImageControl_visible;
extern AT_Theme_log A_Theme_log;
extern AT_PlayListControl_width A_PlayListControl_width;
extern AT_SliderControl_help A_SliderControl_help;
extern AT_ButtonControl_help A_ButtonControl_help;
......
......@@ -2,7 +2,7 @@
* wrappers.cpp: Wrappers around C++ objects
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: wrappers.cpp,v 1.8 2003/04/17 15:43:30 karibu Exp $
* $Id: wrappers.cpp,v 1.9 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -94,10 +94,9 @@ void EndWindow()
{
}
//---------------------------------------------------------------------------
void StartTheme( char *log, char *magnet )
void StartTheme( char *magnet )
{
g_pIntf->p_sys->p_theme->StartTheme( ConvertBoolean( log ),
atoi( magnet ) );
g_pIntf->p_sys->p_theme->StartTheme( atoi( magnet ) );
}
//---------------------------------------------------------------------------
void EndTheme()
......
......@@ -2,7 +2,7 @@
* wrappers.h: Wrappers around C++ objects
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: wrappers.h,v 1.3 2003/03/19 17:14:50 karibu Exp $
* $Id: wrappers.h,v 1.4 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -46,7 +46,7 @@ extern "C" {
//---------------------------------------------------------------------------
void AddThemeInfo( char *name, char *author, char *email,
char *webpage );
void StartTheme( char *log, char *magnet );
void StartTheme( char *magnet );
void EndTheme();
//---------------------------------------------------------------------------
......
......@@ -2,7 +2,7 @@
* dialog.cpp: Classes for some dialog boxes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: dialog.cpp,v 1.3 2003/04/12 21:43:27 asmax Exp $
* $Id: dialog.cpp,v 1.4 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -51,84 +51,3 @@ OpenFileDialog::~OpenFileDialog()
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Log Window
//---------------------------------------------------------------------------
LogWindow::LogWindow( intf_thread_t *_p_intf )
{
p_intf = _p_intf;
Visible = false;
}
//---------------------------------------------------------------------------
LogWindow::~LogWindow()
{
}
//---------------------------------------------------------------------------
void LogWindow::Update( msg_subscription_t *Sub )
{
//if( !Visible )
// return;
int i_start, i_stop;
int i_max_lines;
vlc_mutex_lock( Sub->p_lock );
i_stop = *Sub->pi_stop;
vlc_mutex_unlock( Sub->p_lock );
if( Sub->i_start != i_stop )
{
for( i_start = Sub->i_start;
i_start != i_stop;
i_start = (i_start+1) % VLC_MSG_QSIZE )
{
/* FIXME: kludge */
#ifdef WIN32
// 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;
#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
if( i_max_lines )
{
AddLine( (string)Sub->p_msg[i_start].psz_msg );
}
}
vlc_mutex_lock( Sub->p_lock );
Sub->i_start = i_start;
vlc_mutex_unlock( Sub->p_lock );
}
}
//---------------------------------------------------------------------------
......@@ -2,7 +2,7 @@
* skin_common.h: Private Skin interface description
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin_common.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: skin_common.h,v 1.2 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -32,33 +32,41 @@
class Theme;
class wxIcon;
class OpenDialog;
class Messages;
/*****************************************************************************
* intf_sys_t: description and status of skin interface
*****************************************************************************/
//---------------------------------------------------------------------------
// intf_sys_t: description and status of skin interface
//---------------------------------------------------------------------------
struct intf_sys_t
{
/* Pointer to the theme main class */
// Pointer to the theme main class
Theme *p_theme;
char *p_new_theme_file;
/* The input thread */
input_thread_t * p_input;
// The input thread
input_thread_t *p_input;
/* The playlist thread */
playlist_t * p_playlist;
// The playlist thread
playlist_t *p_playlist;
// Check if thread is closing
int i_close_status;
bool b_all_win_closed;
/* message bank subscription */
msg_subscription_t* p_sub;
// message bank subscription
msg_subscription_t *p_sub;
// Interface status
int i_index; // Set wich file is being played
int i_size; // Size of playlist;
wxIcon *p_icon;
// Dialogs
OpenDialog *OpenDlg;
Messages *MessagesDlg;
};
#endif
......
......@@ -2,7 +2,7 @@
* skin-main.cpp: skins plugin for VLC
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin_main.cpp,v 1.11 2003/04/18 16:04:17 asmax Exp $
* $Id: skin_main.cpp,v 1.12 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,8 @@
* USA.
*****************************************************************************/
//--- GENERAL ---------------------------------------------------------------
#include <wx/wx.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/vlc.h>
......@@ -41,6 +43,7 @@
#include "themeloader.h"
#include "vlcproc.h"
#include "skin_common.h"
#include "wxdialogs.h"
//---------------------------------------------------------------------------
......@@ -133,8 +136,6 @@ static void Close ( vlc_object_t *p_this )
// Unsuscribe to messages bank
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
// Destroy structure
free( p_intf->p_sys );
}
......@@ -145,7 +146,6 @@ static void Close ( vlc_object_t *p_this )
//---------------------------------------------------------------------------
static void Run( intf_thread_t *p_intf )
{
#if !defined WIN32
/* FIXME: should be elsewhere ? */
// Initialize GDK
......@@ -227,7 +227,6 @@ static void Run( intf_thread_t *p_intf )
// Refresh the whole interface
OSAPI_PostMessage( NULL, VLC_INTF_REFRESH, 0, (int)true );
// Run interface message loop
OSRun( p_intf );
}
......@@ -281,7 +280,7 @@ int SkinManage( intf_thread_t *p_intf )
OSAPI_PostMessage( NULL, VLC_INTF_REFRESH, 0, (long)false );
// Update the log window
//p_intf->p_sys->p_theme->UpdateLog( p_intf->p_sys->p_sub );
p_intf->p_sys->MessagesDlg->UpdateLog();
//-------------------------------------------------------------------------
if( p_intf->p_sys->p_input != NULL && !p_intf->p_sys->p_input->b_die )
......@@ -350,4 +349,3 @@ int SkinManage( intf_thread_t *p_intf )
return( VLC_TRUE );
}
//---------------------------------------------------------------------------
......@@ -2,7 +2,7 @@
* theme.cpp: Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: theme.cpp,v 1.8 2003/04/16 21:40:07 ipkiss Exp $
* $Id: theme.cpp,v 1.9 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -54,7 +54,6 @@ Theme::Theme( intf_thread_t *_p_intf )
FntBank = new FontBank( p_intf );
EvtBank = new EventBank( p_intf );
OffBank = new OffSetBank( p_intf );
Log = NULL;
ConstructPlaylist = false;
ShowInTray = false;
......@@ -70,7 +69,6 @@ Theme::~Theme()
{
delete (OSWindow *)(*win);
}
delete (OSLogWindow *)Log;
delete OffBank;
delete EvtBank;
delete BmpBank;
......@@ -183,13 +181,9 @@ void Theme::SaveConfig()
}
//---------------------------------------------------------------------------
void Theme::StartTheme( bool log, int magnet )
void Theme::StartTheme( int magnet )
{
Magnet = magnet;
if( log )
{
Log = (LogWindow *)new OSLogWindow( p_intf );
}
}
//---------------------------------------------------------------------------
void Theme::InitTheme()
......@@ -404,38 +398,4 @@ void Theme::CheckAnchors()
}
}
//---------------------------------------------------------------------------
void Theme::UpdateLog( msg_subscription_t *Sub )
{
if( Log != NULL )
Log->Update( Sub );
}
//---------------------------------------------------------------------------
void Theme::ShowLog( int show )
{
if( Log == NULL )
return;
if( show == 1 )
{
Log->Show();
}
else if( show == 0 )
{
Log->Hide();
}
else if( show == 2 )
{
if( Log->IsVisible() )
Log->Hide();
else
Log->Show();
}
}
//---------------------------------------------------------------------------
void Theme::ClearLog()
{
if( Log!= NULL )
Log->Clear();
}
//---------------------------------------------------------------------------
......@@ -2,7 +2,7 @@
* theme.h: Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: theme.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: theme.h,v 1.2 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -40,7 +40,6 @@ class BitmapBank;
class FontBank;
class Event;
class OffSetBank;
class LogWindow;
//---------------------------------------------------------------------------
class Theme
......@@ -48,7 +47,6 @@ class Theme
private:
protected:
LogWindow *Log;
int Magnet;
intf_thread_t *p_intf;
......@@ -58,7 +56,7 @@ class Theme
public:
// Constructors
Theme( intf_thread_t *_p_intf );
void StartTheme( bool log, int magnet );
void StartTheme( int magnet );
// Destructor
virtual ~Theme();
......@@ -91,12 +89,6 @@ class Theme
void MoveSkin( Window *wnd, int left, int top );
void CheckAnchors();
// Log window
LogWindow *GetLogWindow() { return Log; };
void UpdateLog( msg_subscription_t *Sub );
void ShowLog( int show );
void ClearLog();
bool ConstructPlaylist;
// Config file treatment
......
......@@ -2,7 +2,7 @@
* vlcproc.cpp: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: vlcproc.cpp,v 1.9 2003/04/17 16:32:14 karibu Exp $
* $Id: vlcproc.cpp,v 1.10 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -23,6 +23,7 @@
* USA.
*****************************************************************************/
#include <wx/wx.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/vlc.h>
......@@ -43,6 +44,7 @@
#include "window.h"
#include "vlcproc.h"
#include "skin_common.h"
#include "wxdialogs.h"
......@@ -129,11 +131,13 @@ bool VlcProc::EventProc( Event *evt )
return true;
case VLC_LOG_SHOW:
p_intf->p_sys->p_theme->ShowLog( evt->GetParam2() );
// p_intf->p_sys->p_theme->ShowLog( evt->GetParam2() );
p_intf->p_sys->MessagesDlg->Show(
!p_intf->p_sys->MessagesDlg->IsShown() );
return true;
case VLC_LOG_CLEAR:
p_intf->p_sys->p_theme->ClearLog();
// p_intf->p_sys->p_theme->ClearLog();
return true;
case VLC_INTF_REFRESH:
......@@ -383,51 +387,39 @@ void VlcProc::LoadSkin()
//---------------------------------------------------------------------------
void VlcProc::OpenFile( bool play )
{
// Initialize file structure
OpenFileDialog *OpenFile;
if( play )
{
OpenFile = (OpenFileDialog *)new OSOpenFileDialog( p_intf,
_("Open file"), false );
}
else
if( p_intf->p_sys->OpenDlg->ShowModal() != wxID_OK )
{
OpenFile = (OpenFileDialog *)new OSOpenFileDialog( p_intf,
_("Add file"), true );
return;
}
OpenFile->AddFilter( _("All files"), "*.*" );
// Check if palylist is available
// Check if playlist is available
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
if( p_playlist == NULL )
{
return;
}
// Open dialog box and launch file
if( OpenFile->Open() )
if( play )
{
list<string>::const_iterator file;
for( file = OpenFile->FileList.begin();
file != OpenFile->FileList.end(); file++ )
{
playlist_Add( p_playlist, (*file).c_str(), PLAYLIST_APPEND,
PLAYLIST_END );
}
// Refreshing
if( play )
{
// Play
p_intf->p_sys->p_theme->EvtBank->Get( "play" )->SendEvent();
}
// Append and play
playlist_Add( p_playlist,
(char *)p_intf->p_sys->OpenDlg->mrl.c_str(),
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
// Refresh interface !
p_intf->p_sys->p_theme->EvtBank->Get( "playlist_refresh" )
->PostSynchroMessage();
InterfaceRefresh();
p_intf->p_sys->p_theme->EvtBank->Get( "play" )->SendEvent();
}
else
{
// Append only
playlist_Add( p_playlist,
(char *)p_intf->p_sys->OpenDlg->mrl.c_str(),
PLAYLIST_APPEND, PLAYLIST_END );
}
// Free memory
delete OpenFile;
// Refresh interface !
p_intf->p_sys->p_theme->EvtBank->Get( "playlist_refresh" )
->PostSynchroMessage();
InterfaceRefresh();
}
//---------------------------------------------------------------------------
void VlcProc::DropFile( unsigned int param )
......
/*****************************************************************************
* wxwindows.h: private wxWindows interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: wxdialogs.h,v 1.1 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
* 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.
*****************************************************************************/
#include <wx/listctrl.h>
#include <wx/textctrl.h>
#include <wx/notebook.h>
#include <wx/spinctrl.h>
#include <wx/dnd.h>
#include <wx/treectrl.h>
class Playlist;
class Messages;
class FileInfo;
#define SLIDER_MAX_POS 10000
/*****************************************************************************
* Classes declarations.
*****************************************************************************/
class Interface;
/* Timer */
class Timer: public wxTimer
{
public:
/* Constructor */
Timer( intf_thread_t *p_intf, Interface *p_main_interface );
virtual ~Timer();
virtual void Notify();
private:
intf_thread_t *p_intf;
Interface *p_main_interface;
int i_old_playing_status;
};
/* Main Interface */
class Interface: public wxFrame
{
public:
/* Constructor */
Interface( intf_thread_t *p_intf );
virtual ~Interface();
void TogglePlayButton( int i_playing_status );
wxBoxSizer *frame_sizer;
wxStatusBar *statusbar;
wxSlider *slider;
wxWindow *slider_frame;
wxStaticBox *slider_box;
wxMenu *p_popup_menu;
wxArrayString mrl_history;
private:
void CreateOurMenuBar();
void CreateOurToolBar();
void CreateOurSlider();
void Open( int i_access_method );
/* Event handlers (these functions should _not_ be virtual) */
void OnExit( wxCommandEvent& event );
void OnAbout( wxCommandEvent& event );
void OnMessages( wxCommandEvent& event );
void OnPlaylist( wxCommandEvent& event );
void OnLogs( wxCommandEvent& event );
void OnFileInfo( wxCommandEvent& event );
void OnPreferences( wxCommandEvent& event );
void OnOpenFile( wxCommandEvent& event );
void OnOpenDisc( wxCommandEvent& event );
void OnOpenNet( wxCommandEvent& event );
void OnOpenSat( wxCommandEvent& event );
void OnPlayStream( wxCommandEvent& event );
void OnStopStream( wxCommandEvent& event );
void OnSliderUpdate( wxScrollEvent& event );
void OnPrevStream( wxCommandEvent& event );
void OnNextStream( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
Timer *timer;
intf_thread_t *p_intf;
wxFrame *p_prefs_dialog;
int i_old_playing_status;
};
/* Open Dialog */
class OpenDialog: public wxDialog
{
public:
/* Constructor */
OpenDialog( intf_thread_t *p_intf, Interface *p_main_interface,
int i_access_method );
virtual ~OpenDialog();
void Rebuild();
void Manage();
wxString mrl;
private:
wxPanel *FilePanel( wxWindow* parent );
wxPanel *DiscPanel( wxWindow* parent );
wxPanel *NetPanel( wxWindow* parent );
wxPanel *SatPanel( wxWindow* parent );
void UpdateMRL( int i_access_method );
/* Event handlers (these functions should _not_ be virtual) */
void OnOk( wxCommandEvent& event );
void OnCancel( wxCommandEvent& event );
void OnPageChange( wxNotebookEvent& event );
void OnMRLChange( wxCommandEvent& event );
/* Event handlers for the file page */
void OnFilePanelChange( wxCommandEvent& event );
void OnFileBrowse( wxCommandEvent& event );
/* Event handlers for the disc page */
void OnDiscPanelChange( wxCommandEvent& event );
void OnDiscTypeChange( wxCommandEvent& event );
/* Event handlers for the net page */
void OnNetPanelChange( wxCommandEvent& event );
void OnNetTypeChange( wxCommandEvent& event );
/* Event handlers for the stream output */
void OnSoutEnable( wxCommandEvent& event );
void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
/* Event handlers for the demux dump */
void OnDemuxDumpEnable( wxCommandEvent& event );
void OnDemuxDumpBrowse( wxCommandEvent& event );
void OnDemuxDumpChange( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
Interface *p_main_interface;
int i_current_access_method;
wxComboBox *mrl_combo;
/* Controls for the file panel */
wxComboBox *file_combo;
/* Controls for the disc panel */
wxRadioBox *disc_type;
wxTextCtrl *disc_device;
wxSpinCtrl *disc_title;
wxSpinCtrl *disc_chapter;
/* Controls for the net panel */
wxRadioBox *net_type;
int i_net_type;
wxPanel *net_subpanels[4];
wxRadioButton *net_radios[4];
wxSpinCtrl *net_ports[4];
wxTextCtrl *net_addrs[4];
/* Controls for the stream output */
wxButton *sout_button;
wxCheckBox *sout_checkbox;
/* Controls for the demux dump */
wxTextCtrl *demuxdump_textctrl;
wxButton *demuxdump_button;
wxCheckBox *demuxdump_checkbox;
};
enum
{
FILE_ACCESS = 0,
DISC_ACCESS,
NET_ACCESS,
SAT_ACCESS
};
/* Stream output Dialog */
class SoutDialog: public wxDialog
{
public:
/* Constructor */
SoutDialog( intf_thread_t *p_intf, Interface *p_main_interface );
virtual ~SoutDialog();
wxString mrl;
private:
void UpdateMRL();
wxPanel *AccessPanel( wxWindow* parent );
wxPanel *EncapsulationPanel( wxWindow* parent );
void ParseMRL();
/* Event handlers (these functions should _not_ be virtual) */
void OnOk( wxCommandEvent& event );
void OnCancel( wxCommandEvent& event );
void OnMRLChange( wxCommandEvent& event );
void OnAccessTypeChange( wxCommandEvent& event );
/* Event handlers for the file access output */
void OnFileChange( wxCommandEvent& event );
void OnFileBrowse( wxCommandEvent& event );
/* Event handlers for the net access output */
void OnNetChange( wxCommandEvent& event );
/* Event handlers for the encapsulation panel */
void OnEncapsulationChange( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
Interface *p_main_interface;
wxComboBox *mrl_combo;
wxPanel *access_panel;
wxPanel *encapsulation_panel;
/* Controls for the access outputs */
wxPanel *access_subpanels[4];
wxRadioButton *access_radios[4];
int i_access_type;
wxComboBox *file_combo;
wxSpinCtrl *net_port;
wxTextCtrl *net_addr;
/* Controls for the encapsulation */
wxRadioButton *encapsulation_radios[4];
int i_encapsulation_type;
};
/* Preferences Dialog */
class PrefsTreeCtrl;
class PrefsDialog: public wxFrame
{
public:
/* Constructor */
PrefsDialog( intf_thread_t *p_intf, Interface *p_main_interface );
virtual ~PrefsDialog();
private:
wxPanel *PrefsPanel( wxWindow* parent );
/* Event handlers (these functions should _not_ be virtual) */
void OnOk( wxCommandEvent& event );
void OnCancel( wxCommandEvent& event );
void OnSave( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
Interface *p_main_interface;
PrefsTreeCtrl *prefs_tree;
};
/* Messages */
class Messages: public wxFrame
{
public:
/* Constructor */
Messages( intf_thread_t *p_intf, Interface *_p_main_interface );
virtual ~Messages();
void UpdateLog();
private:
/* Event handlers (these functions should _not_ be virtual) */
void OnClose( wxCommandEvent& event );
void OnVerbose( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
Interface *p_main_interface;
wxTextCtrl *textctrl;
wxTextAttr *info_attr;
wxTextAttr *err_attr;
wxTextAttr *warn_attr;
wxTextAttr *dbg_attr;
vlc_bool_t b_verbose;
};
/* Playlist */
class Playlist: public wxFrame
{
public:
/* Constructor */
Playlist( intf_thread_t *p_intf, Interface *p_main_interface );
virtual ~Playlist();
void Rebuild();
void Manage();
private:
void DeleteItem( int item );
/* Event handlers (these functions should _not_ be virtual) */
void OnAddUrl( wxCommandEvent& event );
void OnAddDirectory( wxCommandEvent& event );
void OnClose( wxCommandEvent& event );
void OnInvertSelection( wxCommandEvent& event );
void OnDeleteSelection( wxCommandEvent& event );
void OnSelectAll( wxCommandEvent& event );
void OnActivateItem( wxListEvent& event );
void OnKeyDown( wxListEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
Interface *p_main_interface;
wxListView *listview;
wxButton *ok_button;
};
/* File Info */
class FileInfo: public wxFrame
{
public:
/* Constructor */
FileInfo( intf_thread_t *p_intf, Interface *p_main_interface );
virtual ~FileInfo();
void UpdateFileInfo();
private:
void OnClose( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
wxTreeCtrl *fileinfo_tree;
wxTreeItemId fileinfo_root;
};
#if !defined(__WXX11__)
/* Drag and Drop class */
class DragAndDrop: public wxFileDropTarget
{
public:
DragAndDrop( intf_thread_t *_p_intf );
virtual bool OnDropFiles( wxCoord x, wxCoord y,
const wxArrayString& filenames );
private:
intf_thread_t *p_intf;
};
#endif
/* Popup contextual menu */
class PopupMenu: public wxMenu
{
public:
/* Constructor */
PopupMenu( intf_thread_t *p_intf, Interface *p_main_interface );
virtual ~PopupMenu();
private:
/* Event handlers (these functions should _not_ be virtual) */
void OnClose( wxCommandEvent& event );
void OnEntrySelected( wxCommandEvent& event );
wxMenu *PopupMenu::CreateDummyMenu();
void PopupMenu::CreateMenuEntry( char *, vlc_object_t * );
wxMenu *PopupMenu::CreateSubMenu( char *, vlc_object_t * );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
Interface *p_main_interface;
int i_item_id;
};
class PopupEvtHandler : public wxEvtHandler
{
public:
PopupEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
virtual ~PopupEvtHandler();
void PopupEvtHandler::OnMenuEvent( wxCommandEvent& event );
private:
DECLARE_EVENT_TABLE()
intf_thread_t *p_intf;
Interface *p_main_interface;
};
class wxMenuItemExt: public wxMenuItem
{
public:
/* Constructor */
wxMenuItemExt( wxMenu* parentMenu, int id,
const wxString& text,
const wxString& helpString,
wxItemKind kind,
char *_psz_var, int _i_object_id, vlc_value_t _val ):
wxMenuItem( parentMenu, id, text, helpString, kind )
{
/* Initializations */
psz_var = _psz_var;
i_object_id = _i_object_id;
val = _val;
};
virtual ~wxMenuItemExt() { if( psz_var ) free( psz_var ); };
char *psz_var;
int i_object_id;
vlc_value_t val;
private:
};
......@@ -2,7 +2,7 @@
* win32_dialog.cpp: Win32 implementation of some dialog boxes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_dialog.cpp,v 1.4 2003/04/16 21:40:07 ipkiss Exp $
* $Id: win32_dialog.cpp,v 1.5 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -186,178 +186,4 @@ bool Win32OpenFileDialog::Open()
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// 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( ( (Win32Theme *)p_intf->p_sys->p_theme )
->GetLogHandle() == hwnd )
{
SetWindowPos( ( (Win32LogWindow *)
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;
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Win32 Log Window class
//---------------------------------------------------------------------------
Win32LogWindow::Win32LogWindow( 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();
}
//---------------------------------------------------------------------------
Win32LogWindow::~Win32LogWindow()
{
DestroyWindow( hRichCtrl );
DestroyWindow( hWindow );
}
//---------------------------------------------------------------------------
void Win32LogWindow::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 Win32LogWindow::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 Win32LogWindow::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 Win32LogWindow::Show()
{
ShowWindow( hWindow, SW_SHOW );
Visible = true;
}
//---------------------------------------------------------------------------
void Win32LogWindow::Hide()
{
ShowWindow( hWindow, SW_HIDE );
Visible = false;
}
//---------------------------------------------------------------------------
#endif
......@@ -2,7 +2,7 @@
* win32_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_run.cpp,v 1.5 2003/04/16 21:40:07 ipkiss Exp $
* $Id: win32_run.cpp,v 1.6 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -25,7 +25,8 @@
#ifdef WIN32
//--- WIN32 -----------------------------------------------------------------
//--- GENERAL ---------------------------------------------------------------
#include <wx/wx.h>
#include <windows.h>
//--- VLC -------------------------------------------------------------------
......@@ -42,8 +43,10 @@
#include "../os_theme.h"
#include "../src/skin_common.h"
#include "../src/vlcproc.h"
#include "../src/wxdialogs.h"
// include the icon graphic
#include "share/vlc32x32.xpm"
//---------------------------------------------------------------------------
// Specific method
......@@ -52,9 +55,87 @@ bool IsVLCEvent( unsigned int msg );
int SkinManage( intf_thread_t *p_intf );
//---------------------------------------------------------------------------
// Local classes declarations.
//---------------------------------------------------------------------------
class Instance: public wxApp
{
public:
Instance();
Instance( intf_thread_t *_p_intf );
bool OnInit();
OpenDialog *open;
private:
intf_thread_t *p_intf;
};
//---------------------------------------------------------------------------
// REFRESH TIMER CALLBACK
// Implementation of Instance class
//---------------------------------------------------------------------------
Instance::Instance( )
{
}
Instance::Instance( intf_thread_t *_p_intf )
{
// Initialization
p_intf = _p_intf;
}
IMPLEMENT_APP_NO_MAIN(Instance)
bool Instance::OnInit()
{
p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
p_intf->p_sys->OpenDlg = new OpenDialog( p_intf, NULL, FILE_ACCESS );
p_intf->p_sys->MessagesDlg = new Messages( p_intf, NULL );
return TRUE;
}
//---------------------------------------------------------------------------
#if !defined(__BUILTIN__) && defined( WIN32 )
HINSTANCE hInstance = 0;
extern "C" BOOL WINAPI
DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
{
hInstance = (HINSTANCE)hModule;
return TRUE;
}
#endif
//---------------------------------------------------------------------------
// Thread callback
// We create all wxWindows dialogs in a separate thread because we don't want
// any interaction with our own message loop
//---------------------------------------------------------------------------
DWORD WINAPI ThreadFunc( LPVOID lpParam )
{
intf_thread_t *p_intf = (intf_thread_t *)lpParam;
/* Hack to pass the p_intf pointer to the new wxWindow Instance object */
wxTheApp = new Instance( p_intf );
#if defined( WIN32 )
#if !defined(__BUILTIN__)
wxEntry( hInstance/*GetModuleHandle(NULL)*/, NULL, NULL, SW_SHOW, TRUE );
#else
wxEntry( GetModuleHandle( NULL ), NULL, NULL, SW_SHOW, TRUE );
#endif
#else
wxEntry( 1, p_args );
#endif
return 0;
}
//---------------------------------------------------------------------------
// Refresh Timer Callback
//---------------------------------------------------------------------------
void CALLBACK RefreshTimer( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime )
{
......@@ -77,6 +158,10 @@ void OSRun( intf_thread_t *p_intf )
Event *ProcessEvent;
int KeyModifier = 0;
// Create a new thread for wxWindows
HANDLE hThread;
hThread = CreateThread( NULL, 0, ThreadFunc, (LPVOID) p_intf, 0, 0 );
// Create refresh timer
SetTimer( ((OSTheme *)p_intf->p_sys->p_theme)->GetParentWindow(), 42, 200,
(TIMERPROC)RefreshTimer );
......@@ -85,6 +170,20 @@ void OSRun( intf_thread_t *p_intf )
while( GetMessage( &msg, NULL, 0, 0 ) )
{
for( win = p_intf->p_sys->p_theme->WindowList.begin();
win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
if( msg.hwnd == NULL || msg.hwnd == ((Win32Window*)(*win))->GetHandle() )
{
break;
}
}
if( win == p_intf->p_sys->p_theme->WindowList.end() )
{
// DispatchMessage( &msg );
// DefWindowProc( msg.hwnd, msg.message, msg.wParam, msg.lParam );
}
// Translate keys
TranslateMessage( &msg );
......
......@@ -2,7 +2,7 @@
* win32_theme.cpp: Win32 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_theme.cpp,v 1.3 2003/04/16 21:40:07 ipkiss Exp $
* $Id: win32_theme.cpp,v 1.4 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -179,10 +179,6 @@ Win32Theme::~Win32Theme()
{
UnregisterClass( "SkinWindow", hinst );
}
if( GetClassInfo( hinst, "LogWindow", &wndclass ) )
{
UnregisterClass( "LogWindow", hinst );
}
if( GetClassInfo( hinst, "ParentWindow", &wndclass ) )
{
UnregisterClass( "ParentWindow", hinst );
......@@ -303,14 +299,6 @@ void Win32Theme::AddWindow( string name, int x, int y, bool visible,
fadetime, alpha, movealpha, dragdrop ) ) ;
}
//---------------------------------------------------------------------------
HWND Win32Theme::GetLogHandle()
{
if( Log != NULL )
return ( (Win32LogWindow *)Log )->GetWindow();
else
return NULL;
}
//---------------------------------------------------------------------------
void Win32Theme::ChangeTray()
{
if( ShowInTray )
......
......@@ -2,7 +2,7 @@
* win32_theme.h: Win32 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_theme.h,v 1.2 2003/04/12 21:43:27 asmax Exp $
* $Id: win32_theme.h,v 1.3 2003/04/20 20:28:39 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -41,7 +41,6 @@ class Window;
class EventBank;
class BitmapBank;
class FontBank;
class LogWindow;
//---------------------------------------------------------------------------
class Win32Theme : public Theme
......@@ -65,7 +64,6 @@ class Win32Theme : public Theme
// Specific windows methods
HINSTANCE getInstance() { return hinst; }
HWND GetLogHandle();
HWND GetParentWindow() { return ParentWindow; }
// !!!
......
......@@ -2,7 +2,7 @@
* playlist.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: messages.cpp,v 1.3 2003/04/06 16:30:43 gbazin Exp $
* $Id: messages.cpp,v 1.4 2003/04/20 20:28:40 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
*
......@@ -45,7 +45,12 @@
#include <vlc/intf.h>
#include "wxwindows.h"
#if defined MODULE_NAME_IS_skins
# include "../skins/src/skin_common.h"
# include "../skins/src/wxdialogs.h"
#else
# include "wxwindows.h"
#endif
/*****************************************************************************
* Event Table.
......
......@@ -2,7 +2,7 @@
* open.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: open.cpp,v 1.13 2003/04/06 01:00:07 massiot Exp $
* $Id: open.cpp,v 1.14 2003/04/20 20:28:40 ipkiss Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -49,7 +49,12 @@
#include <vlc/intf.h>
#include "wxwindows.h"
#if defined MODULE_NAME_IS_skins
# include "../skins/src/skin_common.h"
# include "../skins/src/wxdialogs.h"
#else
# include "wxwindows.h"
#endif
#ifndef wxRB_SINGLE
# define wxRB_SINGLE 0
......@@ -672,12 +677,14 @@ void OpenDialog::OnSoutEnable( wxCommandEvent& event )
void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) )
{
/* Show/hide the open dialog */
#if !defined MODULE_NAME_IS_skins
SoutDialog dialog( p_intf, p_main_interface );
if( dialog.ShowModal() == wxID_OK )
{
config_PutPsz( p_intf, "sout", (char *)dialog.mrl.c_str() );
}
#endif
}
/*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment