]> git.lyx.org Git - lyx.git/blobdiff - src/text.C
remove unused code
[lyx.git] / src / text.C
index aa8b2b0659c152c31526db333eb4173153ac45d7..4568a031077b7ee7aca15d6bb7b6bddbe1de749f 100644 (file)
@@ -28,6 +28,8 @@
 #include "language.h"
 #include "ParagraphParameters.h"
 #include "undo_funcs.h"
+#include "WordLangTuple.h"
+#include "funcrequest.h"
 
 #include "insets/insetbib.h"
 #include "insets/insettext.h"
@@ -1805,7 +1807,7 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout)
 
        insertParagraph(bview, cursor.par()->next(), cursor.row());
 
-       updateCounters(bview, cursor.row()->previous());
+       updateCounters(bview);
 
        // This check is necessary. Otherwise the new empty paragraph will
        // be deleted automatically. And it is more friendly for the user!
@@ -2393,8 +2395,8 @@ bool LyXText::selectWordWhenUnderCursor(BufferView * bview,
 
 // This function is only used by the spellchecker for NextWord().
 // It doesn't handle LYX_ACCENTs and probably never will.
-WordLangTuple LyXText::selectNextWordToSpellcheck(BufferView * bview,
-                                                float & value) const
+WordLangTuple const
+LyXText::selectNextWordToSpellcheck(BufferView * bview, float & value) const
 {
        if (the_locking_inset) {
                WordLangTuple word = the_locking_inset->selectNextWordToSpellcheck(bview, value);
@@ -2818,7 +2820,7 @@ void LyXText::backspace(BufferView * bview)
 
                        // This rebuilds the rows.
                        appendParagraph(bview, cursor.row());
-                       updateCounters(bview, cursor.row());
+                       updateCounters(bview);
 
                        // the row may have changed, block, hfills etc.
                        setCursor(bview, cursor.par(), cursor.pos(), false);
@@ -3129,26 +3131,22 @@ void LyXText::paintRowSelection(DrawRowParams & p)
                }
                return;
        } else if (startrow != row && endrow != row) {
-               int w = p.width;
-               int h = row->height();
                if (p.y > starty && p.y < endy) {
+                       int w = p.width;
+                       int h = row->height();
                        p.pain->fillRectangle(p.xo, p.yo, w, h, LColor::selection);
                }
                return;
        }
 
-       if (!((startrow != row && !is_rtl) || (endrow != row && is_rtl))) {
-               return;
-       }
-
-       float tmpx = p.x;
-
-       p.pain->fillRectangle(p.xo, p.yo, int(p.x), row->height(), LColor::selection);
+       if ((startrow != row && !is_rtl) || (endrow != row && is_rtl))
+               p.pain->fillRectangle(p.xo, p.yo, int(p.x), row->height(), LColor::selection);
 
        Buffer const * buffer = p.bv->buffer();
        Paragraph * par = row->par();
        pos_type main_body = beginningOfMainBody(buffer, par);
        pos_type const last = rowLastPrintable(row);
+       float tmpx = p.x;
 
        for (pos_type vpos = row->pos(); vpos <= last; ++vpos)  {
                pos_type pos = vis2log(vpos);
@@ -3186,12 +3184,12 @@ void LyXText::paintRowSelection(DrawRowParams & p)
                                int(tmpx - old_tmpx + 1),
                                row->height(), LColor::selection);
                }
+       }
 
-               if ((startrow != row && is_rtl) || (endrow != row && !is_rtl)) {
-                       p.pain->fillRectangle(p.xo + int(tmpx),
-                               p.yo, int(p.bv->workWidth() - tmpx),
-                               row->height(), LColor::selection);
-               }
+       if ((startrow != row && is_rtl) || (endrow != row && !is_rtl)) {
+               p.pain->fillRectangle(p.xo + int(tmpx),
+                                     p.yo, int(p.bv->workWidth() - tmpx),
+                                     row->height(), LColor::selection);
        }
 }
 
@@ -3950,3 +3948,49 @@ int LyXText::getDepth() const
 {
        return cursor.par()->getDepth();
 }
+
+
+Inset::RESULT LyXText::lfunAppendix(FuncRequest const & cmd)
+{
+       BufferView * bv = cmd.view();
+       // what is this good for?
+       if (!bv->available())
+               return Inset::UNDISPATCHED;
+
+       Paragraph * par = cursor.par();
+       bool start = !par->params().startOfAppendix();
+
+       // ensure that we have only one start_of_appendix in this document
+       Paragraph * tmp = ownerParagraph();
+       for (; tmp; tmp = tmp->next()) {
+               tmp->params().startOfAppendix(false);
+       }
+
+       par->params().startOfAppendix(start);
+
+       // we can set the refreshing parameters now
+       status(cmd.view(), LyXText::NEED_MORE_REFRESH);
+       refresh_y = 0;
+       refresh_row = 0; // not needed for full update
+       updateCounters(cmd.view());
+       setCursor(cmd.view(), cursor.par(), cursor.pos());
+       bv->update(this,
+                                BufferView::SELECT
+                                | BufferView::FITCUR
+                                | BufferView::CHANGE);
+       return Inset::DISPATCHED;
+}
+
+
+Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
+{
+       switch (cmd.action) {
+               case LFUN_APPENDIX:
+                       return lfunAppendix(cmd);
+
+               default:
+                       return Inset::UNDISPATCHED;
+       }
+       // shut up compiler
+       return Inset::UNDISPATCHED;
+}