]> git.lyx.org Git - features.git/commitdiff
use boost::bind instead of home grown stuff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 20 Aug 2002 20:04:24 +0000 (20:04 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 20 Aug 2002 20:04:24 +0000 (20:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5044 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/ChangeLog
src/bufferlist.C
src/support/ChangeLog
src/support/lyxfunctional.h

index b5b68341d375429471ab8590aabb52c99909aab7..5f9e57ab30d1e5ecda068df7ec87c528af812b4f 100644 (file)
@@ -479,7 +479,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, mouse_button::state s
 
        // The test for not selection possible is needed, that only motion
        // events are used, where the bottom press event was on
-       //  the drawing area too 
+       //  the drawing area too
        if (!selection_possible)
                return;
 
@@ -554,7 +554,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
                // We are in inset locking mode
 
                // Check whether the inset was hit. If not reset mode,
-               // otherwise give the event to the inset 
+               // otherwise give the event to the inset
                if (inset_hit == bv_->theLockingInset()) {
                        FuncRequest cmd(bv_, LFUN_MOUSE_PRESS, xpos, ypos, button);
                        bv_->theLockingInset()->localDispatch(cmd);
@@ -643,7 +643,7 @@ void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, mouse_button::state bu
                } else {
                        text->selectWord(bv_, LyXText::WHOLE_WORD_STRICT);
                }
-               // This will fit the cursor on the screen if necessary 
+               // This will fit the cursor on the screen if necessary
                update(text, BufferView::SELECT|BufferView::FITCUR);
                workarea().haveSelection(bv_->getLyXText()->selection.set());
        }
@@ -672,7 +672,7 @@ void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, mouse_button::state bu
                if (text->bv_owner) {
                        screen().toggleSelection(text, bv_, false);
                }
-               // This will fit the cursor on the screen if necessary 
+               // This will fit the cursor on the screen if necessary
                update(text, BufferView::SELECT|BufferView::FITCUR);
                workarea().haveSelection(bv_->getLyXText()->selection.set());
        }
@@ -1367,7 +1367,6 @@ void BufferView::Pimpl::stuffClipboard(string const & stuff) const
  */
 
 
-inline
 void BufferView::Pimpl::moveCursorUpdate(bool selecting, bool fitcur)
 {
        LyXText * lt = bv_->getLyXText();
@@ -1419,7 +1418,7 @@ Inset * BufferView::Pimpl::getInsetByCode(Inset::Code code)
        Buffer::inset_iterator end = b->inset_iterator_end();
 
        bool cursor_par_seen = false;
-       
+
        for (; beg != end; ++beg) {
                if (beg.getPar() == cursor.par()) {
                        cursor_par_seen = true;
@@ -1432,7 +1431,7 @@ Inset * BufferView::Pimpl::getInsetByCode(Inset::Code code)
                                break;
                        }
                }
-               
+
        }
        if (beg != end) {
                // Now find the first inset that matches code.
index 5a240d89292150026c870731e587541cb59d3995..20264a749b77cc07471d7cc49f6c19792bc3cfa2 100644 (file)
@@ -1,5 +1,9 @@
 2002-08-20  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
+       * bufferlist.C (emergencyWriteAll): use boost bind
+
+       * BufferView_pimpl.C (moveCursorUpdate): remove inline
+
        * text.C: include paragraph_funcs.h
        (breakParagraph): breakParagraph is now in global scope
 
index d8226677a1876c084eed5b46f617db6455eef9fb..d6a1058233d4aad0f78778982ef724f68a689b21 100644 (file)
@@ -41,6 +41,8 @@
 #include "support/lyxfunctional.h"
 #include "support/LAssert.h"
 
+#include <boost/bind.hpp>
+
 #include <cassert>
 #include <algorithm>
 #include <functional>
@@ -289,7 +291,7 @@ void BufferList::updateIncludedTeXfiles(string const & mastertmpdir)
 void BufferList::emergencyWriteAll()
 {
        for_each(bstore.begin(), bstore.end(),
-                lyx::void_class_fun(*this, &BufferList::emergencyWrite));
+                boost::bind(&BufferList::emergencyWrite, this, _1));
 }
 
 
index bac8b9e771539ed9dbf34284c9e00228c38eed85..d84882659c1a8a3db364ccf108c3ddb56ba0370e 100644 (file)
@@ -1,8 +1,13 @@
+2002-08-20  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * lyxfunctional.h: remove class_fun_t, void_class_fun_t,
+       class_fun and void_class_fun
+
 2002-08-20  John Levon  <levon@movementarian.org>
 
        * Makefile.am:
        * fmt.C: remove
+
 2002-08-14  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * textutils.h: formatting.
index 0d129c6c63aea22be32fa614a9b9176f37724cb5..c89e097621e12b4de89d63bf2d9a41e755b79aff 100644 (file)
 
 namespace lyx {
 
-template<class R, class C, class A>
-class class_fun_t {
-public:
-       class_fun_t(C & ct, R(C::*p)(A))
-               : c(ct), cmf(p) {}
-       R operator()(A & a) const {
-               return (c.*cmf)(a);
-       }
-private:
-       C & c;
-       R(C::*cmf)(A);
-};
-
-
-template<class C, class A>
-class void_class_fun_t {
-public:
-       void_class_fun_t(C & ct, void(C::*p)(A))
-               : c(ct), cmf(p) {}
-       void operator()(A & a) const {
-               (c.*cmf)(a);
-       }
-private:
-       C & c;
-       void(C::*cmf)(A);
-};
-
-
-/// Use to call a class method with a container element.
-/** Most easily used as a functor to std::algoritms.
-    Small example:
-    \verbatim
-    A a; // class that have a int print(string const &) method
-    vector<string> vs;
-    for_each(vs.begin(), vs.end(), class_fun(int, vs, &A::print);
-    \endverbatim
-**/
-template <class R, class C, class A> class_fun_t<R, C, A>
-class_fun(C & c, R(C::*f)(A))
-{
-       return class_fun_t<R, C, A>(c, f);
-}
-
-
-template <class C, class A> void_class_fun_t<C, A>
-void_class_fun(C & c, void(C::*f)(A))
-{
-       return void_class_fun_t<C, A>(c, f);
-}
-
-
 template <class Cont, class Type, class MemRet>
 class back_insert_fun_iterator {
 protected: