示例#1
0
文件: caret.c 项目: ChenZewei/acoral
//show caret
BOOL GUIAPI 
ShowCaret(
	HWND hWnd
)
{
	PWindowsTree pWin;
	HDC hDC;

	pWin = (PWindowsTree)hWnd;

	if (!pWin->pCaretInfo)
		return false;

	if (pWin->pCaretInfo->fBlink)
		return false;

	pWin->pCaretInfo->fBlink = true;
	GetCaretBitmaps (pWin->pCaretInfo);

	if (!pWin->pCaretInfo->fShow) {
		// show caret immediately
		hDC = GetDC (hWnd);
		PutSavedBoxOnDC (hDC,
		                pWin->pCaretInfo->x, pWin->pCaretInfo->y,
		                pWin->pCaretInfo->nEffWidth,
		                pWin->pCaretInfo->nEffHeight,
		                (PCOLORREF)pWin->pCaretInfo->pXored);

		ReleaseDC (hWnd, hDC);
		pWin->pCaretInfo->fShow = true;
	}

	return true;
}
示例#2
0
BOOL GUIAPI ShowCaret (HWND hWnd)
{
    PMAINWIN pWin;

    pWin = (PMAINWIN)hWnd;

    if (!pWin->pCaretInfo)
        return FALSE;

    if (pWin->pCaretInfo->fBlink)
        return FALSE;

    pWin->pCaretInfo->fBlink = TRUE;
    GetCaretBitmaps (pWin->pCaretInfo);
    
    if (!pWin->pCaretInfo->fShow) {

        HDC hdc;
        
        // show caret immediately
        hdc = GetClientDC (hWnd);
#ifdef _USE_NEWGAL
        pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pXored;
        FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
        PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pXored);
#endif /* _USE_NEWGAL */
        ReleaseDC (hdc);

        pWin->pCaretInfo->fShow = TRUE;
    }

    return TRUE;
}
示例#3
0
BOOL GUIAPI ChangeCaretSize (HWND hWnd, int newWidth, int newHeight)
{
    PMAINWIN pWin;

    pWin = (PMAINWIN)hWnd;

    if (!pWin->pCaretInfo)
        return FALSE;
    
#ifdef _USE_NEWGAL
    if (newWidth == pWin->pCaretInfo->caret_bmp.bmWidth
            && newHeight == pWin->pCaretInfo->caret_bmp.bmHeight)
        return TRUE;
#else
    if (newWidth == pWin->pCaretInfo->nEffWidth
            && newHeight == pWin->pCaretInfo->nEffHeight)
        return TRUE;
#endif /* _USE_NEWGAL */
        
    if (newWidth > pWin->pCaretInfo->nWidth
            || newHeight > pWin->pCaretInfo->nHeight
            || newWidth <= 0 || newHeight <= 0)
        return FALSE;

    if (pWin->pCaretInfo->fBlink) {
        if (pWin->pCaretInfo->fShow) {
        
            HDC hdc;

            // hide caret first
            hdc = GetClientDC (hWnd);
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pNormal;
            FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
            PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pNormal);
#endif /* _USE_NEWGAL */

            // then update size info
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmWidth = newWidth;
            pWin->pCaretInfo->caret_bmp.bmHeight= newHeight;
            pWin->pCaretInfo->nBytesNr = pWin->pCaretInfo->caret_bmp.bmPitch * newHeight;
#else
            pWin->pCaretInfo->nEffWidth = newWidth;
            pWin->pCaretInfo->nEffHeight = newHeight;
            pWin->pCaretInfo->nBytesNr = newWidth * newHeight * BYTESPERPHYPIXEL;
#endif /* _USE_NEWGAL */

            // save normal bitmap first
            GetCaretBitmaps (pWin->pCaretInfo);
            
            // show caret again
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pXored;
            FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
            PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pXored);
#endif /* _USE_NEWGAL */

            ReleaseDC (hdc);
        }
        else {
            HDC hdc;
        
            // then update size info
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmWidth = newWidth;
            pWin->pCaretInfo->caret_bmp.bmHeight= newHeight;
            pWin->pCaretInfo->nBytesNr = pWin->pCaretInfo->caret_bmp.bmPitch * newHeight;
#else
            pWin->pCaretInfo->nEffWidth = newWidth;
            pWin->pCaretInfo->nEffHeight = newHeight;
            pWin->pCaretInfo->nBytesNr = newWidth * newHeight * BYTESPERPHYPIXEL;
#endif /* _USE_NEWGAL */

            // save normal bitmap first
            GetCaretBitmaps (pWin->pCaretInfo);

            // show caret
            hdc = GetClientDC (hWnd);
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pXored;
            FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
            PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pXored);
