Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

行毎ではなく一括で線を描く変更によって引き起こされた表示の不具合を起こさないように元に戻す #1072

Merged
merged 1 commit into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sakura_core/view/CEditView.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ class CEditView
protected:
//! ロジック行を1行描画
bool DrawLogicLine(
SColorStrategyInfo* pInfo, //!< [in,out]
HDC hdc, //!< [in] 作画対象
DispPos* pDispPos, //!< [in,out] 描画する箇所、描画元ソース
CLayoutInt nLineTo //!< [in] 作画終了するレイアウト行番号
);

Expand Down
77 changes: 38 additions & 39 deletions sakura_core/view/CEditView_Paint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,22 +779,15 @@ void CEditView::OnPaint2( HDC _hdc, PAINTSTRUCT *pPs, BOOL bDrawFromComptibleBmp
sPos.ForwardLayoutLineRef(1); //レイアウト行++
}
}else{

SColorStrategyInfo _sInfo;
SColorStrategyInfo* pInfo = &_sInfo;
pInfo->m_gr = gr;
pInfo->m_pDispPos = &sPos;
pInfo->m_pcView = this;

auto y0 = pInfo->m_pDispPos->GetDrawPos().y;
while(sPos.GetLayoutLineRef() <= nLayoutLineTo)
{
//描画X位置リセット
sPos.ResetDrawCol();

//1行描画
bool bDispResult = DrawLogicLine(
pInfo,
gr,
&sPos,
nLayoutLineTo
);

Expand All @@ -817,35 +810,6 @@ void CEditView::OnPaint2( HDC _hdc, PAINTSTRUCT *pPs, BOOL bDrawFromComptibleBmp
}
}
}
auto y1 = pInfo->m_pDispPos->GetDrawPos().y;

// ノート線描画
if( !m_bMiniMap ){
LONG left = GetTextArea().GetAreaLeft();
LONG top = y0;
LONG right = GetTextArea().GetAreaRight();
LONG bottom = y1;
GetTextDrawer().DispNoteLines( pInfo->m_gr, left, top, right, bottom );
}

// 指定桁縦線描画
GetTextDrawer().DispVerticalLines(
pInfo->m_gr,
y0,
y1,
CLayoutInt(0),
CLayoutInt(-1)
);

// 折り返し桁縦線描画
if( !m_bMiniMap ){
GetTextDrawer().DispWrapLine(
pInfo->m_gr,
y0,
y1
);
}

}

cTextType.RewindGraphicsState(gr);
Expand Down Expand Up @@ -907,12 +871,18 @@ void CEditView::OnPaint2( HDC _hdc, PAINTSTRUCT *pPs, BOOL bDrawFromComptibleBmp
@date 2007.08.31 kobake 引数 bDispBkBitmap を削除
*/
bool CEditView::DrawLogicLine(
SColorStrategyInfo* pInfo, //!< [in,out]
HDC _hdc, //!< [in] 作画対象
DispPos* _pDispPos, //!< [in,out] 描画する箇所、描画元ソース
CLayoutInt nLineTo //!< [in] 作画終了するレイアウト行番号
)
{
// MY_RUNNINGTIMER( cRunningTimer, "CEditView::DrawLogicLine" );
bool bDispEOF = false;
SColorStrategyInfo _sInfo;
SColorStrategyInfo* pInfo = &_sInfo;
pInfo->m_gr.Init(_hdc);
pInfo->m_pDispPos = _pDispPos;
pInfo->m_pcView = this;

//CColorStrategyPool初期化
CColorStrategyPool* pool = CColorStrategyPool::getInstance();
Expand Down Expand Up @@ -1176,6 +1146,35 @@ bool CEditView::DrawLayoutLine(SColorStrategyInfo* pInfo)
}
}

// ノート線描画
if( !m_bMiniMap ){
GetTextDrawer().DispNoteLine(
pInfo->m_gr,
pInfo->m_pDispPos->GetDrawPos().y,
pInfo->m_pDispPos->GetDrawPos().y + nLineHeight,
GetTextArea().GetAreaLeft(),
GetTextArea().GetAreaRight()
);
}

// 指定桁縦線描画
GetTextDrawer().DispVerticalLines(
pInfo->m_gr,
pInfo->m_pDispPos->GetDrawPos().y,
pInfo->m_pDispPos->GetDrawPos().y + nLineHeight,
CLayoutInt(0),
CLayoutInt(-1)
);

// 折り返し桁縦線描画
if( !m_bMiniMap ){
GetTextDrawer().DispWrapLine(
pInfo->m_gr,
pInfo->m_pDispPos->GetDrawPos().y,
pInfo->m_pDispPos->GetDrawPos().y + nLineHeight
);
}

