From 37f710d4eea40efa99d8c1973f69f0fcf3e07aec Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 3 May 2009 03:52:19 +0000 Subject: Turned on exceptions. Translate exceptions into status codes before leaving Scintilla. Pick up status codes in SciTE and throw a ScintillaFailure exception. SciTE on Windows catches ScintillaFailure, shows message and exits. --- win32/PlatWin.cxx | 84 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 40 deletions(-) (limited to 'win32/PlatWin.cxx') diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 7345fc8f2..012d8a9af 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1809,53 +1809,57 @@ void ListBoxX::Paint(HDC hDC) { } LRESULT PASCAL ListBoxX::ControlWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (uMsg) { - case WM_ERASEBKGND: - return TRUE; - - case WM_PAINT: { - PAINTSTRUCT ps; - HDC hDC = ::BeginPaint(hWnd, &ps); - ListBoxX *lbx = reinterpret_cast(PointerFromWindow(::GetParent(hWnd))); - if (lbx) - lbx->Paint(hDC); - ::EndPaint(hWnd, &ps); - } - return 0; - - case WM_MOUSEACTIVATE: - // This prevents the view activating when the scrollbar is clicked - return MA_NOACTIVATE; - - case WM_LBUTTONDOWN: { - // We must take control of selection to prevent the ListBox activating - // the popup - LRESULT lResult = ::SendMessage(hWnd, LB_ITEMFROMPOINT, 0, lParam); - int item = LOWORD(lResult); - if (HIWORD(lResult) == 0 && item >= 0) { - ::SendMessage(hWnd, LB_SETCURSEL, item, 0); + try { + switch (uMsg) { + case WM_ERASEBKGND: + return TRUE; + + case WM_PAINT: { + PAINTSTRUCT ps; + HDC hDC = ::BeginPaint(hWnd, &ps); + ListBoxX *lbx = reinterpret_cast(PointerFromWindow(::GetParent(hWnd))); + if (lbx) + lbx->Paint(hDC); + ::EndPaint(hWnd, &ps); } - } - return 0; + return 0; + + case WM_MOUSEACTIVATE: + // This prevents the view activating when the scrollbar is clicked + return MA_NOACTIVATE; + + case WM_LBUTTONDOWN: { + // We must take control of selection to prevent the ListBox activating + // the popup + LRESULT lResult = ::SendMessage(hWnd, LB_ITEMFROMPOINT, 0, lParam); + int item = LOWORD(lResult); + if (HIWORD(lResult) == 0 && item >= 0) { + ::SendMessage(hWnd, LB_SETCURSEL, item, 0); + } + } + return 0; - case WM_LBUTTONUP: - return 0; + case WM_LBUTTONUP: + return 0; - case WM_LBUTTONDBLCLK: { - ListBoxX *lbx = reinterpret_cast(PointerFromWindow(::GetParent(hWnd))); - if (lbx) { - lbx->OnDoubleClick(); + case WM_LBUTTONDBLCLK: { + ListBoxX *lbx = reinterpret_cast(PointerFromWindow(::GetParent(hWnd))); + if (lbx) { + lbx->OnDoubleClick(); + } } + return 0; } - return 0; - } - WNDPROC prevWndProc = reinterpret_cast(GetWindowLongPtr(hWnd, GWLP_USERDATA)); - if (prevWndProc) { - return ::CallWindowProc(prevWndProc, hWnd, uMsg, wParam, lParam); - } else { - return ::DefWindowProc(hWnd, uMsg, wParam, lParam); + WNDPROC prevWndProc = reinterpret_cast(GetWindowLongPtr(hWnd, GWLP_USERDATA)); + if (prevWndProc) { + return ::CallWindowProc(prevWndProc, hWnd, uMsg, wParam, lParam); + } else { + return ::DefWindowProc(hWnd, uMsg, wParam, lParam); + } + } catch (...) { } + return ::DefWindowProc(hWnd, uMsg, wParam, lParam); } LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) { -- cgit v1.2.3