📄 ceditview_new.cpp
字号:
nBgn = nPos;
nCOMMENTMODE = COLORIDX_TEXT; // 2002/03/13 novice
/* 現在の色を指定 */
if( !bSearchStringMode ){
SetCurrentColor( hdc, nCOMMENTMODE );
}
goto SEARCH_START;
}
break;
case COLORIDX_WSTRING: /* ダブルクォーテーション文字列である */ // 2002/03/13 novice
if( 0 == nCOMMENTEND ){
/* ダブルクォーテーション文字列の終端があるか */
int i;
nCOMMENTEND = nLineLen;
for( i = nPos/* + 1*/; i <= nLineLen - 1; ++i ){
nCharChars_2 = CMemory::MemCharNext( pLine, nLineLen, &pLine[i] ) - &pLine[i];
if( 0 == nCharChars_2 ){
nCharChars_2 = 1;
}
if( TypeDataPtr->m_nStringType == 0 ){ /* 文字列区切り記号エスケープ方法 0=[\"][\'] 1=[""][''] */
if( 1 == nCharChars_2 && pLine[i] == '\\' ){
++i;
}else
if( 1 == nCharChars_2 && pLine[i] == '"' ){
nCOMMENTEND = i + 1;
break;
}
}else
if( TypeDataPtr->m_nStringType == 1 ){ /* 文字列区切り記号エスケープ方法 0=[\"][\'] 1=[""][''] */
if( 1 == nCharChars_2 && pLine[i] == '"' ){
if( i + 1 < nLineLen && pLine[i + 1] == '"' ){
++i;
}else{
nCOMMENTEND = i + 1;
break;
}
}
}
if( 2 == nCharChars_2 ){
++i;
}
}
}else
if( nPos == nCOMMENTEND ){
if( y/* + nLineHeight*/ >= m_nViewAlignTop ){
/* テキスト表示 */
nX += DispText( hdc, x + nX * ( nCharWidth ), y, &pLine[nBgn], nPos - nBgn );
}
nBgn = nPos;
nCOMMENTMODE = COLORIDX_TEXT; // 2002/03/13 novice
/* 現在の色を指定 */
if( !bSearchStringMode ){
SetCurrentColor( hdc, nCOMMENTMODE );
}
goto SEARCH_START;
}
break;
default: //@@@ 2002.01.04 add start
if( nCOMMENTMODE >= 1000 && nCOMMENTMODE <= 1099 ){ //正規表現キーワード1~10
if( nPos == nCOMMENTEND ){
if( y/* + nLineHeight*/ >= m_nViewAlignTop ){
/* テキスト表示 */
nX += DispText( hdc, x + nX * ( nCharWidth ), y, &pLine[nBgn], nPos - nBgn );
}
nBgn = nPos;
nCOMMENTMODE = COLORIDX_TEXT; // 2002/03/13 novice
/* 現在の色を指定 */
if( !bSearchStringMode ){
SetCurrentColor( hdc, nCOMMENTMODE );
}
goto SEARCH_START;
}
}
break; //@@@ 2002.01.04 add end
}
if( pLine[nPos] == TAB ){
if( y/* + nLineHeight*/ >= m_nViewAlignTop ){
/* テキスト表示 */
nX += DispText( hdc, x + nX * ( nCharWidth ), y, &pLine[nBgn], nPos - nBgn );
// Sep. 22, 2002 genta 共通式のくくりだし
// Sep. 23, 2002 genta LayoutMgrの値を使う
int tabDispWidth = m_pcEditDoc->m_cLayoutMgr.GetActualTabSpace( nX );
/* タブ記号を表示する */
rcClip2.left = x + nX * ( nCharWidth );
rcClip2.right = rcClip2.left + ( nCharWidth ) * tabDispWidth;
if( rcClip2.left < m_nViewAlignLeft ){
rcClip2.left = m_nViewAlignLeft;
}
if( rcClip2.left < rcClip2.right &&
rcClip2.left < m_nViewAlignLeft + m_nViewCx && rcClip2.right > m_nViewAlignLeft ){
rcClip2.top = y;
rcClip2.bottom = y + nLineHeight;
/* TABを表示するか? */
if( TypeDataPtr->m_ColorInfoArr[COLORIDX_TAB].m_bDisp
&& 0 == TypeDataPtr->m_bTabArrow ){ //タブ通常表示 //@@@ 2003.03.26 MIK
if( bSearchStringMode ){
nColorIdx = COLORIDX_SEARCH;
}else{
nColorIdx = COLORIDX_TAB;
}
colTextColorOld = ::SetTextColor( hdc, TypeDataPtr->m_ColorInfoArr[nColorIdx].m_colTEXT ); /* TAB文字の色 */
colBkColorOld = ::SetBkColor( hdc, TypeDataPtr->m_ColorInfoArr[nColorIdx].m_colBACK ); /* TAB文字背景の色 */
HFONT hFontOld;
/* フォントを選ぶ */
hFontOld = (HFONT)::SelectObject( hdc,
ChooseFontHandle(
TypeDataPtr->m_ColorInfoArr[nColorIdx].m_bFatFont,
TypeDataPtr->m_ColorInfoArr[nColorIdx].m_bUnderLine
)
);
//@@@ 2001.03.16 by MIK
::ExtTextOut( hdc, x + nX * ( nCharWidth ), y, fuOptions,
&rcClip2, /*pszTAB*/ TypeDataPtr->m_szTabViewString,
tabDispWidth <= 8 ? tabDispWidth : 8, // Sep. 22, 2002 genta
m_pnDx );
::SelectObject( hdc, hFontOld );
::SetTextColor( hdc, colTextColorOld );
::SetBkColor( hdc, colBkColorOld );
}else{
if( bSearchStringMode ){
nColorIdx = COLORIDX_SEARCH;
colBkColorOld = ::SetBkColor( hdc, TypeDataPtr->m_ColorInfoArr[nColorIdx].m_colBACK ); /* TAB文字背景の色 */
}
::ExtTextOut( hdc, x + nX * ( nCharWidth ), y, fuOptions,
&rcClip2, pszSPACES,
tabDispWidth <= 8 ? tabDispWidth : 8, // Sep. 22, 2002 genta
m_pnDx );
if( bSearchStringMode ){
::SetBkColor( hdc, colBkColorOld );
}
//タブ矢印表示 //@@@ 2003.03.26 MIK
if( TypeDataPtr->m_ColorInfoArr[COLORIDX_TAB].m_bDisp
&& 0 != TypeDataPtr->m_bTabArrow
&& rcClip2.left <= x + nX * nCharWidth ) // Apr. 1, 2003 MIK 行番号と重なる
{
DrawTabArrow( hdc, x + nX * ( nCharWidth ), y, m_nCharWidth, m_nCharHeight,
TypeDataPtr->m_ColorInfoArr[COLORIDX_TAB].m_bFatFont,
TypeDataPtr->m_ColorInfoArr[COLORIDX_TAB].m_colTEXT );
}
}
}
nX += tabDispWidth ;// Sep. 22, 2002 genta
}
nBgn = nPos + 1;
nCharChars = 1;
}else
if( (unsigned char)pLine[nPos] == 0x81 && (unsigned char)pLine[nPos + 1] == 0x40 //@@@ 2001.11.17 upd MIK
// && nCOMMENTMODE != 1000 ) //@@@ 2002.01.04
&& (nCOMMENTMODE < 1000 || nCOMMENTMODE > 1099) ) //@@@ 2002.01.04
{ //@@@ 2001.11.17 add MIK //@@@ 2002.01.04
if( y/* + nLineHeight*/ >= m_nViewAlignTop ){
/* テキスト表示 */
nX += DispText( hdc, x + nX * ( nCharWidth ), y, &pLine[nBgn], nPos - nBgn );
/* 全角空白を表示する */
rcClip2.left = x + nX * ( nCharWidth );
rcClip2.right = rcClip2.left + ( nCharWidth ) * 2;
if( rcClip2.left < m_nViewAlignLeft ){
rcClip2.left = m_nViewAlignLeft;
}
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_ZENSPACE].m_bDisp ){ /* 日本語空白を表示するか */
if( bSearchStringMode ){
nColorIdx = COLORIDX_SEARCH;
}else{
nColorIdx = COLORIDX_ZENSPACE;
}
colTextColorOld = ::SetTextColor( hdc, TypeDataPtr->m_ColorInfoArr[nColorIdx].m_colTEXT ); /* 全角スペース文字の色 */
colBkColorOld = ::SetBkColor( hdc, TypeDataPtr->m_ColorInfoArr[nColorIdx].m_colBACK ); /* 全角スペース文字背景の色 */
HFONT hFontOld;
/* フォントを選ぶ */
hFontOld = (HFONT)::SelectObject( hdc,
ChooseFontHandle(
TypeDataPtr->m_ColorInfoArr[nColorIdx].m_bFatFont,
TypeDataPtr->m_ColorInfoArr[nColorIdx].m_bUnderLine
)
);
// if( TypeDataPtr->m_ColorInfoArr[nColorIdx].m_bFatFont ){ /* 太字か */
// hFontOld = (HFONT)::SelectObject( hdc, m_hFont_HAN_FAT );
// }else{
// hFontOld = (HFONT)::SelectObject( hdc, m_hFont_HAN );
// }
::ExtTextOut( hdc, x + nX * ( nCharWidth ), y, fuOptions,
&rcClip2, pszZENSPACE, lstrlen( pszZENSPACE ), m_pnDx );
::SelectObject( hdc, hFontOld );
::SetTextColor( hdc, colTextColorOld );
::SetBkColor( hdc, colBkColorOld );
}else{
if( bSearchStringMode ){
nColorIdx = COLORIDX_SEARCH;
colBkColorOld = ::SetBkColor( hdc, TypeDataPtr->m_ColorInfoArr[nColorIdx].m_colBACK ); /* 文字背景の色 */
}
::ExtTextOut( hdc, x + nX * ( nCharWidth ), y, fuOptions,
&rcClip2, pszSPACES, 2, m_pnDx );
}
if( bSearchStringMode ){
::SetBkColor( hdc, colBkColorOld );
}
}
nX += 2;
}
nBgn = nPos + 2;
nCharChars = 2;
}
//半角空白(半角スペース)を表示 2002.04.28 Add by KK
else if (pLine[nPos] == ' ' && TypeDataPtr->m_ColorInfoArr[COLORIDX_SPACE].m_bDisp
&& (nCOMMENTMODE < 1000 || nCOMMENTMODE > 1099) )
{
nX += DispText( hdc, x + nX * ( nCharWidth ), y, &pLine[nBgn], nPos - nBgn );
if( y >= m_nViewAlignTop ){
rcClip2.left = x + nX * ( nCharWidth );
rcClip2.right = rcClip2.left + ( nCharWidth );
if( rcClip2.left < m_nViewAlignLeft ){
rcClip2.left = m_nViewAlignLeft;
}
if( rcClip2.left < rcClip2.right &&
rcClip2.left < m_nViewAlignLeft + m_nViewCx && rcClip2.right > m_nViewAlignLeft ){
if( bSearchStringMode ){
nColorIdx = COLORIDX_SEARCH;
}else{
nColorIdx = COLORIDX_SPACE;
}
colTextColorOld = ::SetTextColor( hdc, TypeDataPtr->m_ColorInfoArr[nColorIdx].m_colTEXT ); /* 半角スペース文字の色 */
colBkColorOld = ::SetBkColor( hdc, TypeDataPtr->m_ColorInfoArr[nColorIdx].m_colBACK ); /* 半角スペース文字背景の色 */
HFONT hFontOld = (HFONT)::SelectObject( hdc,
ChooseFontHandle(
TypeDataPtr->m_ColorInfoArr[nColorIdx].m_bFatFont,
TypeDataPtr->m_ColorInfoArr[nColorIdx].m_bUnderLine
)
);
//小文字"o"の下半分を出力
rcClip2.top = y + (int)((nLineHeight/2) ) ;
rcClip2.bottom = y + nLineHeight;
::ExtTextOut( hdc, x + nX * ( nCharWidth ), y, fuOptions,
&rcClip2, "o", 1, m_pnDx );
//上半分は普通の空白で出力("o"の上半分を消す)
rcClip2.top = y ;
rcClip2.bottom = y + (int)((nLineHeight/2) ) ;
::ExtTextOut( hdc, x + nX * ( nCharWidth ), y, fuOptions,
&rcClip2, " ", 1, m_pnDx );
::SelectObject( hdc, hFontOld );
::SetTextColor( hdc, colTextColorOld );
::SetBkColor( hdc, colBkColorOld );
}
nX++;
}
nBgn = nPos + 1;
nCharChars = 1;
}
else{
nCharChars = CMemory::MemCharNext( pLine, nLineLen, &pLine[nPos] ) - &pLine[nPos];
if( 0 == nCharChars ){
nCharChars = 1;
}
if( !bSearchStringMode
&& 1 == nCharChars
&& COLORIDX_CTRLCODE != nCOMMENTMODE // 2002/03/13 novice
&& TypeDataPtr->m_ColorInfoArr[COLORIDX_CTRLCODE].m_bDisp /* コントロールコードを色分け */
&& (
// Jan. 23, 2002 genta 警告抑制
( (unsigned char)pLine[nPos] <= (unsigned char)0x1F ) //||
//( (unsigned char)'~' < (unsigned char)pLine[nPos] && (unsigned char)pLine[nPos] < (unsigned char)'?' ) ||
// ( (unsigned char)'?' < (unsigned char)pLine[nPos] )
)
&& pLine[nPos] != TAB && pLine[nPos] != CR && pLine[nPos] != LF
){
if( y/* + nLineHeight*/ >= m_nViewAlignTop ){
/* テキスト表示 */
nX += DispText( hdc, x + nX * ( nCharWidth ), y, &pLine[nBgn], nPos - nBgn );
}
nBgn = nPos;
nCOMMENTMODE_OLD = nCOMMENTMODE;
nCOMMENTEND_OLD = nCOMMENTEND;
nCOMMENTMODE = COLORIDX_CTRLCODE; /* コントロールコード モード */ // 2002/03/13 novice
/* コントロールコード列の終端を探す */
for( i = nPos + 1; i <= nLineLen - 1; ++i ){
nCharChars_2 = CMemory::MemCharNext( pLine, nLineLen, &pLine[i] ) - &pLine[i];
if( 0 == nCharChars_2 ){
nCharChars_2 = 1;
}
if( nCharChars_2 != 1 ){
break;
}
if( (
// Jan. 23, 2002 genta 警告抑制
( (unsigned char)pLine[i] <= (unsigned char)0x1F ) //||
//( (unsigned char)'~' < (unsigned char)pLine[i] && (unsigned char)pLine[i] < (unsigned char)'?' ) ||
// ( (unsigned char)'?' < (unsigned char)pLine[i] )
) &&
pLine[i] != TAB && pLine[i] != CR && pLine[i] != LF
){
}else{
break;
}
}
nCOMMENTEND = i;
/* 現在の色を指定 */
// if( !bSearchStringMode ){
SetCurrentColor( hdc, nCOMMENTMODE );
// }
}
}
nPos+= nCharChars;
} //end of while( nPos - nLineBgn < pcLayout2->m_nLength ){
if( nPos >= nLineLen ){
break;
}
if( y/* + nLineHeight*/ >= m_nViewAlignTop ){
/* テキスト表示 */
nX += DispText( hdc, x + nX * ( nCharWidth ), y, &pLine[nBgn], nPos - nBgn );
nBgn = nPos;
/* 行末背景描画 */
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 );
}
/* 折り返し記号 */
/* 折り返し記号を表示する */
rcClip2.left = x + nX * ( nCharWidth );
rcClip2.right = rcClip2.left + ( nCharWidth ) * 1;
if( rcClip2.left < m_nViewAlignLeft ){
rcClip2.left = m_nViewAlignLeft;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -