Commit 801b203b authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wince/*: New Windows CE interface by Cedric Marodon...

* modules/gui/wince/*: New Windows CE interface by Cedric Marodon <cedric_marodon at yahoo dot fr> (ported from the vlcpocketpc project by myself after some heavy code cleanup).
parent 8bd934d6
SOURCES_wince = \
wince.cpp \
wince.h \
interface.cpp \
menus.cpp \
open.cpp \
playlist.cpp \
fileinfo.cpp \
iteminfo.cpp \
messages.cpp \
preferences.cpp \
preferences_widgets.cpp \
preferences_widgets.h \
subtitles.cpp \
timer.cpp \
video.cpp \
wince.rc \
$(NULL)
EXTRA_DIST += \
bitmaps/vlc16x16.ico \
bitmaps/toolbar1.bmp \
bitmaps/toolbar2.bmp \
bitmaps/toolbar3.bmp
/*****************************************************************************
* fileinfo.cpp : WinCE gui plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2004 VideoLAN
* $Id$
*
* Authors: Marodon Cedric <cedric_marodon@yahoo.fr>
* Gildas Bazin <gbazin@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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <string.h>
#include <string>
#include <stdio.h>
using namespace std;
#include <winuser.h>
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <aygshell.h>
#include <commdlg.h>
#include "wince.h"
/*****************************************************************************
* Constructor.
*****************************************************************************/
FileInfo::FileInfo( intf_thread_t *_p_intf, HINSTANCE _hInst )
{
/* Initializations */
p_intf = _p_intf;
hInst = _hInst;
hwnd_fileinfo = hwndTV = NULL;
}
/***********************************************************************
FUNCTION:
CreateTreeView
PURPOSE:
Registers the TreeView control class and creates a TreeView.
***********************************************************************/
BOOL FileInfo::CreateTreeView(HWND hwnd)
{
DWORD dwStyle;
RECT rect;
INITCOMMONCONTROLSEX iccex;
iccex.dwSize = sizeof( INITCOMMONCONTROLSEX );
iccex.dwICC = ICC_TREEVIEW_CLASSES;
// Registers Statusbar control classes from the common control dll
InitCommonControlsEx( &iccex );
// Get the coordinates of the parent window's client area
GetClientRect( hwnd, &rect );
// Assign the window styles for the tree view.
dwStyle = WS_VISIBLE | WS_CHILD | TVS_HASLINES | TVS_LINESATROOT |
TVS_HASBUTTONS;
// Create the tree-view control.
hwndTV = CreateWindowEx( 0, WC_TREEVIEW, NULL, dwStyle, 0, MENU_HEIGHT,
rect.right-rect.left,
rect.bottom-rect.top-MENU_HEIGHT,
hwnd, NULL, hInst, NULL );
// Be sure that the tree view actually was created.
if( !hwndTV ) return FALSE;
UpdateFileInfo( hwndTV );
return TRUE;
}
/***********************************************************************
FUNCTION:
UpdateFileInfo
PURPOSE:
Update the TreeView with file information.
***********************************************************************/
void FileInfo::UpdateFileInfo(HWND hwnd)
{
TVITEM tvi = {0};
TVINSERTSTRUCT tvins = {0};
HTREEITEM hPrev = (HTREEITEM)TVI_FIRST;
HTREEITEM hPrevRootItem = NULL;
HTREEITEM hPrevLev2Item = NULL;
p_intf->p_sys->p_input = (input_thread_t *)
vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
input_thread_t *p_input = p_intf->p_sys->p_input;
if( !p_input ) return;
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
// Set the text of the item.
tvi.pszText = _FROMMB( p_input->input.p_item->psz_name );
tvi.cchTextMax = _tcslen( tvi.pszText );
// Save the heading level in the item's application-defined data area
tvi.lParam = (LPARAM)1;
tvins.item = tvi;
//tvins.hInsertAfter = TVI_LAST;
tvins.hInsertAfter = hPrev;
tvins.hParent = TVI_ROOT;
// Add the item to the tree-view control.
hPrev = (HTREEITEM)TreeView_InsertItem( hwnd, &tvins );
hPrevRootItem = hPrev;
vlc_mutex_lock( &p_input->input.p_item->lock );
for( int i = 0; i < p_input->input.p_item->i_categories; i++ )
{
info_category_t *p_cat = p_input->input.p_item->pp_categories[i];
// Set the text of the item.
tvi.pszText = _FROMMB( p_input->input.p_item->psz_name );
tvi.cchTextMax = _tcslen( tvi.pszText );
// Save the heading level in the item's application-defined data area
tvi.lParam = (LPARAM)2; // level 2
tvins.item = tvi;
tvins.hInsertAfter = hPrev;
tvins.hParent = hPrevRootItem;
// Add the item to the tree-view control.
hPrev = (HTREEITEM)TreeView_InsertItem( hwnd, &tvins );
hPrevLev2Item = hPrev;
for( int j = 0; j < p_cat->i_infos; j++ )
{
info_t *p_info = p_cat->pp_infos[j];
// Set the text of the item.
string szAnsi = (string)p_info->psz_name;
szAnsi += ": ";
szAnsi += p_info->psz_value;
tvi.pszText = _FROMMB( szAnsi.c_str() );
tvi.cchTextMax = _tcslen( tvi.pszText );
tvi.lParam = (LPARAM)3; // level 3
tvins.item = tvi;
tvins.hInsertAfter = hPrev;
tvins.hParent = hPrevLev2Item;
// Add the item to the tree-view control.
hPrev = (HTREEITEM)TreeView_InsertItem( hwnd, &tvins );
}
TreeView_Expand( hwnd, hPrevLev2Item, TVE_EXPANDPARTIAL |TVE_EXPAND );
}
vlc_mutex_unlock( &p_input->input.p_item->lock );
TreeView_Expand( hwnd, hPrevRootItem, TVE_EXPANDPARTIAL |TVE_EXPAND );
return;
}
/***********************************************************************
FUNCTION:
WndProc
PURPOSE:
Processes messages sent to the main window.
***********************************************************************/
LRESULT FileInfo::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
PBOOL pbProcessed )
{
SHINITDLGINFO shidi;
LRESULT lResult = CBaseWindow::WndProc( hwnd, msg, wp, lp, pbProcessed );
BOOL bWasProcessed = *pbProcessed;
*pbProcessed = TRUE;
switch( msg )
{
case WM_INITDIALOG:
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN |
SHIDIF_FULLSCREENNOMENUBAR;//SHIDIF_SIZEDLGFULLSCREEN;
shidi.hDlg = hwnd;
SHInitDialog( &shidi );
CreateTreeView( hwnd );
UpdateWindow( hwnd );
SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
return lResult;
case WM_COMMAND:
if ( LOWORD(wp) == IDOK )
{
EndDialog( hwnd, LOWORD( wp ) );
return TRUE;
}
*pbProcessed = bWasProcessed;
lResult = FALSE;
return lResult;
default:
// the message was not processed
// indicate if the base class handled it
*pbProcessed = bWasProcessed;
lResult = FALSE;
return lResult;
}
return lResult;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* messages.cpp : WinCE gui plugin for VLC
*****************************************************************************
* Copyright (C) 2000-2004 VideoLAN
* $Id$
*
* Authors: Marodon Cedric <cedric_marodon@yahoo.fr>
* Gildas Bazin <gbazin@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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <string.h>
#include <string>
#include <stdio.h>
using namespace std;
#include <winuser.h>
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <aygshell.h>
#include <commdlg.h>
#include "wince.h"
#ifndef NMAXFILE
#define NMAXFILE 512 // at least 256
#endif
#ifndef TEXTMAXBUF
#define TEXTMAXBUF 512 // at least 500
#endif
/*****************************************************************************
* Constructor.
*****************************************************************************/
Messages::Messages( intf_thread_t *_p_intf, HINSTANCE _hInst )
{
/* Initializations */
p_intf = _p_intf;
hInst = _hInst;
hListView = NULL;
b_verbose = VLC_FALSE;
}
/***********************************************************************
FUNCTION:
WndProc
PURPOSE:
Processes messages sent to the main window.
***********************************************************************/
LRESULT Messages::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
PBOOL pbProcessed )
{
SHINITDLGINFO shidi;
TCHAR psz_text[TEXTMAXBUF];
OPENFILENAME ofn;
int i_dummy;
HANDLE fichier;
int nList=0;
LRESULT lResult = CBaseWindow::WndProc( hwnd, msg, wp, lp, pbProcessed );
BOOL bWasProcessed = *pbProcessed;
*pbProcessed = TRUE;
switch (msg)
{
case WM_INITDIALOG:
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN |
SHIDIF_FULLSCREENNOMENUBAR;//SHIDIF_SIZEDLGFULLSCREEN;
shidi.hDlg = hwnd;
SHInitDialog( &shidi );
RECT rect;
GetClientRect( hwnd, &rect );
hListView = CreateWindow( WC_LISTVIEW, NULL,
WS_VISIBLE | WS_CHILD | LVS_REPORT |
LVS_SHOWSELALWAYS | WS_VSCROLL | WS_HSCROLL |
WS_BORDER /*| LVS_NOCOLUMNHEADER */,
rect.left + 20, rect.top + 50,
rect.right - rect.left - ( 2 * 20 ),
rect.bottom - rect.top - 50 - 20,
hwnd, NULL, hInst, NULL );
ListView_SetExtendedListViewStyle( hListView, LVS_EX_FULLROWSELECT );
LVCOLUMN lv;
lv.mask = LVCF_WIDTH | LVCF_FMT | LVCF_TEXT;
lv.fmt = LVCFMT_LEFT ;
GetClientRect( hwnd, &rect );
lv.cx = rect.right - rect.left;
lv.pszText = _T("Messages");
lv.cchTextMax = 9;
ListView_InsertColumn( hListView, 0, &lv);
SetTimer( hwnd, 1, 500 /*milliseconds*/, NULL );
SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
return lResult;
case WM_TIMER:
UpdateLog();
return lResult;
case WM_COMMAND:
switch( LOWORD(wp) )
{
case IDOK:
EndDialog( hwnd, LOWORD( wp ) );
return TRUE;
case IDCLEAR:
ListView_DeleteAllItems( hListView );
return TRUE;
case IDSAVEAS:
memset( &(ofn), 0, sizeof(ofn) );
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = _T("");
ofn.nMaxFile = NMAXFILE;
ofn.lpstrFilter = _T("Text (*.txt)\0*.txt\0");
ofn.lpstrTitle = _T("Save File As");
ofn.Flags = OFN_HIDEREADONLY;
ofn.lpstrDefExt = _T("txt");
if( GetSaveFileName( (LPOPENFILENAME)&ofn ) )
{
fichier = CreateFile( ofn.lpstrFile, GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL );
if( fichier != INVALID_HANDLE_VALUE )
{
int n;
//SetFilePointer( fichier, 0, NULL, FILE_END );
for( n = 0; n < ListView_GetItemCount( hListView ); n++ )
{
ListView_GetItemText( hListView, n, 0, psz_text,
TEXTMAXBUF );
string text_out = (string)_TOMB(psz_text) + "\n";
WriteFile( fichier, text_out.c_str(), text_out.size(),
(LPDWORD)&i_dummy, NULL );
}
FlushFileBuffers( fichier );
CloseHandle(fichier);
}
}
SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
return TRUE;
default:
*pbProcessed = bWasProcessed;
lResult = FALSE;
return lResult;
}
default:
// the message was not processed
// indicate if the base class handled it
*pbProcessed = bWasProcessed;
lResult = FALSE;
return lResult;
}
return lResult;
}
void Messages::UpdateLog()
{
msg_subscription_t *p_sub = p_intf->p_sys->p_sub;
string debug;
int i_start, i_stop;
vlc_mutex_lock( p_sub->p_lock );
i_stop = *p_sub->pi_stop;
vlc_mutex_unlock( p_sub->p_lock );
if( p_sub->i_start != i_stop )
{
for( i_start = p_sub->i_start; i_start != i_stop;
i_start = (i_start+1) % VLC_MSG_QSIZE )
{
if( !b_verbose && VLC_MSG_ERR != p_sub->p_msg[i_start].i_type )
continue;
/* Append all messages to log window */
debug = p_sub->p_msg[i_start].psz_module;
switch( p_sub->p_msg[i_start].i_type )
{
case VLC_MSG_INFO:
debug += ": ";
break;
case VLC_MSG_ERR:
debug += " error: ";
break;
case VLC_MSG_WARN:
debug += " warning: ";
break;
case VLC_MSG_DBG:
default:
debug += " debug: ";
break;
}
/* Add message */
debug += p_sub->p_msg[i_start].psz_msg;
LVITEM lv;
lv.mask = LVIF_TEXT;
lv.pszText = TEXT("");
lv.cchTextMax = 1;
lv.iSubItem = 0;
lv.iItem = ListView_GetItemCount( hListView );
ListView_InsertItem( hListView, &lv );
ListView_SetItemText( hListView, lv.iItem, 0,
_FROMMB(debug.c_str()) );
}
vlc_mutex_lock( p_sub->p_lock );
p_sub->i_start = i_start;
vlc_mutex_unlock( p_sub->p_lock );
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* preferences_widgets.h : WinCE gui plugin for VLC
*****************************************************************************
* Copyright (C) 2000-2003 VideoLAN
* $Id$
*
* Authors: Marodon Cedric <cedric_marodon@yahoo.fr>
* Gildas Bazin <gbazin@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.
*****************************************************************************/
class ConfigControl
{
public:
ConfigControl( vlc_object_t *, module_config_t *, HWND, HINSTANCE );
~ConfigControl();
/*wxSizer *Sizer();*/
virtual int GetIntValue() {return 0;}
virtual float GetFloatValue() {return 0;}
virtual char *GetPszValue() {return GetName();} // faux retourne nom associ parent
// mettre dans constructeur et dans private le nom du panel associ HWND
char *GetName();
int GetType();
vlc_bool_t IsAdvanced();
void SetUpdateCallback( void (*)( void * ), void * );
protected:
/*wxBoxSizer *sizer;*/
HWND label;
vlc_object_t *p_this;
void (*pf_update_callback)( void * );
void *p_update_data;
void OnUpdate( UINT );
private:
HWND parent;
char *name;
int i_type;
vlc_bool_t b_advanced;
};
ConfigControl *CreateConfigControl( vlc_object_t *,
module_config_t *, HWND, HINSTANCE,
int * );
class KeyConfigControl: public ConfigControl
{
public:
KeyConfigControl( vlc_object_t *, module_config_t *, HWND,
HINSTANCE, int * );
~KeyConfigControl();
virtual int GetIntValue();
private:
HWND alt;
HWND alt_label;
HWND ctrl;
HWND ctrl_label;
HWND shift;
HWND shift_label;
HWND combo;
// Array of key descriptions, for the ComboBox
static string *m_keysList;
};
class ModuleConfigControl: public ConfigControl
{
public:
ModuleConfigControl( vlc_object_t *, module_config_t *, HWND,
HINSTANCE, int * );
~ModuleConfigControl();
virtual char *GetPszValue();
private:
HWND combo;
};
class StringConfigControl: public ConfigControl
{
public:
StringConfigControl( vlc_object_t *, module_config_t *, HWND,
HINSTANCE, int * );
~StringConfigControl();
virtual char *GetPszValue();
private:
HWND textctrl;
};
class StringListConfigControl: public ConfigControl
{
public:
StringListConfigControl( vlc_object_t *, module_config_t *, HWND,
HINSTANCE, int * );
~StringListConfigControl();
virtual char *GetPszValue();
private:
};
class FileConfigControl: public ConfigControl
{
public:
FileConfigControl( vlc_object_t *, module_config_t *, HWND,
HINSTANCE, int * );
~FileConfigControl();
void OnBrowse( UINT );
virtual char *GetPszValue();
private:
};
class IntegerConfigControl: public ConfigControl
{
public:
IntegerConfigControl( vlc_object_t *, module_config_t *, HWND,
HINSTANCE, int * );
~IntegerConfigControl();
virtual int GetIntValue();
private:
};
class IntegerListConfigControl: public ConfigControl
{
public:
IntegerListConfigControl( vlc_object_t *, module_config_t *, HWND,
HINSTANCE, int * );
~IntegerListConfigControl();
virtual int GetIntValue();
private:
};
class RangedIntConfigControl: public ConfigControl
{
public:
RangedIntConfigControl( vlc_object_t *, module_config_t *, HWND,
HINSTANCE, int * );
~RangedIntConfigControl();
virtual int GetIntValue();
private:
};
class FloatConfigControl: public ConfigControl
{
public:
FloatConfigControl( vlc_object_t *, module_config_t *, HWND,
HINSTANCE, int * );
~FloatConfigControl();
virtual float GetFloatValue();
private:
HWND textctrl;
};
class BoolConfigControl: public ConfigControl
{
public:
BoolConfigControl( vlc_object_t *, module_config_t *, HWND,
HINSTANCE, int * );
~BoolConfigControl();
virtual int GetIntValue();
private:
HWND checkbox;
HWND checkbox_label;
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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