[MPLAY32]:

- Improve the app's title by printing the filename and the current state of the player. By Ricardo Hanke.
- Fix pause state retrieval.

svn path=/trunk/; revision=66746
This commit is contained in:
Hermès Bélusca-Maïto 2015-03-16 21:16:07 +00:00
parent be7e5a84eb
commit 1cd9362c3a
24 changed files with 281 additions and 17 deletions

View file

@ -47,6 +47,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Всички поддържани"
IDS_TOOLTIP_PLAY "Пускане"
IDS_TOOLTIP_STOP "Спиране"

View file

@ -48,6 +48,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Všechny podporované"
IDS_TOOLTIP_PLAY "Přehrát"
IDS_TOOLTIP_STOP "Zastavit"

View file

@ -43,6 +43,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unbekannt"
IDS_MODE_OPEN "Geöffnet"
IDS_MODE_STOP "Angehalten"
IDS_MODE_PLAY "Wiedergabe"
IDS_MODE_PAUSE "Pause"
IDS_MODE_RECORD "Aufnehmen"
IDS_MODE_SEEK "Spulen"
IDS_MODE_NOT_READY "Nicht bereit"
IDS_ALL_TYPES_FILTER "Alle unterstützten"
IDS_TOOLTIP_PLAY "Wiedergabe"
IDS_TOOLTIP_STOP "Stopp"

View file

@ -43,6 +43,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "All Supported"
IDS_TOOLTIP_PLAY "Play"
IDS_TOOLTIP_STOP "Stop"

View file

@ -43,6 +43,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Todos los archivos soportados"
IDS_TOOLTIP_PLAY "Reproducir"
IDS_TOOLTIP_STOP "Detener"

View file

@ -43,6 +43,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Inconnu"
IDS_MODE_OPEN "Ouvert"
IDS_MODE_STOP "Arrêté"
IDS_MODE_PLAY "Lecture"
IDS_MODE_PAUSE "En pause"
IDS_MODE_RECORD "Enregistrement"
IDS_MODE_SEEK "Recherche"
IDS_MODE_NOT_READY "Pas prêt"
IDS_ALL_TYPES_FILTER "Tous les types supportés"
IDS_TOOLTIP_PLAY "Lecture"
IDS_TOOLTIP_STOP "Stop"

View file

@ -43,6 +43,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "כל הקבצים הנתמכים"
IDS_TOOLTIP_PLAY "נגן"
IDS_TOOLTIP_STOP "עצור"

View file

@ -43,6 +43,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Tutti i tipi supportati"
IDS_TOOLTIP_PLAY "Riproduci"
IDS_TOOLTIP_STOP "Interrompi"

View file

@ -43,6 +43,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "すべてのサポートされたファイル"
IDS_TOOLTIP_PLAY "再生"
IDS_TOOLTIP_STOP "停止"

View file

@ -43,6 +43,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Mediabestanden"
IDS_TOOLTIP_PLAY "Afspelen"
IDS_TOOLTIP_STOP "Stoppen"

View file

@ -43,6 +43,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Alle kompaktible filer"
IDS_TOOLTIP_PLAY "Spill av"
IDS_TOOLTIP_STOP "Stopp"

View file

@ -51,6 +51,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Wszystkie formaty"
IDS_TOOLTIP_PLAY "Odtwarzaj"
IDS_TOOLTIP_STOP "Zatrzymaj"

View file

@ -45,6 +45,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Todos os formatos"
IDS_TOOLTIP_PLAY "Executar"
IDS_TOOLTIP_STOP "Pausar"

View file

@ -49,6 +49,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Toate admisibile"
IDS_TOOLTIP_PLAY "Redare conținut multimedia"
IDS_TOOLTIP_STOP "Oprirea lecturii"

View file

@ -43,6 +43,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Все поддерживаемые"
IDS_TOOLTIP_PLAY "Воспроизведение"
IDS_TOOLTIP_STOP "Остановить"

View file

@ -48,6 +48,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Všetky podporované"
IDS_TOOLTIP_PLAY "Prehrať"
IDS_TOOLTIP_STOP "Zastaviť"

View file

@ -47,6 +47,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Të gjith suportimet"
IDS_TOOLTIP_PLAY "Fillo"
IDS_TOOLTIP_STOP "Ndalo"

View file

@ -50,6 +50,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Alla kompaktibla filer"
IDS_TOOLTIP_PLAY "Spela upp"
IDS_TOOLTIP_STOP "Stopp"

