/*****************************************************************************
* preferences.cpp : WinCE gui plugin for VLC
*****************************************************************************
- * Copyright (C) 2000-2004 VideoLAN
+ * Copyright (C) 2000-2004 the VideoLAN team
* $Id$
*
* Authors: Marodon Cedric <cedric_marodon@yahoo.fr>
*
* 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.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
#include <string.h> /* strerror() */
#include <stdio.h>
#include <vlc/vlc.h>
-#include <vlc/intf.h>
+#include <vlc_interface.h>
#include "wince.h"
PrefsDialog *p_prefs_dialog;
vlc_bool_t b_advanced;
- HTREEITEM root_item;
HTREEITEM general_item;
HTREEITEM plugins_item;
};
/*****************************************************************************
* Constructor.
*****************************************************************************/
-PrefsDialog::PrefsDialog( intf_thread_t *_p_intf, HINSTANCE _hInst )
+PrefsDialog::PrefsDialog( intf_thread_t *p_intf, CBaseWindow *p_parent,
+ HINSTANCE h_inst )
+ : CBaseWindow( p_intf, p_parent, h_inst )
{
/* Initializations */
- p_intf = _p_intf;
- hInst = _hInst;
prefs_tree = NULL;
}
Processes messages sent to the main window.
***********************************************************************/
-LRESULT PrefsDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
- PBOOL pbProcessed )
+LRESULT PrefsDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
{
SHINITDLGINFO shidi;
SHMENUBARINFO mbi;
RECT rcClient;
- LRESULT lResult = CBaseWindow::WndProc( hwnd, msg, wp, lp, pbProcessed );
- BOOL bWasProcessed = *pbProcessed;
- *pbProcessed = TRUE;
-
switch( msg )
{
case WM_INITDIALOG:
memset( &mbi, 0, sizeof (SHMENUBARINFO) );
mbi.cbSize = sizeof (SHMENUBARINFO);
mbi.hwndParent = hwnd;
- mbi.nToolBarId = IDR_DUMMYMENU;
+ mbi.dwFlags = SHCMBF_EMPTYBAR;
mbi.hInstRes = hInst;
- mbi.nBmpId = 0;
- mbi.cBmpImages = 0;
if( !SHCreateMenuBar(&mbi) )
{
prefs_tree = new PrefsTreeCtrl( p_intf, this, hwnd, hInst );
UpdateWindow( hwnd );
- return lResult;
+ break;
+
+ case WM_CLOSE:
+ EndDialog( hwnd, LOWORD( wp ) );
+ break;
+
+ case WM_SETFOCUS:
+ SHFullScreen( hwnd, SHFS_SHOWSIPBUTTON );
+ break;
case WM_COMMAND:
if( LOWORD(wp) == IDOK )
{
OnOk();
EndDialog( hwnd, LOWORD( wp ) );
- return TRUE;
}
- *pbProcessed = bWasProcessed;
- lResult = FALSE;
- return lResult;
+ break;
case WM_NOTIFY:
- if ( ( ((LPNMHDR)lp)->hwndFrom == prefs_tree->hwndTV ) &&
- ( ((LPNMHDR)lp)->code == TVN_SELCHANGED ) )
+ if( lp && prefs_tree &&
+ ((LPNMHDR)lp)->hwndFrom == prefs_tree->hwndTV &&
+ ((LPNMHDR)lp)->code == TVN_SELCHANGED )
{
prefs_tree->OnSelectTreeItem( (NM_TREEVIEW FAR *)(LPNMHDR)lp,
hwnd, hInst );
- return TRUE;
}
-
- *pbProcessed = bWasProcessed;
- lResult = FALSE;
- return lResult;
+ break;
case WM_VSCROLL:
{
TVITEM tvi = {0};
tvi.mask = TVIF_PARAM;
tvi.hItem = TreeView_GetSelection( prefs_tree->hwndTV );
- TreeView_GetItem( prefs_tree->hwndTV, &tvi );
- ConfigTreeData *config_data = prefs_tree->FindModuleConfig( (ConfigTreeData *)tvi.lParam );
- if ( hwnd == config_data->panel->config_window )
+ if( !tvi.hItem ) break;
+
+ if( !TreeView_GetItem( prefs_tree->hwndTV, &tvi ) ) break;
+
+ ConfigTreeData *config_data =
+ prefs_tree->FindModuleConfig( (ConfigTreeData *)tvi.lParam );
+ if( config_data && hwnd == config_data->panel->config_window )
{
int dy;
RECT rc;
case SB_BOTTOM : newvalue = 0; break;
case SB_TOP : newvalue = config_data->panel->maxvalue; break;
case SB_LINEDOWN : newvalue += 10; break;
- case SB_PAGEDOWN : newvalue += rc.bottom - rc.top - 25; break; // faux ! une page c'est la longueur réelle de notebook
+ case SB_PAGEDOWN : newvalue += rc.bottom - rc.top - 25; break; // wrong! one page is notebook actual length
case SB_LINEUP : newvalue -= 10; break;
case SB_PAGEUP : newvalue -= rc.bottom - rc.top - 25; break;
case SB_THUMBPOSITION:
config_data->panel->oldvalue = newvalue;
}
+ break;
}
- *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;
+ break;
}
- return lResult;
+ return FALSE;
}
/*****************************************************************************
5, 10 + 2*(15 + 10) + 105 + 5, rcClient.right - 5 - 5, 6*15,
hwnd, NULL, hInst, NULL );
- tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
- tvi.pszText = _T("root");
- tvi.cchTextMax = lstrlen(_T("root"));
- tvi.lParam = (LPARAM) 1; // root level
- tvins.item = tvi;
- tvins.hInsertAfter = TVI_FIRST;
- tvins.hParent = TVI_ROOT;
-
- // Add the item to the tree-view control.
- hPrev = (HTREEITEM) TreeView_InsertItem( hwndTV, &tvins );
- root_item = hPrev;
+ tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
/* List the plugins */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
config_data->psz_section = strdup( GENERAL_TITLE );
tvi.pszText = _T("General settings");
tvi.cchTextMax = lstrlen(_T("General settings"));
- tvi.lParam = (long) config_data;
+ tvi.lParam = (long)config_data;
tvins.item = tvi;
- tvins.hInsertAfter = hPrev;
- tvins.hParent = root_item; //level 2
+ tvins.hInsertAfter = TVI_FIRST;
+ tvins.hParent = TVI_ROOT;
// Add the item to the tree-view control.
hPrev = (HTREEITEM) TreeView_InsertItem( hwndTV, &tvins);
config_data->psz_section = strdup("nothing");//strdup( PLUGIN_TITLE );
tvi.pszText = _T("Modules");
tvi.cchTextMax = lstrlen(_T("Modules"));
- tvi.lParam = (long) config_data;
+ tvi.lParam = (long)config_data;
tvins.item = tvi;
- tvins.hInsertAfter = hPrev;
- tvins.hParent = root_item;// level 2
+ tvins.hInsertAfter = TVI_LAST;
+ tvins.hParent = TVI_ROOT;
// Add the item to the tree-view control.
hPrev = (HTREEITEM) TreeView_InsertItem( hwndTV, &tvins);
config_data->i_object_id = CAPABILITY_ID;
tvi.pszText = _FROMMB(p_module->psz_capability);
tvi.cchTextMax = _tcslen(tvi.pszText);
- tvi.lParam = (long) config_data;
+ tvi.lParam = (long)config_data;
tvins.item = tvi;
tvins.hInsertAfter = plugins_item;
tvins.hParent = plugins_item;// level 3
config_data->psz_help = NULL;
tvi.pszText = _FROMMB(p_module->psz_object_name);
tvi.cchTextMax = _tcslen(tvi.pszText);
- tvi.lParam = (long) config_data;
+ tvi.lParam = (long)config_data;
tvins.item = tvi;
tvins.hInsertAfter = capability_item;
tvins.hParent = capability_item;// level 4
/* Clean-up everything */
vlc_list_release( p_list );
- TreeView_Expand( hwndTV, root_item, TVE_EXPANDPARTIAL |TVE_EXPAND );
TreeView_Expand( hwndTV, general_item, TVE_EXPANDPARTIAL |TVE_EXPAND );
}
/* Find the category if it has been specified */
if( psz_section && p_item->i_type == CONFIG_HINT_CATEGORY )
{
- while( !p_item->i_type == CONFIG_HINT_CATEGORY ||
+ while( !(p_item->i_type == CONFIG_HINT_CATEGORY) ||
strcmp( psz_section, p_item->psz_text ) )
{
- if( p_item->i_type == CONFIG_HINT_END )
- break;
+ if( p_item->i_type == CONFIG_HINT_END ) break;
p_item++;
}
}
case CONFIG_ITEM_KEY:
/* So you don't need to restart to have the changes take effect */
val.i_int = control->GetIntValue();
- var_Set( p_intf->p_vlc, control->GetName(), val );
+ var_Set( p_intf->p_libvlc, control->GetName(), val );
case CONFIG_ITEM_INTEGER:
case CONFIG_ITEM_BOOL:
config_PutInt( p_intf, control->GetName(),