]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetLine.cpp
* ANNOUNCE
[lyx.git] / src / insets / InsetLine.cpp
index fc31bd1e72d085559aaf9019ee2073c1bbbce5f2..5c12d37e09539a23430ffc21be0020fd3d4eaf9d 100644 (file)
@@ -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();