From: Alfredo Braunstein Date: Fri, 17 Dec 2004 16:27:12 +0000 (+0000) Subject: remove paragraph::autoBreakRows X-Git-Tag: 1.6.10~14723 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=70bcd97d455a510aa465058a86239e0d99ff66d0;p=features.git remove paragraph::autoBreakRows git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9397 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index c37e150eb8..24d03d44b2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2004-12-17 Alfredo Braunstein + + * paragraph.[Ch] (autoBreakRows): remove + + * lyxtext.h: move autoBreakRows_ flag from InsetText to here. + + * buffer.[Ch] (insertStringAsLines): receive an autobreakrows bool to + avoid using the paragraph one + + * text2.C (LyXText, insertStringAsLines): adjust + 2004-12-16 Angus Leeming * bufferlist.C: diff --git a/src/buffer.C b/src/buffer.C index 37ec8955e8..610a56a78c 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -474,7 +474,7 @@ bool Buffer::readDocument(LyXLex & lex) // needed to insert the selection void Buffer::insertStringAsLines(ParagraphList & pars, pit_type & par, pos_type & pos, - LyXFont const & fn, string const & str) + LyXFont const & fn, string const & str, bool autobreakrows) { LyXLayout_ptr const & layout = pars[par].layout(); @@ -483,7 +483,6 @@ void Buffer::insertStringAsLines(ParagraphList & pars, pars[par].checkInsertChar(font); // insert the string, don't insert doublespace bool space_inserted = true; - bool autobreakrows = pars[par].autoBreakRows(); for (string::const_iterator cit = str.begin(); cit != str.end(); ++cit) { if (*cit == '\n') { diff --git a/src/buffer.h b/src/buffer.h index 67b8c859b7..9e7b9a1675 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -99,7 +99,7 @@ public: /// void insertStringAsLines(ParagraphList & plist, lyx::pit_type &, lyx::pos_type &, - LyXFont const &, std::string const &); + LyXFont const &, std::string const &, bool); /// ParIterator getParFromID(int id) const; /// do we have a paragraph with this id? diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index d20b7fce59..fd9ae88b08 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ + +2004-12-17 Alfredo Braunstein + + * insettext.[Ch] : move autoBreakRows_ bool to LyXText + 2004-12-15 Georg Baum * insettabular.C (tabularFeatures): re-enable SET_ALL_LINES and diff --git a/src/insets/insettext.C b/src/insets/insettext.C index ee35d1f1aa..fdb2c5611a 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -72,8 +72,7 @@ using std::vector; InsetText::InsetText(BufferParams const & bp) - : autoBreakRows_(false), drawFrame_(false), - frame_color_(LColor::insetframe), text_(0) + : drawFrame_(false), frame_color_(LColor::insetframe), text_(0) { paragraphs().push_back(Paragraph()); paragraphs().back().layout(bp.getLyXTextClass().defaultLayout()); @@ -86,7 +85,7 @@ InsetText::InsetText(BufferParams const & bp) InsetText::InsetText(InsetText const & in) : UpdatableInset(in), text_(in.text_.bv_owner) { - autoBreakRows_ = in.autoBreakRows_; + text_.autoBreakRows_ = in.text_.autoBreakRows_; drawFrame_ = in.drawFrame_; frame_color_ = in.frame_color_; text_.paragraphs() = in.text_.paragraphs(); @@ -226,7 +225,7 @@ void InsetText::clearInset(Painter & pain, int x, int y) const void InsetText::updateLocal(LCursor & cur) { - if (!autoBreakRows_ && paragraphs().size() > 1) { + if (!text_.autoBreakRows_ && paragraphs().size() > 1) { // collapse paragraphs while (paragraphs().size() > 1) { ParagraphList::iterator const first = paragraphs().begin(); @@ -409,8 +408,8 @@ void InsetText::setText(string const & data, LyXFont const & font) void InsetText::setAutoBreakRows(bool flag) { - if (flag != autoBreakRows_) { - autoBreakRows_ = flag; + if (flag != text_.autoBreakRows_) { + text_.autoBreakRows_ = flag; if (!flag) removeNewlines(); } diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 1390ff8e1f..ad8664f1ab 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -86,7 +86,7 @@ public: /// void setAutoBreakRows(bool); /// - bool getAutoBreakRows() const { return autoBreakRows_; } + bool getAutoBreakRows() const { return text_.autoBreakRows_; } /// void setDrawFrame(bool); /// @@ -157,8 +157,6 @@ private: /// void clearInset(Painter &, int x, int y) const; - /// - bool autoBreakRows_; /// bool drawFrame_; /** We store the LColor::color value as an int to get LColor.h out diff --git a/src/lyxtext.h b/src/lyxtext.h index cc637f1694..07b4765bd0 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -352,6 +352,8 @@ public: /// our 'outermost' Font LyXFont font_; + /// + bool autoBreakRows_; private: /// return past-the-last paragraph influenced by a layout /// change on pit diff --git a/src/paragraph.C b/src/paragraph.C index 62667f63b6..a2d4a52f35 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -716,12 +716,6 @@ bool Paragraph::forceDefaultParagraphs() const } -bool Paragraph::autoBreakRows() const -{ - return inInset() && static_cast(inInset())->getAutoBreakRows(); -} - - namespace { // paragraphs inside floats need different alignment tags to avoid diff --git a/src/paragraph.h b/src/paragraph.h index 8aac8031a4..26d1121828 100644 --- a/src/paragraph.h +++ b/src/paragraph.h @@ -169,8 +169,6 @@ public: /// InsetBase::Code ownerCode() const; /// - bool autoBreakRows() const; - /// bool forceDefaultParagraphs() const; /// diff --git a/src/text2.C b/src/text2.C index e406a65f66..55f9d4e1ad 100644 --- a/src/text2.C +++ b/src/text2.C @@ -74,7 +74,8 @@ using std::string; LyXText::LyXText(BufferView * bv) : maxwidth_(bv ? bv->workWidth() : 100), background_color_(LColor::background), - bv_owner(bv) + bv_owner(bv), + autoBreakRows_(false) {} @@ -893,7 +894,8 @@ void LyXText::insertStringAsLines(LCursor & cur, string const & str) // only to be sure, should not be neccessary cur.clearSelection(); - cur.buffer().insertStringAsLines(pars_, pit, pos, current_font, str); + cur.buffer().insertStringAsLines(pars_, pit, pos, current_font, str, + autoBreakRows_); cur.resetAnchor(); setCursor(cur, cur.pit(), pos);