Commit 3435dcce authored by Olivier Teulière's avatar Olivier Teulière

* we now use a wxwindow dialog to load the skins, so we can get rid

   of our custom dialog
parent dfa3c5d0
SOURCES_skins = \ SOURCES_skins = \
modules/gui/skins/os_api.h \ modules/gui/skins/os_api.h \
modules/gui/skins/os_bitmap.h \ modules/gui/skins/os_bitmap.h \
modules/gui/skins/os_dialog.h \
modules/gui/skins/os_event.h \ modules/gui/skins/os_event.h \
modules/gui/skins/os_font.h \ modules/gui/skins/os_font.h \
modules/gui/skins/os_graphics.h \ modules/gui/skins/os_graphics.h \
...@@ -40,8 +39,6 @@ SOURCES_skins = \ ...@@ -40,8 +39,6 @@ SOURCES_skins = \
modules/gui/skins/src/bezier.h \ modules/gui/skins/src/bezier.h \
modules/gui/skins/src/bitmap.cpp \ modules/gui/skins/src/bitmap.cpp \
modules/gui/skins/src/bitmap.h \ modules/gui/skins/src/bitmap.h \
modules/gui/skins/src/dialog.cpp \
modules/gui/skins/src/dialog.h \
modules/gui/skins/src/event.cpp \ modules/gui/skins/src/event.cpp \
modules/gui/skins/src/event.h \ modules/gui/skins/src/event.h \
modules/gui/skins/src/font.cpp \ modules/gui/skins/src/font.cpp \
...@@ -63,8 +60,6 @@ SOURCES_skins = \ ...@@ -63,8 +60,6 @@ SOURCES_skins = \
modules/gui/skins/win32/win32_api.cpp \ modules/gui/skins/win32/win32_api.cpp \
modules/gui/skins/win32/win32_bitmap.cpp \ modules/gui/skins/win32/win32_bitmap.cpp \
modules/gui/skins/win32/win32_bitmap.h \ 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.cpp \
modules/gui/skins/win32/win32_dragdrop.h \ modules/gui/skins/win32/win32_dragdrop.h \
modules/gui/skins/win32/win32_event.cpp \ modules/gui/skins/win32/win32_event.cpp \
...@@ -82,8 +77,6 @@ SOURCES_skins = \ ...@@ -82,8 +77,6 @@ SOURCES_skins = \
modules/gui/skins/gtk2/gtk2_api.cpp \ modules/gui/skins/gtk2/gtk2_api.cpp \
modules/gui/skins/gtk2/gtk2_bitmap.cpp \ modules/gui/skins/gtk2/gtk2_bitmap.cpp \
modules/gui/skins/gtk2/gtk2_bitmap.h \ 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.cpp \
modules/gui/skins/gtk2/gtk2_dragdrop.h \ modules/gui/skins/gtk2/gtk2_dragdrop.h \
modules/gui/skins/gtk2/gtk2_event.cpp \ modules/gui/skins/gtk2/gtk2_event.cpp \
......
/*****************************************************************************
* gtk2_dialog.cpp: GTK2 implementation of some dialog boxes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_dialog.cpp,v 1.5 2003/04/20 20:28:39 ipkiss 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.
*****************************************************************************/
#if !defined WIN32
//--- 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 "../src/banks.h"
#include "../src/dialog.h"
#include "../os_dialog.h"
#include "../src/skin_common.h"
#include "../src/window.h"
#include "../os_window.h"
#include "../src/theme.h"
#include "../os_theme.h"
#include "../src/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 );
TrackEvent.dwFlags = TME_LEAVE|TME_CANCEL;
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;*/
}
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* gtk2_dialog.h: GTK2 implementation of some dialog boxes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_dialog.h,v 1.2 2003/04/20 20:28:39 ipkiss 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();
};
//---------------------------------------------------------------------------
#endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_theme.cpp: GTK2 implementation of the Theme class * gtk2_theme.cpp: GTK2 implementation of the Theme class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_theme.cpp,v 1.20 2003/04/20 20:28:39 ipkiss Exp $ * $Id: gtk2_theme.cpp,v 1.21 2003/04/21 02:12:06 ipkiss Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -40,8 +40,6 @@ ...@@ -40,8 +40,6 @@
#include "../os_event.h" #include "../os_event.h"
#include "../src/theme.h" #include "../src/theme.h"
#include "../os_theme.h" #include "../os_theme.h"
#include "../src/dialog.h"
#include "../os_dialog.h"
#include "../src/vlcproc.h" #include "../src/vlcproc.h"
#include "../src/skin_common.h" #include "../src/skin_common.h"
......
/*****************************************************************************
* os_dialog.h: Wrapper for the common dialogs
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $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>
*
* 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.
*****************************************************************************/
#if defined( WIN32 )
#include "win32/win32_dialog.h"
#define OSOpenFileDialog Win32OpenFileDialog
#else
#include "gtk2/gtk2_dialog.h"
#define OSOpenFileDialog GTK2OpenFileDialog
#endif
/*****************************************************************************
* dialog.cpp: Classes for some dialog boxes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $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>
*
* 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>
//--- SKIN ------------------------------------------------------------------
#include "dialog.h"
//---------------------------------------------------------------------------
// Open file dialog box
//---------------------------------------------------------------------------
OpenFileDialog::OpenFileDialog( intf_thread_t *_p_intf, string title,
bool multiselect )
{
p_intf = _p_intf;
MultiSelect = multiselect;
Title = title;
Filter = new char[200];
FilterLength = 0;
}
//---------------------------------------------------------------------------
OpenFileDialog::~OpenFileDialog()
{
delete[] Filter;
}
//---------------------------------------------------------------------------
/*****************************************************************************
* dialog.h: Classes for some dialog boxes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: dialog.h,v 1.2 2003/03/20 09:29:07 karibu Exp $
*
* Authors: Olivier Teulire <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_DIALOG
#define VLC_SKIN_DIALOG
//--- GENERAL ---------------------------------------------------------------
#include <string>
#include <list>
using namespace std;
//---------------------------------------------------------------------------
struct intf_thread_t;
struct msg_subscription_t;
//---------------------------------------------------------------------------
class OpenFileDialog
{
private:
protected:
char *Filter;
int FilterLength;
string Title;
bool MultiSelect;
intf_thread_t *p_intf;
public:
// Constructors
OpenFileDialog( intf_thread_t *_p_intf, string title,
bool multiselect );
// Destructors
virtual ~OpenFileDialog();
// List of files
list<string> FileList;
// Specific methods
virtual void AddFilter( string name, string type ) = 0;
virtual bool Open() = 0;
};
//---------------------------------------------------------------------------
class LogWindow
{
protected:
bool Visible;
intf_thread_t *p_intf;
public:
// Constructors
LogWindow( intf_thread_t *_p_intf );
// Destructors
virtual ~LogWindow();
virtual void Clear() = 0;
virtual void AddLine( string line ) = 0;
virtual void ChangeColor( int color, bool bold = false ) = 0;
virtual void Show() = 0;
virtual void Hide() = 0;
// Getters
bool IsVisible() { return Visible; };
void Update( msg_subscription_t *Sub );
};
//---------------------------------------------------------------------------
#endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* skin-main.cpp: skins plugin for VLC * skin-main.cpp: skins plugin for VLC
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: skin_main.cpp,v 1.13 2003/04/21 00:54:26 ipkiss Exp $ * $Id: skin_main.cpp,v 1.14 2003/04/21 02:12:06 ipkiss Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
//--- SKIN ------------------------------------------------------------------ //--- SKIN ------------------------------------------------------------------
#include "../os_api.h" #include "../os_api.h"
#include "event.h" #include "event.h"
#include "dialog.h"
#include "../os_dialog.h"
#include "banks.h" #include "banks.h"
#include "window.h" #include "window.h"
#include "theme.h" #include "theme.h"
...@@ -184,35 +182,25 @@ static void Run( intf_thread_t *p_intf ) ...@@ -184,35 +182,25 @@ static void Run( intf_thread_t *p_intf )
#endif #endif
{ {
// Last chance: the user can select a new theme file // Last chance: the user can select a new theme file
wxFileDialog dialog( NULL, _("Open a skin file"), "", "",
"Skin files (*.vlt)|*.vlt|Skin files (*.xml)|*.xml|"
"All files|*.*", wxOPEN );
// Initialize file structure if( dialog.ShowModal() == wxID_OK )
OpenFileDialog *OpenFile;
OpenFile = (OpenFileDialog *)new OSOpenFileDialog( NULL,
_("Open skin"), false );
OpenFile->AddFilter( _("Skin files"), "*.vlt" );
OpenFile->AddFilter( _("Skin files"), "*.xml" );
OpenFile->AddFilter( _("All files"), "*.*" );
// Open dialog box
if( OpenFile->Open() )
{ {
// try to load selected file // try to load selected file
if( ! Loader->Load( OpenFile->FileList.front() ) ) if( ! Loader->Load( dialog.GetPath().c_str() ) )
{ {
// He, he, what the hell is he doing ? // He, he, what the hell is he doing ?
delete OpenFile;
delete Loader; delete Loader;
return; return;
} }
} }
else else
{ {
delete OpenFile;
delete Loader; delete Loader;
return; return;
} }
delete OpenFile;
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* theme.cpp: Theme class * theme.cpp: Theme class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: theme.cpp,v 1.9 2003/04/20 20:28:39 ipkiss Exp $ * $Id: theme.cpp,v 1.10 2003/04/21 02:12:06 ipkiss Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -31,8 +31,6 @@ ...@@ -31,8 +31,6 @@
#include "../os_api.h" #include "../os_api.h"
#include "window.h" #include "window.h"
#include "../os_window.h" #include "../os_window.h"
#include "dialog.h"
#include "../os_dialog.h"
#include "banks.h" #include "banks.h"
#include "anchor.h" #include "anchor.h"
#include "event.h" #include "event.h"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlcproc.cpp: VlcProc class * vlcproc.cpp: VlcProc class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: vlcproc.cpp,v 1.12 2003/04/21 00:54:26 ipkiss Exp $ * $Id: vlcproc.cpp,v 1.13 2003/04/21 02:12:06 ipkiss Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
//--- SKIN ------------------------------------------------------------------ //--- SKIN ------------------------------------------------------------------
#include "../os_api.h" #include "../os_api.h"
#include "dialog.h"
#include "../os_dialog.h"
#include "event.h" #include "event.h"
#include "banks.h" #include "banks.h"
#include "theme.h" #include "theme.h"
...@@ -329,29 +327,21 @@ void VlcProc::LoadSkin() ...@@ -329,29 +327,21 @@ void VlcProc::LoadSkin()
{ {
if( p_intf->p_sys->p_new_theme_file == NULL ) if( p_intf->p_sys->p_new_theme_file == NULL )
{ {
// Initialize file structure wxFileDialog dialog( NULL, _("Open a skin file"), "", "",
OpenFileDialog *OpenFile; "Skin files (*.vlt)|*.vlt|Skin files (*.xml)|*.xml|All files|*.*",
OpenFile = (OpenFileDialog *)new OSOpenFileDialog( p_intf, wxOPEN );
_("Change skin - Open new file"), false );
OpenFile->AddFilter( _("Skin files"), "*.vlt" ); if( dialog.ShowModal() == wxID_OK )
OpenFile->AddFilter( _("Skin files"), "*.xml" );
OpenFile->AddFilter( _("All files"), "*.*" );
// Open dialog box
if( OpenFile->Open() )
{ {
p_intf->p_sys->p_new_theme_file = p_intf->p_sys->p_new_theme_file =
new char[OpenFile->FileList.front().length()]; new char[dialog.GetPath().Length()];
strcpy( p_intf->p_sys->p_new_theme_file, strcpy( p_intf->p_sys->p_new_theme_file,
OpenFile->FileList.front().c_str() ); dialog.GetPath().c_str() );
// Tell vlc to change skin after hiding interface // Tell vlc to change skin after hiding interface
OSAPI_PostMessage( NULL, VLC_HIDE, VLC_LOAD_SKIN, 0 ); OSAPI_PostMessage( NULL, VLC_HIDE, VLC_LOAD_SKIN, 0 );
} }
// Free memory
delete OpenFile;
} }
else else
{ {
......
/*****************************************************************************
* win32_dialog.cpp: Win32 implementation of some dialog boxes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $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>
*
* 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.
*****************************************************************************/
#ifdef WIN32
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
extern intf_thread_t *g_pIntf;
//--- WIN32 -----------------------------------------------------------------
#define _WIN32_IE 0x0400 // Yes, i think it's a fucking kludge !
#include <windows.h>
#include <commdlg.h>
#include <commctrl.h>
#include <richedit.h>
//--- SKIN ------------------------------------------------------------------
#include "../src/banks.h"
#include "../src/dialog.h"
#include "../os_dialog.h"
#include "../src/skin_common.h"
#include "../src/window.h"
#include "../os_window.h"
#include "../src/theme.h"
#include "../os_theme.h"
#include "../src/event.h"
#include "../os_api.h"
//---------------------------------------------------------------------------
// Open file dialog box
//---------------------------------------------------------------------------
Win32OpenFileDialog::Win32OpenFileDialog( intf_thread_t *_p_intf, string title,
bool multiselect ) : OpenFileDialog( _p_intf, title, multiselect )
{
}
//---------------------------------------------------------------------------
Win32OpenFileDialog::~Win32OpenFileDialog()
{
}
//---------------------------------------------------------------------------
void Win32OpenFileDialog::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 Win32OpenFileDialog::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 );
TrackEvent.dwFlags = TME_LEAVE|TME_CANCEL;
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 = ( (Win32Window *)(*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;
}
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* win32_dialog.h: Win32 implementation of some dialog boxes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_dialog.h,v 1.3 2003/04/12 21:43:27 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
*
* 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.
*****************************************************************************/
#ifdef WIN32
#ifndef VLC_SKIN_WIN32_DIALOG
#define VLC_SKIN_WIN32_DIALOG
//--- GENERAL ---------------------------------------------------------------
#include <string>
using namespace std;
//---------------------------------------------------------------------------
class Win32OpenFileDialog : OpenFileDialog
{
private:
protected:
public:
// Constructors
Win32OpenFileDialog( intf_thread_t *_p_intf, string title,
bool multiselect );
// Destructors
virtual ~Win32OpenFileDialog();
virtual void AddFilter( string name, string type );
virtual bool Open();
};
//---------------------------------------------------------------------------
class Win32LogWindow : LogWindow
{
private:
HWND hWindow;
HWND hRichCtrl;
string RtfHeader;
public:
// Constructors
Win32LogWindow( intf_thread_t *_p_intf );
// Destructors
virtual ~Win32LogWindow();
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
#endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* win32_theme.cpp: Win32 implementation of the Theme class * win32_theme.cpp: Win32 implementation of the Theme class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: win32_theme.cpp,v 1.4 2003/04/20 20:28:39 ipkiss Exp $ * $Id: win32_theme.cpp,v 1.5 2003/04/21 02:12:06 ipkiss Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -44,8 +44,6 @@ ...@@ -44,8 +44,6 @@
#include "../os_event.h" #include "../os_event.h"
#include "../src/theme.h" #include "../src/theme.h"
#include "../os_theme.h" #include "../os_theme.h"
#include "../src/dialog.h"
#include "../os_dialog.h"
#include "../src/vlcproc.h" #include "../src/vlcproc.h"
#include "../src/skin_common.h" #include "../src/skin_common.h"
......
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