<commit_before>//
// Capture.cpp : Capture events to a window.
//

#include "stdafx.h"
#include "Capture.h"
#include "vtdata/vtLog.h"

// Class statics
std::map <void*, Capture*> Capture::registry;

Capture::Capture(void* winId)
{
	_ok = false;
	_winId = winId;
	registry.insert(std::pair<void*, Capture*>(_winId, this));
}

void Capture::init()
{
	// install an event filter on the widget
	_oldWndProc = (WNDPROC)SetWindowLong((HWND)_winId, GWL_WNDPROC, (LONG) s_wndProc);
	_ok = true;
}

Capture::~Capture()
{
	if(_ok)
		SetWindowLong((HWND)_winId, GWL_WNDPROC, (LONG) _oldWndProc);
}

LRESULT CALLBACK Capture::s_wndProc(HWND hWnd, UINT uMsg,
									WPARAM wParam, LPARAM lParam)
{
	std::map <void*, Capture*>::iterator p;
	p = registry.find( (void*)hWnd );
	if( p == registry.end() )
		return DefWindowProc( hWnd, uMsg, wParam, lParam );
	else
		return p->second->wndProc( hWnd, uMsg, wParam, lParam );
}

LRESULT CALLBACK Capture::wndProc(HWND hWnd, UINT iMsg,
								  WPARAM wParam, LPARAM lParam)
{
#if 1
	VTLOG("Capture sees %3d (0x%04x)", iMsg, iMsg);
	if (iMsg == WM_MOVE) VTLOG1(" (WM_MOVE)");
	if (iMsg == WM_SETFOCUS) VTLOG1(" (WM_SETFOCUS)");
	if (iMsg == WM_SETCURSOR) VTLOG1(" (WM_SETCURSOR)");
	if (iMsg == WM_MOUSEMOVE) VTLOG1(" (WM_MOUSEMOVE)");
	if (iMsg == WM_NCHITTEST) VTLOG1(" (WM_NCHITTEST)");
	if (iMsg == WM_SHOWWINDOW) VTLOG1(" (WM_SHOWWINDOW)");<commit_msg>turned off some excessive logging<commit_after>//
// Capture.cpp : Capture events to a window.
//

#include "stdafx.h"
#include "Capture.h"
#include "vtdata/vtLog.h"

// Class statics
std::map <void*, Capture*> Capture::registry;

Capture::Capture(void* winId)
{
	_ok = false;
	_winId = winId;
	registry.insert(std::pair<void*, Capture*>(_winId, this));
}

void Capture::init()
{
	// install an event filter on the widget
	_oldWndProc = (WNDPROC)SetWindowLong((HWND)_winId, GWL_WNDPROC, (LONG) s_wndProc);
	_ok = true;
}

Capture::~Capture()
{
	if(_ok)
		SetWindowLong((HWND)_winId, GWL_WNDPROC, (LONG) _oldWndProc);
}

LRESULT CALLBACK Capture::s_wndProc(HWND hWnd, UINT uMsg,
									WPARAM wParam, LPARAM lParam)
{
	std::map <void*, Capture*>::iterator p;
	p = registry.find( (void*)hWnd );
	if( p == registry.end() )
		return DefWindowProc( hWnd, uMsg, wParam, lParam );
	else
		return p->second->wndProc( hWnd, uMsg, wParam, lParam );
}

LRESULT CALLBACK Capture::wndProc(HWND hWnd, UINT iMsg,
								  WPARAM wParam, LPARAM lParam)
{
#if _DEBUG
	VTLOG("Capture sees %3d (0x%04x)", iMsg, iMsg);
	if (iMsg == WM_MOVE) VTLOG1(" (WM_MOVE)");
	if (iMsg == WM_SETFOCUS) VTLOG1(" (WM_SETFOCUS)");
	if (iMsg == WM_SETCURSOR) VTLOG1(" (WM_SETCURSOR)");
	if (iMsg == WM_MOUSEMOVE) VTLOG1(" (WM_MOUSEMOVE)");
	if (iMsg == WM_NCHITTEST) VTLOG1(" (WM_NCHITTEST)");
	if (iMsg == WM_SHOWWINDOW) VTLOG1(" (WM_SHOWWINDOW)");
{'fraction_non_alphanumeric': 0.1696969696969697, 'fraction_numerical': 0.0074866310160427805, 'mean_word_length': 5.008565310492505, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4012975', 'n_tokens_mistral': 1216, 'n_tokens_neox': 1191, 'n_words': 265}