PhantomTranslator const & phantomtranslator()
{
- static PhantomTranslator translator = init_phantomtranslator();
+ static PhantomTranslator const translator =
+ init_phantomtranslator();
return translator;
}
PhantomTranslatorLoc const & phantomtranslator_loc()
{
- static PhantomTranslatorLoc translator = init_phantomtranslator_loc();
+ static PhantomTranslatorLoc const translator =
+ init_phantomtranslator_loc();
return translator;
}
}
-docstring InsetPhantom::name() const
+docstring InsetPhantom::layoutName() const
{
return from_ascii("Phantom:" + phantomtranslator().find(params_.type));
}
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) {
void InsetPhantom::doDispatch(Cursor & cur, FuncRequest & cmd)
{
- switch (cmd.action) {
+ switch (cmd.action()) {
case LFUN_INSET_MODIFY:
+ cur.recordUndoInset(ATOMIC_UNDO, this);
string2params(to_utf8(cmd.argument()), params_);
+ setButtonLabel();
+ cur.forceBufferUpdate();
break;
case LFUN_INSET_DIALOG_UPDATE:
bool InsetPhantom::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const
{
- switch (cmd.action) {
+ switch (cmd.action()) {
case LFUN_INSET_MODIFY:
if (cmd.getArg(0) == "phantom") {
docstring InsetPhantom::toolTip(BufferView const &, int, int) const
{
- OutputParams rp(&buffer().params().encoding());
- odocstringstream ods;
- InsetCollapsable::plaintext(ods, rp);
- docstring content_tip = support::wrapParas(ods.str());
- docstring res = phantomtranslator_loc().find(params_.type);
- if (!content_tip.empty())
- res += from_ascii(": ") + "\n" + content_tip;
- return res;
+ docstring const res = phantomtranslator_loc().find(params_.type);
+ return toolTipText(res + from_ascii(": "));
}
-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{";
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") << ":";
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;
}
-docstring InsetPhantom::xhtml(odocstream &, OutputParams const &) const
+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";
}