}
-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
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);
}
#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
/// 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;
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;
+}
#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>
/// 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;
+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:
+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.)
#include "BufferView.h"
+#include "insets/inset.h"
+
#include "support/lstrings.h"
#include <boost/bind.hpp>
+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.)
#include "insets/renderers.h"
+#include "insets/inset.h"
+
#include "BufferView.h"
#include "gettext.h"
#include "metricsinfo.h"