/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <stdio.h>
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
#include <vlc_interface.h>
#include "wince.h"
WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_SIZEBOX,
0, 0, /*CW_USEDEFAULT*/300, /*CW_USEDEFAULT*/300,
p_parent->GetHandle(), NULL, h_inst, (void *)this );
+ // Suscribe to messages bank
+ cb_data = new msg_cb_data_t;
+ cb_data->self = this;
+ sub = msg_Subscribe( p_intf->p_libvlc, sinkMessage, cb_data );
+}
+
+Messages::~Messages()
+{
+ msg_Unsubscribe(sub);
+ delete cb_data;
}
/***********************************************************************
-FUNCTION:
+FUNCTION:
WndProc
-PURPOSE:
+PURPOSE:
Processes messages sent to the main window.
***********************************************************************/
LRESULT Messages::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
WS_VISIBLE | WS_CHILD | LVS_REPORT |
LVS_SHOWSELALWAYS | WS_VSCROLL | WS_HSCROLL |
WS_BORDER | LVS_NOCOLUMNHEADER, 0, 0, 0, 0,
- hwnd, NULL, hInst, NULL );
+ hwnd, NULL, hInst, NULL );
ListView_SetExtendedListViewStyle( hListView, LVS_EX_FULLROWSELECT );
LVCOLUMN lv;
break;
case WM_SETFOCUS:
- SHSipPreference( hwnd, SIP_DOWN );
+ SHSipPreference( hwnd, SIP_DOWN );
SHFullScreen( hwnd, SHFS_HIDESIPBUTTON );
break;
- case WM_TIMER:
- UpdateLog();
- break;
-
case WM_CLOSE:
Show( FALSE );
return TRUE;
ListView_DeleteAllItems( hListView );
break;
- case IDSAVEAS:
+ case IDSAVEAS:
memset( &(ofn), 0, sizeof(ofn) );
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = _T("");
- ofn.nMaxFile = NMAXFILE;
+ ofn.nMaxFile = NMAXFILE;
ofn.lpstrFilter = _T("Text (*.txt)\0*.txt\0");
ofn.lpstrTitle = _T("Save File As");
- ofn.Flags = OFN_HIDEREADONLY;
+ ofn.Flags = OFN_HIDEREADONLY;
ofn.lpstrDefExt = _T("txt");
if( GetSaveFileName( (LPOPENFILENAME)&ofn ) )
return DefWindowProc( hwnd, msg, wp, lp );
}
-void Messages::UpdateLog()
+void Messages::sinkMessage (msg_cb_data_t *data, msg_item_t *item,
+ unsigned overruns)
{
- msg_subscription_t *p_sub = p_intf->p_sys->p_sub;
- string debug;
- int i_start, i_stop;
+ Messages *self = data->self;
- vlc_mutex_lock( p_sub->p_lock );
- i_stop = *p_sub->pi_stop;
- vlc_mutex_unlock( p_sub->p_lock );
+ self->sinkMessage (item, overruns);
+}
- 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 )
- {
- switch( p_sub->p_msg[i_start].i_type )
- {
- case VLC_MSG_ERR:
- case VLC_MSG_INFO:
- if( p_intf->p_libvlc_global->i_verbose < 0 ) continue;
- break;
- case VLC_MSG_WARN:
- if( p_intf->p_libvlc_global->i_verbose < 1 ) continue;
- break;
- case VLC_MSG_DBG:
- if( p_intf->p_libvlc_global->i_verbose < 2 ) continue;
- break;
- }
+void Messages::sinkMessage (msg_item_t *item, unsigned overruns)
+{
+ vlc_value_t val;
+ var_Get( p_intf->p_libvlc, "verbose", &val );
- /* 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;
- 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,
- (TCHAR *)_FROMMB(debug.c_str()) );
- }
+ /* Append all messages to log window */
+ string debug = item->psz_module;
- vlc_mutex_lock( p_sub->p_lock );
- p_sub->i_start = i_start;
- vlc_mutex_unlock( p_sub->p_lock );
+ switch( item->i_type )
+ {
+ case VLC_MSG_INFO: debug += ": "; break;
+ case VLC_MSG_ERR: debug += " error: "; break;
+ case VLC_MSG_WARN: debug += " warning: "; break;
+ default: debug += " debug: "; break;
}
+
+ /* Add message */
+ debug += item->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,
+ (TCHAR *)_FROMMB(debug.c_str()) );
}
+