mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
[MPLAY32]
Implement a single-window mode for videos. Patch by Ricardo Hanke. TO ALL TRANSLATORS: Update the translations! CORE-7910 #resolve #comment Committed, thanks! svn path=/trunk/; revision=63940
This commit is contained in:
parent
245d743eba
commit
1270840cc9
|
@ -20,6 +20,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -21,6 +21,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -16,6 +16,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "W&iederholen\tStrg+T", IDM_REPEAT
|
MENUITEM "W&iederholen\tStrg+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&Ansicht"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Einzelfenster-&Modus", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Gerät"
|
POPUP "&Gerät"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Eigenschaften", IDM_DEVPROPS
|
MENUITEM "&Eigenschaften", IDM_DEVPROPS
|
||||||
|
|
|
@ -16,6 +16,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -16,6 +16,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -16,6 +16,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Répé&ter\tCtrl+T", IDM_REPEAT
|
MENUITEM "Répé&ter\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "Périp&hérique"
|
POPUP "Périp&hérique"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Propriétés", IDM_DEVPROPS
|
MENUITEM "&Propriétés", IDM_DEVPROPS
|
||||||
|
|
|
@ -16,6 +16,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -16,6 +16,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -16,6 +16,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -16,6 +16,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -16,6 +16,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -24,6 +24,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Urządzenie"
|
POPUP "&Urządzenie"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Właściwości", IDM_DEVPROPS
|
MENUITEM "&Właściwości", IDM_DEVPROPS
|
||||||
|
|
|
@ -18,6 +18,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -22,6 +22,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Dispozitiv"
|
POPUP "&Dispozitiv"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Proprietăți…", IDM_DEVPROPS
|
MENUITEM "&Proprietăți…", IDM_DEVPROPS
|
||||||
|
|
|
@ -16,6 +16,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Устройство"
|
POPUP "&Устройство"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Свойства", IDM_DEVPROPS
|
MENUITEM "&Свойства", IDM_DEVPROPS
|
||||||
|
|
|
@ -21,6 +21,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -20,6 +20,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -23,6 +23,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -18,6 +18,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Aygıt"
|
POPUP "&Aygıt"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Husûsiyetler", IDM_DEVPROPS
|
MENUITEM "&Husûsiyetler", IDM_DEVPROPS
|
||||||
|
|
|
@ -24,6 +24,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -18,6 +18,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -24,6 +24,10 @@ BEGIN
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
MENUITEM "Repea&t\tCtrl+T", IDM_REPEAT
|
||||||
END
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Single-Window &Mode", IDM_SWITCHVIEW
|
||||||
|
END
|
||||||
POPUP "&Device"
|
POPUP "&Device"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Properties", IDM_DEVPROPS
|
MENUITEM "&Properties", IDM_DEVPROPS
|
||||||
|
|
|
@ -19,7 +19,9 @@ WORD wDeviceId;
|
||||||
BOOL bIsOpened = FALSE;
|
BOOL bIsOpened = FALSE;
|
||||||
BOOL bIsPaused = FALSE;
|
BOOL bIsPaused = FALSE;
|
||||||
BOOL bRepeat = FALSE;
|
BOOL bRepeat = FALSE;
|
||||||
|
BOOL bIsSingleWindow = FALSE;
|
||||||
UINT MaxFilePos = 0;
|
UINT MaxFilePos = 0;
|
||||||
|
RECT PrevWindowPos;
|
||||||
|
|
||||||
|
|
||||||
/* ToolBar Buttons */
|
/* ToolBar Buttons */
|
||||||
|
@ -35,9 +37,11 @@ static const TBBUTTON Buttons[] =
|
||||||
{TBICON_FORWARD, IDC_FORWARD, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}
|
{TBICON_FORWARD, IDC_FORWARD, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
void EnableMenuItems(void)
|
void EnableMenuItems(HWND hwnd)
|
||||||
{
|
{
|
||||||
MCI_GENERIC_PARMS mciGeneric;
|
MCI_GENERIC_PARMS mciGeneric;
|
||||||
|
MCI_DGV_RECT_PARMS mciVideoRect;
|
||||||
|
MCI_DGV_WINDOW_PARMSW mciVideoWindow;
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
|
||||||
EnableMenuItem(hMainMenu, IDM_CLOSE_FILE, MF_BYCOMMAND | MF_ENABLED);
|
EnableMenuItem(hMainMenu, IDM_CLOSE_FILE, MF_BYCOMMAND | MF_ENABLED);
|
||||||
|
@ -47,12 +51,38 @@ void EnableMenuItems(void)
|
||||||
{
|
{
|
||||||
EnableMenuItem(hMainMenu, IDM_DEVPROPS, MF_BYCOMMAND | MF_ENABLED);
|
EnableMenuItem(hMainMenu, IDM_DEVPROPS, MF_BYCOMMAND | MF_ENABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mciVideoWindow.hWnd = hwnd;
|
||||||
|
|
||||||
|
dwError = mciSendCommand(wDeviceId, MCI_WINDOW, MCI_DGV_WINDOW_HWND | MCI_TEST, (DWORD)(LPSTR)&mciVideoWindow);
|
||||||
|
if (!dwError)
|
||||||
|
{
|
||||||
|
dwError = mciSendCommand(wDeviceId, MCI_WHERE, MCI_DGV_WHERE_SOURCE | MCI_TEST, (DWORD)(LPSTR)&mciVideoRect);
|
||||||
|
if (!dwError)
|
||||||
|
{
|
||||||
|
EnableMenuItem(hMainMenu, IDM_SWITCHVIEW, MF_BYCOMMAND | MF_ENABLED);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisableMenuItems(void)
|
void DisableMenuItems(void)
|
||||||
{
|
{
|
||||||
EnableMenuItem(hMainMenu, IDM_CLOSE_FILE, MF_BYCOMMAND | MF_GRAYED);
|
EnableMenuItem(hMainMenu, IDM_CLOSE_FILE, MF_BYCOMMAND | MF_GRAYED);
|
||||||
EnableMenuItem(hMainMenu, IDM_DEVPROPS, MF_BYCOMMAND | MF_GRAYED);
|
EnableMenuItem(hMainMenu, IDM_DEVPROPS, MF_BYCOMMAND | MF_GRAYED);
|
||||||
|
EnableMenuItem(hMainMenu, IDM_SWITCHVIEW, MF_BYCOMMAND | MF_GRAYED);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResizeClientArea(HWND hwnd, int nWidth, int nHeight)
|
||||||
|
{
|
||||||
|
RECT rcClientRect;
|
||||||
|
RECT rcWindowRect;
|
||||||
|
POINT ptDifference;
|
||||||
|
|
||||||
|
GetClientRect(hwnd, &rcClientRect);
|
||||||
|
GetWindowRect(hwnd, &rcWindowRect);
|
||||||
|
ptDifference.x = (rcWindowRect.right - rcWindowRect.left) - rcClientRect.right;
|
||||||
|
ptDifference.y = (rcWindowRect.bottom - rcWindowRect.top) - rcClientRect.bottom;
|
||||||
|
MoveWindow(hwnd, rcWindowRect.left, rcWindowRect.top, nWidth + ptDifference.x, nHeight + ptDifference.y, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
|
@ -213,6 +243,77 @@ IsSupportedFileExtension(LPTSTR lpFileName, LPTSTR lpDeviceName, LPDWORD dwSize)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VOID
|
||||||
|
SwitchViewMode(HWND hwnd)
|
||||||
|
{
|
||||||
|
MCIERROR mciError;
|
||||||
|
MCI_DGV_RECT_PARMS mciVideoRect;
|
||||||
|
MCI_DGV_WINDOW_PARMSW mciVideoWindow;
|
||||||
|
RECT rcToolbarRect;
|
||||||
|
RECT rcTempRect;
|
||||||
|
|
||||||
|
mciVideoWindow.hWnd = hwnd;
|
||||||
|
|
||||||
|
mciError = mciSendCommand(wDeviceId, MCI_WINDOW, MCI_DGV_WINDOW_HWND | MCI_TEST, (DWORD)(LPSTR)&mciVideoWindow);
|
||||||
|
if (mciError)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mciError = mciSendCommand(wDeviceId, MCI_WHERE, MCI_DGV_WHERE_SOURCE | MCI_TEST, (DWORD)(LPSTR)&mciVideoRect);
|
||||||
|
if (mciError)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bIsSingleWindow)
|
||||||
|
{
|
||||||
|
GetWindowRect(hwnd, &PrevWindowPos);
|
||||||
|
|
||||||
|
SetParent(hTrackBar, hToolBar);
|
||||||
|
|
||||||
|
mciError = mciSendCommand(wDeviceId, MCI_WHERE, MCI_DGV_WHERE_SOURCE, (DWORD)(LPSTR)&mciVideoRect);
|
||||||
|
if (mciError)
|
||||||
|
{
|
||||||
|
ShowMCIError(hwnd, mciError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetWindowRect(hToolBar, &rcToolbarRect);
|
||||||
|
ResizeClientArea(hwnd, mciVideoRect.rc.right, mciVideoRect.rc.bottom + (rcToolbarRect.bottom - rcToolbarRect.top));
|
||||||
|
|
||||||
|
mciError = mciSendCommand(wDeviceId, MCI_WINDOW, MCI_DGV_WINDOW_HWND, (DWORD)(LPSTR)&mciVideoWindow);
|
||||||
|
if (mciError)
|
||||||
|
{
|
||||||
|
ShowMCIError(hwnd, mciError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetWindowRect(hToolBar, &rcTempRect);
|
||||||
|
MoveWindow(hTrackBar, 180, 0, rcTempRect.right - rcTempRect.left - 180, 25, TRUE);
|
||||||
|
|
||||||
|
CheckMenuItem(hMainMenu, IDM_SWITCHVIEW, MF_BYCOMMAND | MF_CHECKED);
|
||||||
|
bIsSingleWindow = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bIsSingleWindow = FALSE;
|
||||||
|
CheckMenuItem(hMainMenu, IDM_SWITCHVIEW, MF_BYCOMMAND | MF_UNCHECKED);
|
||||||
|
|
||||||
|
mciVideoWindow.hWnd = MCI_DGV_WINDOW_DEFAULT;
|
||||||
|
mciError = mciSendCommand(wDeviceId, MCI_WINDOW, MCI_DGV_WINDOW_HWND, (DWORD)(LPSTR)&mciVideoWindow);
|
||||||
|
if (mciError)
|
||||||
|
{
|
||||||
|
ShowMCIError(hwnd, mciError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetParent(hTrackBar, hwnd);
|
||||||
|
|
||||||
|
MoveWindow(hwnd, PrevWindowPos.left, PrevWindowPos.top, PrevWindowPos.right - PrevWindowPos.left, PrevWindowPos.bottom - PrevWindowPos.top, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static DWORD
|
static DWORD
|
||||||
CloseMciDevice(VOID)
|
CloseMciDevice(VOID)
|
||||||
{
|
{
|
||||||
|
@ -295,7 +396,7 @@ OpenMciDevice(HWND hwnd, LPTSTR lpType, LPTSTR lpFileName)
|
||||||
bIsOpened = TRUE;
|
bIsOpened = TRUE;
|
||||||
_tcscpy(szPrevFile, lpFileName);
|
_tcscpy(szPrevFile, lpFileName);
|
||||||
|
|
||||||
EnableMenuItems();
|
EnableMenuItems(hwnd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -307,6 +408,12 @@ StopPlayback(HWND hwnd)
|
||||||
{
|
{
|
||||||
SendMessage(hTrackBar, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) 1);
|
SendMessage(hTrackBar, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) 1);
|
||||||
KillTimer(hwnd, IDT_PLAYTIMER);
|
KillTimer(hwnd, IDT_PLAYTIMER);
|
||||||
|
|
||||||
|
if (bIsSingleWindow)
|
||||||
|
{
|
||||||
|
SwitchViewMode(hwnd);
|
||||||
|
}
|
||||||
|
|
||||||
CloseMciDevice();
|
CloseMciDevice();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -499,6 +606,11 @@ PlayFile(HWND hwnd, LPTSTR lpFileName)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bIsOpened)
|
||||||
|
{
|
||||||
|
StopPlayback(hwnd);
|
||||||
|
}
|
||||||
|
|
||||||
mciError = OpenMciDevice(hwnd, szDeviceName, szLocalFileName);
|
mciError = OpenMciDevice(hwnd, szDeviceName, szLocalFileName);
|
||||||
if (mciError != 0)
|
if (mciError != 0)
|
||||||
{
|
{
|
||||||
|
@ -622,12 +734,14 @@ MainWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LPRECT pRect = (LPRECT)lParam;
|
LPRECT pRect = (LPRECT)lParam;
|
||||||
|
|
||||||
if (pRect->right - pRect->left < MAIN_WINDOW_MIN_WIDTH)
|
if (!bIsSingleWindow)
|
||||||
pRect->right = pRect->left + MAIN_WINDOW_MIN_WIDTH;
|
{
|
||||||
|
if (pRect->right - pRect->left < MAIN_WINDOW_MIN_WIDTH)
|
||||||
if (pRect->bottom - pRect->top != MAIN_WINDOW_HEIGHT)
|
pRect->right = pRect->left + MAIN_WINDOW_MIN_WIDTH;
|
||||||
pRect->bottom = pRect->top + MAIN_WINDOW_HEIGHT;
|
|
||||||
|
|
||||||
|
if (pRect->bottom - pRect->top != MAIN_WINDOW_HEIGHT)
|
||||||
|
pRect->bottom = pRect->top + MAIN_WINDOW_HEIGHT;
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,14 +749,33 @@ MainWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
RECT Rect;
|
RECT Rect;
|
||||||
UINT Size;
|
UINT Size;
|
||||||
|
RECT ToolbarRect;
|
||||||
|
MCI_DGV_PUT_PARMS mciPut;
|
||||||
|
|
||||||
if (hToolBar && hTrackBar)
|
if (hToolBar && hTrackBar)
|
||||||
{
|
{
|
||||||
SendMessage(hToolBar, TB_AUTOSIZE, 0, 0);
|
SendMessage(hToolBar, TB_AUTOSIZE, 0, 0);
|
||||||
SendMessage(hToolBar, TB_GETITEMRECT, 1, (LPARAM)&Rect);
|
SendMessage(hToolBar, TB_GETITEMRECT, 1, (LPARAM)&Rect);
|
||||||
|
|
||||||
Size = GetSystemMetrics(SM_CYMENU) + Rect.bottom;
|
if (!bIsSingleWindow)
|
||||||
MoveWindow(hTrackBar, 0, 0, LOWORD(lParam), HIWORD(lParam) - Size, TRUE);
|
{
|
||||||
|
Size = GetSystemMetrics(SM_CYMENU) + Rect.bottom;
|
||||||
|
MoveWindow(hTrackBar, 0, 0, LOWORD(lParam), HIWORD(lParam) - Size, TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MoveWindow(hTrackBar, 180, 0, LOWORD(lParam) - 180, 25, TRUE);
|
||||||
|
|
||||||
|
GetClientRect(hwnd, &Rect);
|
||||||
|
GetClientRect(hToolBar, &ToolbarRect);
|
||||||
|
|
||||||
|
mciPut.rc.top = 0;
|
||||||
|
mciPut.rc.left = 0;
|
||||||
|
mciPut.rc.right = Rect.right;
|
||||||
|
mciPut.rc.bottom = Rect.bottom - (ToolbarRect.bottom - ToolbarRect.top) - 2;
|
||||||
|
|
||||||
|
mciSendCommand(wDeviceId, MCI_PUT, MCI_DGV_PUT_DESTINATION | MCI_DGV_RECT | MCI_WAIT, (DWORD)&mciPut);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
@ -664,6 +797,15 @@ MainWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_NCLBUTTONDBLCLK:
|
||||||
|
{
|
||||||
|
if (wParam == HTCAPTION)
|
||||||
|
{
|
||||||
|
SwitchViewMode(hwnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
|
@ -732,6 +874,10 @@ MainWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case IDM_SWITCHVIEW:
|
||||||
|
SwitchViewMode(hwnd);
|
||||||
|
break;
|
||||||
|
|
||||||
case IDM_DEVPROPS:
|
case IDM_DEVPROPS:
|
||||||
ShowDeviceProperties(hwnd);
|
ShowDeviceProperties(hwnd);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#define IDM_VOLUMECTL 1004
|
#define IDM_VOLUMECTL 1004
|
||||||
#define IDM_DEVPROPS 1005
|
#define IDM_DEVPROPS 1005
|
||||||
#define IDM_REPEAT 1006
|
#define IDM_REPEAT 1006
|
||||||
|
#define IDM_SWITCHVIEW 1007
|
||||||
|
|
||||||
/* ToolBar Icons */
|
/* ToolBar Icons */
|
||||||
#define TBICON_PLAY 0
|
#define TBICON_PLAY 0
|
||||||
|
|
Loading…
Reference in a new issue