]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetPhantom.cpp
Fix crash after undo following replacement of a multicell selection (#8973).
[lyx.git] / src / insets / InsetPhantom.cpp
index f275e1c9c7711b40d80e914f5958b7b037df25b7..f7a9b45d9a732fa859c7be6cde82365c2ce23efb 100644 (file)
@@ -126,7 +126,7 @@ InsetPhantom::~InsetPhantom()
 }
 
 
-docstring InsetPhantom::name() const 
+docstring InsetPhantom::layoutName() const
 {
        return from_ascii("Phantom:" + phantomtranslator().find(params_.type));
 }
@@ -154,7 +154,7 @@ void InsetPhantom::draw(PainterInfo & pi, int x, int y) const
        ColorCode const origcol = pi.base.font.color();
        pi.base.font.setColor(Color_special);
        pi.base.font.setColor(origcol);
-       Dimension const dim = dimension(*pi.base.bv);
+       Dimension const dim = Inset::dimension(*pi.base.bv);
 
        if (params_.type == InsetPhantomParams::Phantom ||
                params_.type == InsetPhantomParams::VPhantom) {
@@ -261,6 +261,8 @@ void InsetPhantom::doDispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_INSET_MODIFY:
                cur.recordUndoInset(ATOMIC_UNDO, this);
                string2params(to_utf8(cmd.argument()), params_);
+               setButtonLabel();
+               cur.forceBufferUpdate();
                break;
 
        case LFUN_INSET_DIALOG_UPDATE:
@@ -305,7 +307,7 @@ docstring InsetPhantom::toolTip(BufferView const &, int, int) const
 }
 
 
-int InsetPhantom::latex(odocstream & os, OutputParams const & runparams) const
+void InsetPhantom::latex(otexstream & os, OutputParams const & runparams) const
 {
        if (params_.type == InsetPhantomParams::Phantom)
                os << "\\phantom{";
@@ -313,15 +315,13 @@ int InsetPhantom::latex(odocstream & os, OutputParams const & runparams) const
                os << "\\hphantom{";
        else if (params_.type == InsetPhantomParams::VPhantom)
                os << "\\vphantom{";
-       int const i = InsetCollapsable::latex(os, runparams);
+       InsetCollapsable::latex(os, runparams);
        os << "}";
-
-       return i;
 }
 
 
-int InsetPhantom::plaintext(odocstream & os,
-                           OutputParams const & runparams) const
+int InsetPhantom::plaintext(odocstringstream & os,
+                           OutputParams const & runparams, size_t max_length) const
 {
        if (params_.type == InsetPhantomParams::Phantom)
                os << '[' << buffer().B_("phantom") << ":";
@@ -329,7 +329,7 @@ int InsetPhantom::plaintext(odocstream & os,
                os << '[' << buffer().B_("hphantom") << ":";
        else if (params_.type == InsetPhantomParams::VPhantom)
                os << '[' << buffer().B_("vphantom") << ":";
-       InsetCollapsable::plaintext(os, runparams);
+       InsetCollapsable::plaintext(os, runparams, max_length);
        os << "]";
 
        return PLAINTEXT_NEWLINE;
@@ -358,9 +358,9 @@ docstring InsetPhantom::xhtml(XHTMLStream &, OutputParams const &) const
        return docstring();
 }
 
-docstring InsetPhantom::contextMenu(BufferView const &, int, int) const
+string InsetPhantom::contextMenuName() const
 {
-       return from_ascii("context-phantom");
+       return "context-phantom";
 }