From: SourceForge.net <no...@so...> - 2009-02-28 16:05:40
|
Patches item #1781135, was opened at 2007-08-24 14:54 Message generated for change (Comment added) made by fabiankeil You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=311118&aid=1781135&group_id=11118 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: new feature Group: None >Status: Pending Resolution: None Priority: 5 Private: No Submitted By: T Ford (torford) Assigned to: Gerry Murphy (gjmurphy) Summary: Patch - Add clear log, select all, and Accelerators for w32 Initial Comment: Patch to add menu items for clearing the log, as well as selecting all in the log. Also added accelerators that work when the rich text edit has focus, or when the main window has focus. These changes are for w32 only. ---------------------------------------------------------------------- >Comment By: Fabian Keil (fabiankeil) Date: 2009-02-28 16:05 Message: Unless I'm mistaken, Lee took care of integrating this. ---------------------------------------------------------------------- Comment By: Gerry Murphy (gjmurphy) Date: 2008-10-08 18:32 Message: Life was complicated before the release of the previous beta & I wasn't willing to check in code to a stable release without sufficient testing. Thanks for the reminder - I'll try to add this shortly. ---------------------------------------------------------------------- Comment By: Fabian Keil (fabiankeil) Date: 2008-09-09 16:21 Message: What it the status on this one, Gerry? Are you waiting for some kind of approval, or just busy with other things? ---------------------------------------------------------------------- Comment By: Gerry Murphy (gjmurphy) Date: 2007-11-01 01:17 Message: Logged In: YES user_id=1890069 Originator: NO This kinda works. The functionality added here is useful, but there is a few problems with this patch. Main problem: In the LogRichEditProc() function code is added directly after a return statement, therefore preventing the code that captures the ctrl+d keypress from executing when the richtext control has focus. Minor problems: A new global variable is declared but never referenced; incorrect documentation in a comment; whitespace: tabs in place of spaces; not a unified diff; I've corrected the above problems and an updated version of the patch follows. NOTE: full credit goes to torford for the additional functionality added by this patch, I've simply cleaned it up a bit to make it work. Attached inline as it appears that I can't attach a file to this comment. --cut-- diff -ur ../current/w32.rc ./w32.rc --- ../current/w32.rc 2006-08-18 04:06:25.000000000 +0200 +++ ./w32.rc 2007-11-01 00:05:40.474576000 +0100 @@ -269,11 +269,12 @@ END POPUP "&Edit" BEGIN - MENUITEM "Copy", ID_EDIT_COPY + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Select All\tCtrl+A", ID_EDIT_SELECT_ALL END POPUP "&View" BEGIN - MENUITEM "&Clear Log", ID_VIEW_CLEARLOG + MENUITEM "&Clear Log\tCtrl+D", ID_VIEW_CLEARLOG MENUITEM SEPARATOR MENUITEM "&Log Messages", ID_VIEW_LOGMESSAGES, CHECKED MENUITEM "Message &Highlighting", ID_VIEW_MESSAGEHIGHLIGHTING, CHECKED @@ -321,7 +322,9 @@ IDR_ACCELERATOR ACCELERATORS DISCARDABLE BEGIN + "A", ID_EDIT_SELECT_ALL, VIRTKEY, CONTROL, NOINVERT "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "D", ID_VIEW_CLEARLOG, VIRTKEY, CONTROL, NOINVERT END #endif /* English (U.S.) resources */ Files ../current/w32.res and ./w32.res differ diff -ur ../current/w32log.c ./w32log.c --- ../current/w32log.c 2006-07-18 16:48:48.000000000 +0200 +++ ./w32log.c 2007-11-01 01:53:33.161843200 +0100 @@ -1184,6 +1184,20 @@ MessageBox(g_hwndLogFrame, win32_blurb, "About Privoxy", MB_OK); break; + case ID_EDIT_SELECT_ALL: + { + LRESULT lResult = 0; + GETTEXTLENGTHEX GetTextLengthEx; + CHARRANGE CharRange; + GetTextLengthEx.flags = GTL_NUMCHARS; + GetTextLengthEx.codepage = 0; + lResult = SendMessage(g_hwndLogBox, EM_GETTEXTLENGTHEX, (WPARAM)&GetTextLengthEx, 0); + CharRange.cpMin = 0; + CharRange.cpMax = lResult; + SendMessage(g_hwndLogBox, EM_EXSETSEL, 0, (LPARAM)&CharRange); + } + break; + default: /* DO NOTHING */ break; @@ -1298,8 +1312,16 @@ pt.y = HIWORD(lParam); ClientToScreen(hwnd, &pt); OnLogRButtonUp(wParam, pt.x, pt.y); + return 0; + } + case WM_CHAR: + { + if ((GetKeyState(VK_CONTROL) != 0) && (wParam == 4)) /* ctrl+d */ + { + OnLogCommand(ID_VIEW_CLEARLOG); + return 0; + } } - return 0; } return CallWindowProc(g_fnLogBox, hwnd, uMsg, wParam, lParam); @@ -1377,6 +1399,27 @@ return 0; } break; + + case WM_CHAR: + if ((GetKeyState(VK_CONTROL) != 0) && (wParam == 4)) /* ctrl+d */ + { + OnLogCommand(ID_VIEW_CLEARLOG); + return 0; + } + else if ((GetKeyState(VK_CONTROL) != 0) && (wParam == 1)) /* ctrl+a */ + { + LRESULT lResult = 0; + GETTEXTLENGTHEX GetTextLengthEx; + CHARRANGE CharRange; + GetTextLengthEx.flags = GTL_NUMCHARS; + GetTextLengthEx.codepage = 0; + lResult = SendMessage(g_hwndLogBox, EM_GETTEXTLENGTHEX, (WPARAM)&GetTextLengthEx, 0); + CharRange.cpMin = 0; + CharRange.cpMax = lResult; + lResult = SendMessage(g_hwndLogBox, EM_EXSETSEL, 0, (LPARAM)&CharRange); + return 0; + } + break; } return DefWindowProc(hwnd, uMsg, wParam, lParam); diff -ur ../current/w32res.h ./w32res.h --- ../current/w32res.h 2006-07-18 16:48:48.000000000 +0200 +++ ./w32res.h 2007-10-31 23:43:32.144531200 +0100 @@ -175,6 +175,7 @@ */ #define IDC_STATIC (-1) #define ID_EDIT_COPY 30000 +#define ID_EDIT_SELECT_ALL 30001 #endif /* ndef W32RES_H_INCLUDED */ --cut-- ---------------------------------------------------------------------- Comment By: T Ford (torford) Date: 2007-08-24 14:56 Message: Logged In: YES user_id=17266 Originator: YES Patches are against the following CVS versions: w32.rc -> 1.20 w32log.c -> 1.27 w32res.h -> 1.15 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=311118&aid=1781135&group_id=11118 |