return;
// an enabled EmbeededFile should have this problem handled
- BOOST_ASSERT(!enabled());
+ BOOST_ASSERT(!isEnabled());
// file will be synced when it is enabled
inzip_name_ = name;
}
string EmbeddedFile::embeddedFile() const
{
- BOOST_ASSERT(enabled());
+ BOOST_ASSERT(isEnabled());
return temp_path_ + inzip_name_;
}
FileName EmbeddedFile::availableFile() const
{
- if (enabled() && embedded())
+ if (isEnabled() && embedded())
return FileName(embeddedFile());
else
return *this;
string EmbeddedFile::latexFilename(std::string const & buffer_path) const
{
- return (enabled() && embedded()) ? inzip_name_ : relFilename(buffer_path);
+ return (isEnabled() && embedded()) ? inzip_name_ : relFilename(buffer_path);
}
}
-void EmbeddedFile::enable(bool flag, Buffer const * buf, bool updateFile)
+void EmbeddedFile::enable(bool enabled, Buffer const * buf, bool updateFile)
{
// This function will be called when
// 1. through EmbeddedFiles::enable() when a file is read. Files
// 2. through menu item enable/disable. updateFile should be true.
// 3. A single embedded file is added or modified. updateFile
// can be true or false.
- LYXERR(Debug::FILES, (flag ? "Enable" : "Disable")
+ LYXERR(Debug::FILES, (enabled ? "Enable" : "Disable")
<< " " << absFilename()
<< (updateFile ? " (update file)." : " (no update)."));
- if (flag) {
+ if (enabled) {
temp_path_ = buf->temppath();
if (!suffixIs(temp_path_, '/'))
temp_path_ += '/';
} else {
// when a new embeddeed file is created, it is not enabled, and
// there is no need to extract.
- if (enabled() && embedded() && updateFile)
+ if (isEnabled() && embedded() && updateFile)
extract();
temp_path_ = "";
}
bool EmbeddedFile::extract() const
{
- BOOST_ASSERT(enabled());
+ BOOST_ASSERT(isEnabled());
string ext_file = absFilename();
string emb_file = embeddedFile();
bool EmbeddedFile::updateFromExternalFile() const
{
- BOOST_ASSERT(enabled());
+ BOOST_ASSERT(isEnabled());
string ext_file = absFilename();
string emb_file = embeddedFile();
void EmbeddedFile::syncInzipFile(std::string const & buffer_path)
{
- BOOST_ASSERT(enabled());
+ BOOST_ASSERT(isEnabled());
string old_emb_file = temp_path_ + '/' + inzip_name_;
FileName old_emb(old_emb_file);
}
-void EmbeddedFileList::enable(bool flag, Buffer & buffer, bool updateFile)
+void EmbeddedFileList::enable(bool enabled, Buffer & buffer, bool updateFile)
{
// update embedded file list
update(buffer);
iterator it_end = end();
// an exception may be thrown
for (; it != it_end; ++it) {
- it->enable(flag, &buffer, updateFile);
+ it->enable(enabled, &buffer, updateFile);
if (it->embedded())
++count_embedded;
else
++count_external;
}
// if operation is successful (no exception is thrown)
- buffer.params().embedded = flag;
+ buffer.params().embedded = enabled;
// if the operation is successful, update insets
for (it = begin(); it != it_end; ++it)
return;
// show result
- if (flag) {
+ if (enabled) {
docstring const msg = bformat(_("%1$d external files are ignored.\n"
"%2$d embeddable files are embedded.\n"), count_external, count_embedded);
Alert::information(_("Packing all files"), msg);
void EmbeddedFileList::registerFile(EmbeddedFile const & file,
Inset const * inset, Buffer const & buffer)
{
- BOOST_ASSERT(!buffer.embedded() || file.enabled());
+ BOOST_ASSERT(!buffer.embedded() || file.isEnabled());
string newfile = file.absFilename();
iterator efp = findFile(newfile);
/// set embedding status.
void setEmbed(bool embed);
- /// whether or not embedding is enabled in the current buffer
+ /// whether or not embedding is enabled for the current file
/**
* An embedded file needs to know the temp path of a buffer to know
* where its embedded copy is. This has to be stored within EmbeddedFile
* when an embedded file is copied to another buffer, temp_path_ has
* to be updated and file copying may be needed.
*/
- bool enabled() const { return !temp_path_.empty(); }
+ bool isEnabled() const { return !temp_path_.empty(); }
/// enable embedding of this file
- void enable(bool flag, Buffer const * buf, bool updateFile);
+ void enable(bool enabled, Buffer const * buf, bool updateFile);
/// extract file, does not change embedding status
bool extract() const;
public:
/// set buffer params embedded flag. Files will be updated or extracted
/// if such an operation fails, enable will fail.
- void enable(bool flag, Buffer & buffer, bool updateFile);
+ void enable(bool enabled, Buffer & buffer, bool updateFile);
/// add a file item.
/** \param file Embedded file to add