+
+2003-02-17 André Pönitz <poenitz@gmx.net>
+
+ * lauouts/*: Item_Environment -> Bib_Environment for Bibligraphy
+
2003-02-14 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* chkconfig.ltx: information is in LaTeXConfig.lyx, not
# Bibliography style definition
Style Bibliography
Margin First_Dynamic
- LatexType Item_Environment
+ LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
LeftMargin MM
# Bibliography style definition
Style Bibliography
Margin First_Dynamic
- LatexType Item_Environment
+ LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
LeftMargin MM
# Bibliography style definition
Style Bibliography
Margin First_Dynamic
- LatexType Item_Environment
+ LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
LeftMargin MM
# Bibliography style definition
Style Bibliography
Margin First_Dynamic
- LatexType Item_Environment
+ LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
LeftMargin MM
Style Bibliography
Margin Dynamic
- LatexType Item_Environment
+ LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 0
LeftMargin M
EndPreamble
End
+
+
+
+Style Bibliography
+ Margin Static
+ LatexType Bib_Environment
+ LatexName thebibliography
+ NextNoIndent 1
+ LeftMargin MMN
+ LabelSep xx
+ ParSkip 0.0
+ ItemSep 0.2
+ TopSep 0.7
+ BottomSep 0.7
+ ParSep 0.3
+ Align Block
+ AlignPossible Block, Left
+ LabelType Counter_EnumI
+End
# Bibliography style definition
Style Bibliography
Margin First_Dynamic
- LatexType Item_Environment
+ LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
LeftMargin MM
# Bibliography style definition
Style Bibliography
Margin First_Dynamic
- LatexType Item_Environment
+ LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
LeftMargin MM
Item "Footnote|F" "footnote-insert"
Item "Marginal Note|M" "marginalnote-insert"
Item "Short Title" "optional-insert"
+ Item "Bibliography Key" "bibkey-insert"
Item "Index Entry...|I" "index-insert"
Item "URL...|U" "url-insert"
Item "Note|N" "note-insert"
+
+2003-02-17 André Pönitz <poenitz@gmx.net>
+
+ * LyXAction.C:
+ * commandtags.h: new LFUN_INSERT_BIBKEY
+
+ * layout.h:
+ * lyxlayout.C:
+ * buffer.C:
+ * factory.C:
+ * text.C:
+ * text2.C:
+ * text3.C:
+ * paragraph.[Ch]:
+ * paragraph_func.C: remove special bibkey handling
+
2003-02-17 John Levon <levon@movementarian.org>
* text.C (Delete): fix case where delete at the end of
- the very first paragraph would not merge the pars
+ the very first paragraph would not merge the pars
2003-02-17 John Levon <levon@movementarian.org>
2002-10-11 André Pönitz <poenitz@gmx.net>
- * lytext.h: make some functions public to allow access
+ * lyxtext.h: make some functions public to allow access
from inset/lyxtext for handling LFUN_PRIOR/NEXT
2002-10-09 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
Noop },
{ LFUN_INSET_OPTARG, "optional-insert", N_("Insert Optional Argument"),
Noop },
+ { LFUN_INSERT_BIBKEY, "bibkey-insert", N_("Insert Bibliography Key"),
+ Noop },
{ LFUN_LANGUAGE, "language", N_("Change language"), Noop },
{ LFUN_LATEX_LOG, "latex-view-log", N_("View LaTeX log"),
ReadOnly },
inset->read(this, lex);
par->insertInset(pos, inset, font, current_change);
++pos;
+ } else if (token == "\\bibitem") { // ale970302
+ InsetCommandParams p("bibitem", "dummy");
+ InsetBibKey * inset = new InsetBibKey(p);
+ inset->read(this, lex);
+ par->insertInset(pos, inset, font, current_change);
+ ++pos;
} else if (token == "\\hfill") {
par->insertChar(pos, Paragraph::META_HFILL, font, current_change);
++pos;
istr >> aid;
istr >> ct;
current_change = Change(Change::DELETED, author_ids[aid], ct);
- } else if (token == "\\bibitem") { // ale970302
- if (!par->bibkey) {
- InsetCommandParams p("bibitem", "dummy");
- par->bibkey = new InsetBibKey(p);
- }
- par->bibkey->read(this, lex);
} else if (token == "\\the_end") {
the_end_read = true;
} else {
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT:
+ case LATEX_BIB_ENVIRONMENT:
{
string const & latexname = style->latexname();
break;
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT:
+ case LATEX_BIB_ENVIRONMENT:
if (style->latexparam() == "CDATA")
ofs << "]]>";
break;
ParagraphList::iterator pit = paragraphs.begin();
ParagraphList::iterator pend = paragraphs.end();
for (; pit != pend; ++pit) {
- if (pit->bibkey) {
- string const key = pit->bibkey->getContents();
- string const opt = pit->bibkey->getOptions();
+ 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;
LFUN_REJECT_CHANGE, // Levon 20021016
LFUN_ACCEPT_ALL_CHANGES, // Levon 20021016
LFUN_REJECT_ALL_CHANGES, // Levon 20021016
+ LFUN_INSERT_BIBKEY, // André 14 Feb 2003
LFUN_LASTACTION /* this marks the end of the table */
};
#include "BufferView.h"
#include "lyxtext.h"
+#include "insets/insetbib.h"
#include "insets/insetcaption.h"
#include "insets/insetert.h"
#include "insets/insetexternal.h"
case LFUN_INSET_OPTARG:
return new InsetOptArg(params);
+ case LFUN_INSERT_BIBKEY:
+ return new InsetBibKey(InsetCommandParams("bibkey"));
+
case LFUN_INSET_FLOAT:
// check if the float type exists
if (params.getLyXTextClass().floats().typeExist(cmd.argument))
+
+2003-02-17 André Pönitz <poenitz@gmx.net>
+
+ * insetbib.[Ch]: Adjust access to bibkeys
+
2003-02-14 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* insetquotes.C (dispString): remove use of acute accent for "'"
// of time cause LyX3 won't use lyxlex anyway. (ale)
void InsetBibKey::write(Buffer const *, ostream & os) const
{
- os << "\\bibitem ";
- if (! getOptions().empty()) {
- os << '['
- << getOptions() << ']';
- }
+ os << "\n\\layout Bibliography\n\\bibitem ";
+ if (! getOptions().empty())
+ os << '[' << getOptions() << ']';
os << '{'
<< getContents() << "}\n";
}
ParagraphList::iterator it = bv->buffer()->paragraphs.begin();
ParagraphList::iterator end = bv->buffer()->paragraphs.end();
for (; it != end; ++it) {
- if (it->bibkey) {
- int const wx = it->bibkey->width(bv, font);
+ if (it->bibkey()) {
+ int const wx = it->bibkey()->width(bv, font);
if (wx > w)
w = wx;
}
ParagraphList::iterator it = buffer->paragraphs.begin();
ParagraphList::iterator end = buffer->paragraphs.end();
for (; it != end; ++it) {
- if (it->bibkey) {
+ if (it->bibkey()) {
int const wx =
- font_metrics::width(it->bibkey->getBibLabel(),
+ font_metrics::width(it->bibkey()->getBibLabel(),
font);
if (wx > w) {
w = wx;
- bkey = it->bibkey;
+ bkey = it->bibkey();
}
}
}
///
EDITABLE editable() const { return IS_EDITABLE; }
/// A user can't neither insert nor delete this inset
- bool deletable() const {
- return false;
- }
+ //bool deletable() const {
+ // return false;
+ //}
+ /// keep .lyx format compatible
+ bool directWrite() const { return true; }
///
void setCounter(int);
///
///
LATEX_ITEM_ENVIRONMENT,
///
+ LATEX_BIB_ENVIRONMENT,
+ ///
LATEX_LIST_ENVIRONMENT
};
void LyXLayout::readLatexType(LyXLex & lexrc)
{
keyword_item latexTypeTags[] = {
+ { "bib_environment", LATEX_BIB_ENVIRONMENT },
{ "command", LATEX_COMMAND },
{ "environment", LATEX_ENVIRONMENT },
{ "item_environment", LATEX_ITEM_ENVIRONMENT },
case LATEX_COMMAND:
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT:
+ case LATEX_BIB_ENVIRONMENT:
case LATEX_LIST_ENVIRONMENT:
latextype = static_cast<LYX_LATEX_TYPES>(le);
break;
///
bool isEnvironment() const {
return (latextype == LATEX_ENVIRONMENT
+ || latextype == LATEX_BIB_ENVIRONMENT
|| latextype == LATEX_ITEM_ENVIRONMENT
|| latextype == LATEX_LIST_ENVIRONMENT);
}
#endif
enumdepth = 0;
itemdepth = 0;
- bibkey = 0; // ale970302
params().clear();
}
previous_->next_ = this;
// end
- bibkey = 0; // ale970302
params().clear();
}
#endif
// follow footnotes
layout_ = lp.layout();
- // ale970302
- if (lp.bibkey) {
- bibkey = static_cast<InsetBibKey *>
- (lp.bibkey->clone(*current_view->buffer()));
- } else {
- bibkey = 0;
- }
-
// copy everything behind the break-position to the new paragraph
insetlist = lp.insetlist;
InsetList::iterator it = insetlist.begin();
next_->previous_ = previous_;
#endif
- // ale970302
- delete bibkey;
-
delete pimpl_;
//
//lyxerr << "Paragraph::paragraph_id = "
os << "\\align " << string_align[h] << ' ';
}
- // bibitem ale970302
- if (bibkey)
- bibkey->write(buf, os);
-
LyXFont font1(LyXFont::ALL_INHERIT, bparams.language);
Change running_change = Change(Change::UNCHANGED);
// Find the entry.
InsetList::iterator it = insetlist.begin();
InsetList::iterator end = insetlist.end();
- for (; it != end; ++it) {
- if (it.getInset() == inset) {
+ for (; it != end; ++it)
+ if (it.getInset() == inset)
return it.getPos();
- }
- }
- if (inset == bibkey)
- return 0;
-
return -1;
}
+
+InsetBibKey * Paragraph::bibkey()
+{
+ InsetList::iterator it = insetlist.begin();
+ if (it != insetlist.end() && it.getInset()->lyxCode() == Inset::BIBTEX_CODE)
+ return static_cast<InsetBibKey *>(it.getInset());
+ return 0;
+}
+
namespace {
InsetOptArg * optArgInset(Paragraph const & par)
switch (style->latextype) {
case LATEX_COMMAND:
- os << '\\'
- << style->latexname();
+ os << '\\' << style->latexname();
// Separate handling of optional argument inset.
if (style->optionalargs == 1) {
InsetOptArg * it = optArgInset(*this);
- if (it != 0)
+ if (it)
it->latexOptional(buf, os, false, false);
}
else
os << style->latexparam();
break;
case LATEX_ITEM_ENVIRONMENT:
- if (bibkey) {
- bibkey->latex(buf, os, false, false);
- } else
- os << "\\item ";
- break;
case LATEX_LIST_ENVIRONMENT:
os << "\\item ";
break;
+ case LATEX_BIB_ENVIRONMENT:
+ // ignore this, the inset will write itself
+ break;
default:
break;
}
char itemdepth;
///
- InsetBibKey * bibkey; // ale970302
+ InsetBibKey * bibkey(); // ale970302
#ifndef NO_NEXT
///
tmp->params().lineTop(par->params().lineTop());
tmp->params().pagebreakTop(par->params().pagebreakTop());
tmp->params().spaceTop(par->params().spaceTop());
- tmp->bibkey = par->bibkey;
-
- par->bibkey = 0;
par->params().clear();
par->layout(bparams.getLyXTextClass().defaultLayout());
str, font);
}
}
-
- if (layout->labeltype == LABEL_BIBLIO && par->bibkey) {
- LyXFont font = getLayoutFont(buffer, par);
- float x;
- if (is_rtl) {
- x = ww - leftMargin(p.bv, p.row)
- + font_metrics::width(layout->labelsep, font);
- } else {
- x = p.x - font_metrics::width(layout->labelsep, font)
- - par->bibkey->width(p.bv, font);
- }
- par->bibkey->draw(p.bv, font, p.yo + p.row->baseline(), x, p.cleared);
- }
}
Inset * LyXText::getInset() const
{
- Inset * inset = 0;
- if (cursor.pos() == 0 && cursor.par()->bibkey) {
- inset = cursor.par()->bibkey;
- } else if (cursor.pos() < cursor.par()->size()
+ if (cursor.pos() < cursor.par()->size()
&& cursor.par()->isInset(cursor.pos())) {
- inset = cursor.par()->getInset(cursor.pos());
+ return cursor.par()->getInset(cursor.pos());
}
- return inset;
+ return 0;
}
: VSpace(VSpace::NONE));
if (lyxlayout->margintype == MARGIN_MANUAL)
par->setLabelWidthString(lyxlayout->labelstring());
- if (lyxlayout->labeltype != LABEL_BIBLIO
- && fppar->bibkey) {
- delete fppar->bibkey;
- fppar->bibkey = 0;
- }
cur.par(par);
par = par->next();
} while (par != epar);
} else if (layout->labeltype == LABEL_BIBLIO) {// ale970302
textclass.counters().step("bibitem");
int number = textclass.counters().value("bibitem");
- if (!par->bibkey) {
- InsetCommandParams p("bibitem");
- par->bibkey = new InsetBibKey(p);
+ //if (!par->bibkey()) {
+ if (par->bibkey()) {
+ par->bibkey()->setCounter(number);
+ par->params().labelString(layout->labelstring());
}
- par->bibkey->setCounter(number);
- par->params().labelString(layout->labelstring());
-
+ // else {
+ // InsetCommandParams p("bibitem");
+ // par->bibkey() = new InsetBibKey(p);
+ //}
// In biblio should't be following counters but...
} else {
string s = layout->labelstring();
} else {
FuncRequest cmd1(bv, LFUN_MOUSE_RELEASE, x, y, cmd.button());
inset_hit->localDispatch(cmd1);
- // IMO this is a grosshack! Inset's should be changed so that
+ // IMO this is a gross hack! Insets should be changed so that
// they call the actions they have to do with the insetButtonRel.
// function and not in the edit(). This should be changed
// (Jug 20020329)
break;
}
- // Maybe we want to edit a bibitem ale970302
- if (bv->text->cursor.par()->bibkey) {
- bool const is_rtl =
- bv->text->cursor.par()->isRightToLeftPar(bv->buffer()->params);
- int const width =
- bibitemMaxWidth(bv, bv->buffer()->params.getLyXTextClass().defaultfont());
- if ((is_rtl && x > bv->text->workWidth(bv)-20-width) ||
- (!is_rtl && x < 20 + width)) {
- bv->text->cursor.par()->bibkey->edit(bv, 0, 0, mouse_button::none);
- }
- }
break;
}
case LFUN_INSET_CAPTION:
#endif
case LFUN_INSERT_NOTE:
+ case LFUN_INSERT_BIBKEY:
case LFUN_INSET_ERT:
case LFUN_INSET_FLOAT:
case LFUN_INSET_FOOTNOTE: