Hello, As the title says, will commit now.
Abdel.
Index: CutAndPaste.C =================================================================== --- CutAndPaste.C (revision 15119) +++ CutAndPaste.C (working copy) @@ -513,8 +513,8 @@ // solved by running the line below only when the selection has // finished. The solution used currently just works, to make it // faster we need to be more clever and probably also have more - // calls to cur.bv().owner()->gui().selection().put. (Lgb) -// cur.bv().owner()->gui().selection().put(cur.selectionAsString(true)); + // calls to theApp->selection().put. (Lgb) +// theApp->selection().put(cur.selectionAsString(true)); // make sure that the depth behind the selection are restored, too @@ -578,7 +578,7 @@ void copySelection(LCursor & cur) { // stuff the selection onto the X clipboard, from an explicit copy request - cur.bv().owner()->gui().clipboard().put(cur.selectionAsString(true)); + theApp->clipboard().put(cur.selectionAsString(true)); // this doesn't make sense, if there is no selection if (!cur.selection()) Index: frontends/Application.h =================================================================== --- frontends/Application.h (revision 15119) +++ frontends/Application.h (working copy) @@ -25,8 +25,9 @@ namespace lyx { namespace frontend { -//class GuiWorkArea; +class Clipboard; class Gui; +class Selection; /// The main application class @@ -51,6 +52,11 @@ virtual void exit(int status) = 0; /// + virtual Clipboard & clipboard() = 0; + /// + virtual Selection & selection() = 0; + + /// LyXFunc & lyxFunc(); LyXFunc const & lyxFunc() const; /// Index: frontends/Gui.h =================================================================== --- frontends/Gui.h (revision 15119) +++ frontends/Gui.h (working copy) @@ -24,8 +24,6 @@ namespace lyx { namespace frontend { -class Clipboard; -class Selection; class WorkArea; @@ -38,11 +36,6 @@ virtual ~Gui() {} /// - virtual Clipboard & clipboard() = 0; - /// - virtual Selection & selection() = 0; - - /// virtual int newView(unsigned int width, unsigned int height) = 0; /// virtual LyXView & view(int id) = 0; Index: frontends/LyXView.C =================================================================== --- frontends/LyXView.C (revision 15119) +++ frontends/LyXView.C (working copy) @@ -65,15 +65,9 @@ string current_layout; -Gui & LyXView::gui() -{ - return owner_; -} - -LyXView::LyXView(Gui & owner) +LyXView::LyXView() : work_area_(0), - owner_(owner), toolbars_(new Toolbars(*this)), autosave_timeout_(new Timeout(5000)), lyxfunc_(new LyXFunc(this)), Index: frontends/LyXView.h =================================================================== --- frontends/LyXView.h (revision 15121) +++ frontends/LyXView.h (working copy) @@ -58,7 +58,7 @@ class LyXView : public boost::signals::trackable, boost::noncopyable { public: - LyXView(lyx::frontend::Gui & owner); + LyXView(); virtual ~LyXView(); @@ -162,9 +162,6 @@ /// returns true if this view has the focus. virtual bool hasFocus() const = 0; - /// - virtual lyx::frontend::Gui & gui(); - /// Temporary method used by the kernel to redraw the work area. virtual void redrawWorkArea(); @@ -191,7 +188,6 @@ boost::scoped_ptr<Menubar> menubar_; private: - lyx::frontend::Gui & owner_; /** * setWindowTitle - set title of window * @param t main window title Index: frontends/qt4/GuiApplication.C =================================================================== --- frontends/qt4/GuiApplication.C (revision 15119) +++ frontends/qt4/GuiApplication.C (working copy) @@ -137,6 +137,18 @@ } +Clipboard& GuiApplication::clipboard() +{ + return clipboard_; +} + + +Selection& GuiApplication::selection() +{ + return selection_; +} + + int const GuiApplication::exec() { return QApplication::exec(); Index: frontends/qt4/GuiApplication.h =================================================================== --- frontends/qt4/GuiApplication.h (revision 15119) +++ frontends/qt4/GuiApplication.h (working copy) @@ -13,8 +13,10 @@ #ifndef QT4_APPLICATION_H #define QT4_APPLICATION_H +#include "FontLoader.h" +#include "GuiClipboard.h" #include "GuiImplementation.h" -#include "FontLoader.h" +#include "GuiSelection.h" #include "frontends/Application.h" @@ -50,6 +52,8 @@ /// Method inherited from \c Application class //@{ + virtual Clipboard& clipboard(); + virtual Selection& selection(); virtual int const exec(); virtual Gui & gui() { return gui_; } virtual void exit(int status); @@ -65,8 +69,11 @@ private: /// GuiImplementation gui_; - /// + GuiClipboard clipboard_; + /// + GuiSelection selection_; + /// FontLoader font_loader_; #ifdef Q_WS_X11 Index: frontends/qt4/GuiImplementation.C =================================================================== --- frontends/qt4/GuiImplementation.C (revision 15119) +++ frontends/qt4/GuiImplementation.C (working copy) @@ -31,24 +31,12 @@ } -Clipboard& GuiImplementation::clipboard() -{ - return clipboard_; -} - - -Selection& GuiImplementation::selection() -{ - return selection_; -} - - int GuiImplementation::newView(unsigned int /*w*/, unsigned int /*h*/) { size_t const id = max_view_id_; ++max_view_id_; - views_[id].reset(new GuiView(*this)); + views_[id].reset(new GuiView()); return id; } Index: frontends/qt4/GuiImplementation.h =================================================================== --- frontends/qt4/GuiImplementation.h (revision 15119) +++ frontends/qt4/GuiImplementation.h (working copy) @@ -14,8 +14,6 @@ #define GUI_H #include "frontends/Gui.h" -#include "GuiClipboard.h" -#include "GuiSelection.h" #include <boost/shared_ptr.hpp> @@ -38,9 +36,6 @@ GuiImplementation(); virtual ~GuiImplementation() {} - Clipboard& clipboard(); - Selection& selection(); - int newView(unsigned int width, unsigned int height); LyXView& view(int id); void destroyView(int id); @@ -52,10 +47,6 @@ private: /// - GuiClipboard clipboard_; - /// - GuiSelection selection_; - /// std::map<int, boost::shared_ptr<GuiView> > views_; /// std::map<int, boost::shared_ptr<GuiWorkArea> > work_areas_; Index: frontends/qt4/GuiView.C =================================================================== --- frontends/qt4/GuiView.C (revision 15119) +++ frontends/qt4/GuiView.C (working copy) @@ -68,8 +68,8 @@ } // namespace anon -GuiView::GuiView(Gui & owner) - : QMainWindow(), LyXView(owner), commandbuffer_(0) +GuiView::GuiView() + : QMainWindow(), LyXView(), commandbuffer_(0) { // setToolButtonStyle(Qt::ToolButtonIconOnly); // setIconSize(QSize(12,12)); Index: frontends/qt4/GuiView.h =================================================================== --- frontends/qt4/GuiView.h (revision 15119) +++ frontends/qt4/GuiView.h (working copy) @@ -47,7 +47,7 @@ Q_OBJECT public: /// create a main window of the given dimensions - GuiView(Gui & owner); + GuiView(); ~GuiView(); Index: insets/insettabular.C =================================================================== --- insets/insettabular.C (revision 15119) +++ insets/insettabular.C (working copy) @@ -700,8 +700,8 @@ case LFUN_CLIPBOARD_PASTE: case LFUN_PRIMARY_SELECTION_PASTE: { docstring const clip = (cmd.action == LFUN_CLIPBOARD_PASTE) ? - cur.bv().owner()->gui().clipboard().get() : - cur.bv().owner()->gui().selection().get(); + theApp->clipboard().get() : + theApp->selection().get(); if (clip.empty()) break; // pass to InsertAsciiString, but @@ -1780,7 +1780,7 @@ ostringstream os; OutputParams const runparams; paste_tabular->plaintext(cur.buffer(), os, runparams, 0, true, '\t'); - cur.bv().owner()->gui().clipboard().put(lyx::from_utf8(os.str())); + theApp->clipboard().put(lyx::from_utf8(os.str())); // mark tabular stack dirty // FIXME: this is a workaround for bug 1919. Should be removed for 1.5, // when we (hopefully) have a one-for-all paste mechanism. Index: mathed/InsetMathNest.C =================================================================== --- mathed/InsetMathNest.C (revision 15119) +++ mathed/InsetMathNest.C (working copy) @@ -1089,7 +1089,7 @@ if (cur.selection()) asArray(lyx::to_utf8(bv.cursor().selectionAsString(false)), ar); else - asArray(lyx::to_utf8(bv.owner()->gui().selection().get()), ar); + asArray(lyx::to_utf8(theApp->selection().get()), ar); cur.insert(ar); bv.mouseSetCursor(cur); @@ -1120,7 +1120,7 @@ //lyxerr << "## lfunMouseRelease: buttons: " << cmd.button() << endl; if (cmd.button() == mouse_button::button1) { - //cur.bv().owner()->gui().selection().put(cur.grabSelection()); + //theApp->selection().put(cur.grabSelection()); return; } Index: text3.C =================================================================== --- text3.C (revision 15121) +++ text3.C (working copy) @@ -125,7 +125,7 @@ if (selecting || cur.mark()) cur.setSelection(); if (!cur.selection()) - cur.bv().owner()->gui().selection().haveSelection(false); + theApp->selection().haveSelection(false); cur.bv().switchKeyMap(); } @@ -883,7 +883,7 @@ case LFUN_CLIPBOARD_PASTE: { cur.clearSelection(); - docstring const clip = bv->owner()->gui().clipboard().get(); + docstring const clip = theApp->clipboard().get(); if (!clip.empty()) { recordUndo(cur); if (cmd.argument() == "paragraph") @@ -896,7 +896,7 @@ case LFUN_PRIMARY_SELECTION_PASTE: { cur.clearSelection(); - docstring const clip = bv->owner()->gui().selection().get(); + docstring const clip = theApp->selection().get(); if (!clip.empty()) { recordUndo(cur); if (cmd.argument() == "paragraph") @@ -956,7 +956,7 @@ cursorEnd(cur); cur.setSelection(); bv->cursor() = cur; - bv->owner()->gui().selection().haveSelection(cur.selection()); + theApp->selection().haveSelection(cur.selection()); } break; @@ -964,7 +964,7 @@ if (cmd.button() == mouse_button::button1) { selectWord(cur, lyx::WHOLE_WORD_STRICT); bv->cursor() = cur; - bv->owner()->gui().selection().haveSelection(cur.selection()); + theApp->selection().haveSelection(cur.selection()); } break; @@ -1046,7 +1046,7 @@ // finish selection if (cmd.button() == mouse_button::button1) - bv->owner()->gui().selection().haveSelection(cur.selection()); + theApp->selection().haveSelection(cur.selection()); bv->switchKeyMap(); bv->owner()->updateMenubar(); @@ -1067,7 +1067,7 @@ if (lyxrc.auto_region_delete) { if (cur.selection()) cutSelection(cur, false, false); - bv->owner()->gui().selection().haveSelection(false); + theApp->selection().haveSelection(false); } cur.clearSelection();