-const char w32log_rcs[] = "$Id: w32log.c,v 2.3 2002/09/12 14:30:32 oes Exp $";
+const char w32log_rcs[] = "$Id: w32log.c,v 1.25.2.5 2003/04/04 12:48:51 oes Exp $";
/*********************************************************************
*
- * File : $Source: /cvsroot/ijbswa/current/src/w32log.c,v $
+ * File : $Source: /cvsroot/ijbswa/current/Attic/w32log.c,v $
*
* Purpose : Functions for creating and destroying the log window,
* ouputting strings, processing messages and so on.
*
* Revisions :
* $Log: w32log.c,v $
- * Revision 2.3 2002/09/12 14:30:32 oes
- * Uncheck the "Show Privoxy Window" taskbar menu item when window gets minimized. Fixes bug #606804
+ * Revision 1.25.2.5 2003/04/04 12:48:51 oes
+ * Fixed bug #711865:
+ * - Made tray menu correctly reflect initial window visibility state
+ * - Hopefully fixed problem where log window contents wasn't visible
+ * until vertical scroll bar was clicked. Thanks to Guy for the fix!
+ *
+ * Revision 1.25.2.4 2003/03/11 11:53:59 oes
+ * Cosmetic: Renamed cryptic variable
*
- * Revision 2.2 2002/09/05 08:43:11 oes
- * Synced with the stable branch:
- * Revision 1.25.2.1 2002/08/21 17:59:05 oes
- * - "Show Privoxy Window" now a toggle
- * - Temp kludge to let user and default action file be edited through win32 GUI (FR 592080)
+ * Revision 1.25.2.3 2002/11/20 14:39:05 oes
+ * Fixed compiler warning
*
- * Revision 2.1 2002/06/04 16:37:48 jongfoster
- * Adding Doxygen-style comments to variables
+ * Revision 1.25.2.2 2002/09/25 15:23:10 oes
+ * Uncheck the "Show Privoxy Window" taskbar menu item when window gets minimized. Fixes bug #606804
*
- * Revision 2.0 2002/06/04 14:34:21 jongfoster
- * Moving source files to src/
+ * Revision 1.25.2.1 2002/08/21 17:59:05 oes
+ * - "Show Privoxy Window" now a toggle
+ * - Temp kludge to let user and default action file be edited through win32 GUI (FR 592080)
*
* Revision 1.25 2002/04/04 00:36:36 gliptak
* always use pcre for matching
* configurable through the UI.
*/
-/** Indicates whether task bar shows activity animation */
+/* Indicates whether task bar shows activity animation */
BOOL g_bShowActivityAnimation = 1;
-/** Indicates whether the log window is shown */
+/* Indicates whether the log window is shown */
BOOL g_bShowLogWindow = 1;
-/** Indicates if the log window appears on the task bar */
+/* Indicates if the log window appears on the task bar */
BOOL g_bShowOnTaskBar = 0;
-/** Indicates whether closing the log window really just hides it */
+/* Indicates whether closing the log window really just hides it */
BOOL g_bCloseHidesWindow = 1;
-/** Indicates if messages are logged at all */
+/* Indicates if messages are logged at all */
BOOL g_bLogMessages = 1;
-/** Indicates whether log messages are highlighted */
+/* Indicates whether log messages are highlighted */
BOOL g_bHighlightMessages = 1;
-/** Indicates if buffer is limited in size */
+/* Indicates if buffer is limited in size */
BOOL g_bLimitBufferSize = 1;
-/** Maximum number of lines allowed in buffer when limited */
+/* Maximum number of lines allowed in buffer when limited */
int g_nMaxBufferLines = DEFAULT_MAX_BUFFER_LINES;
-/** Font to use */
+/* Font to use */
char g_szFontFaceName[255] = DEFAULT_LOG_FONT_NAME;
-/** Size of font to use */
+/* Size of font to use */
int g_nFontSize = DEFAULT_LOG_FONT_SIZE;
/* FIXME: this is a kludge */
-/** Second (=default, hopefully) Actions file name. */
const char * g_default_actions_file = NULL;
-
-/** Third (=user, hopefully) Actions file name. */
const char * g_user_actions_file = NULL;
-
-/** Filter file name. */
const char * g_re_filterfile = NULL;
-
#ifdef FEATURE_TRUST
-
-/** Trust file name. */
const char * g_trustfile = NULL;
-
#endif /* def FEATURE_TRUST */
/* FIXME: end kludge */
-
-/** Regular expression for detected URLs */
+/* Regular expression for detected URLs */
#define RE_URL "http:[^ \n\r]*"
-
-/**
- * Regular expressions that are used to perform highlight in the log window.
+/*
+ * Regular expressions that are used to perform highlight in the log window
*/
static struct _Pattern
{
- const char *str; /**< The pattern to match. */
- int style; /**< How to highlight it - one of the STYLE_xxx constants. */
- regex_t buffer; /**< The compiled pattern to use for matching. Generated from str. */
+ const char *str;
+ int style;
+ regex_t buffer;
} patterns_to_highlight[] =
{
/* url headers */
/* { "[a-zA-Z0-9]+\\.[a-zA-Z0-9]+\\.[a-zA-Z0-9]+\\.[^ \n\r]*", STYLE_LINK }, */
/* interesting text to highlight */
{ "crunch!", STYLE_HIGHLIGHT },
- { "crunch:", STYLE_HIGHLIGHT },
/* http headers */
{ "referer:", STYLE_HEADER },
{ "proxy-connection:", STYLE_HEADER },
/*
* Public variables
*/
-
-/**
- * Window handle for the log window.
- */
HWND g_hwndLogFrame;
-
+HICON g_hiconApp;
/*
* Private variables
*/
-
-/** Critical section used to serialize output to the log window. */
static CRITICAL_SECTION g_criticalsection;
-
-/** The window handle of the tray icon window. */
static HWND g_hwndTray;
-
-/** The window handle of the log window. */
static HWND g_hwndLogBox;
-
-/** The default window procedure for the rich edit control. Set when we
- subclass this window. */
static WNDPROC g_fnLogBox;
-
-/** The icons for the activity animation. */
static HICON g_hiconAnim[ANIM_FRAMES];
-
-/** The icon to use when idle. */
static HICON g_hiconIdle;
-
-/** The main application icon. */
-static HICON g_hiconApp;
-
-/** The index of the current animation frame. */
static int g_nAnimFrame;
-
-/** If a timer to call LogClipBuffer() has been started. */
static BOOL g_bClipPending = FALSE;
-
-/** The version of the rich edit control we're using. */
static int g_nRichEditVersion = 0;
-
/*
* Private functions
*/
* Function : LogClipBuffer
*
* Description : Prunes old lines from the log.
- * This is called occasionally, from a timer callback.
*
* Parameters : None
*
SendMessage(g_hwndLogBox, EM_REPLACESEL, FALSE, (LPARAM) "");
SendMessage(g_hwndLogBox, EM_SETOPTIONS, ECOOP_XOR, ECO_AUTOVSCROLL);
- /* Restore old selection */
+ /* reposition (back to) the end of the log content */
+ range.cpMin = SendMessage (g_hwndLogBox, WM_GETTEXTLENGTH, 0, 0);
+ range.cpMax = -1;
+ SendMessage(g_hwndLogBox, EM_EXSETSEL, 0, (LPARAM) &range);
+
+ /* restore vertical ScrollBar stuff (messed up by AUTOVSCROLL) */
+ SendMessage (g_hwndLogBox, EM_SCROLL, SB_LINEDOWN, 0);
+
}
-}
+}
/*********************************************************************
nCmdShow == SW_MINIMIZE ||
nCmdShow == SW_SHOWMINNOACTIVE))
{
+ g_bShowLogWindow = FALSE;
nCmdShow = SW_HIDE;
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
+
GetClientRect(g_hwndLogFrame, &rcClient);
SetWindowPos(g_hwndLogBox, NULL, rcClient.left, rcClient.top, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, SWP_NOZORDER);
#ifdef FEATURE_TOGGLE
/* by haroon - change toggle to its opposite value */
case ID_TOGGLE_ENABLED:
- g_bToggleIJB = !g_bToggleIJB;
- if (g_bToggleIJB)
+ global_toggle_state = !global_toggle_state;
+ if (global_toggle_state)
{
log_error(LOG_LEVEL_INFO, "Now toggled ON.");
}
CheckMenuItem(hmenu, ID_VIEW_ACTIVITYANIMATION, MF_BYCOMMAND | (g_bShowActivityAnimation ? MF_CHECKED : MF_UNCHECKED));
#ifdef FEATURE_TOGGLE
/* by haroon - menu item for Enable toggle on/off */
- CheckMenuItem(hmenu, ID_TOGGLE_ENABLED, MF_BYCOMMAND | (g_bToggleIJB ? MF_CHECKED : MF_UNCHECKED));
+ CheckMenuItem(hmenu, ID_TOGGLE_ENABLED, MF_BYCOMMAND | (global_toggle_state ? MF_CHECKED : MF_UNCHECKED));
#endif /* def FEATURE_TOGGLE */
CheckMenuItem(hmenu, ID_TOGGLE_SHOWWINDOW, MF_BYCOMMAND | (g_bShowLogWindow ? MF_CHECKED : MF_UNCHECKED));