commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-commons-sandbox/daemon/src/native/nt/procrun procgui.c procrun.h procrun.rc
Date Fri, 25 Apr 2003 14:55:35 GMT
mturk       2003/04/25 07:55:35

  Modified:    daemon/src/native/nt/procrun procgui.c procrun.h procrun.rc
  Log:
  Change the behavior of try icon.
  When TC is started the try icon is red (stopped), until we receive the
  Jk running message. Then change the try icon to green.
  Also when shutting down, don't delete the icon, but rather change it to
  green. It will get deleted when the process exits.
  
  Revision  Changes    Path
  1.6       +38 -33    jakarta-commons-sandbox/daemon/src/native/nt/procrun/procgui.c
  
  Index: procgui.c
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procgui.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- procgui.c	12 Mar 2003 17:25:44 -0000	1.5
  +++ procgui.c	25 Apr 2003 14:55:35 -0000	1.6
  @@ -111,6 +111,7 @@
   static procrun_t       *ac_env = NULL;
   static HICON           ac_main_icon;
   static HICON           ac_try_icon;
  +static HICON           ac_try_stop;
   static UINT            ac_taskbar_created;
   HWND                   ac_main_hwnd;
   static HWND            ac_list_hwnd;
  @@ -120,6 +121,33 @@
   char                   *ac_cmdname;
   RECT                   ac_winpos = {-1, 0, 640, 480};
   
  +void ac_show_try_icon(HWND hwnd, DWORD message, const char *tip, int stop)
  +{
  +    
  +    NOTIFYICONDATA nid;
  +    if (!ac_use_try)
  +        return;
  +
  +    ZeroMemory(&nid,sizeof(nid));
  +    nid.cbSize = sizeof(NOTIFYICONDATA);
  +    nid.hWnd = hwnd;
  +    nid.uID = 0xFF;
  +    nid.uFlags = NIF_ICON | NIF_MESSAGE;
  +    if (tip)
  +        nid.uFlags |= NIF_TIP;
  +
  +    nid.uCallbackMessage = WM_TRAYMESSAGE;
  +    
  +    if (message != NIM_DELETE)
  +        nid.hIcon = stop ? ac_try_stop : ac_try_icon;
  +    else
  +        nid.hIcon = NULL;
  +    if (tip)
  +        strcpy(nid.szTip, tip);
  +
  +    Shell_NotifyIcon(message, &nid);
  +}
  +
   void ac_add_list_string(const char *str, int len)
   {
       static int nqueue = 0;
  @@ -127,6 +155,10 @@
       int i;
   
       if (str) {
  +
  +        /* set the status to 'green' when received Jk running */
  +        if (strncmp(str, "INFO: Jk running", 16))
  +            ac_show_try_icon(ac_main_hwnd, NIM_MODIFY, ac_cmdname, 0);
           if (nqueue > MAX_LISTCOUNT - 1) {
               free(ac_stdout_lines[0]);
               /* TODO: improve performance */
  @@ -154,33 +186,6 @@
       nqueue = 0;
   }
   
  -void ac_show_try_icon(HWND hwnd, DWORD message, const char *tip)
  -{
  -    
  -    NOTIFYICONDATA nid;
  -    if (!ac_use_try)
  -        return;
  -
  -    ZeroMemory(&nid,sizeof(nid));
  -    nid.cbSize = sizeof(NOTIFYICONDATA);
  -    nid.hWnd = hwnd;
  -    nid.uID = 0xFF;
  -    nid.uFlags = NIF_ICON | NIF_MESSAGE;
  -    if (tip)
  -        nid.uFlags |= NIF_TIP;
  -
  -    nid.uCallbackMessage = WM_TRAYMESSAGE;
  -    
  -    if (message != NIM_DELETE)
  -        nid.hIcon = ac_try_icon;
  -    else
  -        nid.hIcon = NULL;
  -    if (tip)
  -        strcpy(nid.szTip, tip);
  -
  -    Shell_NotifyIcon(message, &nid);
  -}
  -
   static void ac_append_menu_item(HMENU menu, UINT menu_id, char *name, int isdef, int enabled)
   {
       MENUITEMINFO mii;
  @@ -437,12 +442,12 @@
   {
       if (message == ac_taskbar_created) {
           /* restore the tray icon on shell restart */
  -        ac_show_try_icon(hwnd, NIM_ADD, ac_cmdname);
  +        ac_show_try_icon(hwnd, NIM_ADD, ac_cmdname, 0);
           return DefWindowProc(hwnd, message, wparam, lparam);
       }
       switch (message) {
           case WM_CREATE:
  -            ac_show_try_icon(hwnd, NIM_ADD, ac_cmdname);
  +            ac_show_try_icon(hwnd, NIM_ADD, ac_cmdname, 1);
               if (ac_use_show) {
                   DialogBox(ac_instance, MAKEINTRESOURCE(IDD_DLGCONSOLE),
                             hwnd, (DLGPROC)ac_console_dlg_proc);
  @@ -450,7 +455,7 @@
               break;
           case WM_DESTROY:
           case WM_QUIT:
  -            ac_show_try_icon(hwnd, NIM_DELETE, NULL);
  +            ac_show_try_icon(hwnd, NIM_DELETE, NULL, 0);
               SetEvent(g_env->m->events[0]);
               break;
           case WM_TRAYMESSAGE:
  @@ -464,10 +469,8 @@
           case WM_COMMAND:
               switch (LOWORD(wparam)) {
                  case IDM_EXIT:
  -                   ac_show_try_icon(hwnd, NIM_DELETE, NULL);
  +                   ac_show_try_icon(hwnd, NIM_MODIFY, ac_cmdname, 1);
                      SetEvent(g_env->m->events[0]);
  -
  -                   PostQuitMessage(CONWRAP_SUCCESS);
                      return TRUE;
                      break;
                  case IDM_CONSOLE:
  @@ -514,6 +517,8 @@
       wcex.hIconSm        = (HICON)LoadImage(instance, MAKEINTRESOURCE(IDI_ICOCONWRAP),
                                              IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
       ac_try_icon = (HICON)LoadImage(instance, MAKEINTRESOURCE(IDI_ICOCONTRY),
  +                                           IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
  +    ac_try_stop = (HICON)LoadImage(instance, MAKEINTRESOURCE(IDI_ICOCONTRYSTOP),
                                              IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
       if (RegisterClassEx(&wcex))
           hwnd = CreateWindow(wclass, title,
  
  
  
  1.11      +1 -0      jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.h
  
  Index: procrun.h
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- procrun.h	12 Mar 2003 17:25:44 -0000	1.10
  +++ procrun.h	25 Apr 2003 14:55:35 -0000	1.11
  @@ -96,6 +96,7 @@
   #define IDD_ABOUTBOX          118
   #define IDC_RICHEDIT21        119
   #define IDM_ABOUT             120
  +#define IDI_ICOCONTRYSTOP     121
   #define IDC_STATIC             -1
   
   #define PROC_ENV_COUNT  32
  
  
  
  1.5       +1 -0      jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.rc
  
  Index: procrun.rc
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.rc,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- procrun.rc	21 Feb 2003 21:07:24 -0000	1.4
  +++ procrun.rc	25 Apr 2003 14:55:35 -0000	1.5
  @@ -3,6 +3,7 @@
   
   IDI_ICOCONWRAP         ICON                    "tomcatp.ico"
   IDI_ICOCONTRY          ICON                    "tomcatr.ico"
  +IDI_ICOCONTRYSTOP      ICON                    "tomcats.ico"
   IDR_RTFLIC             RTF                     "License.rtf"
   
   IDB_BMPJAKARTA         BITMAP   DISCARDABLE    "jakarta-banner.bmp"
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message