Index: sakura_core/view/CViewSelect.h =================================================================== --- sakura_core/view/CViewSelect.h (リビジョン 47367) +++ sakura_core/view/CViewSelect.h (リビジョン 47414) @@ -79,6 +79,7 @@ CLayoutInt nLineNum, //!< [in] 描画対象行(レイアウト行) const CLayoutRange& sRange //!< [in] 選択範囲(レイアウト単位) ) const; + void PaintRectAsSelected( HDC canvas, const RECT& selected ) const; // DrawSelectArea()の下部ツール。描画ロジックの実装のみ。 //! 選択情報データの作成 2005.07.09 genta void PrintSelectionInfoMsg() const; Index: sakura_core/view/CViewSelect.cpp =================================================================== --- sakura_core/view/CViewSelect.cpp (リビジョン 47367) +++ sakura_core/view/CViewSelect.cpp (リビジョン 47414) @@ -9,6 +9,8 @@ #include "charset/CCodeFactory.h" #include "env/CShareData.h" #include "env/DLLSHAREDATA.h" +#include "view/colors/CColorStrategy.h" // enum EColorIndexType +#include "types/CTypeSupport.h" CViewSelect::CViewSelect(CEditView* pcEditView) : m_pcEditView(pcEditView) @@ -157,209 +159,75 @@ */ void CViewSelect::DrawSelectArea() const { - const CEditView* pView=GetEditView(); - + CEditView* const pView = this->m_pcEditView; if( !pView->GetDrawSwitch() ){ return; } + const int nCharWidth = pView->GetTextMetrics().GetHankakuDx(); + const int nCharHeight = pView->GetTextMetrics().GetHankakuDy(); - CLayoutRange sRangeA; + RECT rcRedraw; - CLayoutInt nLineNum; - - m_bDrawSelectArea = true; - - // 2006.10.01 Moca 重複コード統合 - HDC hdc = pView->GetDC(); - HBRUSH hBrush = ::CreateSolidBrush( SELECTEDAREA_RGB ); - HBRUSH hBrushOld = (HBRUSH)::SelectObject( hdc, hBrush ); - int nROP_Old = ::SetROP2( hdc, SELECTEDAREA_ROP2 ); - // From Here 2007.09.09 Moca 互換BMPによる画面バッファ - HBRUSH hBrushCompatOld; - int nROPCompatOld; - if( pView->m_hbmpCompatBMP ){ - hBrushCompatOld = (HBRUSH)::SelectObject( pView->m_hdcCompatDC, hBrush ); - nROPCompatOld = ::SetROP2( pView->m_hdcCompatDC, SELECTEDAREA_ROP2 ); - } - // To Here 2007.09.09 Moca - -// MYTRACE_A( "DrawSelectArea() m_bBeginBoxSelect=%hs\n", m_bBeginBoxSelect?"TRUE":"FALSE" ); if( IsBoxSelecting() ){ // 矩形範囲選択中 - // 2001.12.21 hor 矩形エリアにEOFがある場合、RGN_XORで結合すると - // EOF以降のエリアも反転してしまうので、この場合はRedrawを使う - // 2002.02.16 hor ちらつきを抑止するためEOF以降のエリアが反転したらもう一度反転して元に戻すことにする - //if((GetTextArea().GetViewTopLine()+m_nViewRowNum+1>=m_pcEditDoc->m_cLayoutMgr.GetLineCount()) && - // (m_sSelect.GetTo().y+1 >= m_pcEditDoc->m_cLayoutMgr.GetLineCount() || - // m_sSelectOld.GetTo().y+1 >= m_pcEditDoc->m_cLayoutMgr.GetLineCount() ) ) { - // Redraw(); - // return; - //} - const int nCharWidth = pView->GetTextMetrics().GetHankakuDx(); - const int nCharHeight = pView->GetTextMetrics().GetHankakuDy(); + CLayoutRect lrcOld, lrcNew; + RECT rcOld, rcNew; + TwoPointToRect( &lrcOld, m_sSelectOld.GetFrom(), m_sSelectOld.GetTo() ); + lrcOld.left = t_max(lrcOld.left , pView->GetTextArea().GetViewLeftCol() ); + lrcOld.right = t_max(lrcOld.right , pView->GetTextArea().GetViewLeftCol() ); + lrcOld.right = t_min(lrcOld.right , pView->GetTextArea().GetRightCol() + 1 ); + lrcOld.top = t_max(lrcOld.top , pView->GetTextArea().GetViewTopLine() ); + lrcOld.bottom = t_min(lrcOld.bottom, pView->GetTextArea().GetBottomLine() ); + rcOld.left = (pView->GetTextArea().GetAreaLeft() - (Int)pView->GetTextArea().GetViewLeftCol() * nCharWidth) + (Int)lrcOld.left * nCharWidth; + rcOld.right = (pView->GetTextArea().GetAreaLeft() - (Int)pView->GetTextArea().GetViewLeftCol() * nCharWidth) + (Int)lrcOld.right * nCharWidth; + rcOld.top = (Int)( lrcOld.top - pView->GetTextArea().GetViewTopLine() ) * nCharHeight + pView->GetTextArea().GetAreaTop(); + rcOld.bottom = (Int)( lrcOld.bottom + 1 - pView->GetTextArea().GetViewTopLine() ) * nCharHeight + pView->GetTextArea().GetAreaTop(); - // 2点を対角とする矩形を求める - CLayoutRect rcOld; - TwoPointToRect( - &rcOld, - m_sSelectOld.GetFrom(), // 範囲選択開始 - m_sSelectOld.GetTo() // 範囲選択終了 - ); - rcOld.left = t_max(rcOld.left , pView->GetTextArea().GetViewLeftCol() ); - rcOld.right = t_max(rcOld.right , pView->GetTextArea().GetViewLeftCol() ); - rcOld.right = t_min(rcOld.right , pView->GetTextArea().GetRightCol() + 1 ); - rcOld.top = t_max(rcOld.top , pView->GetTextArea().GetViewTopLine() ); - rcOld.bottom = t_min(rcOld.bottom, pView->GetTextArea().GetBottomLine() ); + TwoPointToRect( &lrcNew, m_sSelect.GetFrom(), m_sSelect.GetTo() ); + lrcNew.left = t_max(lrcNew.left , pView->GetTextArea().GetViewLeftCol() ); + lrcNew.right = t_max(lrcNew.right , pView->GetTextArea().GetViewLeftCol() ); + lrcNew.right = t_min(lrcNew.right , pView->GetTextArea().GetRightCol() + 1); + lrcNew.top = t_max(lrcNew.top , pView->GetTextArea().GetViewTopLine() ); + lrcNew.bottom = t_min(lrcNew.bottom, pView->GetTextArea().GetBottomLine() ); + rcNew.left = (pView->GetTextArea().GetAreaLeft() - (Int)pView->GetTextArea().GetViewLeftCol() * nCharWidth) + (Int)lrcNew.left * nCharWidth; + rcNew.right = (pView->GetTextArea().GetAreaLeft() - (Int)pView->GetTextArea().GetViewLeftCol() * nCharWidth) + (Int)lrcNew.right * nCharWidth; + rcNew.top = (Int)(lrcNew.top - pView->GetTextArea().GetViewTopLine()) * nCharHeight + pView->GetTextArea().GetAreaTop(); + rcNew.bottom = (Int)(lrcNew.bottom + 1 - pView->GetTextArea().GetViewTopLine()) * nCharHeight + pView->GetTextArea().GetAreaTop(); - RECT rcOld2; - rcOld2.left = (pView->GetTextArea().GetAreaLeft() - (Int)pView->GetTextArea().GetViewLeftCol() * nCharWidth) + (Int)rcOld.left * nCharWidth; - rcOld2.right = (pView->GetTextArea().GetAreaLeft() - (Int)pView->GetTextArea().GetViewLeftCol() * nCharWidth) + (Int)rcOld.right * nCharWidth; - rcOld2.top = (Int)( rcOld.top - pView->GetTextArea().GetViewTopLine() ) * nCharHeight + pView->GetTextArea().GetAreaTop(); - rcOld2.bottom = (Int)( rcOld.bottom + 1 - pView->GetTextArea().GetViewTopLine() ) * nCharHeight + pView->GetTextArea().GetAreaTop(); - HRGN hrgnOld = ::CreateRectRgnIndirect( &rcOld2 ); - - // 2点を対角とする矩形を求める - CLayoutRect rcNew; - TwoPointToRect( - &rcNew, - m_sSelect.GetFrom(), // 範囲選択開始 - m_sSelect.GetTo() // 範囲選択終了 - ); - rcNew.left = t_max(rcNew.left , pView->GetTextArea().GetViewLeftCol() ); - rcNew.right = t_max(rcNew.right , pView->GetTextArea().GetViewLeftCol() ); - rcNew.right = t_min(rcNew.right , pView->GetTextArea().GetRightCol() + 1); - rcNew.top = t_max(rcNew.top , pView->GetTextArea().GetViewTopLine() ); - rcNew.bottom = t_min(rcNew.bottom, pView->GetTextArea().GetBottomLine() ); - - RECT rcNew2; - rcNew2.left = (pView->GetTextArea().GetAreaLeft() - (Int)pView->GetTextArea().GetViewLeftCol() * nCharWidth) + (Int)rcNew.left * nCharWidth; - rcNew2.right = (pView->GetTextArea().GetAreaLeft() - (Int)pView->GetTextArea().GetViewLeftCol() * nCharWidth) + (Int)rcNew.right * nCharWidth; - rcNew2.top = (Int)(rcNew.top - pView->GetTextArea().GetViewTopLine()) * nCharHeight + pView->GetTextArea().GetAreaTop(); - rcNew2.bottom = (Int)(rcNew.bottom + 1 - pView->GetTextArea().GetViewTopLine()) * nCharHeight + pView->GetTextArea().GetAreaTop(); - - HRGN hrgnNew = ::CreateRectRgnIndirect( &rcNew2 ); - - // 矩形作画。 - // ::CombineRgn()の結果を受け取るために、適当なリージョンを作る - HRGN hrgnDraw = ::CreateRectRgnIndirect( &rcNew2 ); - { - // 旧選択矩形と新選択矩形のリージョンを結合し、 重なりあう部分だけを除去します - if( NULLREGION != ::CombineRgn( hrgnDraw, hrgnOld, hrgnNew, RGN_XOR ) ){ - - // 2002.02.16 hor - // 結合後のエリアにEOFが含まれる場合はEOF以降の部分を除去します - // 2006.10.01 Moca リーソースリークを修正したら、チラつくようになったため、 - // 抑えるために EOF以降をリージョンから削除して1度の作画にする - - // 2006.10.01 Moca Start EOF位置計算をGetEndLayoutPosに書き換え。 - CLayoutPoint ptLast; - pView->m_pcEditDoc->m_cLayoutMgr.GetEndLayoutPos( &ptLast ); - // 2006.10.01 Moca End - if(m_sSelect.GetFrom().y>=ptLast.y || m_sSelect.GetTo().y>=ptLast.y || - m_sSelectOld.GetFrom().y>=ptLast.y || m_sSelectOld.GetTo().y>=ptLast.y){ - // Jan. 24, 2004 genta nLastLenは物理桁なので変換必要 - // 最終行にTABが入っていると反転範囲が不足する. - // 2006.10.01 Moca GetEndLayoutPosで処理するためColumnToIndexは不要に。 - RECT rcNew; - rcNew.left = pView->GetTextArea().GetAreaLeft() + (Int)(pView->GetTextArea().GetViewLeftCol() + ptLast.x) * nCharWidth; - rcNew.right = pView->GetTextArea().GetAreaRight(); - rcNew.top = (Int)(ptLast.y - pView->GetTextArea().GetViewTopLine()) * nCharHeight + pView->GetTextArea().GetAreaTop(); - rcNew.bottom = rcNew.top + nCharHeight; - - // 2006.10.01 Moca GDI(リージョン)リソースリーク修正 - HRGN hrgnEOFNew = ::CreateRectRgnIndirect( &rcNew ); - ::CombineRgn( hrgnDraw, hrgnDraw, hrgnEOFNew, RGN_DIFF ); - ::DeleteObject( hrgnEOFNew ); - } - ::PaintRgn( hdc, hrgnDraw ); - // From Here 2007.09.09 Moca 互換BMPによる画面バッファ - if( pView->m_hbmpCompatBMP ){ - ::PaintRgn( pView->m_hdcCompatDC, hrgnDraw ); - } - // To Here 2007.09.09 Moca - } + UnionRect( &rcRedraw, &rcOld, &rcNew ); + } else { + CLayoutRange unionRange = m_sSelectOld; // 旧選択範囲と新選択範囲の両方を含む最小の範囲。 + // m_sSelectOld ∪ m_sSelect + if (m_sSelect.GetFrom() < unionRange.GetFrom()) { + *(unionRange.GetFromPointer()) = m_sSelect.GetFrom(); } - - ////////////////////////////////////////// - // デバッグ用 リージョン矩形のダンプ -//@@ TraceRgn( hrgnDraw ); - - - if( NULL != hrgnDraw ){ - ::DeleteObject( hrgnDraw ); + if (unionRange.GetTo() < m_sSelect.GetTo()) { + *(unionRange.GetToPointer()) = m_sSelect.GetTo(); } - if( NULL != hrgnNew ){ - ::DeleteObject( hrgnNew ); + // CLayoutRange -> RECT + if (unionRange.GetFrom().y != unionRange.GetTo().y) { + rcRedraw.left = pView->GetTextArea().GetAreaLeft(); + rcRedraw.right = pView->GetTextArea().GetAreaRight(); + } else { + rcRedraw.left = pView->GetTextArea().GetAreaLeft() + std::max( 0, nCharWidth * (unionRange.GetFrom().x - pView->GetTextArea().GetViewLeftCol()) ); + rcRedraw.right = pView->GetTextArea().GetAreaLeft() + std::max( 0, nCharWidth * (unionRange.GetTo().x + 1 - pView->GetTextArea().GetViewLeftCol()) ); + rcRedraw.right = std::min( rcRedraw.right, pView->GetTextArea().GetAreaRight() ); } - if( NULL != hrgnOld ){ - ::DeleteObject( hrgnOld ); - } - }else{ - - // 現在描画されている範囲と始点が同じ - if( m_sSelect.GetFrom() == m_sSelectOld.GetFrom() ){ - // 範囲が後方に拡大された - if( PointCompare(m_sSelect.GetTo(),m_sSelectOld.GetTo()) > 0 ){ - sRangeA.SetFrom(m_sSelectOld.GetTo()); - sRangeA.SetTo (m_sSelect.GetTo()); - } - else{ - sRangeA.SetFrom(m_sSelect.GetTo()); - sRangeA.SetTo (m_sSelectOld.GetTo()); - } - for( nLineNum = sRangeA.GetFrom().GetY2(); nLineNum <= sRangeA.GetTo().GetY2(); ++nLineNum ){ - if( nLineNum >= pView->GetTextArea().GetViewTopLine() && nLineNum <= pView->GetTextArea().GetBottomLine() + 1 ){ - DrawSelectAreaLine( hdc, nLineNum, sRangeA); - } - } - } - else if( m_sSelect.GetTo() == m_sSelectOld.GetTo() ){ - // 範囲が前方に拡大された - if(PointCompare(m_sSelect.GetFrom(),m_sSelectOld.GetFrom()) < 0){ - sRangeA.SetFrom(m_sSelect.GetFrom()); - sRangeA.SetTo (m_sSelectOld.GetFrom()); - } - else{ - sRangeA.SetFrom(m_sSelectOld.GetFrom()); - sRangeA.SetTo (m_sSelect.GetFrom()); - } - for( nLineNum = sRangeA.GetFrom().GetY2(); nLineNum <= sRangeA.GetTo().GetY2(); ++nLineNum ){ - if( nLineNum >= pView->GetTextArea().GetViewTopLine() && nLineNum <= pView->GetTextArea().GetBottomLine() + 1 ){ - DrawSelectAreaLine( hdc, nLineNum, sRangeA ); - } - } - } - else{ - sRangeA = m_sSelectOld; - for( nLineNum = sRangeA.GetFrom().GetY2(); nLineNum <= sRangeA.GetTo().GetY2(); ++nLineNum ){ - if( nLineNum >= pView->GetTextArea().GetViewTopLine() && nLineNum <= pView->GetTextArea().GetBottomLine() + 1 ){ - DrawSelectAreaLine( hdc, nLineNum, sRangeA ); - } - } - sRangeA = m_sSelect; - for( nLineNum = sRangeA.GetFrom().GetY2(); nLineNum <= sRangeA.GetTo().GetY2(); ++nLineNum ){ - if( nLineNum >= pView->GetTextArea().GetViewTopLine() && nLineNum <= pView->GetTextArea().GetBottomLine() + 1 ){ - DrawSelectAreaLine( hdc, nLineNum, sRangeA ); - } - } - } + rcRedraw.top = pView->GetTextArea().GetAreaTop() + std::max( 0, nCharHeight * (unionRange.GetFrom().y - pView->GetTextArea().GetViewTopLine()) ); + rcRedraw.bottom = pView->GetTextArea().GetAreaTop() + std::max( 0, nCharHeight * (unionRange.GetTo().y + 1 - pView->GetTextArea().GetViewTopLine()) ); + rcRedraw.bottom = std::min( rcRedraw.bottom, pView->GetTextArea().GetAreaBottom() ); } - // From Here 2007.09.09 Moca 互換BMPによる画面バッファ - if( pView->m_hbmpCompatBMP ){ - ::SetROP2( pView->m_hdcCompatDC, nROPCompatOld ); - ::SelectObject( pView->m_hdcCompatDC, hBrushCompatOld ); - } - // To Here 2007.09.09 Moca - - // 2006.10.01 Moca 重複コード統合 - ::SetROP2( hdc, nROP_Old ); - ::SelectObject( hdc, hBrushOld ); - ::DeleteObject( hBrush ); - pView->ReleaseDC( hdc ); // Jul. 9, 2005 genta 選択領域の情報を表示 PrintSelectionInfoMsg(); + + HDC hdc = pView->GetDC(); + PAINTSTRUCT ps = { hdc, 0, rcRedraw }; + pView->OnPaint( hdc, &ps, FALSE ); + pView->ReleaseDC( hdc ); + + m_bDrawSelectArea = true; } @@ -442,23 +310,87 @@ // 必要なときだけ。 if ( rcClip.right != rcClip.left ){ pView->GetCaret().m_cUnderLine.CaretUnderLineOFF( TRUE ); - // 2006.03.28 Moca 表示域内のみ処理する if( nSelectFrom <=pView->GetTextArea().GetRightCol() && pView->GetTextArea().GetViewLeftCol() < nSelectTo ){ - HRGN hrgnDraw = ::CreateRectRgn( rcClip.left, rcClip.top, rcClip.right, rcClip.bottom ); - ::PaintRgn( hdc, hrgnDraw ); - // From Here 2007.09.09 Moca 互換BMPによる画面バッファ - if( pView->m_hbmpCompatBMP ){ - ::PaintRgn( pView->m_hdcCompatDC, hrgnDraw ); + PaintRectAsSelected( hdc, rcClip ); + if( pView->m_hbmpCompatBMP ) { + PaintRectAsSelected( pView->m_hdcCompatDC, rcClip ); } - // To Here 2007.09.09 Moca - ::DeleteObject( hrgnDraw ); } } } +void CViewSelect::PaintRectAsSelected( HDC canvas, const RECT& selected ) const +{ + const CTypeSupport selColorSetting( this->m_pcEditView, COLORIDX_SELECT ); + if (selColorSetting.IsDisp()) { // 半透明描画 + HDC hdcMem = CreateCompatibleDC( canvas ); + HBITMAP hBmp = CreateCompatibleBitmap( canvas, selected.right - selected.left, selected.bottom - selected.top ); + SelectObject( hdcMem, hBmp ); + BitBlt( hdcMem, 0, 0, selected.right - selected.left, selected.bottom - selected.top, + canvas, selected.left, selected.top, SRCCOPY + ); + BITMAP bmpSelected; + GetObject( hBmp, sizeof bmpSelected, &bmpSelected ); + const DWORD bmpbitsSize = ((bmpSelected.bmWidth * 32 + 31) / 32) * bmpSelected.bmHeight * 4; + std::vector bmpinfoBuffer( sizeof(BITMAPINFOHEADER) + bmpbitsSize, 0 ); + BITMAPINFO& bmpinfo = *reinterpret_cast(&bmpinfoBuffer[0]); + BITMAPINFOHEADER& bmpinfoHeader = *reinterpret_cast(&bmpinfoBuffer[0]); + RGBQUAD* const pBits = reinterpret_cast(&bmpinfoBuffer[sizeof(BITMAPINFOHEADER)]); + bmpinfoHeader.biSize = sizeof BITMAPINFOHEADER; + bmpinfoHeader.biWidth = bmpSelected.bmWidth; + bmpinfoHeader.biHeight = bmpSelected.bmHeight; + bmpinfoHeader.biPlanes = 1; + bmpinfoHeader.biBitCount = 32; + bmpinfoHeader.biCompression = BI_RGB; + bmpinfoHeader.biSizeImage = 0; + bmpinfoHeader.biXPelsPerMeter = 0; + bmpinfoHeader.biYPelsPerMeter = 0; + bmpinfoHeader.biClrUsed = 0; + bmpinfoHeader.biClrImportant = 0; + const int copiedLines = GetDIBits( hdcMem, hBmp, 0, bmpSelected.bmHeight, + pBits, &bmpinfo, DIB_RGB_COLORS + ); + const RGBTRIPLE selectedColor = { + GetBValue(selColorSetting.GetTextColor()) * GetBValue(selColorSetting.GetBackColor()) >> 8, + GetGValue(selColorSetting.GetTextColor()) * GetGValue(selColorSetting.GetBackColor()) >> 8, + GetRValue(selColorSetting.GetTextColor()) * GetRValue(selColorSetting.GetBackColor()) >> 8 + }; + const RGBTRIPLE sourceAlpha = { + 0xFF - GetBValue(selColorSetting.GetTextColor()), + 0xFF - GetGValue(selColorSetting.GetTextColor()), + 0xFF - GetRValue(selColorSetting.GetTextColor()) + }; + for (RGBQUAD* pQuad = pBits; pQuad < pBits + bmpSelected.bmWidth * copiedLines; ++pQuad) { + pQuad->rgbBlue = (pQuad->rgbBlue * sourceAlpha.rgbtBlue >> 8) + selectedColor.rgbtBlue; + pQuad->rgbGreen = (pQuad->rgbGreen * sourceAlpha.rgbtGreen >> 8) + selectedColor.rgbtGreen; + pQuad->rgbRed = (pQuad->rgbRed * sourceAlpha.rgbtRed >> 8) + selectedColor.rgbtRed; + } + SetDIBits( hdcMem, hBmp, 0, copiedLines, pBits, &bmpinfo, DIB_RGB_COLORS ); + BitBlt( canvas, selected.left, selected.top, selected.right - selected.left, selected.bottom - selected.top, + hdcMem, 0, 0, SRCCOPY + ); + DeleteDC( hdcMem ); + DeleteObject( hBmp ); + } else { // 反転描画 + HBRUSH hBrush = ::CreateSolidBrush( SELECTEDAREA_RGB ); + //HBRUSH hBrush = ::CreateSolidBrush( selColorSetting.GetBackColor() ^ CTypeSupport(this, COLORIDX_TEXT).GetBackColor() ); // assuming SELECTEDAREA_ROP2 == XOR + + int nROP_Old = ::SetROP2( canvas, SELECTEDAREA_ROP2 ); + HBRUSH hBrushOld = (HBRUSH)::SelectObject( canvas, hBrush ); + HRGN hrgnDraw = ::CreateRectRgn( selected.left, selected.top, selected.right, selected.bottom ); + ::PaintRgn( canvas, hrgnDraw ); + ::DeleteObject( hrgnDraw ); + + SetROP2( canvas, nROP_Old ); + SelectObject( canvas, hBrushOld ); + DeleteObject( hBrush ); + } +} + + /*! 選択範囲情報メッセージの表示 @author genta Index: sakura_core/view/CEditView_Paint.cpp =================================================================== --- sakura_core/view/CEditView_Paint.cpp (リビジョン 47367) +++ sakura_core/view/CEditView_Paint.cpp (リビジョン 47414) @@ -857,7 +857,6 @@ RECT rcClip; int nLineHeight = GetTextMetrics().GetHankakuDy(); int nCharWidth = GetTextMetrics().GetHankakuDx(); - HRGN hrgnDraw; const CLayout* pcLayout = m_pcEditDoc->m_cLayoutMgr.SearchLineByLayoutY( nLineNum ); /* 選択範囲内の行かな */ @@ -945,18 +944,8 @@ if( rcClip.right > GetTextArea().GetAreaRight() ){ rcClip.right = GetTextArea().GetAreaRight(); } - - HBRUSH hBrush = ::CreateSolidBrush( SELECTEDAREA_RGB ); - int nROP_Old = ::SetROP2( hdc, SELECTEDAREA_ROP2 ); - HBRUSH hBrushOld = (HBRUSH)::SelectObject( hdc, hBrush ); - hrgnDraw = ::CreateRectRgn( rcClip.left, rcClip.top, rcClip.right, rcClip.bottom ); - ::PaintRgn( hdc, hrgnDraw ); - ::DeleteObject( hrgnDraw ); - - SetROP2( hdc, nROP_Old ); - SelectObject( hdc, hBrushOld ); - DeleteObject( hBrush ); + this->m_cViewSelect.PaintRectAsSelected( hdc, rcClip ); } // } return; Index: sakura_core/view/colors/CColorStrategy.h =================================================================== --- sakura_core/view/colors/CColorStrategy.h (リビジョン 47367) +++ sakura_core/view/colors/CColorStrategy.h (リビジョン 47414) @@ -62,6 +62,7 @@ COLORIDX_DIFF_DELETE, // DIFF追加 //@@@ 2002.06.01 MIK COLORIDX_BRACKET_PAIR, // 対括弧 // 02/09/18 ai Add COLORIDX_MARK, // ブックマーク // 02/10/16 ai Add + COLORIDX_SELECT, // 選択領域 //カラーの最後 COLORIDX_LAST, Index: sakura_core/view/colors/CColorStrategy.cpp =================================================================== --- sakura_core/view/colors/CColorStrategy.cpp (リビジョン 47367) +++ sakura_core/view/colors/CColorStrategy.cpp (リビジョン 47414) @@ -227,6 +227,7 @@ {_T("DFD"), 0}, //DIFF削除 //@@@ 2002.06.01 MIK {_T("BRC"), 0}, //対括弧 // 02/09/18 ai Add {_T("MRK"), 0}, //ブックマーク // 02/10/16 ai Add + {_T("SEL"), COLOR_ATTRIB_NO_BOLD | COLOR_ATTRIB_NO_UNDERLINE}, // 選択領域。 {_T("LAST"), 0} // Not Used }; Index: sakura_core/doc/CDocTypeSetting.cpp =================================================================== --- sakura_core/doc/CDocTypeSetting.cpp (リビジョン 47367) +++ sakura_core/doc/CDocTypeSetting.cpp (リビジョン 47414) @@ -63,6 +63,7 @@ _T("DIFF差分表示(削除)"), FALSE, FALSE, FALSE, RGB( 0, 0, 0 ), RGB( 255, 251, 240 ), //@@@ 2002.06.01 MIK _T("対括弧の強調表示"), FALSE, TRUE, FALSE, RGB( 128, 0, 0 ), RGB( 255, 251, 240 ), // 02/09/18 ai _T("ブックマーク"), TRUE , FALSE, FALSE, RGB( 255, 251, 240 ), RGB( 0, 128, 192 ), // 02/10/16 ai + _T("選択領域"), TRUE, FALSE, FALSE, RGB(63, 63, 63), RGB(51, 153, 255), }; void GetDefaultColorInfo(ColorInfo* pColorInfo, int nIndex) Index: sakura_core/basis/CMyPoint.h =================================================================== --- sakura_core/basis/CMyPoint.h (リビジョン 47367) +++ sakura_core/basis/CMyPoint.h (リビジョン 47414) @@ -69,8 +69,11 @@ if(pt1.y!=pt2.y)return (Int)(pt1.y-pt2.y); return (Int)(pt1.x-pt2.x); } +template inline bool operator < (POINT_T left, POINT_T right) { return PointCompare(left, right) < 0; } +template inline bool operator > (POINT_T left, POINT_T right) { return PointCompare(left, right) > 0; } +template inline bool operator <= (POINT_T left, POINT_T right) { return PointCompare(left, right) <= 0; } +template inline bool operator >= (POINT_T left, POINT_T right) { return PointCompare(left, right) >= 0; } - //! 2点を対角とする矩形を求める template inline void TwoPointToRect(