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

📄 ncurses.c

📁 VLC Player Source Code
💻 C
📖 第 1 页 / 共 5 页
字号:
            /* Chapter */            if( !var_Get( p_input, "chapter", &val ) )            {                var_Change( p_input, "chapter", VLC_VAR_GETCHOICES, &val_list, NULL );                if( val_list.p_list->i_count > 0 )                {                    mvnprintw( y++, 0, COLS, _(" Chapter  : %d/%d"), val.i_int, val_list.p_list->i_count );                }                var_Change( p_input, "chapter", VLC_VAR_FREELIST, &val_list, NULL );            }        }        else        {            y += 2;        }    }    else    {        mvnprintw( y++, 0, COLS, _(" Source: <no current item> %s"), psz_state );        DrawEmptyLine( p_sys->w, y++, 0, COLS );        mvnprintw( y++, 0, COLS, _(" [ h for help ]") );        DrawEmptyLine( p_sys->w, y++, 0, COLS );    }    free( psz_state );    if( p_sys->b_color )        wcolor_set( p_sys->w, C_DEFAULT, NULL );    DrawBox( p_sys->w, y, 0, 3, COLS, "", p_sys->b_color );    DrawEmptyLine( p_sys->w, y+1, 1, COLS-2);    DrawLine( p_sys->w, y+1, 1, (int)(p_intf->p_sys->f_slider/100.0 * (COLS -2)) );    y += 3;    p_sys->i_box_y = y + 1;    p_sys->i_box_lines = LINES - y - 2;    h = LINES - y;    y_end = y + h - 1;    if( p_sys->i_box_type == BOX_HELP )    {        /* Help box */        int l = 0;        DrawBox( p_sys->w, y++, 0, h, COLS, _(" Help "), p_sys->b_color );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_CATEGORY, NULL );        MainBoxWrite( p_intf, l++, 1, _("[Display]") );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_DEFAULT, NULL );        MainBoxWrite( p_intf, l++, 1, _("     h,H         Show/Hide help box") );        MainBoxWrite( p_intf, l++, 1, _("     i           Show/Hide info box") );        MainBoxWrite( p_intf, l++, 1, _("     m           Show/Hide metadata box") );        MainBoxWrite( p_intf, l++, 1, _("     L           Show/Hide messages box") );        MainBoxWrite( p_intf, l++, 1, _("     P           Show/Hide playlist box") );        MainBoxWrite( p_intf, l++, 1, _("     B           Show/Hide filebrowser") );        MainBoxWrite( p_intf, l++, 1, _("     x           Show/Hide objects box") );        MainBoxWrite( p_intf, l++, 1, _("     S           Show/Hide statistics box" ) );        MainBoxWrite( p_intf, l++, 1, _("     c           Switch color on/off") );        MainBoxWrite( p_intf, l++, 1, _("     Esc         Close Add/Search entry") );        MainBoxWrite( p_intf, l++, 1, "" );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_CATEGORY, NULL );        MainBoxWrite( p_intf, l++, 1, _("[Global]") );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_DEFAULT, NULL );        MainBoxWrite( p_intf, l++, 1, _("     q, Q, Esc   Quit") );        MainBoxWrite( p_intf, l++, 1, _("     s           Stop") );        MainBoxWrite( p_intf, l++, 1, _("     <space>     Pause/Play") );        MainBoxWrite( p_intf, l++, 1, _("     f           Toggle Fullscreen") );        MainBoxWrite( p_intf, l++, 1, _("     n, p        Next/Previous playlist item") );        MainBoxWrite( p_intf, l++, 1, _("     [, ]        Next/Previous title") );        MainBoxWrite( p_intf, l++, 1, _("     <, >        Next/Previous chapter") );        MainBoxWrite( p_intf, l++, 1, _("     <right>     Seek +1%%") );        MainBoxWrite( p_intf, l++, 1, _("     <left>      Seek -1%%") );        MainBoxWrite( p_intf, l++, 1, _("     a           Volume Up") );        MainBoxWrite( p_intf, l++, 1, _("     z           Volume Down") );        MainBoxWrite( p_intf, l++, 1, "" );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_CATEGORY, NULL );        MainBoxWrite( p_intf, l++, 1, _("[Playlist]") );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_DEFAULT, NULL );        MainBoxWrite( p_intf, l++, 1, _("     r           Toggle Random playing") );        MainBoxWrite( p_intf, l++, 1, _("     l           Toggle Loop Playlist") );        MainBoxWrite( p_intf, l++, 1, _("     R           Toggle Repeat item") );        MainBoxWrite( p_intf, l++, 1, _("     o           Order Playlist by title") );        MainBoxWrite( p_intf, l++, 1, _("     O           Reverse order Playlist by title") );        MainBoxWrite( p_intf, l++, 1, _("     g           Go to the current playing item") );        MainBoxWrite( p_intf, l++, 1, _("     /           Look for an item") );        MainBoxWrite( p_intf, l++, 1, _("     A           Add an entry") );        MainBoxWrite( p_intf, l++, 1, _("     D, <del>    Delete an entry") );        MainBoxWrite( p_intf, l++, 1, _("     <backspace> Delete an entry") );        MainBoxWrite( p_intf, l++, 1, _("     e           Eject (if stopped)") );        MainBoxWrite( p_intf, l++, 1, "" );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_CATEGORY, NULL );        MainBoxWrite( p_intf, l++, 1, _("[Filebrowser]") );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_DEFAULT, NULL );        MainBoxWrite( p_intf, l++, 1, _("     <enter>     Add the selected file to the playlist") );        MainBoxWrite( p_intf, l++, 1, _("     <space>     Add the selected directory to the playlist") );        MainBoxWrite( p_intf, l++, 1, _("     .           Show/Hide hidden files") );        MainBoxWrite( p_intf, l++, 1, "" );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_CATEGORY, NULL );        MainBoxWrite( p_intf, l++, 1, _("[Boxes]") );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_DEFAULT, NULL );        MainBoxWrite( p_intf, l++, 1, _("     <up>,<down>     Navigate through the box line by line") );        MainBoxWrite( p_intf, l++, 1, _("     <pgup>,<pgdown> Navigate through the box page by page") );        MainBoxWrite( p_intf, l++, 1, "" );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_CATEGORY, NULL );        MainBoxWrite( p_intf, l++, 1, _("[Player]") );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_DEFAULT, NULL );        MainBoxWrite( p_intf, l++, 1, _("     <up>,<down>     Seek +/-5%%") );        MainBoxWrite( p_intf, l++, 1, "" );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_CATEGORY, NULL );        MainBoxWrite( p_intf, l++, 1, _("[Miscellaneous]") );        if( p_sys->b_color )            wcolor_set( p_sys->w, C_DEFAULT, NULL );        MainBoxWrite( p_intf, l++, 1, _("     Ctrl-l          Refresh the screen") );        p_sys->i_box_lines_total = l;        if( p_sys->i_box_start >= p_sys->i_box_lines_total )        {            p_sys->i_box_start = p_sys->i_box_lines_total - 1;        }        if( l - p_sys->i_box_start < p_sys->i_box_lines )        {            y += l - p_sys->i_box_start;        }        else        {            y += p_sys->i_box_lines;        }    }    else if( p_sys->i_box_type == BOX_INFO )    {        /* Info box */        int l = 0;        DrawBox( p_sys->w, y++, 0, h, COLS, _(" Information "), p_sys->b_color );        if( p_input )        {            int i,j;            vlc_mutex_lock( &input_GetItem(p_input)->lock );            for( i = 0; i < input_GetItem(p_input)->i_categories; i++ )            {                info_category_t *p_category = input_GetItem(p_input)->pp_categories[i];                if( y >= y_end ) break;                if( p_sys->b_color )                    wcolor_set( p_sys->w, C_CATEGORY, NULL );                MainBoxWrite( p_intf, l++, 1, _("  [%s]"), p_category->psz_name );                if( p_sys->b_color )                    wcolor_set( p_sys->w, C_DEFAULT, NULL );                for( j = 0; j < p_category->i_infos; j++ )                {                    info_t *p_info = p_category->pp_infos[j];                    if( y >= y_end ) break;                    MainBoxWrite( p_intf, l++, 1, _("      %s: %s"), p_info->psz_name, p_info->psz_value );                }            }            vlc_mutex_unlock( &input_GetItem(p_input)->lock );        }        else        {            MainBoxWrite( p_intf, l++, 1, _("No item currently playing") );        }        p_sys->i_box_lines_total = l;        if( p_sys->i_box_start >= p_sys->i_box_lines_total )        {            p_sys->i_box_start = p_sys->i_box_lines_total - 1;        }        if( l - p_sys->i_box_start < p_sys->i_box_lines )        {            y += l - p_sys->i_box_start;        }        else        {            y += p_sys->i_box_lines;        }    }    else if( p_sys->i_box_type == BOX_META )    {        /* Meta data box */        int l = 0;        DrawBox( p_sys->w, y++, 0, h, COLS, _("Meta-information"),                 p_sys->b_color );        if( p_input )        {            int i;            input_item_t *p_item = input_GetItem( p_input );            vlc_mutex_lock( &p_item->lock );            for( i=0; i<VLC_META_TYPE_COUNT; i++ )            {                if( y >= y_end ) break;                char *psz_meta = p_item->p_meta->ppsz_meta[i];                if( psz_meta && *psz_meta )                {                    const char *psz_meta_title;                    switch( i )                    {                        case 0:                            psz_meta_title = VLC_META_TITLE; break;                        case 1:                            psz_meta_title = VLC_META_ARTIST; break;                        case 2:                            psz_meta_title = VLC_META_GENRE ; break;                        case 3:                            psz_meta_title = VLC_META_COPYRIGHT; break;                        case 4:                            psz_meta_title = VLC_META_ALBUM; break;                        case 5:                            psz_meta_title = VLC_META_TRACK_NUMBER; break;                        case 6:                            psz_meta_title = VLC_META_DESCRIPTION; break;                        case 7:                            psz_meta_title = VLC_META_RATING; break;                        case 8:                            psz_meta_title = VLC_META_DATE; break;                        case 9:                            psz_meta_title = VLC_META_SETTING; break;                        case 10:                            psz_meta_title = VLC_META_URL; break;                        case 11:                            psz_meta_title = VLC_META_LANGUAGE; break;                        case 12:                            psz_meta_title = VLC_META_NOW_PLAYING; break;                        case 13:                            psz_meta_title = VLC_META_PUBLISHER; break;                        case 14:                            psz_meta_title = VLC_META_ENCODED_BY; break;                        case 15:                            psz_meta_title = VLC_META_ART_URL; break;                        case 16:                            psz_meta_title = VLC_META_TRACKID; break;                        default:                            psz_meta_title = ""; break;                    }                    if( p_sys->b_color )                        wcolor_set( p_sys->w, C_CATEGORY, NULL );                    MainBoxWrite( p_intf, l++, 1, "  [%s]", psz_meta_title );                    if( p_sys->b_color )                        wcolor_set( p_sys->w, C_DEFAULT, NULL );                    MainBoxWrite( p_intf, l++, 1, "      %s", psz_meta );                }            }            vlc_mutex_unlock( &p_item->lock );        }        else        {            MainBoxWrite( p_intf, l++, 1, _("No item currently playing") );        }        p_sys->i_box_lines_total = l;        if( p_sys->i_box_start >= p_sys->i_box_lines_total )        {            p_sys->i_box_start = p_sys->i_box_lines_total - 1;        }        if( l - p_sys->i_box_start < p_sys->i_box_lines )        {            y += l - p_sys->i_box_start;        }        else        {            y += p_sys->i_box_lines;        }    }    else if( p_sys->i_box_type == BOX_LOG )    {        int i_line = 0;        int i_stop;        int i_start;        DrawBox( p_sys->w, y++, 0, h, COLS, _(" Logs "), p_sys->b_color );        i_start = p_intf->p_sys->p_sub->i_start;        vlc_mutex_lock( p_intf->p_sys->p_sub->p_lock );        i_stop = *p_intf->p_sys->p_sub->pi_stop;        vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock );        for( ;; )        {            static const char *ppsz_type[4] = { "", "error", "warning", "debug" };            if( i_line >= h - 2 )            {                break;            }            i_stop--;            i_line++;            if( i_stop < 0 ) i_stop += VLC_MSG_QSIZE;            if( i_stop == i_start )            {                break;            }            if( p_sys->b_color )                wcolor_set( p_sys->w,                    p_sys->p_sub->p_msg[i_stop].i_type + C_INFO,                    NULL );            mvnprintw( y + h-2-i_line, 1, COLS - 2, "   [%s] %s",                      ppsz_type[p_sys->p_sub->p_msg[i_stop].i_type],                      p_sys->p_sub->p_msg[i_stop].psz_msg );            if( p_sys->b_color )                wcolor_set( p_sys->w, C_DEFAULT, NULL );        }        vlc_mutex_lock( p_intf->p_sys->p_sub->p_lock );        p_intf->p_sys->p_sub->i_start = i_stop;        vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock );        y = y_end;    }    else if( p_sys->i_box_type == BOX_BROWSE )    {        /* Filebrowser box */        int        i_start, i_stop;        int        i_item;        DrawBox( p_sys->w, y++, 0, h, COLS, _(" Browse "), p_sys->b_color );        if( p_sys->i_box_bidx >= p_sys->i_dir_entries ) p_sys->i_box_plidx = p_sys->i_dir_entries - 1;        if( p_sys->i_box_bidx < 0 ) p_sys->i_box_bidx = 0;        if( p_sys->i_box_bidx < (h - 2)/2 )        {            i_start = 0;            i_stop = h - 2;        }        else if( p_sys->i_dir_entries - p_sys->i_box_bidx > (h - 2)/2 )        {            i_start = p_sys->i_box_bidx - (h - 2)/2;            i_stop = i_start + h - 2;        }        else        {            i_stop = p_sys->i_dir_entries;            i_start = p_sys->i_dir_entries - (h - 2);        }        if( i_start < 0 )        {            i_start = 0;        }        if( i_stop > p_sys->i_dir_entries )        {            i_stop = p_sys->i_dir_entries;        }        for( i_item = i_start; i_item < i_stop; i_item++ )        {            bool b_selected = ( p_sys->i_box_bidx == i_item );            if( y >= y_end ) break;            if( b_selected )            {                attrset( A_REVERSE );            }            if( p_sys->b_color && !p_sys->pp_dir_entries[i_item]->b_file )                wcolor_set( p_sys->w, C_FOLDER, NULL );            mvnprintw( y++, 1, COLS - 2, " %c %s", p_sys->pp_dir_entries[i_item]->b_file == true ? ' ' : '+',                            p_sys->pp_dir_entries[i_item]->psz_path );            if( p_sys->b_color && !p_sys->pp_dir_entries[i_item]->b_file )                wcolor_set( p_sys->w, C_DEFAULT, NULL );            if( b_selected )            {                attroff( A_REVERSE );            }        }    }    else if( p_sys->i_box_type == BOX_OBJECTS )    {        int l = 0;        DrawBox( p_sys->w, y++, 0, h, COLS, _(" Objects "), p_sys->b_color );        DumpObject( p_intf, &l, VLC_OBJECT( p_intf->p_libvlc ), 0 );        p_sys->i_box_lines_total = l;        if( p_sys->i_box_start >= p_sys->i_box_lines_total )            p_sys->i_box_start = p_sys->i_box_lines_total - 1;        if( l - p_sys->i_box_start < p_sys->i_box_lines )            y += l - p_sys->i_box_start;        else            y += p_sys->i_box_lines;    }    else if( p_s

⌨️ 快捷键说明

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