Author: gadamopoulos
Date: Sat Nov 3 21:00:10 2012
New Revision: 57671
URL:
http://svn.reactos.org/svn/reactos?rev=57671&view=rev
Log:
[explorer]
- Implement calling IShellView_TranslateAccelerator
- Fixes accelerators like Ctrl+c , Ctrl+v, etc in windows
Modified:
trunk/reactos/base/shell/explorer/desktop/desktop.cpp
trunk/reactos/base/shell/explorer/desktop/desktop.h
trunk/reactos/base/shell/explorer/shell/shellbrowser.cpp
trunk/reactos/base/shell/explorer/shell/shellbrowser.h
trunk/reactos/base/shell/explorer/utility/window.cpp
trunk/reactos/base/shell/explorer/utility/window.h
Modified: trunk/reactos/base/shell/explorer/desktop/desktop.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/deskto…
==============================================================================
--- trunk/reactos/base/shell/explorer/desktop/desktop.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/desktop/desktop.cpp [iso-8859-1] Sat Nov 3 21:00:10
2012
@@ -479,6 +479,26 @@
SendMessage(g_Globals._hwndShellView, nmsg, wparam, lparam);
break;
+ case PM_TRANSLATE_MSG:
+ {
+ /* TranslateAccelerator is called for all explorer windows that are open
+ so we have to decide if this is the correct recipient */
+ LPMSG lpmsg = (LPMSG)lparam;
+ HWND hwnd = lpmsg->hwnd;
+
+ while(hwnd)
+ {
+ if(hwnd == _hwnd)
+ break;
+
+ hwnd = GetParent(hwnd);
+ }
+
+ if (hwnd)
+ return _pShellView->TranslateAccelerator(lpmsg) == S_OK;
+ return false;
+ }
+
default: def:
return super::WndProc(nmsg, wparam, lparam);
}
Modified: trunk/reactos/base/shell/explorer/desktop/desktop.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/deskto…
==============================================================================
--- trunk/reactos/base/shell/explorer/desktop/desktop.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/desktop/desktop.h [iso-8859-1] Sat Nov 3 21:00:10
2012
@@ -48,9 +48,9 @@
/// Implementation of the Explorer desktop window
-struct DesktopWindow : public Window, public IShellBrowserImpl
+struct DesktopWindow : public PreTranslateWindow, public IShellBrowserImpl
{
- typedef Window super;
+ typedef PreTranslateWindow super;
DesktopWindow(HWND hwnd);
~DesktopWindow();
Modified: trunk/reactos/base/shell/explorer/shell/shellbrowser.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/shell/…
==============================================================================
--- trunk/reactos/base/shell/explorer/shell/shellbrowser.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/shell/shellbrowser.cpp [iso-8859-1] Sat Nov 3
21:00:10 2012
@@ -599,6 +599,27 @@
return false;
}
+bool ShellBrowser::TranslateAccelerator(LPMSG lpmsg)
+{
+ HWND hwnd;
+
+ /* TranslateAccelerator is called for all explorer windows that are open
+ so we have to decide if this is the correct recipient */
+ hwnd = lpmsg->hwnd;
+
+ while(hwnd)
+ {
+ if(hwnd == _hwnd)
+ break;
+
+ hwnd = GetParent(hwnd);
+ }
+
+ if (hwnd)
+ return _pShellView->TranslateAccelerator(lpmsg) == S_OK;
+
+ return false;
+}
bool ShellBrowser::select_folder(Entry* entry, bool expand)
{
@@ -707,6 +728,9 @@
SendMessage(_right_hwnd, WM_SYSCOLORCHANGE, 0, 0);
break;
+ case PM_TRANSLATE_MSG:
+ return _shellBrowser->TranslateAccelerator((MSG*)lparam);
+
default:
return super::WndProc(nmsg, wparam, lparam);
}
Modified: trunk/reactos/base/shell/explorer/shell/shellbrowser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/shell/…
==============================================================================
--- trunk/reactos/base/shell/explorer/shell/shellbrowser.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/shell/shellbrowser.h [iso-8859-1] Sat Nov 3
21:00:10 2012
@@ -141,6 +141,8 @@
void invalidate_cache();
+ bool TranslateAccelerator(LPMSG lpmsg);
+
protected:
HWND _hwnd;
HWND _hwndFrame;
Modified: trunk/reactos/base/shell/explorer/utility/window.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/utilit…
==============================================================================
--- trunk/reactos/base/shell/explorer/utility/window.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/utility/window.cpp [iso-8859-1] Sat Nov 3 21:00:10
2012
@@ -591,6 +591,14 @@
BOOL Window::pretranslate_msg(LPMSG pmsg)
{
+ if ((pmsg->message != WM_KEYDOWN) &&
+ (pmsg->message != WM_SYSKEYDOWN) &&
+ (pmsg->message != WM_SYSCHAR) &&
+ (pmsg->message != WM_CHAR))
+ {
+ return FALSE;
+ }
+
for(WindowSet::const_iterator it=Window::s_pretranslate_windows.begin();
it!=s_pretranslate_windows.end(); ++it)
if (SendMessage(*it, PM_TRANSLATE_MSG, 0, (LPARAM)pmsg))
return TRUE;
Modified: trunk/reactos/base/shell/explorer/utility/window.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/utilit…
==============================================================================
--- trunk/reactos/base/shell/explorer/utility/window.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/utility/window.h [iso-8859-1] Sat Nov 3 21:00:10
2012
@@ -283,12 +283,27 @@
/**
+ PreTranslateWindow is used to register windows to be called by
Window::pretranslate_msg().
+ This way you get PM_TRANSLATE_MSG messages before the message loop dispatches messages.
+ You can then for example use TranslateAccelerator() to implement key shortcuts.
+ */
+struct PreTranslateWindow : public Window
+{
+ typedef Window super;
+
+ PreTranslateWindow(HWND);
+ ~PreTranslateWindow();
+};
+
+
+
+ /**
Class ChildWindow represents MDI child windows.
It is used with class MainFrame.
*/
-struct ChildWindow : public Window
-{
- typedef Window super;
+struct ChildWindow : public PreTranslateWindow
+{
+ typedef PreTranslateWindow super;
ChildWindow(HWND hwnd, const ChildWndInfo& info);
@@ -323,20 +338,6 @@
};
#define PM_SETSTATUSTEXT (WM_APP+0x1E)
-
-
- /**
- PreTranslateWindow is used to register windows to be called by
Window::pretranslate_msg().
- This way you get PM_TRANSLATE_MSG messages before the message loop dispatches messages.
- You can then for example use TranslateAccelerator() to implement key shortcuts.
- */
-struct PreTranslateWindow : public Window
-{
- typedef Window super;
-
- PreTranslateWindow(HWND);
- ~PreTranslateWindow();
-};
/**