From: Richard Heck Date: Sat, 29 Mar 2008 23:13:32 +0000 (+0000) Subject: Cosmetics. X-Git-Tag: 1.6.10~5349 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=749cbb30ad7f46f8f9ce3b584e903d7becf9d4f3;p=features.git Cosmetics. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24052 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/EmbeddedFiles.cpp b/src/EmbeddedFiles.cpp index a6450073cf..1feac87295 100644 --- a/src/EmbeddedFiles.cpp +++ b/src/EmbeddedFiles.cpp @@ -71,7 +71,7 @@ void EmbeddedFile::setInzipName(std::string const & name) 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; } @@ -79,14 +79,14 @@ void EmbeddedFile::setInzipName(std::string const & 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; @@ -95,7 +95,7 @@ FileName EmbeddedFile::availableFile() const 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); } @@ -112,7 +112,7 @@ void EmbeddedFile::setEmbed(bool embed) } -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 @@ -121,11 +121,11 @@ void EmbeddedFile::enable(bool flag, Buffer const * buf, bool updateFile) // 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_ += '/'; @@ -134,7 +134,7 @@ void EmbeddedFile::enable(bool flag, Buffer const * buf, bool updateFile) } 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_ = ""; } @@ -143,7 +143,7 @@ void EmbeddedFile::enable(bool flag, Buffer const * buf, bool updateFile) bool EmbeddedFile::extract() const { - BOOST_ASSERT(enabled()); + BOOST_ASSERT(isEnabled()); string ext_file = absFilename(); string emb_file = embeddedFile(); @@ -202,7 +202,7 @@ bool EmbeddedFile::extract() const bool EmbeddedFile::updateFromExternalFile() const { - BOOST_ASSERT(enabled()); + BOOST_ASSERT(isEnabled()); string ext_file = absFilename(); string emb_file = embeddedFile(); @@ -392,7 +392,7 @@ std::string EmbeddedFile::calcInzipName(std::string const & buffer_path) 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); @@ -448,7 +448,7 @@ bool operator!=(EmbeddedFile const & lhs, EmbeddedFile const & rhs) } -void EmbeddedFileList::enable(bool flag, Buffer & buffer, bool updateFile) +void EmbeddedFileList::enable(bool enabled, Buffer & buffer, bool updateFile) { // update embedded file list update(buffer); @@ -459,14 +459,14 @@ void EmbeddedFileList::enable(bool flag, Buffer & buffer, bool updateFile) 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) @@ -476,7 +476,7 @@ void EmbeddedFileList::enable(bool flag, Buffer & buffer, bool updateFile) 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); @@ -491,7 +491,7 @@ void EmbeddedFileList::enable(bool flag, Buffer & buffer, bool updateFile) 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); diff --git a/src/EmbeddedFiles.h b/src/EmbeddedFiles.h index 0b1376b2d0..46c5c5b725 100644 --- a/src/EmbeddedFiles.h +++ b/src/EmbeddedFiles.h @@ -143,7 +143,7 @@ public: /// 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 @@ -151,9 +151,9 @@ public: * 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; @@ -201,7 +201,7 @@ class EmbeddedFileList : public std::vector { 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