Permalink
Browse files

Added support for using the application key (context menu key) on the…

… keyboard to popup the popup menu. Really nice for not having to take your hand off the keyboard.

Some modifications by ShadowFlare
  • Loading branch information...
1 parent ec1caca commit 17bb922db6a2f0f59b79466909f0dfefb58aa433 @tig tig committed with Mar 30, 2012
Showing with 34 additions and 0 deletions.
  1. +28 −0 Console/MainFrame.cpp
  2. +2 −0 Console/MainFrame.h
  3. +1 −0 Console/SettingsHandler.cpp
  4. +1 −0 Console/console.xml
  5. +1 −0 Console/resource.h
  6. +1 −0 setup/config/console.xml
View
28 Console/MainFrame.cpp
@@ -1557,6 +1557,34 @@ LRESULT MainFrame::OnDumpBuffer(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndC
//////////////////////////////////////////////////////////////////////////////
+LRESULT MainFrame::OnPopupPopupMenu(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
+{
+ POINT pt;
+ CRect windowRect;
+
+ GetClientRect(&windowRect);
+ ClientToScreen(&windowRect);
+
+ pt.x = windowRect.left;
+ pt.y = windowRect.top;
+
+ // adjust for the toolbar height
+ CReBarCtrl rebar(m_hWndToolBar);
+ pt.y += rebar.GetBarHeight();
+ pt.y += GetTabAreaHeight();
+
+ //CPoint screenPoint(pt);
+ //ClientToScreen(&screenPoint);
+ SendMessage(UM_SHOW_POPUP_MENU, 0, MAKELPARAM(pt.x, pt.y));
+
+ return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////
+
LRESULT MainFrame::OnHelp(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
::HtmlHelp(m_hWnd, (Helpers::GetModulePath(NULL) + wstring(L"console.chm")).c_str(), HH_DISPLAY_TOPIC, NULL);
View
2 Console/MainFrame.h
@@ -119,6 +119,7 @@ class MainFrame
COMMAND_ID_HANDLER(ID_HELP, OnHelp)
COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout)
COMMAND_ID_HANDLER(IDC_DUMP_BUFFER, OnDumpBuffer)
+ COMMAND_ID_HANDLER(ID_POPUP_MENU, OnPopupPopupMenu)
CHAIN_MSG_MAP(CTabbedFrameImpl<MainFrame>)
REFLECT_NOTIFICATIONS()
@@ -191,6 +192,7 @@ class MainFrame
LRESULT OnHelp(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnDumpBuffer(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
+ LRESULT OnPopupPopupMenu(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
public:
View
1 Console/SettingsHandler.cpp
@@ -1145,6 +1145,7 @@ HotKeys::HotKeys()
commands.push_back(shared_ptr<CommandData>(new CommandData(L"scrollpageright", ID_SCROLL_PAGE_RIGHT, L"Scroll buffer page right")));
commands.push_back(shared_ptr<CommandData>(new CommandData(L"dumpbuffer", IDC_DUMP_BUFFER, L"Dump screen buffer")));
+ commands.push_back(shared_ptr<CommandData>(new CommandData(L"appmenu", ID_POPUP_MENU, L"Context menu")));
// global commands
commands.push_back(shared_ptr<CommandData>(new CommandData(L"activate", IDC_GLOBAL_ACTIVATE, L"Activate Console (global)", true)));
View
1 Console/console.xml
@@ -80,6 +80,7 @@
<hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpageright"/>
<hotkey ctrl="1" shift="1" alt="0" extended="0" code="112" command="dumpbuffer"/>
<hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="activate"/>
+ <hotkey ctrl="0" shift="0" alt="0" extended="1" code="93" command="appmenu"/>
</hotkeys>
<mouse>
<actions>
View
1 Console/resource.h
@@ -235,6 +235,7 @@
#define ID_NEXT_TAB 2200
#define ID_PREV_TAB 2201
#define IDC_DUMP_BUFFER 3000
+#define ID_POPUP_MENU 3001
#define IDS_ERR_CANT_START_SHELL 5000
#define IDS_ERR_CANT_START_AS_USER 5001
#define IDS_ERR_CANT_START_SHELL_AS_USER 5001
View
1 setup/config/console.xml
@@ -78,6 +78,7 @@
<hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpageleft"/>
<hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpageright"/>
<hotkey ctrl="1" shift="1" alt="0" extended="0" code="112" command="dumpbuffer"/>
+ <hotkey ctrl="0" shift="0" alt="0" extended="1" code="93" command="appmenu"/>
</hotkeys>
<mouse>
<actions>

0 comments on commit 17bb922

Please sign in to comment.