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

📄 menus.cpp

📁 VLC Player Source Code
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************** * menus.cpp : WinCE gui plugin for VLC ***************************************************************************** * Copyright (C) 2000-2004 the VideoLAN team * $Id: 75b27c152179af72010a052f65685d10a3e2e255 $ * * 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"/***************************************************************************** * Event Table. *****************************************************************************//* IDs for the controls and the menu commands */enum{    /* menu items */    MenuDummy_Event = 1000,    OpenFileSimple_Event = 1100,    OpenFile_Event,    OpenDisc_Event,    OpenNet_Event,    FirstAutoGenerated_Event = 1999,    SettingsMenu_Events = 2000,    AudioMenu_Events = 3000,    VideoMenu_Events = 4000,    NavigMenu_Events = 5000,    PopupMenu_Events = 6000};HMENU OpenStreamMenu( intf_thread_t *p_intf ){    HMENU hmenu = CreatePopupMenu();    AppendMenu( hmenu, MF_STRING, ID_FILE_QUICKOPEN,                _T("Quick &Open File...") );    AppendMenu( hmenu, MF_STRING, ID_FILE_OPENFILE,                _T("Open &File...") );    AppendMenu( hmenu, MF_STRING, ID_FILE_OPENNET,                _T("Open &Network Stream...") );    return hmenu;}HMENU MiscMenu( intf_thread_t *p_intf ){    HMENU hmenu = CreatePopupMenu();    AppendMenu( hmenu, MF_STRING, ID_VIEW_STREAMINFO, _T("Media &Info...") );    AppendMenu( hmenu, MF_STRING, ID_VIEW_MESSAGES, _T("&Messages...") );    AppendMenu( hmenu, MF_STRING, ID_PREFERENCES, _T("&Preferences...") );    return hmenu;}void PopupMenu( intf_thread_t *p_intf, HWND p_parent, POINT point ){#define MAX_POPUP_ITEMS 45    vlc_object_t *p_object, *p_input;    char *ppsz_varnames[MAX_POPUP_ITEMS];    int pi_objects[MAX_POPUP_ITEMS];    int i = 0, i_last_separator = 0;    /* Initializations */    memset( pi_objects, 0, MAX_POPUP_ITEMS * sizeof(int) );    ppsz_varnames[i] = "VLC media player";    pi_objects[i++] = 0;    ppsz_varnames[i++] = NULL; /* Separator */    i_last_separator = i;    /* Input menu */    p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,                                                FIND_ANYWHERE );    if( p_object != NULL )    {        ppsz_varnames[i] = "bookmark";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "title";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "chapter";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "program";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "navigation";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "dvd_menus";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "video-es";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "audio-es";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "spu-es";        pi_objects[i++] = p_object->i_object_id;    }    p_input = p_object;    if( !p_input ) goto interfacemenu;    /* Video menu */    if( i != i_last_separator ) ppsz_varnames[i++] = NULL; /* Separator */    i_last_separator = i;    p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,                                                FIND_ANYWHERE );    if( p_object != NULL )    {        vlc_object_t *p_dec_obj;        ppsz_varnames[i] = "fullscreen";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "zoom";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "deinterlace";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "aspect-ratio";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "crop";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "video-on-top";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "directx-wallpaper";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "video-snapshot";        pi_objects[i++] = p_object->i_object_id;        p_dec_obj = (vlc_object_t *)vlc_object_find( p_object,                                                     VLC_OBJECT_DECODER,                                                     FIND_PARENT );        if( p_dec_obj != NULL )        {            ppsz_varnames[i] = "ffmpeg-pp-q";            pi_objects[i++] = p_dec_obj->i_object_id;            vlc_object_release( p_dec_obj );        }        vlc_object_release( p_object );    }    /* Audio menu */    if( i != i_last_separator ) ppsz_varnames[i++] = NULL; /* Separator */    i_last_separator  = i;    p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,                                                FIND_ANYWHERE );    if( p_object != NULL )    {        ppsz_varnames[i] = "audio-device";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "audio-channels";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "visual";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "equalizer";        pi_objects[i++] = p_object->i_object_id;        vlc_object_release( p_object );    } interfacemenu:    /* Interface menu */    if( i != i_last_separator ) ppsz_varnames[i++] = NULL; /* Separator */    i_last_separator = i;    /* vlc_object_find is needed because of the dialogs provider case */    p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INTF,                                                FIND_PARENT );    if( p_object != NULL )    {        /* Nothing for now */        vlc_object_release( p_object );    }    /* Build menu */    vector<MenuItemExt*> popup_menu;    HMENU hmenu = CreatePopupMenu();    RefreshMenu( p_intf, &popup_menu, hmenu, i,                 ppsz_varnames, pi_objects, PopupMenu_Events );    MenuItemExt::ClearList( &popup_menu );    /* Add static entries */    if( p_input != NULL )    {        vlc_value_t val;        AppendMenu( hmenu, MF_SEPARATOR, 0, _T("") );        AppendMenu( hmenu, MF_STRING, StopStream_Event, _T("Stop") );        AppendMenu( hmenu, MF_STRING, PrevStream_Event, _T("Previous") );        AppendMenu( hmenu, MF_STRING, NextStream_Event, _T("Next") );        var_Get( p_input, "state", &val );        if( val.i_int == PAUSE_S )            AppendMenu( hmenu, MF_STRING, PlayStream_Event, _T("Play") );        else            AppendMenu( hmenu, MF_STRING, PlayStream_Event, _T("Pause") );        vlc_object_release( p_input );    }    else    {        playlist_t * p_playlist = pl_Yield( p_intf );        if( p_playlist && p_playlist->i_size )        {            AppendMenu( hmenu, MF_SEPARATOR, 0, _T("") );            AppendMenu( hmenu, MF_STRING, PlayStream_Event, _T("Play") );        }        if( p_playlist ) pl_Release( p_intf );    }    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)MiscMenu( p_intf ),                _T("Miscellaneous") );    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)OpenStreamMenu( p_intf ),                _T("Open") );    TrackPopupMenu( hmenu, 0, point.x, point.y, 0, p_parent, 0 );    PostMessage( p_parent, WM_NULL, 0, 0 );    DestroyMenu( hmenu );}void RefreshAudioMenu( intf_thread_t *p_intf, HMENU hMenu ){#define MAX_AUDIO_ITEMS 10    vlc_object_t *p_object;    char *ppsz_varnames[MAX_AUDIO_ITEMS];    int pi_objects[MAX_AUDIO_ITEMS];    int i;    /* Delete old menu */    int count = wce_GetMenuItemCount( hMenu );    for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );    if( p_intf->p_sys->p_audio_menu )        MenuItemExt::ClearList( p_intf->p_sys->p_audio_menu );    else p_intf->p_sys->p_audio_menu = new vector<MenuItemExt*>;    /* Initializations */    memset( pi_objects, 0, MAX_AUDIO_ITEMS * sizeof(int) );    i = 0;    p_object = (vlc_object_t *)        vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );    if( p_object != NULL )    {        ppsz_varnames[i] = "audio-es";        pi_objects[i++] = p_object->i_object_id;        vlc_object_release( p_object );    }    p_object = (vlc_object_t *)        vlc_object_find( p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE );    if( p_object != NULL )    {        ppsz_varnames[i] = "audio-device";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "audio-channels";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "visual";        pi_objects[i++] = p_object->i_object_id;        vlc_object_release( p_object );    }    /* Build menu */    RefreshMenu( p_intf, p_intf->p_sys->p_audio_menu,                 hMenu, i, ppsz_varnames, pi_objects, AudioMenu_Events );}void RefreshVideoMenu( intf_thread_t *p_intf, HMENU hMenu ){#define MAX_VIDEO_ITEMS 15    vlc_object_t *p_object;    char *ppsz_varnames[MAX_VIDEO_ITEMS];    int pi_objects[MAX_VIDEO_ITEMS];    int i;    /* Delete old menu */    int count = wce_GetMenuItemCount( hMenu );    for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );    if( p_intf->p_sys->p_video_menu )        MenuItemExt::ClearList( p_intf->p_sys->p_video_menu );    else p_intf->p_sys->p_video_menu = new vector<MenuItemExt*>;    /* Initializations */    memset( pi_objects, 0, MAX_VIDEO_ITEMS * sizeof(int) );    i = 0;    p_object = (vlc_object_t *)        vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );    if( p_object != NULL )    {        ppsz_varnames[i] = "video-es";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "spu-es";        pi_objects[i++] = p_object->i_object_id;        vlc_object_release( p_object );    }    p_object = (vlc_object_t *)        vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );    if( p_object != NULL )    {        vlc_object_t *p_dec_obj;        ppsz_varnames[i] = "fullscreen";        pi_objects[i++] = p_object->i_object_id;#ifdef WINCE        ppsz_varnames[i] = "transform";        pi_objects[i++] = p_object->i_object_id;#endif        ppsz_varnames[i] = "zoom";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "deinterlace";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "aspect-ratio";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "crop";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "directx-on-top";        pi_objects[i++] = p_object->i_object_id;        p_dec_obj = (vlc_object_t *)            vlc_object_find( p_object, VLC_OBJECT_DECODER, FIND_PARENT );        if( p_dec_obj != NULL )        {            ppsz_varnames[i] = "ffmpeg-pp-q";            pi_objects[i++] = p_dec_obj->i_object_id;            vlc_object_release( p_dec_obj );        }        vlc_object_release( p_object );    }    /* Build menu */    RefreshMenu( p_intf, p_intf->p_sys->p_video_menu, hMenu, i,                 ppsz_varnames, pi_objects, VideoMenu_Events );}void RefreshNavigMenu( intf_thread_t *p_intf, HMENU hMenu ){#define MAX_NAVIG_ITEMS 10    vlc_object_t *p_object;    char *ppsz_varnames[MAX_NAVIG_ITEMS];    int pi_objects[MAX_NAVIG_ITEMS];    int i;    /* Delete old menu */    int count = wce_GetMenuItemCount( hMenu );    for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );     if( p_intf->p_sys->p_navig_menu )        MenuItemExt::ClearList( p_intf->p_sys->p_navig_menu );    else p_intf->p_sys->p_navig_menu = new vector<MenuItemExt*>;    /* Initializations */    memset( pi_objects, 0, MAX_NAVIG_ITEMS * sizeof(int) );    i = 0;    p_object = (vlc_object_t *)        vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );    if( p_object != NULL )    {        ppsz_varnames[i] = "title";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "chapter";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "program";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "navigation";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "dvd_menus";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "prev-title";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "next-title";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "prev-chapter";        pi_objects[i++] = p_object->i_object_id;        ppsz_varnames[i] = "next-chapter";        pi_objects[i++] = p_object->i_object_id;        vlc_object_release( p_object );    }

⌨️ 快捷键说明

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