Skip to content

Commit

Permalink
Merge 445a9cc into 0843eb9
Browse files Browse the repository at this point in the history
  • Loading branch information
Kohki Akikaze authored May 21, 2021
2 parents 0843eb9 + 445a9cc commit 6a7a98b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 41 deletions.
34 changes: 16 additions & 18 deletions sakura_core/view/figures/CFigure_Comma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@
#include "types/CTypeSupport.h"
#include "apiwrap/StdApi.h"

void _DispTab( CGraphics& gr, DispPos* pDispPos, const CEditView* pcView );

// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
// CFigure_Comma //
// CFigure_Comma //
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //

bool CFigure_Comma::Match(const wchar_t* pText, int nTextLen) const
Expand All @@ -58,51 +56,51 @@ void CFigure_Comma::DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcVie
DispPos& sPos=*pDispPos;

//必要なインターフェース
const CLayoutMgr& pcLayoutMgr = pcView->GetDocument()->m_cLayoutMgr;
const CTextMetrics* pMetrics=&pcView->GetTextMetrics();
const CTextArea* pArea=&pcView->GetTextArea();

int nLineHeight = pMetrics->GetHankakuDy();
int nCharWidth = pMetrics->GetCharPxWidth(); // Layout→Px

CTypeSupport cTabType(pcView,COLORIDX_TAB);

// これから描画するタブ幅
CLayoutXInt tabDispWidthLayout = pcView->m_pcEditDoc->m_cLayoutMgr.GetActualTsvSpace( sPos.GetDrawCol(), L',' );
int tabDispWidth = (Int)tabDispWidthLayout;
CLayoutXInt nTabLayoutWidth = pcLayoutMgr.GetActualTsvSpace(sPos.GetDrawCol(), L',');
size_t nTabDispWidth = static_cast<Int>(nTabLayoutWidth) / pcLayoutMgr.GetWidthPerKeta();
if( pcView->m_bMiniMap ){
CLayoutMgr mgrTemp;
mgrTemp.SetTabSpaceInfo(pcView->m_pcEditDoc->m_cLayoutMgr.GetTabSpaceKetas(),
CLayoutXInt(pcView->GetTextMetrics().GetHankakuWidth()) );
tabDispWidthLayout = mgrTemp.GetActualTabSpace(sPos.GetDrawCol());
tabDispWidth = (Int)tabDispWidthLayout;
mgrTemp.SetTabSpaceInfo(pcLayoutMgr.GetTabSpaceKetas(), static_cast<CLayoutXInt>(pMetrics->GetHankakuWidth()));
nTabLayoutWidth = mgrTemp.GetActualTabSpace(sPos.GetDrawCol());
nTabDispWidth = static_cast<Int>(nTabLayoutWidth) / mgrTemp.GetWidthPerKeta();
}

// タブ記号領域
RECT rcClip2;
rcClip2.left = sPos.GetDrawPos().x;
rcClip2.right = rcClip2.left + nCharWidth * tabDispWidth;
rcClip2.right = rcClip2.left + static_cast<Int>(nTabLayoutWidth);
if( rcClip2.left < pArea->GetAreaLeft() ){
rcClip2.left = pArea->GetAreaLeft();
}
rcClip2.top = sPos.GetDrawPos().y;
rcClip2.bottom = sPos.GetDrawPos().y + nLineHeight;
int nLen = wcslen( m_pTypeData->m_szTabViewString );
rcClip2.bottom = sPos.GetDrawPos().y + pMetrics->GetHankakuDy();

if( pArea->IsRectIntersected(rcClip2) ){
if( cTabType.IsDisp() ){ //CSVモード
std::wstring szViewString = L",";
if (szViewString.length() < nTabDispWidth) {
szViewString.append(nTabDispWidth - szViewString.length(), L' ');
}
::ExtTextOut(
gr,
sPos.GetDrawPos().x,
sPos.GetDrawPos().y,
ExtTextOutOption() & ~(bTrans? ETO_OPAQUE: 0),
&rcClip2,
L", ",
tabDispWidth <= 8 ? tabDispWidth : 8, // Sep. 22, 2002 genta
szViewString.c_str(),
static_cast<UINT>(szViewString.length()),
pMetrics->GetDxArray_AllHankaku()
);
}
}

//Xを進める
sPos.ForwardDrawCol(tabDispWidthLayout);
sPos.ForwardDrawCol(nTabLayoutWidth);
}
44 changes: 21 additions & 23 deletions sakura_core/view/figures/CFigure_Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,71 +61,69 @@ void CFigure_Tab::DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView,
DispPos& sPos=*pDispPos;

//必要なインターフェース
const CLayoutMgr& pcLayoutMgr = pcView->GetDocument()->m_cLayoutMgr;
const CTextMetrics* pMetrics=&pcView->GetTextMetrics();
const CTextArea* pArea=&pcView->GetTextArea();

int nLineHeight = pMetrics->GetHankakuDy();
int nCharWidth = pMetrics->GetCharPxWidth(); // Layout→Px

CTypeSupport cTabType(pcView,COLORIDX_TAB);

