Remove references to Counter LabelType from source code. The

intention is to use Static in its place, and we now expand the
label for these, as well.
This commit is contained in:
Richard Heck 2013-02-09 11:09:56 -05:00
parent d8a6e0ab70
commit 57d8b059e0
6 changed files with 20 additions and 25 deletions

View File

@ -4364,17 +4364,6 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType utype) const
} }
switch(layout.labeltype) { switch(layout.labeltype) {
case LABEL_COUNTER:
if (layout.toclevel <= bp.secnumdepth
&& (layout.latextype != LATEX_ENVIRONMENT
|| it.text()->isFirstInSequence(it.pit()))) {
if (counters.hasCounter(layout.counter))
counters.step(layout.counter, utype);
par.params().labelString(par.expandLabel(layout, bp));
} else
par.params().labelString(docstring());
break;
case LABEL_ITEMIZE: { case LABEL_ITEMIZE: {
// At some point of time we should do something more // At some point of time we should do something more
// clever here, like: // clever here, like:
@ -4454,14 +4443,28 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType utype) const
par.params().labelString(docstring()); par.params().labelString(docstring());
break; break;
case LABEL_MANUAL:
case LABEL_TOP_ENVIRONMENT: case LABEL_TOP_ENVIRONMENT:
case LABEL_CENTERED_TOP_ENVIRONMENT: case LABEL_CENTERED_TOP_ENVIRONMENT:
case LABEL_STATIC: case LABEL_STATIC: {
case LABEL_BIBLIO: docstring const & lcounter = layout.counter;
if (!lcounter.empty()) {
if (layout.toclevel <= bp.secnumdepth
&& (layout.latextype != LATEX_ENVIRONMENT
|| it.text()->isFirstInSequence(it.pit()))) {
if (counters.hasCounter(lcounter))
counters.step(lcounter, utype);
par.params().labelString(par.expandLabel(layout, bp));
} else
par.params().labelString(docstring());
} else
par.params().labelString(par.expandLabel(layout, bp)); par.params().labelString(par.expandLabel(layout, bp));
break; break;
} }
case LABEL_MANUAL:
case LABEL_BIBLIO:
par.params().labelString(par.expandLabel(layout, bp));
}
} }

View File

@ -688,7 +688,6 @@ void Layout::readLabelType(Lexer & lex)
LA_CENTERED_TOP_ENVIRONMENT, LA_CENTERED_TOP_ENVIRONMENT,
LA_STATIC, LA_STATIC,
LA_SENSITIVE, LA_SENSITIVE,
LA_COUNTER,
LA_ENUMERATE, LA_ENUMERATE,
LA_ITEMIZE, LA_ITEMIZE,
LA_BIBLIO LA_BIBLIO
@ -698,7 +697,6 @@ void Layout::readLabelType(Lexer & lex)
LexerKeyword labelTypeTags[] = { LexerKeyword labelTypeTags[] = {
{ "bibliography", LA_BIBLIO }, { "bibliography", LA_BIBLIO },
{ "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT }, { "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT },
{ "counter", LA_COUNTER },
{ "enumerate", LA_ENUMERATE }, { "enumerate", LA_ENUMERATE },
{ "itemize", LA_ITEMIZE }, { "itemize", LA_ITEMIZE },
{ "manual", LA_MANUAL }, { "manual", LA_MANUAL },
@ -735,9 +733,6 @@ void Layout::readLabelType(Lexer & lex)
case LA_SENSITIVE: case LA_SENSITIVE:
labeltype = LABEL_SENSITIVE; labeltype = LABEL_SENSITIVE;
break; break;
case LA_COUNTER:
labeltype = LABEL_COUNTER;
break;
case LA_ENUMERATE: case LA_ENUMERATE:
labeltype = LABEL_ENUMERATE; labeltype = LABEL_ENUMERATE;
break; break;

View File

@ -123,8 +123,6 @@ enum LabelType {
/// ///
LABEL_SENSITIVE, LABEL_SENSITIVE,
/// ///
LABEL_COUNTER,
///
LABEL_ENUMERATE, LABEL_ENUMERATE,
/// ///
LABEL_ITEMIZE LABEL_ITEMIZE

View File

@ -2084,8 +2084,7 @@ docstring Paragraph::expandParagraphLabel(Layout const & layout,
bool const in_appendix = process_appendix && d->params_.appendix(); bool const in_appendix = process_appendix && d->params_.appendix();
docstring fmt = translateIfPossible(layout.labelstring(in_appendix), lang); docstring fmt = translateIfPossible(layout.labelstring(in_appendix), lang);
if (fmt.empty() && layout.labeltype == LABEL_COUNTER if (fmt.empty() && !layout.counter.empty())
&& !layout.counter.empty())
return tclass.counters().theCounter(layout.counter, lang); return tclass.counters().theCounter(layout.counter, lang);
// handle 'inherited level parts' in 'fmt', // handle 'inherited level parts' in 'fmt',

View File

@ -1097,7 +1097,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
/* /*
Paragraph & par = pars_[cur.pit()]; Paragraph & par = pars_[cur.pit()];
if (inset->lyxCode() == LABEL_CODE if (inset->lyxCode() == LABEL_CODE
&& par.layout().labeltype == LABEL_COUNTER) { && !par.layout().counter.empty() {
// Go to the end of the paragraph // Go to the end of the paragraph
// Warning: Because of Change-Tracking, the last // Warning: Because of Change-Tracking, the last
// position is 'size()' and not 'size()-1': // position is 'size()' and not 'size()-1':

View File

@ -2448,7 +2448,7 @@ void GuiDocument::updateNumbering()
DocumentClass::const_iterator len = tclass.end(); DocumentClass::const_iterator len = tclass.end();
for (; lit != len; ++lit) { for (; lit != len; ++lit) {
int const toclevel = lit->toclevel; int const toclevel = lit->toclevel;
if (toclevel != Layout::NOT_IN_TOC && lit->labeltype == LABEL_COUNTER) { if (toclevel != Layout::NOT_IN_TOC && !lit->counter.empty()) {
item = new QTreeWidgetItem(numberingModule->tocTW); item = new QTreeWidgetItem(numberingModule->tocTW);
item->setText(0, toqstr(translateIfPossible(lit->name()))); item->setText(0, toqstr(translateIfPossible(lit->name())));
item->setText(1, (toclevel <= depth) ? yes : no); item->setText(1, (toclevel <= depth) ? yes : no);