Change the Windows taskbar icon when privoxy is toggled off.
authorLee <ler762@users.sourceforge.net>
Thu, 1 Jan 2009 15:09:23 +0000 (15:09 +0000)
committerLee <ler762@users.sourceforge.net>
Thu, 1 Jan 2009 15:09:23 +0000 (15:09 +0000)
w32.rc
w32log.c
w32res.h

diff --git a/w32.rc b/w32.rc
index e5b20a4..c8c6f9c 100644 (file)
--- a/w32.rc
+++ b/w32.rc
  *
  * Revisions   :
  *    $Log: w32.rc,v $
  *
  * Revisions   :
  *    $Log: w32.rc,v $
+ *    Revision 1.21  2008/11/02 14:37:47  ler762
+ *    commit the part of the patches I've been using that were written by torford and gjmurphy
+ *      [ 1824315 ] Minor code cleanup
+ *      [ 1781135 ] Patch - Add clear log, select all, and Accelerators for w32
+ *        http://sourceforge.net/tracker/?func=detail&atid=311118&aid=1781135&group_id=11118
+ *    The full patch adds control keys A(select all), C(copy) and D(delete all) to the
+ *    Privoxy log window menu.  Select all and copy work for me without the patch
+ *    (albeit without showing the accelerator keys on the menu), so the only part of the
+ *    patch I've been using for the last year or so has been the ctrl-d to delete
+ *    everything in the Privoxy log window.
+ *
  *    Revision 1.20  2006/08/18 02:06:25  david__schmidt
  *    Making icon go back to blue when idle.
  *    See: bug #967648.
  *    Revision 1.20  2006/08/18 02:06:25  david__schmidt
  *    Making icon go back to blue when idle.
  *    See: bug #967648.
@@ -178,6 +189,7 @@ IDI_ANIMATED6           ICON    DISCARDABLE     "icons/ico00006.ico"
 IDI_ANIMATED7           ICON    DISCARDABLE     "icons/ico00007.ico"
 IDI_ANIMATED8           ICON    DISCARDABLE     "icons/ico00008.ico"
 IDI_IDLE                ICON    DISCARDABLE     "icons/privoxy.ico"
 IDI_ANIMATED7           ICON    DISCARDABLE     "icons/ico00007.ico"
 IDI_ANIMATED8           ICON    DISCARDABLE     "icons/ico00008.ico"
 IDI_IDLE                ICON    DISCARDABLE     "icons/privoxy.ico"
+IDI_OFF                 ICON    DISCARDABLE     "icons/off.ico"
 
 #endif /* Neutral resources */
 
 
 #endif /* Neutral resources */
 
index dc3f3ac..9c92131 100644 (file)
--- a/w32log.c
+++ b/w32log.c
@@ -1,4 +1,4 @@
-const char w32log_rcs[] = "$Id: w32log.c,v 1.28 2008/11/02 14:37:47 ler762 Exp $";
+const char w32log_rcs[] = "$Id: w32log.c,v 1.29 2008/12/20 15:27:40 ler762 Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/w32log.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/w32log.c,v $
@@ -32,6 +32,10 @@ const char w32log_rcs[] = "$Id: w32log.c,v 1.28 2008/11/02 14:37:47 ler762 Exp $
  *
  * Revisions   :
  *    $Log: w32log.c,v $
  *
  * Revisions   :
  *    $Log: w32log.c,v $
+ *    Revision 1.29  2008/12/20 15:27:40  ler762
+ *    The crunch log message format changed, so update the strings to highlight
+ *    in the log window.
+ *
  *    Revision 1.28  2008/11/02 14:37:47  ler762
  *    commit the part of the patches I've been using that were written by torford and gjmurphy
  *      [ 1824315 ] Minor code cleanup
  *    Revision 1.28  2008/11/02 14:37:47  ler762
  *    commit the part of the patches I've been using that were written by torford and gjmurphy
  *      [ 1824315 ] Minor code cleanup
@@ -367,6 +371,7 @@ static HWND g_hwndLogBox;
 static WNDPROC g_fnLogBox;
 static HICON g_hiconAnim[ANIM_FRAMES];
 static HICON g_hiconIdle;
 static WNDPROC g_fnLogBox;
 static HICON g_hiconAnim[ANIM_FRAMES];
 static HICON g_hiconIdle;
+static HICON g_hiconOff;
 static int g_nAnimFrame;
 static BOOL g_bClipPending = FALSE;
 static int g_nRichEditVersion = 0;
 static int g_nAnimFrame;
 static BOOL g_bClipPending = FALSE;
 static int g_nRichEditVersion = 0;
@@ -384,6 +389,7 @@ static void LogClipBuffer(void);
 static void LogCreatePatternMatchingBuffers(void);
 static void LogDestroyPatternMatchingBuffers(void);
 static int LogPutStringNoMatch(const char *pszText, int style);
 static void LogCreatePatternMatchingBuffers(void);
 static void LogDestroyPatternMatchingBuffers(void);
 static int LogPutStringNoMatch(const char *pszText, int style);
+static void SetIdleIcon(void);
 
 
 /*********************************************************************
 
 
 /*********************************************************************
@@ -403,6 +409,7 @@ BOOL InitLogWindow(void)
 
    /* Load the icons */
    g_hiconIdle = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_IDLE));
 
    /* Load the icons */
    g_hiconIdle = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_IDLE));
