From: Karsten Ballüder Date: Tue, 18 May 1999 16:28:37 +0000 (+0000) Subject: highlighting fixes X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/57bff99cf406cace309b47d406b7307bc7ef1f3a highlighting fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/user/wxLayout/wxllist.cpp b/user/wxLayout/wxllist.cpp index 2f82b52e9d..a0248d4ce1 100644 --- a/user/wxLayout/wxllist.cpp +++ b/user/wxLayout/wxllist.cpp @@ -935,24 +935,7 @@ wxLayoutLine::Draw(wxDC &dc, { // parts of the line need highlighting tempto = xpos+(**i).GetLength(); -#if 0 - if(tempto >= from && xpos <= to) - { - tempto = to-xpos; - if(tempto > (**i).GetLength()) - tempto = (**i).GetLength(); - CoordType tmp = from-xpos; - if(tmp < 0) tmp = 0; -#endif - (**i).Draw(dc, pos, llist, from-xpos, to-xpos); -#if 0 - } - else - { - llist->EndHighlighting(dc); // FIXME! inefficient - (**i).Draw(dc, pos, llist); - } -#endif + (**i).Draw(dc, pos, llist, from-xpos, to-xpos); } else (**i).Draw(dc, pos, llist); @@ -1149,7 +1132,7 @@ wxLayoutLine::Break(CoordType xpos, wxLayoutList *llist) void wxLayoutLine::MergeNextLine(wxLayoutList *llist) { - wxASSERT(GetNextLine()); + wxCHECK_RET(GetNextLine(),"wxLayout internal error: no next line to merge"); wxLayoutObjectList &list = GetNextLine()->m_ObjectList; wxLOiterator i; //FIXME: this could be optimised, for now be prudent: @@ -1164,6 +1147,7 @@ wxLayoutLine::MergeNextLine(wxLayoutList *llist) wxLayoutLine *oldnext = GetNextLine(); SetNext(GetNextLine()->GetNextLine()); delete oldnext; + GetNextLine()->MoveLines(-1); RecalculatePositions(1, llist); } @@ -1766,7 +1750,7 @@ wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll) // little condition to speed up redrawing: if(bottom != -1 && line->GetPosition().y > bottom) break; } - line->RecalculatePosition(this); + line->RecalculatePositions(1,this); line = line->GetNextLine(); } @@ -1793,6 +1777,7 @@ wxLayoutList::Draw(wxDC &dc, ApplyStyle(&m_DefaultSetting, dc); wxBrush brush(m_CurrentSetting.m_bg, wxSOLID); dc.SetBrush(brush); + dc.SetBackgroundMode(wxTRANSPARENT); while(line) { @@ -2088,6 +2073,7 @@ wxLayoutList::StartHighlighting(wxDC &dc) #if SHOW_SELECTIONS dc.SetTextForeground(m_CurrentSetting.m_bg); dc.SetTextBackground(m_CurrentSetting.m_fg); + dc.SetBackgroundMode(wxSOLID); #endif } @@ -2098,6 +2084,7 @@ wxLayoutList::EndHighlighting(wxDC &dc) #if SHOW_SELECTIONS dc.SetTextForeground(m_CurrentSetting.m_fg); dc.SetTextBackground(m_CurrentSetting.m_bg); + dc.SetBackgroundMode(wxTRANSPARENT); #endif } @@ -2171,8 +2158,8 @@ wxLayoutList::GetSelection(wxLayoutDataObject *wxlo, bool invalidate) wxLayoutList *llist = Copy( m_Selection.m_CursorA, m_Selection.m_CursorB ); - - if(wxlo) // export as data object, too + + if(llist && wxlo) // export as data object, too { wxString string; @@ -2249,6 +2236,9 @@ wxLayoutPrintout::wxLayoutPrintout(wxLayoutList *llist, { m_llist = llist; m_title = title; + // remove any highlighting which could interfere with printing: + m_llist->StartSelection(); + m_llist->EndSelection(); } wxLayoutPrintout::~wxLayoutPrintout()