+2003-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * configure.ac: check for zlib.
+
2003-07-27 Lars Gullik Bjønnes <larsbj@gullik.net>
* configure.ac: new file
LYX_CHECK_DECL(istreambuf_iterator, iterator)
LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
+AC_CHECK_HEADERS(zlib.h)
+AC_CHECK_LIB(z, gzopen)
+
dnl This is a slight hack: the tests generated by autoconf 2.52 do not
dnl work correctly because of some conflict with stdlib.h with g++ 2.96
dnl We aim to remove this eventually, since we should test as much as
+2003-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * lyxlex_pimpl.C (setFile): clean up slightly.
+
+ * bufferparams.h: add compressed var
+
+ * buffer_funcs.C (readFile): adjust for LyXLex change
+ (newFile): ditto + simplify
+
+ * buffer.C (writeFile): handle writing of compressed files
+
+ * buffer.[Ch] (readFile): begin LyXLex here, remove one argument.
+ Check if the file is compressed and set a bufferparm if so.
+
+ * Makefile.am (lyx_LDADD): remove explicit -lz
+
2003-07-28 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* buffer.C (do_writeFile, makeLaTeXFile, makeLinuxDocFile,
makeDocBookFile): put the real LyX version in the first line of
the file
- * version.h:
+ * version.h:
* version.C.in: remove lyx_docversion
* tabular.C (write_attribute): add a template-based version to
endif
lyx_LDADD = $(LYX_CONV_LIBS) $(BOOST_LIBS) $(INTLLIBS) \
- $(AIKSAURUS_LIBS) @LIBS@ -lz
+ $(AIKSAURUS_LIBS) @LIBS@
lyx_DEPENDENCIES = $(LYX_CONV_LIBS) $(BOOST_LIBS) $(INTLLIBS)
}
-bool Buffer::readFile(LyXLex & lex, string const & filename)
+bool Buffer::readFile(string const & filename)
{
+ // Check if the file is compressed.
+ string const format = getExtFromContents(filename);
+ if (format == "gzip" || format == "zip" || format == "compress") {
+ params.compressed = true;
+ }
+
+ LyXLex lex(0, 0);
+ lex.setFile(filename);
+
bool ret = readFile(lex, filename, paragraphs.begin());
// After we have read a file, we must ensure that the buffer
return false;
}
- bool const compressed = (fname.substr(fname.size() - 3, 3) == ".gz");
+ bool retval;
- if (compressed) {
+ if (params.compressed) {
gz::ogzstream ofs(fname.c_str());
if (!ofs)
return false;
- return do_writeFile(ofs);
+ retval = do_writeFile(ofs);
- }
+ } else {
+ ofstream ofs(fname.c_str());
+ if (!ofs)
+ return false;
- ofstream ofs(fname.c_str());
- if (!ofs)
- return false;
+ retval = do_writeFile(ofs);
+ }
- return do_writeFile(ofs);
+ return retval;
}
// FIXME: it's very silly to pass a lex in here
/// load a new file
- bool readFile(LyXLex &, string const &);
+ bool readFile(string const &);
/// read the header, returns number of unknown tokens
int readHeader(LyXLex & lex);
#include "errorlist.h"
#include "gettext.h"
#include "vc-backend.h"
-#include "lyxlex.h"
#include "LaTeX.h"
#include "ParagraphList.h"
#include "paragraph.h"
}
}
}
- // not sure if this is the correct place to begin LyXLex
- LyXLex lex(0, 0);
- lex.setFile(ts);
-
- return b->readFile(lex, ts);
+ return b->readFile(ts);
}
tname = templatename;
if (!tname.empty()) {
- bool templateok = false;
- LyXLex lex(0, 0);
- lex.setFile(tname);
- if (lex.isOK()) {
- if (b->readFile(lex, tname)) {
- templateok = true;
- }
- }
- if (!templateok) {
+ if (!b->readFile(tname)) {
string const file = MakeDisplayPath(tname, 50);
- string text = bformat(_("The specified document template\n%1$s\n"
+ string const text = bformat(_("The specified document template\n%1$s\n"
"could not be read."), file);
Alert::error(_("Could not read template"), text);
// no template, start with empty buffer
}
-void bufferErrors(Buffer const & buf, TeXErrors const & terr)
+void bufferErrors(Buffer const & buf, TeXErrors const & terr)
{
TeXErrors::Errors::const_iterator cit = terr.begin();
TeXErrors::Errors::const_iterator end = terr.end();
}
-void bufferErrors(Buffer const & buf, ErrorList const & el)
+void bufferErrors(Buffer const & buf, ErrorList const & el)
{
ErrorList::const_iterator it = el.begin();
ErrorList::const_iterator end = el.end();
- for (; it != end; ++it)
+ for (; it != end; ++it)
buf.error(*it);
}
sides = LyXTextClass::OneSide;
columns = 1;
pagestyle = "default";
+ compressed = false;
for (int iter = 0; iter < 4; ++iter) {
user_defined_bullets[iter] = ITEMIZE_DEFAULTS[iter];
temp_bullets[iter] = ITEMIZE_DEFAULTS[iter];
string const paper_option = paperSizeName();
if (paper_option != "letter" ||
orientation != ORIENTATION_LANDSCAPE) {
- // dvips won't accept -t letter -t landscape.
+ // dvips won't accept -t letter -t landscape.
// In all other cases, include the paper size
// explicitly.
result = lyxrc.print_paper_flag;
bool tracking_changes;
/// Time ago we agreed that this was a buffer property [ale990407]
string parentname;
+ ///
+ bool compressed;
/// map of the file's author IDs to buffer author IDs
std::vector<int> author_map;
{
string const file_name = buf->niceFile ?
params().filename.relFilename(buf->filePath()):
- params().filename.absFilename();
+ params().filename.absFilename();
os << "<eps file=\"" << file_name << "\">\n";
os << "<img src=\"" << file_name << "\">";
}
-void InsetText::lockInset(BufferView * bv, UpdatableInset * inset)
+void InsetText::lockInset(BufferView * /*bv*/, UpdatableInset * inset)
{
the_locking_inset = inset;
inset_x = cix() - top_x + drawTextXOffset;
return false;
found = tl_inset->updateInsetInInset(bv, inset);
ustat = FULL;
- } else {
+ } else {
text_.updateInset(tl_inset);
setUpdateStatus(ustat);
}
bool LyXLex::Pimpl::setFile(string const & filename)
{
- // Is this a compressed file or not?
- bool const compressed = (filename.substr(filename.size() - 3, 3) == ".gz");
- // The check only outputs a debug message, because it triggers
- // a bug in compaq cxx 6.2, where is_open() returns 'true' for a
- // fresh new filebuf. (JMarc)
- if (compressed) {
+ // Check the format of the file.
+ string const format = getExtFromContents(filename);
+
+ if (format == "gzip" || format == "zip" || format == "compress") {
lyxerr << "lyxlex: compressed" << endl;
+ // The check only outputs a debug message, because it triggers
+ // a bug in compaq cxx 6.2, where is_open() returns 'true' for
+ // a fresh new filebuf. (JMarc)
if (gz__.is_open() || is.tellg() > 0)
lyxerr[Debug::LYXLEX] << "Error in LyXLex::setFile: "
"file or stream already set." << endl;
} else {
lyxerr << "lyxlex: UNcompressed" << endl;
+ // The check only outputs a debug message, because it triggers
+ // a bug in compaq cxx 6.2, where is_open() returns 'true' for
+ // a fresh new filebuf. (JMarc)
if (fb__.is_open() || is.tellg() > 0)
lyxerr[Debug::LYXLEX] << "Error in LyXLex::setFile: "
"file or stream already set." << endl;
lineno = 0;
return fb__.is_open() && is.good();
}
-
}
}
-lyx::pos_type
-Paragraph::getEndPosOfFontSpan(lyx::pos_type pos) const
+lyx::pos_type
+Paragraph::getEndPosOfFontSpan(lyx::pos_type pos) const
{
Assert(pos <= size());
maxasc = max(maxasc, tmpinset->ascent());
maxdesc = max(maxdesc, tmpinset->descent());
#endif
- }
+ }
} else {
// Fall-back to normal case
maxwidth += singleWidth(pit, pos, c);
// check if the given co-ordinates are inside an inset at the
// given cursor, if one exists. If so, the inset is returned,
// and the co-ordinates are made relative. Otherwise, 0 is returned.
- InsetOld * checkInset(BufferView * bv, LyXText & text,
+InsetOld * checkInset(BufferView * /*bv*/, LyXText & text,
LyXCursor const & cur, int & x, int & y)
{
lyx::pos_type const pos = cur.pos();