Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

fogcreek shellext: enable shortcut keys to run TortoiseHg from the shell

Changeset b613087f5bdd

Parent 1f51c7f62171

by David Golub

Changes to 2 files · Browse files at b613087f5bdd Showing diff from parent 1f51c7f62171 Diff from another changeset...

 
18
19
20
 
21
22
23
 
74
75
76
 
77
78
79
80
 
 
 
 
81
82
83
 
155
156
157
 
 
 
 
 
 
 
 
 
158
159
160
 
18
19
20
21
22
23
24
 
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
 
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
@@ -18,6 +18,7 @@
   #include "TortoiseHgKeyboard.h"  #include "TortoiseUtils.h" +#include "RunDialog.h"    // Each Windows Explorer window is launched in a separate thread. Therefore, use thread  // local storage so that each thread can have its own hook. @@ -74,10 +75,15 @@
  {   if (KeyShortcutList[i].wKey == wParam && KeyShortcutList[i].wFlags == wFlags)   { + // Get the selected files and the current directory.   CAtlList<CString> listFiles;   g_pObject->GetSelectedFiles(listFiles);   CString strFolder;   g_pObject->GetFolder(strFolder); + + // Run the command corresponding to the shortcut. + RunDialog(g_pObject->GetExplorerWindow(), KeyShortcutList[i].strName, + listFiles, strFolder);   }   }   } @@ -155,6 +161,15 @@
  return true;  }   +HWND CTortoiseHgKeyboard::GetExplorerWindow() +{ + CComQIPtr<IWebBrowser2> spWB = m_spUnkSite; + if (spWB == NULL) return NULL; + SHANDLE_PTR hWnd; + if (FAILED(spWB->get_HWND(&hWnd))) return NULL; + return (HWND)hWnd; +} +  CTortoiseHgKeyboard::CTortoiseHgKeyboard() :   m_hHook(NULL)  {
 
40
41
42
 
43
44
45
 
40
41
42
43
44
45
46
@@ -40,6 +40,7 @@
  bool GetActiveShellView(IShellView** ppSV);   bool GetSelectedFiles(CAtlList<CString>& listFiles);   bool GetFolder(CString& strFolder); + HWND GetExplorerWindow();     static LRESULT CALLBACK HookProc(int code, WPARAM wParam, LPARAM lParam);  };