X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fwince%2Ffileinfo.cpp;h=f6e1a49a239eb450a3db465db7115d43129fd225;hb=eede8ebe0230269ab06b1c24f4a5a48b842acbc2;hp=721bda93b55e344d040d496dccec586aea5ea520;hpb=9abc1276b17955d403fea3ca171da08d2d0dad60;p=vlc diff --git a/modules/gui/wince/fileinfo.cpp b/modules/gui/wince/fileinfo.cpp index 721bda93b5..f6e1a49a23 100644 --- a/modules/gui/wince/fileinfo.cpp +++ b/modules/gui/wince/fileinfo.cpp @@ -1,7 +1,7 @@ /***************************************************************************** * fileinfo.cpp : WinCE gui plugin for vlc ***************************************************************************** - * Copyright (C) 2000-2004 VideoLAN + * Copyright (C) 2000-2004 the VideoLAN team * $Id$ * * Authors: Marodon Cedric @@ -19,17 +19,18 @@ * * 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. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include /* strerror() */ -#include -#include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include #include "wince.h" @@ -42,20 +43,20 @@ /***************************************************************************** * Constructor. *****************************************************************************/ -FileInfo::FileInfo( intf_thread_t *_p_intf, HINSTANCE _hInst ) +FileInfo::FileInfo( 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; hwnd_fileinfo = hwndTV = NULL; } /*********************************************************************** -FUNCTION: +FUNCTION: CreateTreeView -PURPOSE: +PURPOSE: Registers the TreeView control class and creates a TreeView. ***********************************************************************/ @@ -75,7 +76,7 @@ BOOL FileInfo::CreateTreeView(HWND hwnd) GetClientRect( hwnd, &rect ); // Assign the window styles for the tree view. - dwStyle = WS_VISIBLE | WS_CHILD | TVS_HASLINES | TVS_LINESATROOT | + dwStyle = WS_VISIBLE | WS_CHILD | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS; // Create the tree-view control. @@ -87,27 +88,27 @@ BOOL FileInfo::CreateTreeView(HWND hwnd) // Be sure that the tree view actually was created. if( !hwndTV ) return FALSE; - UpdateFileInfo( hwndTV ); + UpdateFileInfo(); return TRUE; } /*********************************************************************** -FUNCTION: +FUNCTION: UpdateFileInfo -PURPOSE: +PURPOSE: Update the TreeView with file information. ***********************************************************************/ -void FileInfo::UpdateFileInfo(HWND hwnd) +void FileInfo::UpdateFileInfo() { - TVITEM tvi = {0}; - TVINSERTSTRUCT tvins = {0}; - HTREEITEM hPrev = (HTREEITEM)TVI_FIRST; - HTREEITEM hPrevRootItem = NULL; - HTREEITEM hPrevLev2Item = NULL; + 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 ); @@ -116,7 +117,7 @@ void FileInfo::UpdateFileInfo(HWND hwnd) if( !p_input ) return; - tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; + 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 ); @@ -124,33 +125,33 @@ void FileInfo::UpdateFileInfo(HWND hwnd) // Save the heading level in the item's application-defined data area tvi.lParam = (LPARAM)1; - tvins.item = tvi; + tvins.item = tvi; //tvins.hInsertAfter = TVI_LAST; - tvins.hInsertAfter = hPrev; - tvins.hParent = TVI_ROOT; + tvins.hInsertAfter = hPrev; + tvins.hParent = TVI_ROOT; - // Add the item to the tree-view control. - hPrev = (HTREEITEM)TreeView_InsertItem( hwnd, &tvins ); + // Add the item to the tree-view control. + hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins ); - hPrevRootItem = hPrev; + 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. + // 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.item = tvi; + tvins.hInsertAfter = hPrev; tvins.hParent = hPrevRootItem; - // Add the item to the tree-view control. - hPrev = (HTREEITEM)TreeView_InsertItem( hwnd, &tvins ); + // Add the item to the tree-view control. + hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins ); hPrevLev2Item = hPrev; @@ -158,51 +159,46 @@ void FileInfo::UpdateFileInfo(HWND hwnd) { info_t *p_info = p_cat->pp_infos[j]; - // Set the text of the item. + // Set the text of the item. string szAnsi = (string)p_info->psz_name; szAnsi += ": "; szAnsi += p_info->psz_value; tvi.pszText = (TCHAR *)_FROMMB( szAnsi.c_str() ); tvi.cchTextMax = _tcslen( tvi.pszText ); tvi.lParam = (LPARAM)3; // level 3 - tvins.item = tvi; - tvins.hInsertAfter = hPrev; + tvins.item = tvi; + tvins.hInsertAfter = hPrev; tvins.hParent = hPrevLev2Item; - - // Add the item to the tree-view control. - hPrev = (HTREEITEM)TreeView_InsertItem( hwnd, &tvins ); + + // Add the item to the tree-view control. + hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins ); } - TreeView_Expand( hwnd, hPrevLev2Item, TVE_EXPANDPARTIAL |TVE_EXPAND ); + TreeView_Expand( hwndTV, hPrevLev2Item, TVE_EXPANDPARTIAL|TVE_EXPAND ); } vlc_mutex_unlock( &p_input->input.p_item->lock ); - TreeView_Expand( hwnd, hPrevRootItem, TVE_EXPANDPARTIAL |TVE_EXPAND ); + TreeView_Expand( hwndTV, hPrevRootItem, TVE_EXPANDPARTIAL|TVE_EXPAND ); return; } /*********************************************************************** -FUNCTION: +FUNCTION: WndProc -PURPOSE: +PURPOSE: Processes messages sent to the main window. - + ***********************************************************************/ -LRESULT FileInfo::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, - PBOOL pbProcessed ) +LRESULT FileInfo::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) { SHINITDLGINFO shidi; - LRESULT lResult = CBaseWindow::WndProc( hwnd, msg, wp, lp, pbProcessed ); - BOOL bWasProcessed = *pbProcessed; - *pbProcessed = TRUE; - switch( msg ) { - case WM_INITDIALOG: + case WM_INITDIALOG: shidi.dwMask = SHIDIM_FLAGS; shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_FULLSCREENNOMENUBAR;//SHIDIF_SIZEDLGFULLSCREEN; @@ -211,25 +207,27 @@ LRESULT FileInfo::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, CreateTreeView( hwnd ); UpdateWindow( hwnd ); SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); - return lResult; + break; + + case WM_CLOSE: + EndDialog( hwnd, LOWORD( wp ) ); + break; + + case WM_SETFOCUS: + SHSipPreference( hwnd, SIP_DOWN ); + SHFullScreen( hwnd, SHFS_HIDESIPBUTTON ); + break; case WM_COMMAND: if ( LOWORD(wp) == IDOK ) { EndDialog( hwnd, LOWORD( wp ) ); - return TRUE; - } - *pbProcessed = bWasProcessed; - lResult = FALSE; - return lResult; + } + break; default: - // the message was not processed - // indicate if the base class handled it - *pbProcessed = bWasProcessed; - lResult = FALSE; - return lResult; + break; } - return lResult; + return FALSE; }