]> git.lyx.org Git - features.git/commitdiff
Move BufferView::ChangeInsets to the Pimpl. As a result, can remove
authorAngus Leeming <leeming@lyx.org>
Sat, 6 Sep 2003 19:16:30 +0000 (19:16 +0000)
committerAngus Leeming <leeming@lyx.org>
Sat, 6 Sep 2003 19:16:30 +0000 (19:16 +0000)
the #include "insets/inset.h" from BufferView.h.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7696 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.C
src/BufferView.h
src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/ChangeLog
src/graphics/ChangeLog
src/graphics/PreviewedInset.C
src/insets/ChangeLog
src/insets/renderers.C

index 3c0e80f109c37d8c01abe5d42d4087c9b0b97a18..69c73907d4f94d1104ae750fef80758101ff99f5 100644 (file)
@@ -517,47 +517,6 @@ void BufferView::updateInset(InsetOld const * inset)
 }
 
 
-bool BufferView::ChangeInsets(InsetOld::Code code,
-                             string const & from, string const & to)
-{
-       bool need_update = false;
-       LyXCursor cursor = text->cursor;
-       LyXCursor tmpcursor = cursor;
-       cursor.par(tmpcursor.par());
-       cursor.pos(tmpcursor.pos());
-
-       ParIterator end = buffer()->par_iterator_end();
-       for (ParIterator it = buffer()->par_iterator_begin();
-            it != end; ++it) {
-               bool changed_inset = false;
-               for (InsetList::iterator it2 = it->insetlist.begin();
-                    it2 != it->insetlist.end(); ++it2) {
-                       if (it2->inset->lyxCode() == code) {
-                               InsetCommand * inset = static_cast<InsetCommand *>(it2->inset);
-                               if (inset->getContents() == from) {
-                                       inset->setContents(to);
-                                       changed_inset = true;
-                               }
-                       }
-               }
-               if (changed_inset) {
-                       need_update = true;
-
-                       // FIXME
-
-                       // The test it.size()==1 was needed to prevent crashes.
-                       // How to set the cursor corretly when it.size()>1 ??
-                       if (it.size() == 1) {
-                               text->setCursorIntern(it.pit(), 0);
-                               text->redoParagraph(text->cursor.par());
-                       }
-               }
-       }
-       text->setCursorIntern(cursor.par(), cursor.pos());
-       return need_update;
-}
-
-
 bool BufferView::ChangeRefsIfUnique(string const & from, string const & to)
 {
        // Check if the label 'from' appears more than once
@@ -567,7 +526,7 @@ bool BufferView::ChangeRefsIfUnique(string const & from, string const & to)
        if (lyx::count(labels.begin(), labels.end(), from) > 1)
                return false;
 
-       return ChangeInsets(InsetOld::REF_CODE, from, to);
+       return pimpl_->ChangeInsets(InsetOld::REF_CODE, from, to);
 }
 
 
index 2172c101caab8fbc6bff7ded800b08be23fda5ed..df086a8f7e67d0531bf8477fa027066cde3eec58 100644 (file)
 #ifndef BUFFER_VIEW_H
 #define BUFFER_VIEW_H
 
-#include "support/std_string.h"
-
-#include "insets/inset.h"
-
 #include <boost/utility.hpp>
 
+#include "support/std_string.h"
+
+class Buffer;
 class Change;
-class LyXView;
+class Encoding;
+class ErrorList;
+class FuncRequest;
+class InsetOld;
+class Language;
 class LyXText;
-class TeXErrors;
-class Buffer;
 class LyXScreen;
-class Language;
+class LyXView;
 class Painter;
+class TeXErrors;
 class UpdatableInset;
 class WordLangTuple;
-class Encoding;
-class ErrorList;
 
 /**
  * A buffer view encapsulates a view onto a particular
@@ -205,15 +205,6 @@ private:
        /// Set the current locking inset
        void theLockingInset(UpdatableInset * inset);
 
-       /**
-        * Change all insets with the given code's contents to a new
-        * string. May only be used with InsetCommand-derived insets
-        * Returns true if a screen update is needed.
-        */
-       bool ChangeInsets(InsetOld::Code code, string const & from,
-                         string const & to);
-
-
        struct Pimpl;
        friend struct BufferView::Pimpl;
 
index 5d43f7d13c816bd1ffddc0234a8fbb1285e6921e..abcc8144daedb1d2412b1523fae0e7e77ebbfe89 100644 (file)
@@ -1384,3 +1384,44 @@ void BufferView::Pimpl::updateInset(InsetOld const * inset)
        update();
        updateScrollbar();
 }
