* rowpainter.C (paintText): Ensure that "paragraphs().size() - 1"
can be used meaningfully in a comparison.
+2005-02-13 André Pönitz <poenitz@gmx.net>
+
+ * bufferview_funcs.C (coordOffset): improve cursor drawing
+
2005-02-13 André Pönitz <poenitz@gmx.net>
* Cursor.[Ch] (fixIfBroken): new method, try to fix a broken cursor
using std::vector;
+int InsetText::border_ = 2;
+
+
InsetText::InsetText(BufferParams const & bp)
: drawFrame_(false), frame_color_(LColor::insetframe), text_(0)
{
}
-InsetText::InsetText() : text_(0)
+InsetText::InsetText()
+ : text_(0)
{}
{
//lyxerr << "InsetText::metrics: width: " << mi.base.textwidth << endl;
setViewCache(mi.base.bv);
+ mi.base.textwidth -= 2 * border_;
font_ = mi.base.font;
text_.font_ = mi.base.font;
text_.metrics(mi, dim);
+ dim.asc += border_;
+ dim.des += border_;
+ dim.wid += 2 * border_;
+ mi.base.textwidth += 2 * border_;
dim_ = dim;
}
bv->hideCursor();
x += scroll();
- //y -= text_.ascent();
-
-
- text_.draw(pi, x, y);
+ text_.draw(pi, x + border_, y);
if (drawFrame_)
drawFrame(pi.pain, x, y);
void InsetText::drawFrame(Painter & pain, int x, int y) const
{
- int const w = max(1, text_.width());
- int const h = text_.height();
- int const a = text_.ascent();
+ int const w = text_.width() + border_;
+ int const a = text_.ascent() + border_;
+ int const h = a + text_.descent() + border_;
pain.rectangle(x, y - a, w, h, frameColor());
}
void InsetText::clearInset(Painter & pain, int x, int y) const
{
- int const w = text_.width();
- int const h = text_.height();
- int const a = text_.ascent();
+ int const w = text_.width() + border_;
+ int const a = text_.ascent() + border_;
+ int const h = a + text_.descent() + border_;
pain.fillRectangle(x, y - a, w, h, backgroundColor());
}
void InsetText::getCursorPos(CursorSlice const & sl, int & x, int & y) const
{
- x = text_.cursorX(sl);
+ x = text_.cursorX(sl) + border_;
y = text_.cursorY(sl);
}