mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-26 10:01:50 +00:00
This is intended to be a pure renaming of the Inset::name() routine,
preparatory to fixing #7080. Note that mathed uses the same routine, but for a completely different purpose, so I did not rename it there. I have seen no difference in behavior after testing, e.g., opening and exporting Math.lyx, and also re-saving it and looking at the diff. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38109 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9c9abe843f
commit
3f27f951cb
@ -1752,7 +1752,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
Inset * ins = cur.nextInset();
|
||||
if (!ins)
|
||||
break;
|
||||
docstring insname = ins->name();
|
||||
docstring insname = ins->layoutName();
|
||||
while (!insname.empty()) {
|
||||
if (insname == name || name == from_utf8("*")) {
|
||||
cur.recordUndo();
|
||||
|
@ -667,7 +667,9 @@ void switchBetweenClasses(DocumentClass const * const oldone,
|
||||
if (it->lyxCode() != FLEX_CODE)
|
||||
// FIXME: Should we verify all InsetCollapsable?
|
||||
continue;
|
||||
docstring const & n = newone->insetLayout(it->name()).name();
|
||||
|
||||
docstring const layoutName = it->layoutName();
|
||||
docstring const & n = newone->insetLayout(layoutName).name();
|
||||
bool const is_undefined = n.empty() ||
|
||||
n == DocumentClass::plainInsetLayout().name();
|
||||
if (!is_undefined)
|
||||
@ -679,12 +681,11 @@ void switchBetweenClasses(DocumentClass const * const oldone,
|
||||
docstring s;
|
||||
if (oldname == newname)
|
||||
s = bformat(_("Flex inset %1$s is undefined after "
|
||||
"reloading `%2$s' layout."),
|
||||
it->name(), oldname);
|
||||
"reloading `%2$s' layout."), layoutName, oldname);
|
||||
else
|
||||
s = bformat(_("Flex inset %1$s is undefined because of "
|
||||
"conversion from `%2$s' layout to `%3$s'."),
|
||||
it->name(), oldname, newname);
|
||||
layoutName, oldname, newname);
|
||||
// To warn the user that something had to be done.
|
||||
errorlist.push_back(ErrorItem(
|
||||
_("Undefined flex inset"),
|
||||
|
@ -186,11 +186,10 @@ Buffer & Inset::buffer()
|
||||
{
|
||||
if (!buffer_) {
|
||||
odocstringstream s;
|
||||
lyxerr << "Inset: " << this
|
||||
<< " LyX Code: " << lyxCode()
|
||||
<< " name: " << insetName(lyxCode())
|
||||
<< std::endl;
|
||||
s << "LyX Code: " << lyxCode() << " name: " << name();
|
||||
string const iname = insetName(lyxCode());
|
||||
LYXERR0("Inset: " << this << " LyX Code: " << lyxCode()
|
||||
<< " name: " << iname);
|
||||
s << "LyX Code: " << lyxCode() << " name: " << iname;
|
||||
LASSERT(false, /**/);
|
||||
throw ExceptionMessage(BufferException,
|
||||
from_ascii("Inset::buffer_ member not initialized!"), s.str());
|
||||
@ -218,7 +217,7 @@ bool Inset::isBufferValid() const
|
||||
}
|
||||
|
||||
|
||||
docstring Inset::name() const
|
||||
docstring Inset::layoutName() const
|
||||
{
|
||||
return from_ascii("unknown");
|
||||
}
|
||||
@ -579,7 +578,7 @@ InsetLayout const & Inset::getLayout() const
|
||||
{
|
||||
if (!buffer_)
|
||||
return DocumentClass::plainInsetLayout();
|
||||
return buffer().params().documentClass().insetLayout(name());
|
||||
return buffer().params().documentClass().insetLayout(layoutName());
|
||||
}
|
||||
|
||||
|
||||
|
@ -415,13 +415,7 @@ public:
|
||||
virtual docstring contextMenuName() const;
|
||||
|
||||
|
||||
// FIXME This should really disappear in favor of
|
||||
// docstring name() const { return from_ascii(insetName(lyxCode()))); }
|
||||
// There's no reason to be using different names in different places.
|
||||
// But to do this we would need to change the file format, since the names
|
||||
// used there don't correspond to what is used here.
|
||||
///
|
||||
virtual docstring name() const;
|
||||
virtual docstring layoutName() const;
|
||||
///
|
||||
virtual InsetLayout const & getLayout() const;
|
||||
/// Is this inset's layout defined in the document's textclass?
|
||||
|
@ -39,7 +39,7 @@ private:
|
||||
/// code of the inset
|
||||
InsetCode lyxCode() const { return ARG_CODE; }
|
||||
///
|
||||
docstring name() const { return from_ascii("Argument"); }
|
||||
docstring layoutName() const { return from_ascii("Argument"); }
|
||||
/// Standard LaTeX output -- short-circuited
|
||||
void latex(otexstream &, OutputParams const &) const;
|
||||
/// Standard plain text output -- short-circuited
|
||||
|
@ -102,7 +102,7 @@ InsetBox::InsetBox(Buffer * buffer, string const & label)
|
||||
{}
|
||||
|
||||
|
||||
docstring InsetBox::name() const
|
||||
docstring InsetBox::layoutName() const
|
||||
{
|
||||
// FIXME: UNICODE
|
||||
string name = "Box";
|
||||
|
@ -91,7 +91,7 @@ private:
|
||||
///
|
||||
InsetCode lyxCode() const { return BOX_CODE; }
|
||||
///
|
||||
docstring name() const;
|
||||
docstring layoutName() const;
|
||||
///
|
||||
void write(std::ostream &) const;
|
||||
///
|
||||
|
@ -109,7 +109,7 @@ private:
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
///
|
||||
docstring name() const { return from_ascii("Branch"); }
|
||||
docstring layoutName() const { return from_ascii("Branch"); }
|
||||
///
|
||||
Inset * clone() const { return new InsetBranch(*this); }
|
||||
|
||||
|
@ -65,7 +65,7 @@ void InsetCaption::write(ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetCaption::name() const
|
||||
docstring InsetCaption::layoutName() const
|
||||
{
|
||||
if (type_.empty())
|
||||
return from_ascii("Caption");
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
///
|
||||
std::string const & type() const { return type_; }
|
||||
///
|
||||
docstring name() const;
|
||||
docstring layoutName() const;
|
||||
/// return the mandatory argument (LaTeX format) only
|
||||
void getArgument(otexstream & os, OutputParams const &) const;
|
||||
/// return the optional argument(s) only
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
///
|
||||
docstring toolTip(BufferView const & bv, int x, int y) const;
|
||||
///
|
||||
docstring name() const { return from_ascii("Collapsable"); }
|
||||
docstring layoutName() const { return from_ascii("Collapsable"); }
|
||||
///
|
||||
void read(Lexer &);
|
||||
///
|
||||
|
@ -44,7 +44,7 @@ private:
|
||||
///
|
||||
InsetCode lyxCode() const { return ERT_CODE; }
|
||||
///
|
||||
docstring name() const { return from_ascii("ERT"); }
|
||||
docstring layoutName() const { return from_ascii("ERT"); }
|
||||
///
|
||||
void write(std::ostream & os) const;
|
||||
///
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
///
|
||||
InsetFlex(Buffer *, std::string const & layoutName);
|
||||
///
|
||||
docstring name() const { return from_utf8(name_); }
|
||||
docstring layoutName() const { return from_utf8(name_); }
|
||||
///
|
||||
InsetLayout const & getLayout() const;
|
||||
///
|
||||
|
@ -119,7 +119,7 @@ InsetFloat::InsetFloat(Buffer * buf, string params_str)
|
||||
}
|
||||
|
||||
|
||||
docstring InsetFloat::name() const
|
||||
docstring InsetFloat::layoutName() const
|
||||
{
|
||||
return "Float:" + from_utf8(params_.type);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
InsetFloatParams const & params() const { return params_; }
|
||||
private:
|
||||
///
|
||||
docstring name() const;
|
||||
docstring layoutName() const;
|
||||
///
|
||||
docstring toolTip(BufferView const & bv, int x, int y) const;
|
||||
///
|
||||
|
@ -30,7 +30,7 @@ private:
|
||||
///
|
||||
InsetCode lyxCode() const { return FOOT_CODE; }
|
||||
///
|
||||
docstring name() const { return from_ascii("Foot"); }
|
||||
docstring layoutName() const { return from_ascii("Foot"); }
|
||||
///
|
||||
void latex(otexstream &, OutputParams const &) const;
|
||||
///
|
||||
|
@ -50,7 +50,7 @@ void InsetFootlike::draw(PainterInfo & pi, int x, int y) const
|
||||
|
||||
void InsetFootlike::write(ostream & os) const
|
||||
{
|
||||
os << to_utf8(name()) << "\n";
|
||||
os << to_utf8(layoutName()) << "\n";
|
||||
InsetCollapsable::write(os);
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ docstring const InsetIndex::buttonLabel(BufferView const & bv) const
|
||||
|
||||
void InsetIndex::write(ostream & os) const
|
||||
{
|
||||
os << to_utf8(name());
|
||||
os << to_utf8(layoutName());
|
||||
params_.write(os);
|
||||
InsetCollapsable::write(os);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ private:
|
||||
///
|
||||
InsetCode lyxCode() const { return INDEX_CODE; }
|
||||
///
|
||||
docstring name() const { return from_ascii("Index"); }
|
||||
docstring layoutName() const { return from_ascii("Index"); }
|
||||
///
|
||||
ColorCode labelColor() const;
|
||||
///
|
||||
|
@ -107,7 +107,7 @@ string InsetInfo::infoType() const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetInfo::name() const
|
||||
docstring InsetInfo::layoutName() const
|
||||
{
|
||||
return from_ascii("Info:" + infoType());
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
///
|
||||
InsetCode lyxCode() const { return INFO_CODE; }
|
||||
///
|
||||
docstring name() const;
|
||||
docstring layoutName() const;
|
||||
///
|
||||
Inset * editXY(Cursor & cur, int x, int y);
|
||||
///
|
||||
|
@ -47,7 +47,7 @@ private:
|
||||
/// lstinline is inlined, normal listing is displayed
|
||||
DisplayType display() const;
|
||||
///
|
||||
docstring name() const { return from_ascii("Listings"); }
|
||||
docstring layoutName() const { return from_ascii("Listings"); }
|
||||
// Update the counters of this inset and of its contents
|
||||
void updateBuffer(ParIterator const &, UpdateType);
|
||||
///
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
///
|
||||
InsetCode lyxCode() const { return MARGIN_CODE; }
|
||||
///
|
||||
docstring name() const { return from_ascii("Marginal"); }
|
||||
docstring layoutName() const { return from_ascii("Marginal"); }
|
||||
///
|
||||
int plaintext(odocstream &, OutputParams const & runparams) const;
|
||||
///
|
||||
|
@ -111,7 +111,7 @@ InsetNote::~InsetNote()
|
||||
}
|
||||
|
||||
|
||||
docstring InsetNote::name() const
|
||||
docstring InsetNote::layoutName() const
|
||||
{
|
||||
return from_ascii("Note:" + notetranslator().find(params_.type));
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ private:
|
||||
///
|
||||
InsetCode lyxCode() const { return NOTE_CODE; }
|
||||
///
|
||||
docstring name() const;
|
||||
docstring layoutName() const;
|
||||
///
|
||||
DisplayType display() const;
|
||||
/** returns false if, when outputing LaTeX, font changes should
|
||||
|
@ -126,7 +126,7 @@ InsetPhantom::~InsetPhantom()
|
||||
}
|
||||
|
||||
|
||||
docstring InsetPhantom::name() const
|
||||
docstring InsetPhantom::layoutName() const
|
||||
{
|
||||
return from_ascii("Phantom:" + phantomtranslator().find(params_.type));
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ private:
|
||||
///
|
||||
InsetCode lyxCode() const { return PHANTOM_CODE; }
|
||||
///
|
||||
docstring name() const;
|
||||
docstring layoutName() const;
|
||||
///
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
///
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
|
||||
InsetCode lyxCode() const { return PREVIEW_CODE; }
|
||||
|
||||
docstring name() const { return from_ascii("Preview"); }
|
||||
docstring layoutName() const { return from_ascii("Preview"); }
|
||||
|
||||
bool descendable(BufferView const & /*bv*/) const { return true; }
|
||||
|
||||
|
@ -114,7 +114,7 @@ InsetQuotes::InsetQuotes(Buffer * buf, char_type c, QuoteTimes t)
|
||||
}
|
||||
|
||||
|
||||
docstring InsetQuotes::name() const
|
||||
docstring InsetQuotes::layoutName() const
|
||||
{
|
||||
return from_ascii("Quotes");
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
/// Direct access to inner/outer quotation marks
|
||||
InsetQuotes(Buffer * buf, char_type c, QuoteTimes t);
|
||||
///
|
||||
docstring name() const;
|
||||
docstring layoutName() const;
|
||||
///
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
///
|
||||
|
@ -143,7 +143,7 @@ InsetScript::~InsetScript()
|
||||
}
|
||||
|
||||
|
||||
docstring InsetScript::name() const
|
||||
docstring InsetScript::layoutName() const
|
||||
{
|
||||
return from_ascii("script:" + scripttranslator().find(params_.type));
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
///
|
||||
InsetCode lyxCode() const { return SCRIPT_CODE; }
|
||||
///
|
||||
docstring name() const;
|
||||
docstring layoutName() const;
|
||||
///
|
||||
DisplayType display() const;
|
||||
///
|
||||
|
@ -58,7 +58,7 @@ InsetWrap::~InsetWrap()
|
||||
}
|
||||
|
||||
|
||||
docstring InsetWrap::name() const
|
||||
docstring InsetWrap::layoutName() const
|
||||
{
|
||||
return "Wrap:" + from_utf8(params_.type);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ private:
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
///
|
||||
docstring name() const;
|
||||
docstring layoutName() const;
|
||||
///
|
||||
Inset * clone() const { return new InsetWrap(*this); }
|
||||
|
||||
|
@ -27,6 +27,12 @@ using namespace std;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
docstring InsetMath::name() const
|
||||
{
|
||||
return from_utf8("Unknown");
|
||||
}
|
||||
|
||||
|
||||
MathData & InsetMath::cell(idx_type)
|
||||
{
|
||||
static MathData dummyCell(&buffer());
|
||||
|
@ -102,6 +102,8 @@ public:
|
||||
InsetMath const * asInsetMath() const { return this; }
|
||||
/// this is overridden in math text insets (i.e. mbox)
|
||||
bool inMathed() const { return true; }
|
||||
///
|
||||
virtual docstring name() const;
|
||||
|
||||
/// this is overridden by specific insets
|
||||
virtual mode_type currentMode() const { return MATH_MODE; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user