diff --git a/sakura_core/view/figures/CFigure_Comma.cpp b/sakura_core/view/figures/CFigure_Comma.cpp index 4af965b1c7..e21e2ba16c 100644 --- a/sakura_core/view/figures/CFigure_Comma.cpp +++ b/sakura_core/view/figures/CFigure_Comma.cpp @@ -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 @@ -58,51 +56,53 @@ 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(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(pMetrics->GetHankakuWidth())); + nTabLayoutWidth = mgrTemp.GetActualTabSpace(sPos.GetDrawCol()); + nTabDispWidth = static_cast(nTabLayoutWidth) / mgrTemp.GetWidthPerKeta(); } // タブ記号領域 RECT rcClip2; rcClip2.left = sPos.GetDrawPos().x; - rcClip2.right = rcClip2.left + nCharWidth * tabDispWidth; + rcClip2.right = rcClip2.left + static_cast(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 ); 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(szViewString.length()), pMetrics->GetDxArray_AllHankaku() ); } } //Xを進める - sPos.ForwardDrawCol(tabDispWidthLayout); + sPos.ForwardDrawCol(nTabLayoutWidth); } diff --git a/sakura_core/view/figures/CFigure_Tab.cpp b/sakura_core/view/figures/CFigure_Tab.cpp index ee33303985..3eb3584d73 100644 --- a/sakura_core/view/figures/CFigure_Tab.cpp +++ b/sakura_core/view/figures/CFigure_Tab.cpp @@ -61,39 +61,41 @@ 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(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(pMetrics->GetHankakuWidth())); + nTabLayoutWidth = mgrTemp.GetActualTabSpace(sPos.GetDrawCol()); + nTabDispWidth = static_cast(nTabLayoutWidth) / mgrTemp.GetWidthPerKeta(); } // タブ記号領域 RECT rcClip2; rcClip2.left = sPos.GetDrawPos().x; - rcClip2.right = rcClip2.left + nCharWidth * tabDispWidth; + rcClip2.right = rcClip2.left + static_cast(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 ); 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(); @@ -108,9 +110,8 @@ void CFigure_Tab::DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, sPos.GetDrawPos().y + nHeightMargin, ExtTextOutOption() & ~(bTrans? ETO_OPAQUE: 0), &rcClip2, - m_pTypeData->m_szTabViewString, - // tabDispWidth <= 8 ? tabDispWidth : 8, // Sep. 22, 2002 genta - nLen, + szForeViewString.c_str(), + static_cast(szForeViewString.length()), pMetrics->GetDxArray_AllHankaku() // FIXME:半角固定? ); if( fontNo ){ @@ -118,14 +119,15 @@ void CFigure_Tab::DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, } }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(szBackViewString.length()), pMetrics->GetDxArray_AllHankaku() ); @@ -154,7 +156,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(nTabLayoutWidth) - (nPosLeft - sPos.GetDrawPos().x), // Tab Area一杯に 2013/4/11 Uchi pMetrics->GetHankakuHeight(), gr.GetCurrentMyFontBold() || m_pTypeData->m_ColorInfoArr[COLORIDX_TAB].m_sFontAttr.m_bBoldFont, gr.GetCurrentTextForeColor() @@ -165,7 +167,7 @@ void CFigure_Tab::DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, } //Xを進める - sPos.ForwardDrawCol(tabDispWidthLayout); + sPos.ForwardDrawCol(nTabLayoutWidth); } /*