]> git.lyx.org Git - lyx.git/blobdiff - src/insets/Inset.cpp
Braces need to be escaped as well on LATEXIFY
[lyx.git] / src / insets / Inset.cpp
index 6e2e4a0ae23558b8ab9ca21b4dad0a5ec014cfbe..0257ed0c45f1c56dad489b94ccbda9811dc89e2d 100644 (file)
@@ -31,6 +31,7 @@
 #include "output_xhtml.h"
 #include "Text.h"
 #include "TextClass.h"
+#include "TocBackend.h"
 
 #include "frontends/Application.h"
 #include "frontends/Painter.h"
@@ -116,7 +117,7 @@ static void build_translator()
        insetnames[MATH_MACROARG_CODE] = InsetName("mathmacroarg");
        insetnames[LISTINGS_CODE] = InsetName("listings");
        insetnames[INFO_CODE] = InsetName("info", _("Info"));
-       insetnames[COLLAPSABLE_CODE] = InsetName("collapsable");
+       insetnames[COLLAPSIBLE_CODE] = InsetName("collapsible");
        insetnames[NEWPAGE_CODE] = InsetName("newpage");
        insetnames[SCRIPT_CODE] = InsetName("script");
        insetnames[CELL_CODE] = InsetName("tablecell");
@@ -186,6 +187,12 @@ void Inset::setBuffer(Buffer & buffer)
 }
 
 
+void Inset::resetBuffer()
+{
+       buffer_ = nullptr;
+}
+
+
 Buffer & Inset::buffer()
 {
        if (!buffer_) {
@@ -195,7 +202,7 @@ Buffer & Inset::buffer()
                                        << " name: " << iname);
                s << "LyX Code: " << lyxCode() << " name: " << from_ascii(iname);
                LATTEST(false);
-               throw ExceptionMessage(BufferException, 
+               throw ExceptionMessage(BufferException,
                        from_ascii("Inset::buffer_ member not initialized!"), s.str());
        }
        return *buffer_;
@@ -216,7 +223,7 @@ bool Inset::isBufferLoaded() const
 
 bool Inset::isBufferValid() const
 {
-       return buffer_ 
+       return buffer_
                && (isBufferLoaded() || buffer_->isClone());
 }
 
@@ -227,7 +234,7 @@ docstring Inset::layoutName() const
 }
 
 
-bool Inset::isFreeSpacing() const 
+bool Inset::isFreeSpacing() const
 {
        return getLayout().isFreeSpacing();
 }
@@ -291,14 +298,14 @@ InsetCode insetCode(string const & name)
 }
 
 
-string insetName(InsetCode c) 
+string insetName(InsetCode c)
 {
        build_translator();
        return insetnames[c].name;
 }
 
 
-docstring insetDisplayName(InsetCode c) 
+docstring insetDisplayName(InsetCode c)
 {
        build_translator();
        return insetnames[c].display_name;
@@ -309,7 +316,7 @@ void Inset::dispatch(Cursor & cur, FuncRequest & cmd)
 {
        if (buffer_ == 0) {
                lyxerr << "Unassigned buffer_ member in Inset::dispatch()" << std::endl;
-               lyxerr << "LyX Code: " << lyxCode() << " name: " 
+               lyxerr << "LyX Code: " << lyxCode() << " name: "
                       << insetName(lyxCode()) << std::endl;
        } else if (cur.buffer() != buffer_)
                lyxerr << "cur.buffer() != buffer_ in Inset::dispatch()" << std::endl;
@@ -407,7 +414,7 @@ bool Inset::getStatus(Cursor &, FuncRequest const & cmd,
                }
 
        case LFUN_IN_MATHMACROTEMPLATE:
-               // By default we're not in a MathMacroTemplate inset
+               // By default we're not in a InsetMathMacroTemplate inset
                flag.setEnabled(false);
                return true;
 
@@ -543,24 +550,6 @@ void Inset::drawMarkers(PainterInfo & pi, int x, int y) const
        pi.pain.line(t, d - 3, t, d, pen_color);
        pi.pain.line(x, d, x + 3, d, pen_color);
        pi.pain.line(t - 3, d, t, d, pen_color);
-       setPosCache(pi, x, y);
-}
-
-
-void Inset::drawMarkers2(PainterInfo & pi, int x, int y) const
-{
-       ColorCode pen_color = mouseHovered(pi.base.bv) || editing(pi.base.bv)?
-               Color_mathframe : Color_mathcorners;
-
-       drawMarkers(pi, x, y);
-       Dimension const dim = dimension(*pi.base.bv);
-       int const t = x + dim.width() - 1;
-       int const a = y - dim.ascent();
-       pi.pain.line(x, a + 3, x, a, pen_color);
-       pi.pain.line(t, a + 3, t, a, pen_color);
-       pi.pain.line(x, a, x + 3, a, pen_color);
-       pi.pain.line(t - 3, a, t, a, pen_color);
-       setPosCache(pi, x, y);
 }
 
 
@@ -621,19 +610,6 @@ ColorCode Inset::labelColor() const
 }
 
 
-void Inset::setPosCache(PainterInfo const & pi, int x, int y) const
-{
-       //LYXERR("Inset: set position cache to " << x << " " << y);
-       pi.base.bv->coordCache().insets().add(this, x, y);
-}
-
-
-void Inset::setDimCache(MetricsInfo const & mi, Dimension const & dim) const
-{
-       mi.base.bv->coordCache().insets().add(this, dim);
-}
-
-
 Buffer const * Inset::updateFrontend() const
 {
        //FIXME (Abdel 03/12/10): see bugs #6814 and #6949
@@ -652,7 +628,7 @@ bool Inset::resetFontEdit() const
 }
 
 
-docstring Inset::completionPrefix(Cursor const &) const 
+docstring Inset::completionPrefix(Cursor const &) const
 {
        return docstring();
 }