mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 02:28:35 +00:00
Simplify code by using initializer lists for vectors.
{ REFERENCE_NEXT, NOTE_NEXT } can be used as a value for a vector<FuncCode> since C++11.
This commit is contained in:
parent
7761e1317e
commit
8d51b3e7bb
@ -179,13 +179,6 @@ bool findInset(DocIterator & dit, vector<InsetCode> const & codes,
|
||||
}
|
||||
|
||||
|
||||
/// Looks for next inset with the given code
|
||||
void findInset(DocIterator & dit, InsetCode code, bool 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<InsetCode> const & codes,
|
||||
bool same_content)
|
||||
@ -202,13 +195,6 @@ void gotoInset(BufferView * bv, vector<InsetCode> const & codes,
|
||||
}
|
||||
|
||||
|
||||
/// Moves cursor to the next inset with given code.
|
||||
void gotoInset(BufferView * bv, InsetCode code, bool same_content)
|
||||
{
|
||||
gotoInset(bv, vector<InsetCode>(1, code), same_content);
|
||||
}
|
||||
|
||||
|
||||
/// A map from a Text to the associated text metrics
|
||||
typedef map<Text const *, TextMetrics> TextMetricsCache;
|
||||
|
||||
@ -1530,7 +1516,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
}
|
||||
|
||||
case LFUN_NOTE_NEXT:
|
||||
gotoInset(this, NOTE_CODE, false);
|
||||
gotoInset(this, { NOTE_CODE }, false);
|
||||
// FIXME: if SinglePar is changed to act on the inner
|
||||
// paragraph, this will not be OK anymore. The update is
|
||||
// useful for auto-open collapsible insets.
|
||||
@ -1538,10 +1524,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
break;
|
||||
|
||||
case LFUN_REFERENCE_NEXT: {
|
||||
vector<InsetCode> tmp;
|
||||
tmp.push_back(LABEL_CODE);
|
||||
tmp.push_back(REF_CODE);
|
||||
gotoInset(this, tmp, true);
|
||||
gotoInset(this, { LABEL_CODE, REF_CODE }, true);
|
||||
// FIXME: if SinglePar is changed to act on the inner
|
||||
// paragraph, this will not be OK anymore. The update is
|
||||
// useful for auto-open collapsible insets.
|
||||
@ -1723,7 +1706,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
|
||||
case LFUN_BIBTEX_DATABASE_ADD: {
|
||||
Cursor tmpcur = cur;
|
||||
findInset(tmpcur, BIBTEX_CODE, false);
|
||||
findInset(tmpcur, { BIBTEX_CODE }, false);
|
||||
InsetBibtex * inset = getInsetByCode<InsetBibtex>(tmpcur,
|
||||
BIBTEX_CODE);
|
||||
if (inset) {
|
||||
@ -1735,7 +1718,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
|
||||
case LFUN_BIBTEX_DATABASE_DEL: {
|
||||
Cursor tmpcur = cur;
|
||||
findInset(tmpcur, BIBTEX_CODE, false);
|
||||
findInset(tmpcur, { BIBTEX_CODE }, false);
|
||||
InsetBibtex * inset = getInsetByCode<InsetBibtex>(tmpcur,
|
||||
BIBTEX_CODE);
|
||||
if (inset) {
|
||||
|
Loading…
Reference in New Issue
Block a user