<rdar://problem/7276482> Bonjour Printer Wizard should give user more feedback when...
authorsherscher@apple.com <sherscher@apple.com@214c2c4a-bf3b-4dcf-9390-e4dd3010487d>
Thu, 8 Oct 2009 18:08:40 +0000 (18:08 +0000)
committersherscher@apple.com <sherscher@apple.com@214c2c4a-bf3b-4dcf-9390-e4dd3010487d>
Thu, 8 Oct 2009 18:08:40 +0000 (18:08 +0000)
git-svn-id: http://svn.macosforge.org/repository/mDNSResponder/trunk@6732 214c2c4a-bf3b-4dcf-9390-e4dd3010487d

Clients/PrinterSetupWizard/FourthPage.cpp
Clients/PrinterSetupWizard/FourthPage.h
Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.rc
Clients/PrinterSetupWizard/PrinterSetupWizardSheet.cpp
Clients/PrinterSetupWizard/resource_exe.h
Clients/PrinterSetupWizard/resource_loc_res.h
Clients/PrinterSetupWizard/resource_res.h

index b2f8fca..3817246 100644 (file)
 #include "PrinterSetupWizardSheet.h"
 #include "FourthPage.h"
 
+#if !defined( PBS_MARQUEE )
+#      define PBS_MARQUEE  0x08
+#endif
+
+#if !defined( PBM_SETMARQUEE )
+#      define PBM_SETMARQUEE WM_USER + 10
+#endif
+
+
 
 // CFourthPage dialog
 
@@ -65,7 +74,23 @@ END_MESSAGE_MAP()
 OSStatus 
 CFourthPage::OnInitPage()
 {
-       return kNoErr;
+       CWnd * window; 
+       OSStatus err = kNoErr;
+
+       window = GetDlgItem( IDC_INSTALLING );
+       require_action( window, exit, err = kUnknownErr );
+       window->ShowWindow( SW_HIDE );
+
+       window = GetDlgItem( IDC_PROGRESS );
+       require_action( window, exit, err = kUnknownErr );
+       SetWindowLong( *window, GWL_STYLE, GetWindowLong( *window, GWL_STYLE ) | PBS_MARQUEE );
+       SetWindowLongPtr( *window, GWL_STYLE, GetWindowLongPtr( *window, GWL_STYLE ) | PBS_MARQUEE );
+       window->SendMessage( ( UINT ) PBM_SETMARQUEE, ( WPARAM ) FALSE,( LPARAM ) 35 );
+       window->ShowWindow( SW_HIDE );
+
+exit:
+
+       return err;
 }
 
 
@@ -135,3 +160,53 @@ exit:
 
        return CPropertyPage::OnKillActive();
 }
+
+
+BOOL
+CFourthPage::StartActivityIndicator()
+{
+       CWnd * window; 
+       BOOL ok = TRUE;
+
+       window = GetDlgItem( IDC_COMPLETE1 );
+       require_action( window, exit, ok = FALSE );
+       window->ShowWindow( SW_HIDE );
+
+       window = GetDlgItem( IDC_COMPLETE2 );
+       require_action( window, exit, ok = FALSE );
+       window->ShowWindow( SW_HIDE );
+
+       window = GetDlgItem( IDC_INSTALLING );
+       require_action( window, exit, ok = FALSE );
+       window->ShowWindow( SW_SHOW );
+
+       window = GetDlgItem( IDC_PROGRESS );
+       require_action( window, exit, ok = FALSE );
+       window->SendMessage( ( UINT ) PBM_SETMARQUEE, ( WPARAM ) TRUE,( LPARAM ) 50 );
+       window->ShowWindow( SW_SHOW );
+
+exit:
+
+       return ok;
+}
+
+
+BOOL
+CFourthPage::StopActivityIndicator()
+{
+       CWnd * window; 
+       BOOL ok = TRUE;
+
+       window = GetDlgItem( IDC_INSTALLING );
+       require_action( window, exit, ok = FALSE );
+       window->ShowWindow( SW_HIDE );
+
+       window = GetDlgItem( IDC_PROGRESS );
+       require_action( window, exit, ok = FALSE );
+       window->SendMessage( ( UINT ) PBM_SETMARQUEE, ( WPARAM ) FALSE,( LPARAM ) 35 );
+       window->ShowWindow( SW_HIDE );
+
+exit:
+
+       return ok;
+}
index d96e392..9150df2 100644 (file)
@@ -35,6 +35,9 @@ public:
        virtual BOOL OnSetActive();
        virtual BOOL OnKillActive();
 
