]> git.lyx.org Git - features.git/commitdiff
Free BufferView from LyXView!
authorAbdelrazak Younes <younes@lyx.org>
Tue, 26 Sep 2006 10:06:46 +0000 (10:06 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 26 Sep 2006 10:06:46 +0000 (10:06 +0000)
* 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

28 files changed:
src/BufferView.C
src/BufferView.h
src/CutAndPaste.C
src/ParagraphParameters.C
src/bufferview_funcs.C
src/cursor.C
src/frontends/LyXView.C
src/frontends/LyXView.h
src/frontends/WorkArea.C
src/frontends/qt4/GuiImplementation.C
src/insets/insetcollapsable.C
src/insets/insetert.C
src/insets/insetexternal.C
src/insets/insetgraphics.C
src/insets/insetinclude.C
src/insets/insetlabel.C
src/insets/insetref.C
src/insets/insettabular.C
src/insets/mailinset.C
src/lyxfind.C
src/mathed/InsetMathHull.C
src/mathed/InsetMathNest.C
src/mathed/InsetMathRef.C
src/rowpainter.C
src/text.C
src/text2.C
src/text3.C
src/toc.C

index 95d093b777032d8ebd431a539511291251d406fe..6234108beb2bb7f02ae7227cbfb3771781eaa7de 100644 (file)
 #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
index 94c1588e8a688ca68f68662b65971fecaf20eafb..80199dd27093ebf76ea44f517b8ee7b1be030490 100644 (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_;
 
index cb7c556bfc1c8138870dbbcfc17fded53dd9ec8f..68ce0c907a290b3b8b92d8331df2630630d87cfc 100644 (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>
index 6fead69a332123b26c7acb2c1ef84f13fd8f42b6..b9eaca3712199b12c8d460e4563e20f61bb6b92a 100644 (file)
@@ -25,8 +25,6 @@
 #include "paragraph.h"
 #include "tex-strings.h"
 
-#include "frontends/LyXView.h"
-
 #include "support/lstrings.h"
 
 #include <sstream>
index 2125c5706b5eae0b73e56904c3b762aa0d0bd700..9f9f198c303fc3087573b349f0b7e4e7c4107506 100644 (file)
@@ -32,7 +32,6 @@
 #include "pariterator.h"
 
 #include "frontends/Alert.h"
-#include "frontends/LyXView.h"
 
 #include "insets/insetcommand.h"
 #include "insets/insettext.h"
index 0d71f751100345b472140dc64eb79a57141580f1..ee3b064c8b04fb385760146fc939af5c0cbe8a7c 100644 (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>
index 8a8274e966e0d998b92618004f6d4dbd96b5ca5c..2333f8d8883d4926ae37a1caa94cdde4c2c22a06 100644 (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();
index 0d95729f45bb843a131d62ab557ee4c46f1e77c6..309e4af1f049049295f4f218b8911c32391ac103 100644 (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
index 996f7b204283544a6644b0cb68bf6b573aac0ff6..aa4089a26cffe60a294cd48de75149ace8e9f1c5 100644 (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();
        }
 
index 5ead31e72678eabecf408b2708e94766444acedf..705be5fd17c55c614baa31a34701d4c728c1e1a5 100644 (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());
 
index 34a55e61dd8448d8528ee6d267d430fb9ffb9977..ad2fbea91d2c0d240a3728d079fe5b6bf2732138 100644 (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;
index ce96f9ded78787c60d2ac38db1e1e2f29e2ff694..5dc8bef27b1c07e8de9bad26b977da5db793854f 100644 (file)
@@ -32,7 +32,6 @@
 #include "paragraph.h"
 
 #include "frontends/Alert.h"
-#include "frontends/LyXView.h"
 
 #include <sstream>
 
index 11ed1d86d1b31d7064aaea947345f729ab411a98..f597932fd7da666479658c2a49033f16d7b73120 100644 (file)
@@ -32,7 +32,6 @@
 #include "outputparams.h"
 
 #include "frontends/lyx_gui.h"
-#include "frontends/LyXView.h"
 
 #include "graphics/PreviewLoader.h"
 
index c7a48dad4629c8bc40cd1ce73931cf0208463545..31be4abb9a65f711c4306a82b03f871a4c43a3ce 100644 (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"
index 0c4722c87d33a8ee9a0e69bb63c69a77c3874069..c526de91141c5f5f5e82e086e4f9533b4b26976e 100644 (file)
@@ -32,7 +32,6 @@
 #include "outputparams.h"
 
 #include "frontends/Alert.h"
-#include "frontends/LyXView.h"
 #include "frontends/Painter.h"
 
 #include "graphics/PreviewImage.h"
index e7c499bedf0ddf74fbe46a816b044fa4032b429d..dcbf6cbd7f56e81ce104e3b2597c886abc3ea84e 100644 (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"
index 8576a1c677f68fae9af177295d7c55f88e4a4a61..cbfd1d8abe2f9ac01801ee9e3cd6a00cf659b25e 100644 (file)
@@ -21,7 +21,7 @@
 #include "outputparams.h"
 #include "sgml.h"
 
-#include "frontends/LyXView.h"
+#include "frontends/Application.h"
 
 #include "support/lstrings.h"
 
index 5e9e4da802a522491f8b78fa81ed4e902155461b..3b36294d40c83b246e3f411fa56b2716f6ab2439 100644 (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"
index c059200b2035424491fedaab5e4697c9036896de..89765362d61c9eea1b4beeb93454a751942afd9b 100644 (file)
@@ -16,7 +16,6 @@
 #include "debug.h"
 
 #include "frontends/Dialogs.h"
-#include "frontends/LyXView.h"
 
 using std::string;
 
index d18ae9b58be9f32ad9a7906c8b8850484ba12152..0aec2206be12e9550f524f81cc1408d828ad7de2 100644 (file)
@@ -28,7 +28,6 @@
 #include "undo.h"
 
 #include "frontends/Alert.h"
-#include "frontends/LyXView.h"
 
 #include "support/convert.h"
 
index b5ed8347f40b6aba9ac092fb0a8bdc403bcb1f22..ebc5f8972c499cc2fd4fe298047c7cccad78ceba 100644 (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"
 
index bf374d358138ba7a65633c56a6a89a1f26620055..87a41f628a4fc71066c29a8065f7c925a08c7c92 100644 (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"
index 4fbe793883e3b075606d8b9165d01cf07d78e215..ac9f9726cbc8bf6ec95719102f145ae5fc76522d 100644 (file)
 #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 9d3593092b95a9c7e44b7fc6a94ea1b9c2e83c74..012cdc4dad7559a7b6c0cbbb5e796a1fc01a26fb 100644 (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"
index 22b5741227c6da281414ebfb7aad1872b6ca4f4f..f494ca4f00a5a3f84df707a746ac14345a97503e 100644 (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"
index 5495f9bfa4045190a95711f7ffc4e76b64934c1a..be1994246425c2f615d9457cd3e8bec764fce06e 100644 (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"
 
index 823eb16eb4c92f1e1ce36bde8f711ee7d6941851..3e1e365af76d431722f3923bacc0bc2999d55b71 100644 (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;
        }
 
index 9cc013ecb57ca55a8fc879468c0b3dd78739c01e..f4485aaf7287edd6e958ca028bf82343b58a1184 100644 (file)
--- 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"