예제 #1
0
파일: misc.c 프로젝트: jcbaar/Brainchild
/*
 *	Send a status message.
 */
void SendStatusMessage( LPCLASSDATA lpcd )
{
	NMSTATUSUPDATE		nms;
	HWND			hParent;

	/*
	 *	Do we have a parent?
	 */
	if (( hParent = GetParent( lpcd->hWnd )) != NULL )
	{
		/*
		 *	Fill in the structure.
		 */
		nms.hdr.code		= NMBC_STATUSUPDATE;
		nms.hdr.hwndFrom	= lpcd->hWnd;
		nms.hdr.idFrom		= GetWindowLong( lpcd->hWnd, GWL_ID );
		nms.bAnyText		= AnyText( lpcd );
		nms.bCanCopy		= OnCanCopy( lpcd->hWnd, 0, 0, lpcd );
		nms.bCanCut		= nms.bCanDelete = OnCanCutDelete( lpcd->hWnd, 0, 0, lpcd );
		nms.bCanPaste		= OnCanPaste( lpcd->hWnd, 0, 0, lpcd );
		nms.bCanRedo		= OnCanRedo( lpcd->hWnd, 0, 0, lpcd );
		nms.bCanUndo		= OnCanUndo( lpcd->hWnd, 0, 0, lpcd );
		nms.bModified		= lpcd->bModified;
		nms.bOverwrite		= lpcd->bOverwrite;
		nms.bReadOnly		= ( BOOL )( ISREADONLY );
		nms.bBookmarks		= ( BOOL )lpcd->aMarkers[ 0 ].nMarkers;
		nms.nFileMode		= Parser->nFileMode;

		/*
		 *	Send the notification if it
		 *	changed.
		 */
		if ( memcmp( &lpcd->suLastSent, &nms, sizeof( nms )) != 0 )
		{
			SendMessage( hParent, WM_NOTIFY, nms.hdr.idFrom, ( LPARAM )&nms );
			memcpy( &lpcd->suLastSent, &nms, sizeof( nms ));
		}
	}
}
예제 #2
0
파일: misc.c 프로젝트: jcbaar/Brainchild
LRESULT OnAnyText( HWND hWnd, WPARAM wParam, LPARAM lParam, LPCLASSDATA lpcd )
{
	return AnyText( lpcd );
}
예제 #3
0
파일: hyperlink.c 프로젝트: ymx/NiLogViewer
/*
 *	Check if the given position is over
 *	a hyperlink. Also sets up the start
 *	and end points if a hyperlink is
 *	found.
 */
static BOOL CheckForHyperlink( LPCLASSDATA lpcd, LPPOINT lpPos, LPPOINT lpStart, LPPOINT lpEnd, BOOL bQuoted )
{
	LPLINE	lpLine = ( LPLINE )ArrayGetAt( lpcd->lpLines, lpPos->y );
	int	nIndex = lpPos->x, i = 0;

	/*
	 *	Any text and, if so, any text on the
	 *	line?
	 */
	if ( AnyText( lpcd ) == FALSE || lpLine->pcText == NULL )
		return FALSE;

	/*
	 *	Are we in the text of the line?
	 */
	if ( nIndex >= lpLine->nLength )
		return FALSE;

	/*
	 *	Is the given position on a white space and
	 *	are we doing a non-quoted search?
	 */
	if ( ! bQuoted && (_istspace( lpLine->pcText[ nIndex ] ) || lpLine->pcText[ nIndex ] == _T('=')
       || lpLine->pcText[ nIndex ] == _T(';')))   // Modifications by Stephan (2005-05-28)
	{
		/*
		 *	Try a quoted search now.
		 */
		return CheckForHyperlink( lpcd, lpPos, lpStart, lpEnd, TRUE );
	}

	/*
	 *	Store line numbers.
	 */
	lpStart->y = lpEnd->y = lpPos->y;

	/*
	 *	Search for a quoted hyperlink?
	 */
	if ( ! bQuoted )
	{
		/*
		 *	Find the first white space or the 
		 *	beginning of the line.
		 */
		while ( nIndex > 0 && ! _istspace( lpLine->pcText[ nIndex ] ) && lpLine->pcText[ nIndex ] != _T('=') &&
            lpLine->pcText[ nIndex ] != _T(';'))
			nIndex--;

    // Support for certain Windows folders with white spaces
	if (nIndex >= 16 && lpLine->nLength > nIndex + 5 && !_tcsncicmp(lpLine->pcText + nIndex + 1, _T("(x86)"), 5))
		nIndex -= 16;
    else if (nIndex >= 10 && lpLine->nLength > nIndex + 5 && !_tcsncicmp(lpLine->pcText+nIndex+1, _T("Files"), 5))
      nIndex -= 10;
    else if (nIndex >= 16 && lpLine->nLength > nIndex + 8 && !_tcsncicmp(lpLine->pcText+nIndex+1, _T("Settings"), 8))
      nIndex -= 16;
    else if (nIndex >= 16 && lpLine->nLength > nIndex + 13 && !_tcsncicmp(lpLine->pcText+nIndex+1, _T("Einstellungen"), 13))
      nIndex -= 16;
	}
	else
	{
		/*
		 *	Find the first double quote or the 
		 *	beginning of the line.
		 */
		while ( nIndex > 0 && lpLine->pcText[ nIndex ] != _T( '"' ) &&
            lpLine->pcText[ nIndex ] != _T( '\'' ))   // Modifications by Stephan (2005-05-30)
			nIndex--;
	}

	/*
	 *	If were looking for a quoted hyperlink and we
	 *	are not on a double quote we stop here.
	 */
	if ( bQuoted && lpLine->pcText[ nIndex ] != _T( '"' ) && lpLine->pcText[ nIndex ] != _T( '\'' ))   // Modifications by Stephan (2005-05-30)
		return FALSE;
	else if ( _istspace( lpLine->pcText[ nIndex ] ) || lpLine->pcText[ nIndex ] == _T('=') ||
            lpLine->pcText[ nIndex ] == _T(';'))   // Modifications by Stephan (2005-05-28)
		nIndex++;

	/*
	 *	Store the start column.
	 */
	lpStart->x = nIndex;

	/*
	 *	Double or single quoted?
	 */
	if ( lpLine->pcText[ nIndex ] == _T( '"' ) || lpLine->pcText[ nIndex ] == _T( '\'' ))   // Modifications by Stephan (2005-05-30)
		lpStart->x++;

	/*
	 *	Is it a hyperlink?
	 */
	for (i = 0; Hyper[ i ].pszURL; i++ )
	{
		/*
		 *	Check if this hyperlink fits on the line
		 *	from this position.
		 */
		if ( lpLine->nLength - lpStart->x >= Hyper[ i ].nLength )
		{
			/*
			 *	Is it this hyperlink?
			 */
			if ( ! _tcsnicmp( &lpLine->pcText[ lpStart->x ], Hyper[ i ].pszURL, Hyper[ i ].nLength )) 
			{
        // Modified by Stephan (2005-06-12)
        // We only can specify the length of the hyperlink, if we know its identifier.
        // Only this makes it possible to have unquoted hyperlinks with spaces, e.g. c:\program files
	      /*
	      *	Double or single quoted?
	      */
	      if ( lpLine->pcText[ nIndex ] == _T( '"' ) || lpLine->pcText[ nIndex ] == _T( '\'' ))   // Modifications by Stephan (2005-05-30)
	      {
		      /*
		      *	Find the next double quote or the end
		      *	of the line.
		      */
		      nIndex++;
		      while ( nIndex < lpLine->nLength && lpLine->pcText[ nIndex ] != _T( '"' ) &&
                  lpLine->pcText[ nIndex ] != _T( '\'' ))   // Modifications by Stephan (2005-05-30)
			      nIndex++;
	      }
	      else
	      {
          nIndex += Hyper[ i ].nLength;
		      /*
		      *	Find the next white space or the end
		      *	of the line.
		      */
		      while ( nIndex < lpLine->nLength && ! _istspace( lpLine->pcText[ nIndex ] ) &&
                  lpLine->pcText[ nIndex ] != _T('(') && lpLine->pcText[ nIndex ] != _T(',') &&
                  lpLine->pcText[ nIndex ] != _T(';') && lpLine->pcText[ nIndex ] != _T(')') &&
                  lpLine->pcText[ nIndex ] != _T('\''))   // Modified by Stephan (2005-05-28)
			      nIndex++;
	      }

       /*
	      *	Store the end column.
	      */
	      lpEnd->x = nIndex - 1;

				/*
				 *	When we are on a hyperlink we show a hand cursors.
				 */
				SetCursor( lpcd->hHand );
				return TRUE;
			}
		}
	}

	/*
	 *	If we did not find a hyperlink and we are
	 *	not doing a quoted search we start one now.
	 */
	if ( ! bQuoted ) 
		return CheckForHyperlink( lpcd, lpPos, lpStart, lpEnd, TRUE );
	return FALSE;
}