From: Abdelrazak Younes Date: Thu, 30 Aug 2007 22:46:22 +0000 (+0000) Subject: Transfer Text::drawSelection() from InsetText::drawSelection() to InsetText::draw... X-Git-Tag: 1.6.10~8608 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=44812bdec281ebe22136f0a9f4a5987299959d3e;p=lyx.git Transfer Text::drawSelection() from InsetText::drawSelection() to InsetText::draw(). This enables to take care of the background at one place. This will also enable to draw only the selection in the future (and not the full inset). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19934 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index e497d328cb..1ced570aab 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -202,23 +202,13 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const if (drawFrame_) pi.pain.rectangle(x, y - a, w, h, frameColor()); } + text_.drawSelection(pi, x + border_, y); tm.draw(pi, x + border_, y); } void InsetText::drawSelection(PainterInfo & pi, int x, int y) const { - if (!pi.base.bv->cursor().selection()) - return; - - TextMetrics & tm = pi.base.bv->textMetrics(&text_); - int const w = tm.width() + 2 * border_; - int const a = tm.ascent() + border_; - int const h = a + tm.descent() + border_; - pi.pain.fillRectangle(x, y - a, - (hasFixedWidth() ? tm.maxWidth() : w), - h, backgroundColor()); - text_.drawSelection(pi, x + border_, y); }