From bf4fcda6cb2ed72bf00a1b7f44e0f252ec472153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 1 Aug 2003 12:52:59 +0000 Subject: [PATCH] adjust some comments restrict code region covered by save/restoreLyXTextState git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7473 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/insettext.C | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 2bea9220ae..0b21274b8e 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -79,17 +79,17 @@ using namespace bv_funcs; using lyx::pos_type; using lyx::textclass_type; -// These functions should probably go into bufferview_funcs somehow (Jug) + +// we should get rid of these (Andre') void InsetText::saveLyXTextState() const { // check if my paragraphs are still valid ParagraphList::iterator it = const_cast(paragraphs).begin(); ParagraphList::iterator end = const_cast(paragraphs).end(); - for (; it != end; ++it) { + for (; it != end; ++it) if (it == text_.cursor.par()) break; - } if (it != end && text_.cursor.pos() <= it->size()) sstate = text_; // slicing intended @@ -159,7 +159,7 @@ void InsetText::init(InsetText const * ins) drawFrame_ = ins->drawFrame_; frame_color = ins->frame_color; } else { - textwidth_ = 0; // unbounded + textwidth_ = 0; // broken drawFrame_ = NEVER; frame_color = LColor::insetframe; autoBreakRows = false; @@ -1922,14 +1922,8 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const void InsetText::resizeLyXText(BufferView * bv, bool /*force*/) const { - if (paragraphs.size() == 1 && paragraphs.begin()->empty()) { - // no data, resize not neccessary! - // we have to do this as a fixed width may have changed! - saveLyXTextState(); - text_.init(bv); - restoreLyXTextState(); + if (paragraphs.size() == 1 && paragraphs.begin()->empty()) return; - } if (!bv) return; @@ -1937,12 +1931,11 @@ void InsetText::resizeLyXText(BufferView * bv, bool /*force*/) const Assert(bv); setViewCache(bv); - saveLyXTextState(); - for_each(const_cast(paragraphs).begin(), const_cast(paragraphs).end(), boost::bind(&Paragraph::resizeInsetsLyXText, _1, bv)); + saveLyXTextState(); text_.init(bv); restoreLyXTextState();