Free BufferView from LyXView!

* BufferView
  - layoutChanged: new boost signal.
  - LyXView owner(), owner_: deleted

* text3.C
  - emit BufferView::layoutChanged instead of calling LyXView::setLayout directly
  - LFUN_MOUSE_RELEASE: delete LyXView updateMenubar() and updateToolbars() direct calls.
    The update is of both bars is done in WorkArea::dispatch().

* WorkArea.C
  - dispatch(): add LyXView updateMenubar() call.

* LyXView
  - connects to BufferView::layoutChanged directly to Toolbars::setLayout()
  - setLayout(): deleted.

* qt4/GuiImplementation: modify BufferView construction (without LyXView).

All other files: cleanup header declaration of LyXView.h


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15153 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-09-26 10:06:46 +00:00
parent 1ead706c96
commit b171e5f150
28 changed files with 21 additions and 72 deletions

View File

@ -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 @@ 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

View File

@ -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 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<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();
@ -249,8 +242,6 @@ private:
///
ViewMetricsInfo metrics_info_;
///
LyXView * owner_;
///
Buffer * buffer_;

View File

@ -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>

View File

@ -25,8 +25,6 @@
#include "paragraph.h"
#include "tex-strings.h"
#include "frontends/LyXView.h"
#include "support/lstrings.h"
#include <sstream>

View File

@ -32,7 +32,6 @@
#include "pariterator.h"
#include "frontends/Alert.h"
#include "frontends/LyXView.h"
#include "insets/insetcommand.h"
#include "insets/insettext.h"

View File

@ -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>

View File

@ -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();

View File

@ -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

View File

@ -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();
}

View File

@ -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());

View File

@ -28,7 +28,6 @@
#include "frontends/font_metrics.h"
#include "frontends/Painter.h"
#include "frontends/LyXView.h"
using lyx::docstring;
using lyx::graphics::PreviewLoader;

View File

@ -32,7 +32,6 @@
#include "paragraph.h"
#include "frontends/Alert.h"
#include "frontends/LyXView.h"
#include <sstream>

View File

@ -32,7 +32,6 @@
#include "outputparams.h"
#include "frontends/lyx_gui.h"
#include "frontends/LyXView.h"
#include "graphics/PreviewLoader.h"

View File

@ -73,7 +73,6 @@ TODO
#include "sgml.h"
#include "frontends/Alert.h"
#include "frontends/LyXView.h"
#include "support/convert.h"
#include "support/filetools.h"

View File

@ -32,7 +32,6 @@
#include "outputparams.h"
#include "frontends/Alert.h"
#include "frontends/LyXView.h"
#include "frontends/Painter.h"
#include "graphics/PreviewImage.h"

View File

@ -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"

View File

@ -21,7 +21,7 @@
#include "outputparams.h"
#include "sgml.h"
#include "frontends/LyXView.h"
#include "frontends/Application.h"
#include "support/lstrings.h"

View File

@ -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"

View File

@ -16,7 +16,6 @@
#include "debug.h"
#include "frontends/Dialogs.h"
#include "frontends/LyXView.h"
using std::string;

View File

@ -28,7 +28,6 @@
#include "undo.h"
#include "frontends/Alert.h"
#include "frontends/LyXView.h"
#include "support/convert.h"

View File

@ -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"

View File

@ -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"

View File

@ -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")
{}

View File

@ -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"

View File

@ -52,7 +52,6 @@
#include "WordLangTuple.h"
#include "frontends/font_metrics.h"
#include "frontends/LyXView.h"
#include "frontends/Painter.h"
#include "insets/insettext.h"

View File

@ -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"

View File

@ -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;
}

View File

@ -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"