]> git.lyx.org Git - lyx.git/commitdiff
remove toggleSelection
authorAndré Pönitz <poenitz@gmx.net>
Fri, 15 Aug 2003 10:24:39 +0000 (10:24 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 15 Aug 2003 10:24:39 +0000 (10:24 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7552 a592a061-630c-0410-9148-cb99ea01b6c8

14 files changed:
src/BufferView.C
src/BufferView.h
src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/ChangeLog
src/frontends/ChangeLog
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlErrorList.C
src/frontends/controllers/ControlSpellchecker.C
src/frontends/screen.C
src/frontends/screen.h
src/lyxfind.C
src/lyxtext.h
src/text3.C

index dfeefc02c52acc5434a7ae166947b1c34f92b2e8..6850a52d6a10a55771c8c3ef2a7523f9a0a0c6dd 100644 (file)
@@ -214,12 +214,6 @@ int BufferView::workWidth() const
 }
 
 
-void BufferView::toggleSelection(bool b)
-{
-       pimpl_->toggleSelection(b);
-}
-
-
 void BufferView::center()
 {
        pimpl_->center();
@@ -419,7 +413,6 @@ void BufferView::selectLastWord()
        beforeChange(text);
        text->selection.cursor = cur;
        text->selectSelectedWord();
-       toggleSelection(false);
        update();
 }
 
@@ -442,13 +435,7 @@ void BufferView::replaceWord(string const & replacestring)
 
        LyXText * tt = getLyXText();
 
-       // clear the selection (if there is any)
-       toggleSelection(false);
-
-       // clear the selection (if there is any)
-       toggleSelection(false);
        tt->replaceSelectionWithString(replacestring);
-
        tt->setSelectionRange(replacestring.length());
 
        // Go back so that replacement string is also spellchecked
index af356db3d2c0fa681ebf2a1ed84b7b6bed706d7d..6b3baae85a641b90584493ef9cfe1515974c5590 100644 (file)
@@ -155,8 +155,6 @@ public:
 
        /// FIXME
        bool fitLockedInsetCursor(int x, int y, int asc, int desc);
-       /// FIXME
-       void toggleSelection(bool = true);
 
        /// hide the cursor if it is visible
        void hideCursor();
index 74090137c678ae420aa4d2de0da7a2dcb640eb3b..6e1e8ba482722a49f627cd10dc43c154e568e8e1 100644 (file)
@@ -577,7 +577,6 @@ void BufferView::Pimpl::selectionLost()
 {
        if (available()) {
                screen().hideCursor();
-               toggleSelection();
                bv_->getLyXText()->clearSelection();
                bv_->text->xsel_cache.set(false);
        }
@@ -662,19 +661,18 @@ Change const BufferView::Pimpl::getCurrentChange()
        if (!bv_->buffer()->params.tracking_changes)
                return Change(Change::UNCHANGED);
 
-       LyXText * t(bv_->getLyXText());
+       LyXText * text = bv_->getLyXText();
 
-       if (!t->selection.set())
+       if (!text->selection.set())
                return Change(Change::UNCHANGED);
 
-       LyXCursor const & cur(t->selection.start);
+       LyXCursor const & cur = text->selection.start;
        return cur.par()->lookupChangeFull(cur.pos());
 }
 
 
 void BufferView::Pimpl::beforeChange(LyXText * text)
 {
-       toggleSelection();
        text->clearSelection();
 }
 
@@ -763,12 +761,6 @@ void BufferView::Pimpl::insetUnlock()
 }
 
 
