From 32268e2632df5ee325d9a3589e514590b62fb65f Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 14 Aug 2007 09:54:59 +0000 Subject: [PATCH] cosmetics + move frontends/* to frontend namespace. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19553 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Importer.cpp | 1 + src/Importer.h | 7 +++-- src/LyX.cpp | 28 ++++++++++--------- src/LyX.h | 8 ++++-- src/LyXFunc.cpp | 2 ++ src/LyXFunc.h | 8 ++++-- src/Text3.cpp | 17 ++++++----- src/callback.cpp | 4 +-- src/callback.h | 5 +++- src/frontends/Application.h | 2 +- src/frontends/Dialogs.cpp | 5 ++-- src/frontends/Dialogs.h | 11 +++++--- src/frontends/Gui.h | 2 +- src/frontends/LyXView.cpp | 16 +++++------ src/frontends/LyXView.h | 25 ++++++++--------- src/frontends/Menubar.h | 2 ++ src/frontends/Toolbars.cpp | 6 ++-- src/frontends/Toolbars.h | 7 +++-- src/frontends/WorkArea.h | 2 +- .../controllers/ControlCommandBuffer.h | 3 +- src/frontends/controllers/ControlGraphics.h | 3 +- src/frontends/controllers/Dialog.h | 4 +-- src/frontends/controllers/Kernel.h | 3 +- src/frontends/qt4/Dialogs.cpp | 10 +++---- src/frontends/qt4/GuiImplementation.h | 3 +- src/frontends/qt4/QLMenubar.h | 7 +++-- src/frontends/qt4/QLToolbar.h | 6 ++-- src/insets/InsetGraphics.h | 1 - src/insets/MailInset.cpp | 2 -- 29 files changed, 107 insertions(+), 93 deletions(-) diff --git a/src/Importer.cpp b/src/Importer.cpp index 78c2c0969e..ad609e47c1 100644 --- a/src/Importer.cpp +++ b/src/Importer.cpp @@ -38,6 +38,7 @@ using support::bformat; using support::changeExtension; using support::FileName; using support::makeDisplayPath; +using frontend::LyXView; bool Importer::Import(LyXView * lv, FileName const & filename, diff --git a/src/Importer.h b/src/Importer.h index c5790841ee..4483d7825f 100644 --- a/src/Importer.h +++ b/src/Importer.h @@ -22,14 +22,17 @@ namespace lyx { namespace support { class FileName; } -class LyXView; class ErrorList; class Format; +namespace frontend { +class LyXView; +} + class Importer { public: /// - static bool Import(LyXView * lv, support::FileName const & filename, + static bool Import(frontend::LyXView * lv, support::FileName const & filename, std::string const & format, ErrorList & errorList); /// diff --git a/src/LyX.cpp b/src/LyX.cpp index c2b2b62845..e93cfe6494 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -70,6 +70,20 @@ #include #include +using std::endl; +using std::for_each; +using std::map; +using std::make_pair; +using std::string; +using std::vector; + +#ifndef CXX_GLOBAL_CSTD +using std::exit; +using std::signal; +using std::system; +#endif + +namespace fs = boost::filesystem; namespace lyx { @@ -89,23 +103,11 @@ using support::package; using support::prependEnvPath; using support::rtrim; using support::Systemcall; +using frontend::LyXView; namespace Alert = frontend::Alert; namespace os = support::os; -namespace fs = boost::filesystem; -using std::endl; -using std::for_each; -using std::map; -using std::make_pair; -using std::string; -using std::vector; - -#ifndef CXX_GLOBAL_CSTD -using std::exit; -using std::signal; -using std::system; -#endif /// are we using the GUI at all? diff --git a/src/LyX.h b/src/LyX.h index b39ab729f0..be52628497 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -33,7 +33,6 @@ class Inset; class LyXFunc; class Server; class ServerSocket; -class LyXView; class Messages; class Mover; class Movers; @@ -42,7 +41,10 @@ class KeyMap; extern bool use_gui; -namespace frontend { class Application; } +namespace frontend { +class Application; +class LyXView; +} /// initial startup class LyX : boost::noncopyable { @@ -96,7 +98,7 @@ public: void setGuiLanguage(std::string const & language); /// - LyXView * newLyXView(); + frontend::LyXView * newLyXView(); /** redraw \c inset in all the BufferViews in which it is currently * visible. If successful return a pointer to the owning Buffer. diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index fa2de36a49..4bc66bfb92 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -118,6 +118,8 @@ namespace lyx { using bv_funcs::freefont2string; +using frontend::LyXView; + using support::absolutePath; using support::addName; using support::addPath; diff --git a/src/LyXFunc.h b/src/LyXFunc.h index 60862dc406..2e8f286bda 100644 --- a/src/LyXFunc.h +++ b/src/LyXFunc.h @@ -30,8 +30,10 @@ class FuncRequest; class FuncStatus; class KeySymbol; class Text; -class LyXView; +namespace frontend { +class LyXView; +} /** This class encapsulates all the LyX command operations. This is the class of the LyX's "high level event handler". @@ -48,7 +50,7 @@ public: void dispatch(FuncRequest const &); /// - void setLyXView(LyXView * lv); + void setLyXView(frontend::LyXView * lv); /// void initKeySequences(KeyMap * kb); @@ -86,7 +88,7 @@ private: BufferView * view() const; /// - LyXView * lyx_view_; + frontend::LyXView * lyx_view_; /// the last character added to the key sequence, in UCS4 encoded form char_type encoded_last_key; diff --git a/src/Text3.cpp b/src/Text3.cpp index 1d3f0e30df..0b0351b7a2 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -71,6 +71,10 @@ #include #include +using std::endl; +using std::string; +using std::istringstream; +using std::ostringstream; namespace lyx { @@ -83,14 +87,9 @@ using cap::replaceSelection; using support::isStrUnsignedInt; using support::token; -using std::endl; -using std::string; -using std::istringstream; -using std::ostringstream; - - +namespace frontend { extern docstring current_layout; - +} namespace { @@ -896,7 +895,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) break; } - bool change_layout = (current_layout != layout); + bool change_layout = (frontend::current_layout != layout); if (!change_layout && cur.selection() && cur.selBegin().pit() != cur.selEnd().pit()) @@ -904,7 +903,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) pit_type spit = cur.selBegin().pit(); pit_type epit = cur.selEnd().pit() + 1; while (spit != epit) { - if (pars_[spit].layout()->name() != current_layout) { + if (pars_[spit].layout()->name() != frontend::current_layout) { change_layout = true; break; } diff --git a/src/callback.cpp b/src/callback.cpp index 7cda91a367..022181e744 100644 --- a/src/callback.cpp +++ b/src/callback.cpp @@ -66,7 +66,7 @@ using std::ios; using std::istream_iterator; using boost::shared_ptr; - +namespace fs = boost::filesystem; namespace lyx { @@ -87,9 +87,9 @@ using support::split; using support::Systemcall; using support::tempName; using support::unlink; +using frontend::LyXView; namespace Alert = frontend::Alert; -namespace fs = boost::filesystem; // this should be static, but I need it in Buffer.cpp bool quitting; // flag, that we are quitting the program diff --git a/src/callback.h b/src/callback.h index 6ce3858b72..df11f506c9 100644 --- a/src/callback.h +++ b/src/callback.h @@ -18,7 +18,10 @@ namespace lyx { class Buffer; class BufferView; + +namespace frontend { class LyXView; +} /// extern bool quitting; @@ -37,7 +40,7 @@ void insertPlaintextFile(BufferView * bv, std::string const & f, bool asParagrap docstring const getContentsOfPlaintextFile(BufferView * bv, std::string const & f, bool asParagraph); /// -void reconfigure(LyXView & lv); +void reconfigure(frontend::LyXView & lv); } // namespace lyx diff --git a/src/frontends/Application.h b/src/frontends/Application.h index bfe4a9229f..c050e5cee5 100644 --- a/src/frontends/Application.h +++ b/src/frontends/Application.h @@ -18,7 +18,6 @@ namespace lyx { class BufferView; -class LyXView; class Color_color; struct RGBColor; @@ -27,6 +26,7 @@ namespace frontend { class Clipboard; class FontLoader; class Gui; +class LyXView; class Selection; /// The main application class diff --git a/src/frontends/Dialogs.cpp b/src/frontends/Dialogs.cpp index 0f89d05851..92d4fdd2ad 100644 --- a/src/frontends/Dialogs.cpp +++ b/src/frontends/Dialogs.cpp @@ -25,8 +25,7 @@ using std::string; namespace lyx { -using lyx::frontend::Dialog; - +namespace frontend { Dialogs::Dialogs(LyXView & lyxview) : lyxview_(lyxview), in_show_(false) @@ -218,5 +217,5 @@ void Dialogs::checkStatus() } } - +} // namespace frontend } // namespace lyx diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index f179ec56d7..3286c525d5 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -21,9 +21,11 @@ namespace lyx { class Inset; -class LyXView; -namespace frontend { class Dialog; } +namespace frontend { + +class Dialog; +class LyXView; /** Container of all dialogs. */ @@ -98,9 +100,9 @@ private: /// bool isValidName(std::string const & name) const; /// - frontend::Dialog * find_or_build(std::string const & name); + Dialog * find_or_build(std::string const & name); /// - typedef boost::shared_ptr DialogPtr; + typedef boost::shared_ptr DialogPtr; /// DialogPtr build(std::string const & name); @@ -119,6 +121,7 @@ private: boost::signals::connection connection_; }; +} // namespace frontend } // namespace lyx #endif diff --git a/src/frontends/Gui.h b/src/frontends/Gui.h index 5b84e39297..3f6754caca 100644 --- a/src/frontends/Gui.h +++ b/src/frontends/Gui.h @@ -21,11 +21,11 @@ namespace lyx { -class LyXView; class BufferView; namespace frontend { +class LyXView; class WorkArea; diff --git a/src/frontends/LyXView.cpp b/src/frontends/LyXView.cpp index dc95512f7f..40f33b8c29 100644 --- a/src/frontends/LyXView.cpp +++ b/src/frontends/LyXView.cpp @@ -12,6 +12,7 @@ #include #include "LyXView.h" + #include "Dialogs.h" #include "Toolbars.h" #include "Menubar.h" @@ -47,8 +48,6 @@ #include -namespace lyx { - #ifdef HAVE_SYS_TIME_H # include #endif @@ -56,21 +55,20 @@ namespace lyx { # include #endif -using frontend::WorkArea; +using std::endl; +using std::string; + +namespace lyx { using support::bformat; using support::FileName; using support::makeDisplayPath; using support::onlyFilename; -using std::endl; -using std::string; - -using lyx::frontend::ControlCommandBuffer; +namespace frontend { docstring current_layout; - LyXView::LyXView(int id) : work_area_(0), toolbars_(new Toolbars(*this)), @@ -530,5 +528,5 @@ Buffer const * const LyXView::updateInset(Inset const * inset) const return buffer_ptr; } - +} // namespace frontend } // namespace lyx diff --git a/src/frontends/LyXView.h b/src/frontends/LyXView.h index adf88d0ec3..1048f519aa 100644 --- a/src/frontends/LyXView.h +++ b/src/frontends/LyXView.h @@ -29,22 +29,20 @@ namespace lyx { namespace support { class FileName; } +class Font; class Buffer; -class Inset; -class Menubar; - class BufferView; -class Dialogs; +class FuncRequest; +class Inset; class LyXFunc; -class Font; class Timeout; -class FuncRequest; namespace frontend { -class WorkArea; -class ControlCommandBuffer; -} // namespace frontend +class ControlCommandBuffer; +class Dialogs; +class Menubar; +class WorkArea; /** * LyXView - main LyX window @@ -75,13 +73,13 @@ public: std::vector const & workAreaIds() const { return work_area_ids_; } /// FIXME: rename to setCurrentWorkArea() - void setWorkArea(frontend::WorkArea * work_area); + void setWorkArea(WorkArea * work_area); /// return the current WorkArea (the one that has the focus). - frontend::WorkArea const * currentWorkArea() const; + WorkArea const * currentWorkArea() const; /// FIXME: This non-const access is needed because of /// a mis-designed \c ControlSpellchecker. - frontend::WorkArea * currentWorkArea(); + WorkArea * currentWorkArea(); /** * This is called after the concrete view has been created. @@ -293,7 +291,7 @@ protected: /// view's command buffer controller // this has to be declared _after_ lyxfunc_ as its initialization depends // on it! - typedef boost::scoped_ptr + typedef boost::scoped_ptr CommandBufferPtr; CommandBufferPtr const controlcommand_; @@ -303,6 +301,7 @@ private: std::vector work_area_ids_; }; +} // namespace frontend } // namespace lyx #endif // LYXVIEW_H diff --git a/src/frontends/Menubar.h b/src/frontends/Menubar.h index 74e8c59ac5..929beea908 100644 --- a/src/frontends/Menubar.h +++ b/src/frontends/Menubar.h @@ -17,6 +17,7 @@ namespace lyx { +namespace frontend { /** * The LyX GUI independent menubar class @@ -32,6 +33,7 @@ public: virtual void update() = 0; }; +} // namespace frontend } // namespace lyx #endif // MENUBAR_H diff --git a/src/frontends/Toolbars.cpp b/src/frontends/Toolbars.cpp index f28a2b7011..268987922d 100644 --- a/src/frontends/Toolbars.cpp +++ b/src/frontends/Toolbars.cpp @@ -25,11 +25,11 @@ #include "LyX.h" -namespace lyx { - using std::endl; using std::string; +namespace lyx { +namespace frontend { Toolbars::Toolbars(LyXView & owner) : owner_(owner), @@ -375,5 +375,5 @@ void layoutSelected(LyXView & lv, docstring const & name) << endl; } - +} // namespace frontend } // namespace lyx diff --git a/src/frontends/Toolbars.h b/src/frontends/Toolbars.h index b945bbb477..781292b529 100644 --- a/src/frontends/Toolbars.h +++ b/src/frontends/Toolbars.h @@ -24,12 +24,14 @@ #define TOOLBARS_H #include "ToolbarBackend.h" -#include -#include #include "Session.h" +#include + +#include namespace lyx { +namespace frontend { class LyXView; @@ -158,6 +160,7 @@ private: void layoutSelected(LyXView & lv, docstring const & name); +} // namespace frontend } // namespace lyx #endif // NOT TOOLBARS_H diff --git a/src/frontends/WorkArea.h b/src/frontends/WorkArea.h index 31ae9e717f..2eaac0bb93 100644 --- a/src/frontends/WorkArea.h +++ b/src/frontends/WorkArea.h @@ -27,10 +27,10 @@ namespace lyx { class BufferView; class FuncRequest; -class LyXView; namespace frontend { +class LyXView; class Painter; /// types of cursor in work area diff --git a/src/frontends/controllers/ControlCommandBuffer.h b/src/frontends/controllers/ControlCommandBuffer.h index d2c54639b6..c337726ff0 100644 --- a/src/frontends/controllers/ControlCommandBuffer.h +++ b/src/frontends/controllers/ControlCommandBuffer.h @@ -20,11 +20,10 @@ namespace lyx { +namespace frontend { class LyXView; -namespace frontend { - /** * ControlCommandBuffer * diff --git a/src/frontends/controllers/ControlGraphics.h b/src/frontends/controllers/ControlGraphics.h index a668943ca3..ea43f88d6c 100644 --- a/src/frontends/controllers/ControlGraphics.h +++ b/src/frontends/controllers/ControlGraphics.h @@ -26,10 +26,11 @@ namespace lyx { class InsetGraphics; class InsetGraphicsParams; -class LyXView; namespace frontend { +class LyXView; + /** A controller for Graphics dialogs. */ class ControlGraphics : public Dialog::Controller { diff --git a/src/frontends/controllers/Dialog.h b/src/frontends/controllers/Dialog.h index 892f69cc88..8cf351de40 100644 --- a/src/frontends/controllers/Dialog.h +++ b/src/frontends/controllers/Dialog.h @@ -21,12 +21,10 @@ #include namespace lyx { - -class LyXView; - namespace frontend { class ButtonController; +class LyXView; /** \c Dialog collects the different parts of a Model-Controller-View * split of a generic dialog together. diff --git a/src/frontends/controllers/Kernel.h b/src/frontends/controllers/Kernel.h index e45af52918..6f4308cc24 100644 --- a/src/frontends/controllers/Kernel.h +++ b/src/frontends/controllers/Kernel.h @@ -19,10 +19,11 @@ namespace lyx { class Buffer; class BufferView; class FuncRequest; -class LyXView; namespace frontend { +class LyXView; + /** \c Kernel is a wrapper making the LyX kernel available to the dialog. * (Ie, it provides an interface to the Model part of the Model-Controller- * View split. diff --git a/src/frontends/qt4/Dialogs.cpp b/src/frontends/qt4/Dialogs.cpp index 977d7f3345..c82d891e05 100644 --- a/src/frontends/qt4/Dialogs.cpp +++ b/src/frontends/qt4/Dialogs.cpp @@ -99,7 +99,8 @@ using std::string; -using namespace lyx::frontend; +namespace lyx { +namespace frontend { namespace { @@ -133,9 +134,6 @@ private: } // namespace anon -namespace lyx { - - bool Dialogs::isValidName(string const & name) const { return std::find_if(dialognames, end_dialognames, @@ -272,7 +270,7 @@ Dialogs::DialogPtr Dialogs::build(string const & name) dialog->bc().bp(new OkApplyCancelPolicy); } else if (name == "ref") { // full qualification because qt4 has also a ControlRef type - dialog->setController(new lyx::frontend::ControlRef(*dialog)); + dialog->setController(new ControlRef(*dialog)); dialog->setView(new QRef(*dialog)); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "sendto") { @@ -342,5 +340,5 @@ bool Dialogs::tooltipsEnabled() return false; } - +} // namespace frontend } // namespace lyx diff --git a/src/frontends/qt4/GuiImplementation.h b/src/frontends/qt4/GuiImplementation.h index 0b30d572ca..e2a4a524bc 100644 --- a/src/frontends/qt4/GuiImplementation.h +++ b/src/frontends/qt4/GuiImplementation.h @@ -19,13 +19,12 @@ #include -class LyXView; - namespace lyx { namespace frontend { class GuiWorkArea; class GuiView; +class LyXView; /** * The GuiImplementation class is the interface to all Qt4 components. diff --git a/src/frontends/qt4/QLMenubar.h b/src/frontends/qt4/QLMenubar.h index cbcdab6b54..9f94c944db 100644 --- a/src/frontends/qt4/QLMenubar.h +++ b/src/frontends/qt4/QLMenubar.h @@ -15,23 +15,24 @@ #include "frontends/Menubar.h" +#include "QLPopupMenu.h" + #include #include #include #include -#include "QLPopupMenu.h" +namespace lyx { -class LyXView; class MenuBackend; class Menu; class MenuItem; -namespace lyx { namespace frontend { class GuiView; +class LyXView; class QLMenubar : public QObject, public Menubar { Q_OBJECT diff --git a/src/frontends/qt4/QLToolbar.h b/src/frontends/qt4/QLToolbar.h index d65b185c05..5e01cd5dd6 100644 --- a/src/frontends/qt4/QLToolbar.h +++ b/src/frontends/qt4/QLToolbar.h @@ -17,11 +17,13 @@ #define QLTOOLBAR_H #include "frontends/Toolbars.h" -#include +#include "Session.h" #include + +#include + #include -#include "Session.h" class QComboBox; diff --git a/src/insets/InsetGraphics.h b/src/insets/InsetGraphics.h index c5a6bba052..f1fcc617da 100644 --- a/src/insets/InsetGraphics.h +++ b/src/insets/InsetGraphics.h @@ -23,7 +23,6 @@ namespace lyx { -class Dialogs; class RenderGraphic; class LaTeXFeatures; diff --git a/src/insets/MailInset.cpp b/src/insets/MailInset.cpp index 1ee4a34571..6a7d09edd2 100644 --- a/src/insets/MailInset.cpp +++ b/src/insets/MailInset.cpp @@ -16,8 +16,6 @@ #include "debug.h" #include "LyX.h" -#include "frontends/Dialogs.h" - namespace lyx { -- 2.39.5