mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 16:37:28 +00:00
Angus mathed (cleanup) and inset (bib) patch.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1074 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
793da498a2
commit
197273f840
22
ChangeLog
22
ChangeLog
@ -1,3 +1,25 @@
|
||||
2000-10-02 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* src/mathed/formula.C (IsMacro): declared but not referenced; removed.
|
||||
* src/mathed/math_cursor.C (IsAlpha): ditto.
|
||||
* src/mathed/math_inset.C (strnew): ditto.
|
||||
* src/mathed/math_iter.C: SizeFont declared but not referenced;removed.
|
||||
(IMetrics): cxp set but never used; removed.
|
||||
* src/insets/figinset.C (InitFigures): removed redundant for loop, now
|
||||
that the variable in question has been removed also!
|
||||
|
||||
|
||||
* src/insets/insetbib.[Ch]: remove need to store Buffer * owner by
|
||||
using the Buffer * passed to Latex(), using the BufferView * passed to
|
||||
bibitemMaxWidth() bibitemWidest() and by passing a Buffer* to getKeys()
|
||||
|
||||
* src/insets/insetinclude.C: use the Buffer * passed to Latex(),
|
||||
Linuxdoc() and DocBook() rather than the stored Buffer * master.
|
||||
|
||||
* src/lyxfunc.C (Dispatch): used new InsetBibtex c-tor
|
||||
* src/buffer.C (readInset): used new InsetBibtex c-tor
|
||||
* (getBibkeyList): used new InsetBibtex::getKeys
|
||||
|
||||
2000-10-01 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* lib/configure.m4
|
||||
|
@ -64,6 +64,19 @@ src/frontends/xforms/FormPrint.C
|
||||
src/frontends/xforms/form_print.C
|
||||
src/frontends/xforms/FormRef.C
|
||||
src/frontends/xforms/form_ref.C
|
||||
src/frontends/xforms/forms/form_citation.C
|
||||
src/frontends/xforms/forms/form_copyright.C
|
||||
src/frontends/xforms/forms/form_document.C
|
||||
src/frontends/xforms/forms/form_error.C
|
||||
src/frontends/xforms/forms/form_graphics.C
|
||||
src/frontends/xforms/forms/form_index.C
|
||||
src/frontends/xforms/forms/form_paragraph.C
|
||||
src/frontends/xforms/forms/form_preferences.C
|
||||
src/frontends/xforms/forms/form_print.C
|
||||
src/frontends/xforms/forms/form_ref.C
|
||||
src/frontends/xforms/forms/form_tabular.C
|
||||
src/frontends/xforms/forms/form_toc.C
|
||||
src/frontends/xforms/forms/form_url.C
|
||||
src/frontends/xforms/FormTabular.C
|
||||
src/frontends/xforms/form_tabular.C
|
||||
src/frontends/xforms/FormToc.C
|
||||
|
@ -953,7 +953,7 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
|
||||
lex.printError("Wrong place for bibitem");
|
||||
inset = new InsetBibKey(inscmd);
|
||||
} else if (inscmd.getCmdName() == "BibTeX") {
|
||||
inset = new InsetBibtex(inscmd, this);
|
||||
inset = new InsetBibtex(inscmd);
|
||||
} else if (inscmd.getCmdName() == "index") {
|
||||
inset = new InsetIndex(inscmd);
|
||||
} else if (inscmd.getCmdName() == "include") {
|
||||
@ -3583,7 +3583,7 @@ vector<pair<string,string> > const Buffer::getBibkeyList()
|
||||
// Search for Bibtex or Include inset
|
||||
if ((*it)->LyxCode() == Inset::BIBTEX_CODE) {
|
||||
vector<pair<string,string> > tmp =
|
||||
static_cast<InsetBibtex*>(*it)->getKeys();
|
||||
static_cast<InsetBibtex*>(*it)->getKeys(this);
|
||||
keys.insert(keys.end(), tmp.begin(), tmp.end());
|
||||
} else if ((*it)->LyxCode() == Inset::INCLUDE_CODE) {
|
||||
vector<pair<string,string> > const tmp =
|
||||
|
@ -381,13 +381,6 @@ void InitFigures()
|
||||
figures.clear();
|
||||
bitmaps.clear();
|
||||
|
||||
unsigned int k;
|
||||
for (unsigned int i = 0; i < 256; ++i) {
|
||||
k = 0;
|
||||
for (unsigned int j = 0; j < 8; ++j)
|
||||
if (i & (1 << (7-j))) k |= 1 << j;
|
||||
}
|
||||
|
||||
// allocate color cube on pseudo-color display
|
||||
// first get visual
|
||||
gs_color = false;
|
||||
|
@ -26,8 +26,6 @@ using std::endl;
|
||||
using std::vector;
|
||||
using std::pair;
|
||||
|
||||
extern BufferView * current_view;
|
||||
|
||||
FD_bibitem_form * bibitem_form = 0;
|
||||
|
||||
FD_bibitem_form * create_form_bibitem_form(void);
|
||||
@ -200,8 +198,8 @@ void InsetBibKey::Edit(BufferView * bv, int, int, unsigned int)
|
||||
}
|
||||
|
||||
|
||||
InsetBibtex::InsetBibtex(InsetCommandParams const & p, Buffer * o)
|
||||
: InsetCommand(p), owner(o)
|
||||
InsetBibtex::InsetBibtex(InsetCommandParams const & p)
|
||||
: InsetCommand(p)
|
||||
{}
|
||||
|
||||
|
||||
@ -220,16 +218,9 @@ string const InsetBibtex::getScreenLabel() const
|
||||
}
|
||||
|
||||
|
||||
int InsetBibtex::Latex(Buffer const *, ostream & os,
|
||||
int InsetBibtex::Latex(Buffer const * buffer, ostream & os,
|
||||
bool /*fragile*/, bool/*fs*/) const
|
||||
{
|
||||
// this looks like an horrible hack and it is :) The problem
|
||||
// is that owner is not initialized correctly when the bib
|
||||
// inset is cut and pasted. Such hacks will not be needed
|
||||
// later (JMarc)
|
||||
if (!owner) {
|
||||
owner = current_view->buffer();
|
||||
}
|
||||
// If we generate in a temp dir, we might need to give an
|
||||
// absolute path there. This is a bit complicated since we can
|
||||
// have a comma-separated list of bibliographies
|
||||
@ -237,9 +228,9 @@ int InsetBibtex::Latex(Buffer const *, ostream & os,
|
||||
string db_in = getContents();
|
||||
db_in = split(db_in, adb, ',');
|
||||
while(!adb.empty()) {
|
||||
if (!owner->niceFile &&
|
||||
IsFileReadable(MakeAbsPath(adb, owner->filepath)+".bib"))
|
||||
adb = MakeAbsPath(adb, owner->filepath);
|
||||
if (!buffer->niceFile &&
|
||||
IsFileReadable(MakeAbsPath(adb, buffer->filepath)+".bib"))
|
||||
adb = MakeAbsPath(adb, buffer->filepath);
|
||||
|
||||
db_out += adb;
|
||||
db_out += ',';
|
||||
@ -248,10 +239,10 @@ int InsetBibtex::Latex(Buffer const *, ostream & os,
|
||||
db_out = strip(db_out, ',');
|
||||
// Idem, but simpler
|
||||
string style;
|
||||
if (!owner->niceFile
|
||||
&& IsFileReadable(MakeAbsPath(getOptions(), owner->filepath)
|
||||
if (!buffer->niceFile
|
||||
&& IsFileReadable(MakeAbsPath(getOptions(), buffer->filepath)
|
||||
+ ".bst"))
|
||||
style = MakeAbsPath(getOptions(), owner->filepath);
|
||||
style = MakeAbsPath(getOptions(), buffer->filepath);
|
||||
else
|
||||
style = getOptions();
|
||||
|
||||
@ -262,19 +253,9 @@ int InsetBibtex::Latex(Buffer const *, ostream & os,
|
||||
|
||||
|
||||
// This method returns a comma separated list of Bibtex entries
|
||||
vector<pair<string, string> > const InsetBibtex::getKeys() const
|
||||
vector<pair<string, string> > const InsetBibtex::getKeys(Buffer const * buffer) const
|
||||
{
|
||||
// This hack is copied from InsetBibtex::Latex.
|
||||
// Is it still needed? Probably yes.
|
||||
// Why is this needed here when it already is in Latex?
|
||||
// Anyway we need a different way to get to the
|
||||
// buffer the inset is in. (Lgb)
|
||||
|
||||
//if (!owner) {
|
||||
// owner = current_view->buffer();
|
||||
//}
|
||||
|
||||
Path p(owner->filepath);
|
||||
Path p(buffer->filepath);
|
||||
|
||||
vector<pair<string,string> > keys;
|
||||
string tmp;
|
||||
@ -383,7 +364,7 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const & font)
|
||||
{
|
||||
int w = 0;
|
||||
// Does look like a hack? It is! (but will change at 0.13)
|
||||
LyXParagraph * par = current_view->buffer()->paragraph;
|
||||
LyXParagraph * par = bv->buffer()->paragraph;
|
||||
|
||||
while (par) {
|
||||
if (par->bibkey) {
|
||||
@ -401,7 +382,7 @@ string const bibitemWidest(BufferView * bv)
|
||||
{
|
||||
int w = 0;
|
||||
// Does look like a hack? It is! (but will change at 0.13)
|
||||
LyXParagraph * par = current_view->buffer()->paragraph;
|
||||
LyXParagraph * par = bv->buffer()->paragraph;
|
||||
InsetBibKey * bkey = 0;
|
||||
LyXFont font;
|
||||
|
||||
|
@ -78,11 +78,11 @@ private:
|
||||
class InsetBibtex : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
InsetBibtex(InsetCommandParams const &, Buffer *);
|
||||
InsetBibtex(InsetCommandParams const &);
|
||||
///
|
||||
~InsetBibtex();
|
||||
///
|
||||
Inset * Clone() const { return new InsetBibtex(params(), owner); }
|
||||
Inset * Clone() const { return new InsetBibtex(params()); }
|
||||
///
|
||||
string const getScreenLabel() const;
|
||||
///
|
||||
@ -95,7 +95,7 @@ public:
|
||||
int Latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool freespace) const;
|
||||
///
|
||||
std::vector<std::pair<string,string> > const getKeys() const;
|
||||
std::vector<std::pair<string,string> > const getKeys(Buffer const *) const;
|
||||
///
|
||||
bool addDatabase(string const &);
|
||||
///
|
||||
@ -109,9 +109,6 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
///
|
||||
mutable Buffer * owner;
|
||||
|
||||
///
|
||||
Holder holder;
|
||||
};
|
||||
|
@ -353,7 +353,7 @@ bool InsetInclude::loadIfNeeded() const
|
||||
}
|
||||
|
||||
|
||||
int InsetInclude::Latex(Buffer const *, ostream & os,
|
||||
int InsetInclude::Latex(Buffer const * buffer, ostream & os,
|
||||
bool /*fragile*/, bool /*fs*/) const
|
||||
{
|
||||
string incfile(getContents());
|
||||
@ -365,37 +365,37 @@ int InsetInclude::Latex(Buffer const *, ostream & os,
|
||||
if (loadIfNeeded()) {
|
||||
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||
|
||||
if (tmp->params.textclass != master->params.textclass) {
|
||||
if (tmp->params.textclass != buffer->params.textclass) {
|
||||
lyxerr << "ERROR: Cannot handle include file `"
|
||||
<< MakeDisplayPath(getFileName())
|
||||
<< "' which has textclass `"
|
||||
<< textclasslist.NameOfClass(tmp->params.textclass)
|
||||
<< "' instead of `"
|
||||
<< textclasslist.NameOfClass(master->params.textclass)
|
||||
<< textclasslist.NameOfClass(buffer->params.textclass)
|
||||
<< "'." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// write it to a file (so far the complete file)
|
||||
string writefile = ChangeExtension(getFileName(), ".tex");
|
||||
if (!master->tmppath.empty()
|
||||
&& !master->niceFile) {
|
||||
if (!buffer->tmppath.empty()
|
||||
&& !buffer->niceFile) {
|
||||
incfile = subst(incfile, '/','@');
|
||||
#ifdef __EMX__
|
||||
incfile = subst(incfile, ':', '$');
|
||||
#endif
|
||||
writefile = AddName(master->tmppath, incfile);
|
||||
writefile = AddName(buffer->tmppath, incfile);
|
||||
} else
|
||||
writefile = getFileName();
|
||||
writefile = ChangeExtension(writefile, ".tex");
|
||||
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||
|
||||
tmp->markDepClean(master->tmppath);
|
||||
tmp->markDepClean(buffer->tmppath);
|
||||
|
||||
tmp->makeLaTeXFile(writefile,
|
||||
OnlyPath(getMasterFilename()),
|
||||
master->niceFile, true);
|
||||
buffer->niceFile, true);
|
||||
}
|
||||
|
||||
if (isVerb()) {
|
||||
@ -421,7 +421,7 @@ int InsetInclude::Latex(Buffer const *, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetInclude::Linuxdoc(Buffer const *, ostream & os) const
|
||||
int InsetInclude::Linuxdoc(Buffer const * buffer, ostream & os) const
|
||||
{
|
||||
string incfile(getContents());
|
||||
|
||||
@ -434,9 +434,9 @@ int InsetInclude::Linuxdoc(Buffer const *, ostream & os) const
|
||||
|
||||
// write it to a file (so far the complete file)
|
||||
string writefile = ChangeExtension(getFileName(), ".sgml");
|
||||
if (!master->tmppath.empty() && !master->niceFile) {
|
||||
if (!buffer->tmppath.empty() && !buffer->niceFile) {
|
||||
incfile = subst(incfile, '/','@');
|
||||
writefile = AddName(master->tmppath, incfile);
|
||||
writefile = AddName(buffer->tmppath, incfile);
|
||||
} else
|
||||
writefile = getFileName();
|
||||
|
||||
@ -446,7 +446,7 @@ int InsetInclude::Linuxdoc(Buffer const *, ostream & os) const
|
||||
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||
|
||||
tmp->makeLinuxDocFile(writefile, master->niceFile, true);
|
||||
tmp->makeLinuxDocFile(writefile, buffer->niceFile, true);
|
||||
}
|
||||
|
||||
if (isVerb()) {
|
||||
@ -458,7 +458,7 @@ int InsetInclude::Linuxdoc(Buffer const *, ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
int InsetInclude::DocBook(Buffer const *, ostream & os) const
|
||||
int InsetInclude::DocBook(Buffer const * buffer, ostream & os) const
|
||||
{
|
||||
string incfile(getContents());
|
||||
|
||||
@ -471,9 +471,9 @@ int InsetInclude::DocBook(Buffer const *, ostream & os) const
|
||||
|
||||
// write it to a file (so far the complete file)
|
||||
string writefile = ChangeExtension(getFileName(), ".sgml");
|
||||
if (!master->tmppath.empty() && !master->niceFile) {
|
||||
if (!buffer->tmppath.empty() && !buffer->niceFile) {
|
||||
incfile = subst(incfile, '/','@');
|
||||
writefile = AddName(master->tmppath, incfile);
|
||||
writefile = AddName(buffer->tmppath, incfile);
|
||||
} else
|
||||
writefile = getFileName();
|
||||
if(IsLyXFilename(getFileName()))
|
||||
@ -482,7 +482,7 @@ int InsetInclude::DocBook(Buffer const *, ostream & os) const
|
||||
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||
|
||||
tmp->makeDocBookFile(writefile, master->niceFile, true);
|
||||
tmp->makeDocBookFile(writefile, buffer->niceFile, true);
|
||||
}
|
||||
|
||||
if (isVerb()) {
|
||||
|
@ -2671,7 +2671,7 @@ string const LyXFunc::Dispatch(int ac,
|
||||
bibstyle = "plain";
|
||||
|
||||
InsetCommandParams p( "BibTeX", db, bibstyle );
|
||||
InsetBibtex * inset = new InsetBibtex(p, owner->buffer());
|
||||
InsetBibtex * inset = new InsetBibtex(p);
|
||||
|
||||
if (owner->view()->insertInset(inset)) {
|
||||
if (argument.empty())
|
||||
|
@ -70,14 +70,6 @@ int MathedInset::df_des;
|
||||
int MathedInset::df_width;
|
||||
|
||||
|
||||
inline
|
||||
bool IsMacro(short token, int id)
|
||||
{
|
||||
return (token != LM_TK_FRAC && token != LM_TK_SQRT &&
|
||||
!((token == LM_TK_SYM || token == LM_TC_BSYM) && id < 255));
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void mathedValidate(LaTeXFeatures & features, MathParInset * par);
|
||||
|
||||
|
@ -35,12 +35,6 @@ static LyxArrayBase * selarray = 0;
|
||||
|
||||
using std::endl;
|
||||
|
||||
static inline
|
||||
bool IsAlpha(char c)
|
||||
{
|
||||
return ('A' <= c && c <= 'Z' || 'a' <= c && c <= 'z');
|
||||
}
|
||||
|
||||
// This was very smaller, I'll change it later
|
||||
static inline
|
||||
bool IsMacro(short tok, int id)
|
||||
|
@ -26,14 +26,6 @@
|
||||
#include "symbol_def.h"
|
||||
|
||||
|
||||
static inline
|
||||
char * strnew(char const * s)
|
||||
{
|
||||
char * s1 = new char[strlen(s)+1];
|
||||
return strcpy(s1, s);
|
||||
}
|
||||
|
||||
|
||||
MathedInset::MathedInset(MathedInset * inset)
|
||||
{
|
||||
if (inset) {
|
||||
|
@ -30,7 +30,6 @@
|
||||
using std::endl;
|
||||
|
||||
const int SizeInset = sizeof(char*) + 2;
|
||||
const int SizeFont = 2;
|
||||
|
||||
extern int mathed_char_width(short type, int style, byte c);
|
||||
extern int mathed_string_width(short type, int style, byte const* s, int ls);
|
||||
@ -887,7 +886,6 @@ void MathedXIter::subMetrics(int a, int d)
|
||||
void MathedXIter::IMetrics(int pos2, int & width, int & ascent, int & descent)
|
||||
{
|
||||
byte cx;
|
||||
byte cxp = 0; // *s;
|
||||
int x1; // ls;
|
||||
int asc = 0;
|
||||
int des = 0;
|
||||
@ -948,7 +946,6 @@ void MathedXIter::IMetrics(int pos2, int & width, int & ascent, int & descent)
|
||||
break;
|
||||
}
|
||||
if (pos < pos2) Next();
|
||||
cxp = cx;
|
||||
}
|
||||
width = x - x1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user