// これから描画するタブ幅
CLayoutXInt tabDispWidthLayout = pcView->m_pcEditDoc->m_cLayoutMgr.GetActualTsvSpace( sPos.GetDrawCol(), WCODE::TAB );
int tabDispWidth = (Int)tabDispWidthLayout;
CLayoutXInt nTabLayoutWidth = pcLayoutMgr.GetActualTsvSpace(sPos.GetDrawCol(), WCODE::TAB);
size_t nTabDispWidth = static_cast<Int>(nTabLayoutWidth) / pcLayoutMgr.GetWidthPerKeta();
if( pcView->m_bMiniMap ){
CLayoutMgr mgrTemp;
mgrTemp.SetTabSpaceInfo(pcView->m_pcEditDoc->m_cLayoutMgr.GetTabSpaceKetas(),
CLayoutXInt(pcView->GetTextMetrics().GetHankakuWidth()) );
tabDispWidthLayout = mgrTemp.GetActualTabSpace(sPos.GetDrawCol());
tabDispWidth = (Int)tabDispWidthLayout;
mgrTemp.SetTabSpaceInfo(pcLayoutMgr.GetTabSpaceKetas(), static_cast<CLayoutXInt>(pMetrics->GetHankakuWidth()));
nTabLayoutWidth = mgrTemp.GetActualTabSpace(sPos.GetDrawCol());
nTabDispWidth = static_cast<Int>(nTabLayoutWidth) / mgrTemp.GetWidthPerKeta();
}

// タブ記号領域
RECT rcClip2;
rcClip2.left = sPos.GetDrawPos().x;
rcClip2.right = rcClip2.left + nCharWidth * tabDispWidth;
rcClip2.right = rcClip2.left + static_cast<Int>(nTabLayoutWidth);
if( rcClip2.left < pArea->GetAreaLeft() ){
rcClip2.left = pArea->GetAreaLeft();
}
rcClip2.top = sPos.GetDrawPos().y;
rcClip2.bottom = sPos.GetDrawPos().y + nLineHeight;
int nLen = wcslen( m_pTypeData->m_szTabViewString );
rcClip2.bottom = sPos.GetDrawPos().y + pMetrics->GetHankakuDy();

if( pArea->IsRectIntersected(rcClip2) ){
if( cTabType.IsDisp() && TABARROW_STRING == m_pTypeData->m_bTabArrow ){ //タブ通常表示 //@@@ 2003.03.26 MIK
int fontNo = WCODE::GetFontNo(m_pTypeData->m_szTabViewString[0]);
std::wstring szForeViewString = m_pTypeData->m_szTabViewString;
if (szForeViewString.length() < nTabDispWidth) {
szForeViewString.append(nTabDispWidth - szForeViewString.length(), L' ');
}
int fontNo = WCODE::GetFontNo(szForeViewString[0]);
if( fontNo ){
SFONT sFont;
sFont.m_sFontAttr = gr.GetCurrentMyFontAttr();
sFont.m_hFont = pcView->GetFontset().ChooseFontHandle(fontNo, sFont.m_sFontAttr);
gr.PushMyFont(sFont);
}
int nHeightMargin = pcView->GetTextMetrics().GetCharHeightMarginByFontNo(fontNo);
//@@@ 2001.03.16 by MIK
::ExtTextOut(
gr,
sPos.GetDrawPos().x,
sPos.GetDrawPos().y + nHeightMargin,
sPos.GetDrawPos().y + pMetrics->GetCharHeightMarginByFontNo(fontNo),
ExtTextOutOption() & ~(bTrans? ETO_OPAQUE: 0),
&rcClip2,
m_pTypeData->m_szTabViewString,
// tabDispWidth <= 8 ? tabDispWidth : 8, // Sep. 22, 2002 genta
nLen,
szForeViewString.c_str(),
static_cast<UINT>(szForeViewString.length()),
pMetrics->GetDxArray_AllHankaku() // FIXME:半角固定?
);
if( fontNo ){
gr.PopMyFont();
}
}else{
//背景
std::wstring szBackViewString(nTabDispWidth, L' ');
::ExtTextOut(
gr,
sPos.GetDrawPos().x,
sPos.GetDrawPos().y,
ExtTextOutOption() & ~(bTrans? ETO_OPAQUE: 0),
&rcClip2,
L" ",
8,
szBackViewString.c_str(),
static_cast<UINT>(szBackViewString.length()),
pMetrics->GetDxArray_AllHankaku()
);

Expand Down Expand Up @@ -154,7 +152,7 @@ void CFigure_Tab::DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView,
gr,
nPosLeft,
sPos.GetDrawPos().y,
nCharWidth * tabDispWidth - (nPosLeft - sPos.GetDrawPos().x), // Tab Area一杯に 2013/4/11 Uchi
static_cast<Int>(nTabLayoutWidth) - (nPosLeft - sPos.GetDrawPos().x), // Tab Area一杯に
pMetrics->GetHankakuHeight(),
gr.GetCurrentMyFontBold() || m_pTypeData->m_ColorInfoArr[COLORIDX_TAB].m_sFontAttr.m_bBoldFont,
gr.GetCurrentTextForeColor()
Expand All @@ -165,7 +163,7 @@ void CFigure_Tab::DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView,
}

//Xを進める
sPos.ForwardDrawCol(tabDispWidthLayout);
sPos.ForwardDrawCol(nTabLayoutWidth);
}

/*
Expand Down

0 comments on commit 6a7a98b

Please sign in to comment.