Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

w32log.c File Reference

Functions for creating and destroying the log window, ouputting strings, processing messages and so on. More...


Data Structures

struct  _Pattern
 Regular expressions that are used to perform highlight in the log window. More...


Defines

#define TIMER_ANIM_ID   1
#define TIMER_ANIM_TIME   100
#define TIMER_ANIMSTOP_ID   2
#define TIMER_ANIMSTOP_TIME   1000
#define TIMER_CLIPBUFFER_ID   3
#define TIMER_CLIPBUFFER_TIME   1000
#define TIMER_CLIPBUFFER_FORCE_ID   4
#define TIMER_CLIPBUFFER_FORCE_TIME   5000
#define STYLE_NONE   0
#define STYLE_HIGHLIGHT   1
#define STYLE_LINK   2
#define STYLE_HEADER   3
#define ANIM_FRAMES   8
#define DEFAULT_MAX_BUFFER_LINES   200
#define DEFAULT_LOG_FONT_NAME   "MS Sans Serif"
#define DEFAULT_LOG_FONT_SIZE   8
#define RE_URL   "http:[^ \n\r]*"

Functions

HWND CreateLogWindow (HINSTANCE hInstance, int nCmdShow)
HWND CreateHiddenLogOwnerWindow (HINSTANCE hInstance)
LRESULT CALLBACK LogWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK LogOwnerWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK LogRichEditProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL InitRichEdit (void)
void LogClipBuffer (void)
void LogCreatePatternMatchingBuffers (void)
void LogDestroyPatternMatchingBuffers (void)
int LogPutStringNoMatch (const char *pszText, int style)
BOOL InitLogWindow (void)
void TermLogWindow (void)
char * LogGetURLUnderCursor (void)
int LogPutString (const char *pszText)
void LogShowActivity (void)
void ShowLogWindow (BOOL bShow)
void EditFile (const char *filename)
void OnLogRButtonUp (int nModifier, int x, int y)
void OnLogCommand (int nCommand)
void OnLogInitMenu (HMENU hmenu)
void OnLogTimer (int nTimer)

Variables

const char w32log_rcs [] = "$Id: w32log.c,v 2.1 2002/06/04 16:37:48 jongfoster Exp $"
const char w32res_h_rcs [] = W32RES_H_VERSION
const char w32log_h_rcs [] = W32LOG_H_VERSION
BOOL g_bShowActivityAnimation = 1
BOOL g_bShowOnTaskBar = 0
BOOL g_bCloseHidesWindow = 1
BOOL g_bLogMessages = 1
BOOL g_bHighlightMessages = 1
BOOL g_bLimitBufferSize = 1
int g_nMaxBufferLines = DEFAULT_MAX_BUFFER_LINES
char g_szFontFaceName [255] = DEFAULT_LOG_FONT_NAME
int g_nFontSize = DEFAULT_LOG_FONT_SIZE
const char * g_actions_file = NULL
const char * g_re_filterfile = NULL
_Pattern patterns_to_highlight []
HWND g_hwndLogFrame
CRITICAL_SECTION g_criticalsection
HWND g_hwndTray
HWND g_hwndLogBox
WNDPROC g_fnLogBox
HICON g_hiconAnim [ANIM_FRAMES]
HICON g_hiconIdle
HICON g_hiconApp
int g_nAnimFrame
BOOL g_bClipPending = FALSE
int g_nRichEditVersion = 0


Detailed Description

Functions for creating and destroying the log window, ouputting strings, processing messages and so on.

Log:
w32log.c,v
Revision 2.1 2002/06/04 16:37:48 jongfoster Adding Doxygen-style comments to variables

Revision 2.0 2002/06/04 14:34:21 jongfoster Moving source files to src/

Revision 1.25 2002/04/04 00:36:36 gliptak always use pcre for matching

Revision 1.24 2002/03/31 17:19:00 jongfoster Win32 only: Enabling STRICT to fix a VC++ compile warning.

Revision 1.23 2002/03/26 22:57:10 jongfoster Web server name should begin www.

Revision 1.22 2002/03/24 12:48:23 jongfoster Fixing doc links

Revision 1.21 2002/03/24 12:07:35 jongfoster Consistern name for filters file

Revision 1.20 2002/03/24 12:03:47 jongfoster Name change

Revision 1.19 2002/01/17 21:04:17 jongfoster Replacing hard references to the URL of the config interface with defines from project.h

Revision 1.18 2001/11/30 23:37:24 jongfoster Renaming the Win32 config file to config.txt - this is almost the same as the corresponding UNIX name "config"

Revision 1.17 2001/11/16 00:46:31 jongfoster Fixing compiler warnings

