]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetVSpace.cpp
Make logic clearer, with help from Lars.
[lyx.git] / src / insets / InsetVSpace.cpp
index a1134fcbc9bcfb3a1cb785e097fbf78b934b024b..70b9d6abb22add448066984bb6f22041f264c338 100644 (file)
@@ -18,9 +18,9 @@
 #include "DispatchResult.h"
 #include "FuncRequest.h"
 #include "gettext.h"
-#include "LColor.h"
+#include "Color.h"
 #include "Lexer.h"
-#include "LyXText.h"
+#include "Text.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 
@@ -57,9 +57,9 @@ InsetVSpace::~InsetVSpace()
 }
 
 
-std::auto_ptr<InsetBase> InsetVSpace::doClone() const
+std::auto_ptr<Inset> InsetVSpace::doClone() const
 {
-       return std::auto_ptr<InsetBase>(new InsetVSpace(*this));
+       return std::auto_ptr<Inset>(new InsetVSpace(*this));
 }
 
 
@@ -73,11 +73,12 @@ void InsetVSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_MOUSE_RELEASE:
-               InsetVSpaceMailer(*this).showDialog(&cur.bv());
+               if (!cur.selection())
+                       InsetVSpaceMailer(*this).showDialog(&cur.bv());
                break;
 
        default:
-               InsetBase::doDispatch(cur, cmd);
+               Inset::doDispatch(cur, cmd);
                break;
        }
 }
@@ -123,7 +124,7 @@ bool InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
        if (space_.length().len().value() >= 0.0)
                height = max(height, space_.inPixels(*mi.base.bv));
 
-       LyXFont font;
+       Font font;
        font.decSize();
        font.decSize();
 
@@ -178,8 +179,8 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
        int a = 0;
        int d = 0;
 
-       LyXFont font;
-       font.setColor(LColor::added_space);
+       Font font;
+       font.setColor(Color::added_space);
        font.decSize();
        font.decSize();
        docstring const lab = label();
@@ -187,18 +188,18 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
 
        pi.pain.rectText(x + 2 * arrow_size + 5,
                         start + (end - start) / 2 + (a - d) / 2,
-                        lab, font, LColor::none, LColor::none);
+                        lab, font, Color::none, Color::none);
 
        // top arrow
-       pi.pain.line(x, ty1, midx, ty2, LColor::added_space);
-       pi.pain.line(midx, ty2, rightx, ty1, LColor::added_space);
+       pi.pain.line(x, ty1, midx, ty2, Color::added_space);
+       pi.pain.line(midx, ty2, rightx, ty1, Color::added_space);
 
        // bottom arrow
-       pi.pain.line(x, by1, midx, by2, LColor::added_space);
-       pi.pain.line(midx, by2, rightx, by1, LColor::added_space);
+       pi.pain.line(x, by1, midx, by2, Color::added_space);
+       pi.pain.line(midx, by2, rightx, by1, Color::added_space);
 
        // joining line
-       pi.pain.line(midx, ty2, midx, by2, LColor::added_space);
+       pi.pain.line(midx, ty2, midx, by2, Color::added_space);
 }