CPI_Keyboard.c
资源名称:VC++视频传输.rar [点击查看]
上传用户:hxb_1234
上传日期:2010-03-30
资源大小:8328k
文件大小:5k
源码类别:
VC书籍
开发平台:
Visual C++
- ////////////////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "globals.h"
- #include "resource.h"
- #include "CPI_Player.h"
- #include "CPI_Playlist.h"
- #include "CPI_PlaylistItem.h"
- ////////////////////////////////////////////////////////////////////////////////
- //
- //
- //
- void CP_HandleKeyPress_Playlist(HWND hWnd, const int iVKey, const BOOL bAlt, const BOOL bCtrl, const BOOL bShift)
- {
- switch(iVKey)
- {
- case 'F':
- CPVERB_ToggleFindDialog(vaDoVerb, hWnd);
- return;
- case 'H':
- CPVERB_PlaylistShuffle(vaDoVerb, hWnd);
- return;
- case 'V':
- CPVERB_SavePlaylist(vaDoVerb, hWnd);
- return;
- case 'D':
- CPVERB_AddDirectory(vaDoVerb, hWnd);
- return;
- case VK_DELETE:
- case VK_BACK:
- if(bCtrl)
- CPVERB_PlaylistClearAll(vaDoVerb, hWnd);
- else
- CPVERB_PlaylistClearSelected(vaDoVerb, hWnd);
- return;
- case VK_UP:
- if(bAlt)
- {
- CPVERB_PlaylistOffsetUp(vaDoVerb, hWnd);
- return;
- }
- break;
- case VK_DOWN:
- if(bAlt)
- {
- CPVERB_PlaylistOffsetDown(vaDoVerb, hWnd);
- return;
- }
- break;
- case VK_ADD:
- if(bAlt)
- {
- CPVERB_PlaylistMaximise(vaDoVerb, hWnd);
- return;
- }
- break;
- case VK_SUBTRACT:
- if(bAlt)
- {
- CPVERB_PlaylistMinimise(vaDoVerb, hWnd);
- return;
- }
- break;
- }
- CP_HandleKeyPress_Player(hWnd, iVKey, bAlt, bCtrl, bShift);
- }
- //
- //
- //
- void CP_HandleKeyPress_Player(HWND hWnd, const int iVKey, const BOOL bAlt, const BOOL bCtrl, const BOOL bShift)
- {
- switch(iVKey)
- {
- case 'P':
- CPVERB_TogglePlaylistWindow(vaDoVerb, hWnd);
- break;
- case 'E':
- case 'Q':
- CPVERB_ToggleEqualiser(vaDoVerb, hWnd);
- break;
- case 'S':
- CPVERB_ToggleShuffle(vaDoVerb, hWnd);
- break;
- case 'R':
- CPVERB_ToggleRepeat(vaDoVerb, hWnd);
- break;
- case 'X':
- case VK_RETURN:
- case VK_NUMPAD5:
- CPVERB_Play(vaDoVerb, hWnd);
- break;
- case 'V':
- case VK_DECIMAL:
- CPVERB_Stop(vaDoVerb, hWnd);
- break;
- case 'C':
- case VK_PAUSE:
- case VK_NUMPAD0:
- CPVERB_Pause(vaDoVerb, hWnd);
- break;
- case 'B':
- case VK_NUMPAD6:
- CPVERB_NextTrack(vaDoVerb, hWnd);
- break;
- case 'Z':
- case VK_NUMPAD4:
- CPVERB_PrevTrack(vaDoVerb, hWnd);
- break;
- case VK_LEFT:
- if(bCtrl)
- CPVERB_PrevTrack(vaDoVerb, hWnd);
- else
- CPVERB_SkipBackwards(vaDoVerb, hWnd);
- break;
- case VK_RIGHT:
- if(bCtrl)
- CPVERB_NextTrack(vaDoVerb, hWnd);
- else
- CPVERB_SkipForwards(vaDoVerb, hWnd);
- break;
- case VK_ADD:
- case VK_NUMPAD8:
- case VK_UP:
- if(!bAlt)
- CPVERB_VolumeUp(vaDoVerb, hWnd);
- break;
- case VK_SUBTRACT:
- case VK_NUMPAD2:
- case VK_DOWN:
- if(!bAlt)
- CPVERB_VolumeDown(vaDoVerb, hWnd);
- break;
- case '0':
- case 'M':
- case VK_TAB:
- globals.m_iVolume=0;
- main_draw_vu_from_value(windows.wnd_main, VolumeSlider, globals.m_iVolume);
- CPI_Player__SetVolume(globals.m_hPlayer, globals.m_iVolume);
- break;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- globals.m_iVolume=10 + ((iVKey-'1') * 10);
- main_draw_vu_from_value(windows.wnd_main, VolumeSlider, globals.m_iVolume);
- CPI_Player__SetVolume(globals.m_hPlayer, globals.m_iVolume);
- break;
- case VK_F1:
- CPVERB_About(vaDoVerb, hWnd);
- break;
- case VK_F4:
- if(bAlt)
- CPVERB_Exit(vaDoVerb, hWnd);
- else if(bCtrl)
- CPVERB_TogglePlaylistWindow(vaDoVerb, hWnd);
- break;
- case VK_ESCAPE:
- CPVERB_Exit(vaDoVerb, hWnd);
- break;
- case 'L':
- case 'O':
- CPVERB_OpenFile(vaDoVerb, hWnd);
- break;
- case VK_DELETE:
- if(bShift)
- {
- CP_HPLAYLISTITEM hCurrent = CPL_GetActiveItem(globals.m_hPlaylist);
- CPVERB_Stop(vaDoVerb, hWnd);
- if(hCurrent)
- {
- const char *pcText = CPLI_GetPath(hCurrent);
- DeleteFile(pcText);
- CPL_RemoveItem(globals.m_hPlaylist, hCurrent);
- }
- }
- break;
- }
- }
- //
- //
- //