]> git.lyx.org Git - features.git/blobdiff - src/bufferview_funcs.C
Replace LString.h with support/std_string.h,
[features.git] / src / bufferview_funcs.C
index c6a517f323ee2e0c1fd6e1b729ec09d251d6a10e..d2a945e8fb5fa6be06e26d22e14c76f30ccf137d 100644 (file)
@@ -3,40 +3,32 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  * \author Jean-Marc Lasgouttes
  * \author John Levon
  * \author Angus Leeming
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
 #include "bufferview_funcs.h"
 #include "BufferView.h"
-#include "paragraph.h"
-#include "lyxfont.h"
 #include "lyxlex.h"
-#include "lyxtext.h"
 #include "buffer.h"
-#include "lyx_cb.h"
 #include "language.h"
 #include "gettext.h"
 #include "ParagraphParameters.h"
-#include "author.h"
-#include "changes.h"
 
 #include "frontends/LyXView.h"
 #include "frontends/Alert.h"
 #include "mathed/math_cursor.h"
 
 #include "support/tostr.h"
-#include "Lsstream.h"
+#include "support/std_sstream.h"
 
-#include "insets/updatableinset.h"
-#include <boost/bind.hpp>
-#include <algorithm>
+#include "insets/insettext.h"
 
 using namespace lyx::support;
 
@@ -50,16 +42,6 @@ bool toggleall(false);
 
 namespace bv_funcs {
 
-
-void resizeInsets(BufferView * bv)
-{
-       ParagraphList & paragraphs = bv->buffer()->paragraphs;
-       /// then remove all LyXText in text-insets
-       std::for_each(paragraphs.begin(), paragraphs.end(),
-                     boost::bind(&Paragraph::resizeInsetsLyXText, _1, bv));
-}
-
-
 // Set data using font and toggle
 // If successful, returns true
 bool font2string(LyXFont const & font, bool toggle, string & data)
@@ -219,6 +201,7 @@ void number(BufferView * bv)
        toggleAndShow(bv, font);
 }
 
+
 void lang(BufferView * bv, string const & l)
 {
        Language const * lang = languages.getLanguage(l);
@@ -241,8 +224,7 @@ bool changeDepth(BufferView * bv, LyXText * text, DEPTH_CHANGE type, bool test_o
 
        bool const changed = text->changeDepth(type, false);
        if (text->inset_owner)
-               bv->updateInset();
-       bv->update();
+               bv->updateInset(text->inset_owner);
        return changed;
 }
 
@@ -372,7 +354,10 @@ string const currentState(BufferView * bv)
        }
 #ifdef DEVEL_VERSION
        state << _(", Paragraph: ") << text->cursor.par()->id();
-       state << "  Inset: " <<
+       state << _(", Position: ") << text->cursor.pos();
+       RowList::iterator rit = text->cursorRow();
+       state << bformat(_(", Row b:%1$d e:%2$d"), rit->pos(), rit->end());
+       state << _(", Inset: ") <<
                (text->cursor.par()->inInset() ? text->cursor.par()->inInset()->id() : -1);
 #endif
        return STRCONV(state.str());
@@ -393,19 +378,16 @@ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
        }
 
        LyXText * text = bv->getLyXText();
-       // FIXME: can this happen ??
-       if (!text)
-               return;
-
        text->toggleFree(font, toggleall);
        bv->update();
 
        if (font.language() != ignore_language ||
            font.number() != LyXFont::IGNORE) {
                LyXCursor & cursor = text->cursor;
-               text->computeBidiTables(bv->buffer(), text->cursorRow());
+               text->computeBidiTables(text->cursor.par(), *bv->buffer(),
+                       text->cursorRow());
                if (cursor.boundary() !=
-                   text->isBoundary(bv->buffer(), *cursor.par(), cursor.pos(),
+                   text->isBoundary(*bv->buffer(), *cursor.par(), cursor.pos(),
                                     text->real_current_font))
                        text->setCursor(cursor.par(), cursor.pos(),
                                        false, !cursor.boundary());
@@ -417,9 +399,8 @@ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
 void replaceSelection(LyXText * lt)
 {
        if (lt->selection.set()) {
-               lt->update();
                lt->cutSelection(true, false);
-               lt->update();
+               lt->bv()->update();
        }
 }