X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=w32log.c;h=bc795de2c587d25cd0be44692769ccff4ff6dae8;hp=60943384e3b1ec93ecab4fc5a3669d8d50010a8d;hb=6d8aa69a37ff8b7d22b8f8a1afa322053ce14329;hpb=336826411c27cfe02a98f3cdd0b92d8e3ae0eae0 diff --git a/w32log.c b/w32log.c index 60943384..bc795de2 100644 --- a/w32log.c +++ b/w32log.c @@ -1,4 +1,4 @@ -const char w32log_rcs[] = "$Id: w32log.c,v 1.37 2010/06/13 12:31:04 fabiankeil Exp $"; +const char w32log_rcs[] = "$Id: w32log.c,v 1.45 2012/05/24 15:05:17 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/w32log.c,v $ @@ -12,7 +12,7 @@ const char w32log_rcs[] = "$Id: w32log.c,v 1.37 2010/06/13 12:31:04 fabiankeil E * Written by and Copyright (C) 1999 Adam Lock * * - * This program is free software; you can redistribute it + * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software * Foundation; either version 2 of the License, or (at @@ -370,12 +370,12 @@ int LogPutString(const char *pszText) int i; int result = 0; - if (pszText == NULL || strlen(pszText) == 0) + if (!g_bLogMessages) { return 1; } - if (!g_bLogMessages) + if (pszText == NULL || strlen(pszText) == 0) { return 1; } @@ -598,13 +598,13 @@ void LogClipBuffer(void) 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); - + } -} +} /********************************************************************* @@ -641,7 +641,7 @@ HWND CreateHiddenLogOwnerWindow(HINSTANCE hInstance) hwnd = CreateWindow(szWndName, szWndName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, NULL, NULL, hInstance, NULL ); + CW_USEDEFAULT, NULL, NULL, hInstance, NULL); return hwnd; @@ -806,7 +806,7 @@ void ShowLogWindow(BOOL bShow) { SetForegroundWindow(g_hwndLogFrame); SetWindowPos(g_hwndLogFrame, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE); - + } else if (g_bShowOnTaskBar) { @@ -944,18 +944,17 @@ void OnLogCommand(int nCommand) break; #ifdef FEATURE_TOGGLE - /* by haroon - change toggle to its opposite value */ case ID_TOGGLE_ENABLED: global_toggle_state = !global_toggle_state; - if (global_toggle_state) - { - log_error(LOG_LEVEL_INFO, "Now toggled ON."); - } - else - { - log_error(LOG_LEVEL_INFO, "Now toggled OFF."); - } - SetIdleIcon(); + log_error(LOG_LEVEL_INFO, + "Now toggled %s", global_toggle_state ? "ON" : "OFF"); + /* + * Leverage TIMER_ANIMSTOP_ID to set the idle icon through the + * "application queue". According to MSDN, 10 milliseconds are + * the lowest value possible and seem to be close enough to + * "instantly". + */ + SetTimer(g_hwndLogFrame, TIMER_ANIMSTOP_ID, 10, NULL); break; #endif /* def FEATURE_TOGGLE */ @@ -1111,7 +1110,6 @@ void SetIdleIcon() if (!global_toggle_state) { TraySetIcon(g_hwndTray, 1, g_hiconOff); - /* log_error(LOG_LEVEL_INFO, "Privoxy OFF icon selected."); */ } else #endif /* def FEATURE_TOGGLE */ @@ -1184,7 +1182,7 @@ LRESULT CALLBACK LogWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara return 0; case WM_CLOSE: - /* This is the end - beautiful friend - the end */ + /* This is the end - my only friend - the end */ DestroyWindow(g_hwndLogBox); DestroyWindow(g_hwndLogFrame); return 0;