]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetLine.cpp
InsetLine.cpp: correct coding style
[lyx.git] / src / insets / InsetLine.cpp
index ff76f28385c82f7fa3bc8fdd9ad79f83c33e83d0..991ef5a4db1e7e0525b84ab1d809d253007450f8 100644 (file)
@@ -28,7 +28,6 @@
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
-#include "support/convert.h"
 #include "support/debug.h"
 #include "support/docstream.h"
 #include "support/gettext.h"
@@ -107,11 +106,10 @@ void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
        frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
        dim.asc = fm.maxAscent();
        dim.des = fm.maxDescent();
-       
-       Length width = Length(to_ascii(getParam("width")));
-       int w = 
-               width.inPixels(mi.base.textwidth,
-               fm.width(char_type('M')));
+
+       Length const width(to_ascii(getParam("width")));
+       int w = width.inPixels(mi.base.textwidth,
+                              fm.width(char_type('M')));
 
        // assure that the line inset is not outside of the window
        // check that it doesn't exceed the outer boundary
@@ -119,8 +117,8 @@ void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
                w = mi.base.textwidth;
 
        // set a minimal width
-       int const minw = (w < 0) ? 3 * 8 : 4;
-       dim.wid = max(minw, abs(w));
+       int const minw = (w < 0) ? 24 : 4;
+       dim.wid = max(minw, max(w, -w));
 
        // Cache the inset dimension
        setDimCache(mi, dim);
@@ -129,22 +127,17 @@ void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetLine::draw(PainterInfo & pi, int x, int y) const
 {
-       Dimension const dim = dimension(*pi.base.bv);
-
        frontend::FontMetrics const & fm = theFontMetrics(pi.base.font);
 
        // get the length of the parameters in pixels
        Length offset = Length(to_ascii(getParam("offset")));
-       int o = 
-               offset.inPixels(pi.base.textwidth,
+       int o = offset.inPixels(pi.base.textwidth,
                fm.width(char_type('M')));
        Length width = Length(to_ascii(getParam("width")));
-       int w = 
-               width.inPixels(pi.base.textwidth,
+       int w = width.inPixels(pi.base.textwidth,
                fm.width(char_type('M')));
        Length height = Length(to_ascii(getParam("height")));
-       int h = 
-               height.inPixels(pi.base.textwidth,
+       int h = height.inPixels(pi.base.textwidth,
                fm.width(char_type('M')));
 
        // get the surrounding text color
@@ -165,7 +158,7 @@ void InsetLine::draw(PainterInfo & pi, int x, int y) const
 }
 
 
-int InsetLine::latex(odocstream & os, OutputParams const & runparams) const
+int InsetLine::latex(odocstream & os, OutputParams const &) const
 {
        bool have_offset = true;
        Length offset_len = Length(to_ascii(getParam("offset")));