+
+
+bool BufferView::Pimpl::ChangeInsets(InsetOld::Code code,
+                                    string const & from, string const & to)
+{
+       bool need_update = false;
+       LyXCursor cursor = bv_->text->cursor;
+       LyXCursor tmpcursor = cursor;
+       cursor.par(tmpcursor.par());
+       cursor.pos(tmpcursor.pos());
+
+       ParIterator end = bv_->buffer()->par_iterator_end();
+       for (ParIterator it = bv_->buffer()->par_iterator_begin();
+            it != end; ++it) {
+               bool changed_inset = false;
+               for (InsetList::iterator it2 = it->insetlist.begin();
+                    it2 != it->insetlist.end(); ++it2) {
+                       if (it2->inset->lyxCode() == code) {
+                               InsetCommand * inset = static_cast<InsetCommand *>(it2->inset);
+                               if (inset->getContents() == from) {
+                                       inset->setContents(to);
+                                       changed_inset = true;
+                               }
+                       }
+               }
+               if (changed_inset) {
+                       need_update = true;
+
+                       // FIXME
+
+                       // The test it.size()==1 was needed to prevent crashes.
+                       // How to set the cursor corretly when it.size()>1 ??
+                       if (it.size() == 1) {
+                               bv_->text->setCursorIntern(it.pit(), 0);
+                               bv_->text->redoParagraph(bv_->text->cursor.par());
+                       }
+               }
+       }
+       bv_->text->setCursorIntern(cursor.par(), cursor.pos());
+       return need_update;
+}
index 2032a09ec374afe611052a9dd483ef4906743473..6599d6c6e7bcbb837b566f035bccdda3ed7508f8 100644 (file)
 
 #include "errorlist.h"
 #include "BufferView.h"
-#include "frontends/Timeout.h"
+
+#include "insets/inset.h"
+
 #include "frontends/key_state.h"
 #include "frontends/LyXKeySym.h"
+#include "frontends/Timeout.h"
+
 #include "support/types.h"
 
 #include <boost/scoped_ptr.hpp>
@@ -140,6 +144,14 @@ private:
        /// notify readonly status
        void showReadonly(bool);
 
+       /**
+        * Change all insets with the given code's contents to a new
+        * string. May only be used with InsetCommand-derived insets
+        * Returns true if a screen update is needed.
+        */
+       bool ChangeInsets(InsetOld::Code code, string const & from,
+                         string const & to);
+
        ///
        friend class BufferView;
 
index 2066d2dea9bb222034c983a62b78fe07d06c16a1..ca6a06b4b330ad1ab0360747d67e08495f0e58b2 100644 (file)
@@ -1,3 +1,8 @@
+2003-09-06  Angus Leeming  <leeming@lyx.org>
+
+       * BufferView.[Ch] (ChangeInsets): moved to BufferView_pimpl.[Ch].
+       As a result, can remove the #include "insets/inset.h" from BufferView.h
+
 2003-09-06  Angus Leeming  <leeming@lyx.org>
 
        * buffer_funcs.C:
index fd8637ea9f0cfca59325ada387ebb0bcc477e203..cf374b45f5a6382128780a9365cfd6ae2af8a358 100644 (file)
@@ -1,3 +1,7 @@
+2003-09-06  Angus Leeming  <leeming@lyx.org>
+
+       * PreviewedInset.C: add #include "insets/inset.h"
+
 2003-09-05  Angus Leeming  <leeming@lyx.org>
 
        * *.C: strip out redundant #includes. (26 in total.)
index c6ebaf76b16379ef4e7aad43573f8755618946d9..a6447602475e8567273d909228ade224962942c3 100644 (file)
@@ -17,6 +17,8 @@
 
 #include "BufferView.h"
 
+#include "insets/inset.h"
+
 #include "support/lstrings.h"
 
 #include <boost/bind.hpp>
index 60b7201ce7512a640e1d8ca48bec8d6b788765be..2e0bdb85b170d6a2c5581253d863612d7e23d04c 100644 (file)
@@ -1,3 +1,7 @@
+2003-09-06  Angus Leeming  <leeming@lyx.org>
+
+       * renderers.C: add #include "insets/inset.h"
+
 2003-09-05  Angus Leeming  <leeming@lyx.org>
 
        * *.C: strip out redundant #includes. (193 in total.)
index c33cab867c70ba4c9e481c2a08af75472b8ca0b3..9018865f32334db746089be1953719b2c696a1b3 100644 (file)
@@ -12,6 +12,8 @@
 
 #include "insets/renderers.h"
 
+#include "insets/inset.h"
+
 #include "BufferView.h"
 #include "gettext.h"
 #include "metricsinfo.h"