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

📄 cpi_verbs.c

📁 VC++视频开发实例集锦(包括“远程视频监控”"语音识别系统"等13个经典例子)
💻 C
📖 第 1 页 / 共 2 页
字号:

////////////////////////////////////////////////////////////////////////////////



#include "stdafx.h"
#include "globals.h"
#include "resource.h"
#include "CPI_Playlist.h"
#include "CPI_PlaylistWindow.h"
#include "DLG_Find.h"
#include "CPI_Player.h"


////////////////////////////////////////////////////////////////////////////////
//
wp_Verb glb_pfnAllVerbs[] = {

                                CPVERB_TogglePlaylistWindow,
                                CPVERB_ToggleRepeat,
                                CPVERB_ToggleShuffle,
                                CPVERB_ToggleEqualiser,
                                CPVERB_ToggleFindDialog,

                                CPVERB_PlaylistClearSelected,
                                CPVERB_PlaylistClearAll,

                                CPVERB_Play,
                                CPVERB_Stop,
                                CPVERB_Pause,
                                CPVERB_NextTrack,
                                CPVERB_PrevTrack,
                                CPVERB_SkipForwards,
                                CPVERB_SkipBackwards,
                                CPVERB_VolumeUp,
                                CPVERB_VolumeDown,

                                CPVERB_OpenFile,
                                CPVERB_About,
                                CPVERB_Exit,

                                CPVERB_SavePlaylist,
                                CPVERB_PlaylistShuffle,
                                CPVERB_PlaylistOffsetUp,
                                CPVERB_PlaylistOffsetDown,
                                CPVERB_AddDirectory,
                                CPVERB_PlaylistMinimise,
                                CPVERB_PlaylistMaximise,

                                NULL
                            };
//
////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////
//
//
//
void CPVERB_TogglePlaylistWindow(const CPe_VerbAction enAction, void* _pParam)
{
    if(enAction == vaDoVerb)
    {
        options.show_playlist = !options.show_playlist;
        CPlaylistWindow_SetVisible(options.show_playlist);
    }
    else if(enAction == vaQueryName)
    {
        CPs_VerbQueryName* pParam = (CPs_VerbQueryName*)_pParam;

        if(stricmp(pParam->m_pcName, "TogglePlaylistWindow") == 0)
            pParam->m_bNameMatched = TRUE;
    }
}
//
//
//
void CPVERB_ToggleRepeat(const CPe_VerbAction enAction, void* _pParam)
{
    if(enAction == vaDoVerb)
    {
        options.repeat_playlist = !options.repeat_playlist;
        InvalidateRect(windows.wnd_main, NULL, FALSE);
    }
    else if(enAction == vaQueryName)
    {
        CPs_VerbQueryName* pParam = (CPs_VerbQueryName*)_pParam;

        if(stricmp(pParam->m_pcName, "ToggleRepeat") == 0)
            pParam->m_bNameMatched = TRUE;
    }
}
//
//
//
void CPVERB_ToggleShuffle(const CPe_VerbAction enAction, void* _pParam)
{
    if(enAction == vaDoVerb)
    {
 		options.shuffle_play = !options.shuffle_play;
   
		if(options.shuffle_play)
		{
			CPL_Stack_Shuffle(globals.m_hPlaylist, FALSE);
		}else
		{
			CPL_Stack_RestackAll(globals.m_hPlaylist);
		}
        InvalidateRect(windows.wnd_main, NULL, FALSE);
    }
    else if(enAction == vaQueryName)
    {
        CPs_VerbQueryName* pParam = (CPs_VerbQueryName*)_pParam;

        if(stricmp(pParam->m_pcName, "ToggleShuffle") == 0)
            pParam->m_bNameMatched = TRUE;
    }
}
//
//
//
void CPVERB_ToggleEqualiser(const CPe_VerbAction enAction, void* _pParam)
{
    if(enAction == vaDoVerb)
    {
        options.equalizer = !options.equalizer;
        main_set_eq();
        InvalidateRect(windows.wnd_main, NULL, FALSE);
    }
    else if(enAction == vaQueryName)
    {
        CPs_VerbQueryName* pParam = (CPs_VerbQueryName*)_pParam;

        if(stricmp(pParam->m_pcName, "ToggleEqualiser") == 0)
            pParam->m_bNameMatched = TRUE;
    }
}
//
//
//
void CPVERB_ToggleFindDialog(const CPe_VerbAction enAction, void* _pParam)
{
    if(enAction == vaDoVerb)
    {
        if(windows.m_hWndFindDialog == NULL)
        {
            windows.m_hWndFindDialog = CreateDialog(	GetModuleHandle(NULL),
                                       MAKEINTRESOURCE(IDD_QUICKFIND),
                                       windows.wnd_main,
                                       wp_FindDialog);
        }
        else
            SendMessage(windows.m_hWndFindDialog, WM_CLOSE, 0L, 0L);
    }
    else if(enAction == vaQueryName)
    {
        CPs_VerbQueryName* pParam = (CPs_VerbQueryName*)_pParam;

        if(stricmp(pParam->m_pcName, "ToggleFindDialog") == 0)
            pParam->m_bNameMatched = TRUE;
    }
}
//
//
//
void CPVERB_PlaylistClearSelected(const CPe_VerbAction enAction, void* _pParam)
{
    if(enAction == vaDoVerb)
        CPlaylistWindow_ClearSelectedItems();
    else if(enAction == vaQueryName)
    {
        CPs_VerbQueryName* pParam = (CPs_VerbQueryName*)_pParam;

        if(stricmp(pParam->m_pcName, "PlaylistClearSelected") == 0)
            pParam->m_bNameMatched = TRUE;
    }
}


//
//
//
void CPVERB_PlaylistClearAll(const CPe_VerbAction enAction, void* _pParam)
{
    if(enAction == vaDoVerb)
        CPL_Empty(globals.m_hPlaylist);
    else if(enAction == vaQueryName)
    {
        CPs_VerbQueryName* pParam = (CPs_VerbQueryName*)_pParam;

        if(stricmp(pParam->m_pcName, "PlaylistClearAll") == 0)
            pParam->m_bNameMatched = TRUE;
    }
}
//
//
//
void CPVERB_Play(const CPe_VerbAction enAction, void* _pParam)
{
    if(enAction == vaDoVerb)
    {
        if(globals.m_enPlayerState == cppsPaused)
            CPI_Player__Play(globals.m_hPlayer);
        else
            CPL_PlayItem(globals.m_hPlaylist, TRUE, pmCurrentItem);
    }
    else if(enAction == vaQueryName)
    {
        CPs_VerbQueryName* pParam = (CPs_VerbQueryName*)_pParam;

        if(stricmp(pParam->m_pcName, "Play") == 0)
            pParam->m_bNameMatched = TRUE;
    }
}
//
//
//
void CPVERB_Stop(const CPe_VerbAction enAction, void* _pParam)
{
    if(enAction == vaDoVerb)
    {
        CPI_Player__Stop(globals.m_hPlayer);
        globals.main_bool_wavwrite_dir_already_known = FALSE;
    }
    else if(enAction == vaQueryName)
    {
        CPs_VerbQueryName* pParam = (CPs_VerbQueryName*)_pParam;

        if(stricmp(pParam->m_pcName, "Stop") == 0)
            pParam->m_bNameMatched = TRUE;
    }
}
//
//
//
void CPVERB_Pause(const CPe_VerbAction enAction, void* _pParam)
{
    if(enAction == vaDoVerb)
    {
        if(globals.m_enPlayerState == cppsPaused)
            CPI_Player__Play(globals.m_hPlayer);
        else
            CPI_Player__Pause(globals.m_hPlayer);
    }
    else if(enAction == vaQueryName)
    {
        CPs_VerbQueryName* pParam = (CPs_VerbQueryName*)_pParam;

        if(stricmp(pParam->m_pcName, "Pause") == 0)
            pParam->m_bNameMatched = TRUE;
    }
}
//
//
//
void CPVERB_NextTrack(const CPe_VerbAction enAction, void* _pParam)
{
    if(enAction == vaDoVerb)
        CPL_PlayItem(globals.m_hPlaylist, TRUE, pmNextItem);
    else if(enAction == vaQueryName)
    {
        CPs_VerbQueryName* pParam = (CPs_VerbQueryName*)_pParam;

        if(stricmp(pParam->m_pcName, "NextTrack") == 0)
            pParam->m_bNameMatched = TRUE;
    }
}
//
//
//
void CPVERB_PrevTrack(const CPe_VerbAction enAction, void* _pParam)
{
    if(enAction == vaDoVerb)
        CPL_PlayItem(globals.m_hPlaylist, TRUE, pmPrevItem);
    else if(enAction == vaQueryName)
    {
        CPs_VerbQueryName* pParam = (CPs_VerbQueryName*)_pParam;

        if(stricmp(pParam->m_pcName, "PrevTrack") == 0)
            pParam->m_bNameMatched = TRUE;
    }
}
//

⌨️ 快捷键说明

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