📄 ceditview_new.cpp
字号:
}
if( rcClip2.left < rcClip2.right &&
rcClip2.left < m_nViewAlignLeft + m_nViewCx && rcClip2.right > m_nViewAlignLeft ){
rcClip2.top = y;
rcClip2.bottom = y + nLineHeight;
/* 折り返し記号を表示する */
if( TypeDataPtr->m_ColorInfoArr[COLORIDX_WRAP].m_bDisp ){
HFONT hFontOld;
colTextColorOld = ::SetTextColor( hdc, TypeDataPtr->m_ColorInfoArr[COLORIDX_WRAP].m_colTEXT ); /* 折り返し記号の色 */
colBkColorOld = ::SetBkColor( hdc, TypeDataPtr->m_ColorInfoArr[COLORIDX_WRAP].m_colBACK ); /* 折り返し記号背景の色 */
/* フォントを選ぶ */
hFontOld = (HFONT)::SelectObject( hdc,
ChooseFontHandle(
TypeDataPtr->m_ColorInfoArr[COLORIDX_WRAP].m_bFatFont,
TypeDataPtr->m_ColorInfoArr[COLORIDX_WRAP].m_bUnderLine
)
);
::ExtTextOut( hdc, x + nX * ( nCharWidth ), y, fuOptions,
&rcClip2, pszWRAP, lstrlen( pszWRAP ), m_pnDx );
::SelectObject( hdc, hFontOld );
::SetTextColor( hdc, colTextColorOld );
::SetBkColor( hdc, colBkColorOld );
}else{
::ExtTextOut( hdc, x + nX * ( nCharWidth ), y, fuOptions,
&rcClip2, " ", 1, m_pnDx );
}
}
if( bSelected ){
/* テキスト反転 */
DispTextSelected( hdc, nLineNum, x, y, nX );
}
}
}
if( y/* + nLineHeight*/ >= m_nViewAlignTop ){
/* テキスト表示 */
nX += DispText( hdc, x + nX * ( nCharWidth ), y, &pLine[nBgn], nPos - nBgn );
if( bSelected ){
/* テキスト反転 */
DispTextSelected( hdc, nLineNum, x, y, nX );
}
}
/* EOF記号の表示 */
// if( TypeDataPtr->m_ColorInfoArr[COLORIDX_EOF].m_bDisp ){
if( nLineNum + 1 == m_pcEditDoc->m_cLayoutMgr.GetLineCount() &&
nX < TypeDataPtr->m_nMaxLineSize
){
if( TypeDataPtr->m_ColorInfoArr[COLORIDX_EOF].m_bDisp ){
// May 29, 2004 genta (advised by MIK) 共通関数化
nX += DispEOF( hdc, x + nX * ( nCharWidth ), y, nCharWidth, nLineHeight, fuOptions,
TypeDataPtr->m_ColorInfoArr[COLORIDX_EOF] );
}
bEOF = TRUE;
}
if( bDispBkBitmap ){
}else{
/* 行末背景描画 */
rcClip.left = x + nX * ( nCharWidth );
rcClip.right = m_nViewAlignLeft + m_nViewCx;
rcClip.top = y;
rcClip.bottom = y + nLineHeight;
if( rcClip.left < m_nViewAlignLeft ){
rcClip.left = m_nViewAlignLeft;
}
if( rcClip.left < rcClip.right &&
rcClip.left < m_nViewAlignLeft + m_nViewCx && rcClip.right > m_nViewAlignLeft ){
hBrush = ::CreateSolidBrush( TypeDataPtr->m_ColorInfoArr[COLORIDX_TEXT].m_colBACK );
::FillRect( hdc, &rcClip, hBrush );
::DeleteObject( hBrush );
}
}
end_of_line:;
nLineNum++;
y += nLineHeight;
}else{
if( y/* + nLineHeight*/ >= m_nViewAlignTop ){
if( bDispBkBitmap ){
}else{
/* 背景描画 */
rcClip.left = 0;
rcClip.right = m_nViewAlignLeft + m_nViewCx;
rcClip.top = y;
rcClip.bottom = y + nLineHeight;
hBrush = ::CreateSolidBrush( TypeDataPtr->m_ColorInfoArr[COLORIDX_TEXT].m_colBACK );
::FillRect( hdc, &rcClip, hBrush );
::DeleteObject( hBrush );
}
/* EOF記号の表示 */
nCount = m_pcEditDoc->m_cLayoutMgr.GetLineCount();
if( nCount == 0 && m_nViewTopLine == 0 && nLineNum == 0 ){
/* EOF記号の表示 */
if( TypeDataPtr->m_ColorInfoArr[COLORIDX_EOF].m_bDisp ){
// May 29, 2004 genta (advised by MIK) 共通関数化
nX += DispEOF( hdc, x, y, nCharWidth, nLineHeight, fuOptions,
TypeDataPtr->m_ColorInfoArr[COLORIDX_EOF] );
}
y += nLineHeight;
bEOF = TRUE;
}else{
if( nCount > 0 && nLineNum == nCount ){
const char* pLine;
int nLineLen;
const CLayout* pcLayout;
pLine = m_pcEditDoc->m_cLayoutMgr.GetLineStr( nCount - 1, &nLineLen, &pcLayout );
nLineCols = LineIndexToColmn( pcLayout, nLineLen );
if( ( pLine[nLineLen - 1] == CR || pLine[nLineLen - 1] == LF ) ||
nLineCols >= TypeDataPtr->m_nMaxLineSize
){
/* EOF記号の表示 */
if( TypeDataPtr->m_ColorInfoArr[COLORIDX_EOF].m_bDisp ){
// May 29, 2004 genta (advised by MIK) 共通関数化
nX += DispEOF( hdc, x, y, nCharWidth, nLineHeight, fuOptions,
TypeDataPtr->m_ColorInfoArr[COLORIDX_EOF] );
}
y += nLineHeight;
bEOF = TRUE;
}
}
}
}
}
end_of_func:;
// 2002/05/08 YAZAKI アンダーラインの再描画は不要でした
// MYTRACE( "m_nOldUnderLineY=%d\n", m_nOldUnderLineY );
// if( -1 != m_nOldUnderLineY ){
// /* カーソル行アンダーラインのON */
// CaretUnderLineON( TRUE );
// }
return bEOF;
}
// May 23, 2000 genta
/*! 画面描画補助関数:
行末の改行マークを改行コードによって書き分ける(メイン)
@param hdc Device Context Handle
@param nPosX 描画座標X
@param nPosY 描画座標Y
@param nWidth 描画エリアのサイズX
@param nHeight 描画エリアのサイズY
@param cEol 行末コード種別
@param bBold TRUE: 太字
@param pColor 色
@note bBoldがTRUEの時は横に1ドットずらして重ね書きを行うが、
あまり太く見えない。
@date 2001.12.21 YAZAKI 改行記号の描きかたを変更。ペンはこの関数内で作るようにした。
矢印の先頭を、sx, syにして描画ルーチン書き直し。
*/
void CEditView::DrawEOL( HDC hdc, int nPosX, int nPosY, int nWidth, int nHeight, CEOL cEol, int bBold, COLORREF pColor )
{
int sx, sy; // 矢印の先頭
HANDLE hPen;
HPEN hPenOld;
hPen = ::CreatePen( PS_SOLID, 1, pColor );
hPenOld = (HPEN)::SelectObject( hdc, hPen );
switch( cEol.GetType() ){
case EOL_CRLF: // 下左矢印
sx = nPosX;
sy = nPosY + ( nHeight / 2);
::MoveToEx( hdc, sx + nWidth, sy - nHeight / 4, NULL ); // 上へ
::LineTo( hdc, sx + nWidth, sy ); // 下へ
::LineTo( hdc, sx, sy ); // 先頭へ
::LineTo( hdc, sx + nHeight / 4, sy + nHeight / 4 ); // 先頭から下へ
::MoveToEx( hdc, sx, sy, NULL); // 先頭へ戻り
::LineTo( hdc, sx + nHeight / 4, sy - nHeight / 4 ); // 先頭から上へ
if ( bBold ) {
::MoveToEx( hdc, sx + nWidth + 1, sy - nHeight / 4, NULL ); // 上へ(右へずらす)
++sy;
::LineTo( hdc, sx + nWidth + 1, sy ); // 右へ(右にひとつずれている)
::LineTo( hdc, sx, sy ); // 先頭へ
::LineTo( hdc, sx + nHeight / 4, sy + nHeight / 4 ); // 先頭から下へ
::MoveToEx( hdc, sx, sy, NULL); // 先頭へ戻り
::LineTo( hdc, sx + nHeight / 4, sy - nHeight / 4 ); // 先頭から上へ
}
// ::MoveToEx( hdc, sx, nPosY + ( nHeight * 15 / 20 ), NULL );
// ::LineTo( hdc, sx, nPosY + ( nHeight * 5 / 20 ) );
// ::MoveToEx( hdc, sx, sy, NULL );
// ::LineTo( hdc, sx - ( nHeight * 5 / 20 ), sy - ( nHeight * 5 / 20 ) );
// ::MoveToEx( hdc, sx, nPosY + ( nHeight * 15 / 20 ), NULL);
// ::LineTo( hdc, sx + ( nHeight * 5 / 20 ), sy - ( nHeight * 5 / 20 ) );
// if( bBold ){
// ++sx;
// ::MoveToEx( hdc, sx, nPosY + ( nHeight * 15 / 20 ), NULL );
// ::LineTo( hdc, sx, nPosY + ( nHeight * 5 / 20 ) );
// ::MoveToEx( hdc, sx, nPosY + ( nHeight * 15 / 20 ), NULL );
// ::LineTo( hdc, sx - ( nHeight * 5 / 20 ), nPosY + ( nHeight * 15/ 20) - ( nHeight * 5 / 20 ) );
// ::MoveToEx( hdc, sx, nPosY + ( nHeight * 15 / 20 ), NULL);
// ::LineTo( hdc, sx + ( nHeight * 5 / 20 ), nPosY + ( nHeight * 15/ 20) - ( nHeight * 5 / 20 ) );
// }
break;
case EOL_LF: // 左向き矢印
sx = nPosX;
sy = nPosY + ( nHeight / 2 );
::MoveToEx( hdc, sx + nWidth, sy, NULL ); // 右へ
::LineTo( hdc, sx, sy ); // 先頭へ
::LineTo( hdc, sx + nHeight / 4, sy + nHeight / 4 ); // 先頭から下へ
::MoveToEx( hdc, sx, sy, NULL); // 先頭へ戻り
::LineTo( hdc, sx + nHeight / 4, sy - nHeight / 4 ); // 先頭から上へ
if ( bBold ) {
++sy;
::MoveToEx( hdc, sx + nWidth, sy, NULL ); // 右へ
::LineTo( hdc, sx, sy ); // 先頭へ
::LineTo( hdc, sx + nHeight / 4, sy + nHeight / 4 ); // 先頭から下へ
::MoveToEx( hdc, sx, sy, NULL); // 先頭へ戻り
::LineTo( hdc, sx + nHeight / 4, sy - nHeight / 4 ); // 先頭から上へ
}
// ::MoveToEx( hdc, nPosX, sy, NULL );
// ::LineTo( hdc, nPosX + nWidth, sy );
// ::MoveToEx( hdc, sx, sy, NULL );
// ::LineTo( hdc, sx + nHeight / 4, sy - nHeight / 4 );
// ::MoveToEx( hdc, sx, nPosY + ( nHeight / 2 ), NULL );
// ::LineTo( hdc, sx + nHeight / 4, sy + nHeight / 4);
// if( bBold ){
// ++sy;
// ::MoveToEx( hdc, nPosX, sy, NULL );
// ::LineTo( hdc, nPosX + nWidth, sy );
// ::MoveToEx( hdc, sx, sy, NULL );
// ::LineTo( hdc, sx + nHeight / 4, sy - nHeight / 4 );
// ::MoveToEx( hdc, sx, nPosY + ( nHeight / 2 ), NULL );
// ::LineTo( hdc, sx + nHeight / 4, sy + nHeight / 4);
// }
break;
case EOL_CR: // 下向き矢印
sx = nPosX + ( nWidth / 2 );
sy = nPosY + ( nHeight * 3 / 4 );
::MoveToEx( hdc, sx, nPosY + nHeight / 4 + 1, NULL ); // 上へ
::LineTo( hdc, sx, sy ); // 上から下へ
::LineTo( hdc, sx - nHeight / 4, sy - nHeight / 4); // そのまま左上へ
::MoveToEx( hdc, sx, sy, NULL); // 矢印の先端に戻る
::LineTo( hdc, sx + nHeight / 4, sy - nHeight / 4); // そして右上へ
if( bBold ){
++sx;
::MoveToEx( hdc, sx, nPosY + nHeight / 4 + 1, NULL );
::LineTo( hdc, sx, sy ); // 上から下へ
::LineTo( hdc, sx - nHeight / 4, sy - nHeight / 4); // そのまま左上へ
::MoveToEx( hdc, sx, sy, NULL); // 矢印の先端に戻る
::LineTo( hdc, sx + nHeight / 4, sy - nHeight / 4); // そして右上へ
}
//#if 1
// sx = nPosX + nWidth;
// sy = nPosY + ( nHeight / 2 );
// ::MoveToEx( hdc, nPosX, sy, NULL );
// ::LineTo( hdc, nPosX + nWidth, sy );
// ::MoveToEx( hdc, sx, sy, NULL );
// ::LineTo( hdc, sx - nHeight / 4, sy - nHeight / 4 );
// ::MoveToEx( hdc, sx, nPosY + ( nHeight / 2 ), NULL );
// ::LineTo( hdc, sx - nHeight / 4, sy + nHeight / 4);
// if( bBold ){
// ++sy;
// ::MoveToEx( hdc, nPosX, sy, NULL );
// ::LineTo( hdc, nPosX + nWidth, sy );
// ::MoveToEx( hdc, sx, sy, NULL );
// ::LineTo( hdc, sx - nHeight / 4, sy - nHeight / 4 );
// ::MoveToEx( hdc, sx, nPosY + ( nHeight / 2 ), NULL );
// ::LineTo( hdc, sx - nHeight / 4, sy + nHeight / 4);
// }
//#else
// sx = nPosX;
// ::MoveToEx( hdc, sx + nWidth - 3, nPosY + nHeight * 1 / 4, NULL );
// ::LineTo( hdc, sx + nWidth - 3, nPosY + nHeight * 3 / 4);
// ::LineTo( hdc, sx, nPosY + nHeight * 3 / 4 );
// ::LineTo( hdc, sx + nWidth - 3, nPosY + nHeight * 3 / 4 - nHeight / 4);
// if( bBold ){
// ++sx;
// ::MoveToEx( hdc, sx + nWidth - 3, nPosY + nHeight * 1 / 4, NULL );
// ::LineTo( hdc, sx + nWidth - 3, nPosY + nHeight * 3 / 4);
// ::LineTo( hdc, sx, nPosY + nHeight * 3 / 4 );
// ::LineTo( hdc, sx + nWidth - 3, nPosY + nHeight * 3 / 4 - nHeight / 4);
// }
//#endif
break;
case EOL_LFCR:
sx = nPosX + ( nWidth / 2 );
sy = nPosY + ( nHeight * 3 / 4 );
::MoveToEx( hdc, sx + nWidth / 2, nPosY + nHeight / 4 + 1, NULL ); // 右上へ
::LineTo( hdc, sx, nPosY + nHeight / 4 + 1 ); // 右から左へ
::LineTo( hdc, sx, sy ); // 上から下へ
::LineTo( hdc, sx - nHeight / 4, sy - nHeight / 4); // そのまま左上へ
::MoveToEx( hdc, sx, sy, NULL); // 矢印の先端に戻る
::LineTo( hdc, sx + nHeight / 4, sy - nHeight / 4); // そして右上へ
if( bBold ){
::MoveToEx( hdc, sx + nWidth / 2, nPosY + nHeight / 4 + 2, NULL ); // 右上へ
++sx;
::LineTo( hdc, sx, nPosY + nHeight / 4 + 2 ); // 右から左へ
::LineTo( hdc, sx, sy ); // 上から下へ
::LineTo( hdc, sx - nHeight / 4, sy - nHeight / 4); // そのまま左上へ
::MoveToEx( hdc, sx, sy, NULL); // 矢印の先端に戻る
::LineTo( hdc, sx + nHeight / 4, sy - nHeight / 4); // そして右上へ
}
// sx = nPosX + ( nWidth / 2 );
// sy = nPosY + ( nHeight * 1 / 4 );
// ::MoveToEx( hdc, sx, nPosY + ( nHeight * 15 / 20 ), NULL );
// ::LineTo( hdc, sx, nPosY + ( nHeight * 5 / 20 ) );
// ::MoveToEx( hdc, sx, sy, NULL );
// ::LineTo( hdc, sx - ( nHeight * 5 / 20 ), sy + ( nHeight * 5 / 20 ) );
// ::MoveToEx( hdc, sx, sy, NULL);
// ::LineTo( hdc, sx + ( nHeight * 5 / 20 ), sy + ( nHeight * 5 / 20 ) );
// if( bBold ){
// ++sx;
// ::MoveToEx( hdc, sx, nPosY + ( nHeight * 15 / 20 ), NULL );
// ::LineTo( hdc, sx, nPosY + ( nHeight * 5 / 20 ) );
// ::MoveToEx( hdc, sx, sy, NULL );
// ::LineTo( hdc, sx - ( nHeight * 5 / 20 ), sy + ( nHeight * 5 / 20 ) );
// ::MoveToEx( hdc, sx, sy, NULL);
// ::LineTo( hdc, sx + ( nHeight * 5 / 20 ), sy + ( nHeight * 5 / 20 ) );
// }
break;
}
::SelectObject( hdc, hPenOld );
::DeleteObject( hPen );
}
/*
タブ矢印描画関数
*/
void CEditView::DrawTabArrow( HDC hdc, int nPosX, int nPosY, int nWidth, int nHeight, int bBold, COLORREF pColor )
{
int sx, sy; // 矢印の先頭
HANDLE hPen;
HPEN hPenOld;
hPen = ::CreatePen( PS_SOLID, 1, pColor );
hPenOld = (HPEN)::SelectObject( hdc, hPen );
nWidth--;
sx = nPosX + nWidth;
sy = nPosY + ( nHeight / 2 );
::MoveToEx( hdc, sx - nWidth, sy, NULL ); // 左へ
::LineTo( hdc, sx, sy ); // 最後へ
::LineTo( hdc, sx - nHeight / 4, sy + nHeight / 4 ); // 最後から下へ
::MoveToEx( hdc, sx, sy, NULL); // 最後へ戻り
::LineTo( hdc, sx - nHeight / 4, sy - nHeight / 4 ); // 最後から上へ
if ( bBold ) {
++sy;
::MoveToEx( hdc, sx - nWidth, sy, NULL ); // 左へ
::LineTo( hdc, sx, sy ); // 最後へ
::LineTo( hdc, sx - nHeight / 4, sy + nHeight / 4 ); // 最後から下へ
::MoveToEx( hdc, sx, sy, NULL); // 最後へ戻り
::LineTo( hdc, sx - nHeight / 4, sy - nHeight / 4 ); // 最後から上へ
}
::SelectObject( hdc, hPenOld );
::Dele
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -