| 248 | } |
| 249 | |
| 250 | LRESULT CALLBACK rvDebuggerWindow::ScriptWndProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam ) |
| 251 | { |
| 252 | static int lastStart = -1; |
| 253 | static int lastEnd = -1; |
| 254 | rvDebuggerWindow* window = (rvDebuggerWindow*)GetWindowLongPtr ( wnd, GWLP_USERDATA ); |
| 255 | WNDPROC wndproc = window->mOldScriptProc; |
| 256 | |
| 257 | switch ( msg ) |
| 258 | { |
| 259 | case WM_RBUTTONUP: |
| 260 | return SendMessage ( wnd, WM_LBUTTONUP, wparam, lparam ); |
| 261 | |
| 262 | case WM_RBUTTONDOWN: |
| 263 | { |
| 264 | POINT point = { LOWORD(lparam), HIWORD(lparam) }; |
| 265 | HMENU menu; |
| 266 | SendMessage ( wnd, WM_LBUTTONDOWN, wparam, lparam ); |
| 267 | menu = LoadMenu ( window->mInstance, MAKEINTRESOURCE(IDR_DBG_SCRIPT_POPUP) ); |
| 268 | ClientToScreen ( wnd, &point ); |
| 269 | TrackPopupMenu ( GetSubMenu( menu, 0 ), TPM_RIGHTBUTTON|TPM_LEFTALIGN, point.x, point.y, 0, window->mWnd, NULL ); |
| 270 | DestroyMenu ( menu ); |
| 271 | return 0; |
| 272 | } |
| 273 | |
| 274 | case WM_MOUSEMOVE: |
| 275 | { |
| 276 | // Figure out the start and end of the mouse is over |
| 277 | POINTL pos = {LOWORD(lparam),HIWORD(lparam)}; |
| 278 | int c = SendMessage ( wnd, EM_CHARFROMPOS, 0, (WPARAM)&pos ); |
| 279 | int start = SendMessage ( wnd, EM_FINDWORDBREAK, WB_LEFT, c ); |
| 280 | int end = SendMessage ( wnd, EM_FINDWORDBREAK, WB_RIGHT, c ); |
| 281 | |
| 282 | // If the start and the end of the word we are over havent changed |
| 283 | // then the word hasnt changed so no need to re-setup the tool tip |
| 284 | if ( lastStart == start && lastEnd == end ) |
| 285 | { |
| 286 | break; |
| 287 | } |
| 288 | |
| 289 | // Save the current start and end for the next mouse move |
| 290 | lastStart = start; |
| 291 | lastEnd = end; |
| 292 | |
| 293 | // Get rid of the last tool tip if there is one |
| 294 | if ( window->mTooltipVar.Length() ) |
| 295 | { |
| 296 | TOOLINFO ti; |
| 297 | ti.cbSize = sizeof(TOOLINFO); |
| 298 | ti.hwnd = wnd; |
| 299 | ti.uId = 0; |
| 300 | SendMessage ( window->mWndToolTips, TTM_DELTOOL, 0, (LPARAM) (LPTOOLINFO) &ti ); |
| 301 | window->mTooltipVar.Empty ( ); |
| 302 | } |
| 303 | |
| 304 | // If there is no word then ignore it |
| 305 | if ( start == end ) |
| 306 | { |
| 307 | break; |
nothing calls this directly
no test coverage detected