]> git.lyx.org Git - lyx.git/blobdiff - src/MetricsInfo.cpp
Provide proper fallback if a bibliography processor is not found
[lyx.git] / src / MetricsInfo.cpp
index b2f9974504fbba14bafd4a28af83611e13f64ed7..1124ed81df516db279ae455c749e3abd49973659 100644 (file)
@@ -41,19 +41,19 @@ MetricsBase::MetricsBase(BufferView * b, FontInfo f, int w)
          textwidth(w), macro_nesting(0),
          solid_line_thickness_(1), solid_line_offset_(1), dotted_line_thickness_(1)
 {
-       if (lyxrc.zoom >= 200) {
+       if (lyxrc.currentZoom >= 200) {
                // derive the line thickness from zoom factor
                // the zoom is given in percent
                // (increase thickness at 250%, 450% etc.)
-               solid_line_thickness_ = (lyxrc.zoom + 150) / 200;
+               solid_line_thickness_ = (lyxrc.currentZoom + 150) / 200;
                // adjust line_offset_ too
                solid_line_offset_ = 1 + solid_line_thickness_ / 2;
        }
-       if (lyxrc.zoom >= 100) {
+       if (lyxrc.currentZoom >= 100) {
                // derive the line thickness from zoom factor
                // the zoom is given in percent
                // (increase thickness at 150%, 250% etc.)
-               dotted_line_thickness_ = (lyxrc.zoom + 50) / 100;
+               dotted_line_thickness_ = (lyxrc.currentZoom + 50) / 100;
        }
 }
 
@@ -73,7 +73,11 @@ Changer MetricsBase::changeFontSet(string const & name)
            && ((isTextFont(oldname) && oldcolor != Color_foreground)
                || (isMathFont(oldname) && oldcolor != Color_math)))
                font.setColor(oldcolor);
+#if __cplusplus >= 201402L
+       return rc;
+#else
        return move(rc);
+#endif
 }
 
 
@@ -134,30 +138,30 @@ void PainterInfo::draw(int x, int y, docstring const & str)
 
 ColorCode PainterInfo::backgroundColor(Inset const * inset, bool sel) const
 {
-       ColorCode const color_bg = inset->backgroundColor(*this);
-
        if (selected && sel)
                // This inset is in a selection
                return Color_selection;
-       else {
+
+       // special handling for inset background
+       if (inset != nullptr) {
+               ColorCode const color_bg = inset->backgroundColor(*this);
                if (color_bg != Color_none)
                        // This inset has its own color
                        return color_bg;
-               else {
-                       if (background_color == Color_none)
-                               // This inset has no own color and does not inherit a color
-                               return Color_background;
-                       else
-                               // This inset has no own color, but inherits a color
-                               return background_color;
-               }
        }
+
+       if (background_color == Color_none)
+               // This inset has no own color and does not inherit a color
+               return Color_background;
+
+       // This inset has no own color, but inherits a color
+       return background_color;
 }
 
 
 Color PainterInfo::textColor(Color const & color) const
 {
-       if (change_.changed()) 
+       if (change_.changed())
                return change_.color();
        if (selected)
                return Color_selectiontext;