View file

@ -45,6 +45,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Desteklenen Kütükler"
IDS_TOOLTIP_PLAY "Çal"
IDS_TOOLTIP_STOP "Durdur"

View file

@ -51,6 +51,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "Всі підтримувані"
IDS_TOOLTIP_PLAY "Відтворення"
IDS_TOOLTIP_STOP "Зупинити"

View file

@ -45,6 +45,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "所有支持的格式"
IDS_TOOLTIP_PLAY "播放"
IDS_TOOLTIP_STOP "停止"

View file

@ -51,6 +51,14 @@ END
STRINGTABLE
BEGIN
IDS_MODE_UNKNOWN "Unknown"
IDS_MODE_OPEN "Opened"
IDS_MODE_STOP "Stopped"
IDS_MODE_PLAY "Playing"
IDS_MODE_PAUSE "Paused"
IDS_MODE_RECORD "Recording"
IDS_MODE_SEEK "Seeking"
IDS_MODE_NOT_READY "Not ready"
IDS_ALL_TYPES_FILTER "所有支援格式"
IDS_TOOLTIP_PLAY "播放"
IDS_TOOLTIP_STOP "停止"

View file

@ -19,7 +19,8 @@ HMENU hMainMenu = NULL;
TCHAR szAppTitle[256] = _T("");
TCHAR szDefaultFilter[MAX_PATH] = _T("");
TCHAR *szFilter = NULL;
TCHAR szCurrentFile[MAX_PATH] = _T("");
LPTSTR szFilter = NULL;
WORD wDeviceId = 0;
BOOL bRepeat = FALSE;
@ -27,6 +28,8 @@ BOOL bIsSingleWindow = FALSE;
UINT MaxFilePos = 0;
RECT PrevWindowPos;
static DWORD GetDeviceMode(HWND hwnd);
/* ToolBar Buttons */
static const TBBUTTON Buttons[] =
{ /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
@ -89,6 +92,71 @@ void ResizeClientArea(HWND hwnd, int nWidth, int nHeight)
MoveWindow(hwnd, rcWindowRect.left, rcWindowRect.top, nWidth + ptDifference.x, nHeight + ptDifference.y, TRUE);
}
void UpdateWindowCaption(HWND hwnd)
{
TCHAR szNewTitle[MAX_PATH + 3 + 256];
TCHAR szStatus[128];
if (wDeviceId == 0)
{
SetWindowText(hwnd, szAppTitle);
return;
}
switch (GetDeviceMode(hwnd))
{
case MCI_MODE_PAUSE:
{
LoadString(hInstance, IDS_MODE_PAUSE, szStatus, ARRAYSIZE(szStatus));
break;
}
case MCI_MODE_STOP:
{
LoadString(hInstance, IDS_MODE_STOP, szStatus, ARRAYSIZE(szStatus));
break;
}
case MCI_MODE_PLAY:
{
LoadString(hInstance, IDS_MODE_PLAY, szStatus, ARRAYSIZE(szStatus));
break;
}
case MCI_MODE_OPEN:
{
LoadString(hInstance, IDS_MODE_OPEN, szStatus, ARRAYSIZE(szStatus));
break;
}
case MCI_MODE_RECORD:
{
LoadString(hInstance, IDS_MODE_RECORD, szStatus, ARRAYSIZE(szStatus));
break;
}
case MCI_MODE_SEEK:
{
LoadString(hInstance, IDS_MODE_SEEK, szStatus, ARRAYSIZE(szStatus));
break;
}
case MCI_MODE_NOT_READY:
{
LoadString(hInstance, IDS_MODE_NOT_READY, szStatus, ARRAYSIZE(szStatus));
break;
}
default:
{
LoadString(hInstance, IDS_MODE_UNKNOWN, szStatus, ARRAYSIZE(szStatus));
}
}
StringCbPrintf(szNewTitle, sizeof(szNewTitle), _T("%s - %s (%s)"), szAppTitle, szCurrentFile, szStatus);
SetWindowText(hwnd, szNewTitle);
}
static VOID
ShowLastWin32Error(HWND hwnd)
{
@ -375,7 +443,7 @@ OpenMciDevice(HWND hwnd, LPTSTR lpType, LPTSTR lpFileName)
MCI_STATUS_PARMS mciStatus;
MCI_OPEN_PARMS mciOpen;
DWORD dwFlags = MCI_OPEN_ELEMENT | MCI_WAIT;
TCHAR szNewTitle[MAX_PATH + 3 + 256];
LPTSTR lpStr;
if (wDeviceId)
CloseMciDevice();
@ -422,14 +490,23 @@ OpenMciDevice(HWND hwnd, LPTSTR lpType, LPTSTR lpFileName)
SendMessage(hTrackBar, TBM_SETTICFREQ, (WPARAM)100000, (LPARAM)0);
}
StringCbPrintf(szNewTitle, sizeof(szNewTitle), _T("%s - %s"), szAppTitle, lpFileName);
SetWindowText(hwnd, szNewTitle);
MaxFilePos = mciStatus.dwReturn;
wDeviceId = mciOpen.wDeviceID;
/* NOTE: Everything above this line may be done instead in OpenMediaFile() */
lpStr = _tcsrchr(lpFileName, _T('\\'));
if (lpStr) // Get only the file name (skip the last path separator)
lpStr++;
else
lpStr = lpFileName;
StringCbCopy(szCurrentFile, sizeof(szCurrentFile), lpStr);
EnableMenuItems(hwnd);
UpdateWindowCaption(hwnd);
return 0;
}
@ -471,6 +548,8 @@ StopPlayback(HWND hwnd)
mciSendCommand(wDeviceId, MCI_SEEK, MCI_WAIT | MCI_SEEK_TO_START, 0);
UpdateWindowCaption(hwnd);
SendMessage(hToolBar,
TB_SETCMDID,
0,
@ -604,6 +683,8 @@ StartPlayback(HWND hwnd)
return;
}
UpdateWindowCaption(hwnd);
SendMessage(hToolBar,
TB_SETCMDID,
0,
@ -636,7 +717,7 @@ TogglePlaybackState(HWND hwnd)
case MCI_MODE_PLAY:
{
mciGeneric.dwCallback = (DWORD_PTR)hwnd;
mciError = mciSendCommand(wDeviceId, MCI_PAUSE, MCI_NOTIFY, (DWORD_PTR)&mciGeneric);
mciError = mciSendCommand(wDeviceId, MCI_PAUSE, MCI_NOTIFY | MCI_WAIT, (DWORD_PTR)&mciGeneric);
idBmp = IDB_PLAYICON;
idCmd = IDC_PLAY;
break;
@ -663,6 +744,8 @@ TogglePlaybackState(HWND hwnd)
return;
}
UpdateWindowCaption(hwnd);
SendMessage(hToolBar,
TB_SETCMDID,
0,
@ -695,7 +778,7 @@ CloseMediaFile(HWND hwnd)
SwitchViewMode(hwnd);
CloseMciDevice();
SetWindowText(hwnd, szAppTitle);
UpdateWindowCaption(hwnd);
}
static VOID
@ -1027,8 +1110,6 @@ MainWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
case WM_SIZE:
{
RECT Rect;
RECT ToolbarRect;
MCI_DGV_PUT_PARMS mciPut;
if (hToolBar && hTrackBar)
{
@ -1037,13 +1118,14 @@ MainWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
if (!bIsSingleWindow)
{
UINT Size;
Size = GetSystemMetrics(SM_CYMENU) + Rect.bottom;
UINT Size = GetSystemMetrics(SM_CYMENU) + Rect.bottom;
MoveWindow(hTrackBar, 0, 0, LOWORD(lParam), HIWORD(lParam) - Size, TRUE);
}
else
{
RECT ToolbarRect;
MCI_DGV_PUT_PARMS mciPut;
MoveWindow(hTrackBar, 180, 0, LOWORD(lParam) - 180, 25, TRUE);
GetClientRect(hwnd, &Rect);
@ -1094,13 +1176,10 @@ MainWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
case IDC_PAUSE:
{
if (wDeviceId)
{
TogglePlaybackState(hwnd);
}
else
{
OpenFileDialog(hwnd);
}
break;
}

View file

@ -27,8 +27,17 @@
#define IDS_PLAY 110
#define IDS_DEFAULTMCIERRMSG 111
#define IDS_MODE_UNKNOWN 120
#define IDS_MODE_OPEN 121
#define IDS_MODE_STOP 122
#define IDS_MODE_PLAY 123
#define IDS_MODE_PAUSE 124
#define IDS_MODE_RECORD 125
#define IDS_MODE_SEEK 126
#define IDS_MODE_NOT_READY 127
/* Menu */
#define IDR_MAINMENU 500
#define IDR_MAINMENU 500
/* Accelerators */
#define ID_ACCELERATORS 800