mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Georg Baum\'s no-tempdir patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8458 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fff9cb2dbc
commit
d891a896f4
@ -5,12 +5,10 @@ src/Chktex.C
|
|||||||
src/LColor.C
|
src/LColor.C
|
||||||
src/LaTeX.C
|
src/LaTeX.C
|
||||||
src/MenuBackend.C
|
src/MenuBackend.C
|
||||||
src/ParagraphParameters.C
|
|
||||||
src/buffer.C
|
src/buffer.C
|
||||||
src/buffer_funcs.C
|
src/buffer_funcs.C
|
||||||
src/bufferlist.C
|
src/bufferlist.C
|
||||||
src/bufferparams.C
|
src/bufferparams.C
|
||||||
src/bufferview_funcs.C
|
|
||||||
src/converter.C
|
src/converter.C
|
||||||
src/debug.C
|
src/debug.C
|
||||||
src/exporter.C
|
src/exporter.C
|
||||||
@ -195,8 +193,6 @@ src/paragraph.C
|
|||||||
src/paragraph_funcs.C
|
src/paragraph_funcs.C
|
||||||
src/rowpainter.C
|
src/rowpainter.C
|
||||||
src/support/globbing.C
|
src/support/globbing.C
|
||||||
src/support/path_defines.C
|
|
||||||
src/tex2lyx/lengthcommon.C
|
|
||||||
src/text.C
|
src/text.C
|
||||||
src/text2.C
|
src/text2.C
|
||||||
src/text3.C
|
src/text3.C
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
2004-02-21 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||||
|
|
||||||
|
* lyxrc.C, buffer.C, exporter.C: use always a temp dir, ignore
|
||||||
|
use_tempdir in preferences
|
||||||
|
* buffer.C (readFile), lyxvc.C (getLogFile): check success of
|
||||||
|
tempfile creation
|
||||||
|
* lyx_main.C: ensure that tempdir is valid
|
||||||
|
* lyxlex.h: correct typo
|
||||||
|
* buffer.[Ch] (isMultiLingual), (isUnnamed): make const
|
||||||
|
* paragraph.[Ch] (isMultiLingual): make const
|
||||||
|
* cursor.[Ch] (openable): make const
|
||||||
|
|
||||||
2004-02-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
2004-02-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||||
|
|
||||||
* text3.C: fixed LFUN_QUOTE and add lfun arguments single/double.
|
* text3.C: fixed LFUN_QUOTE and add lfun arguments single/double.
|
||||||
|
41
src/buffer.C
41
src/buffer.C
@ -34,6 +34,7 @@
|
|||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "lyxvc.h"
|
#include "lyxvc.h"
|
||||||
|
#include "lyx_main.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "output_docbook.h"
|
#include "output_docbook.h"
|
||||||
@ -85,7 +86,7 @@ using lyx::support::atoi;
|
|||||||
using lyx::support::bformat;
|
using lyx::support::bformat;
|
||||||
using lyx::support::ChangeExtension;
|
using lyx::support::ChangeExtension;
|
||||||
using lyx::support::cmd_ret;
|
using lyx::support::cmd_ret;
|
||||||
using lyx::support::CreateBufferTmpDir;
|
using lyx::support::createBufferTmpDir;
|
||||||
using lyx::support::destroyDir;
|
using lyx::support::destroyDir;
|
||||||
using lyx::support::FileInfo;
|
using lyx::support::FileInfo;
|
||||||
using lyx::support::FileInfo;
|
using lyx::support::FileInfo;
|
||||||
@ -190,8 +191,10 @@ Buffer::Impl::Impl(Buffer & parent, string const & file, bool readonly_)
|
|||||||
text(0, 0)
|
text(0, 0)
|
||||||
{
|
{
|
||||||
lyxvc.buffer(&parent);
|
lyxvc.buffer(&parent);
|
||||||
if (readonly_ || lyxrc.use_tempdir)
|
temppath = createBufferTmpDir();
|
||||||
temppath = CreateBufferTmpDir();
|
// FIXME: And now do something if temppath == string(), because we
|
||||||
|
// assume from now on that temppath points to a valid temp dir.
|
||||||
|
// See http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg67406.html
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -318,10 +321,7 @@ pair<Buffer::LogType, string> const Buffer::getLogName() const
|
|||||||
if (filename.empty())
|
if (filename.empty())
|
||||||
return make_pair(Buffer::latexlog, string());
|
return make_pair(Buffer::latexlog, string());
|
||||||
|
|
||||||
string path = OnlyPath(filename);
|
string const path = temppath();
|
||||||
|
|
||||||
if (lyxrc.use_tempdir || !IsDirWriteable(path))
|
|
||||||
path = temppath();
|
|
||||||
|
|
||||||
string const fname = AddName(path,
|
string const fname = AddName(path,
|
||||||
OnlyFilename(ChangeExtension(filename,
|
OnlyFilename(ChangeExtension(filename,
|
||||||
@ -596,6 +596,15 @@ bool Buffer::readFile(LyXLex & lex, string const & filename,
|
|||||||
filename));
|
filename));
|
||||||
} else if (file_format < LYX_FORMAT) {
|
} else if (file_format < LYX_FORMAT) {
|
||||||
string const tmpfile = tempName();
|
string const tmpfile = tempName();
|
||||||
|
if (tmpfile.empty()) {
|
||||||
|
Alert::error(_("Conversion failed"),
|
||||||
|
bformat(_("%1$s is from an earlier"
|
||||||
|
" version of LyX, but a temporary"
|
||||||
|
" file for converting it could"
|
||||||
|
" not be created."),
|
||||||
|
filename));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
string command = LibFileSearch("lyx2lyx", "lyx2lyx");
|
string command = LibFileSearch("lyx2lyx", "lyx2lyx");
|
||||||
if (command.empty()) {
|
if (command.empty()) {
|
||||||
Alert::error(_("Conversion script not found"),
|
Alert::error(_("Conversion script not found"),
|
||||||
@ -953,7 +962,7 @@ bool Buffer::isSGML() const
|
|||||||
|
|
||||||
void Buffer::makeLinuxDocFile(string const & fname,
|
void Buffer::makeLinuxDocFile(string const & fname,
|
||||||
OutputParams const & runparams,
|
OutputParams const & runparams,
|
||||||
bool body_only )
|
bool body_only)
|
||||||
{
|
{
|
||||||
ofstream ofs;
|
ofstream ofs;
|
||||||
if (!openFileWrite(ofs, fname))
|
if (!openFileWrite(ofs, fname))
|
||||||
@ -1074,12 +1083,8 @@ int Buffer::runChktex()
|
|||||||
|
|
||||||
// get LaTeX-Filename
|
// get LaTeX-Filename
|
||||||
string const name = getLatexName();
|
string const name = getLatexName();
|
||||||
string path = filePath();
|
string const path = temppath();
|
||||||
|
string const org_path = filePath();
|
||||||
string const org_path = path;
|
|
||||||
if (lyxrc.use_tempdir || !IsDirWriteable(path)) {
|
|
||||||
path = temppath();
|
|
||||||
}
|
|
||||||
|
|
||||||
Path p(path); // path to LaTeX file
|
Path p(path); // path to LaTeX file
|
||||||
message(_("Running chktex..."));
|
message(_("Running chktex..."));
|
||||||
@ -1272,10 +1277,10 @@ void Buffer::updateDocLang(Language const * nlang)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Buffer::isMultiLingual()
|
bool Buffer::isMultiLingual() const
|
||||||
{
|
{
|
||||||
ParIterator end = par_iterator_end();
|
ParConstIterator end = par_iterator_end();
|
||||||
for (ParIterator it = par_iterator_begin(); it != end; ++it)
|
for (ParConstIterator it = par_iterator_begin(); it != end; ++it)
|
||||||
if (it->isMultiLingual(params()))
|
if (it->isMultiLingual(params()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -1424,7 +1429,7 @@ void Buffer::setUnnamed(bool flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Buffer::isUnnamed()
|
bool Buffer::isUnnamed() const
|
||||||
{
|
{
|
||||||
return pimpl_->unnamed;
|
return pimpl_->unnamed;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ public:
|
|||||||
void setUnnamed(bool flag = true);
|
void setUnnamed(bool flag = true);
|
||||||
|
|
||||||
///
|
///
|
||||||
bool isUnnamed();
|
bool isUnnamed() const;
|
||||||
|
|
||||||
/// Mark this buffer as dirty.
|
/// Mark this buffer as dirty.
|
||||||
void markDirty();
|
void markDirty();
|
||||||
@ -248,7 +248,7 @@ public:
|
|||||||
void updateDocLang(Language const * nlang);
|
void updateDocLang(Language const * nlang);
|
||||||
|
|
||||||
///
|
///
|
||||||
bool isMultiLingual();
|
bool isMultiLingual() const;
|
||||||
|
|
||||||
/// Does this mean that this is buffer local?
|
/// Does this mean that this is buffer local?
|
||||||
limited_stack<Undo> & undostack();
|
limited_stack<Undo> & undostack();
|
||||||
|
@ -894,7 +894,7 @@ bool LCursor::isInside(InsetBase const * p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LCursor::openable(MathAtom const & t)
|
bool LCursor::openable(MathAtom const & t) const
|
||||||
{
|
{
|
||||||
if (!t->isActive())
|
if (!t->isActive())
|
||||||
return false;
|
return false;
|
||||||
|
@ -471,7 +471,7 @@ private:
|
|||||||
/// where in the curent cell does the macro name start?
|
/// where in the curent cell does the macro name start?
|
||||||
int macroNamePos();
|
int macroNamePos();
|
||||||
/// can we enter the inset?
|
/// can we enter the inset?
|
||||||
bool openable(MathAtom const &);
|
bool openable(MathAtom const &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LYXCURSOR_H
|
#endif // LYXCURSOR_H
|
||||||
|
@ -85,8 +85,7 @@ bool Exporter::Export(Buffer * buffer, string const & format,
|
|||||||
backend_format = format;
|
backend_format = format;
|
||||||
|
|
||||||
string filename = buffer->getLatexName(false);
|
string filename = buffer->getLatexName(false);
|
||||||
if (!buffer->temppath().empty())
|
filename = AddName(buffer->temppath(), filename);
|
||||||
filename = AddName(buffer->temppath(), filename);
|
|
||||||
filename = ChangeExtension(filename,
|
filename = ChangeExtension(filename,
|
||||||
formats.extension(backend_format));
|
formats.extension(backend_format));
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2004-02-21 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||||
|
|
||||||
|
* ControlPrint.C, ControlSendto.C: use always a temp dir
|
||||||
|
* ControlSendto.C: check return value of buffer()->writeFile()
|
||||||
|
|
||||||
2004-02-01 Lars Gullik Bjonnes <larsbj@gullik.net>
|
2004-02-01 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||||
|
|
||||||
* biblio.C (parseBibTeX): "=" -> '='
|
* biblio.C (parseBibTeX): "=" -> '='
|
||||||
|
@ -170,10 +170,7 @@ void ControlPrint::apply()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Push directory path.
|
// Push directory path.
|
||||||
string path = buffer()->filePath();
|
string const path = buffer()->temppath();
|
||||||
if (lyxrc.use_tempdir || !IsDirWriteable(path)) {
|
|
||||||
path = buffer()->temppath();
|
|
||||||
}
|
|
||||||
Path p(path);
|
Path p(path);
|
||||||
|
|
||||||
// there are three cases here:
|
// there are three cases here:
|
||||||
|
@ -120,10 +120,10 @@ void ControlSendto::apply()
|
|||||||
if (format_->name() == "lyx") {
|
if (format_->name() == "lyx") {
|
||||||
filename = ChangeExtension(buffer()->getLatexName(false),
|
filename = ChangeExtension(buffer()->getLatexName(false),
|
||||||
format_->extension());
|
format_->extension());
|
||||||
if (!buffer()->temppath().empty())
|
filename = AddName(buffer()->temppath(), filename);
|
||||||
filename = AddName(buffer()->temppath(), filename);
|
|
||||||
|
|
||||||
buffer()->writeFile(filename);
|
if (!buffer()->writeFile(filename))
|
||||||
|
return;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Exporter::Export(buffer(), format_->name(), true, filename);
|
Exporter::Export(buffer(), format_->name(), true, filename);
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2004-02-21 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||||
|
|
||||||
|
* QPrefs.C, QPrefsDialog.C, ui/QPrefPathsModule.ui: remove
|
||||||
|
use_tempdir
|
||||||
|
|
||||||
2004-02-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
2004-02-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||||
|
|
||||||
* QDocument.C:
|
* QDocument.C:
|
||||||
|
@ -195,7 +195,6 @@ void QPrefs::apply()
|
|||||||
rc.document_path = fromqstr(pathsmod->workingDirED->text());
|
rc.document_path = fromqstr(pathsmod->workingDirED->text());
|
||||||
rc.template_path = fromqstr(pathsmod->templateDirED->text());
|
rc.template_path = fromqstr(pathsmod->templateDirED->text());
|
||||||
rc.backupdir_path = fromqstr(pathsmod->backupDirED->text());
|
rc.backupdir_path = fromqstr(pathsmod->backupDirED->text());
|
||||||
rc.use_tempdir = pathsmod->tempDirCB->isChecked();
|
|
||||||
rc.tempdir_path = fromqstr(pathsmod->tempDirED->text());
|
rc.tempdir_path = fromqstr(pathsmod->tempDirED->text());
|
||||||
// FIXME: should be a checkbox only
|
// FIXME: should be a checkbox only
|
||||||
rc.lyxpipes = fromqstr(pathsmod->lyxserverDirED->text());
|
rc.lyxpipes = fromqstr(pathsmod->lyxserverDirED->text());
|
||||||
@ -499,7 +498,6 @@ void QPrefs::update_contents()
|
|||||||
pathsmod->workingDirED->setText(toqstr(rc.document_path));
|
pathsmod->workingDirED->setText(toqstr(rc.document_path));
|
||||||
pathsmod->templateDirED->setText(toqstr(rc.template_path));
|
pathsmod->templateDirED->setText(toqstr(rc.template_path));
|
||||||
pathsmod->backupDirED->setText(toqstr(rc.backupdir_path));
|
pathsmod->backupDirED->setText(toqstr(rc.backupdir_path));
|
||||||
pathsmod->tempDirCB->setChecked(rc.use_tempdir);
|
|
||||||
pathsmod->tempDirED->setText(toqstr(rc.tempdir_path));
|
pathsmod->tempDirED->setText(toqstr(rc.tempdir_path));
|
||||||
// FIXME: should be a checkbox only
|
// FIXME: should be a checkbox only
|
||||||
pathsmod->lyxserverDirED->setText(toqstr(rc.lyxpipes));
|
pathsmod->lyxserverDirED->setText(toqstr(rc.lyxpipes));
|
||||||
|
@ -210,7 +210,6 @@ QPrefsDialog::QPrefsDialog(QPrefs * form)
|
|||||||
connect(pathsModule->workingDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
connect(pathsModule->workingDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
||||||
connect(pathsModule->templateDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
connect(pathsModule->templateDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
||||||
connect(pathsModule->backupDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
connect(pathsModule->backupDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
||||||
connect(pathsModule->tempDirCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
||||||
connect(pathsModule->tempDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
connect(pathsModule->tempDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
||||||
connect(pathsModule->lyxserverDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
connect(pathsModule->lyxserverDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
||||||
connect(spellcheckerModule->spellCommandCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
connect(spellcheckerModule->spellCommandCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
||||||
|
@ -142,14 +142,18 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget row="4" column="0" >
|
<widget row="4" column="0" >
|
||||||
<class>QCheckBox</class>
|
<class>QLabel</class>
|
||||||
<property stdset="1">
|
<property stdset="1">
|
||||||
<name>name</name>
|
<name>name</name>
|
||||||
<cstring>tempDirCB</cstring>
|
<cstring>tempDirLA</cstring>
|
||||||
</property>
|
</property>
|
||||||
<property stdset="1">
|
<property stdset="1">
|
||||||
<name>text</name>
|
<name>text</name>
|
||||||
<string>&Use temporary directory</string>
|
<string>&Temporary directory:</string>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>buddy</name>
|
||||||
|
<cstring>tempDirED</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget row="3" column="2" >
|
<widget row="3" column="2" >
|
||||||
@ -251,20 +255,6 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</vbox>
|
</vbox>
|
||||||
</widget>
|
</widget>
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>tempDirCB</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>tempDirED</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>tempDirCB</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>tempDirPB</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>workingDirED</tabstop>
|
<tabstop>workingDirED</tabstop>
|
||||||
<tabstop>workingDirPB</tabstop>
|
<tabstop>workingDirPB</tabstop>
|
||||||
@ -274,7 +264,6 @@
|
|||||||
<tabstop>backupDirPB</tabstop>
|
<tabstop>backupDirPB</tabstop>
|
||||||
<tabstop>lyxserverDirED</tabstop>
|
<tabstop>lyxserverDirED</tabstop>
|
||||||
<tabstop>lyxserverDirPB</tabstop>
|
<tabstop>lyxserverDirPB</tabstop>
|
||||||
<tabstop>tempDirCB</tabstop>
|
|
||||||
<tabstop>tempDirED</tabstop>
|
<tabstop>tempDirED</tabstop>
|
||||||
<tabstop>tempDirPB</tabstop>
|
<tabstop>tempDirPB</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2004-02-21 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||||
|
|
||||||
|
* FormPreferences.C, forms/form_preferences.fd: remove use_tempdir
|
||||||
|
|
||||||
2004-02-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
2004-02-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||||
|
|
||||||
* FormDocument.C:
|
* FormDocument.C:
|
||||||
|
@ -1825,17 +1825,10 @@ void FormPreferences::Paths::apply(LyXRC & rc)
|
|||||||
{
|
{
|
||||||
rc.document_path = fl_get_input(dialog_->input_default_path);
|
rc.document_path = fl_get_input(dialog_->input_default_path);
|
||||||
rc.template_path = fl_get_input(dialog_->input_template_path);
|
rc.template_path = fl_get_input(dialog_->input_template_path);
|
||||||
|
rc.tempdir_path = fl_get_input(dialog_->input_temp_dir);
|
||||||
|
|
||||||
int button = fl_get_button(dialog_->check_use_temp_dir);
|
int button = fl_get_button(dialog_->check_last_files);
|
||||||
string str = fl_get_input(dialog_->input_temp_dir);
|
string str = fl_get_input(dialog_->input_lastfiles);
|
||||||
if (!button)
|
|
||||||
str.erase();
|
|
||||||
|
|
||||||
rc.use_tempdir = button;
|
|
||||||
rc.tempdir_path = str;
|
|
||||||
|
|
||||||
button = fl_get_button(dialog_->check_last_files);
|
|
||||||
str = fl_get_input(dialog_->input_lastfiles);
|
|
||||||
if (!button) str.erase();
|
if (!button) str.erase();
|
||||||
|
|
||||||
rc.check_lastfiles = button;
|
rc.check_lastfiles = button;
|
||||||
@ -1880,7 +1873,6 @@ void FormPreferences::Paths::build()
|
|||||||
setPrehandler(dialog_->input_backup_path);
|
setPrehandler(dialog_->input_backup_path);
|
||||||
setPrehandler(dialog_->input_serverpipe);
|
setPrehandler(dialog_->input_serverpipe);
|
||||||
setPrehandler(dialog_->input_temp_dir);
|
setPrehandler(dialog_->input_temp_dir);
|
||||||
setPrehandler(dialog_->check_use_temp_dir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1891,8 +1883,6 @@ FormPreferences::Paths::feedback(FL_OBJECT const * const ob) const
|
|||||||
return LyXRC::getDescription(LyXRC::RC_DOCUMENTPATH);
|
return LyXRC::getDescription(LyXRC::RC_DOCUMENTPATH);
|
||||||
if (ob == dialog_->input_template_path)
|
if (ob == dialog_->input_template_path)
|
||||||
return LyXRC::getDescription(LyXRC::RC_TEMPLATEPATH);
|
return LyXRC::getDescription(LyXRC::RC_TEMPLATEPATH);
|
||||||
if (ob == dialog_->check_use_temp_dir)
|
|
||||||
return LyXRC::getDescription(LyXRC::RC_USETEMPDIR);
|
|
||||||
if (ob == dialog_->input_temp_dir)
|
if (ob == dialog_->input_temp_dir)
|
||||||
return LyXRC::getDescription(LyXRC::RC_TEMPDIRPATH);
|
return LyXRC::getDescription(LyXRC::RC_TEMPDIRPATH);
|
||||||
if (ob == dialog_->check_last_files)
|
if (ob == dialog_->check_last_files)
|
||||||
@ -1918,11 +1908,6 @@ bool FormPreferences::Paths::input(FL_OBJECT const * const ob)
|
|||||||
// !ob if function is called from Paths::update() to de/activate
|
// !ob if function is called from Paths::update() to de/activate
|
||||||
// objects,
|
// objects,
|
||||||
// otherwise the function is called by an xforms CB via input().
|
// otherwise the function is called by an xforms CB via input().
|
||||||
if (!ob || ob == dialog_->check_use_temp_dir) {
|
|
||||||
bool const enable = fl_get_button(dialog_->check_use_temp_dir);
|
|
||||||
setEnabled(dialog_->input_temp_dir, enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ob || ob == dialog_->check_last_files) {
|
if (!ob || ob == dialog_->check_last_files) {
|
||||||
bool const enable = fl_get_button(dialog_->check_last_files);
|
bool const enable = fl_get_button(dialog_->check_last_files);
|
||||||
setEnabled(dialog_->input_lastfiles, enable);
|
setEnabled(dialog_->input_lastfiles, enable);
|
||||||
@ -2046,13 +2031,7 @@ void FormPreferences::Paths::update(LyXRC const & rc)
|
|||||||
rc.make_backup);
|
rc.make_backup);
|
||||||
fl_set_input(dialog_->input_backup_path, str.c_str());
|
fl_set_input(dialog_->input_backup_path, str.c_str());
|
||||||
|
|
||||||
str.erase();
|
fl_set_input(dialog_->input_temp_dir, rc.tempdir_path.c_str());
|
||||||
if (rc.use_tempdir)
|
|
||||||
str = rc.tempdir_path;
|
|
||||||
|
|
||||||
fl_set_button(dialog_->check_use_temp_dir,
|
|
||||||
rc.use_tempdir);
|
|
||||||
fl_set_input(dialog_->input_temp_dir, str.c_str());
|
|
||||||
|
|
||||||
str.erase();
|
str.erase();
|
||||||
if (rc.check_lastfiles)
|
if (rc.check_lastfiles)
|
||||||
|
@ -2024,7 +2024,7 @@ argument: 0
|
|||||||
Name: form_preferences_paths
|
Name: form_preferences_paths
|
||||||
Width: 450
|
Width: 450
|
||||||
Height: 350
|
Height: 350
|
||||||
Number of Objects: 17
|
Number of Objects: 16
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BOX
|
class: FL_BOX
|
||||||
@ -2116,25 +2116,6 @@ name: button_template_path_browse
|
|||||||
callback: C_FormBaseInputCB
|
callback: C_FormBaseInputCB
|
||||||
argument: 0
|
argument: 0
|
||||||
|
|
||||||
--------------------
|
|
||||||
class: FL_CHECKBUTTON
|
|
||||||
type: PUSH_BUTTON
|
|
||||||
box: 140 80 30 30
|
|
||||||
boxtype: FL_NO_BOX
|
|
||||||
colors: FL_COL1 FL_YELLOW
|
|
||||||
alignment: FL_ALIGN_LEFT
|
|
||||||
style: FL_NORMAL_STYLE
|
|
||||||
size: FL_NORMAL_SIZE
|
|
||||||
lcol: FL_BLACK
|
|
||||||
label: Temp dir:|#d
|
|
||||||
shortcut:
|
|
||||||
resize: FL_RESIZE_ALL
|
|
||||||
gravity: FL_NoGravity FL_NoGravity
|
|
||||||
name: check_use_temp_dir
|
|
||||||
callback: C_FormBaseInputCB
|
|
||||||
argument: 0
|
|
||||||
value: 1
|
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_INPUT
|
class: FL_INPUT
|
||||||
type: NORMAL_INPUT
|
type: NORMAL_INPUT
|
||||||
@ -2145,7 +2126,7 @@ alignment: FL_ALIGN_LEFT
|
|||||||
style: FL_NORMAL_STYLE
|
style: FL_NORMAL_STYLE
|
||||||
size: FL_NORMAL_SIZE
|
size: FL_NORMAL_SIZE
|
||||||
lcol: FL_BLACK
|
lcol: FL_BLACK
|
||||||
label:
|
label: Temp dir:|#d
|
||||||
shortcut:
|
shortcut:
|
||||||
resize: FL_RESIZE_ALL
|
resize: FL_RESIZE_ALL
|
||||||
gravity: FL_NoGravity FL_NoGravity
|
gravity: FL_NoGravity FL_NoGravity
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2004-02-21 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||||
|
|
||||||
|
* GraphicsCacheItem.C (convertToDisplayFormat): unzip zipped files
|
||||||
|
to a temporary file
|
||||||
|
* PreviewLoader.C: use always a temp dir
|
||||||
|
* PreviewLoader.C: check successfull creation of LaTeX file
|
||||||
|
|
||||||
2004-01-31 Lars Gullik Bjonnes <larsbj@gullik.net>
|
2004-01-31 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||||
|
|
||||||
* PreviewLoader.C (FindFirst): inherit from std::unary_function
|
* PreviewLoader.C (FindFirst): inherit from std::unary_function
|
||||||
|
@ -36,6 +36,7 @@ using support::getExtFromContents;
|
|||||||
using support::tempName;
|
using support::tempName;
|
||||||
using support::unlink;
|
using support::unlink;
|
||||||
using support::unzipFile;
|
using support::unzipFile;
|
||||||
|
using support::unzippedFileName;
|
||||||
using support::zippedFile;
|
using support::zippedFile;
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@ -381,8 +382,19 @@ void CacheItem::Impl::convertToDisplayFormat()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make a local copy in case we unzip it
|
// Make a local copy in case we unzip it
|
||||||
string const filename = zippedFile(filename_) ?
|
string filename;
|
||||||
unzipFile(filename_) : filename_;
|
if ((zipped_ = zippedFile(filename_))) {
|
||||||
|
unzipped_filename_ = tempName(string(), filename_);
|
||||||
|
if (unzipped_filename_.empty()) {
|
||||||
|
setStatus(ErrorConverting);
|
||||||
|
lyxerr[Debug::GRAPHICS]
|
||||||
|
<< "\tCould not create temporary file." << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
filename = unzipFile(filename_, unzipped_filename_);
|
||||||
|
} else
|
||||||
|
filename = filename_;
|
||||||
|
|
||||||
string const displayed_filename = MakeDisplayPath(filename_);
|
string const displayed_filename = MakeDisplayPath(filename_);
|
||||||
lyxerr[Debug::GRAPHICS] << "[GrahicsCacheItem::convertToDisplayFormat]\n"
|
lyxerr[Debug::GRAPHICS] << "[GrahicsCacheItem::convertToDisplayFormat]\n"
|
||||||
<< "\tAttempting to convert image file: " << filename
|
<< "\tAttempting to convert image file: " << filename
|
||||||
@ -412,6 +424,7 @@ void CacheItem::Impl::convertToDisplayFormat()
|
|||||||
remove_loaded_file_ = true;
|
remove_loaded_file_ = true;
|
||||||
|
|
||||||
// Remove the temp file, we only want the name...
|
// Remove the temp file, we only want the name...
|
||||||
|
// FIXME: This is unsafe!
|
||||||
unlink(to_file_base);
|
unlink(to_file_base);
|
||||||
|
|
||||||
// Connect a signal to this->imageConverted and pass this signal to
|
// Connect a signal to this->imageConverted and pass this signal to
|
||||||
|
@ -461,8 +461,7 @@ void PreviewLoader::Impl::startLoading()
|
|||||||
lyxerr[Debug::GRAPHICS] << "PreviewLoader::startLoading()" << endl;
|
lyxerr[Debug::GRAPHICS] << "PreviewLoader::startLoading()" << endl;
|
||||||
|
|
||||||
// As used by the LaTeX file and by the resulting image files
|
// As used by the LaTeX file and by the resulting image files
|
||||||
string const directory = buffer_.temppath().empty() ?
|
string const directory = buffer_.temppath();
|
||||||
buffer_.filePath() : buffer_.temppath();
|
|
||||||
|
|
||||||
string const filename_base(unique_filename(directory));
|
string const filename_base(unique_filename(directory));
|
||||||
|
|
||||||
@ -477,6 +476,12 @@ void PreviewLoader::Impl::startLoading()
|
|||||||
string const latexfile = filename_base + ".tex";
|
string const latexfile = filename_base + ".tex";
|
||||||
|
|
||||||
ofstream of(latexfile.c_str());
|
ofstream of(latexfile.c_str());
|
||||||
|
if (!of) {
|
||||||
|
lyxerr[Debug::GRAPHICS] << "PreviewLoader::startLoading()\n"
|
||||||
|
<< "Unable to create LaTeX file\n"
|
||||||
|
<< latexfile << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
of << "\\batchmode\n";
|
of << "\\batchmode\n";
|
||||||
dumpPreamble(of);
|
dumpPreamble(of);
|
||||||
of << "\n\\begin{document}\n";
|
of << "\n\\begin{document}\n";
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
2004-02-21 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||||
|
|
||||||
|
* insetexternal.C, insetgraphics.C, insetinclude.C: use always a
|
||||||
|
temp dir
|
||||||
|
* insetinclude.C (latex): show a GUI warning if textclasses don't
|
||||||
|
match
|
||||||
|
* insetinclude.C: use mangledFilename() for temp files
|
||||||
|
* insetgraphics.C (readInsetGraphics): remove version check, since
|
||||||
|
the graphics inset has no own fileformat number anymore
|
||||||
|
|
||||||
2004-02-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
2004-02-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||||
|
|
||||||
* insetquotes.[Ch]: added new member that allows direct access
|
* insetquotes.[Ch]: added new member that allows direct access
|
||||||
|
@ -77,6 +77,7 @@ namespace external {
|
|||||||
TempName::TempName()
|
TempName::TempName()
|
||||||
{
|
{
|
||||||
tempname_ = support::tempName(string(), "lyxext");
|
tempname_ = support::tempName(string(), "lyxext");
|
||||||
|
// FIXME: This is unsafe
|
||||||
support::unlink(tempname_);
|
support::unlink(tempname_);
|
||||||
// must have an extension for the converter code to work correctly.
|
// must have an extension for the converter code to work correctly.
|
||||||
tempname_ += ".tmp";
|
tempname_ += ".tmp";
|
||||||
@ -685,8 +686,7 @@ int InsetExternal::latex(Buffer const & buf, ostream & os,
|
|||||||
// run through the LaTeX compiler.
|
// run through the LaTeX compiler.
|
||||||
// If we're running through the LaTeX compiler, we should write the
|
// If we're running through the LaTeX compiler, we should write the
|
||||||
// generated files in the bufer's temporary directory.
|
// generated files in the bufer's temporary directory.
|
||||||
bool const external_in_tmpdir =
|
bool const external_in_tmpdir = !runparams.nice;
|
||||||
lyxrc.use_tempdir && !buf.temppath().empty() && !runparams.nice;
|
|
||||||
|
|
||||||
// If the template has specified a PDFLaTeX output, then we try and
|
// If the template has specified a PDFLaTeX output, then we try and
|
||||||
// use that.
|
// use that.
|
||||||
|
@ -29,9 +29,6 @@ TODO
|
|||||||
|
|
||||||
/* NOTES:
|
/* NOTES:
|
||||||
* Fileformat:
|
* Fileformat:
|
||||||
* Current version is 1 (inset file format version), when changing it
|
|
||||||
* it should be changed in the Write() function when writing in one place
|
|
||||||
* and when reading one should change the version check and the error message.
|
|
||||||
* The filename is kept in the lyx file in a relative way, so as to allow
|
* The filename is kept in the lyx file in a relative way, so as to allow
|
||||||
* moving the document file and its images with no problem.
|
* moving the document file and its images with no problem.
|
||||||
*
|
*
|
||||||
@ -281,18 +278,7 @@ void InsetGraphics::readInsetGraphics(LyXLex & lex, string const & bufpath)
|
|||||||
continue;
|
continue;
|
||||||
} else if (token == "\\end_inset") {
|
} else if (token == "\\end_inset") {
|
||||||
finished = true;
|
finished = true;
|
||||||
} else if (token == "FormatVersion") {
|
} else {
|
||||||
lex.next();
|
|
||||||
int version = lex.getInteger();
|
|
||||||
if (version > VersionNumber)
|
|
||||||
lyxerr
|
|
||||||
<< "This document was created with a newer Graphics widget"
|
|
||||||
", You should use a newer version of LyX to read this"
|
|
||||||
" file."
|
|
||||||
<< endl;
|
|
||||||
// TODO: Possibly open up a dialog?
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!params_.Read(lex, token, bufpath))
|
if (!params_.Read(lex, token, bufpath))
|
||||||
lyxerr << "Unknown token, " << token << ", skipping."
|
lyxerr << "Unknown token, " << token << ", skipping."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -469,9 +455,6 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
|
|||||||
lyxerr[Debug::GRAPHICS]
|
lyxerr[Debug::GRAPHICS]
|
||||||
<< "\t we have: from " << from << " to " << to << '\n';
|
<< "\t we have: from " << from << " to " << to << '\n';
|
||||||
|
|
||||||
if (from == to && !lyxrc.use_tempdir)
|
|
||||||
return stripExtensionIfPossible(orig_file, to);
|
|
||||||
|
|
||||||
// We're going to be running the exported buffer through the LaTeX
|
// We're going to be running the exported buffer through the LaTeX
|
||||||
// compiler, so must ensure that LaTeX can cope with the graphics
|
// compiler, so must ensure that LaTeX can cope with the graphics
|
||||||
// file format.
|
// file format.
|
||||||
@ -480,16 +463,14 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
|
|||||||
<< "\tthe orig file is: " << orig_file << endl;
|
<< "\tthe orig file is: " << orig_file << endl;
|
||||||
|
|
||||||
bool conversion_needed = true;
|
bool conversion_needed = true;
|
||||||
if (lyxrc.use_tempdir) {
|
CopyStatus status;
|
||||||
CopyStatus status;
|
boost::tie(status, temp_file) =
|
||||||
boost::tie(status, temp_file) =
|
|
||||||
copyToDirIfNeeded(orig_file, buf.temppath());
|
copyToDirIfNeeded(orig_file, buf.temppath());
|
||||||
|
|
||||||
if (status == FAILURE)
|
if (status == FAILURE)
|
||||||
return orig_file;
|
return orig_file;
|
||||||
else if (status == IDENTICAL_CONTENTS)
|
else if (status == IDENTICAL_CONTENTS)
|
||||||
conversion_needed = false;
|
conversion_needed = false;
|
||||||
}
|
|
||||||
|
|
||||||
if (from == to)
|
if (from == to)
|
||||||
return stripExtensionIfPossible(temp_file, to);
|
return stripExtensionIfPossible(temp_file, to);
|
||||||
@ -515,7 +496,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
|
|||||||
<< "\tto_file_base = " << to_file_base << '\n'
|
<< "\tto_file_base = " << to_file_base << '\n'
|
||||||
<< "\t from " << from << " to " << to << '\n';
|
<< "\t from " << from << " to " << to << '\n';
|
||||||
|
|
||||||
// if no special converter defined, than we take the default one
|
// if no special converter defined, then we take the default one
|
||||||
// from ImageMagic: convert from:inname.from to:outname.to
|
// from ImageMagic: convert from:inname.from to:outname.to
|
||||||
if (!converters.convert(&buf, temp_file, to_file_base, from, to)) {
|
if (!converters.convert(&buf, temp_file, to_file_base, from, to)) {
|
||||||
string const command =
|
string const command =
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "metricsinfo.h"
|
#include "metricsinfo.h"
|
||||||
#include "outputparams.h"
|
#include "outputparams.h"
|
||||||
|
|
||||||
|
#include "frontends/Alert.h"
|
||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
#include "frontends/Painter.h"
|
#include "frontends/Painter.h"
|
||||||
|
|
||||||
@ -36,6 +37,7 @@
|
|||||||
#include "insets/render_preview.h"
|
#include "insets/render_preview.h"
|
||||||
|
|
||||||
#include "support/FileInfo.h"
|
#include "support/FileInfo.h"
|
||||||
|
#include "support/filename.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "support/lstrings.h" // contains
|
#include "support/lstrings.h" // contains
|
||||||
#include "support/tostr.h"
|
#include "support/tostr.h"
|
||||||
@ -46,9 +48,11 @@
|
|||||||
#include "support/std_sstream.h"
|
#include "support/std_sstream.h"
|
||||||
|
|
||||||
using lyx::support::AddName;
|
using lyx::support::AddName;
|
||||||
|
using lyx::support::bformat;
|
||||||
using lyx::support::ChangeExtension;
|
using lyx::support::ChangeExtension;
|
||||||
using lyx::support::contains;
|
using lyx::support::contains;
|
||||||
using lyx::support::FileInfo;
|
using lyx::support::FileInfo;
|
||||||
|
using lyx::support::FileName;
|
||||||
using lyx::support::GetFileContents;
|
using lyx::support::GetFileContents;
|
||||||
using lyx::support::IsFileReadable;
|
using lyx::support::IsFileReadable;
|
||||||
using lyx::support::IsLyXFilename;
|
using lyx::support::IsLyXFilename;
|
||||||
@ -307,30 +311,25 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
|
|||||||
if (loadIfNeeded(buffer, params_)) {
|
if (loadIfNeeded(buffer, params_)) {
|
||||||
Buffer * tmp = bufferlist.getBuffer(included_file);
|
Buffer * tmp = bufferlist.getBuffer(included_file);
|
||||||
|
|
||||||
// FIXME: this should be a GUI warning
|
|
||||||
if (tmp->params().textclass != buffer.params().textclass) {
|
if (tmp->params().textclass != buffer.params().textclass) {
|
||||||
lyxerr << "WARNING: Included file `"
|
string text = bformat(_("Included file `%1$s'\n"
|
||||||
<< MakeDisplayPath(included_file)
|
"has textclass `%2$s'\n"
|
||||||
<< "' has textclass `"
|
"while parent file has textclass `%3$s'."),
|
||||||
<< tmp->params().getLyXTextClass().name()
|
MakeDisplayPath(included_file),
|
||||||
<< "' while parent file has textclass `"
|
tmp->params().getLyXTextClass().name(),
|
||||||
<< buffer.params().getLyXTextClass().name()
|
buffer.params().getLyXTextClass().name());
|
||||||
<< "'." << endl;
|
Alert::warning(_("Different textclasses"), text);
|
||||||
//return 0;
|
//return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// write it to a file (so far the complete file)
|
// write it to a file (so far the complete file)
|
||||||
string writefile = ChangeExtension(included_file, ".tex");
|
string writefile = ChangeExtension(included_file, ".tex");
|
||||||
|
|
||||||
if (!buffer.temppath().empty() && !runparams.nice) {
|
if (!runparams.nice) {
|
||||||
incfile = subst(incfile, '/','@');
|
incfile = FileName(writefile).mangledFilename();
|
||||||
#ifdef __EMX__
|
writefile = MakeAbsPath(incfile, buffer.temppath());
|
||||||
incfile = subst(incfile, ':', '$');
|
}
|
||||||
#endif
|
|
||||||
writefile = AddName(buffer.temppath(), incfile);
|
|
||||||
} else
|
|
||||||
writefile = included_file;
|
|
||||||
writefile = ChangeExtension(writefile, ".tex");
|
|
||||||
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
||||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||||
|
|
||||||
@ -388,15 +387,16 @@ int InsetInclude::linuxdoc(Buffer const & buffer, ostream & os,
|
|||||||
Buffer * tmp = bufferlist.getBuffer(included_file);
|
Buffer * tmp = bufferlist.getBuffer(included_file);
|
||||||
|
|
||||||
// write it to a file (so far the complete file)
|
// write it to a file (so far the complete file)
|
||||||
string writefile = ChangeExtension(included_file, ".sgml");
|
string writefile;
|
||||||
if (!buffer.temppath().empty() && !runparams.nice) {
|
if (IsLyXFilename(included_file))
|
||||||
incfile = subst(incfile, '/','@');
|
writefile = ChangeExtension(included_file, ".sgml");
|
||||||
writefile = AddName(buffer.temppath(), incfile);
|
else
|
||||||
} else
|
|
||||||
writefile = included_file;
|
writefile = included_file;
|
||||||
|
|
||||||
if (IsLyXFilename(included_file))
|
if (!runparams.nice) {
|
||||||
writefile = ChangeExtension(writefile, ".sgml");
|
incfile = FileName(writefile).mangledFilename();
|
||||||
|
writefile = MakeAbsPath(incfile, buffer.temppath());
|
||||||
|
}
|
||||||
|
|
||||||
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
||||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||||
@ -431,14 +431,16 @@ int InsetInclude::docbook(Buffer const & buffer, ostream & os,
|
|||||||
Buffer * tmp = bufferlist.getBuffer(included_file);
|
Buffer * tmp = bufferlist.getBuffer(included_file);
|
||||||
|
|
||||||
// write it to a file (so far the complete file)
|
// write it to a file (so far the complete file)
|
||||||
string writefile = ChangeExtension(included_file, ".sgml");
|
string writefile;
|
||||||
if (!buffer.temppath().empty() && !runparams.nice) {
|
|
||||||
incfile = subst(incfile, '/','@');
|
|
||||||
writefile = AddName(buffer.temppath(), incfile);
|
|
||||||
} else
|
|
||||||
writefile = included_file;
|
|
||||||
if (IsLyXFilename(included_file))
|
if (IsLyXFilename(included_file))
|
||||||
writefile = ChangeExtension(writefile, ".sgml");
|
writefile = ChangeExtension(included_file, ".sgml");
|
||||||
|
else
|
||||||
|
writefile = included_file;
|
||||||
|
|
||||||
|
if (!runparams.nice) {
|
||||||
|
incfile = FileName(writefile).mangledFilename();
|
||||||
|
writefile = MakeAbsPath(incfile, buffer.temppath());
|
||||||
|
}
|
||||||
|
|
||||||
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
||||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||||
@ -468,19 +470,15 @@ void InsetInclude::validate(LaTeXFeatures & features) const
|
|||||||
string const included_file = includedFilename(buffer, params_);
|
string const included_file = includedFilename(buffer, params_);
|
||||||
|
|
||||||
if (IsLyXFilename(included_file))
|
if (IsLyXFilename(included_file))
|
||||||
writefile = ChangeExtension(writefile, ".sgml");
|
writefile = ChangeExtension(included_file, ".sgml");
|
||||||
else if (!buffer.temppath().empty() &&
|
else
|
||||||
!features.nice() &&
|
|
||||||
!isVerbatim(params_)) {
|
|
||||||
incfile = subst(incfile, '/','@');
|
|
||||||
#ifdef __EMX__
|
|
||||||
// FIXME: It seems that the following is necessary (see latex() above)
|
|
||||||
// incfile = subst(incfile, ':', '$');
|
|
||||||
#endif
|
|
||||||
writefile = AddName(buffer.temppath(), incfile);
|
|
||||||
} else
|
|
||||||
writefile = included_file;
|
writefile = included_file;
|
||||||
|
|
||||||
|
if (!features.nice() && !isVerbatim(params_)) {
|
||||||
|
incfile = FileName(writefile).mangledFilename();
|
||||||
|
writefile = MakeAbsPath(incfile, buffer.temppath());
|
||||||
|
}
|
||||||
|
|
||||||
features.includeFile(include_label, writefile);
|
features.includeFile(include_label, writefile);
|
||||||
|
|
||||||
if (isVerbatim(params_))
|
if (isVerbatim(params_))
|
||||||
|
@ -58,7 +58,7 @@ using lyx::support::AddName;
|
|||||||
using lyx::support::AddPath;
|
using lyx::support::AddPath;
|
||||||
using lyx::support::bformat;
|
using lyx::support::bformat;
|
||||||
using lyx::support::createDirectory;
|
using lyx::support::createDirectory;
|
||||||
using lyx::support::CreateLyXTmpDir;
|
using lyx::support::createLyXTmpDir;
|
||||||
using lyx::support::FileInfo;
|
using lyx::support::FileInfo;
|
||||||
using lyx::support::FileSearch;
|
using lyx::support::FileSearch;
|
||||||
using lyx::support::GetEnv;
|
using lyx::support::GetEnv;
|
||||||
@ -390,7 +390,21 @@ void LyX::init(bool gui)
|
|||||||
if (lyxerr.debugging(Debug::LYXRC))
|
if (lyxerr.debugging(Debug::LYXRC))
|
||||||
lyxrc.print();
|
lyxrc.print();
|
||||||
|
|
||||||
os::setTmpDir(CreateLyXTmpDir(lyxrc.tempdir_path));
|
os::setTmpDir(createLyXTmpDir(lyxrc.tempdir_path));
|
||||||
|
if (os::getTmpDir().empty()) {
|
||||||
|
Alert::error(_("Could not create temporary directory"),
|
||||||
|
bformat(_("Could not create a temporary directory in\n"
|
||||||
|
"%1$s. Make sure that this\n"
|
||||||
|
"path exists and is writable and try again."),
|
||||||
|
lyxrc.tempdir_path));
|
||||||
|
// createLyXTmpDir() tries sufficiently hard to create a
|
||||||
|
// usable temp dir, so the probability to come here is
|
||||||
|
// close to zero. We therefore don't try to overcome this
|
||||||
|
// problem with e.g. asking the user for a new path and
|
||||||
|
// trying again but simply exit.
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
if (lyxerr.debugging(Debug::INIT)) {
|
if (lyxerr.debugging(Debug::INIT)) {
|
||||||
lyxerr << "LyX tmp dir: `" << os::getTmpDir() << '\'' << endl;
|
lyxerr << "LyX tmp dir: `" << os::getTmpDir() << '\'' << endl;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ private:
|
|||||||
This is needed to ensure that the pop is done upon exit from methods
|
This is needed to ensure that the pop is done upon exit from methods
|
||||||
with more than one exit point or that can return as a response to
|
with more than one exit point or that can return as a response to
|
||||||
exceptions.
|
exceptions.
|
||||||
@autor Lgb
|
@author Lgb
|
||||||
*/
|
*/
|
||||||
struct pushpophelper {
|
struct pushpophelper {
|
||||||
///
|
///
|
||||||
|
12
src/lyxrc.C
12
src/lyxrc.C
@ -156,6 +156,7 @@ keyword_item lyxrcTags[] = {
|
|||||||
// compatibility with versions older than 1.4.0 only
|
// compatibility with versions older than 1.4.0 only
|
||||||
{ "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
|
{ "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
|
||||||
{ "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
|
{ "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
|
||||||
|
// compatibility with versions older than 1.4.0 only
|
||||||
{ "\\use_tempdir", LyXRC::RC_USETEMPDIR },
|
{ "\\use_tempdir", LyXRC::RC_USETEMPDIR },
|
||||||
{ "\\user_email", LyXRC::RC_USER_EMAIL },
|
{ "\\user_email", LyXRC::RC_USER_EMAIL },
|
||||||
{ "\\user_name", LyXRC::RC_USER_NAME },
|
{ "\\user_name", LyXRC::RC_USER_NAME },
|
||||||
@ -197,7 +198,6 @@ void LyXRC::setDefaults() {
|
|||||||
print_paper_dimension_flag = "-T";
|
print_paper_dimension_flag = "-T";
|
||||||
document_path.erase();
|
document_path.erase();
|
||||||
tempdir_path = "/tmp";
|
tempdir_path = "/tmp";
|
||||||
use_tempdir = true;
|
|
||||||
ps_command = "gs";
|
ps_command = "gs";
|
||||||
view_dvi_paper_option.erase();
|
view_dvi_paper_option.erase();
|
||||||
default_papersize = PAPER_USLETTER;
|
default_papersize = PAPER_USLETTER;
|
||||||
@ -657,7 +657,7 @@ int LyXRC::read(string const & filename)
|
|||||||
|
|
||||||
case RC_USETEMPDIR:
|
case RC_USETEMPDIR:
|
||||||
if (lexrc.next()) {
|
if (lexrc.next()) {
|
||||||
use_tempdir = lexrc.getBool();
|
lyxerr << "Ignoring obsolete use_tempdir flag." << endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1524,9 +1524,7 @@ void LyXRC::output(ostream & os) const
|
|||||||
os << "\\tempdir_path \"" << tempdir_path << "\"\n";
|
os << "\\tempdir_path \"" << tempdir_path << "\"\n";
|
||||||
}
|
}
|
||||||
case RC_USETEMPDIR:
|
case RC_USETEMPDIR:
|
||||||
if (use_tempdir != system_lyxrc.use_tempdir) {
|
// Ignore it
|
||||||
os << "\\use_tempdir " << tostr(use_tempdir) << '\n';
|
|
||||||
}
|
|
||||||
case RC_ASCII_LINELEN:
|
case RC_ASCII_LINELEN:
|
||||||
if (ascii_linelen != system_lyxrc.ascii_linelen) {
|
if (ascii_linelen != system_lyxrc.ascii_linelen) {
|
||||||
os << "\\ascii_linelen " << ascii_linelen << '\n';
|
os << "\\ascii_linelen " << ascii_linelen << '\n';
|
||||||
@ -1904,10 +1902,6 @@ string const LyXRC::getDescription(LyXRCTags tag)
|
|||||||
str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
|
str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RC_USETEMPDIR:
|
|
||||||
str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RC_LASTFILES:
|
case RC_LASTFILES:
|
||||||
str = _("The file where the last-files information should be stored.");
|
str = _("The file where the last-files information should be stored.");
|
||||||
break;
|
break;
|
||||||
|
@ -206,8 +206,6 @@ enum LyXRCTags {
|
|||||||
///
|
///
|
||||||
std::string tempdir_path;
|
std::string tempdir_path;
|
||||||
///
|
///
|
||||||
bool use_tempdir;
|
|
||||||
///
|
|
||||||
bool auto_region_delete;
|
bool auto_region_delete;
|
||||||
/// flag telling whether lastfiles should be checked for existance
|
/// flag telling whether lastfiles should be checked for existance
|
||||||
bool auto_reset_options;
|
bool auto_reset_options;
|
||||||
|
@ -223,6 +223,11 @@ string const LyXVC::getLogFile() const
|
|||||||
return string();
|
return string();
|
||||||
|
|
||||||
string tmpf = tempName(string(), "lyxvclog");
|
string tmpf = tempName(string(), "lyxvclog");
|
||||||
|
if (tmpf.empty()) {
|
||||||
|
lyxerr[Debug::LYXVC] << "Could not generate logfile "
|
||||||
|
<< tmpf << endl;
|
||||||
|
return string();
|
||||||
|
}
|
||||||
lyxerr[Debug::LYXVC] << "Generating logfile " << tmpf << endl;
|
lyxerr[Debug::LYXVC] << "Generating logfile " << tmpf << endl;
|
||||||
vcs->getLog(tmpf);
|
vcs->getLog(tmpf);
|
||||||
return tmpf;
|
return tmpf;
|
||||||
|
@ -1556,7 +1556,7 @@ void Paragraph::changeLanguage(BufferParams const & bparams,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Paragraph::isMultiLingual(BufferParams const & bparams)
|
bool Paragraph::isMultiLingual(BufferParams const & bparams) const
|
||||||
{
|
{
|
||||||
Language const * doc_language = bparams.language;
|
Language const * doc_language = bparams.language;
|
||||||
Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
|
Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
void changeLanguage(BufferParams const & bparams,
|
void changeLanguage(BufferParams const & bparams,
|
||||||
Language const * from, Language const * to);
|
Language const * from, Language const * to);
|
||||||
///
|
///
|
||||||
bool isMultiLingual(BufferParams const &);
|
bool isMultiLingual(BufferParams const &) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
std::string const asString(Buffer const &,
|
std::string const asString(Buffer const &,
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
2004-02-21 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||||
|
|
||||||
|
* filetools.[Ch] (CreateBufferTmpDir): rename to createBufferTmpDir,
|
||||||
|
remove pathfor argument
|
||||||
|
* filetools.[Ch] (CreateLyXTmpDir): rename to createLyXTmpDir, try
|
||||||
|
harder to create a usable temp dir
|
||||||
|
* filetools.C (CreateTmpDir): rename to createTmpDir
|
||||||
|
filetools.[Ch] (unzipFile): add argument for output filename
|
||||||
|
* filename.h: fix doxygen warning
|
||||||
|
|
||||||
2004-02-01 Lars Gullik Bjonnes <larsbj@gullik.net>
|
2004-02-01 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||||
|
|
||||||
* lstrings.h (contains_functor): delete
|
* lstrings.h (contains_functor): delete
|
||||||
|
@ -22,7 +22,7 @@ namespace support {
|
|||||||
class FileName {
|
class FileName {
|
||||||
public:
|
public:
|
||||||
FileName();
|
FileName();
|
||||||
/** \param filename the file in question. Must have an absolute path.
|
/** \param abs_filename the file in question. Must have an absolute path.
|
||||||
* \param save_abs_path how is the file to be output to file?
|
* \param save_abs_path how is the file to be output to file?
|
||||||
*/
|
*/
|
||||||
FileName(std::string const & abs_filename, bool save_abs_path = true);
|
FileName(std::string const & abs_filename, bool save_abs_path = true);
|
||||||
|
@ -440,11 +440,11 @@ int DeleteAllFilesInDir(string const & path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const CreateTmpDir(string const & tempdir, string const & mask)
|
string const createTmpDir(string const & tempdir, string const & mask)
|
||||||
{
|
{
|
||||||
lyxerr[Debug::FILES]
|
lyxerr[Debug::FILES]
|
||||||
<< "CreateTmpDir: tempdir=`" << tempdir << "'\n"
|
<< "createTmpDir: tempdir=`" << tempdir << "'\n"
|
||||||
<< "CreateTmpDir: mask=`" << mask << '\'' << endl;
|
<< "createTmpDir: mask=`" << mask << '\'' << endl;
|
||||||
|
|
||||||
string const tmpfl(tempName(tempdir, mask));
|
string const tmpfl(tempName(tempdir, mask));
|
||||||
// lyx::tempName actually creates a file to make sure that it
|
// lyx::tempName actually creates a file to make sure that it
|
||||||
@ -453,8 +453,11 @@ string const CreateTmpDir(string const & tempdir, string const & mask)
|
|||||||
// safe because of the gap between unlink and mkdir. (Lgb)
|
// safe because of the gap between unlink and mkdir. (Lgb)
|
||||||
unlink(tmpfl);
|
unlink(tmpfl);
|
||||||
|
|
||||||
if (tmpfl.empty() || mkdir(tmpfl, 0700))
|
if (tmpfl.empty() || mkdir(tmpfl, 0700)) {
|
||||||
|
lyxerr << "LyX could not create the temporary directory '"
|
||||||
|
<< tmpfl << "'" << endl;
|
||||||
return string();
|
return string();
|
||||||
|
}
|
||||||
|
|
||||||
return MakeAbsPath(tmpfl);
|
return MakeAbsPath(tmpfl);
|
||||||
}
|
}
|
||||||
@ -477,36 +480,47 @@ int destroyDir(string const & tmpdir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const CreateBufferTmpDir(string const & pathfor)
|
string const createBufferTmpDir()
|
||||||
{
|
{
|
||||||
static int count;
|
static int count;
|
||||||
static string const tmpdir(pathfor.empty() ? os::getTmpDir() : pathfor);
|
|
||||||
// We are in our own directory. Why bother to mangle name?
|
// We are in our own directory. Why bother to mangle name?
|
||||||
// In fact I wrote this code to circumvent a problematic behaviour (bug?)
|
// In fact I wrote this code to circumvent a problematic behaviour (bug?)
|
||||||
// of EMX mkstemp().
|
// of EMX mkstemp().
|
||||||
string const tmpfl = tmpdir + "/lyx_tmpbuf" + tostr(count++);
|
string const tmpfl = os::getTmpDir() + "/lyx_tmpbuf" + tostr(count++);
|
||||||
if (mkdir(tmpfl, 0777)) {
|
if (mkdir(tmpfl, 0777)) {
|
||||||
|
lyxerr << "LyX could not create the temporary directory '"
|
||||||
|
<< tmpfl << "'" << endl;
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
return tmpfl;
|
return tmpfl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const CreateLyXTmpDir(string const & deflt)
|
string const createLyXTmpDir(string const & deflt)
|
||||||
{
|
{
|
||||||
if ((!deflt.empty()) && (deflt != "/tmp")) {
|
if (!deflt.empty() && deflt != "/tmp") {
|
||||||
if (mkdir(deflt, 0777)) {
|
if (mkdir(deflt, 0777)) {
|
||||||
|
if (IsDirWriteable(deflt))
|
||||||
|
// deflt could not be created because it
|
||||||
|
// did exist already, so let's create our own
|
||||||
|
// dir inside deflt.
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
Path p(user_lyxdir());
|
Path p(user_lyxdir());
|
||||||
#endif
|
#endif
|
||||||
return CreateTmpDir(deflt, "lyx_tmpdir");
|
return createTmpDir(deflt, "lyx_tmpdir");
|
||||||
|
else
|
||||||
|
// some other error occured.
|
||||||
|
#ifdef __EMX__
|
||||||
|
Path p(user_lyxdir());
|
||||||
|
#endif
|
||||||
|
return createTmpDir("/tmp", "lyx_tmpdir");
|
||||||
} else
|
} else
|
||||||
return deflt;
|
return deflt;
|
||||||
} else {
|
} else {
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
Path p(user_lyxdir());
|
Path p(user_lyxdir());
|
||||||
#endif
|
#endif
|
||||||
return CreateTmpDir("/tmp", "lyx_tmpdir");
|
return createTmpDir("/tmp", "lyx_tmpdir");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1080,9 +1094,10 @@ string const unzippedFileName(string const & zipped_file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const unzipFile(string const & zipped_file)
|
string const unzipFile(string const & zipped_file, string const & unzipped_file)
|
||||||
{
|
{
|
||||||
string const tempfile = unzippedFileName(zipped_file);
|
string const tempfile = unzipped_file.empty() ?
|
||||||
|
unzippedFileName(zipped_file) : unzipped_file;
|
||||||
// Run gunzip
|
// Run gunzip
|
||||||
string const command = "gunzip -c " + zipped_file + " > " + tempfile;
|
string const command = "gunzip -c " + zipped_file + " > " + tempfile;
|
||||||
Systemcall one;
|
Systemcall one;
|
||||||
|
@ -22,14 +22,19 @@ namespace support {
|
|||||||
/// remove directory and all contents, returns 0 on success
|
/// remove directory and all contents, returns 0 on success
|
||||||
int destroyDir(std::string const & tmpdir);
|
int destroyDir(std::string const & tmpdir);
|
||||||
|
|
||||||
///
|
/// Creates the per buffer temporary directory
|
||||||
std::string const CreateBufferTmpDir(std::string const & pathfor = std::string());
|
std::string const createBufferTmpDir();
|
||||||
|
|
||||||
/// Creates directory. Returns true on success
|
/// Creates directory. Returns true on success
|
||||||
bool createDirectory(std::string const & name, int permissions);
|
bool createDirectory(std::string const & name, int permissions);
|
||||||
|
|
||||||
///
|
/** Creates the global LyX temp dir.
|
||||||
std::string const CreateLyXTmpDir(std::string const & deflt);
|
\p deflt can be an existing directory name. In this case a new directory
|
||||||
|
inside \p deflt is created. If \p deflt does not exist yet, \p deflt is
|
||||||
|
created and used as the temporary directory.
|
||||||
|
\return the tmp dir name or string() if something went wrong.
|
||||||
|
*/
|
||||||
|
std::string const createLyXTmpDir(std::string const & deflt);
|
||||||
|
|
||||||
/** Find file by searching several directories.
|
/** Find file by searching several directories.
|
||||||
Uses a string of paths separated by ";"s to find a file to open.
|
Uses a string of paths separated by ";"s to find a file to open.
|
||||||
@ -141,11 +146,18 @@ std::string const getExtFromContents(std::string const & name);
|
|||||||
/// check for zipped file
|
/// check for zipped file
|
||||||
bool zippedFile(std::string const & name);
|
bool zippedFile(std::string const & name);
|
||||||
|
|
||||||
/// \return the name that LyX will give to the unzipped file.
|
/** \return the name that LyX will give to the unzipped file \p zipped_file
|
||||||
|
if the second argument of unzipFile() is empty.
|
||||||
|
*/
|
||||||
std::string const unzippedFileName(std::string const & zipped_file);
|
std::string const unzippedFileName(std::string const & zipped_file);
|
||||||
|
|
||||||
/// unzip a file
|
/** Unzip \p zipped_file.
|
||||||
std::string const unzipFile(std::string const & zipped_file);
|
The unzipped file is named \p unzipped_file if \p unzipped_file is not
|
||||||
|
empty, and unzippedFileName(\p zipped_file) otherwise.
|
||||||
|
Will overwrite an already existing unzipped file without warning.
|
||||||
|
*/
|
||||||
|
std::string const unzipFile(std::string const & zipped_file,
|
||||||
|
std::string const & unzipped_file = std::string());
|
||||||
|
|
||||||
/// Returns true is path is absolute
|
/// Returns true is path is absolute
|
||||||
bool AbsolutePath(std::string const & path);
|
bool AbsolutePath(std::string const & path);
|
||||||
|
Loading…
Reference in New Issue
Block a user