diff --git a/src/ChangeLog b/src/ChangeLog index 9d8815c296..bf64fb3068 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,6 @@ +2003-07-04 Lars Gullik Bjønnes + + * introduce namespace lyx::graphics 2003-07-02 André Pönitz diff --git a/src/buffer.C b/src/buffer.C index b51a4762d4..ba6af0ac00 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -110,6 +110,8 @@ using std::for_each; using lyx::pos_type; using lyx::textclass_type; +namespace grfx = lyx::graphics; + // all these externs should eventually be removed. extern BufferList bufferlist; diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 9d37cd8092..91800c17dc 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,6 @@ +2003-07-04 Lars Gullik Bjønnes + + * introduce namespace lyx::graphics 2003-06-27 André Pönitz @@ -16,7 +19,7 @@ 2003-06-06 Alfredo Braunstein * Dialogs.[Ch] (visible): added. - + 2003-06-03 John Levon * lyx_gui.h: add sync_events() diff --git a/src/frontends/Painter.h b/src/frontends/Painter.h index f2b4f1cdd8..9a143aa104 100644 --- a/src/frontends/Painter.h +++ b/src/frontends/Painter.h @@ -19,9 +19,12 @@ class LyXFont; -namespace grfx { +namespace lyx { +namespace graphics { class Image; } +} + /** * Painter - A painter class to encapsulate all graphics parameters and operations @@ -132,7 +135,7 @@ public: /// draw an image from the image cache virtual Painter & image(int x, int y, int w, int h, - grfx::Image const & image) = 0; + lyx::graphics::Image const & image) = 0; /// draw a string at position x, y (y is the baseline) virtual Painter & text(int x, int y, diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 25ea9246d0..49a2aa048a 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,7 @@ +2003-07-04 Lars Gullik Bjønnes + + * introduce namespace lyx::graphics + 2003-07-03 John Levon * ui/QTexinfoDialog.ui: enable View properly diff --git a/src/frontends/qt2/QExternal.C b/src/frontends/qt2/QExternal.C index 399a9c7bce..4ede9586a6 100644 --- a/src/frontends/qt2/QExternal.C +++ b/src/frontends/qt2/QExternal.C @@ -33,6 +33,8 @@ using namespace lyx::support; +namespace grfx = lyx::graphics; + typedef QController > base_class; diff --git a/src/frontends/qt2/QLImage.C b/src/frontends/qt2/QLImage.C index 72dca212ba..d504cc6a5c 100644 --- a/src/frontends/qt2/QLImage.C +++ b/src/frontends/qt2/QLImage.C @@ -32,7 +32,8 @@ using namespace lyx::support; using std::find_if; using std::endl; -namespace grfx { +namespace lyx { +namespace graphics { /// Access to this class is through this static method. Image::ImagePtr QLImage::newImage() @@ -253,4 +254,5 @@ void QLImage::scale(Params const & params) xformed_pixmap_ = xformed_pixmap_.xForm(m); } -} // namespace grfx +} // namespace graphics +} // lyx diff --git a/src/frontends/qt2/QLImage.h b/src/frontends/qt2/QLImage.h index 6e5f1e6cf3..e4b38678cc 100644 --- a/src/frontends/qt2/QLImage.h +++ b/src/frontends/qt2/QLImage.h @@ -18,7 +18,8 @@ #include -namespace grfx { +namespace lyx { +namespace graphics { class QLImage : public Image { public: @@ -80,6 +81,7 @@ private: QPixmap xformed_pixmap_; }; -} // namespace grfx +} // namespace graphics +} // namespace lyx #endif // QLIMAGE_H diff --git a/src/frontends/qt2/QLPainter.C b/src/frontends/qt2/QLPainter.C index 54fa7fb6bc..026eb66e12 100644 --- a/src/frontends/qt2/QLPainter.C +++ b/src/frontends/qt2/QLPainter.C @@ -36,6 +36,7 @@ using std::endl; +namespace grfx = lyx::graphics; QLPainter::QLPainter(QWorkArea & qwa) : Painter(), owner_(qwa), paint_check_(0) diff --git a/src/frontends/qt2/QLPainter.h b/src/frontends/qt2/QLPainter.h index 6005f9a166..d7159dc9f1 100644 --- a/src/frontends/qt2/QLPainter.h +++ b/src/frontends/qt2/QLPainter.h @@ -100,7 +100,7 @@ public: /// draw an image from the image cache virtual Painter & image(int x, int y, int w, int h, - grfx::Image const & image); + lyx::graphics::Image const & image); /// draw a string at position x, y (y is the baseline) virtual Painter & text(int x, int y, diff --git a/src/frontends/qt2/QPrefs.C b/src/frontends/qt2/QPrefs.C index 77ce4bc0a2..aa4ffbf072 100644 --- a/src/frontends/qt2/QPrefs.C +++ b/src/frontends/qt2/QPrefs.C @@ -63,6 +63,8 @@ using std::setfill; using std::setw; using std::endl; +namespace grfx = lyx::graphics; + typedef Qt2CB > base_class; diff --git a/src/frontends/qt2/lyx_gui.C b/src/frontends/qt2/lyx_gui.C index 6b8038ad83..2b4acb64e3 100644 --- a/src/frontends/qt2/lyx_gui.C +++ b/src/frontends/qt2/lyx_gui.C @@ -119,7 +119,7 @@ void parse_init(int & argc, char * argv[]) { static LQApplication a(argc, argv); - using namespace grfx; + using namespace lyx::graphics; Image::newImage = boost::bind(&QLImage::newImage); Image::loadableFormats = boost::bind(&QLImage::loadableFormats); diff --git a/src/frontends/screen.C b/src/frontends/screen.C index 7bdee9bc08..e902141367 100644 --- a/src/frontends/screen.C +++ b/src/frontends/screen.C @@ -48,6 +48,8 @@ using std::min; using std::max; using std::endl; +namespace grfx = lyx::graphics; + namespace { class SplashScreen : boost::noncopyable, boost::signals::trackable { diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 879ba05c76..224d299b10 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,7 @@ +2003-07-04 Lars Gullik Bjønnes + + * introduce namespace lyx::graphics + 2003-07-01 Lars Gullik Bjønnes * introcude namespace lyx::support diff --git a/src/frontends/xforms/FormExternal.C b/src/frontends/xforms/FormExternal.C index e48fba8b4c..a7419906a3 100644 --- a/src/frontends/xforms/FormExternal.C +++ b/src/frontends/xforms/FormExternal.C @@ -32,6 +32,8 @@ using namespace lyx::support; +namespace grfx = lyx::graphics; + typedef FormController > base_class; FormExternal::FormExternal(Dialog & parent) diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index b6e87f7df4..059ca6781c 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -68,6 +68,8 @@ extern string user_lyxdir; using namespace lyx::support; +namespace grfx = lyx::graphics; + namespace { // These should probably go inside the class definition... diff --git a/src/frontends/xforms/XPainter.C b/src/frontends/xforms/XPainter.C index a40e3342f3..05fd6cc31c 100644 --- a/src/frontends/xforms/XPainter.C +++ b/src/frontends/xforms/XPainter.C @@ -35,6 +35,7 @@ using namespace lyx::support; using std::endl; using std::max; +namespace grfx = lyx::graphics; XPainter::XPainter(XWorkArea & xwa) : Painter(), owner_(xwa) diff --git a/src/frontends/xforms/XPainter.h b/src/frontends/xforms/XPainter.h index 5197c24bfa..43c0c1d89b 100644 --- a/src/frontends/xforms/XPainter.h +++ b/src/frontends/xforms/XPainter.h @@ -95,7 +95,7 @@ public: /// draw an image from the image cache virtual Painter & image(int x, int y, int w, int h, - grfx::Image const & image); + lyx::graphics::Image const & image); /// draw a string at position x, y (y is the baseline) virtual Painter & text(int x, int y, diff --git a/src/frontends/xforms/lyx_gui.C b/src/frontends/xforms/lyx_gui.C index e39db69e87..74733e0f60 100644 --- a/src/frontends/xforms/lyx_gui.C +++ b/src/frontends/xforms/lyx_gui.C @@ -172,7 +172,7 @@ void parse_init(int & argc, char * argv[]) lyxColorHandler.reset(new LyXColorHandler()); - using namespace grfx; + using namespace lyx::graphics; // connect the image loader based on the xforms library Image::newImage = boost::bind(&xformsImage::newImage); diff --git a/src/frontends/xforms/xformsImage.C b/src/frontends/xforms/xformsImage.C index 52abc998b8..7001491131 100644 --- a/src/frontends/xforms/xformsImage.C +++ b/src/frontends/xforms/xformsImage.C @@ -45,7 +45,8 @@ unsigned int packedcolor(LColor::color c); } // namespace anon -namespace grfx { +namespace lyx { +namespace graphics { /// Access to this class is through this static method. Image::ImagePtr xformsImage::newImage() @@ -364,11 +365,14 @@ void xformsImage::errorCB(string const & error_message) finishedLoading(false); } -} // namespace grfx +} // namespace graphics +} // namespace lyx namespace { +namespace grfx = lyx::graphics; + extern "C" { int status_report(FL_IMAGE * ob, const char *s) diff --git a/src/frontends/xforms/xformsImage.h b/src/frontends/xforms/xformsImage.h index 29a9dae3d8..d35e1e42f8 100644 --- a/src/frontends/xforms/xformsImage.h +++ b/src/frontends/xforms/xformsImage.h @@ -24,7 +24,8 @@ struct flimage_; typedef flimage_ FL_IMAGE; -namespace grfx { +namespace lyx { +namespace graphics { class xformsImage : public Image { @@ -104,6 +105,7 @@ private: PixmapStatus pixmap_status_; }; -} // namespace grfx +} // namespace graphics +} // namespace lyx #endif // XFORMSIMAGE_H diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index fb31eccd44..0f0ad5e5d5 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,3 +1,7 @@ +2003-07-04 Lars Gullik Bjønnes + + * Change namespace grfx to lyx::graphics. + 2003-07-01 Lars Gullik Bjønnes * introcude namespace lyx::support diff --git a/src/graphics/GraphicsCache.C b/src/graphics/GraphicsCache.C index 107275cb62..daeb6160e3 100644 --- a/src/graphics/GraphicsCache.C +++ b/src/graphics/GraphicsCache.C @@ -25,7 +25,8 @@ using namespace lyx::support; -namespace grfx { +namespace lyx { +namespace graphics { /** The cache contains one item per file, so use a map to find the * cache item quickly by filename. @@ -113,4 +114,5 @@ Cache::ItemPtr const Cache::item(string const & file) const return it->second; } -} // namespace grfx +} // namespace graphics +} // namespace lyx diff --git a/src/graphics/GraphicsCache.h b/src/graphics/GraphicsCache.h index ca4d029776..1e0f0eb09b 100644 --- a/src/graphics/GraphicsCache.h +++ b/src/graphics/GraphicsCache.h @@ -26,7 +26,8 @@ #include -namespace grfx { +namespace lyx { +namespace graphics { class CacheItem; @@ -79,6 +80,7 @@ private: boost::scoped_ptr const pimpl_; }; -} // namespace grfx +} // namespace graphics +} // namespace lyx #endif // GRAPHICSCACHE_H diff --git a/src/graphics/GraphicsCacheItem.C b/src/graphics/GraphicsCacheItem.C index 02c730d37a..798977f2b4 100644 --- a/src/graphics/GraphicsCacheItem.C +++ b/src/graphics/GraphicsCacheItem.C @@ -32,7 +32,8 @@ using namespace lyx::support; using std::endl; -namespace grfx { +namespace lyx { +namespace graphics { struct CacheItem::Impl : public boost::signals::trackable { @@ -311,11 +312,14 @@ void CacheItem::Impl::imageLoaded(bool success) } -} // namespace grfx +} // namespace graphics +} // namespace lyx namespace { +namespace grfx = lyx::graphics; + string const findTargetFormat(string const & from) { typedef grfx::Image::FormatList FormatList; @@ -351,7 +355,8 @@ string const findTargetFormat(string const & from) } // anon namespace -namespace grfx { +namespace lyx { +namespace graphics { void CacheItem::Impl::convertToDisplayFormat() { @@ -409,4 +414,5 @@ void CacheItem::Impl::convertToDisplayFormat() converter_->startConversion(); } -} // namespace grfx +} // namespace graphics +} // namespace lyx diff --git a/src/graphics/GraphicsCacheItem.h b/src/graphics/GraphicsCacheItem.h index 3e8755fcaa..bcf72f67af 100644 --- a/src/graphics/GraphicsCacheItem.h +++ b/src/graphics/GraphicsCacheItem.h @@ -37,7 +37,8 @@ class InsetGraphics; -namespace grfx { +namespace lyx { +namespace graphics { class Image; class Converter; @@ -95,6 +96,7 @@ private: boost::scoped_ptr const pimpl_; }; -} // namespace grfx +} // namespace graphics +} // namespace lyx #endif // GRAPHICSCACHEITEM_H diff --git a/src/graphics/GraphicsConverter.C b/src/graphics/GraphicsConverter.C index 2333dde461..a61777917a 100644 --- a/src/graphics/GraphicsConverter.C +++ b/src/graphics/GraphicsConverter.C @@ -36,7 +36,8 @@ using namespace lyx::support; using std::endl; using std::ostream; -namespace grfx { +namespace lyx { +namespace graphics { struct Converter::Impl : public boost::signals::trackable { /// @@ -108,7 +109,9 @@ string const & Converter::convertedFile() const return pimpl_->finished_ ? pimpl_->to_file_ : empty; } -} // namespace grfx +} // namespace graphics +} // namespace lyx + //------------------------------ // Implementation details follow @@ -126,7 +129,8 @@ bool build_script(string const & from_file, string const & to_file_base, } // namespace anon -namespace grfx { +namespace lyx { +namespace graphics { Converter::Impl::Impl(string const & from_file, string const & to_file_base, string const & from_format, string const & to_format) @@ -223,7 +227,8 @@ void Converter::Impl::converted(pid_t /* pid */, int retval) } } -} // namespace grfx +} // namespace graphics +} // namespace lyx namespace { diff --git a/src/graphics/GraphicsConverter.h b/src/graphics/GraphicsConverter.h index dd221287a1..ed13961a01 100644 --- a/src/graphics/GraphicsConverter.h +++ b/src/graphics/GraphicsConverter.h @@ -22,7 +22,8 @@ #include #include -namespace grfx { +namespace lyx { +namespace graphics { class Converter : boost::noncopyable { public: @@ -65,6 +66,7 @@ private: boost::scoped_ptr const pimpl_; }; -} // namespace grfx +} // namespace graphics +} // namespace lyx #endif // GRAPHICSCONVERTER_H diff --git a/src/graphics/GraphicsImage.C b/src/graphics/GraphicsImage.C index fd1ae1041c..531ad28912 100644 --- a/src/graphics/GraphicsImage.C +++ b/src/graphics/GraphicsImage.C @@ -19,7 +19,8 @@ using std::endl; using std::abs; -namespace grfx { +namespace lyx { +namespace graphics { // This is to be connected to a function that will return a new // instance of a viable derived class. @@ -53,4 +54,5 @@ Image::getScaledDimensions(Params const & params) const return std::make_pair(width, height); } -} // namespace grfx +} // namespace graphics +} // namespace lyx diff --git a/src/graphics/GraphicsImage.h b/src/graphics/GraphicsImage.h index 2eff2c89b1..366894c277 100644 --- a/src/graphics/GraphicsImage.h +++ b/src/graphics/GraphicsImage.h @@ -33,7 +33,8 @@ #include #include -namespace grfx { +namespace lyx { +namespace graphics { class Params; @@ -107,6 +108,7 @@ protected: getScaledDimensions(Params const & params) const; }; -} // namespace grfx +} // namespace graphics +} // namespace lyx #endif // GRAPHICSIMAGE_H diff --git a/src/graphics/GraphicsLoader.C b/src/graphics/GraphicsLoader.C index 391fac6ac5..3d91ce13ab 100644 --- a/src/graphics/GraphicsLoader.C +++ b/src/graphics/GraphicsLoader.C @@ -25,7 +25,8 @@ #include -namespace grfx { +namespace lyx { +namespace graphics { struct Loader::Impl : boost::signals::trackable { /// @@ -296,4 +297,5 @@ void Loader::Impl::startLoading() } -} // namespace grfx +} // namespace graphics +} // namespace lyx diff --git a/src/graphics/GraphicsLoader.h b/src/graphics/GraphicsLoader.h index c95a21430a..415dd31421 100644 --- a/src/graphics/GraphicsLoader.h +++ b/src/graphics/GraphicsLoader.h @@ -32,7 +32,8 @@ class Inset; -namespace grfx { +namespace lyx { +namespace graphics { class Image; class Params; @@ -106,6 +107,7 @@ private: boost::scoped_ptr const pimpl_; }; -} // namespace grfx +} // namespace graphics +} // namespace lyx #endif // GRAPHICSLOADER_H diff --git a/src/graphics/GraphicsParams.C b/src/graphics/GraphicsParams.C index 0c7123ee81..cf2c72899b 100644 --- a/src/graphics/GraphicsParams.C +++ b/src/graphics/GraphicsParams.C @@ -18,7 +18,8 @@ using std::abs; -namespace grfx { +namespace lyx { +namespace graphics { Params::Params() : display(ColorDisplay), @@ -95,4 +96,5 @@ bool operator!=(BoundingBox const & a, BoundingBox const & b) return !(a == b); } -} // namespace grfx +} // namespace graphics +} // namespace lyx diff --git a/src/graphics/GraphicsParams.h b/src/graphics/GraphicsParams.h index b366f9a0c6..5d1cb6aa73 100644 --- a/src/graphics/GraphicsParams.h +++ b/src/graphics/GraphicsParams.h @@ -18,7 +18,8 @@ #include "LString.h" -namespace grfx { +namespace lyx { +namespace graphics { /** Parse a string of the form "200pt 500pt 300mm 5in" into a * usable bounding box. @@ -67,6 +68,7 @@ struct Params bool operator==(Params const &, Params const &); bool operator!=(Params const &, Params const &); -} // namespace grfx +} // namespace graphics +} // namespace lyx #endif // GRAPHICSPARAMS_H diff --git a/src/graphics/GraphicsTypes.C b/src/graphics/GraphicsTypes.C index 423e5da2fa..bb79a8b3a3 100644 --- a/src/graphics/GraphicsTypes.C +++ b/src/graphics/GraphicsTypes.C @@ -14,7 +14,8 @@ #include "graphics/GraphicsTypes.h" -namespace grfx { +namespace lyx { +namespace graphics { /// The translator between the Display enum and corresponding lyx string. Translator displayTranslator(DefaultDisplay, "default"); @@ -41,4 +42,5 @@ void setDisplayTranslator() } } -} // namespace grfx +} // namespace graphics +} // namespace lyx diff --git a/src/graphics/GraphicsTypes.h b/src/graphics/GraphicsTypes.h index 7dc58035b4..5893c529e0 100644 --- a/src/graphics/GraphicsTypes.h +++ b/src/graphics/GraphicsTypes.h @@ -18,7 +18,8 @@ #include "LString.h" #include "support/translator.h" -namespace grfx { +namespace lyx { +namespace graphics { /// The status of the loading process enum ImageStatus { @@ -68,6 +69,7 @@ extern Translator displayTranslator; /// void setDisplayTranslator(); -} // namespace grfx +} // namespace graphics +} // namespace lyx #endif // GRAPHICSTYPES_H diff --git a/src/graphics/LoaderQueue.C b/src/graphics/LoaderQueue.C index 1647e472c6..f5647cc9b8 100644 --- a/src/graphics/LoaderQueue.C +++ b/src/graphics/LoaderQueue.C @@ -19,8 +19,8 @@ using std::endl; using std::list; - -namespace grfx { +namespace lyx { +namespace graphics { int LoaderQueue::s_numimages_ = 5; int LoaderQueue::s_millisecs_ = 500; @@ -113,4 +113,5 @@ void LoaderQueue::touch(Cache::ItemPtr const & item) } -} // namespace grfx +} // namespace graphics +} // namespace lyx diff --git a/src/graphics/LoaderQueue.h b/src/graphics/LoaderQueue.h index 50183c12b9..49e8dc8d57 100644 --- a/src/graphics/LoaderQueue.h +++ b/src/graphics/LoaderQueue.h @@ -29,7 +29,8 @@ #include #include -namespace grfx { +namespace lyx { +namespace graphics { class LoaderQueue { public: @@ -74,6 +75,7 @@ private: void stopLoader(); }; -} // namespace grfx +} // namespace graphics +} // namespace lyx #endif // LOADERQUEUE_H diff --git a/src/graphics/PreviewImage.C b/src/graphics/PreviewImage.C index 61e112836b..9593ec568b 100644 --- a/src/graphics/PreviewImage.C +++ b/src/graphics/PreviewImage.C @@ -22,7 +22,8 @@ using namespace lyx::support; -namespace grfx { +namespace lyx { +namespace graphics { struct PreviewImage::Impl : public boost::signals::trackable { /// @@ -152,4 +153,5 @@ void PreviewImage::Impl::statusChanged() } } -} // namespace grfx +} // namespace graphics +} // namespace lyx diff --git a/src/graphics/PreviewImage.h b/src/graphics/PreviewImage.h index cb1cb71b3d..f76ff1f246 100644 --- a/src/graphics/PreviewImage.h +++ b/src/graphics/PreviewImage.h @@ -17,7 +17,8 @@ class Inset; -namespace grfx { +namespace lyx { +namespace graphics { class PreviewLoader; class Image; @@ -55,6 +56,7 @@ private: boost::scoped_ptr const pimpl_; }; -} // namespace grfx +} // namespace graphics +} // namespace lyx #endif // PREVIEWIMAGE_H diff --git a/src/graphics/PreviewLoader.C b/src/graphics/PreviewLoader.C index 5e3ee3d09f..09ded34ddd 100644 --- a/src/graphics/PreviewLoader.C +++ b/src/graphics/PreviewLoader.C @@ -117,7 +117,8 @@ typedef InProgressProcesses::value_type InProgressProcess; } // namespace anon -namespace grfx { +namespace lyx { +namespace graphics { struct PreviewLoader::Impl : public boost::signals::trackable { /// @@ -241,7 +242,8 @@ Buffer const & PreviewLoader::buffer() const return pimpl_->buffer(); } -} // namespace grfx +} // namespace graphics +} // namespace lyx // The details of the Impl @@ -306,7 +308,8 @@ void InProgress::stop() const } // namespace anon -namespace grfx { +namespace lyx { +namespace graphics { PreviewLoader::Impl::Impl(PreviewLoader & p, Buffer const & b) : parent_(p), buffer_(b), font_scaling_factor_(0.0) @@ -637,8 +640,8 @@ void PreviewLoader::Impl::dumpData(ostream & os, } } -} // namespace grfx - +} // namespace graphics +} // namespace lyx namespace { diff --git a/src/graphics/PreviewLoader.h b/src/graphics/PreviewLoader.h index 93ea8da64b..ba6613bedb 100644 --- a/src/graphics/PreviewLoader.h +++ b/src/graphics/PreviewLoader.h @@ -25,7 +25,8 @@ class Buffer; -namespace grfx { +namespace lyx { +namespace graphics { class PreviewImage; @@ -92,6 +93,7 @@ private: boost::scoped_ptr const pimpl_; }; -} // namespace grfx +} // namespace graphics +} // namespace lyx #endif // PREVIEWLOADER_H diff --git a/src/graphics/PreviewedInset.C b/src/graphics/PreviewedInset.C index 5a9450a2ed..7f080a8aea 100644 --- a/src/graphics/PreviewedInset.C +++ b/src/graphics/PreviewedInset.C @@ -30,7 +30,8 @@ using namespace lyx::support; -namespace grfx { +namespace lyx { +namespace graphics { bool PreviewedInset::activated() { @@ -50,15 +51,15 @@ void PreviewedInset::generatePreview() !view() || !view()->buffer()) return; - grfx::Previews & previews = grfx::Previews::get(); - grfx::PreviewLoader & loader = previews.loader(view()->buffer()); + Previews & previews = Previews::get(); + PreviewLoader & loader = previews.loader(view()->buffer()); addPreview(loader); if (!snippet_.empty()) loader.startLoading(); } -void PreviewedInset::addPreview(grfx::PreviewLoader & ploader) +void PreviewedInset::addPreview(PreviewLoader & ploader) { if (!Previews::activated() || !previewWanted()) return; @@ -88,8 +89,8 @@ void PreviewedInset::removePreview() if (!view() || !view()->buffer() || snippet_.empty()) return; - grfx::Previews & previews = grfx::Previews::get(); - grfx::PreviewLoader & loader = previews.loader(view()->buffer()); + Previews & previews = Previews::get(); + PreviewLoader & loader = previews.loader(view()->buffer()); loader.remove(snippet_); snippet_.erase(); pimage_ = 0; @@ -103,8 +104,8 @@ bool PreviewedInset::previewReady() const return false; if (!pimage_ || snippet_ != pimage_->snippet()) { - grfx::PreviewLoader & ploader = - grfx::Previews::get().loader(view()->buffer()); + PreviewLoader & ploader = + Previews::get().loader(view()->buffer()); pimage_ = ploader.preview(snippet_); } @@ -115,7 +116,7 @@ bool PreviewedInset::previewReady() const } -void PreviewedInset::imageReady(grfx::PreviewImage const & pimage) const +void PreviewedInset::imageReady(PreviewImage const & pimage) const { // Check snippet against the Inset's current contents if (snippet_ != pimage.snippet()) @@ -127,4 +128,5 @@ void PreviewedInset::imageReady(grfx::PreviewImage const & pimage) const view()->updateInset(&inset_); } -} // namespace grfx +} // namespace graphics +} // namespace lyx diff --git a/src/graphics/PreviewedInset.h b/src/graphics/PreviewedInset.h index 5e40090860..85760603f9 100644 --- a/src/graphics/PreviewedInset.h +++ b/src/graphics/PreviewedInset.h @@ -23,7 +23,8 @@ class Inset; class BufferView; -namespace grfx { +namespace lyx { +namespace graphics { class PreviewImage; class PreviewLoader; @@ -87,7 +88,7 @@ private: boost::signals::connection connection_; }; -} // namespace grfx - +} // namespace graphics +} // namespace lyx #endif // PREVIEWEDINSET_H diff --git a/src/graphics/Previews.C b/src/graphics/Previews.C index ce07495a3c..32a81527a8 100644 --- a/src/graphics/Previews.C +++ b/src/graphics/Previews.C @@ -22,9 +22,11 @@ #include +namespace lyx { + using namespace lyx::support; -namespace grfx { +namespace graphics { bool Previews::activated() { @@ -99,4 +101,5 @@ void Previews::generateBufferPreviews(Buffer const & buffer) const ploader.startLoading(); } -} // namespace grfx +} // namespace graphics +} // namespace lyx diff --git a/src/graphics/Previews.h b/src/graphics/Previews.h index f088fd68de..2bfa1cdf83 100644 --- a/src/graphics/Previews.h +++ b/src/graphics/Previews.h @@ -21,7 +21,8 @@ class Buffer; -namespace grfx { +namespace lyx { +namespace graphics { class PreviewLoader; @@ -66,6 +67,7 @@ private: boost::scoped_ptr const pimpl_; }; -} // namespace grfx +} // namespace graphics +} // namespace lyx #endif // PREVIEWS_H diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index d696383462..bd932cb58a 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2003-07-04 Lars Gullik Bjønnes + + * introduce namespace lyx::graphics + 2003-07-01 Lars Gullik Bjønnes * introduce namespace lyx::support diff --git a/src/insets/inset.h b/src/insets/inset.h index 2e4165860e..84aa5b4b9a 100644 --- a/src/insets/inset.h +++ b/src/insets/inset.h @@ -34,9 +34,11 @@ class WordLangTuple; class ParagraphList; class UpdatableInset; -namespace grfx { +namespace lyx { +namespace graphics { class PreviewLoader; } +} /// Insets class Inset : public InsetBase { @@ -311,7 +313,7 @@ public: * Most insets have no interest in this capability, so the method * defaults to empty. */ - virtual void addPreview(grfx::PreviewLoader &) const {} + virtual void addPreview(lyx::graphics::PreviewLoader &) const {} /** Find the PreviewLoader, add a LaTeX snippet to it and * start the loading process. diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 3377fe3236..d57f809711 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -41,6 +41,7 @@ using std::ostream; using std::endl; using std::max; +namespace grfx = lyx::graphics; InsetCollapsable::InsetCollapsable(BufferParams const & bp, bool collapsed) : UpdatableInset(), collapsed_(collapsed), inset(bp), diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index 02c261e13a..3908081e6d 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -167,7 +167,7 @@ public: bool = true, bool = false); /// - void addPreview(grfx::PreviewLoader &) const; + void addPreview(lyx::graphics::PreviewLoader &) const; protected: /// diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index c6f7552cbd..bd0c1177ec 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -49,6 +49,7 @@ using namespace lyx::support; using std::ostream; using std::endl; +namespace grfx = lyx::graphics; namespace { diff --git a/src/insets/insetexternal.h b/src/insets/insetexternal.h index c23267fa58..919a9ab4be 100644 --- a/src/insets/insetexternal.h +++ b/src/insets/insetexternal.h @@ -36,7 +36,7 @@ public: /// The name of the tempfile used for manipulations. string tempname; /// how the inset is displayed by LyX - grfx::DisplayType display; + lyx::graphics::DisplayType display; /// The scale of the displayed graphic (If shown). unsigned int lyxscale; }; diff --git a/src/insets/insetgraphicsParams.h b/src/insets/insetgraphicsParams.h index 93fde9aa45..b33629b328 100644 --- a/src/insets/insetgraphicsParams.h +++ b/src/insets/insetgraphicsParams.h @@ -18,11 +18,16 @@ #include "LString.h" #include "lyxlength.h" +namespace grfx = lyx::graphics; + class LyXLex; -namespace grfx { +namespace lyx { +namespace graphics { class Params; } +} + /// This struct holds all the parameters needed by insetGraphics. struct InsetGraphicsParams diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index ecc71f332c..fd6fa9faeb 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -50,6 +50,8 @@ using std::endl; using std::vector; using std::pair; +namespace grfx = lyx::graphics; + extern BufferList bufferlist; diff --git a/src/insets/insetinclude.h b/src/insets/insetinclude.h index a4b4c83e89..160c2a8931 100644 --- a/src/insets/insetinclude.h +++ b/src/insets/insetinclude.h @@ -109,7 +109,7 @@ public: bool loadIfNeeded() const; /// - void addPreview(grfx::PreviewLoader &) const; + void addPreview(lyx::graphics::PreviewLoader &) const; private: /// get the text displayed on the button diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 5515a81331..4d07fb85c8 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -59,6 +59,8 @@ using std::endl; using std::swap; using std::max; +namespace grfx = lyx::graphics; + namespace { int const ADD_TO_HEIGHT = 2; diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index 2ab5d2eb9c..cda768070f 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -211,7 +211,7 @@ public: bool forceDefaultParagraphs(Inset const * in) const; /// - void addPreview(grfx::PreviewLoader &) const; + void addPreview(lyx::graphics::PreviewLoader &) const; // // Public structures and variables diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 6d67050e07..bf1c39ff79 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -76,6 +76,7 @@ using namespace lyx::support; using lyx::pos_type; using lyx::textclass_type; +namespace grfx = lyx::graphics; // These functions should probably go into bufferview_funcs somehow (Jug) diff --git a/src/insets/insettext.h b/src/insets/insettext.h index e3d85331c5..290d949592 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -230,7 +230,7 @@ public: void appendParagraphs(Buffer * bp, ParagraphList &); /// - void addPreview(grfx::PreviewLoader &) const; + void addPreview(lyx::graphics::PreviewLoader &) const; // // Public structures and variables diff --git a/src/insets/renderers.C b/src/insets/renderers.C index 3325cabe4c..3839e167bb 100644 --- a/src/insets/renderers.C +++ b/src/insets/renderers.C @@ -28,6 +28,8 @@ using namespace lyx::support; +namespace grfx = lyx::graphics; + RenderInset::RenderInset() {} diff --git a/src/insets/renderers.h b/src/insets/renderers.h index 5604bce779..19d10459bc 100644 --- a/src/insets/renderers.h +++ b/src/insets/renderers.h @@ -27,7 +27,7 @@ class MetricsInfo; class PainterInfo; -class RenderInset +class RenderInset { public: virtual ~RenderInset(); @@ -62,7 +62,7 @@ public: /// This should provide the text for the button void update(string const &, bool editable); - + /// compute the size of the object returned in dim virtual void metrics(MetricsInfo & mi, Dimension & dim) const; /// draw inset and update (xo, yo)-cache @@ -84,7 +84,7 @@ public: virtual RenderInset * clone() const; /// Refresh the info about which file to display and how to display it. - void update(grfx::Params const & params); + void update(lyx::graphics::Params const & params); /// compute the size of the object returned in dim virtual void metrics(MetricsInfo & mi, Dimension & dim) const; @@ -109,10 +109,10 @@ private: /// Is the image ready to draw, or should we display a message instead? bool readyToDisplay() const; - + /// The stored data. - grfx::Loader loader_; - grfx::Params params_; + lyx::graphics::Loader loader_; + lyx::graphics::Params params_; /// Cached variable (not copied). mutable unsigned long checksum_; diff --git a/src/lyx_main.C b/src/lyx_main.C index 436ec5d808..0c0a651de2 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -3,7 +3,7 @@ * Copyright 1995-2002 the LyX Team * Read the file COPYING * - * \author unknown + * \author Lars Gullik Bjønnes */ #include @@ -59,6 +59,8 @@ using std::signal; using std::system; #endif +namespace grfx = lyx::graphics; + extern void LoadLyXFile(string const &); extern void QuitLyX(); diff --git a/src/lyxrc.C b/src/lyxrc.C index edea4b9dda..1357d3d447 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -40,6 +40,8 @@ using std::ios; using std::endl; using std::vector; +namespace grfx = lyx::graphics; + class kb_keymap; extern boost::scoped_ptr toplevel_keymap; diff --git a/src/lyxrc.h b/src/lyxrc.h index 0de60914ab..9d70eacee8 100644 --- a/src/lyxrc.h +++ b/src/lyxrc.h @@ -337,7 +337,7 @@ enum LyXRCTags { /// int label_init_length; /// - grfx::DisplayType display_graphics; + lyx::graphics::DisplayType display_graphics; /// bool show_banner; /// diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 19b01aea35..5bf22e757a 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,7 @@ +2003-07-04 Lars Gullik Bjønnes + + * introduce namespace lyx::graphics + 2003-07-01 Lars Gullik Bjønnes * introduce namespace lyx::support diff --git a/src/mathed/formula.C b/src/mathed/formula.C index c4c2f0959b..7bc66335fc 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -52,6 +52,7 @@ using std::ostream; using std::vector; +namespace grfx = lyx::graphics; class InsetFormula::PreviewImpl : public grfx::PreviewedInset { public: diff --git a/src/mathed/formula.h b/src/mathed/formula.h index c63abd8e5a..820672412f 100644 --- a/src/mathed/formula.h +++ b/src/mathed/formula.h @@ -70,7 +70,7 @@ public: /// void generatePreview() const; /// - void addPreview(grfx::PreviewLoader &) const; + void addPreview(lyx::graphics::PreviewLoader &) const; /// void mutate(string const & type);