+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
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
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") {
// 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 =
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;
using std::vector;
using std::pair;
-extern BufferView * current_view;
-
FD_bibitem_form * bibitem_form = 0;
FD_bibitem_form * create_form_bibitem_form(void);
}
-InsetBibtex::InsetBibtex(InsetCommandParams const & p, Buffer * o)
- : InsetCommand(p), owner(o)
+InsetBibtex::InsetBibtex(InsetCommandParams const & p)
+ : InsetCommand(p)
{}
}
-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
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 += ',';
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();
// 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;
{
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) {
{
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;
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;
///
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 &);
///
};
private:
- ///
- mutable Buffer * owner;
-
///
Holder holder;
};
}
-int InsetInclude::Latex(Buffer const *, ostream & os,
+int InsetInclude::Latex(Buffer const * buffer, ostream & os,
bool /*fragile*/, bool /*fs*/) const
{
string incfile(getContents());
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()) {
}
-int InsetInclude::Linuxdoc(Buffer const *, ostream & os) const
+int InsetInclude::Linuxdoc(Buffer const * buffer, ostream & os) const
{
string incfile(getContents());
// 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();
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()) {
}
-int InsetInclude::DocBook(Buffer const *, ostream & os) const
+int InsetInclude::DocBook(Buffer const * buffer, ostream & os) const
{
string incfile(getContents());
// 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()))
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()) {
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())
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);
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)
#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) {
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);
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;
break;
}
if (pos < pos2) Next();
- cxp = cx;
}
width = x - x1;
}