mturk       2003/02/21 04:14:22

  Modified:    daemon/src/native/nt/procrun procgui.c procrun.h procrun.rc
  Log:
  Enable the GUI part to restore the window position.
  
  Revision  Changes    Path
  1.3       +42 -20    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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- procgui.c 17 Feb 2003 18:20:07 -0000      1.2
  +++ procgui.c 21 Feb 2003 12:14:21 -0000      1.3
  @@ -110,12 +110,14 @@
   HINSTANCE              ac_instance;
   
   static HICON           ac_main_icon;
  +static HICON           ac_try_icon;
   static UINT            ac_taskbar_created;
   static HWND            ac_main_hwnd;
   static HWND            ac_list_hwnd;
  +static HWND            ac_console_hwnd = NULL;
   static char            *ac_stdout_lines[MAX_LISTCOUNT + 1];
   char                   *ac_cmdline;
  -
  +RECT                   ac_winpos = {0, 0, 640, 480};
   
   void ac_add_list_string(const char *str, int len)
   {
  @@ -166,7 +168,7 @@
       nid.uCallbackMessage = WM_TRAYMESSAGE;
       
       if (message != NIM_DELETE)
  -        nid.hIcon = ac_main_icon;
  +        nid.hIcon = ac_try_icon;
       else
           nid.hIcon = NULL;
       if (tip)
  @@ -261,10 +263,18 @@
   
       switch (message) {
           case WM_INITDIALOG:
  +           ac_console_hwnd = hdlg;
              ac_list_hwnd = GetDlgItem(hdlg, IDL_STDOUT); 
              status_bar = CreateStatusWindow(0x0800 /* SBT_TOOLTIPS */
                                             | WS_CHILD | WS_VISIBLE,
                                               ac_cmdline, hdlg, IDC_STATBAR);
  +           if (!ac_use_try) { 
  +               LONG w = GetWindowLong(hdlg, GWL_STYLE);
  +               w &= ~WS_MINIMIZEBOX;
  +               SetWindowLong(hdlg, GWL_STYLE, w);
  +           }
  +           SetWindowPos(hdlg, HWND_TOP, ac_winpos.left, ac_winpos.top,
  +                        ac_winpos.right, ac_winpos.bottom, 0);
              GetWindowRect(status_bar, &r);
              GetClientRect(hdlg, &m);
              MoveWindow(ac_list_hwnd, 0, 0, m.right - m.left, m.bottom - abs((r.top - 
r.bottom)), TRUE);
  @@ -273,7 +283,12 @@
           case WM_SIZE:
               switch (LOWORD(wparam)) { 
                   case SIZE_MINIMIZED:
  -                    EndDialog(hdlg, TRUE); 
  +                    GetWindowRect(hdlg, &ac_winpos);
  +                    if (!ac_use_try) {
  +                        ShowWindow(hdlg, SW_RESTORE);
  +                        return FALSE;
  +                    }
  +                    ShowWindow(hdlg, SW_HIDE);
                       return TRUE; 
                   break;
                   default:
  @@ -286,14 +301,17 @@
               }
           break;
           case WM_QUIT:
  -        case WM_CLOSE: 
  -            OutputDebugString("dlg WM_QUIT");
  +        case WM_CLOSE:
  +            GetWindowRect(hdlg, &ac_winpos);
               if (!ac_use_try) {
  +                EndDialog(hdlg, TRUE);
  +                ac_list_hwnd = NULL;
  +                ac_console_hwnd = NULL;
                   SetEvent(g_env->m->events[0]);
  +                PostQuitMessage(CONWRAP_SUCCESS);
               }
  -            EndDialog(hdlg, TRUE);
  -            ac_list_hwnd = NULL;
  -            PostQuitMessage(CONWRAP_SUCCESS);
  +            else
  +                ShowWindow(ac_console_hwnd, SW_HIDE);
               return TRUE;
           default:
               return FALSE;
  @@ -314,16 +332,15 @@
       switch (message) {
           case WM_CREATE:
               ac_show_try_icon(hwnd, NIM_ADD, g_env->m->service.description);
  -            if (ac_use_show)
  +            if (ac_use_show) {
                   DialogBox(ac_instance, MAKEINTRESOURCE(IDD_DLGCONSOLE),
  -                       hwnd, (DLGPROC)ac_console_dlg_proc);
  -
  +                          hwnd, (DLGPROC)ac_console_dlg_proc);
  +            }
               break;
           case WM_DESTROY:
           case WM_QUIT:
               ac_show_try_icon(hwnd, NIM_DELETE, NULL);
               SetEvent(g_env->m->events[0]);
  -            OutputDebugString("main WM_QUIT");
               break;
           case WM_TRAYMESSAGE:
               switch(lparam) {
  @@ -343,9 +360,13 @@
                      return TRUE;
                      break;
                  case IDM_CONSOLE:
  -                   DialogBox(ac_instance, MAKEINTRESOURCE(IDD_DLGCONSOLE),
  -                       hwnd, (DLGPROC)ac_console_dlg_proc);
  -                   
  +                   if (ac_console_hwnd) {
  +                        ShowWindow(ac_console_hwnd, SW_SHOW);
  +                        ShowWindow(ac_console_hwnd, SW_RESTORE);
  +                   }
  +                   else
  +                       DialogBox(ac_instance, MAKEINTRESOURCE(IDD_DLGCONSOLE),
  +                                 hwnd, (DLGPROC)ac_console_dlg_proc);               
    
                      break;
               }
           default:
  @@ -376,11 +397,12 @@
       wcex.lpszClassName  = wclass;
       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);
       if (RegisterClassEx(&wcex))
           hwnd = CreateWindow(wclass, title,
  -                             0, 0, 0, 0, 0,
  -                             NULL, NULL, instance, NULL);
  +                            0, 0, 0, 0, 0,
  +                            NULL, NULL, instance, NULL);
   
       return hwnd;
   
  @@ -393,7 +415,7 @@
       procrun_t *env = (procrun_t *)param;
       char cname[MAX_LOADSTRING];
   
  -    if (!param)
  +    if (!param || !env->m->service.name)
           return -1;
       strcpy(cname, env->m->service.name);
       strcat(cname, "_CLASS");
  @@ -401,7 +423,7 @@
           ac_cmdline = env->m->service.description;
       else
           ac_cmdline = env->m->service.name;
  -
  +    
       ac_main_hwnd = ac_create_main_window(ac_instance, cname, 
                                            env->m->service.name);
   
  
  
  
  1.8       +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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- procrun.h 17 Feb 2003 18:19:07 -0000      1.7
  +++ procrun.h 21 Feb 2003 12:14:21 -0000      1.8
  @@ -89,6 +89,7 @@
   #define IDR_CMENU             111
   #define IDM_FILE_EXIT         112
   #define IDM_FILE_EDIT         113
  +#define IDI_ICOCONTRY         114
   
   #define IDC_STATIC             -1
   
  @@ -136,6 +137,10 @@
   #define PROCRUN_PARAMS_ACCOUNT      "User"
   #define PROCRUN_PARAMS_PASSWORD     "Password"
   #define PROCRUN_PARAMS_INSTALL      "Install"
  +/* Console Window position and color */
  +#define PROCRUN_PARAMS_WINPOS       "WindowPosition"
  +#define PROCRUN_PARAMS_WINCLR       "WindowColor"
  +#define PROCRUN_PARAMS_WINBACK      "WindowBackground"
   
   
   #define PROCRUN_DEFAULT_CLASS       "Main"
  
  
  
  1.3       +2 -1      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- procrun.rc        13 Feb 2003 17:48:35 -0000      1.2
  +++ procrun.rc        21 Feb 2003 12:14:21 -0000      1.3
  @@ -1,7 +1,8 @@
   #include "procrun.h"
   #include "windows.h"
   
  -IDI_ICOCONWRAP         ICON                    "proctry.ico"
  +IDI_ICOCONWRAP         ICON                    "tomcatp.ico"
  +IDI_ICOCONTRY          ICON                    "tomcatr.ico"
   
   IDR_CMENU MENU DISCARDABLE 
   BEGIN
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to