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 splash.bmp procgui.c procrun.h procrun.rc
Date Fri, 25 Apr 2003 16:38:31 GMT
mturk       2003/04/25 09:38:30

  Modified:    daemon/src/native/nt/procrun procgui.c procrun.h procrun.rc
  Added:       daemon/src/native/nt/procrun splash.bmp
  Log:
  Added splash dialog.
  It's very fancy ;).
  
  Revision  Changes    Path
  1.7       +57 -3     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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- procgui.c	25 Apr 2003 14:55:35 -0000	1.6
  +++ procgui.c	25 Apr 2003 16:38:30 -0000	1.7
  @@ -93,12 +93,14 @@
   #include "procrun.h"
   
   #define WM_TRAYMESSAGE         (WM_APP+1)
  +#define WM_TIMER_TIMEOUT       10
   #define MAX_LOADSTRING         200
   #define MAX_LISTCOUNT          8192
   #define CONWRAP_SUCCESS        0
   #define CONWRAP_ENOARGS        1
   #define CONWRAP_EARG           2
   #define CONWRAP_EFATAL         3
  +#define TIMEOUT_TIME           20000    /* startup timeout (ms) */
   
   extern int g_proc_mode;
   /* The main envronment for services */
  @@ -107,6 +109,7 @@
   int                    ac_use_try = 0;
   int                    ac_use_dlg = 0;
   int                    ac_use_show = 0;
  +int                    ac_use_splash = 0;
   HINSTANCE              ac_instance;
   static procrun_t       *ac_env = NULL;
   static HICON           ac_main_icon;
  @@ -115,11 +118,15 @@
   static UINT            ac_taskbar_created;
   HWND                   ac_main_hwnd;
   static HWND            ac_list_hwnd;
  +static HWND            ac_splist_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;
  +
   
   void ac_show_try_icon(HWND hwnd, DWORD message, const char *tip, int stop)
   {
  @@ -156,9 +163,19 @@
   
       if (str) {
   
  -        /* set the status to 'green' when received Jk running */
  -        if (strncmp(str, "INFO: Jk running", 16))
  +        /* set the status to 'green' when received Jk running 
  +         * and close the spash window if present
  +         */
  +        if (!strncmp(str, "INFO: Jk running", 16)) {
               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 (nqueue > MAX_LISTCOUNT - 1) {
               free(ac_stdout_lines[0]);
               /* TODO: improve performance */
  @@ -436,6 +453,21 @@
       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;
  +        default:
  +            return FALSE;
  +    }
  +
  +    return FALSE;
  +}
   
   LRESULT CALLBACK ac_main_wnd_proc(HWND hwnd, UINT message,
                             WPARAM wparam, LPARAM lparam)
  @@ -447,12 +479,32 @@
       }
       switch (message) {
           case WM_CREATE:
  +            ac_main_hwnd = hwnd;
               ac_show_try_icon(hwnd, NIM_ADD, ac_cmdname, 1);
  +            /* add the 20 s timer for startup to avoid zombie spash 
  +             * 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 (ac_use_show) {
                   DialogBox(ac_instance, MAKEINTRESOURCE(IDD_DLGCONSOLE),
                             hwnd, (DLGPROC)ac_console_dlg_proc);
               }
               break;
  +        case WM_TIMER:
  +            switch (wparam) {
  +                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);
  +                break;
  +            }
  +            break;
           case WM_DESTROY:
           case WM_QUIT:
               ac_show_try_icon(hwnd, NIM_DELETE, NULL, 0);
  @@ -549,7 +601,9 @@
           ac_cmdname = env->m->service.display;
       else
           ac_cmdname = env->m->service.name;
  -    
  +    /* TODO: make that customizable */
  +    if (ac_use_try)
  +        ac_use_splash = 1;
       ac_main_hwnd = ac_create_main_window(ac_instance, cname, 
                                            env->m->service.name);
   
  
  
  
  1.12      +5 -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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- procrun.h	25 Apr 2003 14:55:35 -0000	1.11
  +++ procrun.h	25 Apr 2003 16:38:30 -0000	1.12
  @@ -97,6 +97,11 @@
   #define IDC_RICHEDIT21        119
   #define IDM_ABOUT             120
   #define IDI_ICOCONTRYSTOP     121
  +
  +#define IDD_DLGSPLASH         122
  +#define IDB_BMPSPLASH         123
  +#define IDL_INFO              124
  +
   #define IDC_STATIC             -1
   
   #define PROC_ENV_COUNT  32
  
  
  
  1.6       +13 -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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- procrun.rc	25 Apr 2003 14:55:35 -0000	1.5
  +++ procrun.rc	25 Apr 2003 16:38:30 -0000	1.6
  @@ -7,6 +7,7 @@
   IDR_RTFLIC             RTF                     "License.rtf"
   
   IDB_BMPJAKARTA         BITMAP   DISCARDABLE    "jakarta-banner.bmp"
  +IDB_BMPSPLASH          BITMAP   DISCARDABLE    "splash.bmp"
   
   #ifdef _MSC_VER
   IDR_CMENU MENUEX DISCARDABLE 
  @@ -77,6 +78,18 @@
                       ES_READONLY | WS_BORDER | WS_VSCROLL,0,0,335,145
   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
  +    CONTROL         IDB_BMPSPLASH,IDC_STATIC,"Static",SS_BITMAP |
  +                    SS_CENTERIMAGE,0,0,322,151
  +END
   
   1 VERSIONINFO
    FILEVERSION 2,1,0,0
  
  
  
  1.1                  jakarta-commons-sandbox/daemon/src/native/nt/procrun/splash.bmp
  
  	<<Binary file>>
  
  

---------------------------------------------------------------------
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