mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
more compress support
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7419 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6f91069b50
commit
8721e76079
@ -1,3 +1,7 @@
|
||||
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
|
||||
|
@ -246,6 +246,9 @@ LYX_CHECK_DECL(vsnprintf, stdio.h)
|
||||
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
|
||||
|
@ -1,10 +1,26 @@
|
||||
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
|
||||
|
@ -31,7 +31,7 @@ BOOST_LIBS = -lboost_regex -lboost_signals
|
||||
endif
|
||||
|
||||
lyx_LDADD = $(LYX_CONV_LIBS) $(BOOST_LIBS) $(INTLLIBS) \
|
||||
$(AIKSAURUS_LIBS) @LIBS@ -lz
|
||||
$(AIKSAURUS_LIBS) @LIBS@
|
||||
|
||||
lyx_DEPENDENCIES = $(LYX_CONV_LIBS) $(BOOST_LIBS) $(INTLLIBS)
|
||||
|
||||
|
29
src/buffer.C
29
src/buffer.C
@ -440,8 +440,17 @@ void Buffer::insertStringAsLines(ParagraphList::iterator & par, pos_type & pos,
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
@ -637,23 +646,25 @@ bool Buffer::writeFile(string const & fname) const
|
||||
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;
|
||||
|
||||
retval = do_writeFile(ofs);
|
||||
}
|
||||
|
||||
ofstream ofs(fname.c_str());
|
||||
if (!ofs)
|
||||
return false;
|
||||
|
||||
return do_writeFile(ofs);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
|
||||
// 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);
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "errorlist.h"
|
||||
#include "gettext.h"
|
||||
#include "vc-backend.h"
|
||||
#include "lyxlex.h"
|
||||
#include "LaTeX.h"
|
||||
#include "ParagraphList.h"
|
||||
#include "paragraph.h"
|
||||
@ -105,11 +104,7 @@ bool readFile(Buffer * b, string const & s)
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
@ -166,17 +161,9 @@ Buffer * newFile(string const & filename, string const & templatename,
|
||||
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
|
||||
@ -200,7 +187,7 @@ Buffer * newFile(string const & filename, string const & templatename,
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
@ -219,12 +206,12 @@ void bufferErrors(Buffer const & buf, TeXErrors const & terr)
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,7 @@ BufferParams::BufferParams()
|
||||
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];
|
||||
@ -1004,7 +1005,7 @@ string const BufferParams::dvips_options() const
|
||||
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;
|
||||
|
@ -174,6 +174,8 @@ public:
|
||||
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;
|
||||
|
@ -554,7 +554,7 @@ int InsetGraphics::linuxdoc(Buffer const * buf, ostream & os) const
|
||||
{
|
||||
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 << "\">";
|
||||
|
@ -515,7 +515,7 @@ void InsetText::lockInset(BufferView * bv)
|
||||
}
|
||||
|
||||
|
||||
void InsetText::lockInset(BufferView * bv, UpdatableInset * inset)
|
||||
void InsetText::lockInset(BufferView * /*bv*/, UpdatableInset * inset)
|
||||
{
|
||||
the_locking_inset = inset;
|
||||
inset_x = cix() - top_x + drawTextXOffset;
|
||||
@ -629,7 +629,7 @@ bool InsetText::updateInsetInInset(BufferView * bv, InsetOld * inset)
|
||||
return false;
|
||||
found = tl_inset->updateInsetInInset(bv, inset);
|
||||
ustat = FULL;
|
||||
} else {
|
||||
} else {
|
||||
text_.updateInset(tl_inset);
|
||||
setUpdateStatus(ustat);
|
||||
}
|
||||
|
@ -113,15 +113,16 @@ void LyXLex::Pimpl::popTable()
|
||||
|
||||
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;
|
||||
@ -133,6 +134,9 @@ bool LyXLex::Pimpl::setFile(string const & filename)
|
||||
} 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;
|
||||
@ -142,7 +146,6 @@ bool LyXLex::Pimpl::setFile(string const & filename)
|
||||
lineno = 0;
|
||||
return fb__.is_open() && is.good();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -404,8 +404,8 @@ LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
|
||||
}
|
||||
|
||||
|
||||
lyx::pos_type
|
||||
Paragraph::getEndPosOfFontSpan(lyx::pos_type pos) const
|
||||
lyx::pos_type
|
||||
Paragraph::getEndPosOfFontSpan(lyx::pos_type pos) const
|
||||
{
|
||||
Assert(pos <= size());
|
||||
|
||||
|
@ -1167,7 +1167,7 @@ void LyXText::setHeightOfRow(RowList::iterator rit)
|
||||
maxasc = max(maxasc, tmpinset->ascent());
|
||||
maxdesc = max(maxdesc, tmpinset->descent());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Fall-back to normal case
|
||||
maxwidth += singleWidth(pit, pos, c);
|
||||
|
@ -97,7 +97,7 @@ namespace {
|
||||
// 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();
|
||||
|
Loading…
Reference in New Issue
Block a user