mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +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>
|
2003-07-27 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||||
|
|
||||||
* configure.ac: new file
|
* configure.ac: new file
|
||||||
|
@ -246,6 +246,9 @@ LYX_CHECK_DECL(vsnprintf, stdio.h)
|
|||||||
LYX_CHECK_DECL(istreambuf_iterator, iterator)
|
LYX_CHECK_DECL(istreambuf_iterator, iterator)
|
||||||
LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
|
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 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 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
|
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>
|
2003-07-28 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||||
|
|
||||||
* buffer.C (do_writeFile, makeLaTeXFile, makeLinuxDocFile,
|
* buffer.C (do_writeFile, makeLaTeXFile, makeLinuxDocFile,
|
||||||
makeDocBookFile): put the real LyX version in the first line of
|
makeDocBookFile): put the real LyX version in the first line of
|
||||||
the file
|
the file
|
||||||
|
|
||||||
* version.h:
|
* version.h:
|
||||||
* version.C.in: remove lyx_docversion
|
* version.C.in: remove lyx_docversion
|
||||||
|
|
||||||
* tabular.C (write_attribute): add a template-based version to
|
* tabular.C (write_attribute): add a template-based version to
|
||||||
|
@ -31,7 +31,7 @@ BOOST_LIBS = -lboost_regex -lboost_signals
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
lyx_LDADD = $(LYX_CONV_LIBS) $(BOOST_LIBS) $(INTLLIBS) \
|
lyx_LDADD = $(LYX_CONV_LIBS) $(BOOST_LIBS) $(INTLLIBS) \
|
||||||
$(AIKSAURUS_LIBS) @LIBS@ -lz
|
$(AIKSAURUS_LIBS) @LIBS@
|
||||||
|
|
||||||
lyx_DEPENDENCIES = $(LYX_CONV_LIBS) $(BOOST_LIBS) $(INTLLIBS)
|
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());
|
bool ret = readFile(lex, filename, paragraphs.begin());
|
||||||
|
|
||||||
// After we have read a file, we must ensure that the buffer
|
// 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;
|
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());
|
gz::ogzstream ofs(fname.c_str());
|
||||||
|
|
||||||
if (!ofs)
|
if (!ofs)
|
||||||
return false;
|
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());
|
return retval;
|
||||||
if (!ofs)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return do_writeFile(ofs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
|
|
||||||
// FIXME: it's very silly to pass a lex in here
|
// FIXME: it's very silly to pass a lex in here
|
||||||
/// load a new file
|
/// load a new file
|
||||||
bool readFile(LyXLex &, string const &);
|
bool readFile(string const &);
|
||||||
|
|
||||||
/// read the header, returns number of unknown tokens
|
/// read the header, returns number of unknown tokens
|
||||||
int readHeader(LyXLex & lex);
|
int readHeader(LyXLex & lex);
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "errorlist.h"
|
#include "errorlist.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "vc-backend.h"
|
#include "vc-backend.h"
|
||||||
#include "lyxlex.h"
|
|
||||||
#include "LaTeX.h"
|
#include "LaTeX.h"
|
||||||
#include "ParagraphList.h"
|
#include "ParagraphList.h"
|
||||||
#include "paragraph.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
|
return b->readFile(ts);
|
||||||
LyXLex lex(0, 0);
|
|
||||||
lex.setFile(ts);
|
|
||||||
|
|
||||||
return b->readFile(lex, ts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -166,17 +161,9 @@ Buffer * newFile(string const & filename, string const & templatename,
|
|||||||
tname = templatename;
|
tname = templatename;
|
||||||
|
|
||||||
if (!tname.empty()) {
|
if (!tname.empty()) {
|
||||||
bool templateok = false;
|
if (!b->readFile(tname)) {
|
||||||
LyXLex lex(0, 0);
|
|
||||||
lex.setFile(tname);
|
|
||||||
if (lex.isOK()) {
|
|
||||||
if (b->readFile(lex, tname)) {
|
|
||||||
templateok = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!templateok) {
|
|
||||||
string const file = MakeDisplayPath(tname, 50);
|
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);
|
"could not be read."), file);
|
||||||
Alert::error(_("Could not read template"), text);
|
Alert::error(_("Could not read template"), text);
|
||||||
// no template, start with empty buffer
|
// 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 cit = terr.begin();
|
||||||
TeXErrors::Errors::const_iterator end = terr.end();
|
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 it = el.begin();
|
||||||
ErrorList::const_iterator end = el.end();
|
ErrorList::const_iterator end = el.end();
|
||||||
|
|
||||||
for (; it != end; ++it)
|
for (; it != end; ++it)
|
||||||
buf.error(*it);
|
buf.error(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ BufferParams::BufferParams()
|
|||||||
sides = LyXTextClass::OneSide;
|
sides = LyXTextClass::OneSide;
|
||||||
columns = 1;
|
columns = 1;
|
||||||
pagestyle = "default";
|
pagestyle = "default";
|
||||||
|
compressed = false;
|
||||||
for (int iter = 0; iter < 4; ++iter) {
|
for (int iter = 0; iter < 4; ++iter) {
|
||||||
user_defined_bullets[iter] = ITEMIZE_DEFAULTS[iter];
|
user_defined_bullets[iter] = ITEMIZE_DEFAULTS[iter];
|
||||||
temp_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();
|
string const paper_option = paperSizeName();
|
||||||
if (paper_option != "letter" ||
|
if (paper_option != "letter" ||
|
||||||
orientation != ORIENTATION_LANDSCAPE) {
|
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
|
// In all other cases, include the paper size
|
||||||
// explicitly.
|
// explicitly.
|
||||||
result = lyxrc.print_paper_flag;
|
result = lyxrc.print_paper_flag;
|
||||||
|
@ -174,6 +174,8 @@ public:
|
|||||||
bool tracking_changes;
|
bool tracking_changes;
|
||||||
/// Time ago we agreed that this was a buffer property [ale990407]
|
/// Time ago we agreed that this was a buffer property [ale990407]
|
||||||
string parentname;
|
string parentname;
|
||||||
|
///
|
||||||
|
bool compressed;
|
||||||
|
|
||||||
/// map of the file's author IDs to buffer author IDs
|
/// map of the file's author IDs to buffer author IDs
|
||||||
std::vector<int> author_map;
|
std::vector<int> author_map;
|
||||||
|
@ -554,7 +554,7 @@ int InsetGraphics::linuxdoc(Buffer const * buf, ostream & os) const
|
|||||||
{
|
{
|
||||||
string const file_name = buf->niceFile ?
|
string const file_name = buf->niceFile ?
|
||||||
params().filename.relFilename(buf->filePath()):
|
params().filename.relFilename(buf->filePath()):
|
||||||
params().filename.absFilename();
|
params().filename.absFilename();
|
||||||
|
|
||||||
os << "<eps file=\"" << file_name << "\">\n";
|
os << "<eps file=\"" << file_name << "\">\n";
|
||||||
os << "<img src=\"" << file_name << "\">";
|
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;
|
the_locking_inset = inset;
|
||||||
inset_x = cix() - top_x + drawTextXOffset;
|
inset_x = cix() - top_x + drawTextXOffset;
|
||||||
@ -629,7 +629,7 @@ bool InsetText::updateInsetInInset(BufferView * bv, InsetOld * inset)
|
|||||||
return false;
|
return false;
|
||||||
found = tl_inset->updateInsetInInset(bv, inset);
|
found = tl_inset->updateInsetInInset(bv, inset);
|
||||||
ustat = FULL;
|
ustat = FULL;
|
||||||
} else {
|
} else {
|
||||||
text_.updateInset(tl_inset);
|
text_.updateInset(tl_inset);
|
||||||
setUpdateStatus(ustat);
|
setUpdateStatus(ustat);
|
||||||
}
|
}
|
||||||
|
@ -113,15 +113,16 @@ void LyXLex::Pimpl::popTable()
|
|||||||
|
|
||||||
bool LyXLex::Pimpl::setFile(string const & filename)
|
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
|
// Check the format of the file.
|
||||||
// a bug in compaq cxx 6.2, where is_open() returns 'true' for a
|
string const format = getExtFromContents(filename);
|
||||||
// fresh new filebuf. (JMarc)
|
|
||||||
if (compressed) {
|
if (format == "gzip" || format == "zip" || format == "compress") {
|
||||||
lyxerr << "lyxlex: compressed" << endl;
|
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)
|
if (gz__.is_open() || is.tellg() > 0)
|
||||||
lyxerr[Debug::LYXLEX] << "Error in LyXLex::setFile: "
|
lyxerr[Debug::LYXLEX] << "Error in LyXLex::setFile: "
|
||||||
"file or stream already set." << endl;
|
"file or stream already set." << endl;
|
||||||
@ -133,6 +134,9 @@ bool LyXLex::Pimpl::setFile(string const & filename)
|
|||||||
} else {
|
} else {
|
||||||
lyxerr << "lyxlex: UNcompressed" << endl;
|
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)
|
if (fb__.is_open() || is.tellg() > 0)
|
||||||
lyxerr[Debug::LYXLEX] << "Error in LyXLex::setFile: "
|
lyxerr[Debug::LYXLEX] << "Error in LyXLex::setFile: "
|
||||||
"file or stream already set." << endl;
|
"file or stream already set." << endl;
|
||||||
@ -142,7 +146,6 @@ bool LyXLex::Pimpl::setFile(string const & filename)
|
|||||||
lineno = 0;
|
lineno = 0;
|
||||||
return fb__.is_open() && is.good();
|
return fb__.is_open() && is.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -404,8 +404,8 @@ LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lyx::pos_type
|
lyx::pos_type
|
||||||
Paragraph::getEndPosOfFontSpan(lyx::pos_type pos) const
|
Paragraph::getEndPosOfFontSpan(lyx::pos_type pos) const
|
||||||
{
|
{
|
||||||
Assert(pos <= size());
|
Assert(pos <= size());
|
||||||
|
|
||||||
|
@ -1167,7 +1167,7 @@ void LyXText::setHeightOfRow(RowList::iterator rit)
|
|||||||
maxasc = max(maxasc, tmpinset->ascent());
|
maxasc = max(maxasc, tmpinset->ascent());
|
||||||
maxdesc = max(maxdesc, tmpinset->descent());
|
maxdesc = max(maxdesc, tmpinset->descent());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fall-back to normal case
|
// Fall-back to normal case
|
||||||
maxwidth += singleWidth(pit, pos, c);
|
maxwidth += singleWidth(pit, pos, c);
|
||||||
|
@ -97,7 +97,7 @@ namespace {
|
|||||||
// check if the given co-ordinates are inside an inset at the
|
// check if the given co-ordinates are inside an inset at the
|
||||||
// given cursor, if one exists. If so, the inset is returned,
|
// given cursor, if one exists. If so, the inset is returned,
|
||||||
// and the co-ordinates are made relative. Otherwise, 0 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)
|
LyXCursor const & cur, int & x, int & y)
|
||||||
{
|
{
|
||||||
lyx::pos_type const pos = cur.pos();
|
lyx::pos_type const pos = cur.pos();
|
||||||
|
Loading…
Reference in New Issue
Block a user