mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
remove the hardcoded bibkey from the paragraph
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6186 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d06a2364ef
commit
305c04ba8b
@ -1,3 +1,8 @@
|
|||||||
|
|
||||||
|
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>
|
2003-02-14 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||||
|
|
||||||
* chkconfig.ltx: information is in LaTeXConfig.lyx, not
|
* chkconfig.ltx: information is in LaTeXConfig.lyx, not
|
||||||
|
@ -337,7 +337,7 @@ End
|
|||||||
# Bibliography style definition
|
# Bibliography style definition
|
||||||
Style Bibliography
|
Style Bibliography
|
||||||
Margin First_Dynamic
|
Margin First_Dynamic
|
||||||
LatexType Item_Environment
|
LatexType Bib_Environment
|
||||||
LatexName thebibliography
|
LatexName thebibliography
|
||||||
NextNoIndent 1
|
NextNoIndent 1
|
||||||
LeftMargin MM
|
LeftMargin MM
|
||||||
|
@ -104,7 +104,7 @@ End
|
|||||||
# Bibliography style definition
|
# Bibliography style definition
|
||||||
Style Bibliography
|
Style Bibliography
|
||||||
Margin First_Dynamic
|
Margin First_Dynamic
|
||||||
LatexType Item_Environment
|
LatexType Bib_Environment
|
||||||
LatexName thebibliography
|
LatexName thebibliography
|
||||||
NextNoIndent 1
|
NextNoIndent 1
|
||||||
LeftMargin MM
|
LeftMargin MM
|
||||||
|
@ -642,7 +642,7 @@ End
|
|||||||
# Bibliography style definition
|
# Bibliography style definition
|
||||||
Style Bibliography
|
Style Bibliography
|
||||||
Margin First_Dynamic
|
Margin First_Dynamic
|
||||||
LatexType Item_Environment
|
LatexType Bib_Environment
|
||||||
LatexName thebibliography
|
LatexName thebibliography
|
||||||
NextNoIndent 1
|
NextNoIndent 1
|
||||||
LeftMargin MM
|
LeftMargin MM
|
||||||
|
@ -288,7 +288,7 @@ End
|
|||||||
# Bibliography style definition
|
# Bibliography style definition
|
||||||
Style Bibliography
|
Style Bibliography
|
||||||
Margin First_Dynamic
|
Margin First_Dynamic
|
||||||
LatexType Item_Environment
|
LatexType Bib_Environment
|
||||||
LatexName thebibliography
|
LatexName thebibliography
|
||||||
NextNoIndent 1
|
NextNoIndent 1
|
||||||
LeftMargin MM
|
LeftMargin MM
|
||||||
|
@ -170,7 +170,7 @@ End
|
|||||||
|
|
||||||
Style Bibliography
|
Style Bibliography
|
||||||
Margin Dynamic
|
Margin Dynamic
|
||||||
LatexType Item_Environment
|
LatexType Bib_Environment
|
||||||
LatexName thebibliography
|
LatexName thebibliography
|
||||||
NextNoIndent 0
|
NextNoIndent 0
|
||||||
LeftMargin M
|
LeftMargin M
|
||||||
|
@ -93,3 +93,22 @@ Style List
|
|||||||
EndPreamble
|
EndPreamble
|
||||||
|
|
||||||
End
|
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
|
||||||
|
@ -42,7 +42,7 @@ End
|
|||||||
# Bibliography style definition
|
# Bibliography style definition
|
||||||
Style Bibliography
|
Style Bibliography
|
||||||
Margin First_Dynamic
|
Margin First_Dynamic
|
||||||
LatexType Item_Environment
|
LatexType Bib_Environment
|
||||||
LatexName thebibliography
|
LatexName thebibliography
|
||||||
NextNoIndent 1
|
NextNoIndent 1
|
||||||
LeftMargin MM
|
LeftMargin MM
|
||||||
|
@ -352,7 +352,7 @@ End
|
|||||||
# Bibliography style definition
|
# Bibliography style definition
|
||||||
Style Bibliography
|
Style Bibliography
|
||||||
Margin First_Dynamic
|
Margin First_Dynamic
|
||||||
LatexType Item_Environment
|
LatexType Bib_Environment
|
||||||
LatexName thebibliography
|
LatexName thebibliography
|
||||||
NextNoIndent 1
|
NextNoIndent 1
|
||||||
LeftMargin MM
|
LeftMargin MM
|
||||||
|
@ -201,6 +201,7 @@ Menuset
|
|||||||
Item "Footnote|F" "footnote-insert"
|
Item "Footnote|F" "footnote-insert"
|
||||||
Item "Marginal Note|M" "marginalnote-insert"
|
Item "Marginal Note|M" "marginalnote-insert"
|
||||||
Item "Short Title" "optional-insert"
|
Item "Short Title" "optional-insert"
|
||||||
|
Item "Bibliography Key" "bibkey-insert"
|
||||||
Item "Index Entry...|I" "index-insert"
|
Item "Index Entry...|I" "index-insert"
|
||||||
Item "URL...|U" "url-insert"
|
Item "URL...|U" "url-insert"
|
||||||
Item "Note|N" "note-insert"
|
Item "Note|N" "note-insert"
|
||||||
|
@ -1,7 +1,23 @@
|
|||||||
|
|
||||||
|
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>
|
2003-02-17 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
* text.C (Delete): fix case where delete at the end of
|
* 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>
|
2003-02-17 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
@ -744,7 +760,7 @@
|
|||||||
|
|
||||||
2002-10-11 André Pönitz <poenitz@gmx.net>
|
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
|
from inset/lyxtext for handling LFUN_PRIOR/NEXT
|
||||||
|
|
||||||
2002-10-09 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
2002-10-09 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
@ -245,6 +245,8 @@ void LyXAction::init()
|
|||||||
Noop },
|
Noop },
|
||||||
{ LFUN_INSET_OPTARG, "optional-insert", N_("Insert Optional Argument"),
|
{ LFUN_INSET_OPTARG, "optional-insert", N_("Insert Optional Argument"),
|
||||||
Noop },
|
Noop },
|
||||||
|
{ LFUN_INSERT_BIBKEY, "bibkey-insert", N_("Insert Bibliography Key"),
|
||||||
|
Noop },
|
||||||
{ LFUN_LANGUAGE, "language", N_("Change language"), Noop },
|
{ LFUN_LANGUAGE, "language", N_("Change language"), Noop },
|
||||||
{ LFUN_LATEX_LOG, "latex-view-log", N_("View LaTeX log"),
|
{ LFUN_LATEX_LOG, "latex-view-log", N_("View LaTeX log"),
|
||||||
ReadOnly },
|
ReadOnly },
|
||||||
|
21
src/buffer.C
21
src/buffer.C
@ -956,6 +956,12 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
inset->read(this, lex);
|
inset->read(this, lex);
|
||||||
par->insertInset(pos, inset, font, current_change);
|
par->insertInset(pos, inset, font, current_change);
|
||||||
++pos;
|
++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") {
|
} else if (token == "\\hfill") {
|
||||||
par->insertChar(pos, Paragraph::META_HFILL, font, current_change);
|
par->insertChar(pos, Paragraph::META_HFILL, font, current_change);
|
||||||
++pos;
|
++pos;
|
||||||
@ -980,12 +986,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
istr >> aid;
|
istr >> aid;
|
||||||
istr >> ct;
|
istr >> ct;
|
||||||
current_change = Change(Change::DELETED, author_ids[aid], 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") {
|
} else if (token == "\\the_end") {
|
||||||
the_end_read = true;
|
the_end_read = true;
|
||||||
} else {
|
} else {
|
||||||
@ -2034,6 +2034,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
|||||||
|
|
||||||
case LATEX_ENVIRONMENT:
|
case LATEX_ENVIRONMENT:
|
||||||
case LATEX_ITEM_ENVIRONMENT:
|
case LATEX_ITEM_ENVIRONMENT:
|
||||||
|
case LATEX_BIB_ENVIRONMENT:
|
||||||
{
|
{
|
||||||
string const & latexname = style->latexname();
|
string const & latexname = style->latexname();
|
||||||
|
|
||||||
@ -2088,6 +2089,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
|||||||
break;
|
break;
|
||||||
case LATEX_ENVIRONMENT:
|
case LATEX_ENVIRONMENT:
|
||||||
case LATEX_ITEM_ENVIRONMENT:
|
case LATEX_ITEM_ENVIRONMENT:
|
||||||
|
case LATEX_BIB_ENVIRONMENT:
|
||||||
if (style->latexparam() == "CDATA")
|
if (style->latexparam() == "CDATA")
|
||||||
ofs << "]]>";
|
ofs << "]]>";
|
||||||
break;
|
break;
|
||||||
@ -2885,9 +2887,10 @@ vector<pair<string, string> > const Buffer::getBibkeyList() const
|
|||||||
ParagraphList::iterator pit = paragraphs.begin();
|
ParagraphList::iterator pit = paragraphs.begin();
|
||||||
ParagraphList::iterator pend = paragraphs.end();
|
ParagraphList::iterator pend = paragraphs.end();
|
||||||
for (; pit != pend; ++pit) {
|
for (; pit != pend; ++pit) {
|
||||||
if (pit->bibkey) {
|
InsetBibKey * bib = pit->bibkey();
|
||||||
string const key = pit->bibkey->getContents();
|
if (bib) {
|
||||||
string const opt = pit->bibkey->getOptions();
|
string const key = bib->getContents();
|
||||||
|
string const opt = bib->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;
|
||||||
|
|
||||||
|
@ -296,6 +296,7 @@ enum kb_action {
|
|||||||
LFUN_REJECT_CHANGE, // Levon 20021016
|
LFUN_REJECT_CHANGE, // Levon 20021016
|
||||||
LFUN_ACCEPT_ALL_CHANGES, // Levon 20021016
|
LFUN_ACCEPT_ALL_CHANGES, // Levon 20021016
|
||||||
LFUN_REJECT_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 */
|
LFUN_LASTACTION /* this marks the end of the table */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
|
|
||||||
|
#include "insets/insetbib.h"
|
||||||
#include "insets/insetcaption.h"
|
#include "insets/insetcaption.h"
|
||||||
#include "insets/insetert.h"
|
#include "insets/insetert.h"
|
||||||
#include "insets/insetexternal.h"
|
#include "insets/insetexternal.h"
|
||||||
@ -70,6 +71,9 @@ Inset * createInset(FuncRequest const & cmd)
|
|||||||
case LFUN_INSET_OPTARG:
|
case LFUN_INSET_OPTARG:
|
||||||
return new InsetOptArg(params);
|
return new InsetOptArg(params);
|
||||||
|
|
||||||
|
case LFUN_INSERT_BIBKEY:
|
||||||
|
return new InsetBibKey(InsetCommandParams("bibkey"));
|
||||||
|
|
||||||
case LFUN_INSET_FLOAT:
|
case LFUN_INSET_FLOAT:
|
||||||
// check if the float type exists
|
// check if the float type exists
|
||||||
if (params.getLyXTextClass().floats().typeExist(cmd.argument))
|
if (params.getLyXTextClass().floats().typeExist(cmd.argument))
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
|
||||||
|
2003-02-17 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
|
* insetbib.[Ch]: Adjust access to bibkeys
|
||||||
|
|
||||||
2003-02-14 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
2003-02-14 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||||
|
|
||||||
* insetquotes.C (dispString): remove use of acute accent for "'"
|
* insetquotes.C (dispString): remove use of acute accent for "'"
|
||||||
|
@ -76,11 +76,9 @@ void InsetBibKey::setCounter(int c)
|
|||||||
// of time cause LyX3 won't use lyxlex anyway. (ale)
|
// of time cause LyX3 won't use lyxlex anyway. (ale)
|
||||||
void InsetBibKey::write(Buffer const *, ostream & os) const
|
void InsetBibKey::write(Buffer const *, ostream & os) const
|
||||||
{
|
{
|
||||||
os << "\\bibitem ";
|
os << "\n\\layout Bibliography\n\\bibitem ";
|
||||||
if (! getOptions().empty()) {
|
if (! getOptions().empty())
|
||||||
os << '['
|
os << '[' << getOptions() << ']';
|
||||||
<< getOptions() << ']';
|
|
||||||
}
|
|
||||||
os << '{'
|
os << '{'
|
||||||
<< getContents() << "}\n";
|
<< getContents() << "}\n";
|
||||||
}
|
}
|
||||||
@ -336,8 +334,8 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const & font)
|
|||||||
ParagraphList::iterator it = bv->buffer()->paragraphs.begin();
|
ParagraphList::iterator it = bv->buffer()->paragraphs.begin();
|
||||||
ParagraphList::iterator end = bv->buffer()->paragraphs.end();
|
ParagraphList::iterator end = bv->buffer()->paragraphs.end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
if (it->bibkey) {
|
if (it->bibkey()) {
|
||||||
int const wx = it->bibkey->width(bv, font);
|
int const wx = it->bibkey()->width(bv, font);
|
||||||
if (wx > w)
|
if (wx > w)
|
||||||
w = wx;
|
w = wx;
|
||||||
}
|
}
|
||||||
@ -358,13 +356,13 @@ string const bibitemWidest(Buffer const * buffer)
|
|||||||
ParagraphList::iterator it = buffer->paragraphs.begin();
|
ParagraphList::iterator it = buffer->paragraphs.begin();
|
||||||
ParagraphList::iterator end = buffer->paragraphs.end();
|
ParagraphList::iterator end = buffer->paragraphs.end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
if (it->bibkey) {
|
if (it->bibkey()) {
|
||||||
int const wx =
|
int const wx =
|
||||||
font_metrics::width(it->bibkey->getBibLabel(),
|
font_metrics::width(it->bibkey()->getBibLabel(),
|
||||||
font);
|
font);
|
||||||
if (wx > w) {
|
if (wx > w) {
|
||||||
w = wx;
|
w = wx;
|
||||||
bkey = it->bibkey;
|
bkey = it->bibkey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,9 +46,11 @@ public:
|
|||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
EDITABLE editable() const { return IS_EDITABLE; }
|
||||||
/// A user can't neither insert nor delete this inset
|
/// A user can't neither insert nor delete this inset
|
||||||
bool deletable() const {
|
//bool deletable() const {
|
||||||
return false;
|
// return false;
|
||||||
}
|
//}
|
||||||
|
/// keep .lyx format compatible
|
||||||
|
bool directWrite() const { return true; }
|
||||||
///
|
///
|
||||||
void setCounter(int);
|
void setCounter(int);
|
||||||
///
|
///
|
||||||
|
@ -76,6 +76,8 @@ enum LYX_LATEX_TYPES {
|
|||||||
///
|
///
|
||||||
LATEX_ITEM_ENVIRONMENT,
|
LATEX_ITEM_ENVIRONMENT,
|
||||||
///
|
///
|
||||||
|
LATEX_BIB_ENVIRONMENT,
|
||||||
|
///
|
||||||
LATEX_LIST_ENVIRONMENT
|
LATEX_LIST_ENVIRONMENT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -680,6 +680,7 @@ void LyXLayout::readMargin(LyXLex & lexrc)
|
|||||||
void LyXLayout::readLatexType(LyXLex & lexrc)
|
void LyXLayout::readLatexType(LyXLex & lexrc)
|
||||||
{
|
{
|
||||||
keyword_item latexTypeTags[] = {
|
keyword_item latexTypeTags[] = {
|
||||||
|
{ "bib_environment", LATEX_BIB_ENVIRONMENT },
|
||||||
{ "command", LATEX_COMMAND },
|
{ "command", LATEX_COMMAND },
|
||||||
{ "environment", LATEX_ENVIRONMENT },
|
{ "environment", LATEX_ENVIRONMENT },
|
||||||
{ "item_environment", LATEX_ITEM_ENVIRONMENT },
|
{ "item_environment", LATEX_ITEM_ENVIRONMENT },
|
||||||
@ -697,6 +698,7 @@ void LyXLayout::readLatexType(LyXLex & lexrc)
|
|||||||
case LATEX_COMMAND:
|
case LATEX_COMMAND:
|
||||||
case LATEX_ENVIRONMENT:
|
case LATEX_ENVIRONMENT:
|
||||||
case LATEX_ITEM_ENVIRONMENT:
|
case LATEX_ITEM_ENVIRONMENT:
|
||||||
|
case LATEX_BIB_ENVIRONMENT:
|
||||||
case LATEX_LIST_ENVIRONMENT:
|
case LATEX_LIST_ENVIRONMENT:
|
||||||
latextype = static_cast<LYX_LATEX_TYPES>(le);
|
latextype = static_cast<LYX_LATEX_TYPES>(le);
|
||||||
break;
|
break;
|
||||||
|
@ -177,6 +177,7 @@ public:
|
|||||||
///
|
///
|
||||||
bool isEnvironment() const {
|
bool isEnvironment() const {
|
||||||
return (latextype == LATEX_ENVIRONMENT
|
return (latextype == LATEX_ENVIRONMENT
|
||||||
|
|| latextype == LATEX_BIB_ENVIRONMENT
|
||||||
|| latextype == LATEX_ITEM_ENVIRONMENT
|
|| latextype == LATEX_ITEM_ENVIRONMENT
|
||||||
|| latextype == LATEX_LIST_ENVIRONMENT);
|
|| latextype == LATEX_LIST_ENVIRONMENT);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,6 @@ Paragraph::Paragraph()
|
|||||||
#endif
|
#endif
|
||||||
enumdepth = 0;
|
enumdepth = 0;
|
||||||
itemdepth = 0;
|
itemdepth = 0;
|
||||||
bibkey = 0; // ale970302
|
|
||||||
params().clear();
|
params().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +98,6 @@ Paragraph::Paragraph(Paragraph * par)
|
|||||||
previous_->next_ = this;
|
previous_->next_ = this;
|
||||||
// end
|
// end
|
||||||
|
|
||||||
bibkey = 0; // ale970302
|
|
||||||
params().clear();
|
params().clear();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -118,14 +116,6 @@ Paragraph::Paragraph(Paragraph const & lp, bool same_ids)
|
|||||||
// follow footnotes
|
// follow footnotes
|
||||||
layout_ = lp.layout();
|
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
|
// copy everything behind the break-position to the new paragraph
|
||||||
insetlist = lp.insetlist;
|
insetlist = lp.insetlist;
|
||||||
InsetList::iterator it = insetlist.begin();
|
InsetList::iterator it = insetlist.begin();
|
||||||
@ -149,9 +139,6 @@ Paragraph::~Paragraph()
|
|||||||
next_->previous_ = previous_;
|
next_->previous_ = previous_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ale970302
|
|
||||||
delete bibkey;
|
|
||||||
|
|
||||||
delete pimpl_;
|
delete pimpl_;
|
||||||
//
|
//
|
||||||
//lyxerr << "Paragraph::paragraph_id = "
|
//lyxerr << "Paragraph::paragraph_id = "
|
||||||
@ -234,10 +221,6 @@ void Paragraph::write(Buffer const * buf, ostream & os,
|
|||||||
os << "\\align " << string_align[h] << ' ';
|
os << "\\align " << string_align[h] << ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
// bibitem ale970302
|
|
||||||
if (bibkey)
|
|
||||||
bibkey->write(buf, os);
|
|
||||||
|
|
||||||
LyXFont font1(LyXFont::ALL_INHERIT, bparams.language);
|
LyXFont font1(LyXFont::ALL_INHERIT, bparams.language);
|
||||||
|
|
||||||
Change running_change = Change(Change::UNCHANGED);
|
Change running_change = Change(Change::UNCHANGED);
|
||||||
@ -952,17 +935,21 @@ int Paragraph::getPositionOfInset(Inset const * inset) const
|
|||||||
// Find the entry.
|
// Find the entry.
|
||||||
InsetList::iterator it = insetlist.begin();
|
InsetList::iterator it = insetlist.begin();
|
||||||
InsetList::iterator end = insetlist.end();
|
InsetList::iterator end = insetlist.end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it)
|
||||||
if (it.getInset() == inset) {
|
if (it.getInset() == inset)
|
||||||
return it.getPos();
|
return it.getPos();
|
||||||
}
|
|
||||||
}
|
|
||||||
if (inset == bibkey)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return -1;
|
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 {
|
namespace {
|
||||||
|
|
||||||
InsetOptArg * optArgInset(Paragraph const & par)
|
InsetOptArg * optArgInset(Paragraph const & par)
|
||||||
@ -1079,27 +1066,24 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
|
|||||||
|
|
||||||
switch (style->latextype) {
|
switch (style->latextype) {
|
||||||
case LATEX_COMMAND:
|
case LATEX_COMMAND:
|
||||||
os << '\\'
|
os << '\\' << style->latexname();
|
||||||
<< style->latexname();
|
|
||||||
|
|
||||||
// Separate handling of optional argument inset.
|
// Separate handling of optional argument inset.
|
||||||
if (style->optionalargs == 1) {
|
if (style->optionalargs == 1) {
|
||||||
InsetOptArg * it = optArgInset(*this);
|
InsetOptArg * it = optArgInset(*this);
|
||||||
if (it != 0)
|
if (it)
|
||||||
it->latexOptional(buf, os, false, false);
|
it->latexOptional(buf, os, false, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
os << style->latexparam();
|
os << style->latexparam();
|
||||||
break;
|
break;
|
||||||
case LATEX_ITEM_ENVIRONMENT:
|
case LATEX_ITEM_ENVIRONMENT:
|
||||||
if (bibkey) {
|
|
||||||
bibkey->latex(buf, os, false, false);
|
|
||||||
} else
|
|
||||||
os << "\\item ";
|
|
||||||
break;
|
|
||||||
case LATEX_LIST_ENVIRONMENT:
|
case LATEX_LIST_ENVIRONMENT:
|
||||||
os << "\\item ";
|
os << "\\item ";
|
||||||
break;
|
break;
|
||||||
|
case LATEX_BIB_ENVIRONMENT:
|
||||||
|
// ignore this, the inset will write itself
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ public:
|
|||||||
char itemdepth;
|
char itemdepth;
|
||||||
|
|
||||||
///
|
///
|
||||||
InsetBibKey * bibkey; // ale970302
|
InsetBibKey * bibkey(); // ale970302
|
||||||
|
|
||||||
#ifndef NO_NEXT
|
#ifndef NO_NEXT
|
||||||
///
|
///
|
||||||
|
@ -97,9 +97,6 @@ void breakParagraph(BufferParams const & bparams,
|
|||||||
tmp->params().lineTop(par->params().lineTop());
|
tmp->params().lineTop(par->params().lineTop());
|
||||||
tmp->params().pagebreakTop(par->params().pagebreakTop());
|
tmp->params().pagebreakTop(par->params().pagebreakTop());
|
||||||
tmp->params().spaceTop(par->params().spaceTop());
|
tmp->params().spaceTop(par->params().spaceTop());
|
||||||
tmp->bibkey = par->bibkey;
|
|
||||||
|
|
||||||
par->bibkey = 0;
|
|
||||||
par->params().clear();
|
par->params().clear();
|
||||||
|
|
||||||
par->layout(bparams.getLyXTextClass().defaultLayout());
|
par->layout(bparams.getLyXTextClass().defaultLayout());
|
||||||
|
13
src/text.C
13
src/text.C
@ -3455,19 +3455,6 @@ void LyXText::paintFirstRow(DrawRowParams & p)
|
|||||||
str, font);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
28
src/text2.C
28
src/text2.C
@ -368,14 +368,11 @@ void LyXText::insertParagraph(BufferView * bview, Paragraph * par,
|
|||||||
|
|
||||||
Inset * LyXText::getInset() const
|
Inset * LyXText::getInset() const
|
||||||
{
|
{
|
||||||
Inset * inset = 0;
|
if (cursor.pos() < cursor.par()->size()
|
||||||
if (cursor.pos() == 0 && cursor.par()->bibkey) {
|
|
||||||
inset = cursor.par()->bibkey;
|
|
||||||
} else if (cursor.pos() < cursor.par()->size()
|
|
||||||
&& cursor.par()->isInset(cursor.pos())) {
|
&& cursor.par()->isInset(cursor.pos())) {
|
||||||
inset = cursor.par()->getInset(cursor.pos());
|
return cursor.par()->getInset(cursor.pos());
|
||||||
}
|
}
|
||||||
return inset;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -471,11 +468,6 @@ Paragraph * LyXText::setLayout(BufferView * bview,
|
|||||||
: VSpace(VSpace::NONE));
|
: VSpace(VSpace::NONE));
|
||||||
if (lyxlayout->margintype == MARGIN_MANUAL)
|
if (lyxlayout->margintype == MARGIN_MANUAL)
|
||||||
par->setLabelWidthString(lyxlayout->labelstring());
|
par->setLabelWidthString(lyxlayout->labelstring());
|
||||||
if (lyxlayout->labeltype != LABEL_BIBLIO
|
|
||||||
&& fppar->bibkey) {
|
|
||||||
delete fppar->bibkey;
|
|
||||||
fppar->bibkey = 0;
|
|
||||||
}
|
|
||||||
cur.par(par);
|
cur.par(par);
|
||||||
par = par->next();
|
par = par->next();
|
||||||
} while (par != epar);
|
} while (par != epar);
|
||||||
@ -1271,13 +1263,15 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
|
|||||||
} else if (layout->labeltype == LABEL_BIBLIO) {// ale970302
|
} else if (layout->labeltype == LABEL_BIBLIO) {// ale970302
|
||||||
textclass.counters().step("bibitem");
|
textclass.counters().step("bibitem");
|
||||||
int number = textclass.counters().value("bibitem");
|
int number = textclass.counters().value("bibitem");
|
||||||
if (!par->bibkey) {
|
//if (!par->bibkey()) {
|
||||||
InsetCommandParams p("bibitem");
|
if (par->bibkey()) {
|
||||||
par->bibkey = new InsetBibKey(p);
|
par->bibkey()->setCounter(number);
|
||||||
|
par->params().labelString(layout->labelstring());
|
||||||
}
|
}
|
||||||
par->bibkey->setCounter(number);
|
// else {
|
||||||
par->params().labelString(layout->labelstring());
|
// InsetCommandParams p("bibitem");
|
||||||
|
// par->bibkey() = new InsetBibKey(p);
|
||||||
|
//}
|
||||||
// In biblio should't be following counters but...
|
// In biblio should't be following counters but...
|
||||||
} else {
|
} else {
|
||||||
string s = layout->labelstring();
|
string s = layout->labelstring();
|
||||||
|
14
src/text3.C
14
src/text3.C
@ -1538,7 +1538,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
|||||||
} else {
|
} else {
|
||||||
FuncRequest cmd1(bv, LFUN_MOUSE_RELEASE, x, y, cmd.button());
|
FuncRequest cmd1(bv, LFUN_MOUSE_RELEASE, x, y, cmd.button());
|
||||||
inset_hit->localDispatch(cmd1);
|
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.
|
// they call the actions they have to do with the insetButtonRel.
|
||||||
// function and not in the edit(). This should be changed
|
// function and not in the edit(). This should be changed
|
||||||
// (Jug 20020329)
|
// (Jug 20020329)
|
||||||
@ -1550,17 +1550,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
|||||||
break;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1621,6 +1610,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
|||||||
case LFUN_INSET_CAPTION:
|
case LFUN_INSET_CAPTION:
|
||||||
#endif
|
#endif
|
||||||
case LFUN_INSERT_NOTE:
|
case LFUN_INSERT_NOTE:
|
||||||
|
case LFUN_INSERT_BIBKEY:
|
||||||
case LFUN_INSET_ERT:
|
case LFUN_INSET_ERT:
|
||||||
case LFUN_INSET_FLOAT:
|
case LFUN_INSET_FLOAT:
|
||||||
case LFUN_INSET_FOOTNOTE:
|
case LFUN_INSET_FOOTNOTE:
|
||||||
|
Loading…
Reference in New Issue
Block a user