From e7335581258d098eafbf03c8a54578d82933f9e9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 20 Aug 2002 20:04:24 +0000 Subject: [PATCH] use boost::bind instead of home grown stuff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5044 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 13 +++++----- src/ChangeLog | 4 +++ src/bufferlist.C | 4 ++- src/support/ChangeLog | 7 ++++- src/support/lyxfunctional.h | 51 ------------------------------------- 5 files changed, 19 insertions(+), 60 deletions(-) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index b5b68341d3..5f9e57ab30 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -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. diff --git a/src/ChangeLog b/src/ChangeLog index 5a240d8929..20264a749b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2002-08-20 Lars Gullik Bjønnes + * 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 diff --git a/src/bufferlist.C b/src/bufferlist.C index d8226677a1..d6a1058233 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -41,6 +41,8 @@ #include "support/lyxfunctional.h" #include "support/LAssert.h" +#include + #include #include #include @@ -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)); } diff --git a/src/support/ChangeLog b/src/support/ChangeLog index bac8b9e771..d84882659c 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,8 +1,13 @@ +2002-08-20 Lars Gullik Bjønnes + + * lyxfunctional.h: remove class_fun_t, void_class_fun_t, + class_fun and void_class_fun + 2002-08-20 John Levon * Makefile.am: * fmt.C: remove - + 2002-08-14 Lars Gullik Bjønnes * textutils.h: formatting. diff --git a/src/support/lyxfunctional.h b/src/support/lyxfunctional.h index 0d129c6c63..c89e097621 100644 --- a/src/support/lyxfunctional.h +++ b/src/support/lyxfunctional.h @@ -14,57 +14,6 @@ namespace lyx { -template -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 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 vs; - for_each(vs.begin(), vs.end(), class_fun(int, vs, &A::print); - \endverbatim -**/ -template class_fun_t -class_fun(C & c, R(C::*f)(A)) -{ - return class_fun_t(c, f); -} - - -template void_class_fun_t -void_class_fun(C & c, void(C::*f)(A)) -{ - return void_class_fun_t(c, f); -} - - template class back_insert_fun_iterator { protected: -- 2.39.2