mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
Pass Buffer arg to Inset::getLabelList, Inset::fillWithBibKeys.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7794 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9252f9886a
commit
62df753a2e
@ -324,7 +324,7 @@ void BufferView::gotoLabel(string const & label)
|
|||||||
for (Buffer::inset_iterator it = buffer()->inset_iterator_begin();
|
for (Buffer::inset_iterator it = buffer()->inset_iterator_begin();
|
||||||
it != buffer()->inset_iterator_end(); ++it) {
|
it != buffer()->inset_iterator_end(); ++it) {
|
||||||
vector<string> labels;
|
vector<string> labels;
|
||||||
it->getLabelList(labels);
|
it->getLabelList(*buffer(), labels);
|
||||||
if (find(labels.begin(),labels.end(),label) != labels.end()) {
|
if (find(labels.begin(),labels.end(),label) != labels.end()) {
|
||||||
beforeChange(text);
|
beforeChange(text);
|
||||||
text->setCursor(it.getPar(), it.getPos());
|
text->setCursor(it.getPar(), it.getPos());
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2003-09-18 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* buffer.C:
|
||||||
|
* BufferView.C: pass the buffer when calling Inset::getLabelList,
|
||||||
|
Inset::fillWithBibKeys.
|
||||||
|
* tabular.[Ch] (getLabelList): receive, pass on a Buffer const & arg.
|
||||||
|
|
||||||
2003-09-18 Angus Leeming <leeming@lyx.org>
|
2003-09-18 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* LaTeXFeatures.[Ch]: append a '_' to the names of all private member
|
* LaTeXFeatures.[Ch]: append a '_' to the names of all private member
|
||||||
|
23
src/buffer.C
23
src/buffer.C
@ -2140,7 +2140,7 @@ void Buffer::getLabelList(std::vector<string> & list) const
|
|||||||
|
|
||||||
for (inset_iterator it = inset_const_iterator_begin();
|
for (inset_iterator it = inset_const_iterator_begin();
|
||||||
it != inset_const_iterator_end(); ++it) {
|
it != inset_const_iterator_end(); ++it) {
|
||||||
it->getLabelList(list);
|
it->getLabelList(*this, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2161,14 +2161,19 @@ void Buffer::fillWithBibKeys(std::vector<std::pair<string, string> > & keys) con
|
|||||||
|
|
||||||
for (inset_iterator it = inset_const_iterator_begin();
|
for (inset_iterator it = inset_const_iterator_begin();
|
||||||
it != inset_const_iterator_end(); ++it) {
|
it != inset_const_iterator_end(); ++it) {
|
||||||
if (it->lyxCode() == InsetOld::BIBTEX_CODE)
|
if (it->lyxCode() == InsetOld::BIBTEX_CODE) {
|
||||||
static_cast<InsetBibtex &>(*it).fillWithBibKeys(*this, keys);
|
InsetBibtex const & inset =
|
||||||
else if (it->lyxCode() == InsetOld::INCLUDE_CODE)
|
dynamic_cast<InsetBibtex const &>(*it);
|
||||||
static_cast<InsetInclude &>(*it).fillWithBibKeys(keys);
|
inset.fillWithBibKeys(*this, keys);
|
||||||
else if (it->lyxCode() == InsetOld::BIBITEM_CODE) {
|
} else if (it->lyxCode() == InsetOld::INCLUDE_CODE) {
|
||||||
InsetBibitem & bib = static_cast<InsetBibitem &>(*it);
|
InsetInclude const & inset =
|
||||||
string const key = bib.getContents();
|
dynamic_cast<InsetInclude const &>(*it);
|
||||||
string const opt = bib.getOptions();
|
inset.fillWithBibKeys(*this, keys);
|
||||||
|
} else if (it->lyxCode() == InsetOld::BIBITEM_CODE) {
|
||||||
|
InsetBibitem const & inset =
|
||||||
|
dynamic_cast<InsetBibitem const &>(*it);
|
||||||
|
string const key = inset.getContents();
|
||||||
|
string const opt = inset.getOptions();
|
||||||
string const ref; // = pit->asString(this, false);
|
string const ref; // = pit->asString(this, false);
|
||||||
string const info = opt + "TheBibliographyRef" + ref;
|
string const info = opt + "TheBibliographyRef" + ref;
|
||||||
keys.push_back(pair<string, string>(key, info));
|
keys.push_back(pair<string, string>(key, info));
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
2003-09-18 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* insetinsetbase.h (getLabelList):
|
||||||
|
* insetinsetcollapsable.[Ch] (getLabelList):
|
||||||
|
* insetinsetinclude.[Ch] (getLabelList):
|
||||||
|
* insetinsetlabel.[Ch] (getLabelList):
|
||||||
|
* insetinsettabular.[Ch] (getLabelList):
|
||||||
|
* insetinsettext.[Ch] (getLabelList): receive a Buffer const & arg.
|
||||||
|
* insetinsetinclude.[Ch] (fillWithBibKeys): ditto.
|
||||||
|
|
||||||
2003-09-18 Angus Leeming <leeming@lyx.org>
|
2003-09-18 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* insetinclude.[Ch]: remove Params::operator==, operator!= as they're
|
* insetinclude.[Ch]: remove Params::operator==, operator!= as they're
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
class Buffer;
|
||||||
class BufferView;
|
class BufferView;
|
||||||
class FuncRequest;
|
class FuncRequest;
|
||||||
class MetricsInfo;
|
class MetricsInfo;
|
||||||
@ -101,8 +102,9 @@ public:
|
|||||||
virtual BufferView * view() const { return 0; }
|
virtual BufferView * view() const { return 0; }
|
||||||
/// request "external features"
|
/// request "external features"
|
||||||
virtual void validate(LaTeXFeatures &) const {}
|
virtual void validate(LaTeXFeatures &) const {}
|
||||||
/// fill in all labels in the inset
|
/// Appends \c list with all labels found within this inset.
|
||||||
virtual void getLabelList(std::vector<string> &) const {}
|
virtual void getLabelList(Buffer const &,
|
||||||
|
std::vector<string> & /* list */) const {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -435,9 +435,10 @@ void InsetCollapsable::deleteLyXText(BufferView * bv, bool recursive) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::getLabelList(std::vector<string> & list) const
|
void InsetCollapsable::getLabelList(Buffer const & buffer,
|
||||||
|
std::vector<string> & list) const
|
||||||
{
|
{
|
||||||
inset.getLabelList(list);
|
inset.getLabelList(buffer, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,8 +107,8 @@ public:
|
|||||||
LyXText * getLyXText(BufferView const *, bool const recursive) const;
|
LyXText * getLyXText(BufferView const *, bool const recursive) const;
|
||||||
///
|
///
|
||||||
void deleteLyXText(BufferView *, bool recursive=true) const;
|
void deleteLyXText(BufferView *, bool recursive=true) const;
|
||||||
///
|
/// Appends \c list with all labels found within this inset.
|
||||||
void getLabelList(std::vector<string> &) const;
|
void getLabelList(Buffer const &, std::vector<string> & list) const;
|
||||||
///
|
///
|
||||||
int scroll(bool recursive=true) const;
|
int scroll(bool recursive=true) const;
|
||||||
///
|
///
|
||||||
|
@ -504,7 +504,7 @@ void InsetInclude::validate(LaTeXFeatures & features) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetInclude::getLabelList(std::vector<string> & list) const
|
void InsetInclude::getLabelList(Buffer const &, std::vector<string> & list) const
|
||||||
{
|
{
|
||||||
if (loadIfNeeded()) {
|
if (loadIfNeeded()) {
|
||||||
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||||
@ -515,7 +515,8 @@ void InsetInclude::getLabelList(std::vector<string> & list) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetInclude::fillWithBibKeys(std::vector<std::pair<string,string> > & keys) const
|
void InsetInclude::fillWithBibKeys(Buffer const &,
|
||||||
|
std::vector<std::pair<string,string> > & keys) const
|
||||||
{
|
{
|
||||||
if (loadIfNeeded()) {
|
if (loadIfNeeded()) {
|
||||||
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||||
|
@ -62,10 +62,19 @@ public:
|
|||||||
virtual std::auto_ptr<InsetBase> clone() const;
|
virtual std::auto_ptr<InsetBase> clone() const;
|
||||||
///
|
///
|
||||||
InsetOld::Code lyxCode() const { return InsetOld::INCLUDE_CODE; }
|
InsetOld::Code lyxCode() const { return InsetOld::INCLUDE_CODE; }
|
||||||
/// This returns the list of labels on the child buffer
|
/** Fills \c list
|
||||||
void getLabelList(std::vector<string> &) const;
|
* \param buffer the Buffer containing this inset.
|
||||||
/// This returns the list of bibkeys on the child buffer
|
* \param list the list of labels in the child buffer.
|
||||||
void fillWithBibKeys(std::vector<std::pair<string,string> > & keys) const;
|
*/
|
||||||
|
void getLabelList(Buffer const & buffer,
|
||||||
|
std::vector<string> & list) const;
|
||||||
|
/** Fills \c keys
|
||||||
|
* \param buffer the Buffer containing this inset.
|
||||||
|
* \param keys the list of bibkeys in the child buffer.
|
||||||
|
*/
|
||||||
|
///
|
||||||
|
void fillWithBibKeys(Buffer const & buffer,
|
||||||
|
std::vector<std::pair<string,string> > & keys) const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const
|
EDITABLE editable() const
|
||||||
{
|
{
|
||||||
@ -87,15 +96,15 @@ public:
|
|||||||
///
|
///
|
||||||
void validate(LaTeXFeatures &) const;
|
void validate(LaTeXFeatures &) const;
|
||||||
|
|
||||||
/// return true if the file is or got loaded.
|
|
||||||
bool loadIfNeeded() const;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
void addPreview(lyx::graphics::PreviewLoader &) const;
|
void addPreview(lyx::graphics::PreviewLoader &) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class InsetIncludeMailer;
|
friend class InsetIncludeMailer;
|
||||||
|
|
||||||
|
/// return true if the file is or got loaded.
|
||||||
|
bool loadIfNeeded() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
void write(std::ostream &) const;
|
void write(std::ostream &) const;
|
||||||
///
|
///
|
||||||
|
@ -33,7 +33,7 @@ InsetLabel::~InsetLabel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetLabel::getLabelList(std::vector<string> & list) const
|
void InsetLabel::getLabelList(Buffer const &, std::vector<string> & list) const
|
||||||
{
|
{
|
||||||
list.push_back(getContents());
|
list.push_back(getContents());
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ public:
|
|||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
EDITABLE editable() const { return IS_EDITABLE; }
|
||||||
///
|
///
|
||||||
InsetOld::Code lyxCode() const { return InsetOld::LABEL_CODE; }
|
InsetOld::Code lyxCode() const { return InsetOld::LABEL_CODE; }
|
||||||
///
|
/// Appends \c list with this label
|
||||||
void getLabelList(std::vector<string> &) const;
|
void getLabelList(Buffer const &, std::vector<string> & list) const;
|
||||||
///
|
///
|
||||||
int latex(Buffer const &, std::ostream &,
|
int latex(Buffer const &, std::ostream &,
|
||||||
LatexRunParams const &) const;
|
LatexRunParams const &) const;
|
||||||
|
@ -2185,9 +2185,10 @@ FuncStatus InsetTabular::getStatus(string const & what) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::getLabelList(std::vector<string> & list) const
|
void InsetTabular::getLabelList(Buffer const & buffer,
|
||||||
|
std::vector<string> & list) const
|
||||||
{
|
{
|
||||||
tabular.getLabelList(list);
|
tabular.getLabelList(buffer, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,8 +145,8 @@ public:
|
|||||||
bool showInsetDialog(BufferView *) const;
|
bool showInsetDialog(BufferView *) const;
|
||||||
///
|
///
|
||||||
FuncStatus getStatus(string const & argument) const;
|
FuncStatus getStatus(string const & argument) const;
|
||||||
///
|
/// Appends \c list with all labels found within this inset.
|
||||||
void getLabelList(std::vector<string> &) const;
|
void getLabelList(Buffer const &, std::vector<string> & list) const;
|
||||||
///
|
///
|
||||||
int scroll(bool recursive=true) const;
|
int scroll(bool recursive=true) const;
|
||||||
///
|
///
|
||||||
|
@ -1318,7 +1318,8 @@ bool InsetText::showInsetDialog(BufferView * bv) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetText::getLabelList(std::vector<string> & list) const
|
void InsetText::getLabelList(Buffer const & buffer,
|
||||||
|
std::vector<string> & list) const
|
||||||
{
|
{
|
||||||
ParagraphList::const_iterator pit = paragraphs.begin();
|
ParagraphList::const_iterator pit = paragraphs.begin();
|
||||||
ParagraphList::const_iterator pend = paragraphs.end();
|
ParagraphList::const_iterator pend = paragraphs.end();
|
||||||
@ -1326,7 +1327,7 @@ void InsetText::getLabelList(std::vector<string> & list) const
|
|||||||
InsetList::const_iterator beg = pit->insetlist.begin();
|
InsetList::const_iterator beg = pit->insetlist.begin();
|
||||||
InsetList::const_iterator end = pit->insetlist.end();
|
InsetList::const_iterator end = pit->insetlist.end();
|
||||||
for (; beg != end; ++beg)
|
for (; beg != end; ++beg)
|
||||||
beg->inset->getLabelList(list);
|
beg->inset->getLabelList(buffer, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,8 +139,8 @@ public:
|
|||||||
void deleteLyXText(BufferView *, bool recursive = true) const;
|
void deleteLyXText(BufferView *, bool recursive = true) const;
|
||||||
///
|
///
|
||||||
bool showInsetDialog(BufferView *) const;
|
bool showInsetDialog(BufferView *) const;
|
||||||
///
|
/// Appends \c list with all labels found within this inset.
|
||||||
void getLabelList(std::vector<string> &) const;
|
void getLabelList(Buffer const &, std::vector<string> & list) const;
|
||||||
///
|
///
|
||||||
int scroll(bool recursive = true) const;
|
int scroll(bool recursive = true) const;
|
||||||
///
|
///
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2003-09-18 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* matheformula.[Ch] (getLabelList):
|
||||||
|
* mathemath_hullinset.[Ch] (getLabelList):
|
||||||
|
receive a Buffer const & arg.
|
||||||
|
|
||||||
2003-09-18 Angus Leeming <leeming@lyx.org>
|
2003-09-18 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* formula.C (latexString): add a Buffer const & arg.
|
* formula.C (latexString): add a Buffer const & arg.
|
||||||
|
@ -228,9 +228,10 @@ void InsetFormula::draw(PainterInfo & pi, int x, int y) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetFormula::getLabelList(vector<string> & res) const
|
void InsetFormula::getLabelList(Buffer const & buffer,
|
||||||
|
vector<string> & res) const
|
||||||
{
|
{
|
||||||
par()->getLabelList(res);
|
par()->getLabelList(buffer, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,8 +59,9 @@ public:
|
|||||||
InsetOld::Code lyxCode() const;
|
InsetOld::Code lyxCode() const;
|
||||||
///
|
///
|
||||||
bool insetAllowed(InsetOld::Code code) const;
|
bool insetAllowed(InsetOld::Code code) const;
|
||||||
///
|
/// Appends \c list with all labels found within this inset.
|
||||||
void getLabelList(std::vector<string> &) const;
|
void getLabelList(Buffer const &,
|
||||||
|
std::vector<string> & list) const;
|
||||||
///
|
///
|
||||||
MathAtom const & par() const { return par_; }
|
MathAtom const & par() const { return par_; }
|
||||||
///
|
///
|
||||||
|
@ -308,7 +308,8 @@ bool MathHullInset::display() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathHullInset::getLabelList(std::vector<string> & labels) const
|
void MathHullInset::getLabelList(Buffer const &,
|
||||||
|
std::vector<string> & labels) const
|
||||||
{
|
{
|
||||||
for (row_type row = 0; row < nrows(); ++row)
|
for (row_type row = 0; row < nrows(); ++row)
|
||||||
if (!label_[row].empty() && nonum_[row] != 1)
|
if (!label_[row].empty() && nonum_[row] != 1)
|
||||||
|
@ -52,8 +52,9 @@ public:
|
|||||||
bool ams() const;
|
bool ams() const;
|
||||||
/// local dispatcher
|
/// local dispatcher
|
||||||
dispatch_result dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
|
dispatch_result dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
|
||||||
///
|
/// Appends \c list with all labels found within this inset.
|
||||||
void getLabelList(std::vector<string> &) const;
|
void getLabelList(Buffer const &,
|
||||||
|
std::vector<string> & list) const;
|
||||||
///
|
///
|
||||||
void validate(LaTeXFeatures & features) const;
|
void validate(LaTeXFeatures & features) const;
|
||||||
/// identifies MatrixInsets
|
/// identifies MatrixInsets
|
||||||
|
@ -2656,11 +2656,12 @@ void LyXTabular::validate(LaTeXFeatures & features) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXTabular::getLabelList(std::vector<string> & list) const
|
void LyXTabular::getLabelList(Buffer const & buffer,
|
||||||
|
std::vector<string> & list) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < rows_; ++i)
|
for (int i = 0; i < rows_; ++i)
|
||||||
for (int j = 0; j < columns_; ++j)
|
for (int j = 0; j < columns_; ++j)
|
||||||
getCellInset(i, j).getLabelList(list);
|
getCellInset(i, j).getLabelList(buffer, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -377,8 +377,8 @@ public:
|
|||||||
int columns() const { return columns_;}
|
int columns() const { return columns_;}
|
||||||
///
|
///
|
||||||
void validate(LaTeXFeatures &) const;
|
void validate(LaTeXFeatures &) const;
|
||||||
///
|
/// Appends \c list with all labels found within this inset.
|
||||||
void getLabelList(std::vector<string> &) const;
|
void getLabelList(Buffer const &, std::vector<string> & list) const;
|
||||||
///
|
///
|
||||||
/// recalculate the widths/heights only!
|
/// recalculate the widths/heights only!
|
||||||
void reinit();
|
void reinit();
|
||||||
|
Loading…
Reference in New Issue
Block a user