]> git.lyx.org Git - features.git/blobdiff - src/mathed/math_hullinset.C
change "support/std_sstream.h" to <sstream>
[features.git] / src / mathed / math_hullinset.C
index 8490ff9c0eb7ab4bc2f9d18ffa4baec2971917b9..b56dec9d2c70fb9b8414911e618de80382d843eb 100644 (file)
 #include "graphics/PreviewImage.h"
 #include "graphics/PreviewLoader.h"
 
-#include "support/std_sstream.h"
-
 #include <boost/bind.hpp>
 
+#include <sstream>
+
 using lyx::cap::grabAndEraseSelection;
 
 using std::endl;
@@ -232,7 +232,8 @@ void MathHullInset::metrics(MetricsInfo & mi, Dimension & dim) const
        BOOST_ASSERT(mi.base.bv && mi.base.bv->buffer());
 
        bool use_preview = false;
-       if (!editing(mi.base.bv) && RenderPreview::activated()) {
+       if (!editing(mi.base.bv) &&
+           RenderPreview::status() == LyXRC::PREVIEW_ON) {
                lyx::graphics::PreviewImage const * pimage =
                        preview_->getPreviewImage(*mi.base.bv->buffer());
                use_preview = pimage && pimage->image();
@@ -285,7 +286,8 @@ void MathHullInset::draw(PainterInfo & pi, int x, int y) const
        BOOST_ASSERT(pi.base.bv && pi.base.bv->buffer());
 
        bool use_preview = false;
-       if (!editing(pi.base.bv) && RenderPreview::activated()) {
+       if (!editing(pi.base.bv) &&
+           RenderPreview::status() == LyXRC::PREVIEW_ON) {
                lyx::graphics::PreviewImage const * pimage =
                        preview_->getPreviewImage(*pi.base.bv->buffer());
                use_preview = pimage && pimage->image();
@@ -357,14 +359,16 @@ string const latex_string(MathHullInset const & inset)
 
 void MathHullInset::addPreview(lyx::graphics::PreviewLoader & ploader) const
 {
-       string const snippet = latex_string(*this);
-       preview_->addPreview(snippet, ploader);
+       if (RenderPreview::status() == LyXRC::PREVIEW_ON) {
+               string const snippet = latex_string(*this);
+               preview_->addPreview(snippet, ploader);
+       }
 }
 
 
 void MathHullInset::notifyCursorLeaves(LCursor & cur)
 {
-       if (!RenderPreview::activated())
+       if (RenderPreview::status() != LyXRC::PREVIEW_ON)
                return;
 
        Buffer const & buffer = cur.buffer();
@@ -1150,7 +1154,9 @@ InsetBase::Code MathHullInset::lyxCode() const
 bool MathHullInset::searchForward(BufferView * bv, string const & str,
                                     bool, bool)
 {
+#ifdef WITH_WARNINGS
 #warning completely broken
+#endif
        static MathHullInset * lastformula = 0;
        static CursorBase current = DocIterator(ibegin(nucleus()));
        static MathArray ar;
@@ -1235,7 +1241,9 @@ int MathHullInset::docbook(Buffer const & buf, ostream & os,
                          OutputParams const & runparams) const
 {
        MathMLStream ms(os);
-       ms << MTag("equation");
+       string name="equation";
+       if (! label(0).empty()) name += " id=\"" + label(0)+ "\"";
+       ms << MTag(name.c_str());
        ms <<   MTag("alt");
        ms <<    "<[CDATA[";
        int res = plaintext(buf, ms.os(), runparams);