]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetIPA.cpp
Change tracking cue: for instant preview
[lyx.git] / src / insets / InsetIPA.cpp
index 33ede5515fd57b604991d5fe1d6c0a51a04e5cdd..1da5a24299c2fbc1d106dbbe0e9e144f4093d6cc 100644 (file)
@@ -36,9 +36,8 @@ namespace lyx {
 
 InsetIPA::InsetIPA(Buffer * buf) 
        : InsetText(buf),
-         preview_(new RenderPreview(this)), use_preview_(true)
+         preview_(new RenderPreview(this))
 {
-       setAutoBreakRows(true);
        setDrawFrame(true);
        setFrameColor(Color_insetframe);
 }
@@ -55,6 +54,18 @@ InsetIPA::InsetIPA(InsetIPA const & other)
 }
 
 
+InsetIPA & InsetIPA::operator=(InsetIPA const & other)
+{
+       if (&other == this)
+               return *this;
+
+       InsetText::operator=(other);
+       preview_.reset(new RenderPreview(*other.preview_, this));
+
+       return *this;
+}
+
+
 void InsetIPA::write(ostream & os) const
 {
        os << "IPA" << "\n";
@@ -139,9 +150,7 @@ void InsetIPA::reloadPreview(DocIterator const & pos) const
 
 void InsetIPA::draw(PainterInfo & pi, int x, int y) const
 {
-       use_preview_ = previewState(pi.base.bv);
-
-       if (use_preview_) {
+       if (previewState(pi.base.bv)) {
                preview_->draw(pi, x + TEXT_TO_INSET_OFFSET, y);
                setPosCache(pi, x, y);
                return;
@@ -159,7 +168,7 @@ void InsetIPA::edit(Cursor & cur, bool front, EntryDirection entry_from)
 
 Inset * InsetIPA::editXY(Cursor & cur, int x, int y)
 {
-       if (use_preview_) {
+       if (previewState(&cur.bv())) {
                edit(cur, true, ENTRY_DIRECTION_IGNORE);
                return this;
        }
@@ -180,7 +189,6 @@ void InsetIPA::metrics(MetricsInfo & mi, Dimension & dim) const
                dim.asc += TEXT_TO_INSET_OFFSET;
                dim.des += TEXT_TO_INSET_OFFSET;
                dim.wid += TEXT_TO_INSET_OFFSET;
-               dim_ = dim;
                dim.wid += TEXT_TO_INSET_OFFSET;
                // insert a one pixel gap
                dim.wid += 1;
@@ -231,6 +239,14 @@ void InsetIPA::latex(otexstream & os, OutputParams const & runparams_in) const
 }
 
 
+docstring InsetIPA::xhtml(XHTMLStream & xs, OutputParams const & runparams_in) const
+{
+       OutputParams runparams(runparams_in);
+       runparams.inIPA = true;
+       return InsetText::xhtml(xs, runparams);
+}
+
+
 bool InsetIPA::insetAllowed(InsetCode code) const
 {
        switch (code) {