From 3ab05074978fae165f885772801e7122b4954652 Mon Sep 17 00:00:00 2001 From: Alfredo Braunstein Date: Mon, 6 Dec 2004 12:55:03 +0000 Subject: [PATCH] remove getSelectionSpan not-so-helper git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9346 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 6 ++++++ src/text2.C | 29 ++++++----------------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 46ed6c39e9..42b946086b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ + +2004-12-06 Alfredo Braunstein + + * text2.C (getSelectionSpan): remove + (changeDepth, changeDepthAllowed): adjust + 2004-12-05 Lars Gullik Bjønnes * Makefile.am (BOOST_LIBS): use boost variables diff --git a/src/text2.C b/src/text2.C index 2f90fd73b1..e406a65f66 100644 --- a/src/text2.C +++ b/src/text2.C @@ -343,18 +343,6 @@ void LyXText::setLayout(LCursor & cur, string const & layout) namespace { -void getSelectionSpan(LCursor & cur, pit_type & beg, pit_type & end) -{ - if (!cur.selection()) { - beg = cur.pit(); - end = cur.pit() + 1; - } else { - beg = cur.selBegin().pit(); - end = cur.selEnd().pit() + 1; - } -} - - bool changeDepthAllowed(LyXText::DEPTH_CHANGE type, Paragraph const & par, int max_depth) { @@ -375,11 +363,9 @@ bool changeDepthAllowed(LyXText::DEPTH_CHANGE type, bool LyXText::changeDepthAllowed(LCursor & cur, DEPTH_CHANGE type) const { BOOST_ASSERT(this == cur.text()); - pit_type beg, end; - getSelectionSpan(cur, beg, end); - int max_depth = 0; - if (beg != 0) - max_depth = pars_[beg - 1].getMaxDepthAfter(); + pit_type const beg = cur.selBegin().pit(); + pit_type const end = cur.selEnd().pit() + 1; + int max_depth = (beg != 0 ? pars_[beg - 1].getMaxDepthAfter() : 0); for (pit_type pit = beg; pit != end; ++pit) { if (::changeDepthAllowed(type, pars_[pit], max_depth)) @@ -393,13 +379,10 @@ bool LyXText::changeDepthAllowed(LCursor & cur, DEPTH_CHANGE type) const void LyXText::changeDepth(LCursor & cur, DEPTH_CHANGE type) { BOOST_ASSERT(this == cur.text()); - pit_type beg, end; - getSelectionSpan(cur, beg, end); + pit_type const beg = cur.selBegin().pit(); + pit_type const end = cur.selEnd().pit() + 1; recordUndoSelection(cur); - - int max_depth = 0; - if (beg != 0) - max_depth = pars_[beg - 1].getMaxDepthAfter(); + int max_depth = (beg != 0 ? pars_[beg - 1].getMaxDepthAfter() : 0); for (pit_type pit = beg; pit != end; ++pit) { Paragraph & par = pars_[pit]; -- 2.39.2