diff --git a/src/BufferView.C b/src/BufferView.C index 95d093b777..6234108beb 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -60,12 +60,8 @@ #include "insets/insettext.h" #include "frontends/Alert.h" -#include "frontends/Clipboard.h" -#include "frontends/Dialogs.h" #include "frontends/FileDialog.h" #include "frontends/font_metrics.h" -#include "frontends/LyXView.h" -#include "frontends/Selection.h" #include "graphics/Previews.h" @@ -82,8 +78,6 @@ #include -using lyx::frontend::Clipboard; - using lyx::docstring; using lyx::pos_type; @@ -131,8 +125,8 @@ T * getInsetByCode(LCursor & cur, InsetBase::Code code) } // anon namespace -BufferView::BufferView(LyXView * owner) - : owner_(owner), buffer_(0), wh_(0), +BufferView::BufferView() + : buffer_(0), wh_(0), cursor_(*this), multiparsel_cache_(false), anchor_ref_(0), offset_ref_(0), intl_(new Intl) @@ -164,12 +158,6 @@ Buffer * BufferView::buffer() const } -LyXView * BufferView::owner() const -{ - return owner_; -} - - void BufferView::setBuffer(Buffer * b) { lyxerr[Debug::INFO] << BOOST_CURRENT_FUNCTION diff --git a/src/BufferView.h b/src/BufferView.h index 94c1588e8a..80199dd270 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -18,8 +18,6 @@ #include "cursor.h" #include "metricsinfo.h" -#include "frontends/LyXKeySym.h" - #include "support/types.h" #include @@ -36,7 +34,6 @@ class Intl; class Language; class LCursor; class LyXText; -class LyXView; class ParIterator; class ViewMetricsInfo; @@ -88,11 +85,7 @@ struct ScrollbarParameters */ class BufferView : boost::noncopyable { public: - /** - * Create a view with the given owner main window, - * of the given dimensions. - */ - BufferView(LyXView * owner); + BufferView(); ~BufferView(); @@ -101,9 +94,6 @@ public: /// return the buffer being viewed Buffer * buffer() const; - /// return the owning main view - LyXView * owner() const; - /// resize event has happened void resize(); @@ -233,6 +223,9 @@ public: boost::signal updateDialog; + /// This signal is emitted when the layout at the cursor is changed. + boost::signal layoutChanged; + private: /// bool multiParSel(); @@ -249,8 +242,6 @@ private: /// ViewMetricsInfo metrics_info_; - /// - LyXView * owner_; /// Buffer * buffer_; diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index cb7c556bfc..68ce0c907a 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -45,7 +45,7 @@ #include "support/lstrings.h" -#include "frontends/LyXView.h" +#include "frontends/Application.h" #include "frontends/Clipboard.h" #include diff --git a/src/ParagraphParameters.C b/src/ParagraphParameters.C index 6fead69a33..b9eaca3712 100644 --- a/src/ParagraphParameters.C +++ b/src/ParagraphParameters.C @@ -25,8 +25,6 @@ #include "paragraph.h" #include "tex-strings.h" -#include "frontends/LyXView.h" - #include "support/lstrings.h" #include diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index 2125c5706b..9f9f198c30 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -32,7 +32,6 @@ #include "pariterator.h" #include "frontends/Alert.h" -#include "frontends/LyXView.h" #include "insets/insetcommand.h" #include "insets/insettext.h" diff --git a/src/cursor.C b/src/cursor.C index 0d71f75110..ee3b064c8b 100644 --- a/src/cursor.C +++ b/src/cursor.C @@ -43,7 +43,7 @@ #include "support/limited_stack.h" -#include "frontends/LyXView.h" +#include "frontends/Application.h" #include "frontends/font_metrics.h" #include diff --git a/src/frontends/LyXView.C b/src/frontends/LyXView.C index 8a8274e966..2333f8d888 100644 --- a/src/frontends/LyXView.C +++ b/src/frontends/LyXView.C @@ -209,6 +209,7 @@ void LyXView::disconnectBuffer() timerConnection_.disconnect(); readonlyConnection_.disconnect(); closingConnection_.disconnect(); + layout_changed_connection_.disconnect(); } @@ -222,6 +223,8 @@ void LyXView::connectBufferView(BufferView & bv) boost::bind(&LyXView::showInsetDialog, this, _1, _2, _3)); update_dialog_connection_ = bv.updateDialog.connect( boost::bind(&LyXView::updateDialog, this, _1, _2)); + layout_changed_connection_ = bv.layoutChanged.connect( + boost::bind(&Toolbars::setLayout, toolbars_.get(), _1)); } @@ -283,12 +286,6 @@ BufferView * LyXView::view() const } -void LyXView::setLayout(string const & layout) -{ - toolbars_->setLayout(layout); -} - - void LyXView::updateToolbars() { bool const math = work_area_->bufferView().cursor().inMathed(); diff --git a/src/frontends/LyXView.h b/src/frontends/LyXView.h index 0d95729f45..309e4af1f0 100644 --- a/src/frontends/LyXView.h +++ b/src/frontends/LyXView.h @@ -123,8 +123,6 @@ public: /// set a buffer to the current workarea void setBuffer(Buffer * b); - /// sets the layout in the toolbar layout selection - void setLayout(std::string const & layout); /// updates the possible layouts selectable void updateLayoutChoice(); @@ -232,6 +230,7 @@ private: boost::signals::connection show_dialog_with_data_connection_; boost::signals::connection show_inset_dialog_connection_; boost::signals::connection update_dialog_connection_; + boost::signals::connection layout_changed_connection_; //@} /// Bind methods for BufferView messages signal connection diff --git a/src/frontends/WorkArea.C b/src/frontends/WorkArea.C index 996f7b2042..aa4089a26c 100644 --- a/src/frontends/WorkArea.C +++ b/src/frontends/WorkArea.C @@ -264,6 +264,7 @@ void WorkArea::dispatch(FuncRequest const & cmd0) // Skip these when selecting if (cmd0.action != LFUN_MOUSE_MOTION) { lyx_view_.updateLayoutChoice(); + lyx_view_.updateMenubar(); lyx_view_.updateToolbars(); } diff --git a/src/frontends/qt4/GuiImplementation.C b/src/frontends/qt4/GuiImplementation.C index 5ead31e726..705be5fd17 100644 --- a/src/frontends/qt4/GuiImplementation.C +++ b/src/frontends/qt4/GuiImplementation.C @@ -66,7 +66,7 @@ int GuiImplementation::newWorkArea(unsigned int w, unsigned int h, int view_id) work_areas_[id].reset(new GuiWorkArea(w, h, *view)); // FIXME BufferView creation should be independant of WorkArea creation - buffer_views_[id].reset(new BufferView(view)); + buffer_views_[id].reset(new BufferView()); work_areas_[id]->setBufferView(buffer_views_[id].get()); view->setWorkArea(work_areas_[id].get()); diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 34a55e61dd..ad2fbea91d 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -28,7 +28,6 @@ #include "frontends/font_metrics.h" #include "frontends/Painter.h" -#include "frontends/LyXView.h" using lyx::docstring; using lyx::graphics::PreviewLoader; diff --git a/src/insets/insetert.C b/src/insets/insetert.C index ce96f9ded7..5dc8bef27b 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -32,7 +32,6 @@ #include "paragraph.h" #include "frontends/Alert.h" -#include "frontends/LyXView.h" #include diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index 11ed1d86d1..f597932fd7 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -32,7 +32,6 @@ #include "outputparams.h" #include "frontends/lyx_gui.h" -#include "frontends/LyXView.h" #include "graphics/PreviewLoader.h" diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index c7a48dad46..31be4abb9a 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -73,7 +73,6 @@ TODO #include "sgml.h" #include "frontends/Alert.h" -#include "frontends/LyXView.h" #include "support/convert.h" #include "support/filetools.h" diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 0c4722c87d..c526de9114 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -32,7 +32,6 @@ #include "outputparams.h" #include "frontends/Alert.h" -#include "frontends/LyXView.h" #include "frontends/Painter.h" #include "graphics/PreviewImage.h" diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index e7c499bedf..dcbf6cbd7f 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -22,8 +22,6 @@ #include "pariterator.h" #include "sgml.h" -#include "frontends/LyXView.h" - #include "support/lstrings.h" #include "support/lyxalgo.h" #include "support/std_ostream.h" diff --git a/src/insets/insetref.C b/src/insets/insetref.C index 8576a1c677..cbfd1d8abe 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -21,7 +21,7 @@ #include "outputparams.h" #include "sgml.h" -#include "frontends/LyXView.h" +#include "frontends/Application.h" #include "support/lstrings.h" diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 5e9e4da802..3b36294d40 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -37,8 +37,8 @@ #include "support/convert.h" #include "frontends/Alert.h" +#include "frontends/Application.h" #include "frontends/font_metrics.h" -#include "frontends/LyXView.h" #include "frontends/Clipboard.h" #include "frontends/Painter.h" #include "frontends/Selection.h" diff --git a/src/insets/mailinset.C b/src/insets/mailinset.C index c059200b20..89765362d6 100644 --- a/src/insets/mailinset.C +++ b/src/insets/mailinset.C @@ -16,7 +16,6 @@ #include "debug.h" #include "frontends/Dialogs.h" -#include "frontends/LyXView.h" using std::string; diff --git a/src/lyxfind.C b/src/lyxfind.C index d18ae9b58b..0aec2206be 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -28,7 +28,6 @@ #include "undo.h" #include "frontends/Alert.h" -#include "frontends/LyXView.h" #include "support/convert.h" diff --git a/src/mathed/InsetMathHull.C b/src/mathed/InsetMathHull.C index b5ed8347f4..ebc5f8972c 100644 --- a/src/mathed/InsetMathHull.C +++ b/src/mathed/InsetMathHull.C @@ -50,9 +50,6 @@ #include "insets/render_preview.h" #include "insets/insetlabel.h" -#include "frontends/Dialogs.h" -#include "frontends/LyXView.h" - #include "graphics/PreviewImage.h" #include "graphics/PreviewLoader.h" diff --git a/src/mathed/InsetMathNest.C b/src/mathed/InsetMathNest.C index bf374d3581..87a41f628a 100644 --- a/src/mathed/InsetMathNest.C +++ b/src/mathed/InsetMathNest.C @@ -49,8 +49,7 @@ #include "support/lstrings.h" -#include "frontends/Dialogs.h" -#include "frontends/LyXView.h" +#include "frontends/Application.h" #include "frontends/Painter.h" #include "frontends/Selection.h" #include "frontends/nullpainter.h" diff --git a/src/mathed/InsetMathRef.C b/src/mathed/InsetMathRef.C index 4fbe793883..ac9f9726cb 100644 --- a/src/mathed/InsetMathRef.C +++ b/src/mathed/InsetMathRef.C @@ -26,15 +26,11 @@ #include "outputparams.h" #include "sgml.h" -#include "frontends/LyXView.h" -#include "frontends/Dialogs.h" - using std::string; using std::auto_ptr; using std::endl; - RefInset::RefInset() : CommandInset("ref") {} diff --git a/src/rowpainter.C b/src/rowpainter.C index 9d3593092b..012cdc4dad 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -34,8 +34,6 @@ #include "frontends/font_metrics.h" #include "frontends/nullpainter.h" -#include "frontends/LyXView.h" -#include "frontends/WorkArea.h" #include "frontends/Painter.h" #include "insets/insettext.h" diff --git a/src/text.C b/src/text.C index 22b5741227..f494ca4f00 100644 --- a/src/text.C +++ b/src/text.C @@ -52,7 +52,6 @@ #include "WordLangTuple.h" #include "frontends/font_metrics.h" -#include "frontends/LyXView.h" #include "frontends/Painter.h" #include "insets/insettext.h" diff --git a/src/text2.C b/src/text2.C index 5495f9bfa4..be19942464 100644 --- a/src/text2.C +++ b/src/text2.C @@ -46,8 +46,8 @@ #include "undo.h" #include "vspace.h" +#include "frontends/Application.h" #include "frontends/font_metrics.h" -#include "frontends/LyXView.h" #include "insets/insetenv.h" diff --git a/src/text3.C b/src/text3.C index 823eb16eb4..3e1e365af7 100644 --- a/src/text3.C +++ b/src/text3.C @@ -47,8 +47,7 @@ #include "vspace.h" #include "pariterator.h" -#include "frontends/Dialogs.h" -#include "frontends/LyXView.h" +#include "frontends/Application.h" #include "frontends/Clipboard.h" #include "frontends/Selection.h" @@ -874,7 +873,8 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) if (change_layout) { current_layout = layout; setLayout(cur, layout); - bv->owner()->setLayout(layout); + // inform the GUI that the layout has changed. + bv->layoutChanged(layout); bv->switchKeyMap(); } break; @@ -1048,8 +1048,6 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) theApp->selection().haveSelection(cur.selection()); bv->switchKeyMap(); - bv->owner()->updateMenubar(); - bv->owner()->updateToolbars(); break; } diff --git a/src/toc.C b/src/toc.C index 9cc013ecb5..f4485aaf72 100644 --- a/src/toc.C +++ b/src/toc.C @@ -24,8 +24,6 @@ #include "debug.h" #include "undo.h" -#include "frontends/LyXView.h" - #include "insets/insetfloat.h" #include "insets/insetoptarg.h" #include "insets/insetwrap.h"