#endif /* _USE_NEWGAL */

            ReleaseDC (hdc);

            pWin->pCaretInfo->fShow = TRUE;
        }
    }
    else {
        // update size info
#ifdef _USE_NEWGAL
        pWin->pCaretInfo->caret_bmp.bmWidth = newWidth;
        pWin->pCaretInfo->caret_bmp.bmHeight= newHeight;
        pWin->pCaretInfo->nBytesNr = pWin->pCaretInfo->caret_bmp.bmPitch * newHeight;
#else
        pWin->pCaretInfo->nEffWidth  = newWidth;
        pWin->pCaretInfo->nEffHeight = newHeight;
        pWin->pCaretInfo->nBytesNr = newWidth * newHeight * BYTESPERPHYPIXEL;
#endif
    }

    return TRUE;
}
示例#4
0
BOOL GUIAPI SetCaretPos (HWND hWnd, int x, int y)
{
    PMAINWIN pWin;

    pWin = (PMAINWIN)hWnd;

    if (!pWin->pCaretInfo)
        return FALSE;

    if (pWin->pCaretInfo->fBlink) {
        if (pWin->pCaretInfo->fShow) {
        
            HDC hdc;

            // hide caret first
            hdc = GetClientDC (hWnd);
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pNormal;
            FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
            PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pNormal);
#endif /* _USE_NEWGAL */

            // then update position
            pWin->pCaretInfo->x = x;
            pWin->pCaretInfo->y = y;

            // save normal bitmap first
            GetCaretBitmaps (pWin->pCaretInfo);
            
            // show caret again
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pXored;
            FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
            PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pXored);
#endif /* _USE_NEWGAL */

            ReleaseDC (hdc);
        }
        else {
            HDC hdc;
        
            // update position
            pWin->pCaretInfo->x = x;
            pWin->pCaretInfo->y = y;

            // save normal bitmap first
            GetCaretBitmaps (pWin->pCaretInfo);

            // show caret
            hdc = GetClientDC (hWnd);
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pXored;
            FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
            PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pXored);
