Beispiel #1
0
LOCAL LPTSTR SkipParm( LPTSTR pszCommand, int nParam )
/***********************************************************************/
{
    pszCommand = SkipSpaces( pszCommand );
	WORD wChar;
                                     
    // skip over current parameter
    while( --nParam >= 0 )
	{
		if( IsDBCSLeadByte(( BYTE )*pszCommand ))
            wChar = *(( LPWORD )pszCommand );
        else
            wChar = *pszCommand;

	    if( wChar == STRING_DELIM )
		    pszCommand = lStrChr( pszCommand+sizeof( TCHAR ), STRING_DELIM );
	    else
		    pszCommand = lStrChr( pszCommand, _T(' ') );
													  
	    if( !pszCommand )
		    return( NULL );

        pszCommand = MyCharNext( pszCommand );
	    pszCommand = SkipSpaces( pszCommand );
	}
    return( pszCommand );
}
Beispiel #2
0
LOCAL void display_cast( HWND hWnd, LPTSTR lpString, BOOL bScroll )
// Display a scrolling list of the Cast, beginning with a new player each time.
/************************************************************************/
{ 
	TEXTMETRIC   	SysCharSize;
	HDC          	hDC;
	RECT         	Area;
	LPTSTR       	lpNext, lpCastName;
	HRGN         	hUpdate;
	int          	SaveLevel, WndHeight, CastHeight, OldBkMode;
	DWORD        	OldTextColor;
	HBRUSH       	hBrush;
	HGDIOBJ      	hFont, hOldFont;
	RECT         	Update, rDummy;
	WORD         	wChar;
	BOOL	   	 	fDBCS, fCenter;
	static short 	CastOfs = -1;

	#define SCROLLCOUNT 1

	if ( !hWnd )
		return;

	if ( !(hDC = GetDC( hWnd )) )
		return;

	GetTextMetrics( hDC, &SysCharSize );

	OldBkMode = SetBkMode( hDC,TRANSPARENT );
	OldTextColor = SetTextColor( hDC, GetSysColor( COLOR_WINDOWTEXT ) );
	hBrush = CreateSolidBrush( GetSysColor( COLOR_BTNFACE ) );

	if ( !(hFont = (HFONT)SendMessage( hWnd, WM_GETFONT, 0, 0L )) )
		hFont = GetStockObject( GetSystemMetrics( SM_DBCSENABLED ) ? SYSTEM_FONT:ANSI_VAR_FONT );
	hOldFont = SelectObject(hDC, hFont);

	GetClientRect( hWnd, &Area );

	CastHeight = 0;
	lpNext = lpString;
	while ( lpNext )
	{
		CastHeight += SysCharSize.tmHeight;
		lpNext = lStrChr( MyCharNextN( lpNext, 1 ), _T('\n') );
	}

	if (bScroll)
	{
		Area.top += SCROLLCOUNT; 
		ScrollDC( hDC, 0, -SCROLLCOUNT, &Area, NULL, NULL, &Update );
		Area.top -= SCROLLCOUNT; 
		SaveLevel = SaveDC( hDC );
	}
	else	
	{
		Update = Area;
	}

	hUpdate = CreateRectRgn(Update.left,Update.top,Update.right,Update.bottom);
	SelectClipRgn( hDC, hUpdate );

	WndHeight = (1 + Area.bottom / SysCharSize.tmHeight) * SysCharSize.tmHeight;
	if ((WndHeight - (CastOfs -= SCROLLCOUNT)) >= CastHeight)
		CastOfs = WndHeight;
	Area.top = CastOfs;

	lpNext = lpString;
	while ( lpNext )
	{
		Area.bottom = Area.top + SysCharSize.tmHeight;

		lpCastName = lpNext;
		if( lpNext = lStrChr( lpNext, _T('\n') ))
		{
			if( IsDBCSLeadByte(( BYTE )*lpNext ))
			{
				fDBCS = TRUE;
				wChar =  *(( LPWORD )lpNext );
			}
			else
			{
				fDBCS = FALSE;
				wChar = *lpNext;
			}
			*lpNext = _T('\0');
		}

		if( IntersectRect( &rDummy, &Area, &Update ))
		{
			FillRect( hDC, &Area, hBrush );

			if( IsDBCSLeadByte(( BYTE )*lpCastName ))
				fCenter = ( *(( LPWORD )lpCastName ) == _T(' ')	);		
			else
				fCenter = ( *lpCastName == _T(' ') );		

			DrawText( hDC, lpCastName, -1, &Area, 
				( fCenter ? DT_CENTER : 0 ) | DT_NOPREFIX | DT_SINGLELINE );
		}

		if( lpNext )
		{
			if( fDBCS )
				*(( LPWORD )lpNext ) = wChar;
			else
				*lpNext = LOBYTE( wChar );

			lpNext = MyCharNext( lpNext );
		}

		if ((Area.top = Area.bottom) > WndHeight )
			Area.top -= CastHeight;
	}

	if (bScroll)
		RestoreDC( hDC, SaveLevel );

	DeleteObject( hUpdate );
	DeleteObject( hBrush );
	SetTextColor( hDC, OldTextColor );
	SetBkMode( hDC, OldBkMode );
	if ( hOldFont )
		SelectObject( hDC, hOldFont );
	ReleaseDC( hWnd, hDC );
}
Beispiel #3
0
BOOL HandleCommandLine( HWND hWindow, LPTSTR lpszCmdLine, LPINT lpPrint )
/***********************************************************************/
{
	FNAME    szFileName;
	LPTSTR   lp;
	BOOL     bPassedByClient;
	LPIMAGE  lpImageDoc;
	HWND     hWnd;
	WORD 	 wChar;

	*lpPrint = NO;
	if( !lpszCmdLine )
    	return( TRUE );

	// Check if we have "[/ | -]embedding" and a possible filename.
	// usage: PP ["[-/]embedding"] file1 file2 ...

	//dbg("full command line = '%ls'", lpszCmdLine );

	// See if the command line is being passed by a client
	bPassedByClient = NO;
	if(( lp = lstrfind( lpszCmdLine, _T("embedding") )) &&
   	   ( lp == lpszCmdLine || lp == ( MyCharNext( lpszCmdLine ))))
   	{ 	// Command line passed by a client
		//  dbg(_T("command line passed by client"));
    	bPassedByClient = YES;
    	lpszCmdLine = SkipSpaces( MyCharNextN( lp, 9 )); 	// skip over _T("embedding")
   	}

	while( *lpszCmdLine )		// Process any files and switches on the command line
   	{ 
    	// Skip white space and see if we're done...
    	lpszCmdLine = SkipSpaces( lpszCmdLine );
    	if( !( *lpszCmdLine ))	// If NULL get out
        	break; 

		//  dbg( _T("file='%ls' print=%d"), lpszCmdLine, *lpPrint );dbg(0);

    	// Check for any switches preceeding the file name: only /p for now
    	while( TRUE )	
    	{ 
			if( IsDBCSLeadByte(( BYTE )*lpszCmdLine ))
				wChar = *(( LPWORD )lpszCmdLine );
			else
				wChar = *lpszCmdLine;

			if( wChar != _T('/'))	// if not a switch...
				break;

        	lpszCmdLine = MyCharNext( lpszCmdLine );	// Skip over the slash

        	if( !*lpszCmdLine )		// If NULL get out
            	break; 

			if( IsDBCSLeadByte(( BYTE )*lpszCmdLine ))
				wChar = *(( LPWORD )lpszCmdLine );
			else
				wChar = *lpszCmdLine;

        	if( wChar == _T('p') || wChar == _T('P') )
            	*lpPrint = YES;

        	lpszCmdLine = SkipSpaces( MyCharNext( lpszCmdLine ));
		}

    	// Skip white space and see if we're done...
    	lpszCmdLine = SkipSpaces( lpszCmdLine );
    	if( !( *lpszCmdLine ))		// If NULL get out
        	break; 

    	// Try to zap the space after a single file name
    	if(( lp = lstrfind( lpszCmdLine, _T(" ") )))
        	*lp = _T('\0'); // If we found a space, zap it

    	// Copy the full path name into szFileName
    	if( lStrChr( lpszCmdLine, _T('\\') ))
        	lstrcpy( szFileName, lpszCmdLine );
    	else				// If not a full path name...
   		{ 
        	GetCurrentDir( szFileName, sizeof(FNAME) );
        	FixPath( szFileName );
        	lstrcat( szFileName, lpszCmdLine );
		}

    	// Now we're done with lpszCmdLine, so set it up for the next loop
		// If we had found a space, there might be more file names
    	if( lp )	
        	lpszCmdLine = MyCharNext( lp );
    	else    
			lpszCmdLine += lstrlen( lpszCmdLine ); // Point to nothing

    	// Process szFileName

    	// Special handling of documents passed by a client
    	if ( bPassedByClient )
    	{
			CServerDoc *pDoc = PictPubApp.GetDocument(szFileName);
			if (pDoc)
        	{
            	// It's already open....
            	POSITION ViewPos = pDoc->GetFirstViewPosition();
            	ASSERT(ViewPos!=NULL);
            	CView* pView = pDoc->GetNextView( ViewPos );
            	ASSERT(pView);
            	// NOTE send Message to View's Parent MDIFrame
            	SendMessage( PictPubApp.Get_hClientAstral(), WM_MDIACTIVATE, 
                	(WORD)pView->GetParentFrame()->GetSafeHwnd(), 0L );
            	lpImageDoc->fOwnedByClient = YES;
            	*szFileName = _T('\0'); // Zap it
        	}
    	}

    	// If we have a file name, open it...
    	if ( *szFileName )
			hWnd = AstralImageLoad(  0, szFileName, MAYBE, YES );
    	else    
			hWnd = NULL;

    	// If the printing option was passed, print it and close it
    	if ( hWnd && *lpPrint )
    	{
         	FORWARD_WM_COMMAND(PictPubApp.Get_hWndAstral(), IDM_PRINT, NULL, 0, SendMessage);
        	CloseImage( NO, NULL, NULL );
    	}
	}
	return( TRUE );
}