+   g_hiconOff  = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_OFF));
    for (i = 0; i < ANIM_FRAMES; i++)
    {
       g_hiconAnim[i] = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ANIMATED1 + i));
    for (i = 0; i < ANIM_FRAMES; i++)
    {
       g_hiconAnim[i] = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ANIMATED1 + i));
@@ -445,6 +452,7 @@ void TermLogWindow(void)
    TrayDeleteIcon(g_hwndTray, 1);
    DeleteObject(g_hiconApp);
    DeleteObject(g_hiconIdle);
    TrayDeleteIcon(g_hwndTray, 1);
    DeleteObject(g_hiconApp);
    DeleteObject(g_hiconIdle);
+   DeleteObject(g_hiconOff);
    for (i = 0; i < ANIM_FRAMES; i++)
    {
       DeleteObject(g_hiconAnim[i]);
    for (i = 0; i < ANIM_FRAMES; i++)
    {
       DeleteObject(g_hiconAnim[i]);
@@ -1159,6 +1167,7 @@ void OnLogCommand(int nCommand)
          {
             log_error(LOG_LEVEL_INFO, "Now toggled OFF.");
          }
          {
             log_error(LOG_LEVEL_INFO, "Now toggled OFF.");
          }
+         SetIdleIcon();
          break;
 #endif /* def FEATURE_TOGGLE */
 
          break;
 #endif /* def FEATURE_TOGGLE */
 
@@ -1271,7 +1280,7 @@ void OnLogTimer(int nTimer)
 
       case TIMER_ANIMSTOP_ID:
          g_nAnimFrame = 0;
 
       case TIMER_ANIMSTOP_ID:
          g_nAnimFrame = 0;
-         TraySetIcon(g_hwndTray, 1, g_hiconIdle);
+         SetIdleIcon();
          KillTimer(g_hwndLogFrame, TIMER_ANIM_ID);
          KillTimer(g_hwndLogFrame, TIMER_ANIMSTOP_ID);
          break;
          KillTimer(g_hwndLogFrame, TIMER_ANIM_ID);
          KillTimer(g_hwndLogFrame, TIMER_ANIMSTOP_ID);
          break;
@@ -1292,6 +1301,31 @@ void OnLogTimer(int nTimer)
 }
 
 
 }
 
 
+/*********************************************************************
+ *
+ * Function    :  SetIdleIcon
+ *
+ * Description :  Sets the tray icon to either idle or off
+ *
+ * Parameters  :  none
+ *
+ * Returns     :  N/A
+ *
+ *********************************************************************/
+void SetIdleIcon()
+{
+#ifdef FEATURE_TOGGLE
+         if (!global_toggle_state)
+         {
+            TraySetIcon(g_hwndTray, 1, g_hiconOff);
+            /* log_error(LOG_LEVEL_INFO, "Privoxy OFF icon selected."); */
+         }
+         else
+#endif /* def FEATURE_TOGGLE */
+         TraySetIcon(g_hwndTray, 1, g_hiconIdle);
+}
+
+
 /*********************************************************************
  *
  * Function    :  LogRichEditProc
 /*********************************************************************
  *
  * Function    :  LogRichEditProc
index ffe1b1b..0216bf5 100644 (file)
--- a/w32res.h
+++ b/w32res.h
@@ -1,6 +1,6 @@
 #ifndef W32RES_H_INCLUDED
 #define W32RES_H_INCLUDED
 #ifndef W32RES_H_INCLUDED
 #define W32RES_H_INCLUDED
-#define W32RES_H_VERSION "$Id: w32res.h,v 1.15 2006/07/18 14:48:48 david__schmidt Exp $"
+#define W32RES_H_VERSION "$Id: w32res.h,v 1.16 2008/11/02 14:37:47 ler762 Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/w32res.h,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/w32res.h,v $
  *
  * Revisions   :
  *    $Log: w32res.h,v $
  *
  * Revisions   :
  *    $Log: w32res.h,v $
+ *    Revision 1.16  2008/11/02 14:37:47  ler762
+ *    commit the part of the patches I've been using that were written by torford and gjmurphy
+ *      [ 1824315 ] Minor code cleanup
+ *      [ 1781135 ] Patch - Add clear log, select all, and Accelerators for w32
+ *        http://sourceforge.net/tracker/?func=detail&atid=311118&aid=1781135&group_id=11118
+ *    The full patch adds control keys A(select all), C(copy) and D(delete all) to the
+ *    Privoxy log window menu.  Select all and copy work for me without the patch
+ *    (albeit without showing the accelerator keys on the menu), so the only part of the
+ *    patch I've been using for the last year or so has been the ctrl-d to delete
+ *    everything in the Privoxy log window.
+ *
  *    Revision 1.15  2006/07/18 14:48:48  david__schmidt
  *    Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
  *    with what was really the latest development (the v_3_0_branch branch)
  *    Revision 1.15  2006/07/18 14:48:48  david__schmidt
  *    Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
  *    with what was really the latest development (the v_3_0_branch branch)
 #define IDI_ANIMATED6                     206
 #define IDI_ANIMATED7                     207
 #define IDI_ANIMATED8                     208
 #define IDI_ANIMATED6                     206
 #define IDI_ANIMATED7                     207
 #define IDI_ANIMATED8                     208
+#define IDI_OFF                           209
 
 #define ID_TOGGLE_SHOWWINDOW              4000
 #define ID_HELP_ABOUT                     4001
 
 #define ID_TOGGLE_SHOWWINDOW              4000
 #define ID_HELP_ABOUT                     4001