-void BufferView::Pimpl::toggleSelection(bool b)
-{
-       screen().toggleSelection(bv_->text, bv_, b);
-}
-
-
 void BufferView::Pimpl::center()
 {
        LyXText * t = bv_->text;
index 1371bcd2f8382e4cecc99456720e8f30fa1679fe..552a954aa1a4d1a8077aaf5ac8bdf11f7c7cce58 100644 (file)
@@ -89,8 +89,6 @@ struct BufferView::Pimpl : public boost::signals::trackable {
        ///
        void insetUnlock();
        ///
-       void toggleSelection(bool = true);
-       ///
        void center();
        ///
        bool insertInset(InsetOld * inset, string const & lout = string());
index 496dffa9d93c82a874d9d946ddde18e5fd48cc0a..5ecc733f515acc0073198296755c703e80fe993c 100644 (file)
        * text_funcs.C: split LyXText::rowlist_ into individual
        Paragraph::rows_ chunks
 
+       * BufferView.[Ch]:
+       * BufferView_pimpl.[Ch]:
+       * lyxfind.C:
+       * lyxtext.h:
+       * text3.C: remove toggleSelection()
+
 2003-08-12  Michael Schmitt  <michael.schmitt@teststep.org>
 
        * bufferlist.C: beautify two alerts (shorter text of buttons)
index a62ca4de405deb82b40f4c3062e57e9a0cc3a291..020cb74acffbc57aa403251201dea73611270b23 100644 (file)
@@ -1,3 +1,8 @@
+
+2003-08-15  André Pönitz  <poenitz@gmx.net>
+
+       * screen.[Ch]: remove toggle selection
+
 2003-08-02  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
 
        * Makefile.am (SUBDIRS): use FRONTENDS_SUBDIRS
index a58c70605d8dfd88b2ded06b49321a785e164f68..08157861f47e2a3089e45d3cae8fd27bbdcd4d7a 100644 (file)
@@ -1,3 +1,9 @@
+
+2003-08-15  André Pönitz  <poenitz@gmx.net>
+
+       * ControlErrorList.C:
+       * ControlSpellchecker.C: remove toggleSelection
+
 2003-08-12  Michael Schmitt  <michael.schmitt@teststep.org>
 
        * ControlGraphics.C: rename "XXX baseline" to "Baseline XXX"
index 174a9974a88699085ea3ec67ffff6cc9824f3467..594cab8f7ad3ce90b0b471593fd39536e8b682cc 100644 (file)
@@ -75,11 +75,9 @@ void ControlErrorList::goTo(int item)
        // Now make the selection.
        BufferView * const bv = kernel().bufferview();
        bv->insetUnlock();
-       bv->toggleSelection();
        bv->text->clearSelection();
        bv->text->setCursor(pit.pit(), err.pos_start);
        bv->text->setSelectionRange(range);
-       bv->toggleSelection(false);
        bv->fitCursor();
        bv->update();
 }
index de9c7ff3e3ee6500b9a5dbaed86924b1b7772f42..95a9f6f1e87c19744ce83521bca70eac0b27ff53 100644 (file)
@@ -149,7 +149,6 @@ void ControlSpellchecker::check()
 
        // clear any old selection
        LyXText * text = bufferview()->getLyXText();
-       bufferview()->toggleSelection(true);
        bufferview()->update();
 
        while (res == SpellBase::OK || res == SpellBase::IGNORE) {
index 799c275c6e743852871e0377e585f8958c90ac83..33b3302b252823e16e384f9d89c86bba2e32e545 100644 (file)
@@ -297,38 +297,6 @@ bool LyXScreen::fitCursor(LyXText * text, BufferView * bv)
 }
 
 
-void LyXScreen::toggleSelection(LyXText * text, BufferView * bv,
-                               bool kill_selection,
-                               int yo, int xo)
-{
-       // only if there is a selection
-       if (!text->selection.set())
-               return;
-
-       int const bottom = min(
-               max(int(text->selection.end.y()
-                                    - text->getRow(text->selection.end)->baseline()
-                                    + text->getRow(text->selection.end)->height()),
-                   text->top_y()),
-               int(text->top_y() + workarea().workHeight()));
-       int const top = min(
-               max(int(text->selection.start.y() -
-                                    text->getRow(text->selection.start)->baseline()),
-                   text->top_y()),
-               int(text->top_y() + workarea().workHeight()));
-
-       if (kill_selection)
-               text->selection.set(false);
-
-       workarea().getPainter().start();
-
-       drawFromTo(text, bv, top - text->top_y(), bottom - text->top_y(), yo, xo);
-       expose(0, top - text->top_y(), workarea().workWidth(), bottom - top);
-
-       workarea().getPainter().end();
-}
-
-
 void LyXScreen::redraw(BufferView & bv)
 {
        greyed_out_ = !bv.text;
index f50001740217d829422904fcb415bd81061cfec9..434611a554497007aa33615a85b21418a5891878 100644 (file)
@@ -92,10 +92,6 @@ public:
        /// toggle the cursor's visibility
        void toggleCursor(BufferView & bv);
 
-       /// FIXME
-       virtual void toggleSelection(LyXText *, BufferView *, bool = true,
-                            int y_offset = 0, int x_offset = 0);
-
 protected:
        /// cause the display of the given area of the work area
        virtual void expose(int x, int y, int w, int h) = 0;
index 51367a245534b904507706a683d65d3011bf6241..afc50357e892dec4c9ee811468d2d25c3d59653d 100644 (file)
@@ -198,7 +198,6 @@ int replace(BufferView * bv,
                if (!bv->theLockingInset() ||
                        ((text != bv->text) &&
                         (text->inset_owner == text->inset_owner->getLockingInset()))) {
-                       bv->toggleSelection(false);
                        text->replaceSelectionWithString(replacestr);
                        text->setSelectionRange(replacestr.length());
                        ++replace_count;
@@ -247,7 +246,6 @@ bool find(BufferView * bv,
                text->cursor = forward ?
                        text->selection.end : text->selection.start;
 
-       bv->toggleSelection();
        text->clearSelection();
 
        SearchResult result = forward ?
@@ -261,7 +259,6 @@ bool find(BufferView * bv,
        if (result == SR_FOUND) {
                bv->unlockInset(bv->theLockingInset());
                text->setSelectionRange(searchstr.length());
-               bv->toggleSelection(false);
        } else if (result == SR_NOT_FOUND) {
                bv->unlockInset(bv->theLockingInset());
                found = false;
@@ -281,7 +278,6 @@ SearchResult find(BufferView * bv, LyXText * text,
                text->cursor = forward ?
                        text->selection.end : text->selection.start;
 
-       bv->toggleSelection();
        text->clearSelection();
 
        SearchResult result = forward ?
@@ -351,7 +347,6 @@ SearchResult findNextChange(BufferView * bv, LyXText * text, pos_type & length)
        if (text->selection.set())
                text->cursor = text->selection.end;
 
-       bv->toggleSelection();
        text->clearSelection();
 
        return nextChange(bv, text, length);
@@ -385,7 +380,6 @@ bool findNextChange(BufferView * bv)
        if (text->selection.set())
                text->cursor = text->selection.end;
 
-       bv->toggleSelection();
        text->clearSelection();
 
        SearchResult result = nextChange(bv, text, length);
@@ -398,7 +392,6 @@ bool findNextChange(BufferView * bv)
        if (result == SR_FOUND) {
                bv->unlockInset(bv->theLockingInset());
                text->setSelectionRange(length);
-               bv->toggleSelection(false);
        } else if (result == SR_NOT_FOUND) {
                bv->unlockInset(bv->theLockingInset());
                found = false;
index d393cc76fc6f078aa3127c8af999cb5b74dd1a42..59140c7f894b3c10d00879a40a559a9db0f0c2ac 100644 (file)
@@ -39,7 +39,10 @@ class Dimension;
 
 
 /**
-  This class holds the mapping between buffer paragraphs and screen rows.
+  This class used to hold the mapping between buffer paragraphs and
+       screen rows. Nowadays, the Paragraphs take care of their rows
+  themselves and this contains just most of the code for manipulating 
+  them and interaction with the Cursor. 
   */
 
 // The inheritance from TextCursor should go. It's just there to ease
index 1b3d0b1875aab8e56bb749a498cb086e7656cca0..ca471a16f724177dd19eb6181f578dc4bafb7e76 100644 (file)
@@ -1172,14 +1172,10 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                if (!isInInset() && bv->theLockingInset())
                        break;
                if (cmd.button() == mouse_button::button1) {
-                       if (!isInInset())
-                               bv->screen().toggleSelection(this, bv);
                        cursorHome();
                        selection.cursor = cursor;
                        cursorEnd();
                        setSelection();
-                       if (!isInInset())
-                               bv->screen().toggleSelection(this, bv, false);
                        bv->update();
                        bv->haveSelection(selection.set());
                }
@@ -1191,13 +1187,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                if (!isInInset() && bv->theLockingInset())
                        break;
                if (cmd.button() == mouse_button::button1) {
-                       if (!isInInset()) {
-                               bv->screen().toggleSelection(this, bv);
-                               selectWord(lyx::WHOLE_WORD_STRICT);
-                               bv->screen().toggleSelection(this, bv, false);
-                       } else {
-                               selectWord(lyx::WHOLE_WORD_STRICT);
-                       }
+                       selectWord(lyx::WHOLE_WORD_STRICT);
                        bv->update();
                        bv->haveSelection(selection.set());
                }
@@ -1314,7 +1304,6 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        selection_possible = true;
 
                // Clear the selection
-               bv->screen().toggleSelection(bv->text, bv);
                bv->text->clearSelection();
                bv->update();
                bv->updateScrollbar();