📄 caret.c
字号:
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 */ pWin->pCaretInfo->fShow = FALSE; } ReleaseDC (hdc); return TRUE;}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;}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;}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;}BOOL GUIAPI GetCaretPos (HWND hWnd, PPOINT pPt){ PMAINWIN pWin; pWin = (PMAINWIN)hWnd; if (!pWin->pCaretInfo) return FALSE; pPt->x = pWin->pCaretInfo->x; pPt->y = pWin->pCaretInfo->y; return TRUE;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -