diff --git a/src/frontends/LyXView.C b/src/frontends/LyXView.C index 73699d1646..9017b09e9b 100644 --- a/src/frontends/LyXView.C +++ b/src/frontends/LyXView.C @@ -100,6 +100,20 @@ void LyXView::setWorkArea(WorkArea * work_area) } +// FIXME, there's only one WorkArea per LyXView possible for now. +WorkArea const * LyXView::currentWorkArea() const +{ + return work_area_; +} + + +// FIXME, there's only one WorkArea per LyXView possible for now. +WorkArea * LyXView::currentWorkArea() +{ + return work_area_; +} + + Buffer * LyXView::buffer() const { BOOST_ASSERT(work_area_); diff --git a/src/frontends/LyXView.h b/src/frontends/LyXView.h index b51aa65447..6c3b62a79b 100644 --- a/src/frontends/LyXView.h +++ b/src/frontends/LyXView.h @@ -74,8 +74,15 @@ public: std::vector const & workAreaIds() const { return work_area_ids_; } + /// FIXME: rename to setCurrentWorkArea() void setWorkArea(frontend::WorkArea * work_area); + /// return the current WorkArea (the one that has the focus). + frontend::WorkArea const * currentWorkArea() const; + /// FIXME: This non-const access is needed because of + /// a mis-designed \c ControlSpellchecker. + frontend::WorkArea * currentWorkArea(); + /** * This is called after the concrete view has been created. * We have to have the toolbar and the other stuff created diff --git a/src/frontends/controllers/ControlSpellchecker.C b/src/frontends/controllers/ControlSpellchecker.C index c001bd27b4..f6af7fd50c 100644 --- a/src/frontends/controllers/ControlSpellchecker.C +++ b/src/frontends/controllers/ControlSpellchecker.C @@ -40,6 +40,10 @@ #include "support/docstring.h" #include "frontends/Alert.h" +// FIXME: those two headers are needed because of the +// WorkArea::redraw() call below. +#include "frontends/lyxview.h" +#include "frontends/WorkArea.h" using std::advance; using std::distance; @@ -251,6 +255,8 @@ void ControlSpellchecker::check() // if we used a lfun like in find/replace, dispatch would do // that for us kernel().bufferview()->update(); + // FIXME: this Controller is very badly designed... + kernel().lyxview().currentWorkArea()->redraw(); // set suggestions if (res != SpellBase::OK && res != SpellBase::IGNORED_WORD) {