You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by mt...@apache.org on 2003/09/29 10:56:50 UTC

cvs commit: jakarta-commons/daemon/src/native/nt/procrun extend.h procgui.c procrun.c procrun.h procrun.rc

mturk       2003/09/29 01:56:50

  Modified:    daemon/src/native/nt/procrun procgui.c procrun.c procrun.h
                        procrun.rc
  Added:       daemon/src/native/nt/procrun extend.h
  Log:
  Remove the TC specific code.
  This code is moved to j-t-c-/procrun.
  
  Revision  Changes    Path
  1.5       +31 -179   jakarta-commons/daemon/src/native/nt/procrun/procgui.c
  
  Index: procgui.c
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/daemon/src/native/nt/procrun/procgui.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- procgui.c	28 Sep 2003 15:52:35 -0000	1.4
  +++ procgui.c	29 Sep 2003 08:56:50 -0000	1.5
  @@ -115,9 +115,8 @@
   int                    ac_use_try = 0;
   int                    ac_use_dlg = 0;
   int                    ac_use_show = 0;
  -int                    ac_use_splash = 0;
   int                    ac_use_props = 0;
  -int                    ac_use_lview = 1;
  +int                    ac_use_lview = 0;
   
   HINSTANCE              ac_instance;
   static procrun_t       *ac_env = NULL;
  @@ -126,25 +125,12 @@
   static HICON           ac_try_stop;
   static UINT            ac_taskbar_created;
   HWND                   ac_main_hwnd;
  -static HWND            ac_list_hwnd;
  -static HWND            ac_splist_hwnd;
  +HWND                   ac_list_hwnd;
   static HWND            ac_console_hwnd = NULL;
   static char            *ac_stdout_lines[MAX_LISTCOUNT + 1];
   char                   *ac_cmdline;
   char                   *ac_cmdname;
   RECT                   ac_winpos = {-1, 0, 640, 480};
  -/* splash window handle */
  -static HWND            ac_splash_hwnd = NULL;
  -
  -int                    ac_lview_current = 0;
  -static struct {
  -    char *  label;
  -    DWORD   width;
  -} ac_columns[] = {
  -    {   "Status",   140     },
  -    {   "Class",    172     },
  -    {   "Message",  300     },
  -};
   
   
   INT_PTR ac_show_properties(HWND owner);
  @@ -177,88 +163,6 @@
       Shell_NotifyIcon(message, &nid);
   }
   
  -static char *ac_lv_stat = NULL;
  -static char ac_lv_clbuf[1024] = {0};
  -static char *ac_lv_class = NULL;
  -static char *ac_lv_clmsg = NULL;
  -static int  ac_lv_iicon = 0;
  -
  -#define STR_NOT_NULL(s) { if((s) == NULL) (s) = ""; }
  -
  -static void ac_parse_list_string(const char *str)
  -{
  -    int row = 0x7FFFFFFF;
  -    LV_ITEM lvi;
  -    int off = 0;
  -
  -    if (isdigit(*str)) {
  -        char *p;
  -                
  -        strncpy(ac_lv_clbuf, str, 1023);
  -        ac_lv_stat = p = &ac_lv_clbuf[0];
  -
  -        while (*p && !isspace(*p))
  -            ++p;
  -        ++p;
  -        while (*p && !isspace(*p))
  -            ++p;
  -        *(p++) = 0;
  -        while (*p && isspace(*p))
  -            ++p;
  -        ac_lv_class = p;
  -
  -        while (*p && !isspace(*p))
  -            ++p;
  -        *(p++) = 0;
  -        ac_lv_clmsg = p;
  -        
  -    }
  -    else {
  -        if (STRN_COMPARE(str, "INFO:")) {
  -            ac_lv_iicon = 0;
  -            off = STRN_SIZE("INFO:") + 1;
  -        }
  -        else if (STRN_COMPARE(str, "WARNING:")) {
  -            ac_lv_iicon = 1;
  -            off = STRN_SIZE("WARNING:") + 1;
  -        }
  -        else if (STRN_COMPARE(str, "ERROR:")) {
  -            ac_lv_iicon = 2;
  -            off = STRN_SIZE("ERROR:") + 1;
  -        }
  -        else if (STRN_COMPARE(str, "SEVERE:")) {
  -            ac_lv_iicon = 2;
  -            off = STRN_SIZE("SEVERE:") + 1;
  -        }
  -        ac_lv_clmsg = (char *)str + off;
  -
  -        /* skip leading spaces */
  -        while (*ac_lv_clmsg && isspace(*ac_lv_clmsg))
  -            ++ac_lv_clmsg;
  -    }
  -
  -    STR_NOT_NULL(ac_lv_class);
  -    STR_NOT_NULL(ac_lv_clmsg);
  -    STR_NOT_NULL(ac_lv_stat);
  -
  -    memset(&lvi, 0, sizeof(LV_ITEM));
  -    lvi.mask        = LVIF_IMAGE | LVIF_TEXT;
  -    lvi.iItem       = ac_lview_current;
  -    lvi.iImage      = ac_lv_iicon;
  -    lvi.pszText     = ac_lv_stat;
  -    lvi.cchTextMax  = strlen(ac_lv_stat) + 1;
  -    row = ListView_InsertItem(ac_list_hwnd, &lvi);
  -    if (row == -1)
  -        return;
  -    ListView_SetItemText(ac_list_hwnd, row, 1, ac_lv_class); 
  -    ListView_SetItemText(ac_list_hwnd, row, 2, ac_lv_clmsg);
  -    ListView_EnsureVisible(ac_list_hwnd,
  -                               ListView_GetItemCount(ac_list_hwnd) - 1,
  -                               FALSE); 
  -
  -    ac_lview_current++;
  -}
  -
   void ac_add_list_string(const char *str, int len)
   {
       static int nqueue = 0;
  @@ -268,19 +172,9 @@
   
       if (str) {
   
  -        /* set the status to 'green' when received Jk running 
  -         * and close the spash window if present
  -         */
  -        if (STRN_COMPARE(str, "INFO: Jk running")) {
  -            ac_show_try_icon(ac_main_hwnd, NIM_MODIFY, ac_cmdname, 0);
  -            /* kill the splash window if present */
  -            if (ac_splash_hwnd)
  -                EndDialog(ac_splash_hwnd, TRUE);
  -            ac_splash_hwnd = NULL;
  -        }
  -        else if (ac_splash_hwnd) {
  -            SendMessage(ac_splist_hwnd, LB_INSERTSTRING, 0, (LPARAM)str);
  -        }
  +#if defined(PRCRUN_EXTENDED)
  +        acx_process_splash(str);
  +#endif
           if (nqueue > MAX_LISTCOUNT - 1) {
               free(ac_stdout_lines[0]);
               /* TODO: improve performance */
  @@ -293,18 +187,23 @@
       }
       if (!ac_list_hwnd || !nqueue)
           return;
  -
  +#if defined(PROCRUN_EXTENDED)
       if (ac_use_lview) {
           for (i = 0; i < nqueue; i++) {
  -            ac_parse_list_string(ac_stdout_lines[i]);
  +            acx_parse_list_string(ac_stdout_lines[i]);
               if (litems++ > MAX_LIST_ITEMS)
                   ListView_DeleteItem(ac_list_hwnd, 0);
           }
       }
  -    else {
  -        for (i = 0; i < nqueue; i++)
  +    else 
  +#endif
  +    {
  +        for (i = 0; i < nqueue; i++) {
               ListBox_AddString(ac_list_hwnd, ac_stdout_lines[i]);
  +            if (litems++ > MAX_LIST_ITEMS)
  +                ListBox_DeleteString(ac_list_hwnd, 0);
           
  +        }
           if (olen < nlen) {
               olen = nlen;
               SendMessage(ac_list_hwnd, LB_SETHORIZONTALEXTENT,
  @@ -434,7 +333,7 @@
       return 0;
   }
   
  -static void ac_center_window(HWND hwnd)
  +void ac_center_window(HWND hwnd)
   {
      RECT    rc, rw;
      int     cw, ch;
  @@ -544,47 +443,14 @@
                           
              GetWindowRect(status_bar, &r);
              GetClientRect(hdlg, &m);
  +#if defined(PROCRUN_EXTENDED)
              if (!ac_use_lview)
                  MoveWindow(ac_list_hwnd, 0, 0, m.right - m.left, m.bottom - abs((r.top - r.bottom)), TRUE);
  -           else {
  -               LV_COLUMN lvc;
  -               int i;
  -               HIMAGELIST  imlist;
  -               HICON hicon; 
  -               imlist = ImageList_Create(16, 16, ILC_COLORDDB | ILC_MASK, 3, 0);
  -               hicon = LoadImage(ac_instance, MAKEINTRESOURCE(IDI_ICOI),
  -                                 IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
  -               ImageList_AddIcon(imlist, hicon);
  -               hicon = LoadImage(ac_instance, MAKEINTRESOURCE(IDI_ICOW),
  -                                 IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
  -               ImageList_AddIcon(imlist, hicon);
  -               hicon = LoadImage(ac_instance, MAKEINTRESOURCE(IDI_ICOS),
  -                                 IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
  -               ImageList_AddIcon(imlist, hicon);
  -
  -               ac_list_hwnd = CreateWindowEx(0L, WC_LISTVIEW, "", 
  -                                             WS_VISIBLE | WS_CHILD |
  -                                             LVS_REPORT | WS_EX_CLIENTEDGE,
  -                                             0, 0, m.right - m.left,
  -                                             m.bottom - abs((r.top - r.bottom)),
  -                                             hdlg, NULL, ac_instance, NULL);
  -               lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
  -               lvc.fmt  = LVCFMT_LEFT;
  -
  -               ListView_SetImageList(ac_list_hwnd,imlist, LVSIL_SMALL);
  -
  -               for (i = 0; i < sizeof(ac_columns) / sizeof(ac_columns[0]); ++i)  {
  -                    lvc.iSubItem    = i;
  -                    lvc.cx          = ac_columns[i].width;
  -                    lvc.pszText     = ac_columns[i].label;
  -                    ListView_InsertColumn(ac_list_hwnd, i, &lvc );
  -               }
  -#ifdef LVS_EX_FULLROWSELECT
  -               ListView_SetExtendedListViewStyleEx(ac_list_hwnd, 0,
  -                                                   LVS_EX_FULLROWSELECT |
  -                                                   LVS_EX_INFOTIP);
  +           else
  +               acx_create_view(hdlg, &m, &r);
  +#else
  +           MoveWindow(ac_list_hwnd, 0, 0, m.right - m.left, m.bottom - abs((r.top - r.bottom)), TRUE);
   #endif
  -           }
              ac_add_list_string(NULL, 0);
              break;
           case WM_SIZE:
  @@ -645,20 +511,6 @@
       return FALSE;
   }
   
  -LRESULT CALLBACK ac_splash_dlg_proc(HWND hdlg, UINT message, WPARAM wparam, LPARAM lparam)
  -{
  -
  -    switch (message) {
  -        case WM_INITDIALOG:
  -           ac_splash_hwnd = hdlg;
  -           ac_center_window(hdlg);
  -           ac_splist_hwnd = GetDlgItem(hdlg, IDL_INFO); 
  -           break;
  -    }
  -
  -    return FALSE;
  -}
  -
   int ac_browse_for_dialog(HWND hwnd, char *str, size_t len, int files)
   {
       int rv = 0;
  @@ -670,9 +522,9 @@
       memset(&bi, 0, sizeof(BROWSEINFO));
       SHGetSpecialFolderLocation(hwnd, CSIDL_DRIVES, &il);
       if (files)
  -        bi.lpszTitle  = "Tomcat Service Manager :\nSelect Folder!";
  +        bi.lpszTitle  = PROCRUN_GUI_DISPLAY " :\nSelect Folder!";
       else
  -        bi.lpszTitle  = "Tomcat Service Manager :\nSelect File!";
  +        bi.lpszTitle  = PROCRUN_GUI_DISPLAY " :\nSelect File!";
       bi.pszDisplayName = str;
       bi.hwndOwner =      hwnd;
       bi.ulFlags =        BIF_EDITBOX;
  @@ -1106,11 +958,10 @@
                * if something goes wrong.
                */
               SetTimer(hwnd, WM_TIMER_TIMEOUT, TIMEOUT_TIME, NULL);
  -            if (ac_use_splash) {
  -                DialogBox(ac_instance, MAKEINTRESOURCE(IDD_DLGSPLASH),
  -                          hwnd, (DLGPROC)ac_splash_dlg_proc);
  -            }
   
  +#if defined(PROCRUN_EXTENDED)
  +            acx_create_spash(hwnd);
  +#endif
               if (ac_use_show) {
                   DialogBox(ac_instance, MAKEINTRESOURCE(IDD_DLGCONSOLE),
                             hwnd, (DLGPROC)ac_console_dlg_proc);
  @@ -1121,8 +972,9 @@
                   case WM_TIMER_TIMEOUT:
                       if (ac_use_try)
                           ac_show_try_icon(hwnd, NIM_MODIFY, ac_cmdname, 0);
  -                    if (ac_use_splash && ac_splash_hwnd)
  -                        EndDialog(ac_splash_hwnd, TRUE);
  +#if defined(PROCRUN_EXTENDED)
  +                    acx_close_spash();
  +#endif
                   break;
               }
               break;
  @@ -1256,9 +1108,9 @@
           return 0;
       }
   
  -    /* TODO: make that customizable */
  -    if (ac_use_try)
  -        ac_use_splash = 1;
  +#if defined(PROCRUN_EXTENDED)
  +    acx_init_extended();
  +#endif
       ac_main_hwnd = ac_create_main_window(ac_instance, cname, 
                                            env->m->service.name);
   
  
  
  
  1.5       +1 -15     jakarta-commons/daemon/src/native/nt/procrun/procrun.c
  
  Index: procrun.c
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/daemon/src/native/nt/procrun/procrun.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- procrun.c	28 Sep 2003 15:52:35 -0000	1.4
  +++ procrun.c	29 Sep 2003 08:56:50 -0000	1.5
  @@ -112,20 +112,6 @@
   
   #ifdef PROCRUN_WINAPP
   
  -extern DWORD WINAPI gui_thread(LPVOID param);
  -
  -extern void ac_add_list_string(const char *str, int len);
  -extern int  ac_use_try;
  -extern int  ac_use_dlg;
  -extern int  ac_use_show;
  -extern int  ac_use_props;
  -extern int  ac_use_lview;
  -
  -extern RECT ac_winpos;
  -extern HINSTANCE ac_instance;
  -extern HWND ac_main_hwnd;
  -void ac_show_try_icon(HWND hwnd, DWORD message, const char *tip);
  -
   #endif
   
   #ifdef _DEBUG
  @@ -2922,7 +2908,7 @@
   
   #ifdef PROCRUN_WINAPP
       if (ac_main_hwnd)
  -        ac_show_try_icon(ac_main_hwnd, NIM_DELETE, NULL);
  +        ac_show_try_icon(ac_main_hwnd, NIM_DELETE, NULL, 0);
   #endif
       procrun_destroy_jvm(env->m, NULL);
       inject_exitprocess(&env->c->pinfo);
  
  
  
  1.4       +45 -8     jakarta-commons/daemon/src/native/nt/procrun/procrun.h
  
  Index: procrun.h
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/daemon/src/native/nt/procrun/procrun.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- procrun.h	28 Sep 2003 15:52:35 -0000	1.3
  +++ procrun.h	29 Sep 2003 08:56:50 -0000	1.4
  @@ -72,6 +72,10 @@
   extern "C" {
   #endif
   
  +#if defined(PROCRUN_EXTENDED)
  +#include "extend.h"
  +#endif
  +
   #define IDD_DLGCONSOLE        101
   #define IDS_CONWRAPTITLE      102
   #define IDS_CONWRAPCLASS      103
  @@ -94,17 +98,10 @@
   #define IDM_ABOUT             120
   #define IDI_ICOCONTRYSTOP     121
   
  -#define IDD_DLGSPLASH         122
  -#define IDB_BMPSPLASH         123
  -#define IDL_INFO              124
  -
  -#define IDM_OPTIONS           125
  +#define IDM_OPTIONS           122
   #define RC_DLG_SRVOPT         130
   #define RC_LBL_VER            131
   #define RC_LISTVIEW           132
  -#define IDI_ICOI              133
  -#define IDI_ICOS              134
  -#define IDI_ICOW              135
   
   #define RC_TAB_SRVOPT        1000
   #define RC_GRP_MSP           1001
  @@ -173,7 +170,15 @@
   #define PROC_ARG_EDIT_SERVICE       "//ES//"
   
   #define PROCRUN_VERSION_STR         "1.1"
  +
  +#ifndef PROCRUN_REGKEY_ROOT
   #define PROCRUN_REGKEY_ROOT         "SOFTWARE\\Apache Software Foundation\\Process Runner " PROCRUN_VERSION_STR
  +#endif
  +
  +#ifndef PROCRUN_GUI_DISPLAY
  +#define PROCRUN_GUI_DISPLAY         "Apache Process Runner"
  +#endif
  +
   #define PROCRUN_REGKEY_SERVICES     "System\\CurrentControlSet\\Services\\%s"
   #define PROCRUN_REGKEY_PARAMS       "System\\CurrentControlSet\\Services\\%s\\Parameters"
   #define PROCRUN_REGKEY_RSERVICES    PROCRUN_REGKEY_ROOT "\\%s"
  @@ -339,7 +344,39 @@
       pool_t *pool_create();
       int pool_destroy(pool_t *pool);
   
  +#if !defined(PROCRUN_CONSOLE)
  +
  +extern DWORD WINAPI gui_thread(LPVOID param);
  +
  +extern void ac_add_list_string(const char *str, int len);
  +extern int  ac_use_try;
  +extern int  ac_use_dlg;
  +extern int  ac_use_show;
  +extern int  ac_use_props;
  +extern int  ac_use_lview;
  +
  +extern  RECT        ac_winpos;
  +extern  HINSTANCE   ac_instance;
  +extern  HWND        ac_main_hwnd;
  +extern  HWND        ac_list_hwnd;
  +extern  char        *ac_cmdname;
  +
  +void    ac_show_try_icon(HWND hwnd, DWORD message, const char *tip, int stop);
  +void    ac_center_window(HWND hwnd);
  +
  +#if defined(PROCRUN_EXTENDED)
  +
  +void acx_process_splash(const char *str);
  +void acx_create_view(HWND hdlg, LPRECT pr, LPRECT pw);
  +void acx_parse_list_string(const char *str);
  +void acx_create_spash(HWND hwnd);
  +void acx_close_spash();
  +void acx_init_extended();
  +
  +
  +#endif
   
  +#endif
   
   #ifdef __cplusplus
   }
  
  
  
  1.3       +10 -24    jakarta-commons/daemon/src/native/nt/procrun/procrun.rc
  
  Index: procrun.rc
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/daemon/src/native/nt/procrun/procrun.rc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- procrun.rc	28 Sep 2003 06:51:36 -0000	1.2
  +++ procrun.rc	29 Sep 2003 08:56:50 -0000	1.3
  @@ -59,18 +59,16 @@
   #include "procrun.h"
   #include "windows.h"
   
  -IDI_ICOCONWRAP         ICON                    "tomcatp.ico"
  -IDI_ICOCONTRY          ICON                    "tomcatr.ico"
  -IDI_ICOCONTRYSTOP      ICON                    "tomcats.ico"
  -IDR_RTFLIC             RTF                     "License.rtf"
  +#if !defined(PROCRUN_EXTENDED)
  +IDI_ICOCONWRAP         ICON                    "proctry.ico"
  +IDI_ICOCONTRY          ICON                    "proctry.ico"
  +IDI_ICOCONTRYSTOP      ICON                    "proctry.ico"
  +#endif
   
  -IDI_ICOI               ICON                    "icoi.ico"
  -IDI_ICOS               ICON                    "icos.ico"
  -IDI_ICOW               ICON                    "icow.ico"
  +IDR_RTFLIC             RTF                     "License.rtf"
   
   #ifdef _MSC_VER
   IDB_BMPJAKARTA         BITMAP   DISCARDABLE    "jakarta-banner.bmp"
  -IDB_BMPSPLASH          BITMAP   DISCARDABLE    "splash.bmp"
   IDR_CMENU MENUEX DISCARDABLE 
   BEGIN
       POPUP "&Process",65535,MFT_STRING,MFS_ENABLED
  @@ -142,18 +140,6 @@
   END
   #endif
   
  -IDD_DLGSPLASH DIALOGEX 0, 0, 322, 151
  -STYLE DS_SYSMODAL | DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | 
  -    WS_BORDER
  -EXSTYLE WS_EX_TOPMOST
  -FONT 8, "Microsoft Sans Serif", 400, 0, 0x0
  -BEGIN
  -    LISTBOX         IDL_INFO,7,126,217,9, LBS_NOINTEGRALHEIGHT | 
  -                    LBS_NOSEL | NOT WS_BORDER | NOT LBS_USETABSTOPS
  -    CONTROL         IDB_BMPSPLASH,IDC_STATIC,"Static",SS_BITMAP |
  -                    SS_CENTERIMAGE,0,0,322,151
  -END
  -
   RC_DLG_SRVOPT DIALOGEX 0, 0, 337, 186
   STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_BORDER
   FONT 8, "MS Shell Dlg", 400, 0, 0x1
  @@ -235,12 +221,12 @@
       BEGIN
         VALUE "Comments", "All rights reserved.  The license is available at <http://www.apache.org/LICENSE.txt>.  The Apache HTTP Server project pages are at <http://httpd.apache.org/>.\0"
         VALUE "CompanyName", "Apache Software Foundation\0"
  -      VALUE "FileDescription", "Tomcat Service Manager\0"
  +      VALUE "FileDescription", "Apache Process Runner\0"
         VALUE "FileVersion", PROC_VERSION
  -      VALUE "InternalName", "tomcatw.exe\0"
  +      VALUE "InternalName", "procrunw.exe\0"
         VALUE "LegalCopyright", "Copyright � 2000-2003 The Apache Software Foundation.\0"
  -      VALUE "OriginalFilename", "tomcatw.exe\0"
  -      VALUE "ProductName", "Tomcat Service Manager\0"
  +      VALUE "OriginalFilename", "procrunw.exe\0"
  +      VALUE "ProductName", "Apache Process Runner\0"
         VALUE "ProductVersion", PROC_VERSION
       END
     END
  
  
  
  1.1                  jakarta-commons/daemon/src/native/nt/procrun/extend.h
  
  Index: extend.h
  ===================================================================
  /*
   * procrun GUI extension includes.
   */