Author: dquintana
Date: Fri Jan 9 16:25:49 2015
New Revision: 66015
URL:
http://svn.reactos.org/svn/reactos?rev=66015&view=rev
Log:
[STOBJECT]
* Fix resource strings so they compile correctly.
* Make use of the resource strings for the tooltip.
* Implement a context menu for the volume icon, using resource strings.
NOTE: I have a strange issue where the cursor disappears while the popup is open. No idea
if it's my fault or win32k.
Modified:
trunk/reactos/dll/shellext/stobject/lang/de-DE.rc
trunk/reactos/dll/shellext/stobject/lang/en-US.rc
trunk/reactos/dll/shellext/stobject/lang/es-ES.rc
trunk/reactos/dll/shellext/stobject/lang/tr-TR.rc
trunk/reactos/dll/shellext/stobject/stobject.rc
trunk/reactos/dll/shellext/stobject/volume.cpp
Modified: trunk/reactos/dll/shellext/stobject/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/stobject/lang…
==============================================================================
--- trunk/reactos/dll/shellext/stobject/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/stobject/lang/de-DE.rc [iso-8859-1] Fri Jan 9 16:25:49
2015
@@ -1,5 +1,6 @@
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
+#if 0
IDD_POWER_METER DIALOGEX 0, 0, 252, 218
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
@@ -11,6 +12,7 @@
CONTROL "&Details für jede Batterie anzeigen", 1002, BUTTON,
BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 129, 6, 123, 10
CONTROL "", 1000, STATIC, SS_LEFT | WS_CHILD | WS_GROUP, 11, 29, 229, 178
END
+#endif
STRINGTABLE
BEGIN
@@ -34,7 +36,7 @@
IDS_HOTPLUG_DRIVE " - Laufwerk (%s)"
IDS_HOTPLUG_DRIVES " - Laufwerke (%s)"
IDS_HOTPLUG_A "A:"
- IDS_HOTPLUG_REQUIERES "Diese Hardware erfordert \"Sicheres
Entfernen\""
+ IDS_HOTPLUG_REQUIERES "Diese Hardware erfordert ""Sicheres
Entfernen"""
IDS_HOTPLUG_CLICK "Klicken Sie auf dieses Symbol, und wählen Sie die zu
entfernende Hardware, bevor Sie diese Hardware entfernen."
//Volume related strings
@@ -48,4 +50,4 @@
IDS_KEYS_STICKY "Einrastfunktion"
IDS_KEYS_MOUSE "Tastaturmaus"
IDS_KEYS_FILTER "Anschlagverzögerung"
-END
+END
Modified: trunk/reactos/dll/shellext/stobject/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/stobject/lang…
==============================================================================
--- trunk/reactos/dll/shellext/stobject/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/stobject/lang/en-US.rc [iso-8859-1] Fri Jan 9 16:25:49
2015
@@ -1,5 +1,6 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#if 0
IDD_POWER_METER DIALOGEX 0, 0, 252, 218
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
@@ -11,6 +12,7 @@
CONTROL "Show details for each &battery.", 1003, BUTTON,
BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 135, 6, 120, 8
CONTROL "", 1000, STATIC, SS_LEFT | WS_CHILD | WS_GROUP, 11, 29, 229, 178
END
+#endif
STRINGTABLE
BEGIN
@@ -34,7 +36,7 @@
IDS_HOTPLUG_DRIVE " - Drive(%s)"
IDS_HOTPLUG_DRIVES " - Drives(%s)"
IDS_HOTPLUG_A "A:"
- IDS_HOTPLUG_REQUIERES "This hardware requires \"Safe Removal\""
+ IDS_HOTPLUG_REQUIERES "This hardware requires ""Safe
Removal"""
IDS_HOTPLUG_CLICK "Before removing this hardware, click on this icon and select
the hardware you want to remove."
//Volume related strings
@@ -49,4 +51,3 @@
IDS_KEYS_MOUSE "MouseKeys"
IDS_KEYS_FILTER "FilterKeys"
END
-
Modified: trunk/reactos/dll/shellext/stobject/lang/es-ES.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/stobject/lang…
==============================================================================
--- trunk/reactos/dll/shellext/stobject/lang/es-ES.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/stobject/lang/es-ES.rc [iso-8859-1] Fri Jan 9 16:25:49
2015
@@ -1,6 +1,7 @@
/* Spanish translation created by Ismael Ferreras Morezuelas (2014-12-30) */
LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
+#if 0
IDD_POWER_METER DIALOGEX 0, 0, 252, 218
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
@@ -12,6 +13,7 @@
CONTROL "Mostrar un estado detallado para cada &baterÃa.", 1003,
BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 135, 6, 120, 8
CONTROL "", 1000, STATIC, SS_LEFT | WS_CHILD | WS_GROUP, 11, 29, 229, 178
END
+#endif
STRINGTABLE
BEGIN
@@ -35,7 +37,7 @@
IDS_HOTPLUG_DRIVE " - Unidad(%s)"
IDS_HOTPLUG_DRIVES " - Unidades(%s)"
IDS_HOTPLUG_A "A:"
- IDS_HOTPLUG_REQUIERES "Este dispositivo necesita una \"desconexión
segura\""
+ IDS_HOTPLUG_REQUIERES "Este dispositivo necesita una ""desconexión
segura"""
IDS_HOTPLUG_CLICK "Antes de desconectar el dispositivo, haga clic en este icono
y eliga el dispositivo a desconectar."
//Volume related strings
@@ -50,4 +52,3 @@
IDS_KEYS_MOUSE "MouseKeys"
IDS_KEYS_FILTER "FilterKeys"
END
-
Modified: trunk/reactos/dll/shellext/stobject/lang/tr-TR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/stobject/lang…
==============================================================================
--- trunk/reactos/dll/shellext/stobject/lang/tr-TR.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/stobject/lang/tr-TR.rc [iso-8859-1] Fri Jan 9 16:25:49
2015
@@ -2,6 +2,7 @@
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
+#if 0
IDD_POWER_METER DIALOGEX 0, 0, 252, 218
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
@@ -13,6 +14,7 @@
CONTROL "&Tüm Piller İçin Ayrıntıları Göster", 1003, BUTTON,
BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 135, 6, 120, 8
CONTROL "", 1000, STATIC, SS_LEFT | WS_CHILD | WS_GROUP, 11, 29, 229, 178
END
+#endif
STRINGTABLE
BEGIN
@@ -51,4 +53,3 @@
IDS_KEYS_MOUSE "Fâre DüÄmeleri"
IDS_KEYS_FILTER "Süzgeç DüÄmeleri"
END
-
Modified: trunk/reactos/dll/shellext/stobject/stobject.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/stobject/stob…
==============================================================================
--- trunk/reactos/dll/shellext/stobject/stobject.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/stobject/stobject.rc [iso-8859-1] Fri Jan 9 16:25:49 2015
@@ -16,7 +16,6 @@
/* UTF-8 */
#pragma code_page(65001)
-#if 0
#ifdef LANGUAGE_DE_DE
#include "lang/de-DE.rc"
#endif
@@ -32,4 +31,3 @@
#ifdef LANGUAGE_TR_TR
#include "lang/tr-TR.rc"
#endif
-#endif
Modified: trunk/reactos/dll/shellext/stobject/volume.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/stobject/volu…
==============================================================================
--- trunk/reactos/dll/shellext/stobject/volume.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/stobject/volume.cpp [iso-8859-1] Fri Jan 9 16:25:49 2015
@@ -11,6 +11,9 @@
#include <mmsystem.h>
#include <mmddk.h>
+#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
+#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
+
WINE_DEFAULT_DEBUG_CHANNEL(stobject);
HICON g_hIconVolume;
@@ -28,13 +31,13 @@
static HRESULT __stdcall Volume_FindMixerControl(CSysTray * pSysTray)
{
MMRESULT result;
- UINT mixerId = 0;
+ UINT mixerId = 0;
DWORD waveOutId = 0;
- DWORD param2 = 0;
+ DWORD param2 = 0;
TRACE("Volume_FindDefaultMixerID\n");
- result = waveOutMessage((HWAVEOUT) WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET,
(DWORD_PTR) &waveOutId, (DWORD_PTR) ¶m2);
+ result = waveOutMessage((HWAVEOUT)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET,
(DWORD_PTR)&waveOutId, (DWORD_PTR)¶m2);
if (result)
return E_FAIL;
@@ -48,7 +51,7 @@
{
TRACE("waveOut default device is %d\n", waveOutId);
- result = mixerGetID((HMIXEROBJ) waveOutId, &mixerId, MIXER_OBJECTF_WAVEOUT);
+ result = mixerGetID((HMIXEROBJ)waveOutId, &mixerId, MIXER_OBJECTF_WAVEOUT);
if (result)
return E_FAIL;
@@ -79,7 +82,7 @@
{
mixerLine.cbStruct = sizeof(mixerLine);
mixerLine.dwDestination = idx;
- if (!mixerGetLineInfoW((HMIXEROBJ) g_mixerId, &mixerLine, 0))
+ if (!mixerGetLineInfoW((HMIXEROBJ)g_mixerId, &mixerLine, 0))
{
if (mixerLine.dwComponentType >= MIXERLINE_COMPONENTTYPE_DST_SPEAKERS
&&
mixerLine.dwComponentType <= MIXERLINE_COMPONENTTYPE_DST_HEADPHONES)
@@ -102,11 +105,11 @@
mixerLineControls.pamxctrl = &mixerControl;
mixerLineControls.cbmxctrl = sizeof(mixerControl);
- if (mixerGetLineControlsW((HMIXEROBJ) g_mixerId, &mixerLineControls,
MIXER_GETLINECONTROLSF_ONEBYTYPE))
+ if (mixerGetLineControlsW((HMIXEROBJ)g_mixerId, &mixerLineControls,
MIXER_GETLINECONTROLSF_ONEBYTYPE))
return E_FAIL;
TRACE("Found control id %d for mute: %d\n", mixerControl.dwControlID);
-
+
g_muteControlID = mixerControl.dwControlID;
return S_OK;
@@ -172,13 +175,18 @@
Volume_IsMute();
+ WCHAR strTooltip[128];
HICON icon;
- if (g_IsMute)
+ if (g_IsMute) {
icon = g_hIconMute;
- else
+ LoadStringW(g_hInstance, IDS_VOL_MUTED, strTooltip, _countof(strTooltip));
+ }
+ else {
icon = g_hIconVolume;
-
- return pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_VOLUME, icon,
L"Placeholder");
+ LoadStringW(g_hInstance, IDS_VOL_VOLUME, strTooltip, _countof(strTooltip));
+ }
+
+ return pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_VOLUME, icon, strTooltip);
}
HRESULT STDMETHODCALLTYPE Volume_Shutdown(_In_ CSysTray * pSysTray)
@@ -191,6 +199,49 @@
HRESULT Volume_OnDeviceChange(_In_ CSysTray * pSysTray, WPARAM wParam, LPARAM lParam)
{
return Volume_FindMixerControl(pSysTray);
+}
+
+static void _RunVolume()
+{
+ // FIXME: ensure we are loading the right one
+ ShellExecuteW(NULL, NULL, L"sndvol32.exe", NULL, NULL, SW_SHOWNORMAL);
+}
+
+static void _RunMMCpl()
+{
+ ShellExecuteW(NULL, NULL, L"mmsys.cpl", NULL, NULL, SW_NORMAL);
+}
+
+static void _ShowContextMenu(CSysTray * pSysTray)
+{
+ WCHAR strAdjust[128];
+ WCHAR strOpen[128];
+ LoadStringW(g_hInstance, IDS_VOL_ADJUST, strAdjust, _countof(strAdjust));
+ LoadStringW(g_hInstance, IDS_VOL_OPEN, strOpen, _countof(strOpen));
+
+ HMENU hPopup = CreatePopupMenu();
+ AppendMenuW(hPopup, MF_STRING, IDS_VOL_ADJUST, strAdjust);
+ AppendMenuW(hPopup, MF_STRING, IDS_VOL_OPEN, strOpen);
+
+ DWORD flags = TPM_RETURNCMD | TPM_NONOTIFY | TPM_RIGHTALIGN | TPM_BOTTOMALIGN;
+ DWORD msgPos = GetMessagePos();
+
+ SetForegroundWindow(pSysTray->GetHWnd());
+ DWORD id = TrackPopupMenuEx(hPopup, flags,
+ GET_X_LPARAM(msgPos), GET_Y_LPARAM(msgPos),
+ pSysTray->GetHWnd(), NULL);
+
+ DestroyMenu(hPopup);
+
+ switch (id)
+ {
+ case IDS_VOL_OPEN:
+ _RunVolume();
+ break;
+ case IDS_VOL_ADJUST:
+ _RunMMCpl();
+ break;
+ }
}
HRESULT STDMETHODCALLTYPE Volume_Message(_In_ CSysTray * pSysTray, UINT uMsg, WPARAM
wParam, LPARAM lParam)
@@ -216,13 +267,12 @@
TRACE("TODO: display volume slider\n");
break;
case WM_LBUTTONDBLCLK:
- // FIXME: ensure we are loading the right one
- ShellExecute(NULL, NULL, L"sndvol32.exe", NULL, NULL, SW_SHOWNORMAL);
+ _RunVolume();
break;
case WM_RBUTTONDOWN:
break;
case WM_RBUTTONUP:
- break;
+ _ShowContextMenu(pSysTray);
case WM_RBUTTONDBLCLK:
break;
case WM_MOUSEMOVE: