]> git.lyx.org Git - features.git/commitdiff
remove getSelectionSpan not-so-helper
authorAlfredo Braunstein <abraunst@lyx.org>
Mon, 6 Dec 2004 12:55:03 +0000 (12:55 +0000)
committerAlfredo Braunstein <abraunst@lyx.org>
Mon, 6 Dec 2004 12:55:03 +0000 (12:55 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9346 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/text2.C

index 46ed6c39e91ce9183f44dbd6e30fb5080edd72cf..42b946086b33468d40a29e06cee8fe1f47b727ea 100644 (file)
@@ -1,3 +1,9 @@
+
+2004-12-06  Alfredo Braunstein  <abraunst@lyx.org>
+
+       * text2.C (getSelectionSpan): remove
+       (changeDepth, changeDepthAllowed): adjust
+
 2004-12-05  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
        * Makefile.am (BOOST_LIBS): use boost variables
index 2f90fd73b1a4db07bf11eaef1795a8746fb05638..e406a65f6649c4eb6050cf3250a92c9b158ba660 100644 (file)
@@ -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];