?? cpi_playlistwindow.c
字號(hào):
case PLAYLIST_COMMENT:
CPLI_SetComment(hPlaylistItem, pcEditText);
break;
}
}
free(pcEditText);
}
}
//
//
//
void CPlaylistWindow_WM_COMMAND_IDC_PL_FLOATINGCOMBO(WPARAM wParam, LPARAM lParam)
{
if(HIWORD(wParam) == CBN_KILLFOCUS)
{
// Floating combo control looses focus - destroy it (after breaking out of kill focus context)
IF_PostAppMessage(windows.m_hifPlaylist, CPPLM_DESTROYINPLACE, 0L, 0L);
}
else if(HIWORD(wParam) == CBN_SELCHANGE && globals.m_bIP_InhibitUpdates == FALSE)
{
int iSearchItemIDX;
int iSelectedItemIDX;
unsigned char cNewGenre;
iSelectedItemIDX = SendMessage(windows.wnd_playlist_IPEdit, CB_GETCURSEL, 0L, 0L);
cNewGenre = (unsigned char)SendMessage(windows.wnd_playlist_IPEdit, CB_GETITEMDATA, (WPARAM)iSelectedItemIDX, 0L);
// Update all of the selected items
iSearchItemIDX = CLV_GetNextSelectedItem(globals.m_hPlaylistViewControl, CPC_INVALIDITEM);
for(;iSearchItemIDX != -1; iSearchItemIDX = CLV_GetNextSelectedItem(globals.m_hPlaylistViewControl, iSearchItemIDX))
{
CP_HPLAYLISTITEM hPlaylistItem = (CP_HPLAYLISTITEM)CLV_GetItemData(globals.m_hPlaylistViewControl, iSearchItemIDX);
CPLI_SetGenreIDX(hPlaylistItem, cNewGenre);
}
}
}
//
//
//
void LVCB_DrawBackgroundRect(CPs_DrawContext* pDC)
{
RECT rClient;
GetClientRect(IF_GetHWnd(windows.m_hifPlaylist), &rClient);
// Draw the window background
CPIG_TiledFill(pDC, &rClient, &glb_pSkin->mpl_rBackground_SourceTile, glb_pSkin->mpl_pBackground, CIC_TILEDFILOPTIONS_NONE);
}
//
//
//
void CPlaylistWindow_CB_onClose(CP_HINTERFACE hInterface)
{
options.show_playlist = FALSE;
CPlaylistWindow_SetVisible(FALSE);
}
//
//
//
void LVCB_HeaderChanged(CP_HLISTVIEW _hListData)
{
CLV_GetColumnOrder(_hListData, options.playlist_column_seq, PLAYLIST_last + 1);
CLV_GetColumnWidths(_hListData, options.playlist_column_widths, PLAYLIST_last + 1);
CLV_GetColumnVisibleState(_hListData, options.playlist_column_visible, PLAYLIST_last + 1);
}
//
//
//
void LVCB_ItemSelected(CP_HLISTVIEW _hListData, const int iItemIDX, const CP_HPLAYLISTITEM hItem)
{
if(options.read_id3_tag_of_selected)
CPLI_ReadTag(hItem);
}
//
//
//
void LVCB_ItemAction(CP_HLISTVIEW _hListData, const int iItemIDX, const CP_HPLAYLISTITEM hItem)
{
// Setup & play the active item
if(CPL_Stack_GetItemState(globals.m_hPlaylist, hItem) == issUnstacked)
{
CPL_Stack_ClipFromCurrent(globals.m_hPlaylist);
CPL_Stack_Append(globals.m_hPlaylist, hItem);
CPL_SetActiveItem(globals.m_hPlaylist, hItem);
CPL_PlayItem(globals.m_hPlaylist, TRUE, pmCurrentItem);
}
else
{
CPL_SetActiveItem(globals.m_hPlaylist, hItem);
CPL_PlayItem(globals.m_hPlaylist, TRUE, pmCurrentItem);
}
}
//
//
//
void LVCB_ItemDrag(CP_HLISTVIEW _hListData, const int iItemIDX, const CP_HPLAYLISTITEM hItem)
{
globals.main_drag_anchor_point = iItemIDX;
IF_SetMouseCapture(windows.m_hifPlaylist, CPlaylistWindow_CB_onMouseMove, CPlaylistWindow_CB_onMouseButton_LUp);
}
//
//
//
void LVCB_ColHeaderClick(CP_HLISTVIEW _hListData, const int iColIDX)
{
// Work out assending or decending
BOOL bDesc;
if(iColIDX == globals.m_iLastPlaylistSortColoumn)
{
globals.m_iLastPlaylistSortColoumn = -1;
bDesc = TRUE;
}
else
{
globals.m_iLastPlaylistSortColoumn = iColIDX;
bDesc = FALSE;
}
// Perform sorting
switch(iColIDX)
{
case PLAYLIST_TRACKSTACK:
CPL_SortList(globals.m_hPlaylist, piseTrackStackPos, FALSE);
break;
case PLAYLIST_TITLE:
CPL_SortList(globals.m_hPlaylist, piseTrackName, bDesc);
break;
case PLAYLIST_ARTIST:
CPL_SortList(globals.m_hPlaylist, piseArtist, bDesc);
break;
case PLAYLIST_ALBUM:
CPL_SortList(globals.m_hPlaylist, piseAlbum, bDesc);
break;
case PLAYLIST_YEAR:
CPL_SortList(globals.m_hPlaylist, piseYear, bDesc);
break;
case PLAYLIST_TRACKNUM:
CPL_SortList(globals.m_hPlaylist, piseTrackNum, bDesc);
break;
case PLAYLIST_COMMENT:
CPL_SortList(globals.m_hPlaylist, piseComment, bDesc);
break;
case PLAYLIST_GENRE:
CPL_SortList(globals.m_hPlaylist, piseGenre, bDesc);
break;
case PLAYLIST_PATH:
CPL_SortList(globals.m_hPlaylist, pisePath, bDesc);
break;
case PLAYLIST_FILENAME:
CPL_SortList(globals.m_hPlaylist, piseFilename, bDesc);
break;
case PLAYLIST_LENGTH:
CPL_SortList(globals.m_hPlaylist, piseLength, bDesc);
break;
}
}
//
//
//
void LVCB_ItemRightClick(CP_HLISTVIEW _hListData, const int iItemIDX, const int iColumnIDX, const CP_HPLAYLISTITEM hItem)
{
IF_PostAppMessage(windows.m_hifPlaylist, CPPLM_CREATEINPLACE, (WPARAM)iItemIDX, (LPARAM)iColumnIDX);
}
//
//
//
void LVCB_UnhandledKeyPress(CP_HLISTVIEW _hListData, const int iVKey, const BOOL bAlt, const BOOL bCtrl, const BOOL bShift)
{
CP_HandleKeyPress_Playlist(windows.m_hWndPlaylist, iVKey, bAlt, bCtrl, bShift);
}
//
//
//
void CPlaylistWindow_ClearSelectedItems()
{
int iSearchItemIDX;
int iFocusItem;
CLV_BeginBatch(globals.m_hPlaylistViewControl);
iSearchItemIDX = CLV_GetNextSelectedItem(globals.m_hPlaylistViewControl, CPC_INVALIDITEM);
while(iSearchItemIDX != CPC_INVALIDITEM)
{
CP_HPLAYLISTITEM hItem = (CP_HPLAYLISTITEM)CLV_GetItemData(globals.m_hPlaylistViewControl, iSearchItemIDX);
CPL_RemoveItem(globals.m_hPlaylist, hItem);
iSearchItemIDX = CLV_GetNextSelectedItem(globals.m_hPlaylistViewControl, CPC_INVALIDITEM);
}
iFocusItem = CLV_GetFocusItem(globals.m_hPlaylistViewControl);
if(iFocusItem != CPC_INVALIDITEM)
CLV_SetItemSelected(globals.m_hPlaylistViewControl, iFocusItem, TRUE);
CLV_EndBatch(globals.m_hPlaylistViewControl);
}
//
//
//
void CPlaylistWindow_CB_onCreate(CP_HINTERFACE hInterface, const RECT* pInitialPosition)
{
CPlaylistWindow_CreateListView();
}
//
//
//
void CPlaylistWindow_CB_onDraw(CP_HINTERFACE hInterface, CPs_DrawContext* pContext)
{
RECT rClient;
// Draw the window background
GetClientRect(IF_GetHWnd(windows.m_hifPlaylist), &rClient);
CPIG_TiledFill(pContext, &rClient, &glb_pSkin->mpl_rBackground_SourceTile, glb_pSkin->mpl_pBackground, CIC_TILEDFILOPTIONS_NONE);
}
//
//
//
void CPlaylistWindow_CB_onKeyDown(CP_HINTERFACE hInterface, const unsigned int iVKeyCode, const BOOL bAlt, const BOOL bCtrl, const BOOL bShift)
{
CP_HandleKeyPress_Playlist(NULL, iVKeyCode, bAlt, bCtrl, bShift);
}
//
//
//
void CPlaylistWindow_CB_onDropFiles(CP_HINTERFACE hInterface, HDROP hDrop)
{
CPL_SyncLoadNextFile(globals.m_hPlaylist);
CPL_AddDroppedFiles(globals.m_hPlaylist, hDrop);
}
//
//
//
void CPlaylistWindow_CB_onPosChange(CP_HINTERFACE hInterface, const RECT* pNewPosition, const BOOL bSizeChanged)
{
options.playlist_window_pos = *pNewPosition;
if(bSizeChanged)
{
SIZE szWindow;
szWindow.cx = pNewPosition->right - pNewPosition->left;
szWindow.cy = pNewPosition->bottom - pNewPosition->top;
MoveWindow(CLV_GetHWND(globals.m_hPlaylistViewControl),
glb_pSkin->mpl_rList_Border.left,
glb_pSkin->mpl_rList_Border.top,
(szWindow.cx - glb_pSkin->mpl_rList_Border.right) - glb_pSkin->mpl_rList_Border.left,
(szWindow.cy - glb_pSkin->mpl_rList_Border.bottom) - glb_pSkin->mpl_rList_Border.top,
TRUE);
}
}
//
//
//
void CPlaylistWindow_CB_onFocus(CP_HINTERFACE hInterface, const BOOL bHasFocus)
{
if(bHasFocus == TRUE)
SetFocus(CLV_GetHWND(globals.m_hPlaylistViewControl));
}
//
//
//
void CPlaylistWindow_CB_onCommandMessage(CP_HINTERFACE hInterface, const WPARAM wParam, const LPARAM lParam)
{
if(LOWORD(wParam) == IDC_PL_FLOATINGEDIT)
CPlaylistWindow_WM_COMMAND_IDC_PL_FLOATINGEDIT(wParam, lParam);
else if(LOWORD(wParam) == IDC_PL_FLOATINGCOMBO)
CPlaylistWindow_WM_COMMAND_IDC_PL_FLOATINGCOMBO(wParam, lParam);
}
//
//
//
LRESULT CPlaylistWindow_CB_onAppMessage(CP_HINTERFACE hInterface, const UINT uiMessage, const WPARAM wParam, const LPARAM lParam)
{
if(uiMessage == CPPLM_CREATEINPLACE)
{
int iItem = (int)wParam;
int iSubItem = (int)lParam;
CPlaylistWindow_DestroyIPEdit();
// It's a hit - create sub control (for IP controls)
if(iItem != CPC_INVALIDITEM && iSubItem != CPC_INVALIDCOLUMN)
{
if(iSubItem != PLAYLIST_TRACKSTACK
&& iSubItem != PLAYLIST_PATH
&& iSubItem != PLAYLIST_FILENAME)
{
CPlaylistWindow_CreateIPEdit(iItem, iSubItem);
}
else if(iSubItem == PLAYLIST_TRACKSTACK)
{
CPlaylistWindow_TrackStackMenu(iItem);
}
else if(iSubItem == PLAYLIST_PATH || iSubItem == PLAYLIST_FILENAME)
{
CPlaylistWindow_RenameMenu(iItem, iSubItem);
}
}
}
else if(uiMessage == CPPLM_DESTROYINPLACE)
CPlaylistWindow_DestroyIPEdit();
return 0;
}
//
//
//
CPe_CustomDrawColour LVCB_GetTrackStackItemColour(const void* pvItemData)
{
CP_HPLAYLISTITEM hItem = (CP_HPLAYLISTITEM)pvItemData;
int iTrackStackPos;
iTrackStackPos = CPLI_GetTrackStackPos(hItem);
if(iTrackStackPos == CIC_TRACKSTACK_UNSTACKED)
return cdcNormal;
else if(iTrackStackPos == 0)
return cdcHighlighted;
else if(iTrackStackPos < 0)
return cdcLowlighted;
return cdcNormal;
}
//
//
//
CPe_CustomDrawColour LVCB_GetItemColour(const void* pvItemData)
{
CP_HPLAYLISTITEM hItem = (CP_HPLAYLISTITEM)pvItemData;
if(CPLI_GetTrackStackPos(hItem) == 0)
return cdcHighlighted;
return cdcNormal;
}
//
//
//
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -