/* * Copyright 2004 Perforce Software. All rights reserved. * * Developed by Data Shades Ltd. */ #include "ResultsDialog.h" #include "debug.h" ResultsDialog::ResultsDialog( PluginOperations *ops, TCHAR *op, PerforceResults *results, const StrPtr *currDir ) : Dialog( ops, IDD_RESULTS_DIALOG, DialogWndProc ) { this->op = op; this->results = results; this->currDir = currDir; } void ResultsDialog::ParseInfo( PerforceResults &results, UniStrBuf *msg ) { StrPtr *value; UniStrDict *dict; // New style info output if ( results.Count() == 1 ) { dict = (UniStrDict *)results.Get( 0 ); value = dict->GetVar( "userName" ); if ( value ) { AppendLine( msg, _T("User name: "), value ); } value = dict->GetVar( "clientName" ); if ( value ) { AppendLine( msg, _T("Client name: "), value ); } value = dict->GetVar( "clientHost" ); if ( value ) { AppendLine( msg, _T("Client host: "), value ); } value = dict->GetVar( "clientRoot" ); if ( value ) { AppendLine( msg, _T("Client root: "), value ); } AppendLine( msg, _T("Current directory: "), (StrPtr *)GetCwd() ); value = dict->GetVar( "clientAddress" ); if ( value ) { AppendLine( msg, _T("Client address: "), value ); } value = dict->GetVar( "unicode" ); if ( value ) { AppendLine( msg, _T("Unicode: "), value ); } value = dict->GetVar( "serverAddress" ); if ( value ) { AppendLine( msg, _T("Server address: "), value ); } value = dict->GetVar( "serverRoot" ); if ( value ) { AppendLine( msg, _T("Server root: "), value ); } value = dict->GetVar( "serverDate" ); if ( value ) { AppendLine( msg, _T("Server date: "), value ); } value = dict->GetVar( "serverVersion" ); if ( value ) { AppendLine( msg, _T("Server version: "), value ); } value = dict->GetVar( "serverLicense" ); if ( value ) { AppendLine( msg, _T("Server license: "), value ); } } // Old style info output else { for ( int i=0; i<results.Count(); i++ ) { dict = (UniStrDict *)results.Get( i ); value = dict->GetVar( "msg" ); if ( value ) { AppendLine( msg, _T(""), value ); } } } } void ResultsDialog::AppendLine( UniStrBuf *buff, TCHAR *var, StrPtr *value ) { buff->Append( var ); buff->Append( value ); buff->Append( _T("\r\n") ); } BOOL CALLBACK ResultsDialog::DialogWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { HWND results = GetDlgItem( hWnd, IDC_RESULTS_EDIT ); HWND okButton = GetDlgItem( hWnd, IDOK ); switch(uMsg) { case WM_INITDIALOG: { ResultsDialog *dialog = ( ResultsDialog * )lParam; SaveDialogObject( hWnd, dialog ); TCHAR *op = dialog->Operator(); if ( _tcscmp( op, _T("submit") ) == 0 ) { SetWindowText( hWnd, _T("P4GT - Confirmation of Check In") ); } else if ( _tcscmp( op, _T("last") ) == 0 ) { SetWindowText( hWnd, _T("P4GT - Result of Last Perforce Command") ); } else if ( _tcscmp( op, _T("info") ) == 0 ) { SetWindowText( hWnd, _T("P4GT - Perforce Connection Information") ); } if ( _tcscmp( op, _T("info") ) == 0 ) { if ( dialog->Results()->Count() > 0 ) { UniStrBuf msg; dialog->ParseInfo( *dialog->Results(), &msg ); SetWindowText( results, (TCHAR *)msg.Text() ); } } else { SetWindowText( results, dialog->Results()->GetText() ); } SetFocus( okButton ); Centre( hWnd ); SaveInitialSizes( hWnd ); SetResizeFlags( results, RESIZE_WIDTH | RESIZE_HEIGHT ); SetResizeFlags( okButton, RESIZE_TOP | RESIZE_LEFT_HALF ); return true; break; } case WM_GETMINMAXINFO: SetMinimumSize( hWnd, (LPMINMAXINFO) lParam ); return true; break; case WM_SIZE: Resize( hWnd, lParam ); return true; break; case WM_PAINT: { ResultsDialog *dialog = ( ResultsDialog * )DialogObject( hWnd ); dialog->PaintSizeGrip( hWnd ); break; } case WM_NCHITTEST: { return HitTestSizeGrip( hWnd, lParam ); } case WM_CTLCOLORSTATIC: // Make the background of edit boxes white instead of the read-only grey. if ( ( HWND )lParam == results ) { return ( BOOL )GetStockObject( WHITE_BRUSH ); } break; case WM_COMMAND: switch ( LOWORD( wParam ) ) { case IDOK: FinishDialog( hWnd, TRUE ); return true; case IDCANCEL: FinishDialog( hWnd, FALSE ); return true; } } return false; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 11893 | Robert Cowham |
Populate -o //guest/robert_cowham/perforce/P4OFC/main/... //guest/robert_cowham/perforce/P4OFC/icm/.... |
||
//guest/robert_cowham/perforce/P4OFC/main/libp4gt/ResultsDialog.cpp | |||||
#1 | 10843 | Robert Cowham |
Initial version of P4OFC source code. See README.txt (and LICENSE.txt and doc\P4OFC-Design.docx) |