X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetLine.cpp;h=5c12d37e09539a23430ffc21be0020fd3d4eaf9d;hb=a3c84666b2dbfc75c9a80cf4f94612149cb2b570;hp=fc31bd1e72d085559aaf9019ee2073c1bbbce5f2;hpb=08453ceba449ca2de26a5adcf79d38af034bb076;p=lyx.git diff --git a/src/insets/InsetLine.cpp b/src/insets/InsetLine.cpp index fc31bd1e72..5c12d37e09 100644 --- a/src/insets/InsetLine.cpp +++ b/src/insets/InsetLine.cpp @@ -3,6 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * + * \author Abdelrazak Younes * \author André Pönitz * \author Uwe Stöhr * @@ -14,6 +15,7 @@ #include "InsetLine.h" #include "Buffer.h" +#include "Cursor.h" #include "Dimension.h" #include "DispatchResult.h" #include "FuncRequest.h" @@ -41,7 +43,7 @@ using frontend::Painter; InsetLine::InsetLine(Buffer * buf, InsetCommandParams const & p) - : InsetCommand(buf, p, "line") + : InsetCommand(buf, p) {} @@ -70,8 +72,7 @@ void InsetLine::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_INSET_MODIFY: { InsetCommandParams p(LINE_CODE); // FIXME UNICODE - InsetCommand::string2params("line", - to_utf8(cmd.argument()), p); + InsetCommand::string2params(to_utf8(cmd.argument()), p); if (p.getCmdName().empty()) { cur.noScreenUpdate(); break; @@ -125,8 +126,8 @@ void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const Length offset = Length(to_ascii(getParam("offset"))); offset_ = offset.inPixels(max_width, fm.width(char_type('M'))); - dim.asc = max(fm.maxAscent(), offset_ + height_/2); - dim.des = max(fm.maxDescent(), height_/2 - offset_); + dim.asc = max(fm.maxAscent(), offset_ + height_); + dim.des = max(fm.maxDescent(), - offset_); // Cache the inset dimension setDimCache(mi, dim); @@ -145,11 +146,6 @@ void InsetLine::draw(PainterInfo & pi, int x, int y) const { Dimension const dim = dimension(*pi.base.bv); - // check that it doesn't exceed the upper boundary - // FIXME: not sure this should be done... - if (y - offset_ - height_/2 < 0) - offset_ = y - height_/2 - 2; - // get the surrounding text color Color Line_color = pi.base.font.realColor();