#endif /* _USE_NEWGAL */

            ReleaseDC (hdc);

            pWin->pCaretInfo->fShow = TRUE;
        }
    }
    else {
        // update position
        pWin->pCaretInfo->x = x;
        pWin->pCaretInfo->y = y;
    }

    return TRUE;
}
示例#5
0
文件: caret.c 项目: ChenZewei/acoral
BOOL GUIAPI 
ChangeCaretSize(
	HWND hWnd, 
	int newWidth, 
	int newHeight
)
{
	PWindowsTree pWin;
	HDC hDC;
	pWin = (PWindowsTree)hWnd;

	if (!pWin->pCaretInfo)
		return false;

	if (newWidth == pWin->pCaretInfo->nEffWidth
	        && newHeight == pWin->pCaretInfo->nEffHeight)
		return true;
	    
	if (newWidth > pWin->pCaretInfo->nWidth
	        || newHeight > pWin->pCaretInfo->nHeight
	        || newWidth <= 0 || newHeight <= 0)
		return false;

	if (pWin->pCaretInfo->fBlink) {
		if (pWin->pCaretInfo->fShow) {
			// hide caret first
			hDC = GetDC (hWnd);
			PutSavedBoxOnDC (hDC,
			            pWin->pCaretInfo->x, pWin->pCaretInfo->y,
			            pWin->pCaretInfo->nEffWidth,
			            pWin->pCaretInfo->nEffHeight,
			            (PCOLORREF)pWin->pCaretInfo->pNormal);

			// then update size info
			pWin->pCaretInfo->nEffWidth = newWidth;
			pWin->pCaretInfo->nEffHeight = newHeight;
			pWin->pCaretInfo->nBytesNr = newWidth*newHeight*Gal_iBytesDataType;

			// save normal bitmap first
			GetCaretBitmaps (pWin->pCaretInfo);

			// show caret again
			PutSavedBoxOnDC (hDC,
			            pWin->pCaretInfo->x, pWin->pCaretInfo->y,
			            pWin->pCaretInfo->nEffWidth,
			            pWin->pCaretInfo->nEffHeight,
			            (PCOLORREF)pWin->pCaretInfo->pXored);

			ReleaseDC (hWnd, hDC);
		}
		else {
			// then update size info
			pWin->pCaretInfo->nEffWidth = newWidth;
			pWin->pCaretInfo->nEffHeight = newHeight;
			pWin->pCaretInfo->nBytesNr = newWidth*newHeight*Gal_iBytesDataType;

			// save normal bitmap first
			GetCaretBitmaps (pWin->pCaretInfo);

			// show caret
			hDC = GetDC (hWnd);
			PutSavedBoxOnDC (hDC,
			            pWin->pCaretInfo->x, pWin->pCaretInfo->y,
			            pWin->pCaretInfo->nEffWidth,
			            pWin->pCaretInfo->nEffHeight,
			            (PCOLORREF)pWin->pCaretInfo->pXored);

			ReleaseDC (hWnd, hDC);

			pWin->pCaretInfo->fShow = true;
		}
	}
	else {
		// update size info
		pWin->pCaretInfo->nEffWidth  = newWidth;
		pWin->pCaretInfo->nEffHeight = newHeight;
		pWin->pCaretInfo->nBytesNr = newWidth*newHeight*Gal_iBytesDataType;
	}

	return true;
}
示例#6
0
文件: caret.c 项目: ChenZewei/acoral
BOOL GUIAPI
SetCaretPos(
	HWND hWnd, 
	int x, 
	int y
)
{
	PWindowsTree pWin;
	HDC hDC;
	pWin = (PWindowsTree)hWnd;

	if (!pWin->pCaretInfo)
		return false;

	if (pWin->pCaretInfo->fBlink) { /// set to blink
		if (pWin->pCaretInfo->fShow) {
			// hide caret first
			hDC = GetDC (hWnd);
			PutSavedBoxOnDC (hDC,
			            pWin->pCaretInfo->x, pWin->pCaretInfo->y,
			            pWin->pCaretInfo->nEffWidth,
			            pWin->pCaretInfo->nEffHeight,
			            (PCOLORREF)pWin->pCaretInfo->pNormal);
			// then update position
			pWin->pCaretInfo->x = x;
			pWin->pCaretInfo->y = y;

			// save normal bitmap first
			GetCaretBitmaps (pWin->pCaretInfo);

			// show caret again
			PutSavedBoxOnDC (hDC,
			            pWin->pCaretInfo->x, pWin->pCaretInfo->y,
			            pWin->pCaretInfo->nEffWidth,
			            pWin->pCaretInfo->nEffHeight,
			            (PCOLORREF)pWin->pCaretInfo->pXored);

			ReleaseDC (hWnd, hDC);
		}
		else {
			// update position
			pWin->pCaretInfo->x = x;
			pWin->pCaretInfo->y = y;

			// save normal bitmap first
			GetCaretBitmaps (pWin->pCaretInfo);

			// show caret
			hDC = GetDC (hWnd);
			PutSavedBoxOnDC (hDC,
			            pWin->pCaretInfo->x, pWin->pCaretInfo->y,
			            pWin->pCaretInfo->nEffWidth,
			            pWin->pCaretInfo->nEffHeight,
			            (PCOLORREF)pWin->pCaretInfo->pXored);

			ReleaseDC (hWnd, hDC);

			pWin->pCaretInfo->fShow = true;
		}
	}
	else {
		// update position
		pWin->pCaretInfo->x = x;
		pWin->pCaretInfo->y = y;
	}
	return true;
}