diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index 9f82eb3abe..f99f0f46a8 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,3 +1,16 @@ +2003-09-04 Angus Leeming + + * GraphicsCache.C: + * GraphicsCacheItem.C: + * GraphicsConverter.C: + * PreviewImage.C: + * PreviewLoader.C: + * PreviewedInset.C: + * Previews.C: 'namespace support = lyx::support' rather than + 'using lyx::support'. + + * Previews.h: cleaned up some comments. + 2003-07-26 Jean-Marc Lasgouttes * GraphicsTypes.h: do not declare displayTranstor here (and remove diff --git a/src/graphics/GraphicsCache.C b/src/graphics/GraphicsCache.C index 04819cec97..a220462f54 100644 --- a/src/graphics/GraphicsCache.C +++ b/src/graphics/GraphicsCache.C @@ -23,7 +23,7 @@ #include -using namespace lyx::support; +namespace support = lyx::support; namespace lyx { namespace graphics { @@ -64,7 +64,7 @@ std::vector Cache::loadableFormats() const void Cache::add(string const & file) const { - if (!AbsolutePath(file)) { + if (!support::AbsolutePath(file)) { lyxerr << "Cache::add(" << file << "):\n" << "The file must be have an absolute path." << std::endl; diff --git a/src/graphics/GraphicsCacheItem.C b/src/graphics/GraphicsCacheItem.C index 9241560176..7fc4f801eb 100644 --- a/src/graphics/GraphicsCacheItem.C +++ b/src/graphics/GraphicsCacheItem.C @@ -28,7 +28,19 @@ #include #include -using namespace lyx::support; +namespace support = lyx::support; + +using support::Assert; +using support::ChangeExtension; +using support::FileMonitor; +using support::IsFileReadable; +using support::MakeDisplayPath; +using support::OnlyFilename; +using support::getExtFromContents; +using support::tempName; +using support::unlink; +using support::unzipFile; +using support::zippedFile; using std::endl; diff --git a/src/graphics/GraphicsConverter.C b/src/graphics/GraphicsConverter.C index 3496c145e4..13b4b91206 100644 --- a/src/graphics/GraphicsConverter.C +++ b/src/graphics/GraphicsConverter.C @@ -31,7 +31,19 @@ #include #include // needed for pid_t -using namespace lyx::support; +namespace support = lyx::support; + +using support::ChangeExtension; +using support::Forkedcall; +using support::ForkedCallQueue; +using support::LibFileSearch; +using support::LibScriptSearch; +using support::OnlyPath; +using support::OnlyFilename; +using support::QuoteName; +using support::subst; +using support::tempName; +using support::unlink; using std::endl; using std::ostream; diff --git a/src/graphics/PreviewImage.C b/src/graphics/PreviewImage.C index 4a3b9a1ee2..3fae30b2d7 100644 --- a/src/graphics/PreviewImage.C +++ b/src/graphics/PreviewImage.C @@ -20,7 +20,8 @@ #include #include -using namespace lyx::support; +namespace support = lyx::support; + namespace lyx { namespace graphics { @@ -114,7 +115,7 @@ PreviewImage::Impl::Impl(PreviewImage & p, PreviewLoader & l, PreviewImage::Impl::~Impl() { - unlink(iloader_.filename()); + support::unlink(iloader_.filename()); } @@ -147,7 +148,7 @@ void PreviewImage::Impl::statusChanged() break; case Ready: - unlink(iloader_.filename()); + support::unlink(iloader_.filename()); ploader_.emitSignal(parent_); break; } diff --git a/src/graphics/PreviewLoader.C b/src/graphics/PreviewLoader.C index 2e96ca3f43..9af42478de 100644 --- a/src/graphics/PreviewLoader.C +++ b/src/graphics/PreviewLoader.C @@ -42,7 +42,8 @@ #include #include -using namespace lyx::support; +namespace support = lyx::support; + using std::endl; using std::find; @@ -292,16 +293,16 @@ InProgress::InProgress(string const & filename_base, void InProgress::stop() const { if (pid) - ForkedcallsController::get().kill(pid, 0); + support::ForkedcallsController::get().kill(pid, 0); if (!metrics_file.empty()) - unlink(metrics_file); + support::unlink(metrics_file); BitmapFile::const_iterator vit = snippets.begin(); BitmapFile::const_iterator vend = snippets.end(); for (; vit != vend; ++vit) { if (!vit->second.empty()) - unlink(vit->second); + support::unlink(vit->second); } } @@ -393,7 +394,7 @@ void PreviewLoader::Impl::add(string const & latex_snippet) if (!pconverter_ || status(latex_snippet) != NotFound) return; - string const snippet = trim(latex_snippet); + string const snippet = support::trim(latex_snippet); if (snippet.empty()) return; @@ -486,14 +487,15 @@ void PreviewLoader::Impl::startLoading() cs << pconverter_->command << ' ' << latexfile << ' ' << int(font_scaling_factor_) << ' ' << pconverter_->to; - string const command = "sh " + LibScriptSearch(STRCONV(cs.str())); + string const command = "sh " + support::LibScriptSearch(STRCONV(cs.str())); // Initiate the conversion from LaTeX to bitmap images files. - Forkedcall::SignalTypePtr convert_ptr(new Forkedcall::SignalType); + support::Forkedcall::SignalTypePtr + convert_ptr(new support::Forkedcall::SignalType); convert_ptr->connect( boost::bind(&Impl::finishedGenerating, this, _1, _2)); - Forkedcall call; + support::Forkedcall call; int ret = call.startscript(command, convert_ptr); if (ret != 0) { @@ -649,7 +651,7 @@ string const unique_filename(string const bufferpath) { static int theCounter = 0; string const filename = tostr(theCounter++) + "lyxpreview"; - return AddName(bufferpath, filename); + return support::AddName(bufferpath, filename); } @@ -746,7 +748,7 @@ void setAscentFractions(vector & ascent_fractions, double const a = ascent + tp_ascent; double const d = descent - tp_descent; - if (!float_equal(a + d, 0, 0.1)) + if (!support::float_equal(a + d, 0, 0.1)) *it = a / (a + d); if (++it == end) diff --git a/src/graphics/PreviewedInset.C b/src/graphics/PreviewedInset.C index 5274123487..258c6f0417 100644 --- a/src/graphics/PreviewedInset.C +++ b/src/graphics/PreviewedInset.C @@ -25,9 +25,8 @@ #include -#include "debug.h" // temporary +namespace support = lyx::support; -using namespace lyx::support; namespace lyx { namespace graphics { @@ -63,7 +62,7 @@ void PreviewedInset::addPreview(PreviewLoader & ploader) if (!Previews::activated() || !previewWanted()) return; - snippet_ = trim(latexString()); + snippet_ = support::trim(latexString()); if (snippet_.empty()) return; diff --git a/src/graphics/Previews.C b/src/graphics/Previews.C index 0cbd21b398..e8c64b9886 100644 --- a/src/graphics/Previews.C +++ b/src/graphics/Previews.C @@ -22,10 +22,10 @@ #include +namespace support = lyx::support; + + namespace lyx { - -using namespace lyx::support; - namespace graphics { bool Previews::activated() diff --git a/src/graphics/Previews.h b/src/graphics/Previews.h index 630b49f814..1f9430d984 100644 --- a/src/graphics/Previews.h +++ b/src/graphics/Previews.h @@ -36,20 +36,15 @@ public: /** Returns the PreviewLoader for this buffer. * Used by individual insets to update their own preview. - * We assert that (buffer != 0) but do not pass a Buffer & - * so that insets do not need to #include buffer.h */ PreviewLoader & loader(Buffer const & buffer) const; - /** Called from the Buffer d-tor. - * If (buffer == 0), does nothing. - */ + /// Called from the Buffer d-tor. void removeLoader(Buffer const & buffer) const; /** For a particular buffer, initiate the generation of previews - * for each and every snippetof LaTeX that's of interest with + * for each and every snippet of LaTeX that's of interest with * a single forked process. - * If (buffer == 0), does nothing. */ void generateBufferPreviews(Buffer const & buffer) const; @@ -58,7 +53,6 @@ private: * are instantiated. */ Previews(); - /// ~Previews(); /// Use the Pimpl idiom to hide the internals.