// 反転描画
if( pcLayout && GetSelectionInfo().IsTextSelected() ){
DispTextSelected(
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/view/CEditView_Paint_Bracket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void CEditView::DrawBracketPair( bool bDraw )
DispPos sPos(nWidth, nHeight);
sPos.InitDrawPos(CMyPoint(nLeft, nTop));
GetTextDrawer().DispText(gr, &sPos, 0, &pLine[OutputX], 1, bTrans);
GetTextDrawer().DispNoteLines(gr, nLeft, nTop, nLeft + (Int)charsWidth * nWidth, nTop + nHeight);
GetTextDrawer().DispNoteLine(gr, nTop, nTop + nHeight, nLeft, nLeft + (Int)charsWidth * nWidth);
// 2006.04.30 Moca 対括弧の縦線対応
GetTextDrawer().DispVerticalLines(gr, nTop, nTop + nHeight, ptColLine.x, ptColLine.x + charsWidth); //※括弧が全角幅である場合を考慮
cTextType.RewindGraphicsState(gr);
Expand Down
45 changes: 21 additions & 24 deletions sakura_core/view/CTextDrawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,38 +281,35 @@ void CTextDrawer::DispVerticalLines(
}
}

void CTextDrawer::DispNoteLines(
void CTextDrawer::DispNoteLine(
CGraphics& gr, //!< 作画するウィンドウのDC
LONG left, //!< ノート線を引く領域の左端のクライアント座標x
LONG top, //!< ノート線を引く領域の上端のクライアント座標y
LONG right, //!< ノート線を引く領域の右端のクライアント座標x
LONG bottom //!< ノート線を引く領域の下端のクライアント座標y
int nTop, //!< 線を引く上端のクライアント座標y
int nBottom, //!< 線を引く下端のクライアント座標y
int nLeft, //!< 線を引く左端
int nRight //!< 線を引く右端
) const
{
const CEditView* pView=m_pEditView;

CTypeSupport cNoteLine(pView, COLORIDX_NOTELINE);
if( cNoteLine.IsDisp() ){
gr.SetPen( cNoteLine.GetTextColor() );
const LONG nLineHeight = pView->GetTextMetrics().GetHankakuDy();
const LONG userOffset = pView->m_pTypeData->m_nNoteLineOffset;
LONG offset = pView->GetTextArea().GetAreaTop() + userOffset - 1;
const int nLineHeight = pView->GetTextMetrics().GetHankakuDy();
const int left = nLeft;
const int right = nRight;
int userOffset = pView->m_pTypeData->m_nNoteLineOffset;
int offset = pView->GetTextArea().GetAreaTop() + userOffset - 1;
while( offset < 0 ){
offset += nLineHeight;
}

std::vector<CMyPoint> vLineEnds;
LONG offsetMod = offset % nLineHeight;
LONG y = ((top - offset) / nLineHeight * nLineHeight) + offsetMod;
for( ; y < bottom; y += nLineHeight ){
if( top <= y ){
vLineEnds.push_back(CMyPoint(left, y));
vLineEnds.push_back(CMyPoint(right, y));
int offsetMod = offset % nLineHeight;
int y = ((nTop - offset) / nLineHeight * nLineHeight) + offsetMod;
for( ; y < nBottom; y += nLineHeight ){
if( nTop <= y ){
::MoveToEx( gr, left, y, NULL );
::LineTo( gr, right, y );
}
}

std::vector<DWORD> vNumPts(vLineEnds.size() / 2, 2);
::PolyPolyline(gr, vLineEnds.data(), vNumPts.data(), static_cast<DWORD>(vNumPts.size()));
}
}

Expand Down Expand Up @@ -572,11 +569,11 @@ void CTextDrawer::DispLineNumber(

// 行番号部分のノート線描画
if( !pView->m_bMiniMap ){
LONG left = bDispLineNumTrans ? 0 : rcLineNum.right;
LONG top = y;
LONG right = pView->GetTextArea().GetAreaLeft();
LONG bottom = y + nLineHeight;
DispNoteLines( gr, left, top, right, bottom );
int left = bDispLineNumTrans ? 0 : rcLineNum.right;
int right = pView->GetTextArea().GetAreaLeft();
int top = y;
int bottom = y + nLineHeight;
DispNoteLine( gr, top, bottom, left, right );
}
}

2 changes: 1 addition & 1 deletion sakura_core/view/CTextDrawer.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CTextDrawer{
void DispText( HDC hdc, DispPos* pDispPos, int marginy, const wchar_t* pData, int nLength, bool bTransparent = false ) const; // テキスト表示

//! ノート線描画
void DispNoteLines( CGraphics& gr, LONG left, LONG top, LONG right, LONG bottom ) const;
void DispNoteLine( CGraphics& gr, int nTop, int nBottom, int nLeft, int nRight ) const;

// -- -- 指定桁縦線描画 -- -- //
//! 指定桁縦線描画関数 // 2005.11.08 Moca
Expand Down