⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 open.cpp

📁 VLC Player Source Code
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************** * open.cpp : WinCE gui plugin for VLC ***************************************************************************** * Copyright (C) 2000-2004 the VideoLAN team * $Id: 6a2d3e12239d2c383ac191bd50b36e25ad77cba0 $ * * 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************//***************************************************************************** * Preamble *****************************************************************************/#ifdef HAVE_CONFIG_H# include "config.h"#endif#include <vlc_common.h>#include <vlc_interface.h>#include "wince.h"#include <windowsx.h>#include <commctrl.h>#include <commdlg.h>#include <shlobj.h>/***************************************************************************** * Event Table. *****************************************************************************//* IDs for the controls and the menu commands */enum{    Notebook_Event = 1000,    MRL_Event,    FileBrowse_Event,    FileName_Event,    DiscType_Event,    DiscDevice_Event,    DiscTitle_Event,    DiscChapter_Event,    NetType_Event,    NetRadio1_Event, NetRadio2_Event, NetRadio3_Event, NetRadio4_Event,    NetPort1_Event, NetPort2_Event, NetPort3_Event,    NetAddr1_Event, NetAddr2_Event, NetAddr3_Event, NetAddr4_Event,    SubsFileEnable_Event,    SubsFileSettings_Event,};/***************************************************************************** * AutoBuiltPanel. *****************************************************************************//***************************************************************************** * Constructor. *****************************************************************************/OpenDialog::OpenDialog( intf_thread_t *p_intf, CBaseWindow *p_parent,                        HINSTANCE h_inst, int _i_access, int _i_arg )  :  CBaseWindow( p_intf, p_parent, h_inst ){    /* Initializations */    i_access = _i_access;    i_open_arg = _i_arg;    for( int i = 0; i < 4; i++ )    {        net_radios[i] = 0;        net_label[i] = 0;        net_port_label[i] = 0;        net_ports[i] = 0;        hUpdown[i] = 0;        i_net_ports[i] = 0;        net_addrs_label[i] = 0;        net_addrs[i] = 0;    }    CreateWindow( _T("VLC WinCE"), _T("Messages"),                  WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_SIZEBOX,                  0, 0, /*CW_USEDEFAULT*/300, /*CW_USEDEFAULT*/300,                  p_parent->GetHandle(), NULL, h_inst, (void *)this );}/***********************************************************************FUNCTION:  WndProcPURPOSE:  Processes messages sent to the main window. ***********************************************************************/LRESULT OpenDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ){    SHINITDLGINFO shidi;    INITCOMMONCONTROLSEX  iccex;  // INITCOMMONCONTROLSEX structure    RECT rcClient;    TC_ITEM tcItem;    switch( msg )    {    case WM_CREATE:        shidi.dwMask = SHIDIM_FLAGS;        shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_FULLSCREENNOMENUBAR;        shidi.hDlg = hwnd;        SHInitDialog( &shidi );        // Get the client area rect to put the panels in        GetClientRect( hwnd, &rcClient );        /* Create MRL combobox */        mrl_box = CreateWindow( _T("STATIC"),                                _FROMMB(_("Media Resource Locator (MRL)")),                                WS_CHILD | WS_VISIBLE | SS_LEFT,                                5, 10, rcClient.right, 15, hwnd, 0, hInst, 0 );        mrl_label = CreateWindow( _T("STATIC"), _FROMMB(_("Open:")),                                  WS_CHILD | WS_VISIBLE | SS_LEFT,                                  5, 10 + 15 + 10, 40, 15, hwnd, 0, hInst, 0 );        mrl_combo = CreateWindow( _T("COMBOBOX"), _T(""),                                  WS_CHILD | WS_VISIBLE | CBS_AUTOHSCROLL |                                  CBS_SORT | WS_VSCROLL, 45, 10 + 15 + 10 - 3,                                  rcClient.right - 50 - 5, 5*15 + 6, hwnd,                                  0, hInst, 0 );        // No tooltips for ComboBox        label = CreateWindow( _T("STATIC"),                              _FROMMB(_("Alternatively, you can build an MRL "                                       "using one of the following predefined "                                       "targets:" )),                              WS_CHILD | WS_VISIBLE | SS_LEFT,                              5, 10 + 2*(15 + 10), rcClient.right - 2*5, 2*15,                              hwnd, 0, hInst, 0 );        /* Create notebook */        iccex.dwSize = sizeof (INITCOMMONCONTROLSEX);        iccex.dwSize = ICC_TAB_CLASSES;        InitCommonControlsEx (&iccex);        notebook = CreateWindowEx( 0, WC_TABCONTROL, NULL,            WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE,            5, 10 + 4*15 + 2*10, rcClient.right - 2*5,            rcClient.bottom - MENU_HEIGHT - 15 - 10 - 10 - (10 + 4*15 + 2*10),            hwnd, NULL, hInst, NULL );        tcItem.mask = TCIF_TEXT;        tcItem.pszText = _T("File");        TabCtrl_InsertItem( notebook, 0, &tcItem );        tcItem.pszText = _T("Network");        TabCtrl_InsertItem( notebook, 1, &tcItem );        switch( i_access )        {        case FILE_ACCESS:            TabCtrl_SetCurSel( notebook, 0 );            break;        case NET_ACCESS:            TabCtrl_SetCurSel( notebook, 1 );            break;        }        FilePanel( hwnd );        NetPanel( hwnd );        OnPageChange();        break;    case WM_CLOSE:        Show( FALSE );        return TRUE;    case WM_SETFOCUS:        SHFullScreen( hwnd, SHFS_SHOWSIPBUTTON );        SHSipPreference( hwnd, SIP_DOWN );        break;    case WM_COMMAND:        if( LOWORD(wp) == IDOK )        {            OnOk();            Show( FALSE );            break;        }        if( HIWORD(wp) == BN_CLICKED )        {            if( (HWND)lp == net_radios[0] )            {                OnNetTypeChange( NetRadio1_Event );            } else if( (HWND)lp == net_radios[1] )            {                OnNetTypeChange( NetRadio2_Event );            } else if( (HWND)lp == net_radios[2] )            {                OnNetTypeChange( NetRadio3_Event );            } else if( (HWND)lp == net_radios[3] )            {                OnNetTypeChange( NetRadio4_Event );            } else if( (HWND)lp == subsfile_checkbox )            {                OnSubsFileEnable();            } else if( (HWND)lp == subsfile_button )            {                OnSubsFileSettings( hwnd );            } else if( (HWND)lp == browse_button )            {                OnFileBrowse();            }            break;        }        if( HIWORD(wp) == EN_CHANGE )        {            if( (HWND)lp == net_addrs[1] )            {                OnNetPanelChange( NetAddr2_Event );            } else if( (HWND)lp == net_addrs[2] )            {                OnNetPanelChange( NetAddr3_Event );            } else if( (HWND)lp == net_addrs[3] )            {                OnNetPanelChange( NetAddr4_Event );            } else if( (HWND)lp == net_ports[0] )            {                OnNetPanelChange( NetPort1_Event );            } else if( (HWND)lp == net_ports[1] )            {                OnNetPanelChange( NetPort2_Event );            }        }        if( HIWORD(wp) == CBN_EDITUPDATE )        {            if ((HWND)lp == file_combo)            {                OnFilePanelChange();            }        }        break;    case WM_NOTIFY:        if( (((NMHDR *)lp)->code) == TCN_SELCHANGE ) OnPageChange();        break;    default:        break;    }    return DefWindowProc( hwnd, msg, wp, lp );}/***************************************************************************** * Private methods. *****************************************************************************/void OpenDialog::FilePanel( HWND hwnd ){    RECT rc;    GetWindowRect( notebook, &rc );    /* Create browse file line */    file_combo = CreateWindow( _T("COMBOBOX"), _T(""),        WS_CHILD | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL,        rc.left + 10, rc.top + 10 - 3, rc.right - 10 - (rc.left + 10),        5*15 + 6, hwnd, NULL, hInst, NULL );    browse_button = CreateWindow( _T("BUTTON"), _T("Browse..."),        WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,        rc.left + 10, rc.top + 10 + 15 + 10 - 3, 80, 15 + 6,        hwnd, NULL, hInst, NULL );    /* Create Subtitles File checkox */    subsfile_checkbox = CreateWindow( _T("BUTTON"), _T("Subtitle options"),        WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,        rc.left + 10, rc.top + 10 + 2*(15 + 10), 15, 15,        hwnd, NULL, hInst, NULL );    SendMessage( subsfile_checkbox, BM_SETCHECK, BST_UNCHECKED, 0 );    subsfile_label = CreateWindow( _T("STATIC"), _T("Subtitle options"),                WS_CHILD | WS_VISIBLE | SS_LEFT,                rc.left + 10 + 15 + 10, rc.top + 10 + 2*(15 + 10), 100, 15,                hwnd, NULL, hInst, NULL);    subsfile_button = CreateWindow( _T("BUTTON"), _T("Settings..."),                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,                rc.right - 80 - 10, rc.top + 10 + 2*(15 + 10) - 3, 80, 15 + 6,                hwnd, NULL, hInst, NULL );    char *psz_subsfile = config_GetPsz( p_intf, "sub-file" );    if( psz_subsfile && *psz_subsfile )    {        SendMessage( subsfile_checkbox, BM_SETCHECK, BST_CHECKED, 0 );        EnableWindow( subsfile_button, TRUE );        string sz_subsfile = "sub-file=";        sz_subsfile += psz_subsfile;        subsfile_mrl.push_back( sz_subsfile );    }    free( psz_subsfile );}void OpenDialog::NetPanel( HWND hwnd ){    INITCOMMONCONTROLSEX ic;    TCHAR psz_text[256];    struct net_type    {        TCHAR *psz_text;        int length;    };    static struct net_type net_type_array[] =    {        { _T("UDP/RTP"), 82 },        { _T("UDP/RTP Multicast"), 140 },        { _T("HTTP/FTP/MMS"), 90 },        { _T("RTSP"), 30 }    };    RECT rc;    GetWindowRect( notebook, &rc);    /* UDP/RTP row */    net_radios[0] = CreateWindow( _T("BUTTON"), net_type_array[0].psz_text,                WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,                rc.left + 5, rc.top + 10, 15, 15, hwnd, NULL, hInst, NULL );    net_label[0] = CreateWindow( _T("STATIC"), net_type_array[0].psz_text,                WS_CHILD | WS_VISIBLE | SS_LEFT,                rc.left + 5 + 15 + 5, rc.top + 10, net_type_array[0].length,                15, hwnd, NULL, hInst, NULL );    i_net_ports[0] = config_GetInt( p_intf, "server-port" );    net_port_label[0] = CreateWindow( _T("STATIC"), _T("Port"),                WS_CHILD | WS_VISIBLE | SS_LEFT,                rc.left + 5 , rc.top + 10 + 2*(15 + 10), 30, 15,                hwnd, NULL, hInst, NULL );    _stprintf( psz_text, _T("%d"), i_net_ports[0] );    net_ports[0] = CreateWindow( _T("EDIT"), psz_text,        WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL,        rc.left + 5 + 30 + 5, rc.top + 10 + 2*(15 + 10) - 3,        rc.right - 5 - (rc.left + 5 + 30 + 5), 15 + 6, hwnd, NULL, hInst, NULL );    ic.dwSize = sizeof(INITCOMMONCONTROLSEX);    ic.dwICC = ICC_UPDOWN_CLASS;    InitCommonControlsEx(&ic);    hUpdown[0] = CreateUpDownControl(                WS_CHILD | WS_VISIBLE | WS_BORDER | UDS_ALIGNRIGHT |                UDS_SETBUDDYINT | UDS_NOTHOUSANDS,                0, 0, 0, 0, hwnd, 0, hInst,                net_ports[0], 16000, 0, i_net_ports[0]);    /* UDP/RTP Multicast row */    net_radios[1] = CreateWindow( _T("BUTTON"), net_type_array[1].psz_text,                WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,                rc.left + 5, rc.top + 10 + 15 + 10, 15, 15,                hwnd, NULL, hInst, NULL);    net_label[1] = CreateWindow( _T("STATIC"), net_type_array[1].psz_text,                WS_CHILD | WS_VISIBLE | SS_LEFT,                rc.left + 5 + 15 + 5, rc.top + 10 + 15 + 10,                net_type_array[1].length, 15, hwnd, NULL, hInst, NULL );    net_addrs_label[1] = CreateWindow( _T("STATIC"), _T("Address"),                WS_CHILD | WS_VISIBLE | SS_LEFT,                rc.left + 5 , rc.top + 10 + 2*(15 + 10), 50, 15,                hwnd, NULL, hInst, NULL);    net_addrs[1] = CreateWindow( _T("EDIT"), _T(""),                WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL,                rc.left + 5 + 50 + 5, rc.top + 10 + 2*(15 + 10) - 3,                rc.right - 5 - (rc.left + 5 + 50 + 5), 15 + 6,                hwnd, NULL, hInst, NULL);    net_port_label[1] = CreateWindow( _T("STATIC"), _T("Port"),                WS_CHILD | WS_VISIBLE | SS_LEFT,                rc.left + 5 , rc.top + 10 + 3*(15 + 10), 30, 15,                hwnd, NULL, hInst, NULL);    i_net_ports[1] = i_net_ports[0];    _stprintf( psz_text, _T("%d"), i_net_ports[1] );    net_ports[1] = CreateWindow( _T("EDIT"), psz_text,                WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL,                rc.left + 5 + 30 + 5, rc.top + 10 + 3*(15 + 10) - 3,                rc.right - 5 -(rc.left + 5 + 30 + 5), 15 + 6,                hwnd, NULL, hInst, NULL );    ic.dwSize = sizeof(INITCOMMONCONTROLSEX);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -