Changeset 39c6836969d8d5a6816970ce4e0cf294565baf4a

Show
Ignore:
Timestamp:
31/03/05 01:47:41 (4 years ago)
Author:
Gildas Bazin <gbazin@videolan.org>
git-committer:
Gildas Bazin <gbazin@videolan.org> 1112226461 +0000
git-parent:

[23584f3100cfb8a22e40f72c6ac110be4b154c93]

git-author:
Gildas Bazin <gbazin@videolan.org> 1112226461 +0000
Message:

* modules/gui/wince: added dialogs provider + another massive cleanup + updates.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/gui/wince/Modules.am

    r2774b1f r39c6836  
    77    wince.h \ 
    88    interface.cpp \ 
     9    dialogs.cpp \ 
    910    menus.cpp \ 
    1011    open.cpp \ 
  • modules/gui/wince/fileinfo.cpp

    r909088e r39c6836  
    4343 * Constructor. 
    4444 *****************************************************************************/ 
    45 FileInfo::FileInfo( intf_thread_t *_p_intf, HINSTANCE _hInst ) 
     45FileInfo::FileInfo( intf_thread_t *p_intf, CBaseWindow *p_parent, 
     46                    HINSTANCE h_inst ) 
     47  :  CBaseWindow( p_intf, p_parent, h_inst ) 
    4648{ 
    4749    /* Initializations */ 
    48     p_intf = _p_intf; 
    49     hInst = _hInst; 
    5050    hwnd_fileinfo = hwndTV = NULL; 
    5151} 
     
    8888    if( !hwndTV ) return FALSE; 
    8989 
    90     UpdateFileInfo( hwndTV ); 
     90    UpdateFileInfo(); 
    9191 
    9292    return TRUE; 
     
    102102 
    103103***********************************************************************/ 
    104 void FileInfo::UpdateFileInfo(HWND hwnd
     104void FileInfo::UpdateFileInfo(
    105105{ 
    106106    TVITEM tvi = {0};  
     
    131131 
    132132    // Add the item to the tree-view control.  
    133     hPrev = (HTREEITEM)TreeView_InsertItem( hwnd, &tvins ); 
     133    hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins ); 
    134134 
    135135    hPrevRootItem = hPrev;  
     
    151151 
    152152        // Add the item to the tree-view control.  
    153         hPrev = (HTREEITEM)TreeView_InsertItem( hwnd, &tvins ); 
     153        hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins ); 
    154154 
    155155        hPrevLev2Item = hPrev; 
     
    171171     
    172172            // Add the item to the tree-view control.  
    173             hPrev = (HTREEITEM)TreeView_InsertItem( hwnd, &tvins ); 
     173            hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins ); 
    174174        } 
    175175 
    176         TreeView_Expand( hwnd, hPrevLev2Item, TVE_EXPANDPARTIAL |TVE_EXPAND ); 
     176        TreeView_Expand( hwndTV, hPrevLev2Item, TVE_EXPANDPARTIAL|TVE_EXPAND ); 
    177177    } 
    178178    vlc_mutex_unlock( &p_input->input.p_item->lock ); 
    179179 
    180     TreeView_Expand( hwnd, hPrevRootItem, TVE_EXPANDPARTIAL |TVE_EXPAND ); 
     180    TreeView_Expand( hwndTV, hPrevRootItem, TVE_EXPANDPARTIAL|TVE_EXPAND ); 
    181181 
    182182    return; 
     
    213213        break; 
    214214 
     215    case WM_SETFOCUS: 
     216        SHSipPreference( hwnd, SIP_DOWN );  
     217        SHFullScreen( hwnd, SHFS_HIDESIPBUTTON ); 
     218        break; 
     219 
    215220    case WM_COMMAND: 
    216221        if ( LOWORD(wp) == IDOK ) 
  • modules/gui/wince/interface.cpp

    re80505a r39c6836  
    3434#include "wince.h" 
    3535 
    36 #include <winuser.h> 
    37 #include <windows.h> 
    3836#include <windowsx.h> 
    3937#include <commctrl.h> 
    4038#include <commdlg.h> 
    41 #include <shlobj.h> 
    4239 
    4340#define NUMIMAGES     9   // Number of buttons in the toolbar            
     
    108105Interface::Interface() 
    109106  : hwndMain(0), hwndCB(0), hwndTB(0), hwndSlider(0), hwndLabel(0), 
    110     hwndVol(0), hwndSB(0), 
    111     fileinfo(0), messages(0), preferences(0), playlist(0), 
    112     timer(0), open(0), video(0), b_volume_hold(0) 
     107    hwndVol(0), hwndSB(0), timer(0), video(0), b_volume_hold(0) 
    113108{ 
    114109} 
     
    127122 
    128123    hInst = hInstance; // Store instance handle in our global variable 
    129  
    130     // Register window class 
    131     WNDCLASS wc; 
    132     wc.style = CS_HREDRAW | CS_VREDRAW ; 
    133     wc.lpfnWndProc = (WNDPROC)BaseWndProc; 
    134     wc.cbClsExtra = 0; 
    135     wc.cbWndExtra = 0; 
    136     wc.hIcon = NULL; 
    137     wc.hInstance = hInstance; 
    138     wc.hCursor = NULL; 
    139     wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); 
    140     wc.lpszMenuName = NULL; 
    141     wc.lpszClassName = _T("VLC WinCE"); 
    142     if( !RegisterClass( &wc ) ) return FALSE; 
    143124 
    144125    int i_style = WS_VISIBLE; 
     
    463444 
    464445/*********************************************************************** 
    465 FUNCTION: 
    466   CreateDialogBox 
    467  
    468 PURPOSE: 
    469   Creates a Dialog Box. 
    470 ***********************************************************************/ 
    471 int CBaseWindow::CreateDialogBox( HWND hwnd, CBaseWindow *p_obj ) 
    472 { 
    473     uint8_t p_buffer[sizeof(DLGTEMPLATE) + sizeof(WORD) * 4]; 
    474     DLGTEMPLATE *p_dlg_template = (DLGTEMPLATE *)p_buffer; 
    475     memset( p_dlg_template, 0, sizeof(DLGTEMPLATE) + sizeof(WORD) * 4 ); 
    476  
    477     // these values are arbitrary, they won't be used normally anyhow 
    478     p_dlg_template->x  = 0; p_dlg_template->y  = 0; 
    479     p_dlg_template->cx = 300; p_dlg_template->cy = 300; 
    480     p_dlg_template->style = 
    481         DS_MODALFRAME|WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_SIZEBOX; 
    482  
    483     return DialogBoxIndirectParam( GetModuleHandle(0), p_dlg_template, hwnd, 
    484                                    (DLGPROC)p_obj->BaseWndProc, (LPARAM)p_obj ); 
    485 } 
    486  
    487 /*********************************************************************** 
    488 FUNCTION:  
    489   BaseWndProc 
    490  
    491 PURPOSE:  
    492   Processes messages sent to the main window. 
    493 ***********************************************************************/ 
    494 LRESULT CALLBACK CBaseWindow::BaseWndProc( HWND hwnd, UINT msg, WPARAM wParam, 
    495                                            LPARAM lParam ) 
    496 { 
    497     CBaseWindow *p_obj; 
    498  
    499     // check to see if a copy of the 'this' pointer needs to be saved 
    500     if( msg == WM_CREATE ) 
    501     { 
    502         p_obj = (CBaseWindow *)(((LPCREATESTRUCT)lParam)->lpCreateParams); 
    503         SetWindowLong( hwnd, GWL_USERDATA, 
    504                        (LONG)((LPCREATESTRUCT)lParam)->lpCreateParams ); 
    505  
    506         p_obj->hWnd = hwnd; 
    507     } 
    508  
    509     if( msg == WM_INITDIALOG ) 
    510     { 
    511         p_obj = (CBaseWindow *)lParam; 
    512         SetWindowLong( hwnd, GWL_USERDATA, lParam ); 
    513         p_obj->hWnd = hwnd; 
    514     } 
    515  
    516     // Retrieve the pointer 
    517     p_obj = (CBaseWindow *)GetWindowLong( hwnd, GWL_USERDATA ); 
    518  
    519     if( !p_obj ) return DefWindowProc( hwnd, msg, wParam, lParam ); 
    520  
    521     // Filter message through child classes 
    522     return p_obj->WndProc( hwnd, msg, wParam, lParam ); 
    523 } 
    524  
    525 /*********************************************************************** 
    526446FUNCTION:  
    527447  WndProc 
     
    549469 
    550470        timer = new Timer( p_intf, hwnd, this ); 
    551  
    552         // Hide the SIP button (WINCE only) 
    553         SetForegroundWindow( hwnd ); 
    554         SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); 
    555471        break; 
    556472 
     
    559475        { 
    560476        case ID_FILE_QUICKOPEN:  
    561             OnOpenFileSimple(); 
     477        case ID_FILE_OPENFILE:  
     478        case ID_FILE_OPENDIR: 
     479        case ID_FILE_OPENNET: 
     480        case ID_VIEW_STREAMINFO: 
     481        case ID_VIEW_MESSAGES: 
     482        case ID_VIEW_PLAYLIST: 
     483        case ID_PREFERENCES: 
     484            OnShowDialog( GET_WM_COMMAND_ID(wp,lp) ); 
    562485            break; 
    563486 
    564         case ID_FILE_OPENFILE:  
    565             open = new OpenDialog( p_intf, hInst, FILE_ACCESS, 
    566                                    ID_FILE_OPENFILE, OPEN_NORMAL ); 
    567             CreateDialogBox( hwnd, open ); 
    568             delete open; 
    569             break; 
    570  
    571         case ID_FILE_OPENDIR: 
    572             OnOpenDirectory(); 
    573             break; 
    574  
    575         case ID_FILE_OPENNET: 
    576             open = new OpenDialog( p_intf, hInst, NET_ACCESS, ID_FILE_OPENNET, 
    577                                    OPEN_NORMAL ); 
    578             CreateDialogBox( hwnd, open ); 
    579             delete open; 
    580             break; 
    581  
    582         case PlayStream_Event:  
    583             OnPlayStream(); 
    584             break; 
    585  
    586         case StopStream_Event:  
    587             OnStopStream(); 
    588             break; 
    589  
    590         case PrevStream_Event:  
    591             OnPrevStream(); 
    592             break; 
    593  
    594         case NextStream_Event:  
    595             OnNextStream(); 
    596             break; 
    597  
    598         case SlowStream_Event:  
    599             OnSlowStream(); 
    600             break; 
    601  
    602         case FastStream_Event:  
    603             OnFastStream(); 
    604             break; 
     487        case PlayStream_Event: OnPlayStream(); break; 
     488        case StopStream_Event: OnStopStream(); break; 
     489        case PrevStream_Event: OnPrevStream(); break; 
     490        case NextStream_Event: OnNextStream(); break; 
     491        case SlowStream_Event: OnSlowStream(); break; 
     492        case FastStream_Event: OnFastStream(); break; 
    605493 
    606494        case ID_FILE_ABOUT:  
     
    621509            break; 
    622510 
    623         case ID_VIEW_STREAMINFO: 
    624             fileinfo = new FileInfo( p_intf, hInst ); 
    625             CreateDialogBox( hwnd, fileinfo ); 
    626             delete fileinfo; 
    627             break; 
    628  
    629         case ID_VIEW_MESSAGES: 
    630             messages = new Messages( p_intf, hInst ); 
    631             CreateDialogBox( hwnd, messages ); 
    632             delete messages; 
    633             break; 
    634  
    635         case ID_VIEW_PLAYLIST: 
    636             playlist = new Playlist( p_intf, hInst ); 
    637             CreateDialogBox( hwnd, playlist ); 
    638             delete playlist; 
    639             break; 
    640  
    641         case ID_PREFERENCES: 
    642             preferences = new PrefsDialog( p_intf, hInst ); 
    643             CreateDialogBox( hwnd, preferences ); 
    644             delete preferences; 
    645             break; 
    646                    
    647511        default: 
    648512            OnMenuEvent( p_intf, GET_WM_COMMAND_ID(wp,lp) ); 
     
    686550        /* Fall through */ 
    687551 
     552    case WM_KILLFOCUS: 
     553        SHFullScreen( hwnd, SHFS_SHOWSIPBUTTON ); 
    688554    case WM_ENTERMENULOOP: 
    689     case WM_KILLFOCUS: 
    690555        if( video && video->hWnd ) 
    691556            SendMessage( video->hWnd, WM_KILLFOCUS, 0, 0 ); 
    692557        break; 
    693558 
     559    case WM_SETFOCUS: 
     560        SHSipPreference( hwnd, SIP_DOWN );  
     561        SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); 
    694562    case WM_EXITMENULOOP: 
    695     case WM_SETFOCUS: 
    696563        if( video && video->hWnd ) 
    697564            SendMessage( video->hWnd, WM_SETFOCUS, 0, 0 ); 
     
    738605} 
    739606 
    740 void Interface::OnOpenFileSimple( void ) 
    741 
    742     OPENFILENAME ofn; 
    743     TCHAR DateiName[80+1] = _T("\0"); 
    744     static TCHAR szFilter[] = _T("All (*.*)\0*.*\0"); 
    745  
    746     playlist_t *p_playlist = (playlist_t *) 
    747         vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); 
    748     if( p_playlist == NULL ) return; 
    749  
    750     memset( &ofn, 0, sizeof(OPENFILENAME) ); 
    751     ofn.lStructSize = sizeof(OPENFILENAME); 
    752     ofn.hwndOwner = hwndMain; 
    753     ofn.hInstance = hInst; 
    754     ofn.lpstrFilter = szFilter; 
    755     ofn.lpstrCustomFilter = NULL; 
    756     ofn.nMaxCustFilter = 0; 
    757     ofn.nFilterIndex = 1;      
    758     ofn.lpstrFile = (LPTSTR)DateiName;  
    759     ofn.nMaxFile = 80; 
    760     ofn.lpstrFileTitle = NULL;  
    761     ofn.nMaxFileTitle = 40; 
    762     ofn.lpstrInitialDir = NULL; 
    763     ofn.lpstrTitle = _T("Quick Open File"); 
    764     ofn.Flags = 0;  
    765     ofn.nFileOffset = 0; 
    766     ofn.nFileExtension = 0; 
    767     ofn.lpstrDefExt = NULL; 
    768     ofn.lCustData = 0L; 
    769     ofn.lpfnHook = NULL; 
    770     ofn.lpTemplateName = NULL; 
    771  
    772     SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); 
    773  
    774     if( GetOpenFile( &ofn ) ) 
    775     { 
    776         char *psz_filename = _TOMB(ofn.lpstrFile); 
    777         playlist_Add( p_playlist, psz_filename, psz_filename, 
    778                       PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); 
    779     } 
    780  
    781     vlc_object_release( p_playlist ); 
    782 
    783  
    784 void Interface::OnOpenDirectory( void ) 
    785 
    786     TCHAR psz_result[MAX_PATH]; 
    787     LPMALLOC p_malloc = 0; 
    788     LPITEMIDLIST pidl; 
    789     BROWSEINFO bi; 
    790     playlist_t *p_playlist = 0; 
    791  
    792 #ifdef UNDER_CE 
    793 #   define SHGetMalloc MySHGetMalloc 
    794 #   define SHBrowseForFolder MySHBrowseForFolder 
    795 #   define SHGetPathFromIDList MySHGetPathFromIDList 
    796  
    797     HMODULE ceshell_dll = LoadLibrary( _T("ceshell") ); 
    798     if( !ceshell_dll ) return; 
    799  
    800     HRESULT WINAPI (*SHGetMalloc)(LPMALLOC *) = 
    801         (HRESULT WINAPI (*)(LPMALLOC *)) 
    802         GetProcAddress( ceshell_dll, _T("SHGetMalloc") ); 
    803     LPITEMIDLIST WINAPI (*SHBrowseForFolder)(LPBROWSEINFO) = 
    804         (LPITEMIDLIST WINAPI (*)(LPBROWSEINFO)) 
    805         GetProcAddress( ceshell_dll, _T("SHBrowseForFolder") ); 
    806     BOOL WINAPI (*SHGetPathFromIDList)(LPCITEMIDLIST, LPTSTR) = 
    807         (BOOL WINAPI (*)(LPCITEMIDLIST, LPTSTR)) 
    808         GetProcAddress( ceshell_dll, _T("SHGetPathFromIDList") ); 
    809  
    810     if( !SHGetMalloc || !SHBrowseForFolder || !SHGetPathFromIDList ) 
    811     { 
    812         msg_Err( p_intf, "couldn't load SHBrowseForFolder API" ); 
    813         FreeLibrary( ceshell_dll ); 
    814         return; 
    815     } 
    816 #endif 
    817  
    818     if( !SUCCEEDED( SHGetMalloc(&p_malloc) ) ) goto error; 
    819  
    820     p_playlist = (playlist_t *) 
    821         vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); 
    822     if( !p_playlist ) goto error; 
    823  
    824     memset( &bi, 0, sizeof(BROWSEINFO) ); 
    825     bi.hwndOwner = hwndMain; 
    826     bi.pszDisplayName = psz_result; 
    827     bi.ulFlags = BIF_EDITBOX; 
    828 #ifndef UNDER_CE 
    829     bi.ulFlags |= BIF_USENEWUI; 
    830 #endif 
    831  
    832     if( (pidl = SHBrowseForFolder( &bi ) ) ) 
    833     { 
    834         if( SHGetPathFromIDList( pidl, psz_result ) ) 
    835         { 
    836             char *psz_filename = _TOMB(psz_result); 
    837             playlist_Add( p_playlist, psz_filename, psz_filename, 
    838                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); 
    839         } 
    840         p_malloc->Free( pidl ); 
    841     } 
    842  
    843  error: 
    844  
    845     if( p_malloc) p_malloc->Release(); 
    846     if( p_playlist ) vlc_object_release( p_playlist ); 
    847  
    848 #ifdef UNDER_CE 
    849     FreeLibrary( ceshell_dll ); 
    850 #endif 
     607void Interface::OnShowDialog( int i_dialog_event ) 
     608
     609    int i_id; 
     610 
     611    switch( i_dialog_event ) 
     612    { 
     613    case ID_FILE_QUICKOPEN: i_id = INTF_DIALOG_FILE_SIMPLE; break; 
     614    case ID_FILE_OPENFILE: i_id = INTF_DIALOG_FILE; break; 
     615    case ID_FILE_OPENDIR: i_id = INTF_DIALOG_DIRECTORY; break; 
     616    case ID_FILE_OPENNET: i_id = INTF_DIALOG_NET; break; 
     617    case ID_VIEW_PLAYLIST: i_id = INTF_DIALOG_PLAYLIST; break; 
     618    case ID_VIEW_MESSAGES: i_id = INTF_DIALOG_MESSAGES; break; 
     619    case ID_VIEW_STREAMINFO: i_id = INTF_DIALOG_FILEINFO; break; 
     620    case ID_PREFERENCES: i_id = INTF_DIALOG_PREFS; break; 
     621    default: i_id = INTF_DIALOG_FILE; break; 
     622    } 
     623 
     624    if( p_intf->p_sys->pf_show_dialog ) 
     625        p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 ); 
    851626} 
    852627 
     
    895670        /* If the playlist is empty, open a file requester instead */ 
    896671        vlc_object_release( p_playlist ); 
    897         OnOpenFileSimple(); 
     672        OnShowDialog( ID_FILE_QUICKOPEN ); 
    898673    } 
    899674} 
  • modules/gui/wince/iteminfo.cpp

    rede8b84 r39c6836  
    4747 * Constructor. 
    4848 *****************************************************************************/ 
    49 ItemInfoDialog::ItemInfoDialog( intf_thread_t *_p_intf
    50                                 HINSTANCE _hInst, 
     49ItemInfoDialog::ItemInfoDialog( intf_thread_t *p_intf, CBaseWindow *p_parent
     50                                HINSTANCE h_inst, 
    5151                                playlist_item_t *_p_item ) 
     52  :  CBaseWindow( p_intf, p_parent, h_inst ) 
    5253{ 
    5354    /* Initializations */ 
    54     p_intf = _p_intf; 
    55     hInst = _hInst; 
    5655    p_item = _p_item; 
    5756} 
     
    153152    case WM_CLOSE: 
    154153        EndDialog( hwnd, LOWORD( wp ) ); 
     154        break; 
     155 
     156    case WM_SETFOCUS: 
     157        SHSipPreference( hwnd, SIP_DOWN );  
     158        SHFullScreen( hwnd, SHFS_HIDESIPBUTTON ); 
    155159        break; 
    156160 
  • modules/gui/wince/messages.cpp

    r909088e r39c6836  
    5252 *****************************************************************************/ 
    5353 
    54 Messages::Messages( intf_thread_t *_p_intf, HINSTANCE _hInst ) 
     54Messages::Messages( intf_thread_t *p_intf, CBaseWindow *p_parent, 
     55                    HINSTANCE h_inst ) 
     56  :  CBaseWindow( p_intf, p_parent, h_inst ) 
    5557{ 
    5658    /* Initializations */ 
    57     p_intf = _p_intf; 
    58     hInst = _hInst; 
    5959    hListView = NULL; 
    60     b_verbose = VLC_FALSE; 
     60 
     61    hWnd = CreateWindow( _T("VLC WinCE"), _T("Messages"), 
     62                         WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_SIZEBOX, 
     63                         0, 0, /*CW_USEDEFAULT*/300, /*CW_USEDEFAULT*/300, 
     64                         p_parent->GetHandle(), NULL, h_inst, (void *)this ); 
    6165} 
    6266 
    6367/*********************************************************************** 
    64  
    6568FUNCTION:  
    6669  WndProc 
     
    6871PURPOSE:  
    6972  Processes messages sent to the main window. 
    70  
    7173***********************************************************************/ 
    7274LRESULT Messages::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) 
     
    8183    switch( msg ) 
    8284    { 
    83     case WM_INITDIALOG:  
     85    case WM_CREATE: 
    8486        shidi.dwMask = SHIDIM_FLAGS; 
    8587        shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | 
     
    8890        SHInitDialog( &shidi ); 
    8991 
    90         RECT rect;  
    91         GetClientRect( hwnd, &rect ); 
    9292        hListView = CreateWindow( WC_LISTVIEW, NULL, 
    9393                                  WS_VISIBLE | WS_CHILD | LVS_REPORT | 
    9494                                  LVS_SHOWSELALWAYS | WS_VSCROLL | WS_HSCROLL | 
    95                                   WS_BORDER /*| LVS_NOCOLUMNHEADER */, 
    96                                   rect.left + 20, rect.top + 50,  
    97                                   rect.right - rect.left - ( 2 * 20 ),  
    98                                   rect.bottom - rect.top - 50 - 20,  
     95                                  WS_BORDER | LVS_NOCOLUMNHEADER, 0, 0, 0, 0, 
    9996                                  hwnd, NULL, hInst, NULL );             
    10097        ListView_SetExtendedListViewStyle( hListView, LVS_EX_FULLROWSELECT ); 
    10198 
    10299        LVCOLUMN lv; 
    103         lv.mask = LVCF_WIDTH | LVCF_FMT | LVCF_TEXT; 
     100        lv.mask = LVCF_FMT; 
    104101        lv.fmt = LVCFMT_LEFT ; 
    105         GetClientRect( hwnd, &rect ); 
    106         lv.cx = rect.right - rect.left; 
    107         lv.pszText = _T("Messages"); 
    108         lv.cchTextMax = 9; 
    109         ListView_InsertColumn( hListView, 0, &lv); 
     102        ListView_InsertColumn( hListView, 0, &lv ); 
    110103 
    111104        SetTimer( hwnd, 1, 500 /*milliseconds*/, NULL ); 
    112  
    113         SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); 
     105        break; 
     106 
     107    case WM_WINDOWPOSCHANGED: 
     108        { 
     109            RECT rect; 
     110            if( !GetClientRect( hwnd, &rect ) ) break; 
     111            SetWindowPos( hListView, 0, 0, 0, 
     112                          rect.right - rect.left, rect.bottom - rect.top, 0 ); 
     113 
     114            LVCOLUMN lv; 
     115            lv.cx = rect.right - rect.left; 
     116            lv.mask = LVCF_WIDTH; 
     117            ListView_SetColumn( hListView, 0, &lv ); 
     118        } 
     119        break; 
     120 
     121    case WM_SETFOCUS: 
     122        SHSipPreference( hwnd, SIP_DOWN );  
     123        SHFullScreen( hwnd, SHFS_HIDESIPBUTTON ); 
    114124        break; 
    115125 
     
    119129 
    120130    case WM_CLOSE: 
    121         EndDialog( hwnd, LOWORD( wp ) ); 
    122         break
     131        Show( FALSE ); 
     132        return TRUE
    123133 
    124134    case WM_COMMAND: 
     
    126136        { 
    127137        case IDOK: 
    128             EndDialog( hwnd, LOWORD( wp ) ); 
     138            Show( FALSE ); 
    129139            break; 
    130140 
     
    168178                } 
    169179            } 
    170  
    171             SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); 
    172180            break; 
    173181 
     
    180188    } 
    181189 
    182     return FALSE
     190    return DefWindowProc( hwnd, msg, wp, lp )
    183191} 
    184192 
     
    198206             i_start = (i_start+1) % VLC_MSG_QSIZE ) 
    199207        { 
    200             if( !b_verbose && VLC_MSG_ERR != p_sub->p_msg[i_start].i_type ) 
    201                 continue; 
     208            switch( p_sub->p_msg[i_start].i_type ) 
     209            { 
     210            case VLC_MSG_ERR: 
     211            case VLC_MSG_INFO: 
     212                if( p_intf->p_libvlc->i_verbose < 0 ) continue; 
     213                break; 
     214            case VLC_MSG_WARN: 
     215                if( p_intf->p_libvlc->i_verbose < 1 ) continue; 
     216                break; 
     217            case VLC_MSG_DBG: 
     218                if( p_intf->p_libvlc->i_verbose < 2 ) continue; 
     219                break; 
     220            } 
    202221 
    203222            /* Append all messages to log window */ 
     
    206225            switch( p_sub->p_msg[i_start].i_type ) 
    207226            { 
    208             case VLC_MSG_INFO: 
    209                 debug += ": "; 
    210                 break; 
    211             case VLC_MSG_ERR: 
    212                 debug += " error: "; 
    213                 break; 
    214             case VLC_MSG_WARN: 
    215                 debug += " warning: "; 
    216                 break; 
    217             case VLC_MSG_DBG: 
    218             default: 
    219                 debug += " debug: "; 
    220                 break; 
     227            case VLC_MSG_INFO: debug += ": "; break; 
     228            case VLC_MSG_ERR: debug += " error: "; break; 
     229            case VLC_MSG_WARN: debug += " warning: "; break; 
     230            default: debug += " debug: "; break; 
    221231            } 
    222232 
  • modules/gui/wince/open.cpp

    ra7ffa80 r39c6836  
    3434#include "wince.h" 
    3535 
    36 #include <winuser.h> 
    37 #include <windows.h> 
    3836#include <windowsx.h> 
    3937#include <commctrl.h> 
    4038#include <commdlg.h> 
     39#include <shlobj.h> 
    4140 
    4241/***************************************************************************** 
     
    7473 * Constructor. 
    7574 *****************************************************************************/ 
    76 OpenDialog::OpenDialog( intf_thread_t *_p_intf, HINSTANCE _hInst, 
    77                         int _i_access_method, int _i_arg, int _i_method ) 
     75OpenDialog::OpenDialog( intf_thread_t *p_intf, CBaseWindow *p_parent, 
     76                        HINSTANCE h_inst, int _i_access, int _i_arg ) 
     77  :  CBaseWindow( p_intf, p_parent, h_inst ) 
    7878{ 
    7979    /* Initializations */ 
    80     p_intf = _p_intf; 
    81     hInst = _hInst; 
    82     i_current_access_method = _i_access_method; 
     80    i_access = _i_access; 
    8381    i_open_arg = _i_arg; 
    84     i_method = _i_method; 
    8582 
    8683    for( int i = 0; i < 4; i++ ) 
     
    9592        net_addrs[i] = 0; 
    9693    } 
     94 
     95    CreateWindow( _T("VLC WinCE"), _T("Messages"), 
     96                  WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_SIZEBOX, 
     97                  0, 0, /*CW_USEDEFAULT*/300, /*CW_USEDEFAULT*/300, 
     98                  p_parent->GetHandle(), NULL, h_inst, (void *)this ); 
    9799} 
    98100 
     
    109111{ 
    110112    SHINITDLGINFO shidi; 
    111     SHMENUBARINFO mbi; 
    112113    INITCOMMONCONTROLSEX  iccex;  // INITCOMMONCONTROLSEX structure     
    113114    RECT rcClient; 
     
    116117    switch( msg ) 
    117118    { 
    118     case WM_INITDIALOG:  
     119    case WM_CREATE: 
    119120        shidi.dwMask = SHIDIM_FLAGS; 
    120         shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | 
    121             SHIDIF_FULLSCREENNOMENUBAR;//SHIDIF_SIZEDLGFULLSCREEN; 
     121        shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_FULLSCREENNOMENUBAR; 
    122122        shidi.hDlg = hwnd; 
    123123        SHInitDialog( &shidi ); 
    124  
    125         //Create the menubar. 
    126         memset( &mbi, 0, sizeof(SHMENUBARINFO) ); 
    127         mbi.cbSize     = sizeof(SHMENUBARINFO); 
    128         mbi.hwndParent = hwnd; 
    129         mbi.dwFlags    = SHCMBF_EMPTYBAR; 
    130         mbi.hInstRes   = hInst; 
    131  
    132         if( !SHCreateMenuBar( &mbi ) ) 
    133         { 
    134             MessageBox( hwnd, _T("SHCreateMenuBar failed"), 
    135                         _T("Error"), MB_OK ); 
    136             //return -1; 
    137         } 
    138  
    139         hwndCB = mbi.hwndMB; 
    140124 
    141125        // Get the client area rect to put the panels in 
     
    184168        TabCtrl_InsertItem( notebook, 1, &tcItem ); 
    185169 
    186         switch( i_current_access_method
     170        switch( i_access
    187171        { 
    188172        case FILE_ACCESS: 
     
    201185 
    202186    case WM_CLOSE: 
    203         EndDialog( hwnd, LOWORD( wp ) ); 
     187        Show( FALSE ); 
     188        return TRUE; 
     189 
     190    case WM_SETFOCUS: 
     191        SHFullScreen( hwnd, SHFS_SHOWSIPBUTTON ); 
     192        SHSipPreference( hwnd, SIP_DOWN );  
    204193        break; 
    205194 
     
    208197        { 
    209198            OnOk(); 
    210             EndDialog( hwnd, LOWORD( wp ) ); 
     199            Show( FALSE ); 
    211200            break; 
    212201        } 
     
    233222            } else if( (HWND)lp == browse_button ) 
    234223            { 
    235                 SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); 
    236224                OnFileBrowse(); 
    237225            }  
     
    274262    } 
    275263 
    276     return FALSE
     264    return DefWindowProc( hwnd, msg, wp, lp )
    277265} 
    278266 
     
    282270void OpenDialog::FilePanel( HWND hwnd ) 
    283271{ 
    284     RECT rc;     
    285     GetWindowRect( notebook, &rc); 
     272    RECT rc; 
     273    GetWindowRect( notebook, &rc ); 
    286274 
    287275    /* Create browse file line */ 
     
    326314 
    327315void OpenDialog::NetPanel( HWND hwnd ) 
    328 {   
     316{ 
    329317    INITCOMMONCONTROLSEX ic; 
    330318    TCHAR psz_text[256]; 
     
    344332    }; 
    345333 
    346     RECT rc;     
     334    RECT rc; 
    347335    GetWindowRect( notebook, &rc); 
    348336 
     
    475463void OpenDialog::UpdateMRL() 
    476464{ 
    477     UpdateMRL( i_current_access_method ); 
     465    UpdateMRL( i_access ); 
    478466} 
    479467 
     
    484472    char psz_tmp[256]; 
    485473 
    486     i_current_access_method = i_access_method; 
     474    i_access = i_access_method; 
    487475 
    488476    switch( i_access_method ) 
     
    568556                      SWP_NOMOVE | SWP_NOSIZE ); 
    569557 
    570         i_current_access_method = FILE_ACCESS; 
     558        i_access = FILE_ACCESS; 
    571559    } 
    572560    else if ( TabCtrl_GetCurSel( notebook ) == 1 ) 
     
    600588        SendMessage( net_radios[0], BM_SETCHECK, BST_CHECKED, 0 ); 
    601589 
    602         i_current_access_method = NET_ACCESS; 
     590        i_access = NET_ACCESS; 
    603591    } 
    604592 
     
    676664} 
    677665 
     666static void OnOpenCB( intf_dialog_args_t *p_arg ) 
     667{ 
     668    OpenDialog *p_this = (OpenDialog *)p_arg->p_arg; 
     669    char psz_tmp[PATH_MAX+2] = "\0"; 
     670 
     671    if( p_arg->i_results && p_arg->psz_results[0] ) 
     672    { 
     673        if( strchr( p_arg->psz_results[0], ' ' ) ) 
     674        { 
     675            strcat( psz_tmp, "\"" ); 
     676            strcat( psz_tmp, p_arg->psz_results[0] ); 
     677            strcat( psz_tmp, "\"" ); 
     678        } 
     679        else strcat( psz_tmp, p_arg->psz_results[0] ); 
     680 
     681        SetWindowText( p_this->file_combo, _FROMMB(psz_tmp) ); 
     682        ComboBox_AddString( p_this->file_combo, _FROMMB(psz_tmp) ); 
     683        if( ComboBox_GetCount( p_this->file_combo ) > 10 )  
     684            ComboBox_DeleteString( p_this->file_combo, 0 ); 
     685 
     686        p_this->UpdateMRL( FILE_ACCESS ); 
     687    } 
     688} 
     689 
    678690void OpenDialog::OnFileBrowse() 
    679 {        
    680     OPENFILENAME ofn; 
    681     static TCHAR szFilter[] = _T("All (*.*)\0*.*\0"); 
    682     TCHAR psz_file[PATH_MAX] = _T("\0"); 
    683     TCHAR psz_tmp[PATH_MAX+2] = _T("\0"); 
    684  
    685     memset(&ofn, 0, sizeof(OPENFILENAME)); 
    686     ofn.lStructSize = sizeof (OPENFILENAME); 
    687     ofn.hwndOwner = NULL; 
    688     ofn.hInstance = hInst; 
    689     ofn.lpstrFilter = szFilter; 
    690     ofn.lpstrCustomFilter = NULL; 
    691     ofn.nMaxCustFilter = 0; 
    692     ofn.nFilterIndex = 1;      
    693     ofn.lpstrFile = psz_file;  
    694     ofn.nMaxFile = PATH_MAX; 
    695     ofn.lpstrFileTitle = NULL;  
    696     ofn.nMaxFileTitle = 40; 
    697     ofn.lpstrInitialDir = NULL; 
    698     ofn.lpstrTitle = _T("Open File"); 
    699     ofn.Flags = 0; 
    700     ofn.nFileOffset = 0; 
    701     ofn.nFileExtension = 0; 
    702     ofn.lpstrDefExt = NULL; 
    703     ofn.lCustData = 0L; 
    704     ofn.lpfnHook = NULL; 
    705     ofn.lpTemplateName = NULL; 
    706     if( GetOpenFile( &ofn ) ) 
    707     { 
    708         if( _tcschr( ofn.lpstrFile, _T(' ') ) ) 
    709         { 
    710             _tcscat( psz_tmp, _T("\"") ); 
    711             _tcscat( psz_tmp, ofn.lpstrFile ); 
    712             _tcscat( psz_tmp, _T("\"") ); 
    713         } 
    714         else _tcscat( psz_tmp, ofn.lpstrFile ); 
    715  
    716         SetWindowText( file_combo, psz_tmp ); 
    717         ComboBox_AddString( file_combo, psz_tmp ); 
    718         if( ComboBox_GetCount( file_combo ) > 10 )  
    719             ComboBox_DeleteString( file_combo, 0 ); 
    720  
    721         UpdateMRL( FILE_ACCESS ); 
    722     } 
     691
     692    intf_dialog_args_t *p_arg = 
     693        (intf_dialog_args_t *)malloc( sizeof(intf_dialog_args_t) ); 
     694    memset( p_arg, 0, sizeof(intf_dialog_args_t) ); 
     695 
     696    p_arg->psz_title = strdup( "Open file" ); 
     697    p_arg->psz_extensions = strdup( "All (*.*)|*.*" ); 
     698    p_arg->p_arg = this; 
     699    p_arg->pf_callback = OnOpenCB; 
     700 
     701    p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE_GENERIC, 0, p_arg); 
    723702} 
    724703 
     
    819798 
    820799    /* Show/hide the open dialog */ 
    821     SubsFileDialog *subsfile_dialog = new SubsFileDialog( p_intf, hInst ); 
     800    SubsFileDialog *subsfile_dialog = new SubsFileDialog( p_intf, this, hInst); 
    822801    CreateDialogBox(  hwnd, subsfile_dialog ); 
    823802 
  • modules/gui/wince/playlist.cpp

    ra7ffa80 r39c6836  
    3737#include <commdlg.h> 
    3838 
    39 #ifndef NMAXFILE 
    40 #define NMAXFILE 512 // at least 256 
    41 #endif 
    42  
    4339#ifndef TEXTMAXBUF 
    4440#define TEXTMAXBUF 512 // at least 500 
     
    124120 * Constructor. 
    125121 *****************************************************************************/ 
    126 Playlist::Playlist( intf_thread_t *_p_intf, HINSTANCE _hInst ) 
     122Playlist::Playlist( intf_thread_t *p_intf, CBaseWindow *p_parent, 
     123                    HINSTANCE h_inst ) 
     124  :  CBaseWindow( p_intf, p_parent, h_inst ) 
    127125{ 
    128126    /* Initializations */ 
    129     p_intf = _p_intf; 
    130         hInst = _hInst; 
    131         hListView = NULL; 
    132  
     127    hListView = NULL; 
    133128    i_title_sorted = 1; 
    134129    i_author_sorted = 1; 
     
    337332 
    338333        SetTimer( hwnd, 1, 500 /*milliseconds*/, NULL ); 
    339  
    340         SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); 
    341334        break; 
    342335 
     
    347340    case WM_CLOSE: 
    348341        EndDialog( hwnd, LOWORD( wp ) ); 
     342        break; 
     343 
     344    case WM_SETFOCUS: 
     345        SHSipPreference( hwnd, SIP_DOWN );  
     346        SHFullScreen( hwnd, SHFS_HIDESIPBUTTON ); 
    349347        break; 
    350348 
     
    362360 
    363361        case ID_MANAGE_SAVEPL: 
    364             SHFullScreen( GetForegroundWindow(), SHFS_SHOWSIPBUTTON ); 
    365362            OnSave(); 
    366             SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); 
    367363            break; 
    368364 
    369365        case ID_MANAGE_ADDFILE: 
    370             SHFullScreen( GetForegroundWindow(), SHFS_SHOWSIPBUTTON ); 
    371             OnAddFile(); 
    372             SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); 
     366            p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE_SIMPLE, 
     367                                           0, 0 ); 
    373368            b_need_update = VLC_TRUE; 
    374369            break; 
    375370 
    376371        case ID_MANAGE_ADDDIRECTORY: 
    377             SHFullScreen( GetForegroundWindow(), SHFS_SHOWSIPBUTTON ); 
    378             OnAddFile(); 
    379             SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); 
     372            p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_DIRECTORY, 
     373                                           0, 0 ); 
    380374            b_need_update = VLC_TRUE; 
    381375            break; 
    382376 
    383