Revision 1.16 2001/08/01 19:58:12 jongfoster Fixing documentation filenames in help menu, and making status option work without needing the "Junkbuster Status.URL" file.

Revision 1.15 2001/07/30 22:08:36 jongfoster Tidying up defines:

Revision 1.14 2001/07/29 18:47:05 jongfoster Adding missing include "loadcfg.h"

Revision 1.13 2001/07/19 19:15:14 haroon

Revision 1.12 2001/07/13 14:04:59 oes Removed all ifdef PCRS

Revision 1.11 2001/06/07 23:08:12 jongfoster Forward and ACL edit options removed.

Revision 1.10 2001/05/31 21:37:11 jongfoster GUI changes to rename "permissions file" to "actions file".

Revision 1.9 2001/05/31 17:33:13 oes

CRLF -> LF

Revision 1.8 2001/05/29 09:50:24 jongfoster Unified blocklist/imagelist/permissionslist. File format is still under discussion, but the internal changes are (mostly) done.

Also modified interceptor behaviour:

Revision 1.7 2001/05/26 01:26:34 jongfoster New define, WIN_GUI_EDIT, enables the (embryonic) Win32 GUI editor. This define cannot be set from ./configure - there's no point, it doesn't work yet. See feature request # 425722

Revision 1.6 2001/05/26 00:31:30 jongfoster Fixing compiler warning about comparing signed/unsigned.

Revision 1.5 2001/05/26 00:28:36 jongfoster Automatic reloading of config file. Removed obsolete SIGHUP support (Unix) and Reload menu option (Win32). Most of the global variables have been moved to a new struct configuration_spec, accessed through csp->config->globalname Most of the globals remaining are used by the Win32 GUI.

Revision 1.4 2001/05/22 18:56:28 oes CRLF -> LF

Revision 1.3 2001/05/20 15:07:54 jongfoster File is now ignored if _WIN_CONSOLE is defined.

Revision 1.2 2001/05/20 01:21:20 jongfoster Version 2.9.4 checkin.

Revision 1.1.1.1 2001/05/15 13:59:07 oes Initial import of version 2.9.3 source tree


Define Documentation

#define RE_URL   "http:[^ \n\r]*"
 

Regular expression for detected URLs.


Function Documentation

HWND CreateHiddenLogOwnerWindow HINSTANCE    hInstance [static]
 

Creates a hidden owner window that stops the log window appearing in the task bar.

Parameters:
hInstance  application's instance handle
Returns:
Handle to newly created window.

HWND CreateLogWindow HINSTANCE    hInstance,
int    nCmdShow
[static]
 

Create the logging window.

Parameters:
hInstance  application's instance handle
nCmdShow  window show value (MIN, MAX, NORMAL, etc...)
Returns:
Handle to newly created window.

void EditFile const char *    filename
 

Opens the specified setting file for editing.

FIXME: What if the file has no associated application. Check for return values from ShellExecute??

Parameters:
filename  filename from the config (aka config.txt) file.
Returns:
N/A

BOOL InitLogWindow void   
 

Initialise the log window.

Returns:
Always TRUE (there should be error checking on the resources).

BOOL InitRichEdit void    [static]
 

Initialise the rich edit control library.

Returns:
TRUE => success, FALSE => failure.

FIXME this is backwards to the rest of IJB and to common programming practice. Please use 0 => success instead.

void LogClipBuffer void    [static]
 

Prunes old lines from the log.

This is called occasionally, from a timer callback.

Returns:
N/A

void LogCreatePatternMatchingBuffers void    [static]
 

Compile the pattern matching buffers.

Returns:
N/A

void LogDestroyPatternMatchingBuffers void    [static]
 

Free up the pattern matching buffers.

Returns:
N/A

char* LogGetURLUnderCursor void   
 

Returns the URL from under the cursor (remember to free it!).

Returns:
NULL or a pointer to an URL string.

LRESULT CALLBACK LogOwnerWindowProc HWND    hwnd,
UINT    uMsg,
WPARAM    wParam,
LPARAM    lParam
[static]
 

Dummy procedure that does nothing special.

Parameters:
hwnd  window handle
uMsg  message number
wParam  first param for this message
lParam  next param for this message
Returns:
Same as `DefWindowProc'.

int LogPutString const char *    pszText
 

Inserts text into the logging window.

This is really a regexp aware wrapper function to `LogPutStringNoMatch'.

