mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
re-enable insertion of bibrefs (and remove 19 lines...)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6195 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a58158344d
commit
2b99c9b189
25
src/buffer.C
25
src/buffer.C
@ -2884,24 +2884,6 @@ vector<pair<string, string> > const Buffer::getBibkeyList() const
|
||||
}
|
||||
|
||||
vector<StringPair> keys;
|
||||
ParagraphList::iterator pit = paragraphs.begin();
|
||||
ParagraphList::iterator pend = paragraphs.end();
|
||||
for (; pit != pend; ++pit) {
|
||||
InsetBibKey * bib = pit->bibkey();
|
||||
if (bib) {
|
||||
string const key = bib->getContents();
|
||||
string const opt = bib->getOptions();
|
||||
string const ref = pit->asString(this, false);
|
||||
string const info = opt + "TheBibliographyRef" + ref;
|
||||
|
||||
keys.push_back(StringPair(key, info));
|
||||
}
|
||||
}
|
||||
|
||||
if (!keys.empty())
|
||||
return keys;
|
||||
|
||||
// Might be either using bibtex or a child has bibliography
|
||||
for (inset_iterator it = inset_const_iterator_begin();
|
||||
it != inset_const_iterator_end(); ++it) {
|
||||
// Search for Bibtex or Include inset
|
||||
@ -2913,6 +2895,13 @@ vector<pair<string, string> > const Buffer::getBibkeyList() const
|
||||
vector<StringPair> const tmp =
|
||||
static_cast<InsetInclude &>(*it).getKeys();
|
||||
keys.insert(keys.end(), tmp.begin(), tmp.end());
|
||||
} else if (it->lyxCode() == Inset::BIBKEY_CODE) {
|
||||
InsetBibKey & bib = static_cast<InsetBibKey &>(*it);
|
||||
string const key = bib.getContents();
|
||||
string const opt = bib.getOptions();
|
||||
string const ref; // = pit->asString(this, false);
|
||||
string const info = opt + "TheBibliographyRef" + ref;
|
||||
keys.push_back(StringPair(key, info));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,7 @@ void fillChoice(FD_citation * dialog, vector<string> vec)
|
||||
{
|
||||
// Check whether the current contents of the browser will be
|
||||
// changed by loading the contents of the vec...
|
||||
vector<string> const choice_style =
|
||||
getVector(dialog->choice_style);
|
||||
vector<string> const choice_style = getVector(dialog->choice_style);
|
||||
|
||||
if (vec == choice_style)
|
||||
return;
|
||||
@ -320,8 +319,7 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
|
||||
// with the selected browser_cite key
|
||||
fl_clear_browser(dialog_->browser_info);
|
||||
string const tmp =
|
||||
formatted(biblio::getInfo(theMap,
|
||||
citekeys[sel - 1]),
|
||||
formatted(biblio::getInfo(theMap, citekeys[sel - 1]),
|
||||
dialog_->browser_info->w - 10);
|
||||
fl_add_browser_line(dialog_->browser_info, tmp.c_str());
|
||||
}
|
||||
@ -433,7 +431,8 @@ void FormCitation::update()
|
||||
|
||||
// Use the first citekey to fill choice_style
|
||||
string key;
|
||||
if (!citekeys.empty()) key = citekeys[0];
|
||||
if (!citekeys.empty())
|
||||
key = citekeys[0];
|
||||
|
||||
fillChoice(dialog_.get(), controller().getCiteStrings(key));
|
||||
|
||||
@ -477,7 +476,7 @@ void FormCitation::updateBrowser(FL_OBJECT * browser,
|
||||
fl_clear_browser(browser);
|
||||
|
||||
for (vector<string>::const_iterator it = keys.begin();
|
||||
it < keys.end(); ++it) {
|
||||
it != keys.end(); ++it) {
|
||||
string key = trim(*it);
|
||||
if (!key.empty())
|
||||
fl_add_browser_line(browser, key.c_str());
|
||||
|
@ -55,9 +55,9 @@ private:
|
||||
///
|
||||
void setCiteButtons(State) const;
|
||||
|
||||
///
|
||||
/// used keys (left panel)
|
||||
std::vector<string> citekeys;
|
||||
///
|
||||
/// available keys (right panel)
|
||||
std::vector<string> bibkeys;
|
||||
};
|
||||
|
||||
|
@ -122,7 +122,9 @@ public:
|
||||
///
|
||||
INDEX_PRINT_CODE,
|
||||
///
|
||||
OPTARG_CODE
|
||||
OPTARG_CODE,
|
||||
///
|
||||
BIBKEY_CODE
|
||||
};
|
||||
|
||||
///
|
||||
|
@ -51,11 +51,6 @@ InsetBibKey::InsetBibKey(InsetCommandParams const & p)
|
||||
}
|
||||
|
||||
|
||||
InsetBibKey::~InsetBibKey()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetBibKey::clone(Buffer const &, bool) const
|
||||
{
|
||||
InsetBibKey * b = new InsetBibKey(params());
|
||||
@ -101,13 +96,13 @@ void InsetBibKey::read(Buffer const *, LyXLex & lex)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string const InsetBibKey::getBibLabel() const
|
||||
{
|
||||
if (! getOptions().empty())
|
||||
return getOptions();
|
||||
return tostr(counter);
|
||||
return getOptions().empty() ? tostr(counter) : getOptions();
|
||||
}
|
||||
|
||||
|
||||
string const InsetBibKey::getScreenLabel(Buffer const *) const
|
||||
{
|
||||
return getContents() + " [" + getBibLabel() + ']';
|
||||
@ -126,16 +121,13 @@ void InsetBibKey::edit(BufferView * bv, bool)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
InsetBibtex::InsetBibtex(InsetCommandParams const & p, bool)
|
||||
: InsetCommand(p)
|
||||
{}
|
||||
|
||||
|
||||
InsetBibtex::~InsetBibtex()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
string const InsetBibtex::getScreenLabel(Buffer const *) const
|
||||
{
|
||||
return _("BibTeX Generated References");
|
||||
@ -241,8 +233,10 @@ vector<string> const InsetBibtex::getFiles(Buffer const & buffer) const
|
||||
return vec;
|
||||
}
|
||||
|
||||
|
||||
// This method returns a comma separated list of Bibtex entries
|
||||
vector<pair<string, string> > const InsetBibtex::getKeys(Buffer const * buffer) const
|
||||
vector<pair<string, string> > const
|
||||
InsetBibtex::getKeys(Buffer const * buffer) const
|
||||
{
|
||||
vector<pair<string,string> > keys;
|
||||
|
||||
|
@ -28,8 +28,6 @@ public:
|
||||
///
|
||||
InsetBibKey(InsetCommandParams const &);
|
||||
///
|
||||
~InsetBibKey();
|
||||
///
|
||||
Inset * clone(Buffer const &, bool same_id = false) const;
|
||||
/** Currently \bibitem is used as a LyX2.x command,
|
||||
so we need this method.
|
||||
@ -45,6 +43,8 @@ public:
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::BIBKEY_CODE; }
|
||||
/// keep .lyx format compatible
|
||||
bool directWrite() const { return true; }
|
||||
///
|
||||
@ -76,8 +76,6 @@ public:
|
||||
///
|
||||
InsetBibtex(InsetCommandParams const &, bool same_id = false);
|
||||
///
|
||||
~InsetBibtex();
|
||||
///
|
||||
Inset * clone(Buffer const &, bool same_id = false) const {
|
||||
return new InsetBibtex(params(), same_id);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user