Hello,
As announced during the week-end. Committing now...
Abdel.
Index: BufferView.C
===================================================================
--- BufferView.C (revision 15150)
+++ BufferView.C (working copy)
@@ -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 <vector>
-using lyx::frontend::Clipboard;
-
using lyx::docstring;
using lyx::pos_type;
@@ -131,8 +125,8 @@
} // 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 @@
}
-LyXView * BufferView::owner() const
-{
- return owner_;
-}
-
-
void BufferView::setBuffer(Buffer * b)
{
lyxerr[Debug::INFO] << BOOST_CURRENT_FUNCTION
Index: BufferView.h
===================================================================
--- BufferView.h (revision 15150)
+++ BufferView.h (working copy)
@@ -18,8 +18,6 @@
#include "cursor.h"
#include "metricsinfo.h"
-#include "frontends/LyXKeySym.h"
-
#include "support/types.h"
#include <boost/utility.hpp>
@@ -36,7 +34,6 @@
class Language;
class LCursor;
class LyXText;
-class LyXView;
class ParIterator;
class ViewMetricsInfo;
@@ -88,11 +85,7 @@
*/
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 @@
/// 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 @@
boost::signal<void(std::string name,
std::string data)> updateDialog;
+ /// This signal is emitted when the layout at the cursor is changed.
+ boost::signal<void(std::string layout)> layoutChanged;
+
private:
///
bool multiParSel();
@@ -250,8 +243,6 @@
ViewMetricsInfo metrics_info_;
///
- LyXView * owner_;
- ///
Buffer * buffer_;
/// Estimated average par height for scrollbar
Index: bufferview_funcs.C
===================================================================
--- bufferview_funcs.C (revision 15150)
+++ bufferview_funcs.C (working copy)
@@ -32,7 +32,6 @@
#include "pariterator.h"
#include "frontends/Alert.h"
-#include "frontends/LyXView.h"
#include "insets/insetcommand.h"
#include "insets/insettext.h"
Index: cursor.C
===================================================================
--- cursor.C (revision 15150)
+++ cursor.C (working copy)
@@ -43,7 +43,7 @@
#include "support/limited_stack.h"
-#include "frontends/LyXView.h"
+#include "frontends/Application.h"
#include "frontends/font_metrics.h"
#include <boost/assert.hpp>
Index: CutAndPaste.C
===================================================================
--- CutAndPaste.C (revision 15150)
+++ CutAndPaste.C (working copy)
@@ -45,7 +45,7 @@
#include "support/lstrings.h"
-#include "frontends/LyXView.h"
+#include "frontends/Application.h"
#include "frontends/Clipboard.h"
#include <boost/tuple/tuple.hpp>
Index: frontends/LyXView.C
===================================================================
--- frontends/LyXView.C (revision 15150)
+++ frontends/LyXView.C (working copy)
@@ -209,6 +209,7 @@
timerConnection_.disconnect();
readonlyConnection_.disconnect();
closingConnection_.disconnect();
+ layout_changed_connection_.disconnect();
}
@@ -222,6 +223,8 @@
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 @@
}
-void LyXView::setLayout(string const & layout)
-{
- toolbars_->setLayout(layout);
-}
-
-
void LyXView::updateToolbars()
{
bool const math = work_area_->bufferView().cursor().inMathed();
Index: frontends/LyXView.h
===================================================================
--- frontends/LyXView.h (revision 15150)
+++ frontends/LyXView.h (working copy)
@@ -123,8 +123,6 @@
/// 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 @@
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
Index: frontends/qt4/GuiImplementation.C
===================================================================
--- frontends/qt4/GuiImplementation.C (revision 15150)
+++ frontends/qt4/GuiImplementation.C (working copy)
@@ -66,7 +66,7 @@
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());
Index: frontends/WorkArea.C
===================================================================
--- frontends/WorkArea.C (revision 15150)
+++ frontends/WorkArea.C (working copy)
@@ -264,6 +264,7 @@
// Skip these when selecting
if (cmd0.action != LFUN_MOUSE_MOTION) {
lyx_view_.updateLayoutChoice();
+ lyx_view_.updateMenubar();
lyx_view_.updateToolbars();
}
Index: insets/insetcollapsable.C
===================================================================
--- insets/insetcollapsable.C (revision 15150)
+++ insets/insetcollapsable.C (working copy)
@@ -28,7 +28,6 @@
#include "frontends/font_metrics.h"
#include "frontends/Painter.h"
-#include "frontends/LyXView.h"
using lyx::docstring;
using lyx::graphics::PreviewLoader;
Index: insets/insetert.C
===================================================================
--- insets/insetert.C (revision 15150)
+++ insets/insetert.C (working copy)
@@ -32,7 +32,6 @@
#include "paragraph.h"
#include "frontends/Alert.h"
-#include "frontends/LyXView.h"
#include <sstream>
Index: insets/insetexternal.C
===================================================================
--- insets/insetexternal.C (revision 15150)
+++ insets/insetexternal.C (working copy)
@@ -32,7 +32,6 @@
#include "outputparams.h"
#include "frontends/lyx_gui.h"
-#include "frontends/LyXView.h"
#include "graphics/PreviewLoader.h"
Index: insets/insetgraphics.C
===================================================================
--- insets/insetgraphics.C (revision 15150)
+++ insets/insetgraphics.C (working copy)
@@ -73,7 +73,6 @@
#include "sgml.h"
#include "frontends/Alert.h"
-#include "frontends/LyXView.h"
#include "support/convert.h"
#include "support/filetools.h"
Index: insets/insetinclude.C
===================================================================
--- insets/insetinclude.C (revision 15150)
+++ insets/insetinclude.C (working copy)
@@ -32,7 +32,6 @@
#include "outputparams.h"
#include "frontends/Alert.h"
-#include "frontends/LyXView.h"
#include "frontends/Painter.h"
#include "graphics/PreviewImage.h"
Index: insets/insetlabel.C
===================================================================
--- insets/insetlabel.C (revision 15150)
+++ insets/insetlabel.C (working copy)
@@ -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"
Index: insets/insetref.C
===================================================================
--- insets/insetref.C (revision 15150)
+++ insets/insetref.C (working copy)
@@ -21,7 +21,7 @@
#include "outputparams.h"
#include "sgml.h"
-#include "frontends/LyXView.h"
+#include "frontends/Application.h"
#include "support/lstrings.h"
Index: insets/insettabular.C
===================================================================
--- insets/insettabular.C (revision 15150)
+++ insets/insettabular.C (working copy)
@@ -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"
Index: insets/mailinset.C
===================================================================
--- insets/mailinset.C (revision 15150)
+++ insets/mailinset.C (working copy)
@@ -16,7 +16,6 @@
#include "debug.h"
#include "frontends/Dialogs.h"
-#include "frontends/LyXView.h"
using std::string;
Index: lyxfind.C
===================================================================
--- lyxfind.C (revision 15150)
+++ lyxfind.C (working copy)
@@ -28,7 +28,6 @@
#include "undo.h"
#include "frontends/Alert.h"
-#include "frontends/LyXView.h"
#include "support/convert.h"
Index: mathed/InsetMathHull.C
===================================================================
--- mathed/InsetMathHull.C (revision 15150)
+++ mathed/InsetMathHull.C (working copy)
@@ -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"
Index: mathed/InsetMathNest.C
===================================================================
--- mathed/InsetMathNest.C (revision 15150)
+++ mathed/InsetMathNest.C (working copy)
@@ -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"
Index: mathed/InsetMathRef.C
===================================================================
--- mathed/InsetMathRef.C (revision 15150)
+++ mathed/InsetMathRef.C (working copy)
@@ -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")
{}
Index: ParagraphParameters.C
===================================================================
--- ParagraphParameters.C (revision 15150)
+++ ParagraphParameters.C (working copy)
@@ -25,8 +25,6 @@
#include "paragraph.h"
#include "tex-strings.h"
-#include "frontends/LyXView.h"
-
#include "support/lstrings.h"
#include <sstream>
Index: rowpainter.C
===================================================================
--- rowpainter.C (revision 15150)
+++ rowpainter.C (working copy)
@@ -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"
Index: text.C
===================================================================
--- text.C (revision 15150)
+++ text.C (working copy)
@@ -52,7 +52,6 @@
#include "WordLangTuple.h"
#include "frontends/font_metrics.h"
-#include "frontends/LyXView.h"
#include "frontends/Painter.h"
#include "insets/insettext.h"
Index: text2.C
===================================================================
--- text2.C (revision 15150)
+++ text2.C (working copy)
@@ -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"
Index: text3.C
===================================================================
--- text3.C (revision 15150)
+++ text3.C (working copy)
@@ -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 @@
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 @@
theApp->selection().haveSelection(cur.selection());
bv->switchKeyMap();
- bv->owner()->updateMenubar();
- bv->owner()->updateToolbars();
break;
}
Index: toc.C
===================================================================
--- toc.C (revision 15150)
+++ toc.C (working copy)
@@ -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"