Parameters:
pszText  pointer to string going to the log window
Returns:
1 => success, else the return code from `LogPutStringNoMatch'.

FIXME this is backwards to the rest of IJB and to common programming practice. Please use 0 => success instead.

int LogPutStringNoMatch const char *    pszText,
int    style
[static]
 

Puts a string into the logging window.

Parameters:
pszText  pointer to string going to the log window
style  STYLE_NONE, STYLE_HEADER, STYLE_HIGHLIGHT, or STYLE_LINK
Returns:
Always 1 => success.

FIXME this is backwards to the rest of IJB and to common programming practice. Please use 0 => success instead.

LRESULT CALLBACK LogRichEditProc HWND    hwnd,
UINT    uMsg,
WPARAM    wParam,
LPARAM    lParam
[static]
 

Window subclass routine handles some events for the rich edit control.

Parameters:
hwnd  window handle of the rich edit control
uMsg  message number
wParam  first param for this message
lParam  next param for this message
Returns:
Appropriate M$ window message handler codes.

void LogShowActivity void   
 

Start the spinner.

Returns:
N/A

LRESULT CALLBACK LogWindowProc HWND    hwnd,
UINT    uMsg,
WPARAM    wParam,
LPARAM    lParam
[static]
 

Windows call back routine handles events on the log window.

Parameters:
hwnd  handle of the logging window
uMsg  message number
wParam  first param for this message
lParam  next param for this message
Returns:
Appropriate M$ window message handler codes.

void OnLogCommand int    nCommand
 

Handler for WM_COMMAND messages.

Parameters:
nCommand  the command portion of the menu selection event
Returns:
N/A

void OnLogInitMenu HMENU    hmenu
 

Handler for WM_INITMENU messages.

Enable, disable, check, and/or uncheck menu options as apropos.

Parameters:
hmenu  handle to menu to "make current"
Returns:
N/A

void OnLogRButtonUp int    nModifier,
int    x,
int    y
 

Handler for WM_RBUTTONUP messages.

Parameters:
nModifier  wParam from mouse message (unused)
x  x coordinate of the mouse event
y  y coordinate of the mouse event
Returns:
N/A

void OnLogTimer int    nTimer
 

Handler for WM_TIMER messages.

Parameters:
nTimer  timer id (animation start/stop or clip buffer)
Returns:
N/A

void ShowLogWindow BOOL    bShow
 

Shows or hides the log window.

We will also raise the window on a show command in case it is buried.

Parameters:
bShow  TRUE to show, FALSE to mimize/hide
Returns:
N/A

void TermLogWindow void   
 

Cleanup the logwindow.

Returns:
N/A


Variable Documentation

const char* g_actions_file = NULL
 

Actions file name.

BOOL g_bClipPending = FALSE [static]
 

If a timer to call LogClipBuffer() has been started.

BOOL g_bCloseHidesWindow = 1
 

Indicates whether closing the log window really just hides it.

BOOL g_bHighlightMessages = 1
 

Indicates whether log messages are highlighted.

BOOL g_bLimitBufferSize = 1
 

Indicates if buffer is limited in size.

BOOL g_bLogMessages = 1
 

Indicates if messages are logged at all.

BOOL g_bShowActivityAnimation = 1
 

Indicates whether task bar shows activity animation.

BOOL g_bShowOnTaskBar = 0
 

Indicates if the log window appears on the task bar.

CRITICAL_SECTION g_criticalsection [static]
 

Critical section used to serialize output to the log window.

WNDPROC g_fnLogBox [static]
 

The default window procedure for the rich edit control.

Set when we subclass this window.

HICON g_hiconAnim[ANIM_FRAMES] [static]
 

The icons for the activity animation.

HICON g_hiconApp [static]
 

The main application icon.

HICON g_hiconIdle [static]
 

The icon to use when idle.

HWND g_hwndLogBox [static]
 

The window handle of the log window.

HWND g_hwndLogFrame
 

Window handle for the log window.

HWND g_hwndTray [static]
 

The window handle of the tray icon window.

int g_nAnimFrame [static]
 

The index of the current animation frame.

int g_nFontSize = DEFAULT_LOG_FONT_SIZE
 

Size of font to use.

int g_nMaxBufferLines = DEFAULT_MAX_BUFFER_LINES
 

Maximum number of lines allowed in buffer when limited.

int g_nRichEditVersion = 0 [static]
 

The version of the rich edit control we're using.

const char* g_re_filterfile = NULL
 

Filter file name.

char g_szFontFaceName[255] = DEFAULT_LOG_FONT_NAME
 

Font to use.

struct _Pattern patterns_to_highlight[] [static]
 

Regular expressions that are used to perform highlight in the log window.

const char w32log_h_rcs[] = W32LOG_H_VERSION
 

Version information about w32log.h.

const char w32log_rcs[] = "$Id: w32log.c,v 2.1 2002/06/04 16:37:48 jongfoster Exp $"
 

Version information about w32log.c.


Generated on Tue Jun 4 18:54:49 2002 for Privoxy 3.1.1 by doxygen1.2.15