+       BOOL StartActivityIndicator();
+       BOOL StopActivityIndicator();
+
 protected:
        virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
 
index a07023e..198890f 100755 (executable)
@@ -171,8 +171,10 @@ BEGIN
     LTEXT           "",IDC_PRINTER_MODEL,172,104,113,8\r
     LTEXT           "",IDC_PRINTER_PROTOCOL,172,117,113,8\r
     LTEXT           "",IDC_PRINTER_DEFAULT,172,130,113,8\r
-    LTEXT           "To complete the installation, click Finish.",IDC_STATIC,116,180,171,8\r
-    LTEXT           "To change these settings, click Back.",IDC_STATIC,116,190,171,8\r
+    LTEXT           "To complete the installation, click Finish.",IDC_COMPLETE1,116,180,171,8\r
+    LTEXT           "To change these settings, click Back.",IDC_COMPLETE2,116,190,171,8\r
+       LTEXT                   "Please wait a few moments while the Bonjour Printer Wizard installs the printer.",IDC_INSTALLING,116,170,171,31\r
+       CONTROL                 "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,116,190,165,8\r
 END\r
 \r
 IDD_DIALOG1 DIALOGEX 0, 0, 265, 130\r
index 989bc51..07e9ca0 100644 (file)
@@ -826,20 +826,34 @@ CPrinterSetupWizardSheet::OnContextMenu(CWnd * pWnd, CPoint pos)
 void
 CPrinterSetupWizardSheet::OnOK()
 {
+       CWnd * window;
+       OSStatus err;
+
        check ( m_selectedPrinter != NULL );
 
        SetWizardButtons( PSWIZB_DISABLEDFINISH );
 
-       ShowWindow( SW_HIDE );
+       window = GetDlgItem( IDCANCEL );
+       if ( window )
+       {
+               window->EnableWindow( FALSE );
+       }
+
+       m_pgFourth.StartActivityIndicator();
        
-       if ( InstallPrinter( m_selectedPrinter ) != kNoErr )
+       err = InstallPrinter( m_selectedPrinter );
+
+       m_pgFourth.StopActivityIndicator();
+
+       if ( err != kNoErr )
        {
                CString caption;
                CString message;
 
                caption.LoadString(IDS_INSTALL_ERROR_CAPTION);
+               caption.AppendFormat( TEXT( " (%d)" ), err );
                message.LoadString(IDS_INSTALL_ERROR_MESSAGE);
-
                MessageBox(message, caption, MB_OK|MB_ICONEXCLAMATION);
        }
 
index bb2faaf..ac510b3 100755 (executable)
 #define IDC_DESCRIPTION_FIELD           1030\r
 #define IDC_LOCATION_FIELD              1032\r
 #define IDC_DESCRIPTION_LABEL           1033\r
+#define IDC_COMPLETE1                                  1034\r
+#define IDC_COMPLETE2                                  1035\r
+#define IDC_INSTALLING                                 1036\r
+#define IDC_PROGRESS                                   1037\r
 \r
 // Next default values for new objects\r
-// \r
+//\r
 #ifdef APSTUDIO_INVOKED\r
 #ifndef APSTUDIO_READONLY_SYMBOLS\r
 #define _APS_NEXT_RESOURCE_VALUE        142\r
index 3aac90d..c6a2c81 100755 (executable)
 #define IDC_DESCRIPTION_FIELD           1030\r
 #define IDC_LOCATION_FIELD              1032\r
 #define IDC_DESCRIPTION_LABEL           1033\r
+#define IDC_COMPLETE1                                  1034\r
+#define IDC_COMPLETE2                                  1035\r
+#define IDC_INSTALLING                                 1036\r
+#define IDC_PROGRESS                                   1037\r
 \r
 // Next default values for new objects\r
 // \r
index bb2faaf..1845b12 100755 (executable)
 #define IDC_DESCRIPTION_FIELD           1030\r
 #define IDC_LOCATION_FIELD              1032\r
 #define IDC_DESCRIPTION_LABEL           1033\r
+#define IDC_COMPLETE1                                  1034\r
+#define IDC_COMPLETE2                                  1035\r
+#define IDC_INSTALLING                                 1036\r
+#define IDC_PROGRESS                                   1037\r
 \r
 // Next default values for new objects\r
 // \r