mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
Move Inset::Code to InsetCode.h
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20936 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
61dba28fc4
commit
f7b1c86393
@ -60,7 +60,7 @@ void Bidi::computeTables(Paragraph const & par,
|
||||
return;
|
||||
}
|
||||
|
||||
if (par.ownerCode() == Inset::ERT_CODE || par.ownerCode() == Inset::LISTINGS_CODE) {
|
||||
if (par.ownerCode() == ERT_CODE || par.ownerCode() == LISTINGS_CODE) {
|
||||
start_ = -1;
|
||||
return;
|
||||
}
|
||||
|
@ -1485,14 +1485,14 @@ void Buffer::updateBibfilesCache()
|
||||
|
||||
bibfilesCache_.clear();
|
||||
for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
|
||||
if (it->lyxCode() == Inset::BIBTEX_CODE) {
|
||||
if (it->lyxCode() == BIBTEX_CODE) {
|
||||
InsetBibtex const & inset =
|
||||
static_cast<InsetBibtex const &>(*it);
|
||||
vector<FileName> const bibfiles = inset.getFiles(*this);
|
||||
bibfilesCache_.insert(bibfilesCache_.end(),
|
||||
bibfiles.begin(),
|
||||
bibfiles.end());
|
||||
} else if (it->lyxCode() == Inset::INCLUDE_CODE) {
|
||||
} else if (it->lyxCode() == INCLUDE_CODE) {
|
||||
InsetInclude & inset =
|
||||
static_cast<InsetInclude &>(*it);
|
||||
inset.updateBibfilesCache(*this);
|
||||
@ -1823,7 +1823,7 @@ void Buffer::buildMacros()
|
||||
InsetList::const_iterator end = insets.end();
|
||||
for ( ; it != end; ++it) {
|
||||
//lyxerr << "found inset code " << it->inset->lyxCode() << std::endl;
|
||||
if (it->inset->lyxCode() == Inset::MATHMACRO_CODE) {
|
||||
if (it->inset->lyxCode() == MATHMACRO_CODE) {
|
||||
MathMacroTemplate const & mac
|
||||
= static_cast<MathMacroTemplate const &>(*it->inset);
|
||||
insertMacro(mac.name(), mac.asMacroData());
|
||||
@ -1836,14 +1836,14 @@ void Buffer::buildMacros()
|
||||
void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
|
||||
int inset_code)
|
||||
{
|
||||
Inset::Code code = static_cast<Inset::Code>(inset_code);
|
||||
InsetCode code = static_cast<InsetCode>(inset_code);
|
||||
|
||||
//FIXME: This does not work for child documents yet.
|
||||
BOOST_ASSERT(code == Inset::CITE_CODE || code == Inset::REF_CODE);
|
||||
BOOST_ASSERT(code == CITE_CODE || code == REF_CODE);
|
||||
// Check if the label 'from' appears more than once
|
||||
vector<docstring> labels;
|
||||
|
||||
if (code == Inset::CITE_CODE) {
|
||||
if (code == CITE_CODE) {
|
||||
BiblioInfo keys;
|
||||
keys.fillWithBibKeys(this);
|
||||
BiblioInfo::const_iterator bit = keys.begin();
|
||||
|
@ -364,10 +364,10 @@ public:
|
||||
///
|
||||
void insertMacro(docstring const & name, MacroData const & data);
|
||||
|
||||
/// Replace the inset contents for insets which Inset::Code is equal
|
||||
/// Replace the inset contents for insets which InsetCode is equal
|
||||
/// to the passed \p inset_code.
|
||||
/// FIXME: we pass Inset::Code as an int in order to avoid the inclusion
|
||||
/// of "Inset.h". It would be better to put Inset::Code in its own
|
||||
/// FIXME: we pass InsetCode as an int in order to avoid the inclusion
|
||||
/// of "Inset.h". It would be better to put InsetCode in its own
|
||||
/// header.
|
||||
void changeRefsIfUnique(docstring const & from, docstring const & to,
|
||||
int inset_code);
|
||||
|
@ -119,7 +119,7 @@ namespace {
|
||||
|
||||
/// Return an inset of this class if it exists at the current cursor position
|
||||
template <class T>
|
||||
T * getInsetByCode(Cursor const & cur, Inset::Code code)
|
||||
T * getInsetByCode(Cursor const & cur, InsetCode code)
|
||||
{
|
||||
DocIterator it = cur;
|
||||
Inset * inset = it.nextInset();
|
||||
@ -129,10 +129,10 @@ T * getInsetByCode(Cursor const & cur, Inset::Code code)
|
||||
}
|
||||
|
||||
|
||||
bool findInset(DocIterator & dit, vector<Inset_code> const & codes,
|
||||
bool findInset(DocIterator & dit, vector<InsetCode> const & codes,
|
||||
bool same_content);
|
||||
|
||||
bool findNextInset(DocIterator & dit, vector<Inset_code> const & codes,
|
||||
bool findNextInset(DocIterator & dit, vector<InsetCode> const & codes,
|
||||
string const & contents)
|
||||
{
|
||||
DocIterator tmpdit = dit;
|
||||
@ -154,7 +154,7 @@ bool findNextInset(DocIterator & dit, vector<Inset_code> const & codes,
|
||||
|
||||
|
||||
/// Looks for next inset with one of the the given code
|
||||
bool findInset(DocIterator & dit, vector<Inset_code> const & codes,
|
||||
bool findInset(DocIterator & dit, vector<InsetCode> const & codes,
|
||||
bool same_content)
|
||||
{
|
||||
string contents;
|
||||
@ -186,14 +186,14 @@ bool findInset(DocIterator & dit, vector<Inset_code> const & codes,
|
||||
|
||||
|
||||
/// Looks for next inset with the given code
|
||||
void findInset(DocIterator & dit, Inset_code code, bool same_content)
|
||||
void findInset(DocIterator & dit, InsetCode code, bool same_content)
|
||||
{
|
||||
findInset(dit, vector<Inset_code>(1, code), same_content);
|
||||
findInset(dit, vector<InsetCode>(1, code), same_content);
|
||||
}
|
||||
|
||||
|
||||
/// Moves cursor to the next inset with one of the given codes.
|
||||
void gotoInset(BufferView * bv, vector<Inset_code> const & codes,
|
||||
void gotoInset(BufferView * bv, vector<InsetCode> const & codes,
|
||||
bool same_content)
|
||||
{
|
||||
Cursor tmpcur = bv->cursor();
|
||||
@ -208,9 +208,9 @@ void gotoInset(BufferView * bv, vector<Inset_code> const & codes,
|
||||
|
||||
|
||||
/// Moves cursor to the next inset with given code.
|
||||
void gotoInset(BufferView * bv, Inset_code code, bool same_content)
|
||||
void gotoInset(BufferView * bv, InsetCode code, bool same_content)
|
||||
{
|
||||
gotoInset(bv, vector<Inset_code>(1, code), same_content);
|
||||
gotoInset(bv, vector<InsetCode>(1, code), same_content);
|
||||
}
|
||||
|
||||
|
||||
@ -891,7 +891,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
|
||||
case LFUN_LABEL_GOTO: {
|
||||
flag.enabled(!cmd.argument().empty()
|
||||
|| getInsetByCode<InsetRef>(cur, Inset::REF_CODE));
|
||||
|| getInsetByCode<InsetRef>(cur, REF_CODE));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -934,7 +934,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT_TABULAR:
|
||||
flag.enabled(cur.innerInsetOfType(Inset::TABULAR_CODE));
|
||||
flag.enabled(cur.innerInsetOfType(TABULAR_CODE));
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT:
|
||||
@ -943,31 +943,31 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_INSET_SETTINGS: {
|
||||
Inset::Code code = cur.inset().lyxCode();
|
||||
InsetCode code = cur.inset().lyxCode();
|
||||
bool enable = false;
|
||||
switch (code) {
|
||||
case Inset::TABULAR_CODE:
|
||||
case TABULAR_CODE:
|
||||
enable = cmd.argument() == "tabular";
|
||||
break;
|
||||
case Inset::ERT_CODE:
|
||||
case ERT_CODE:
|
||||
enable = cmd.argument() == "ert";
|
||||
break;
|
||||
case Inset::FLOAT_CODE:
|
||||
case FLOAT_CODE:
|
||||
enable = cmd.argument() == "float";
|
||||
break;
|
||||
case Inset::WRAP_CODE:
|
||||
case WRAP_CODE:
|
||||
enable = cmd.argument() == "wrap";
|
||||
break;
|
||||
case Inset::NOTE_CODE:
|
||||
case NOTE_CODE:
|
||||
enable = cmd.argument() == "note";
|
||||
break;
|
||||
case Inset::BRANCH_CODE:
|
||||
case BRANCH_CODE:
|
||||
enable = cmd.argument() == "branch";
|
||||
break;
|
||||
case Inset::BOX_CODE:
|
||||
case BOX_CODE:
|
||||
enable = cmd.argument() == "box";
|
||||
break;
|
||||
case Inset::LISTINGS_CODE:
|
||||
case LISTINGS_CODE:
|
||||
enable = cmd.argument() == "listings";
|
||||
break;
|
||||
default:
|
||||
@ -978,9 +978,9 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_DIALOG_SHOW_NEW_INSET:
|
||||
flag.enabled(cur.inset().lyxCode() != Inset::ERT_CODE &&
|
||||
cur.inset().lyxCode() != Inset::LISTINGS_CODE);
|
||||
if (cur.inset().lyxCode() == Inset::CAPTION_CODE) {
|
||||
flag.enabled(cur.inset().lyxCode() != ERT_CODE &&
|
||||
cur.inset().lyxCode() != LISTINGS_CODE);
|
||||
if (cur.inset().lyxCode() == CAPTION_CODE) {
|
||||
FuncStatus flag;
|
||||
if (cur.inset().getStatus(cur, cmd, flag))
|
||||
return flag;
|
||||
@ -1061,7 +1061,7 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
|
||||
if (label.empty()) {
|
||||
InsetRef * inset =
|
||||
getInsetByCode<InsetRef>(d->cursor_,
|
||||
Inset::REF_CODE);
|
||||
REF_CODE);
|
||||
if (inset) {
|
||||
label = inset->getParam("reference");
|
||||
// persistent=false: use temp_bookmark
|
||||
@ -1128,13 +1128,13 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_NOTE_NEXT:
|
||||
gotoInset(this, Inset::NOTE_CODE, false);
|
||||
gotoInset(this, NOTE_CODE, false);
|
||||
break;
|
||||
|
||||
case LFUN_REFERENCE_NEXT: {
|
||||
vector<Inset_code> tmp;
|
||||
tmp.push_back(Inset::LABEL_CODE);
|
||||
tmp.push_back(Inset::REF_CODE);
|
||||
vector<InsetCode> tmp;
|
||||
tmp.push_back(LABEL_CODE);
|
||||
tmp.push_back(REF_CODE);
|
||||
gotoInset(this, tmp, true);
|
||||
break;
|
||||
}
|
||||
@ -1245,9 +1245,9 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
|
||||
|
||||
case LFUN_BIBTEX_DATABASE_ADD: {
|
||||
Cursor tmpcur = d->cursor_;
|
||||
findInset(tmpcur, Inset::BIBTEX_CODE, false);
|
||||
findInset(tmpcur, BIBTEX_CODE, false);
|
||||
InsetBibtex * inset = getInsetByCode<InsetBibtex>(tmpcur,
|
||||
Inset::BIBTEX_CODE);
|
||||
BIBTEX_CODE);
|
||||
if (inset) {
|
||||
if (inset->addDatabase(to_utf8(cmd.argument())))
|
||||
buffer_.updateBibfilesCache();
|
||||
@ -1257,9 +1257,9 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
|
||||
|
||||
case LFUN_BIBTEX_DATABASE_DEL: {
|
||||
Cursor tmpcur = d->cursor_;
|
||||
findInset(tmpcur, Inset::BIBTEX_CODE, false);
|
||||
findInset(tmpcur, BIBTEX_CODE, false);
|
||||
InsetBibtex * inset = getInsetByCode<InsetBibtex>(tmpcur,
|
||||
Inset::BIBTEX_CODE);
|
||||
BIBTEX_CODE);
|
||||
if (inset) {
|
||||
if (inset->delDatabase(to_utf8(cmd.argument())))
|
||||
buffer_.updateBibfilesCache();
|
||||
|
@ -255,8 +255,8 @@ namespace {
|
||||
odocstringstream ods;
|
||||
ods << '\n';
|
||||
// only add blank line if we're not in an ERT or Listings inset
|
||||
if (par.ownerCode() != Inset::ERT_CODE
|
||||
&& par.ownerCode() != Inset::LISTINGS_CODE)
|
||||
if (par.ownerCode() != ERT_CODE
|
||||
&& par.ownerCode() != LISTINGS_CODE)
|
||||
ods << '\n';
|
||||
return ods.str();
|
||||
}
|
||||
|
@ -130,8 +130,8 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
|
||||
// Convert newline to paragraph break in ERT inset.
|
||||
// This should not be here!
|
||||
if (pars[pit].inInset() &&
|
||||
(pars[pit].inInset()->lyxCode() == Inset::ERT_CODE ||
|
||||
pars[pit].inInset()->lyxCode() == Inset::LISTINGS_CODE)) {
|
||||
(pars[pit].inInset()->lyxCode() == ERT_CODE ||
|
||||
pars[pit].inInset()->lyxCode() == LISTINGS_CODE)) {
|
||||
for (ParagraphList::size_type i = 0; i < insertion.size(); ++i) {
|
||||
for (pos_type j = 0; j < insertion[i].size(); ++j) {
|
||||
if (insertion[i].isNewline(j)) {
|
||||
@ -223,7 +223,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
|
||||
|
||||
for (; lit != eit; ++lit) {
|
||||
switch (lit->inset->lyxCode()) {
|
||||
case Inset::TABULAR_CODE: {
|
||||
case TABULAR_CODE: {
|
||||
InsetTabular * it = static_cast<InsetTabular*>(lit->inset);
|
||||
it->buffer(&buffer);
|
||||
break;
|
||||
@ -373,7 +373,7 @@ void copySelectionHelper(Buffer const & buf, ParagraphList & pars,
|
||||
// ERT paragraphs have the Language latex_language.
|
||||
// This is invalid outside of ERT, so we need to change it
|
||||
// to the buffer language.
|
||||
if (it->ownerCode() == Inset::ERT_CODE || it->ownerCode() == Inset::LISTINGS_CODE) {
|
||||
if (it->ownerCode() == ERT_CODE || it->ownerCode() == LISTINGS_CODE) {
|
||||
it->changeLanguage(buf.params(), latex_language,
|
||||
buf.getLanguage());
|
||||
}
|
||||
@ -442,7 +442,7 @@ void switchBetweenClasses(TextClassPtr const & c1,
|
||||
// character styles
|
||||
InsetIterator const i_end = inset_iterator_end(in);
|
||||
for (InsetIterator it = inset_iterator_begin(in); it != i_end; ++it) {
|
||||
if (it->lyxCode() == Inset::FLEX_CODE) {
|
||||
if (it->lyxCode() == FLEX_CODE) {
|
||||
InsetFlex & inset =
|
||||
static_cast<InsetFlex &>(*it);
|
||||
string const name = inset.params().name;
|
||||
|
@ -95,7 +95,7 @@ Inset * DocIterator::realInset() const
|
||||
{
|
||||
BOOST_ASSERT(inTexted());
|
||||
// if we are in a tabular, we need the cell
|
||||
if (inset().lyxCode() == Inset::TABULAR_CODE) {
|
||||
if (inset().lyxCode() == TABULAR_CODE) {
|
||||
InsetTabular & tabular = static_cast<InsetTabular&>(inset());
|
||||
return tabular.cell(idx()).get();
|
||||
}
|
||||
|
@ -574,8 +574,8 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
if (!view())
|
||||
enable = false;
|
||||
else {
|
||||
Inset::Code ic = view()->cursor().inset().lyxCode();
|
||||
enable = ic != Inset::ERT_CODE && ic != Inset::LISTINGS_CODE;
|
||||
InsetCode ic = view()->cursor().inset().lyxCode();
|
||||
enable = ic != ERT_CODE && ic != LISTINGS_CODE;
|
||||
}
|
||||
}
|
||||
else if (name == "latexlog")
|
||||
@ -1686,7 +1686,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
string action;
|
||||
string const name = split(argument, action, ' ');
|
||||
Inset::Code const inset_code =
|
||||
InsetCode const inset_code =
|
||||
Inset::translate(name);
|
||||
|
||||
Cursor & cur = view()->cursor();
|
||||
@ -1697,7 +1697,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
InsetIterator const end = inset_iterator_end(inset);
|
||||
for (; it != end; ++it) {
|
||||
if (!it->asInsetMath()
|
||||
&& (inset_code == Inset::NO_CODE
|
||||
&& (inset_code == NO_CODE
|
||||
|| inset_code == it->lyxCode())) {
|
||||
Cursor tmpcur = cur;
|
||||
tmpcur.pushLeft(*it);
|
||||
@ -1783,7 +1783,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
InsetIterator it = inset_iterator_begin(inset);
|
||||
InsetIterator const end = inset_iterator_end(inset);
|
||||
for (; it != end; ++it)
|
||||
if (it->lyxCode() == Inset::CITE_CODE)
|
||||
if (it->lyxCode() == CITE_CODE)
|
||||
it->dispatch(cur, fr);
|
||||
}
|
||||
|
||||
|
@ -491,6 +491,7 @@ liblyxinsets_la_SOURCES = \
|
||||
insets/InsetCaption.h \
|
||||
insets/InsetCitation.cpp \
|
||||
insets/InsetCitation.h \
|
||||
insets/InsetCode.h \
|
||||
insets/InsetCollapsable.cpp \
|
||||
insets/InsetCollapsable.h \
|
||||
insets/InsetCommand.cpp \
|
||||
|
@ -757,7 +757,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
|
||||
break;
|
||||
|
||||
// FIXME: move this to InsetNewline::latex
|
||||
if (inset->lyxCode() == Inset::NEWLINE_CODE) {
|
||||
if (inset->lyxCode() == NEWLINE_CODE) {
|
||||
// newlines are handled differently here than
|
||||
// the default in simpleTeXSpecialChars().
|
||||
if (!style.newline_allowed) {
|
||||
@ -801,9 +801,9 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
|
||||
bool close = false;
|
||||
odocstream::pos_type const len = os.tellp();
|
||||
|
||||
if ((inset->lyxCode() == Inset::GRAPHICS_CODE
|
||||
|| inset->lyxCode() == Inset::MATH_CODE
|
||||
|| inset->lyxCode() == Inset::URL_CODE)
|
||||
if ((inset->lyxCode() == GRAPHICS_CODE
|
||||
|| inset->lyxCode() == MATH_CODE
|
||||
|| inset->lyxCode() == URL_CODE)
|
||||
&& running_font.isRightToLeft()) {
|
||||
if (running_font.language()->lang() == "farsi")
|
||||
os << "\\beginL{}";
|
||||
@ -1105,7 +1105,7 @@ void Paragraph::Pimpl::validate(LaTeXFeatures & features,
|
||||
if (icit->inset) {
|
||||
icit->inset->validate(features);
|
||||
if (layout.needprotect &&
|
||||
icit->inset->lyxCode() == Inset::FOOT_CODE)
|
||||
icit->inset->lyxCode() == FOOT_CODE)
|
||||
features.require("NeedLyXFootnoteCode");
|
||||
}
|
||||
}
|
||||
@ -1358,7 +1358,7 @@ void Paragraph::insertInset(pos_type pos, Inset * inset,
|
||||
}
|
||||
|
||||
|
||||
bool Paragraph::insetAllowed(Inset_code code)
|
||||
bool Paragraph::insetAllowed(InsetCode code)
|
||||
{
|
||||
return !pimpl_->inset_owner || pimpl_->inset_owner->insetAllowed(code);
|
||||
}
|
||||
@ -1812,7 +1812,7 @@ InsetBibitem * Paragraph::bibitem() const
|
||||
{
|
||||
if (!insetlist.empty()) {
|
||||
Inset * inset = insetlist.begin()->inset;
|
||||
if (inset->lyxCode() == Inset::BIBITEM_CODE)
|
||||
if (inset->lyxCode() == BIBITEM_CODE)
|
||||
return static_cast<InsetBibitem *>(inset);
|
||||
}
|
||||
return 0;
|
||||
@ -1830,9 +1830,9 @@ namespace {
|
||||
// paragraphs inside floats need different alignment tags to avoid
|
||||
// unwanted space
|
||||
|
||||
bool noTrivlistCentering(Inset::Code code)
|
||||
bool noTrivlistCentering(InsetCode code)
|
||||
{
|
||||
return code == Inset::FLOAT_CODE || code == Inset::WRAP_CODE;
|
||||
return code == FLOAT_CODE || code == WRAP_CODE;
|
||||
}
|
||||
|
||||
|
||||
@ -1849,7 +1849,7 @@ string correction(string const & orig)
|
||||
|
||||
|
||||
string const corrected_env(string const & suffix, string const & env,
|
||||
Inset::Code code)
|
||||
InsetCode code)
|
||||
{
|
||||
string output = suffix + "{";
|
||||
if (noTrivlistCentering(code))
|
||||
@ -2302,14 +2302,14 @@ bool Paragraph::emptyTag() const
|
||||
for (pos_type i = 0; i < size(); ++i) {
|
||||
if (isInset(i)) {
|
||||
Inset const * inset = getInset(i);
|
||||
Inset::Code lyx_code = inset->lyxCode();
|
||||
if (lyx_code != Inset::TOC_CODE &&
|
||||
lyx_code != Inset::INCLUDE_CODE &&
|
||||
lyx_code != Inset::GRAPHICS_CODE &&
|
||||
lyx_code != Inset::ERT_CODE &&
|
||||
lyx_code != Inset::LISTINGS_CODE &&
|
||||
lyx_code != Inset::FLOAT_CODE &&
|
||||
lyx_code != Inset::TABULAR_CODE) {
|
||||
InsetCode lyx_code = inset->lyxCode();
|
||||
if (lyx_code != TOC_CODE &&
|
||||
lyx_code != INCLUDE_CODE &&
|
||||
lyx_code != GRAPHICS_CODE &&
|
||||
lyx_code != ERT_CODE &&
|
||||
lyx_code != LISTINGS_CODE &&
|
||||
lyx_code != FLOAT_CODE &&
|
||||
lyx_code != TABULAR_CODE) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@ -2327,8 +2327,8 @@ string Paragraph::getID(Buffer const & buf, OutputParams const & runparams) cons
|
||||
for (pos_type i = 0; i < size(); ++i) {
|
||||
if (isInset(i)) {
|
||||
Inset const * inset = getInset(i);
|
||||
Inset::Code lyx_code = inset->lyxCode();
|
||||
if (lyx_code == Inset::LABEL_CODE) {
|
||||
InsetCode lyx_code = inset->lyxCode();
|
||||
if (lyx_code == LABEL_CODE) {
|
||||
string const id = static_cast<InsetCommand const *>(inset)->getContents();
|
||||
return "id='" + to_utf8(sgml::cleanID(buf, runparams, from_utf8(id))) + "'";
|
||||
}
|
||||
@ -2432,7 +2432,7 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||
bool Paragraph::isNewline(pos_type pos) const
|
||||
{
|
||||
return isInset(pos)
|
||||
&& getInset(pos)->lyxCode() == Inset::NEWLINE_CODE;
|
||||
&& getInset(pos)->lyxCode() == NEWLINE_CODE;
|
||||
}
|
||||
|
||||
|
||||
@ -2471,8 +2471,8 @@ bool Paragraph::isRTL(BufferParams const & bparams) const
|
||||
{
|
||||
return lyxrc.rtl_support
|
||||
&& getParLanguage(bparams)->rightToLeft()
|
||||
&& ownerCode() != Inset::ERT_CODE
|
||||
&& ownerCode() != Inset::LISTINGS_CODE;
|
||||
&& ownerCode() != ERT_CODE
|
||||
&& ownerCode() != LISTINGS_CODE;
|
||||
}
|
||||
|
||||
|
||||
@ -2607,10 +2607,10 @@ Inset * Paragraph::inInset() const
|
||||
}
|
||||
|
||||
|
||||
Inset::Code Paragraph::ownerCode() const
|
||||
InsetCode Paragraph::ownerCode() const
|
||||
{
|
||||
return pimpl_->inset_owner
|
||||
? pimpl_->inset_owner->lyxCode() : Inset::NO_CODE;
|
||||
? pimpl_->inset_owner->lyxCode() : NO_CODE;
|
||||
}
|
||||
|
||||
|
||||
@ -2633,7 +2633,7 @@ bool Paragraph::isFreeSpacing() const
|
||||
|
||||
// for now we just need this, later should we need this in some
|
||||
// other way we can always add a function to Inset too.
|
||||
return ownerCode() == Inset::ERT_CODE || ownerCode() == Inset::LISTINGS_CODE;
|
||||
return ownerCode() == ERT_CODE || ownerCode() == LISTINGS_CODE;
|
||||
}
|
||||
|
||||
|
||||
@ -2641,7 +2641,7 @@ bool Paragraph::allowEmpty() const
|
||||
{
|
||||
if (layout()->keepempty)
|
||||
return true;
|
||||
return ownerCode() == Inset::ERT_CODE || ownerCode() == Inset::LISTINGS_CODE;
|
||||
return ownerCode() == ERT_CODE || ownerCode() == LISTINGS_CODE;
|
||||
}
|
||||
|
||||
|
||||
@ -2698,7 +2698,7 @@ int Paragraph::checkBiblio(bool track_changes)
|
||||
bool hasbibitem = !insetlist.empty()
|
||||
// Insist on it being in pos 0
|
||||
&& getChar(0) == Paragraph::META_INSET
|
||||
&& insetlist.begin()->inset->lyxCode() == Inset::BIBITEM_CODE;
|
||||
&& insetlist.begin()->inset->lyxCode() == BIBITEM_CODE;
|
||||
|
||||
docstring oldkey;
|
||||
docstring oldlabel;
|
||||
@ -2712,7 +2712,7 @@ int Paragraph::checkBiblio(bool track_changes)
|
||||
InsetList::iterator it = insetlist.begin();
|
||||
InsetList::iterator end = insetlist.end();
|
||||
for (; it != end; ++it)
|
||||
if (it->inset->lyxCode() == Inset::BIBITEM_CODE
|
||||
if (it->inset->lyxCode() == BIBITEM_CODE
|
||||
&& it->pos > 0) {
|
||||
InsetBibitem * olditem = static_cast<InsetBibitem *>(it->inset);
|
||||
oldkey = olditem->getParam("key");
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "InsetList.h"
|
||||
#include "lyxlayout_ptr_fwd.h"
|
||||
|
||||
#include "insets/Inset.h" // only for Inset::Code
|
||||
#include "insets/Inset.h" // only for InsetCode
|
||||
|
||||
|
||||
namespace lyx {
|
||||
@ -160,7 +160,7 @@ public:
|
||||
///
|
||||
Inset * inInset() const;
|
||||
///
|
||||
Inset::Code ownerCode() const;
|
||||
InsetCode ownerCode() const;
|
||||
///
|
||||
bool forceDefaultParagraphs() const;
|
||||
|
||||
@ -307,7 +307,7 @@ public:
|
||||
void insertInset(pos_type pos, Inset * inset,
|
||||
Font const &, Change const & change);
|
||||
///
|
||||
bool insetAllowed(Inset_code code);
|
||||
bool insetAllowed(InsetCode code);
|
||||
///
|
||||
Inset * getInset(pos_type pos) {
|
||||
return insetlist.get(pos);
|
||||
@ -320,7 +320,7 @@ public:
|
||||
///
|
||||
bool isHfill(pos_type pos) const {
|
||||
return isInset(pos)
|
||||
&& getInset(pos)->lyxCode() == Inset::HFILL_CODE;
|
||||
&& getInset(pos)->lyxCode() == HFILL_CODE;
|
||||
}
|
||||
/// hinted by profiler
|
||||
bool isInset(pos_type pos) const {
|
||||
|
10
src/Text.cpp
10
src/Text.cpp
@ -1376,17 +1376,17 @@ docstring Text::getPossibleLabel(Cursor & cur) const
|
||||
name = from_ascii(layout->latexname());
|
||||
|
||||
// for captions, we just take the caption type
|
||||
Inset * caption_inset = cur.innerInsetOfType(Inset::CAPTION_CODE);
|
||||
Inset * caption_inset = cur.innerInsetOfType(CAPTION_CODE);
|
||||
if (caption_inset)
|
||||
name = from_ascii(static_cast<InsetCaption *>(caption_inset)->type());
|
||||
|
||||
// If none of the above worked, we'll see if we're inside various
|
||||
// types of insets and take our abbreviation from them.
|
||||
if (name.empty()) {
|
||||
Inset::Code const codes[] = {
|
||||
Inset::FLOAT_CODE,
|
||||
Inset::WRAP_CODE,
|
||||
Inset::FOOT_CODE
|
||||
InsetCode const codes[] = {
|
||||
FLOAT_CODE,
|
||||
WRAP_CODE,
|
||||
FOOT_CODE
|
||||
};
|
||||
for (unsigned int i = 0; i < (sizeof codes / sizeof codes[0]); ++i) {
|
||||
Inset * float_inset = cur.innerInsetOfType(codes[i]);
|
||||
|
100
src/Text3.cpp
100
src/Text3.cpp
@ -652,7 +652,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
// other feature like "automatic labelling".
|
||||
/*
|
||||
Paragraph & par = pars_[cur.pit()];
|
||||
if (inset->lyxCode() == Inset::LABEL_CODE
|
||||
if (inset->lyxCode() == LABEL_CODE
|
||||
&& par.layout()->labeltype == LABEL_COUNTER) {
|
||||
// Go to the end of the paragraph
|
||||
// Warning: Because of Change-Tracking, the last
|
||||
@ -1596,7 +1596,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
Font const & font = cur.real_current_font;
|
||||
bool enable = true;
|
||||
Inset::Code code = Inset::NO_CODE;
|
||||
InsetCode code = NO_CODE;
|
||||
|
||||
switch (cmd.action) {
|
||||
|
||||
@ -1619,88 +1619,88 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
case LFUN_DIALOG_SHOW_NEW_INSET:
|
||||
if (cmd.argument() == "bibitem")
|
||||
code = Inset::BIBITEM_CODE;
|
||||
code = BIBITEM_CODE;
|
||||
else if (cmd.argument() == "bibtex")
|
||||
code = Inset::BIBTEX_CODE;
|
||||
code = BIBTEX_CODE;
|
||||
else if (cmd.argument() == "box")
|
||||
code = Inset::BOX_CODE;
|
||||
code = BOX_CODE;
|
||||
else if (cmd.argument() == "branch")
|
||||
code = Inset::BRANCH_CODE;
|
||||
code = BRANCH_CODE;
|
||||
else if (cmd.argument() == "citation")
|
||||
code = Inset::CITE_CODE;
|
||||
code = CITE_CODE;
|
||||
else if (cmd.argument() == "ert")
|
||||
code = Inset::ERT_CODE;
|
||||
code = ERT_CODE;
|
||||
else if (cmd.argument() == "external")
|
||||
code = Inset::EXTERNAL_CODE;
|
||||
code = EXTERNAL_CODE;
|
||||
else if (cmd.argument() == "float")
|
||||
code = Inset::FLOAT_CODE;
|
||||
code = FLOAT_CODE;
|
||||
else if (cmd.argument() == "graphics")
|
||||
code = Inset::GRAPHICS_CODE;
|
||||
code = GRAPHICS_CODE;
|
||||
else if (cmd.argument() == "include")
|
||||
code = Inset::INCLUDE_CODE;
|
||||
code = INCLUDE_CODE;
|
||||
else if (cmd.argument() == "index")
|
||||
code = Inset::INDEX_CODE;
|
||||
code = INDEX_CODE;
|
||||
else if (cmd.argument() == "nomenclature")
|
||||
code = Inset::NOMENCL_CODE;
|
||||
code = NOMENCL_CODE;
|
||||
else if (cmd.argument() == "label")
|
||||
code = Inset::LABEL_CODE;
|
||||
code = LABEL_CODE;
|
||||
else if (cmd.argument() == "note")
|
||||
code = Inset::NOTE_CODE;
|
||||
code = NOTE_CODE;
|
||||
else if (cmd.argument() == "ref")
|
||||
code = Inset::REF_CODE;
|
||||
code = REF_CODE;
|
||||
else if (cmd.argument() == "toc")
|
||||
code = Inset::TOC_CODE;
|
||||
code = TOC_CODE;
|
||||
else if (cmd.argument() == "url")
|
||||
code = Inset::URL_CODE;
|
||||
code = URL_CODE;
|
||||
else if (cmd.argument() == "vspace")
|
||||
code = Inset::VSPACE_CODE;
|
||||
code = VSPACE_CODE;
|
||||
else if (cmd.argument() == "wrap")
|
||||
code = Inset::WRAP_CODE;
|
||||
code = WRAP_CODE;
|
||||
else if (cmd.argument() == "listings")
|
||||
code = Inset::LISTINGS_CODE;
|
||||
code = LISTINGS_CODE;
|
||||
break;
|
||||
|
||||
case LFUN_ERT_INSERT:
|
||||
code = Inset::ERT_CODE;
|
||||
code = ERT_CODE;
|
||||
break;
|
||||
case LFUN_LISTING_INSERT:
|
||||
code = Inset::LISTINGS_CODE;
|
||||
code = LISTINGS_CODE;
|
||||
break;
|
||||
case LFUN_FOOTNOTE_INSERT:
|
||||
code = Inset::FOOT_CODE;
|
||||
code = FOOT_CODE;
|
||||
break;
|
||||
case LFUN_TABULAR_INSERT:
|
||||
code = Inset::TABULAR_CODE;
|
||||
code = TABULAR_CODE;
|
||||
break;
|
||||
case LFUN_MARGINALNOTE_INSERT:
|
||||
code = Inset::MARGIN_CODE;
|
||||
code = MARGIN_CODE;
|
||||
break;
|
||||
case LFUN_FLOAT_INSERT:
|
||||
case LFUN_FLOAT_WIDE_INSERT:
|
||||
code = Inset::FLOAT_CODE;
|
||||
code = FLOAT_CODE;
|
||||
break;
|
||||
case LFUN_WRAP_INSERT:
|
||||
code = Inset::WRAP_CODE;
|
||||
code = WRAP_CODE;
|
||||
break;
|
||||
case LFUN_FLOAT_LIST:
|
||||
code = Inset::FLOAT_LIST_CODE;
|
||||
code = FLOAT_LIST_CODE;
|
||||
break;
|
||||
#if 0
|
||||
case LFUN_LIST_INSERT:
|
||||
code = Inset::LIST_CODE;
|
||||
code = LIST_CODE;
|
||||
break;
|
||||
case LFUN_THEOREM_INSERT:
|
||||
code = Inset::THEOREM_CODE;
|
||||
code = THEOREM_CODE;
|
||||
break;
|
||||
#endif
|
||||
case LFUN_CAPTION_INSERT:
|
||||
code = Inset::CAPTION_CODE;
|
||||
code = CAPTION_CODE;
|
||||
break;
|
||||
case LFUN_NOTE_INSERT:
|
||||
code = Inset::NOTE_CODE;
|
||||
code = NOTE_CODE;
|
||||
break;
|
||||
case LFUN_FLEX_INSERT: {
|
||||
code = Inset::FLEX_CODE;
|
||||
code = FLEX_CODE;
|
||||
string s = cmd.getArg(0);
|
||||
InsetLayout il = cur.buffer().params().getTextClass().insetlayout(from_utf8(s));
|
||||
if (il.lyxtype != "charstyle" &&
|
||||
@ -1710,45 +1710,45 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
break;
|
||||
}
|
||||
case LFUN_BOX_INSERT:
|
||||
code = Inset::BOX_CODE;
|
||||
code = BOX_CODE;
|
||||
break;
|
||||
case LFUN_BRANCH_INSERT:
|
||||
code = Inset::BRANCH_CODE;
|
||||
code = BRANCH_CODE;
|
||||
if (cur.buffer().getMasterBuffer()->params().branchlist().empty())
|
||||
enable = false;
|
||||
break;
|
||||
case LFUN_LABEL_INSERT:
|
||||
code = Inset::LABEL_CODE;
|
||||
code = LABEL_CODE;
|
||||
break;
|
||||
case LFUN_INFO_INSERT:
|
||||
code = Inset::INFO_CODE;
|
||||
code = INFO_CODE;
|
||||
break;
|
||||
case LFUN_OPTIONAL_INSERT:
|
||||
code = Inset::OPTARG_CODE;
|
||||
code = OPTARG_CODE;
|
||||
enable = numberOfOptArgs(cur.paragraph())
|
||||
< cur.paragraph().layout()->optionalargs;
|
||||
break;
|
||||
case LFUN_ENVIRONMENT_INSERT:
|
||||
code = Inset::BOX_CODE;
|
||||
code = BOX_CODE;
|
||||
break;
|
||||
case LFUN_INDEX_INSERT:
|
||||
code = Inset::INDEX_CODE;
|
||||
code = INDEX_CODE;
|
||||
break;
|
||||
case LFUN_INDEX_PRINT:
|
||||
code = Inset::INDEX_PRINT_CODE;
|
||||
code = INDEX_PRINT_CODE;
|
||||
break;
|
||||
case LFUN_NOMENCL_INSERT:
|
||||
code = Inset::NOMENCL_CODE;
|
||||
code = NOMENCL_CODE;
|
||||
break;
|
||||
case LFUN_NOMENCL_PRINT:
|
||||
code = Inset::NOMENCL_PRINT_CODE;
|
||||
code = NOMENCL_PRINT_CODE;
|
||||
break;
|
||||
case LFUN_TOC_INSERT:
|
||||
code = Inset::TOC_CODE;
|
||||
code = TOC_CODE;
|
||||
break;
|
||||
case LFUN_HTML_INSERT:
|
||||
case LFUN_URL_INSERT:
|
||||
code = Inset::URL_CODE;
|
||||
code = URL_CODE;
|
||||
break;
|
||||
case LFUN_QUOTE_INSERT:
|
||||
// always allow this, since we will inset a raw quote
|
||||
@ -1760,12 +1760,12 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_MENU_SEPARATOR_INSERT:
|
||||
case LFUN_DOTS_INSERT:
|
||||
case LFUN_END_OF_SENTENCE_PERIOD_INSERT:
|
||||
code = Inset::SPECIALCHAR_CODE;
|
||||
code = SPECIALCHAR_CODE;
|
||||
break;
|
||||
case LFUN_SPACE_INSERT:
|
||||
// slight hack: we know this is allowed in math mode
|
||||
if (cur.inTexted())
|
||||
code = Inset::SPACE_CODE;
|
||||
code = SPACE_CODE;
|
||||
break;
|
||||
|
||||
case LFUN_INSET_MODIFY:
|
||||
@ -1955,7 +1955,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (code != Inset::NO_CODE
|
||||
if (code != NO_CODE
|
||||
&& (cur.empty() || !cur.inset().insetAllowed(code)))
|
||||
enable = false;
|
||||
|
||||
|
@ -902,8 +902,8 @@ boost::tuple<int, int> TextMetrics::rowHeight(pit_type const pit, pos_type const
|
||||
// some parskips VERY EASY IMPLEMENTATION
|
||||
if (bufparams.paragraph_separation
|
||||
== BufferParams::PARSEP_SKIP
|
||||
&& par.ownerCode() != Inset::ERT_CODE
|
||||
&& par.ownerCode() != Inset::LISTINGS_CODE
|
||||
&& par.ownerCode() != ERT_CODE
|
||||
&& par.ownerCode() != LISTINGS_CODE
|
||||
&& pit > 0
|
||||
&& ((layout->isParagraph() && par.getDepth() == 0)
|
||||
|| (pars[pit - 1].layout()->isParagraph()
|
||||
|
@ -113,7 +113,7 @@ void TocBackend::updateItem(ParConstIterator const & par_it)
|
||||
InsetList::const_iterator end = toc_item->par_it_->insetlist.end();
|
||||
for (; it != end; ++it) {
|
||||
Inset & inset = *it->inset;
|
||||
if (inset.lyxCode() == Inset::OPTARG_CODE) {
|
||||
if (inset.lyxCode() == OPTARG_CODE) {
|
||||
if (!tocstring.empty())
|
||||
break;
|
||||
Paragraph const & par =
|
||||
@ -158,7 +158,7 @@ void TocBackend::update()
|
||||
Inset & inset = *it->inset;
|
||||
inset.addToToc(tocs_, *buffer_, pit);
|
||||
switch (inset.lyxCode()) {
|
||||
case Inset::OPTARG_CODE: {
|
||||
case OPTARG_CODE: {
|
||||
if (!tocstring.empty())
|
||||
break;
|
||||
Paragraph const & par =
|
||||
|
@ -655,7 +655,7 @@ void loadChildDocuments(Buffer const & buf)
|
||||
bool parse_error = false;
|
||||
|
||||
for (InsetIterator it = inset_iterator_begin(buf.inset()); it; ++it) {
|
||||
if (it->lyxCode() != Inset::INCLUDE_CODE)
|
||||
if (it->lyxCode() != INCLUDE_CODE)
|
||||
continue;
|
||||
InsetInclude const & inset = static_cast<InsetInclude const &>(*it);
|
||||
InsetCommandParams const & ip = inset.params();
|
||||
|
@ -393,8 +393,8 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
|
||||
lex.pushToken(insetType);
|
||||
|
||||
//FIXME
|
||||
//Inset::Code const code = Inset::translate(insetType);
|
||||
//if (code == Inset::NO_CODE) { choke as below; }
|
||||
//InsetCode const code = Inset::translate(insetType);
|
||||
//if (code == NO_CODE) { choke as below; }
|
||||
//InsetCommandParams inscmd();
|
||||
InsetCommandParams inscmd(insetType);
|
||||
inscmd.read(lex);
|
||||
@ -513,7 +513,7 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
|
||||
inset->read(buf, lex);
|
||||
|
||||
// FIXME: hack..
|
||||
if (inset->lyxCode() == Inset::MATHMACRO_CODE) {
|
||||
if (inset->lyxCode() == MATHMACRO_CODE) {
|
||||
MathMacroTemplate const * tmpl =
|
||||
static_cast<MathMacroTemplate*>(inset.get());
|
||||
MacroTable::globalMacros().insert
|
||||
|
@ -952,7 +952,7 @@ bool GuiTabular::initialiseParams(string const & data)
|
||||
// get the innermost tabular inset;
|
||||
// assume that it is "ours"
|
||||
for (int i = cur.depth() - 1; i >= 0; --i)
|
||||
if (cur[i].inset().lyxCode() == Inset::TABULAR_CODE) {
|
||||
if (cur[i].inset().lyxCode() == TABULAR_CODE) {
|
||||
current_inset = static_cast<InsetTabular const *>(&cur[i].inset());
|
||||
active_cell_ = cur[i].idx();
|
||||
break;
|
||||
|
@ -725,7 +725,7 @@ void PreviewLoader::Impl::dumpPreamble(odocstream & os) const
|
||||
InsetIterator const end = inset_iterator_end(inset);
|
||||
|
||||
for (; it != end; ++it)
|
||||
if (it->lyxCode() == Inset::MATHMACRO_CODE)
|
||||
if (it->lyxCode() == MATHMACRO_CODE)
|
||||
it->latex(buffer_, os, runparams);
|
||||
|
||||
// All equation labels appear as "(#)" + preview.sty's rendering of
|
||||
|
@ -47,69 +47,69 @@ namespace lyx {
|
||||
|
||||
class InsetName {
|
||||
public:
|
||||
InsetName(std::string const & n, Inset::Code c)
|
||||
InsetName(std::string const & n, InsetCode c)
|
||||
: name(n), code(c) {}
|
||||
std::string name;
|
||||
Inset::Code code;
|
||||
InsetCode code;
|
||||
};
|
||||
|
||||
|
||||
typedef std::map<std::string, Inset::Code> TranslatorMap;
|
||||
typedef std::map<std::string, InsetCode> TranslatorMap;
|
||||
|
||||
|
||||
static TranslatorMap const build_translator()
|
||||
{
|
||||
InsetName const insetnames[] = {
|
||||
InsetName("toc", Inset::TOC_CODE),
|
||||
InsetName("quote", Inset::QUOTE_CODE),
|
||||
InsetName("ref", Inset::REF_CODE),
|
||||
InsetName("url", Inset::URL_CODE),
|
||||
InsetName("htmlurl", Inset::HTMLURL_CODE),
|
||||
InsetName("separator", Inset::SEPARATOR_CODE),
|
||||
InsetName("ending", Inset::ENDING_CODE),
|
||||
InsetName("label", Inset::LABEL_CODE),
|
||||
InsetName("note", Inset::NOTE_CODE),
|
||||
InsetName("accent", Inset::ACCENT_CODE),
|
||||
InsetName("math", Inset::MATH_CODE),
|
||||
InsetName("index", Inset::INDEX_CODE),
|
||||
InsetName("nomenclature", Inset::NOMENCL_CODE),
|
||||
InsetName("include", Inset::INCLUDE_CODE),
|
||||
InsetName("graphics", Inset::GRAPHICS_CODE),
|
||||
InsetName("bibitem", Inset::BIBITEM_CODE),
|
||||
InsetName("bibtex", Inset::BIBTEX_CODE),
|
||||
InsetName("text", Inset::TEXT_CODE),
|
||||
InsetName("ert", Inset::ERT_CODE),
|
||||
InsetName("foot", Inset::FOOT_CODE),
|
||||
InsetName("margin", Inset::MARGIN_CODE),
|
||||
InsetName("float", Inset::FLOAT_CODE),
|
||||
InsetName("wrap", Inset::WRAP_CODE),
|
||||
InsetName("specialchar", Inset::SPECIALCHAR_CODE),
|
||||
InsetName("tabular", Inset::TABULAR_CODE),
|
||||
InsetName("external", Inset::EXTERNAL_CODE),
|
||||
InsetName("caption", Inset::CAPTION_CODE),
|
||||
InsetName("mathmacro", Inset::MATHMACRO_CODE),
|
||||
InsetName("citation", Inset::CITE_CODE),
|
||||
InsetName("floatlist", Inset::FLOAT_LIST_CODE),
|
||||
InsetName("index_print", Inset::INDEX_PRINT_CODE),
|
||||
InsetName("nomencl_print", Inset::NOMENCL_PRINT_CODE),
|
||||
InsetName("optarg", Inset::OPTARG_CODE),
|
||||
InsetName("environment", Inset::ENVIRONMENT_CODE),
|
||||
InsetName("hfill", Inset::HFILL_CODE),
|
||||
InsetName("newline", Inset::NEWLINE_CODE),
|
||||
InsetName("line", Inset::LINE_CODE),
|
||||
InsetName("branch", Inset::BRANCH_CODE),
|
||||
InsetName("box", Inset::BOX_CODE),
|
||||
InsetName("flex", Inset::FLEX_CODE),
|
||||
InsetName("vspace", Inset::VSPACE_CODE),
|
||||
InsetName("mathmacroarg", Inset::MATHMACROARG_CODE),
|
||||
InsetName("listings", Inset::LISTINGS_CODE),
|
||||
InsetName("info", Inset::INFO_CODE),
|
||||
InsetName("toc", TOC_CODE),
|
||||
InsetName("quote", QUOTE_CODE),
|
||||
InsetName("ref", REF_CODE),
|
||||
InsetName("url", URL_CODE),
|
||||
InsetName("htmlurl", HTMLURL_CODE),
|
||||
InsetName("separator", SEPARATOR_CODE),
|
||||
InsetName("ending", ENDING_CODE),
|
||||
InsetName("label", LABEL_CODE),
|
||||
InsetName("note", NOTE_CODE),
|
||||
InsetName("accent", ACCENT_CODE),
|
||||
InsetName("math", MATH_CODE),
|
||||
InsetName("index", INDEX_CODE),
|
||||
InsetName("nomenclature", NOMENCL_CODE),
|
||||
InsetName("include", INCLUDE_CODE),
|
||||
InsetName("graphics", GRAPHICS_CODE),
|
||||
InsetName("bibitem", BIBITEM_CODE),
|
||||
InsetName("bibtex", BIBTEX_CODE),
|
||||
InsetName("text", TEXT_CODE),
|
||||
InsetName("ert", ERT_CODE),
|
||||
InsetName("foot", FOOT_CODE),
|
||||
InsetName("margin", MARGIN_CODE),
|
||||
InsetName("float", FLOAT_CODE),
|
||||
InsetName("wrap", WRAP_CODE),
|
||||
InsetName("specialchar", SPECIALCHAR_CODE),
|
||||
InsetName("tabular", TABULAR_CODE),
|
||||
InsetName("external", EXTERNAL_CODE),
|
||||
InsetName("caption", CAPTION_CODE),
|
||||
InsetName("mathmacro", MATHMACRO_CODE),
|
||||
InsetName("citation", CITE_CODE),
|
||||
InsetName("floatlist", FLOAT_LIST_CODE),
|
||||
InsetName("index_print", INDEX_PRINT_CODE),
|
||||
InsetName("nomencl_print", NOMENCL_PRINT_CODE),
|
||||
InsetName("optarg", OPTARG_CODE),
|
||||
InsetName("environment", ENVIRONMENT_CODE),
|
||||
InsetName("hfill", HFILL_CODE),
|
||||
InsetName("newline", NEWLINE_CODE),
|
||||
InsetName("line", LINE_CODE),
|
||||
InsetName("branch", BRANCH_CODE),
|
||||
InsetName("box", BOX_CODE),
|
||||
InsetName("flex", FLEX_CODE),
|
||||
InsetName("vspace", VSPACE_CODE),
|
||||
InsetName("mathmacroarg", MATHMACROARG_CODE),
|
||||
InsetName("listings", LISTINGS_CODE),
|
||||
InsetName("info", INFO_CODE),
|
||||
};
|
||||
|
||||
std::size_t const insetnames_size =
|
||||
sizeof(insetnames) / sizeof(insetnames[0]);
|
||||
|
||||
std::map<std::string, Inset::Code> data;
|
||||
std::map<std::string, InsetCode> data;
|
||||
for (std::size_t i = 0; i != insetnames_size; ++i) {
|
||||
InsetName const & var = insetnames[i];
|
||||
data[var.name] = var.code;
|
||||
@ -129,7 +129,7 @@ Dimension const Inset::dimension(BufferView const & bv) const
|
||||
}
|
||||
|
||||
|
||||
Inset::Code Inset::translate(std::string const & name)
|
||||
InsetCode Inset::translate(std::string const & name)
|
||||
{
|
||||
static TranslatorMap const translator = build_translator();
|
||||
|
||||
|
@ -15,6 +15,8 @@
|
||||
#ifndef INSETBASE_H
|
||||
#define INSETBASE_H
|
||||
|
||||
#include "InsetCode.h"
|
||||
|
||||
#include "Dimension.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
@ -264,121 +266,13 @@ public:
|
||||
/// return true if the inset should be removed automatically
|
||||
virtual bool autoDelete() const;
|
||||
|
||||
/** This is not quite the correct place for this enum. I think
|
||||
the correct would be to let each subclass of Inset declare
|
||||
its own enum code. Actually the notion of an Inset::Code
|
||||
should be avoided, but I am not sure how this could be done
|
||||
in a cleaner way. */
|
||||
enum Code {
|
||||
///
|
||||
NO_CODE, // 0
|
||||
///
|
||||
TOC_CODE, // do these insets really need a code? (ale)
|
||||
///
|
||||
QUOTE_CODE,
|
||||
///
|
||||
MARK_CODE,
|
||||
///
|
||||
REF_CODE,
|
||||
///
|
||||
URL_CODE, // 5
|
||||
///
|
||||
HTMLURL_CODE,
|
||||
///
|
||||
SEPARATOR_CODE,
|
||||
///
|
||||
ENDING_CODE,
|
||||
///
|
||||
LABEL_CODE,
|
||||
///
|
||||
NOTE_CODE, // 10
|
||||
///
|
||||
ACCENT_CODE,
|
||||
///
|
||||
MATH_CODE,
|
||||
///
|
||||
INDEX_CODE,
|
||||
///
|
||||
INCLUDE_CODE,
|
||||
///
|
||||
GRAPHICS_CODE, // 15
|
||||
///
|
||||
BIBITEM_CODE,
|
||||
///
|
||||
BIBTEX_CODE,
|
||||
///
|
||||
TEXT_CODE,
|
||||
///
|
||||
ERT_CODE,
|
||||
///
|
||||
FOOT_CODE, // 20
|
||||
///
|
||||
MARGIN_CODE,
|
||||
///
|
||||
FLOAT_CODE,
|
||||
///
|
||||
WRAP_CODE,
|
||||
///
|
||||
SPACE_CODE, // 25
|
||||
///
|
||||
SPECIALCHAR_CODE,
|
||||
///
|
||||
TABULAR_CODE,
|
||||
///
|
||||
EXTERNAL_CODE,
|
||||
#if 0
|
||||
///
|
||||
THEOREM_CODE,
|
||||
#endif
|
||||
///
|
||||
CAPTION_CODE,
|
||||
///
|
||||
MATHMACRO_CODE, // 30
|
||||
///
|
||||
CITE_CODE,
|
||||
///
|
||||
FLOAT_LIST_CODE,
|
||||
///
|
||||
INDEX_PRINT_CODE,
|
||||
///
|
||||
OPTARG_CODE, // 35
|
||||
///
|
||||
ENVIRONMENT_CODE,
|
||||
///
|
||||
HFILL_CODE,
|
||||
///
|
||||
NEWLINE_CODE,
|
||||
///
|
||||
LINE_CODE,
|
||||
///
|
||||
BRANCH_CODE, // 40
|
||||
///
|
||||
BOX_CODE,
|
||||
///
|
||||
FLEX_CODE,
|
||||
///
|
||||
VSPACE_CODE,
|
||||
///
|
||||
MATHMACROARG_CODE,
|
||||
///
|
||||
NOMENCL_CODE, // 45
|
||||
///
|
||||
NOMENCL_PRINT_CODE,
|
||||
///
|
||||
PAGEBREAK_CODE,
|
||||
///
|
||||
LISTINGS_CODE,
|
||||
///
|
||||
INFO_CODE,
|
||||
};
|
||||
|
||||
/** returns the Code corresponding to the \c name.
|
||||
/** returns the InsetCode corresponding to the \c name.
|
||||
* Eg, translate("branch") == BRANCH_CODE
|
||||
*/
|
||||
static Code translate(std::string const & name);
|
||||
static InsetCode translate(std::string const & name);
|
||||
|
||||
/// returns true if the inset can hold an inset of given type
|
||||
virtual bool insetAllowed(Code) const { return false; }
|
||||
virtual bool insetAllowed(InsetCode) const { return false; }
|
||||
/// if this inset has paragraphs should they be output all as default
|
||||
/// paragraphs with the default layout of the text class?
|
||||
virtual bool forceDefaultParagraphs(idx_type) const { return false; }
|
||||
@ -457,7 +351,7 @@ public:
|
||||
|
||||
public:
|
||||
/// returns LyX code associated with the inset. Used for TOC, ...)
|
||||
virtual Code lyxCode() const { return NO_CODE; }
|
||||
virtual InsetCode lyxCode() const { return NO_CODE; }
|
||||
|
||||
/// -1: text mode, 1: math mode, 0 undecided
|
||||
enum mode_type {UNDECIDED_MODE, TEXT_MODE, MATH_MODE};
|
||||
@ -534,18 +428,6 @@ bool isEditableInset(Inset const * inset);
|
||||
*/
|
||||
bool isHighlyEditableInset(Inset const * inset);
|
||||
|
||||
/** \c Inset_code is a wrapper for Inset::Code.
|
||||
* It can be forward-declared and passed as a function argument without
|
||||
* having to expose Inset.h.
|
||||
*/
|
||||
class Inset_code {
|
||||
Inset::Code val_;
|
||||
public:
|
||||
Inset_code(Inset::Code val) : val_(val) {}
|
||||
operator Inset::Code() const { return val_; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
|
@ -67,7 +67,7 @@ void InsetBibitem::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
if (p["key"] != params()["key"])
|
||||
cur.bv().buffer().changeRefsIfUnique(params()["key"],
|
||||
p["key"], Inset::CITE_CODE);
|
||||
p["key"], CITE_CODE);
|
||||
setParams(p);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::BIBITEM_CODE; }
|
||||
InsetCode lyxCode() const { return BIBITEM_CODE; }
|
||||
///
|
||||
docstring const getBibLabel() const;
|
||||
///
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::BIBTEX_CODE; }
|
||||
InsetCode lyxCode() const { return BIBTEX_CODE; }
|
||||
///
|
||||
DisplayType display() const { return AlignCenter; }
|
||||
///
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
///
|
||||
virtual docstring const editMessage() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::BOX_CODE; }
|
||||
InsetCode lyxCode() const { return BOX_CODE; }
|
||||
///
|
||||
void write(Buffer const &, std::ostream &) const;
|
||||
///
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
///
|
||||
virtual docstring const editMessage() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::BRANCH_CODE; }
|
||||
InsetCode lyxCode() const { return BRANCH_CODE; }
|
||||
///
|
||||
void write(Buffer const &, std::ostream &) const;
|
||||
///
|
||||
|
@ -177,7 +177,7 @@ Inset * InsetCaption::editXY(Cursor & cur, int x, int y)
|
||||
}
|
||||
|
||||
|
||||
bool InsetCaption::insetAllowed(Inset::Code code) const
|
||||
bool InsetCaption::insetAllowed(InsetCode code) const
|
||||
{
|
||||
switch (code) {
|
||||
case FLOAT_CODE:
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
///
|
||||
virtual bool neverIndent(Buffer const &) const { return true; }
|
||||
///
|
||||
virtual Inset::Code lyxCode() const;
|
||||
virtual InsetCode lyxCode() const;
|
||||
///
|
||||
virtual docstring const editMessage() const;
|
||||
///
|
||||
@ -53,7 +53,7 @@ public:
|
||||
///
|
||||
virtual Inset * editXY(Cursor & cur, int x, int y);
|
||||
///
|
||||
bool insetAllowed(Inset::Code code) const;
|
||||
bool insetAllowed(InsetCode code) const;
|
||||
///
|
||||
virtual bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
|
||||
// Update the counters of this inset and of its contents
|
||||
@ -108,7 +108,7 @@ Inset::DisplayType InsetCaption::display() const
|
||||
|
||||
|
||||
inline
|
||||
Inset::Code InsetCaption::lyxCode() const
|
||||
InsetCode InsetCaption::lyxCode() const
|
||||
{
|
||||
return CAPTION_CODE;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::CITE_CODE; }
|
||||
InsetCode lyxCode() const { return CITE_CODE; }
|
||||
///
|
||||
int latex(Buffer const &, odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
///
|
||||
int docbook(Buffer const &, odocstream &, OutputParams const & runparams) const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::NO_CODE; }
|
||||
InsetCode lyxCode() const { return NO_CODE; }
|
||||
|
||||
///
|
||||
InsetCommandParams const & params() const { return p_; }
|
||||
|
@ -36,7 +36,7 @@ using support::WarningException;
|
||||
|
||||
|
||||
//FIXME There is no reason now for this to take a string argument.
|
||||
//It'd be much more robust if it took an Inset::Code, since then
|
||||
//It'd be much more robust if it took an InsetCode, since then
|
||||
//the compiler would do some checking for us.
|
||||
InsetCommandParams::InsetCommandParams(string const & insetType)
|
||||
: insetType_(insetType), preview_(false)
|
||||
|
@ -400,7 +400,7 @@ void InsetERT::setButtonLabel()
|
||||
}
|
||||
|
||||
|
||||
bool InsetERT::insetAllowed(Inset::Code /* code */) const
|
||||
bool InsetERT::insetAllowed(InsetCode /* code */) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
///
|
||||
~InsetERT();
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::ERT_CODE; }
|
||||
InsetCode lyxCode() const { return ERT_CODE; }
|
||||
///
|
||||
docstring name() const { return from_ascii("ERT"); }
|
||||
///
|
||||
@ -52,7 +52,7 @@ public:
|
||||
///
|
||||
virtual docstring const editMessage() const;
|
||||
///
|
||||
bool insetAllowed(Inset::Code code) const;
|
||||
bool insetAllowed(InsetCode code) const;
|
||||
///
|
||||
int latex(Buffer const &, odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
///
|
||||
void read(Buffer const & buf, Lexer & lex);
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::ENVIRONMENT_CODE; }
|
||||
InsetCode lyxCode() const { return ENVIRONMENT_CODE; }
|
||||
///
|
||||
int latex(Buffer const &, odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
///
|
||||
virtual ~InsetExternal();
|
||||
///
|
||||
virtual Inset::Code lyxCode() const { return EXTERNAL_CODE; }
|
||||
virtual InsetCode lyxCode() const { return EXTERNAL_CODE; }
|
||||
///
|
||||
virtual EDITABLE editable() const { return IS_EDITABLE; }
|
||||
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
///
|
||||
virtual docstring const editMessage() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::FLEX_CODE; }
|
||||
InsetCode lyxCode() const { return FLEX_CODE; }
|
||||
///
|
||||
void write(Buffer const &, std::ostream &) const;
|
||||
///
|
||||
|
@ -360,11 +360,11 @@ int InsetFloat::docbook(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
bool InsetFloat::insetAllowed(Inset::Code code) const
|
||||
bool InsetFloat::insetAllowed(InsetCode code) const
|
||||
{
|
||||
return code != Inset::FLOAT_CODE
|
||||
&& code != Inset::FOOT_CODE
|
||||
&& code != Inset::MARGIN_CODE;
|
||||
return code != FLOAT_CODE
|
||||
&& code != FOOT_CODE
|
||||
&& code != MARGIN_CODE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::FLOAT_CODE; }
|
||||
InsetCode lyxCode() const { return FLOAT_CODE; }
|
||||
///
|
||||
int latex(Buffer const &, odocstream &,
|
||||
OutputParams const &) const;
|
||||
@ -70,7 +70,7 @@ public:
|
||||
///
|
||||
virtual docstring const editMessage() const;
|
||||
///
|
||||
bool insetAllowed(Inset::Code) const;
|
||||
bool insetAllowed(InsetCode) const;
|
||||
/** returns true if, when outputing LaTeX, font changes should
|
||||
be closed before generating this inset. This is needed for
|
||||
insets that may contain several paragraphs */
|
||||
|
@ -60,9 +60,9 @@ docstring const InsetFloatList::getScreenLabel(Buffer const & buf) const
|
||||
}
|
||||
|
||||
|
||||
Inset::Code InsetFloatList::lyxCode() const
|
||||
InsetCode InsetFloatList::lyxCode() const
|
||||
{
|
||||
return Inset::FLOAT_LIST_CODE;
|
||||
return FLOAT_LIST_CODE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code lyxCode() const;
|
||||
InsetCode lyxCode() const;
|
||||
///
|
||||
DisplayType display() const { return AlignCenter; }
|
||||
///
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
///
|
||||
InsetFoot(BufferParams const &);
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::FOOT_CODE; }
|
||||
InsetCode lyxCode() const { return FOOT_CODE; }
|
||||
///
|
||||
docstring name() const { return from_ascii("Foot"); }
|
||||
///
|
||||
|
@ -56,10 +56,10 @@ void InsetFootlike::write(Buffer const & buf, std::ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
bool InsetFootlike::insetAllowed(Inset::Code code) const
|
||||
bool InsetFootlike::insetAllowed(InsetCode code) const
|
||||
{
|
||||
if (code == Inset::FOOT_CODE || code == Inset::MARGIN_CODE
|
||||
|| code == Inset::FLOAT_CODE)
|
||||
if (code == FOOT_CODE || code == MARGIN_CODE
|
||||
|| code == FLOAT_CODE)
|
||||
return false;
|
||||
return InsetCollapsable::insetAllowed(code);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
///
|
||||
void write(Buffer const & buf, std::ostream & os) const;
|
||||
///
|
||||
bool insetAllowed(Inset::Code) const;
|
||||
bool insetAllowed(InsetCode) const;
|
||||
/** returns true if, when outputing LaTeX, font changes should
|
||||
be closed before generating this inset. This is needed for
|
||||
insets that may contain several paragraphs */
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
|
||||
/// returns LyX code associated with the inset. Used for TOC, ...)
|
||||
Inset::Code lyxCode() const { return Inset::GRAPHICS_CODE; }
|
||||
InsetCode lyxCode() const { return GRAPHICS_CODE; }
|
||||
|
||||
/** Set the inset parameters, used by the GUIndependent dialog.
|
||||
Return true of new params are different from what was so far.
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
///
|
||||
docstring const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::HFILL_CODE; }
|
||||
InsetCode lyxCode() const { return HFILL_CODE; }
|
||||
///
|
||||
int plaintext(Buffer const &, odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
@ -151,7 +151,7 @@ void InsetInclude::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.bv().buffer().changeRefsIfUnique(
|
||||
from_utf8(par_old.getParamValue("label")),
|
||||
from_utf8(par_new.getParamValue("label")),
|
||||
Inset::REF_CODE);
|
||||
REF_CODE);
|
||||
}
|
||||
set(p, cur.buffer());
|
||||
cur.buffer().updateBibfilesCache();
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
InsetCommandParams const & params() const;
|
||||
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::INCLUDE_CODE; }
|
||||
InsetCode lyxCode() const { return INCLUDE_CODE; }
|
||||
/** Fills \c list
|
||||
* \param buffer the Buffer containing this inset.
|
||||
* \param list the list of labels in the child buffer.
|
||||
|
@ -50,9 +50,9 @@ int InsetIndex::docbook(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
Inset::Code InsetIndex::lyxCode() const
|
||||
InsetCode InsetIndex::lyxCode() const
|
||||
{
|
||||
return Inset::INDEX_CODE;
|
||||
return INDEX_CODE;
|
||||
}
|
||||
|
||||
|
||||
@ -130,9 +130,9 @@ void InsetPrintIndex::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
Inset::Code InsetPrintIndex::lyxCode() const
|
||||
InsetCode InsetPrintIndex::lyxCode() const
|
||||
{
|
||||
return Inset::INDEX_PRINT_CODE;
|
||||
return INDEX_PRINT_CODE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code lyxCode() const;
|
||||
InsetCode lyxCode() const;
|
||||
///
|
||||
///
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
@ -67,7 +67,7 @@ public:
|
||||
///
|
||||
EDITABLE editable() const { return NOT_EDITABLE; }
|
||||
///
|
||||
Inset::Code lyxCode() const;
|
||||
InsetCode lyxCode() const;
|
||||
///
|
||||
DisplayType display() const { return AlignCenter; }
|
||||
///
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::INFO_CODE; }
|
||||
InsetCode lyxCode() const { return INFO_CODE; }
|
||||
///
|
||||
void setInfo(std::string const & info);
|
||||
///
|
||||
|
@ -63,7 +63,7 @@ void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
if (p["name"] != params()["name"])
|
||||
cur.bv().buffer().changeRefsIfUnique(params()["name"],
|
||||
p["name"], Inset::REF_CODE);
|
||||
p["name"], REF_CODE);
|
||||
setParams(p);
|
||||
break;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::LABEL_CODE; }
|
||||
InsetCode lyxCode() const { return LABEL_CODE; }
|
||||
/// Appends \c list with this label
|
||||
void getLabelList(Buffer const &, std::vector<docstring> & list) const;
|
||||
///
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
|
||||
InsetLine() {}
|
||||
|
||||
Inset::Code lyxCode() const { return Inset::LINE_CODE; }
|
||||
InsetCode lyxCode() const { return LINE_CODE; }
|
||||
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
|
||||
|
@ -329,7 +329,7 @@ docstring InsetListings::getCaption(Buffer const & buf,
|
||||
InsetList::const_iterator it = pit->insetlist.begin();
|
||||
for (; it != pit->insetlist.end(); ++it) {
|
||||
Inset & inset = *it->inset;
|
||||
if (inset.lyxCode() == Inset::CAPTION_CODE) {
|
||||
if (inset.lyxCode() == CAPTION_CODE) {
|
||||
odocstringstream ods;
|
||||
InsetCaption * ins =
|
||||
static_cast<InsetCaption *>(it->inset);
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
///
|
||||
~InsetListings();
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::LISTINGS_CODE; }
|
||||
InsetCode lyxCode() const { return LISTINGS_CODE; }
|
||||
/// lstinline is inlined, normal listing is displayed
|
||||
virtual DisplayType display() const;
|
||||
///
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
///
|
||||
InsetMarginal(BufferParams const &);
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::MARGIN_CODE; }
|
||||
InsetCode lyxCode() const { return MARGIN_CODE; }
|
||||
///
|
||||
docstring name() const { return from_ascii("Marginal"); }
|
||||
///
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
|
||||
InsetNewline() {}
|
||||
|
||||
Inset::Code lyxCode() const { return Inset::NEWLINE_CODE; }
|
||||
InsetCode lyxCode() const { return NEWLINE_CODE; }
|
||||
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
|
||||
|
@ -70,9 +70,9 @@ void InsetNomencl::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
Inset::Code InsetNomencl::lyxCode() const
|
||||
InsetCode InsetNomencl::lyxCode() const
|
||||
{
|
||||
return Inset::NOMENCL_CODE;
|
||||
return NOMENCL_CODE;
|
||||
}
|
||||
|
||||
|
||||
@ -93,10 +93,10 @@ int InsetPrintNomencl::docbook(Buffer const & buf, odocstream & os,
|
||||
os << "<glossary>\n";
|
||||
int newlines = 2;
|
||||
for (InsetIterator it = inset_iterator_begin(buf.inset()); it;) {
|
||||
if (it->lyxCode() == Inset::NOMENCL_CODE) {
|
||||
if (it->lyxCode() == NOMENCL_CODE) {
|
||||
newlines += static_cast<InsetNomencl const &>(*it).docbookGlossary(os);
|
||||
++it;
|
||||
} else if(it->lyxCode() == Inset::NOTE_CODE &&
|
||||
} else if(it->lyxCode() == NOTE_CODE &&
|
||||
static_cast<InsetNote const &>(*it).params().type == InsetNoteParams::Note) {
|
||||
// Don't output anything nested in note insets
|
||||
size_t const depth = it.depth();
|
||||
@ -118,9 +118,9 @@ void InsetPrintNomencl::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
Inset::Code InsetPrintNomencl::lyxCode() const
|
||||
InsetCode InsetPrintNomencl::lyxCode() const
|
||||
{
|
||||
return Inset::NOMENCL_PRINT_CODE;
|
||||
return NOMENCL_PRINT_CODE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
/// Updates needed features for this inset.
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
Inset::Code lyxCode() const;
|
||||
InsetCode lyxCode() const;
|
||||
///
|
||||
int docbook(Buffer const &, odocstream &,
|
||||
OutputParams const &) const;
|
||||
@ -65,7 +65,7 @@ public:
|
||||
int docbook(Buffer const &, odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
Inset::Code lyxCode() const;
|
||||
InsetCode lyxCode() const;
|
||||
///
|
||||
DisplayType display() const { return AlignCenter; }
|
||||
///
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
///
|
||||
virtual docstring const editMessage() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::NOTE_CODE; }
|
||||
InsetCode lyxCode() const { return NOTE_CODE; }
|
||||
///
|
||||
docstring name() const;
|
||||
/// framed and shaded notes are displayed
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
InsetOptArg(BufferParams const &);
|
||||
|
||||
/// code of the inset
|
||||
Inset::Code lyxCode() const { return Inset::OPTARG_CODE; }
|
||||
InsetCode lyxCode() const { return OPTARG_CODE; }
|
||||
/// return an message upon editing
|
||||
virtual docstring const editMessage() const;
|
||||
|
||||
|
@ -23,7 +23,7 @@ class InsetPagebreak : public Inset {
|
||||
public:
|
||||
InsetPagebreak() {}
|
||||
|
||||
Inset::Code lyxCode() const { return Inset::PAGEBREAK_CODE; }
|
||||
InsetCode lyxCode() const { return PAGEBREAK_CODE; }
|
||||
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
|
||||
|
@ -385,9 +385,9 @@ Inset * InsetQuotes::clone() const
|
||||
}
|
||||
|
||||
|
||||
Inset::Code InsetQuotes::lyxCode() const
|
||||
InsetCode InsetQuotes::lyxCode() const
|
||||
{
|
||||
return Inset::QUOTE_CODE;
|
||||
return QUOTE_CODE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
///
|
||||
Inset::Code lyxCode() const;
|
||||
InsetCode lyxCode() const;
|
||||
// should this inset be handled like a normal character
|
||||
bool isChar() const { return true; }
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Code lyxCode() const { return REF_CODE; }
|
||||
InsetCode lyxCode() const { return REF_CODE; }
|
||||
///
|
||||
DisplayType display() const { return Inline; }
|
||||
///
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
virtual int textString(Buffer const &, odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::SPACE_CODE; }
|
||||
InsetCode lyxCode() const { return SPACE_CODE; }
|
||||
/// We don't need \begin_inset and \end_inset
|
||||
bool directWrite() const { return true; }
|
||||
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
virtual int textString(Buffer const &, odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::SPECIALCHAR_CODE; }
|
||||
InsetCode lyxCode() const { return SPECIALCHAR_CODE; }
|
||||
/// We don't need \begin_inset and \end_inset
|
||||
bool directWrite() const { return true; }
|
||||
///
|
||||
|
@ -48,11 +48,11 @@ docstring const InsetTOC::getScreenLabel(Buffer const & buf) const
|
||||
}
|
||||
|
||||
|
||||
Inset::Code InsetTOC::lyxCode() const
|
||||
InsetCode InsetTOC::lyxCode() const
|
||||
{
|
||||
if (getCmdName() == "tableofcontents")
|
||||
return Inset::TOC_CODE;
|
||||
return Inset::NO_CODE;
|
||||
return TOC_CODE;
|
||||
return NO_CODE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code lyxCode() const;
|
||||
InsetCode lyxCode() const;
|
||||
///
|
||||
DisplayType display() const { return AlignCenter; }
|
||||
///
|
||||
|
@ -3794,7 +3794,7 @@ int InsetTabular::docbook(Buffer const & buf, odocstream & os,
|
||||
// if the table is inside a float it doesn't need the informaltable
|
||||
// wrapper. Search for it.
|
||||
for (master = owner(); master; master = master->owner())
|
||||
if (master->lyxCode() == Inset::FLOAT_CODE)
|
||||
if (master->lyxCode() == FLOAT_CODE)
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
@ -679,7 +679,7 @@ public:
|
||||
///
|
||||
EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
||||
///
|
||||
bool insetAllowed(Inset::Code) const { return true; }
|
||||
bool insetAllowed(InsetCode) const { return true; }
|
||||
///
|
||||
bool allowSpellCheck() const { return true; }
|
||||
///
|
||||
@ -702,7 +702,7 @@ public:
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
Code lyxCode() const { return Inset::TABULAR_CODE; }
|
||||
InsetCode lyxCode() const { return TABULAR_CODE; }
|
||||
/// get offset of this cursor slice relative to our upper left corner
|
||||
void cursorPos(BufferView const & bv, CursorSlice const & sl,
|
||||
bool boundary, int & x, int & y) const;
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
void cursorPos(BufferView const & bv, CursorSlice const & sl,
|
||||
bool boundary, int & x, int & y) const;
|
||||
///
|
||||
Code lyxCode() const { return TEXT_CODE; }
|
||||
InsetCode lyxCode() const { return TEXT_CODE; }
|
||||
///
|
||||
void setText(docstring const &, Font const &, bool trackChanges);
|
||||
///
|
||||
@ -124,7 +124,7 @@ public:
|
||||
///
|
||||
ParagraphList const & paragraphs() const;
|
||||
///
|
||||
bool insetAllowed(Code) const { return true; }
|
||||
bool insetAllowed(InsetCode) const { return true; }
|
||||
///
|
||||
bool allowSpellCheck() const { return true; }
|
||||
/// should paragraph indendation be ommitted in any case?
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
///
|
||||
void write(Buffer const & buf, std::ostream & os) const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::THEOREM_CODE; }
|
||||
InsetCode lyxCode() const { return THEOREM_CODE; }
|
||||
///
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
///
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
explicit
|
||||
InsetUrl(InsetCommandParams const &);
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::URL_CODE; }
|
||||
InsetCode lyxCode() const { return URL_CODE; }
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
///
|
||||
|
@ -260,7 +260,7 @@ int InsetWrap::docbook(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
bool InsetWrap::insetAllowed(Inset::Code code) const
|
||||
bool InsetWrap::insetAllowed(InsetCode code) const
|
||||
{
|
||||
switch(code) {
|
||||
case FLOAT_CODE:
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::WRAP_CODE; }
|
||||
InsetCode lyxCode() const { return WRAP_CODE; }
|
||||
///
|
||||
int latex(Buffer const &, odocstream &,
|
||||
OutputParams const &) const;
|
||||
@ -68,7 +68,7 @@ public:
|
||||
///
|
||||
virtual docstring const editMessage() const;
|
||||
///
|
||||
bool insetAllowed(Inset::Code) const;
|
||||
bool insetAllowed(InsetCode) const;
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
OutputParams const &) const;
|
||||
|
||||
///
|
||||
Inset::Code lyxCode() const { return MATHMACRO_CODE; }
|
||||
InsetCode lyxCode() const { return MATHMACRO_CODE; }
|
||||
///
|
||||
docstring const & getInsetName() const { return name_; }
|
||||
///
|
||||
|
@ -1124,7 +1124,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
docstring old = label(r);
|
||||
if (str != old) {
|
||||
cur.bv().buffer().changeRefsIfUnique(old, str,
|
||||
Inset::REF_CODE);
|
||||
REF_CODE);
|
||||
label(r, str);
|
||||
}
|
||||
break;
|
||||
@ -1363,7 +1363,7 @@ void InsetMathHull::revealCodes(Cursor & cur) const
|
||||
}
|
||||
|
||||
|
||||
Inset::Code InsetMathHull::lyxCode() const
|
||||
InsetCode InsetMathHull::lyxCode() const
|
||||
{
|
||||
return MATH_CODE;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public:
|
||||
/// get notification when the cursor leaves this inset
|
||||
bool notifyCursorLeaves(Cursor & cur);
|
||||
///
|
||||
//bool insetAllowed(Code code) const;
|
||||
//bool insetAllowed(InsetCode code) const;
|
||||
///
|
||||
void addPreview(graphics::PreviewLoader &) const;
|
||||
|
||||
@ -202,7 +202,7 @@ public:
|
||||
///
|
||||
DisplayType display() const;
|
||||
///
|
||||
Code lyxCode() const;
|
||||
InsetCode lyxCode() const;
|
||||
|
||||
protected:
|
||||
///
|
||||
|
@ -1171,7 +1171,9 @@ void InsetMathNest::lfunMousePress(Cursor & cur, FuncRequest & cmd)
|
||||
{
|
||||
//lyxerr << "## lfunMousePress: buttons: " << cmd.button() << endl;
|
||||
BufferView & bv = cur.bv();
|
||||
bv.mouseSetCursor(cur);
|
||||
bool do_selection = cmd.button() == mouse_button::button1
|
||||
&& cmd.argument() == "region-select";
|
||||
bv.mouseSetCursor(cur, do_selection);
|
||||
if (cmd.button() == mouse_button::button1) {
|
||||
//lyxerr << "## lfunMousePress: setting cursor to: " << cur << endl;
|
||||
// Update the cursor update flags as needed:
|
||||
|
@ -55,7 +55,7 @@ void MacroData::expand(vector<MathData> const & args, MathData & to) const
|
||||
for (DocIterator it = doc_iterator_begin(inset); it; it.forwardChar()) {
|
||||
if (!it.nextInset())
|
||||
continue;
|
||||
if (it.nextInset()->lyxCode() != Inset::MATHMACROARG_CODE)
|
||||
if (it.nextInset()->lyxCode() != MATHMACROARG_CODE)
|
||||
continue;
|
||||
//it.cell().erase(it.pos());
|
||||
//it.cell().insert(it.pos(), it.nextInset()->asInsetMath()
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
///
|
||||
std::size_t number() const { return number_; }
|
||||
///
|
||||
Inset::Code lyxCode() const { return MATHMACROARG_CODE; }
|
||||
InsetCode lyxCode() const { return MATHMACROARG_CODE; }
|
||||
|
||||
///
|
||||
void normalize(NormalStream &) const;
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
/// identifies macro templates
|
||||
MathMacroTemplate const * asMacroTemplate() const { return this; }
|
||||
///
|
||||
Inset::Code lyxCode() const { return MATHMACRO_CODE; }
|
||||
InsetCode lyxCode() const { return MATHMACRO_CODE; }
|
||||
|
||||
private:
|
||||
virtual Inset * clone() const;
|
||||
|
@ -226,7 +226,7 @@ int latexOptArgInsets(Buffer const & buf, Paragraph const & par,
|
||||
InsetList::const_iterator it = par.insetlist.begin();
|
||||
InsetList::const_iterator end = par.insetlist.end();
|
||||
for (; it != end && number > 0 ; ++it) {
|
||||
if (it->inset->lyxCode() == Inset::OPTARG_CODE) {
|
||||
if (it->inset->lyxCode() == OPTARG_CODE) {
|
||||
InsetOptArg * ins =
|
||||
static_cast<InsetOptArg *>(it->inset);
|
||||
lines += ins->latexOptional(buf, os, runparams);
|
||||
|
@ -316,7 +316,7 @@ int numberOfOptArgs(Paragraph const & par)
|
||||
InsetList::const_iterator it = par.insetlist.begin();
|
||||
InsetList::const_iterator end = par.insetlist.end();
|
||||
for (; it != end ; ++it) {
|
||||
if (it->inset->lyxCode() == Inset::OPTARG_CODE)
|
||||
if (it->inset->lyxCode() == OPTARG_CODE)
|
||||
++num;
|
||||
}
|
||||
return num;
|
||||
|
Loading…
Reference in New Issue
Block a user