From b0eb70e869128e30ab7e4538aa32a244fd4cea57 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 29 Oct 2003 10:47:21 +0000 Subject: [PATCH] dispatchresult -> DispatchResult git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7998 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 1 + src/ChangeLog | 35 +++++++++++++++------- src/Makefile.am | 1 + src/cursor.C | 1 + src/dispatchresult.h | 55 +++++++++++++++++++++++++++++++++++ src/insets/ChangeLog | 7 ++++- src/insets/insetbase.C | 7 +++-- src/insets/insetbase.h | 49 ++++--------------------------- src/insets/insetbibitem.C | 3 +- src/insets/insetbibitem.h | 2 +- src/insets/insetbibtex.C | 3 +- src/insets/insetbibtex.h | 2 +- src/insets/insetbox.C | 5 ++-- src/insets/insetbox.h | 2 +- src/insets/insetbranch.C | 3 +- src/insets/insetbranch.h | 2 +- src/insets/insetcite.C | 3 +- src/insets/insetcite.h | 4 +-- src/insets/insetcollapsable.C | 5 ++-- src/insets/insetcollapsable.h | 2 +- src/insets/insetcommand.C | 3 +- src/insets/insetcommand.h | 4 +-- src/insets/insetert.C | 5 ++-- src/insets/insetert.h | 2 +- src/insets/insetexternal.C | 5 ++-- src/insets/insetexternal.h | 2 +- src/insets/insetfloat.C | 3 +- src/insets/insetfloat.h | 2 +- src/insets/insetfloatlist.C | 3 +- src/insets/insetfloatlist.h | 2 +- src/insets/insetgraphics.C | 3 +- src/insets/insetgraphics.h | 2 +- src/insets/insetinclude.C | 3 +- src/insets/insetinclude.h | 2 +- src/insets/insetindex.C | 3 +- src/insets/insetindex.h | 2 +- src/insets/insetlabel.C | 3 +- src/insets/insetlabel.h | 2 +- src/insets/insetlatexaccent.C | 6 ++-- src/insets/insetminipage.C | 3 +- src/insets/insetminipage.h | 2 +- src/insets/insetnote.C | 3 +- src/insets/insetnote.h | 2 +- src/insets/insetref.C | 6 ++-- src/insets/insetref.h | 2 +- src/insets/insettabular.C | 13 +++++---- src/insets/insettabular.h | 10 +++---- src/insets/insettext.C | 17 ++++++----- src/insets/insettext.h | 14 ++++----- src/insets/insettoc.C | 6 ++-- src/insets/insettoc.h | 2 +- src/insets/inseturl.C | 3 +- src/insets/inseturl.h | 2 +- src/insets/insetwrap.C | 3 +- src/insets/insetwrap.h | 2 +- src/insets/updatableinset.C | 3 +- src/insets/updatableinset.h | 2 +- src/lyxfunc.C | 11 +++---- src/lyxtext.h | 4 +-- src/mathed/ChangeLog | 18 +++++++++++- src/mathed/command_inset.C | 7 +++-- src/mathed/command_inset.h | 8 +++-- src/mathed/formulabase.C | 13 +++++---- src/mathed/formulabase.h | 8 ++--- src/mathed/math_cursor.C | 9 +++--- src/mathed/math_cursor.h | 7 ++--- src/mathed/math_gridinset.C | 3 +- src/mathed/math_gridinset.h | 9 +++--- src/mathed/math_hullinset.C | 3 +- src/mathed/math_hullinset.h | 7 +++-- src/mathed/math_nestinset.C | 6 ++-- src/mathed/math_nestinset.h | 11 ++++--- src/mathed/math_scriptinset.C | 6 ++-- src/mathed/math_scriptinset.h | 8 +++-- src/mathed/ref_inset.C | 6 ++-- src/mathed/ref_inset.h | 4 +-- src/text.C | 23 ++++++++------- src/text2.C | 5 ++-- src/text3.C | 3 +- 79 files changed, 314 insertions(+), 209 deletions(-) create mode 100644 src/dispatchresult.h diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index bb20bee8ec..ad600d96d1 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -25,6 +25,7 @@ #include "bufferparams.h" #include "cursor.h" #include "debug.h" +#include "dispatchresult.h" #include "factory.h" #include "FloatList.h" #include "funcrequest.h" diff --git a/src/ChangeLog b/src/ChangeLog index 9a35a386fd..9b685fa25a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,18 @@ +2003-10-29 Lars Gullik Bjønnes + + * text3.C: + * text2.C: + * text.C: + * lyxtext.h: + * lyxfunc.C: + * cursor.C: + * BufferView_pimpl.C: dispatch_result -> DispatchResult changes. + + * dispatchresult.h: new file, DispatchResult broken out of + insets/insetbase.h + + * Makefile.am (lyx_SOURCES): add dispatchresult.h + 2003-10-28 Alfredo Braunstein * text.C (rowBreakPoint): put a hack inside #if 0 @@ -50,13 +65,13 @@ 2003-10-27 Alfredo Braunstein - * text.C: - * lyxrow_funcs.[Ch]: - * Bidi.C: - * paragraph.C: - * lyxtext.h: - * rowpainter.C: - * text2.C: + * text.C: + * lyxrow_funcs.[Ch]: + * Bidi.C: + * paragraph.C: + * lyxtext.h: + * rowpainter.C: + * text2.C: * text3.C: remove lastPos uses in favour of Row::endpos 2003-10-27 Alfredo Braunstein @@ -67,9 +82,9 @@ 2003-10-25 Alfredo Braunstein - * text.C (prepareToPrint): fix linebreak rowbreaking as suggested + * text.C (prepareToPrint): fix linebreak rowbreaking as suggested by Martin - (rowBreakPoint): fix width. change point to point + 1. + (rowBreakPoint): fix width. change point to point + 1. Add a missing check. 2003-10-25 Martin Vermeer @@ -93,7 +108,7 @@ * text3.C (cursorPrevious, cursorNext): fix 2 "dontlikes" 2003-10-23 André Pönitz - + * RowList_fwd.h: change list<> to vector<> to gain speed after suggestion from Alfredo diff --git a/src/Makefile.am b/src/Makefile.am index 9bc3752b2b..bae5416a49 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -143,6 +143,7 @@ lyx_SOURCES = \ debug.h \ dimension.C \ dimension.h \ + dispatchresult.h \ encoding.C \ encoding.h \ errorlist.C \ diff --git a/src/cursor.C b/src/cursor.C index fb07ee137d..58313c2025 100644 --- a/src/cursor.C +++ b/src/cursor.C @@ -14,6 +14,7 @@ #include "BufferView.h" #include "cursor.h" #include "debug.h" +#include "dispatchresult.h" #include "iterators.h" #include "lyxtext.h" #include "paragraph.h" diff --git a/src/dispatchresult.h b/src/dispatchresult.h new file mode 100644 index 0000000000..be994a94cb --- /dev/null +++ b/src/dispatchresult.h @@ -0,0 +1,55 @@ +// -*- C++ -*- +/** + * \file dispatchresult.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author none + * \author Lars Gullik Bjønnes + * + * Full author contact details are available in file CREDITS. + */ + +#ifndef DISPATCH_RESULT_H +#define DISPATCH_RESULT_H + +/** Dispatch result codes + DISPATCHED = the inset catched the action + DISPATCHED_NOUPDATE = the inset catched the action and no update + is needed here to redraw the inset + FINISHED = the inset must be unlocked as a result + of the action + FINISHED_RIGHT = FINISHED, but put the cursor to the RIGHT of + the inset. + FINISHED_UP = FINISHED, but put the cursor UP of + the inset. + FINISHED_DOWN = FINISHED, but put the cursor DOWN of + the inset. + UNDISPATCHED = the action was not catched, it should be + dispatched by lower level insets +*/ +enum dispatch_result_t { + UNDISPATCHED = 0, + DISPATCHED, + DISPATCHED_NOUPDATE, + FINISHED, + FINISHED_RIGHT, + FINISHED_UP, + FINISHED_DOWN, + DISPATCHED_POP +}; + +/** \c DispatchResult is a wrapper for dispatch_result_t. + * It can be forward-declared and passed as a function argument without + * having to expose insetbase.h. + */ +class DispatchResult { + dispatch_result_t val_; +public: + DispatchResult() + : val_(UNDISPATCHED) {} + DispatchResult(dispatch_result_t val) : val_(val) {} + operator dispatch_result_t() const{ return val_; } +}; + +#endif // DISPATCH_RESULT_H diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 80b93a2825..f5f207748d 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2003-10-29 Lars Gullik Bjønnes + + * most insets: dispatch_result -> DispatchResult + + * insetbase.h: move DispatchResult out to dispatchresult.h 2003-10-27 André Pönitz @@ -68,7 +73,7 @@ * inset.h: * insetfloat.h: - * insetfootlike.h: re-introduce display() for insets, + * insetfootlike.h: re-introduce display() for insets, fixing the various bugs (stretch of line above, math inset positioning, ...) diff --git a/src/insets/insetbase.C b/src/insets/insetbase.C index 4c8a6022be..dc2098f47c 100644 --- a/src/insets/insetbase.C +++ b/src/insets/insetbase.C @@ -11,16 +11,17 @@ #include #include "insetbase.h" +#include "dispatchresult.h" -dispatch_result +DispatchResult InsetBase::dispatch(FuncRequest const & f, idx_type & i, pos_type & p) { return priv_dispatch(f, i, p); } -dispatch_result +DispatchResult InsetBase::dispatch(FuncRequest const & f) { idx_type i = 0; @@ -29,7 +30,7 @@ InsetBase::dispatch(FuncRequest const & f) } -dispatch_result +DispatchResult InsetBase::priv_dispatch(FuncRequest const &, idx_type &, pos_type &) { return UNDISPATCHED; diff --git a/src/insets/insetbase.h b/src/insets/insetbase.h index 587d1bdd17..179b43db3e 100644 --- a/src/insets/insetbase.h +++ b/src/insets/insetbase.h @@ -23,45 +23,7 @@ class MetricsInfo; class Dimension; class PainterInfo; class LaTeXFeatures; - -/** Dispatch result codes - DISPATCHED = the inset catched the action - DISPATCHED_NOUPDATE = the inset catched the action and no update - is needed here to redraw the inset - FINISHED = the inset must be unlocked as a result - of the action - FINISHED_RIGHT = FINISHED, but put the cursor to the RIGHT of - the inset. - FINISHED_UP = FINISHED, but put the cursor UP of - the inset. - FINISHED_DOWN = FINISHED, but put the cursor DOWN of - the inset. - UNDISPATCHED = the action was not catched, it should be - dispatched by lower level insets -*/ -enum dispatch_result { - UNDISPATCHED = 0, - DISPATCHED, - DISPATCHED_NOUPDATE, - FINISHED, - FINISHED_RIGHT, - FINISHED_UP, - FINISHED_DOWN, - DISPATCHED_POP -}; - -/** \c DispatchResult is a wrapper for dispatch_result. - * It can be forward-declared and passed as a function argument without - * having to expose insetbase.h. - */ -class DispatchResult { - dispatch_result val_; -public: - DispatchResult(dispatch_result val) : val_(val) {} - operator dispatch_result() const{ return val_; } -}; - - +class DispatchResult; /// Common base class to all insets class InsetBase { @@ -85,10 +47,10 @@ public: virtual std::auto_ptr clone() const = 0; // the real dispatcher - dispatch_result + DispatchResult dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos); // the real dispatcher - dispatch_result + DispatchResult dispatch(FuncRequest const & cmd); /// compute the size of the object returned in dim @@ -103,8 +65,9 @@ public: std::vector & /* list */) const {} protected: // the real dispatcher - virtual dispatch_result priv_dispatch - (FuncRequest const & cmd, idx_type & idx, pos_type & pos); + virtual + DispatchResult + priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos); }; #endif diff --git a/src/insets/insetbibitem.C b/src/insets/insetbibitem.C index 1eb749e3a8..807b722fc0 100644 --- a/src/insets/insetbibitem.C +++ b/src/insets/insetbibitem.C @@ -14,6 +14,7 @@ #include "buffer.h" #include "BufferView.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "lyxfont.h" #include "lyxlex.h" @@ -58,7 +59,7 @@ auto_ptr InsetBibitem::clone() const } -dispatch_result +DispatchResult InsetBibitem::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { diff --git a/src/insets/insetbibitem.h b/src/insets/insetbibitem.h index ae3c6649a3..c71e9e26cc 100644 --- a/src/insets/insetbibitem.h +++ b/src/insets/insetbibitem.h @@ -53,7 +53,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); private: /// diff --git a/src/insets/insetbibtex.C b/src/insets/insetbibtex.C index 4a7c043490..2b20f51069 100644 --- a/src/insets/insetbibtex.C +++ b/src/insets/insetbibtex.C @@ -14,6 +14,7 @@ #include "buffer.h" #include "bufferparams.h" +#include "dispatchresult.h" #include "debug.h" #include "funcrequest.h" #include "gettext.h" @@ -87,7 +88,7 @@ void InsetBibtex::draw(PainterInfo & pi, int x, int y) const } -dispatch_result +DispatchResult InsetBibtex::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { diff --git a/src/insets/insetbibtex.h b/src/insets/insetbibtex.h index fa0d63ceaa..2554b48fef 100644 --- a/src/insets/insetbibtex.h +++ b/src/insets/insetbibtex.h @@ -53,7 +53,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); }; diff --git a/src/insets/insetbox.C b/src/insets/insetbox.C index 9f867c502f..d8346b8c60 100644 --- a/src/insets/insetbox.C +++ b/src/insets/insetbox.C @@ -13,9 +13,10 @@ #include #include "insetbox.h" -#include "debug.h" #include "BufferView.h" +#include "dispatchresult.h" +#include "debug.h" #include "funcrequest.h" #include "gettext.h" #include "LaTeXFeatures.h" @@ -164,7 +165,7 @@ bool InsetBox::showInsetDialog(BufferView * bv) const } -dispatch_result +DispatchResult InsetBox::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { diff --git a/src/insets/insetbox.h b/src/insets/insetbox.h index 4fcb7b513b..c83606e575 100644 --- a/src/insets/insetbox.h +++ b/src/insets/insetbox.h @@ -102,7 +102,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const &, idx_type &, pos_type &); private: friend class InsetBoxParams; diff --git a/src/insets/insetbranch.C b/src/insets/insetbranch.C index 7b92208753..283b6d69d6 100644 --- a/src/insets/insetbranch.C +++ b/src/insets/insetbranch.C @@ -15,6 +15,7 @@ #include "buffer.h" #include "bufferparams.h" #include "BufferView.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "gettext.h" #include "LColor.h" @@ -116,7 +117,7 @@ bool InsetBranch::showInsetDialog(BufferView * bv) const } -dispatch_result +DispatchResult InsetBranch::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { diff --git a/src/insets/insetbranch.h b/src/insets/insetbranch.h index d05e2e6a91..15945de5de 100644 --- a/src/insets/insetbranch.h +++ b/src/insets/insetbranch.h @@ -73,7 +73,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const &, idx_type &, pos_type &); private: friend class InsetBranchParams; diff --git a/src/insets/insetcite.C b/src/insets/insetcite.C index 596f29ee31..05f06ee5ce 100644 --- a/src/insets/insetcite.C +++ b/src/insets/insetcite.C @@ -16,6 +16,7 @@ #include "buffer.h" #include "bufferparams.h" #include "BufferView.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "LaTeXFeatures.h" @@ -308,7 +309,7 @@ string const InsetCitation::getScreenLabel(Buffer const & buffer) const } -dispatch_result +DispatchResult InsetCitation::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { diff --git a/src/insets/insetcite.h b/src/insets/insetcite.h index 925b223db2..a4cda12ec8 100644 --- a/src/insets/insetcite.h +++ b/src/insets/insetcite.h @@ -40,13 +40,13 @@ public: int latex(Buffer const &, std::ostream &, LatexRunParams const &) const; /// - dispatch_result localDispatch(FuncRequest const & cmd); + DispatchResult localDispatch(FuncRequest const & cmd); /// void validate(LaTeXFeatures &) const; protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); private: struct Cache { diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index febaa9ceed..277b447aaa 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -17,6 +17,7 @@ #include "buffer.h" #include "BufferView.h" #include "debug.h" +#include "dispatchresult.h" #include "LColor.h" #include "lyxlex.h" #include "funcrequest.h" @@ -281,7 +282,7 @@ void InsetCollapsable::edit(BufferView * bv, int index) } -dispatch_result +DispatchResult InsetCollapsable::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { @@ -355,7 +356,7 @@ InsetCollapsable::priv_dispatch(FuncRequest const & cmd, return DISPATCHED; default: - dispatch_result result = inset.dispatch(cmd); + DispatchResult result = inset.dispatch(cmd); if (result >= FINISHED) bv->unlockInset(this); first_after_edit = false; diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index 7fef350720..a8e365ffbd 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -151,7 +151,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const &, idx_type &, pos_type &); /// void dimension_collapsed(Dimension &) const; diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index caa1c11ad2..c0257e0bcd 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -14,6 +14,7 @@ #include "insetcommand.h" #include "BufferView.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "lyxlex.h" #include "metricsinfo.h" @@ -84,7 +85,7 @@ int InsetCommand::docbook(Buffer const &, ostream &, bool) const } -dispatch_result +DispatchResult InsetCommand::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &) { switch (cmd.action) { diff --git a/src/insets/insetcommand.h b/src/insets/insetcommand.h index 8003f3119e..0e4b29e4e4 100644 --- a/src/insets/insetcommand.h +++ b/src/insets/insetcommand.h @@ -55,7 +55,7 @@ public: virtual int docbook(Buffer const &, std::ostream &, bool) const; /// InsetOld::Code lyxCode() const { return InsetOld::NO_CODE; } - + /// InsetCommandParams const & params() const { return p_; } /// @@ -70,7 +70,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); /// std::string const getCommand() const { return p_.getCommand(); } diff --git a/src/insets/insetert.C b/src/insets/insetert.C index 23722cf930..326f75c52e 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -16,6 +16,7 @@ #include "bufferparams.h" #include "BufferView.h" #include "debug.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "gettext.h" #include "language.h" @@ -421,11 +422,11 @@ int InsetERT::docbook(Buffer const &, ostream & os, bool) const } -dispatch_result +DispatchResult InsetERT::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { - dispatch_result result = UNDISPATCHED; + DispatchResult result = UNDISPATCHED; BufferView * bv = cmd.view(); if (inset.paragraphs.begin()->empty()) { diff --git a/src/insets/insetert.h b/src/insets/insetert.h index c886156c69..86c9694e5f 100644 --- a/src/insets/insetert.h +++ b/src/insets/insetert.h @@ -111,7 +111,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const &, idx_type &, pos_type &); private: /// diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index c07713af02..cb8360d19c 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -20,6 +20,7 @@ #include "buffer.h" #include "BufferView.h" #include "debug.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "gettext.h" #include "LaTeXFeatures.h" @@ -120,7 +121,7 @@ Translator const initTranslator() } // namespace anon -Translator const & displayTranslator() +Translator const & displayTranslator() { static Translator const translator = initTranslator(); @@ -426,7 +427,7 @@ void InsetExternal::statusChanged() const } -dispatch_result +DispatchResult InsetExternal::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &) { switch (cmd.action) { diff --git a/src/insets/insetexternal.h b/src/insets/insetexternal.h index 6dbbddf1ad..cf5300ee78 100644 --- a/src/insets/insetexternal.h +++ b/src/insets/insetexternal.h @@ -142,7 +142,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); private: /** This method is connected to the graphics loader, so we are diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index 8f93e35d9a..6dab6802fb 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -17,6 +17,7 @@ #include "bufferparams.h" #include "BufferView.h" #include "debug.h" +#include "dispatchresult.h" #include "Floating.h" #include "FloatList.h" #include "funcrequest.h" @@ -159,7 +160,7 @@ InsetFloat::~InsetFloat() } -dispatch_result +DispatchResult InsetFloat::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { diff --git a/src/insets/insetfloat.h b/src/insets/insetfloat.h index 5416845ac2..8691c61af5 100644 --- a/src/insets/insetfloat.h +++ b/src/insets/insetfloat.h @@ -79,7 +79,7 @@ public: InsetFloatParams const & params() const { return params_; } protected: virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); private: /// diff --git a/src/insets/insetfloatlist.C b/src/insets/insetfloatlist.C index 3926935e89..cc373a97c7 100644 --- a/src/insets/insetfloatlist.C +++ b/src/insets/insetfloatlist.C @@ -15,6 +15,7 @@ #include "buffer.h" #include "bufferparams.h" #include "debug.h" +#include "dispatchresult.h" #include "Floating.h" #include "FloatList.h" #include "funcrequest.h" @@ -118,7 +119,7 @@ void InsetFloatList::draw(PainterInfo & pi, int x, int y) const } -dispatch_result +DispatchResult InsetFloatList::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { diff --git a/src/insets/insetfloatlist.h b/src/insets/insetfloatlist.h index 6d77f159f1..387ae14d9f 100644 --- a/src/insets/insetfloatlist.h +++ b/src/insets/insetfloatlist.h @@ -59,7 +59,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); }; diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 754f6a6116..24369697fa 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -59,6 +59,7 @@ TODO #include "BufferView.h" #include "converter.h" #include "debug.h" +#include "dispatchresult.h" #include "format.h" #include "funcrequest.h" #include "gettext.h" @@ -190,7 +191,7 @@ void InsetGraphics::statusChanged() const } -dispatch_result +DispatchResult InsetGraphics::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &) { switch (cmd.action) { diff --git a/src/insets/insetgraphics.h b/src/insets/insetgraphics.h index 79e37b2610..4284291c27 100644 --- a/src/insets/insetgraphics.h +++ b/src/insets/insetgraphics.h @@ -77,7 +77,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); private: /// diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 80405c0e26..93485d1c7f 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -18,6 +18,7 @@ #include "bufferparams.h" #include "BufferView.h" #include "debug.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "gettext.h" #include "LaTeXFeatures.h" @@ -107,7 +108,7 @@ InsetInclude::~InsetInclude() } -dispatch_result +DispatchResult InsetInclude::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &) { switch (cmd.action) { diff --git a/src/insets/insetinclude.h b/src/insets/insetinclude.h index 5064e03c02..675811c766 100644 --- a/src/insets/insetinclude.h +++ b/src/insets/insetinclude.h @@ -80,7 +80,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); private: /// Slot receiving a signal that the preview is ready to display. diff --git a/src/insets/insetindex.C b/src/insets/insetindex.C index fa99b04310..0997af1714 100644 --- a/src/insets/insetindex.C +++ b/src/insets/insetindex.C @@ -11,6 +11,7 @@ #include "insetindex.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "gettext.h" #include "LaTeXFeatures.h" @@ -60,7 +61,7 @@ void InsetPrintIndex::draw(PainterInfo & pi, int x, int y) const } -dispatch_result +DispatchResult InsetIndex::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { diff --git a/src/insets/insetindex.h b/src/insets/insetindex.h index 5e5d607b81..d30319586a 100644 --- a/src/insets/insetindex.h +++ b/src/insets/insetindex.h @@ -40,7 +40,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); }; diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index 3e9ca9ad8f..45c81e52b7 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -13,6 +13,7 @@ #include "insetlabel.h" #include "BufferView.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "frontends/LyXView.h" @@ -56,7 +57,7 @@ string const InsetLabel::getScreenLabel(Buffer const &) const } -dispatch_result +DispatchResult InsetLabel::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { diff --git a/src/insets/insetlabel.h b/src/insets/insetlabel.h index 76ce67df84..fb7fc1f3a1 100644 --- a/src/insets/insetlabel.h +++ b/src/insets/insetlabel.h @@ -42,7 +42,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); }; diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index 6f46127c85..31ec370350 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -444,8 +444,8 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const case ACUTE: drawAccent(pi, x2, baseline, char(0xB4)); break; - - case GRAVE: + + case GRAVE: drawAccent(pi, x2, baseline, char(0x60)); break; @@ -477,7 +477,7 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const drawAccent(pi, x2, baseline, '.'); break; - case CIRCLE: + case CIRCLE: drawAccent(pi, x2, baseline, char(0xB0)); break; diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index 7c19ef39c3..545d27274c 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -15,6 +15,7 @@ #include "BufferView.h" #include "debug.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "gettext.h" #include "LColor.h" @@ -95,7 +96,7 @@ InsetMinipage::~InsetMinipage() } -dispatch_result +DispatchResult InsetMinipage::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { diff --git a/src/insets/insetminipage.h b/src/insets/insetminipage.h index b6a355b12b..cdfaaa1f88 100644 --- a/src/insets/insetminipage.h +++ b/src/insets/insetminipage.h @@ -91,7 +91,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); private: /// diff --git a/src/insets/insetnote.C b/src/insets/insetnote.C index 98b855b1da..8a37b8c726 100644 --- a/src/insets/insetnote.C +++ b/src/insets/insetnote.C @@ -15,6 +15,7 @@ #include "insetnote.h" #include "BufferView.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "gettext.h" #include "LaTeXFeatures.h" @@ -129,7 +130,7 @@ bool InsetNote::showInsetDialog(BufferView * bv) const } -dispatch_result +DispatchResult InsetNote::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { diff --git a/src/insets/insetnote.h b/src/insets/insetnote.h index ec77573929..9b21f8c8d7 100644 --- a/src/insets/insetnote.h +++ b/src/insets/insetnote.h @@ -71,7 +71,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const &, idx_type &, pos_type &); private: friend class InsetNoteParams; diff --git a/src/insets/insetref.C b/src/insets/insetref.C index 959f3e903c..024d79efb0 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -13,6 +13,7 @@ #include "buffer.h" #include "BufferView.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "gettext.h" #include "LaTeXFeatures.h" @@ -45,8 +46,9 @@ InsetRef::~InsetRef() } -dispatch_result -InsetRef::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) +DispatchResult +InsetRef::priv_dispatch(FuncRequest const & cmd, + idx_type & idx, pos_type & pos) { switch (cmd.action) { case LFUN_INSET_EDIT: diff --git a/src/insets/insetref.h b/src/insets/insetref.h index 95a506939c..ff01a16c09 100644 --- a/src/insets/insetref.h +++ b/src/insets/insetref.h @@ -67,7 +67,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); private: /// diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 477bb3d4d9..0a390dc5e2 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -16,6 +16,7 @@ #include "bufferparams.h" #include "BufferView.h" #include "debug.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "FuncStatus.h" #include "gettext.h" @@ -660,14 +661,14 @@ void InsetTabular::edit(BufferView * bv, int index) } -dispatch_result +DispatchResult InsetTabular::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { // We need to save the value of the_locking_inset as the call to // the_locking_inset->localDispatch might unlock it. old_locking_inset = the_locking_inset; - dispatch_result result = UpdatableInset::priv_dispatch(cmd, idx, pos); + DispatchResult result = UpdatableInset::priv_dispatch(cmd, idx, pos); BufferView * bv = cmd.view(); if (cmd.action == LFUN_INSET_EDIT) { @@ -1394,7 +1395,7 @@ void InsetTabular::resetPos(BufferView * bv) const } -dispatch_result InsetTabular::moveRight(BufferView * bv, bool lock) +DispatchResult InsetTabular::moveRight(BufferView * bv, bool lock) { if (lock && !old_locking_inset) { if (activateCellInset(bv)) @@ -1412,7 +1413,7 @@ dispatch_result InsetTabular::moveRight(BufferView * bv, bool lock) } -dispatch_result InsetTabular::moveLeft(BufferView * bv, bool lock) +DispatchResult InsetTabular::moveLeft(BufferView * bv, bool lock) { bool moved = isRightToLeft(bv) ? moveNextCell(bv) : movePrevCell(bv); if (!moved) @@ -1425,7 +1426,7 @@ dispatch_result InsetTabular::moveLeft(BufferView * bv, bool lock) } -dispatch_result InsetTabular::moveUp(BufferView * bv, bool lock) +DispatchResult InsetTabular::moveUp(BufferView * bv, bool lock) { int const ocell = actcell; actcell = tabular.getCellAbove(actcell); @@ -1446,7 +1447,7 @@ dispatch_result InsetTabular::moveUp(BufferView * bv, bool lock) } -dispatch_result InsetTabular::moveDown(BufferView * bv, bool lock) +DispatchResult InsetTabular::moveDown(BufferView * bv, bool lock) { int const ocell = actcell; actcell = tabular.getCellBelow(actcell); diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index 33c4a9d6b8..41eda0b58a 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -207,7 +207,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const &, idx_type &, pos_type &); private: /// lock cell with given index @@ -235,13 +235,13 @@ private: /// void setPos(BufferView *, int x, int y) const; /// - dispatch_result moveRight(BufferView *, bool lock = true); + DispatchResult moveRight(BufferView *, bool lock = true); /// - dispatch_result moveLeft(BufferView *, bool lock = true); + DispatchResult moveLeft(BufferView *, bool lock = true); /// - dispatch_result moveUp(BufferView *, bool lock = true); + DispatchResult moveUp(BufferView *, bool lock = true); /// - dispatch_result moveDown(BufferView *, bool lock = true); + DispatchResult moveDown(BufferView *, bool lock = true); /// bool moveNextCell(BufferView *, bool lock = false); /// diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 275114a6c3..4551ed3d38 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -18,6 +18,7 @@ #include "BufferView.h" #include "CutAndPaste.h" #include "debug.h" +#include "dispatchresult.h" #include "errorlist.h" #include "funcrequest.h" #include "gettext.h" @@ -587,7 +588,7 @@ void InsetText::lfunMouseMotion(FuncRequest const & cmd) } -dispatch_result +DispatchResult InsetText::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { @@ -669,7 +670,7 @@ InsetText::priv_dispatch(FuncRequest const & cmd, bool was_empty = paragraphs.begin()->empty() && paragraphs.size() == 1; no_selection = false; - dispatch_result result = UpdatableInset::priv_dispatch(cmd, idx, pos); + DispatchResult result = UpdatableInset::priv_dispatch(cmd, idx, pos); if (result != UNDISPATCHED) return DISPATCHED; @@ -1178,7 +1179,7 @@ void InsetText::fitInsetCursor(BufferView * bv) const } -dispatch_result InsetText::moveRight(BufferView * bv) +DispatchResult InsetText::moveRight(BufferView * bv) { if (text_.cursorPar()->isRightToLeftPar(bv->buffer()->params())) return moveLeftIntern(bv, false, true, false); @@ -1187,7 +1188,7 @@ dispatch_result InsetText::moveRight(BufferView * bv) } -dispatch_result InsetText::moveLeft(BufferView * bv) +DispatchResult InsetText::moveLeft(BufferView * bv) { if (text_.cursorPar()->isRightToLeftPar(bv->buffer()->params())) return moveRightIntern(bv, true, true, false); @@ -1196,7 +1197,7 @@ dispatch_result InsetText::moveLeft(BufferView * bv) } -dispatch_result +DispatchResult InsetText::moveRightIntern(BufferView * bv, bool front, bool activate_inset, bool selecting) { @@ -1213,7 +1214,7 @@ InsetText::moveRightIntern(BufferView * bv, bool front, } -dispatch_result +DispatchResult InsetText::moveLeftIntern(BufferView * bv, bool front, bool activate_inset, bool selecting) { @@ -1228,7 +1229,7 @@ InsetText::moveLeftIntern(BufferView * bv, bool front, } -dispatch_result InsetText::moveUp(BufferView * bv) +DispatchResult InsetText::moveUp(BufferView * bv) { if (crow() == text_.firstRow()) return FINISHED_UP; @@ -1238,7 +1239,7 @@ dispatch_result InsetText::moveUp(BufferView * bv) } -dispatch_result InsetText::moveDown(BufferView * bv) +DispatchResult InsetText::moveDown(BufferView * bv) { if (crow() == text_.lastRow()) return FINISHED_DOWN; diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 578ccdacd5..2ac839309d 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -202,7 +202,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const &, idx_type &, pos_type &); /// void updateLocal(BufferView *, bool mark_dirty); @@ -222,22 +222,22 @@ private: void lfunMouseMotion(FuncRequest const &); /// - dispatch_result moveRight(BufferView *); + DispatchResult moveRight(BufferView *); /// - dispatch_result moveLeft(BufferView *); + DispatchResult moveLeft(BufferView *); /// - dispatch_result moveRightIntern(BufferView *, bool front, + DispatchResult moveRightIntern(BufferView *, bool front, bool activate_inset = true, bool selecting = false); /// - dispatch_result moveLeftIntern(BufferView *, bool front, + DispatchResult moveLeftIntern(BufferView *, bool front, bool activate_inset = true, bool selecting = false); /// - dispatch_result moveUp(BufferView *); + DispatchResult moveUp(BufferView *); /// - dispatch_result moveDown(BufferView *); + DispatchResult moveDown(BufferView *); /// void setCharFont(Buffer const &, int pos, LyXFont const & font); /// diff --git a/src/insets/insettoc.C b/src/insets/insettoc.C index d9466b1fa1..99948c7419 100644 --- a/src/insets/insettoc.C +++ b/src/insets/insettoc.C @@ -12,6 +12,7 @@ #include "insettoc.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "gettext.h" #include "metricsinfo.h" @@ -73,8 +74,9 @@ void InsetTOC::draw(PainterInfo & pi, int x, int y) const } -dispatch_result -InsetTOC::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) +DispatchResult +InsetTOC::priv_dispatch(FuncRequest const & cmd, + idx_type & idx, pos_type & pos) { switch (cmd.action) { case LFUN_MOUSE_RELEASE: diff --git a/src/insets/insettoc.h b/src/insets/insettoc.h index 0bad336d45..d7159e269d 100644 --- a/src/insets/insettoc.h +++ b/src/insets/insettoc.h @@ -49,7 +49,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); }; diff --git a/src/insets/inseturl.C b/src/insets/inseturl.C index 13a25dd3fa..fa918fa99d 100644 --- a/src/insets/inseturl.C +++ b/src/insets/inseturl.C @@ -12,6 +12,7 @@ #include "inseturl.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "latexrunparams.h" #include "LaTeXFeatures.h" @@ -43,7 +44,7 @@ InsetUrl::~InsetUrl() } -dispatch_result +DispatchResult InsetUrl::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { diff --git a/src/insets/inseturl.h b/src/insets/inseturl.h index 716f7c4b21..408f8b35f1 100644 --- a/src/insets/inseturl.h +++ b/src/insets/inseturl.h @@ -52,7 +52,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); }; diff --git a/src/insets/insetwrap.C b/src/insets/insetwrap.C index b070bd80bb..bc457c459c 100644 --- a/src/insets/insetwrap.C +++ b/src/insets/insetwrap.C @@ -16,6 +16,7 @@ #include "bufferparams.h" #include "BufferView.h" #include "debug.h" +#include "dispatchresult.h" #include "Floating.h" #include "FloatList.h" #include "funcrequest.h" @@ -83,7 +84,7 @@ InsetWrap::~InsetWrap() } -dispatch_result +DispatchResult InsetWrap::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { diff --git a/src/insets/insetwrap.h b/src/insets/insetwrap.h index 94adbb1c20..633c4b97cc 100644 --- a/src/insets/insetwrap.h +++ b/src/insets/insetwrap.h @@ -71,7 +71,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); private: /// diff --git a/src/insets/updatableinset.C b/src/insets/updatableinset.C index 9ff4c08e0c..937dc5b107 100644 --- a/src/insets/updatableinset.C +++ b/src/insets/updatableinset.C @@ -17,6 +17,7 @@ #include "BufferView.h" #include "debug.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "lyxtext.h" #include "WordLangTuple.h" @@ -108,7 +109,7 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const /// An updatable inset could handle lyx editing commands -dispatch_result +DispatchResult UpdatableInset::priv_dispatch(FuncRequest const & ev, idx_type &, pos_type &) { if (ev.action == LFUN_MOUSE_RELEASE) diff --git a/src/insets/updatableinset.h b/src/insets/updatableinset.h index 608f7a24d4..d791ecfdaa 100644 --- a/src/insets/updatableinset.h +++ b/src/insets/updatableinset.h @@ -113,7 +113,7 @@ public: protected: /// An updatable inset could handle lyx editing commands virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &); /// scrolls to absolute position in bufferview-workwidth * sx units void scroll(BufferView *, float sx) const; diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 25350974e1..d6de7ed83b 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -29,6 +29,7 @@ #include "BufferView.h" #include "cursor.h" #include "debug.h" +#include "dispatchresult.h" #include "encoding.h" #include "exporter.h" #include "format.h" @@ -894,7 +895,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose) if (view()->available() && view()->theLockingInset()) { - dispatch_result result; + DispatchResult result; if (action > 1 || (action == LFUN_UNKNOWN_ACTION && !keyseq.deleted())) { @@ -1485,12 +1486,12 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose) break; } - case LFUN_DIALOG_SHOW_NEXT_INSET: + case LFUN_DIALOG_SHOW_NEXT_INSET: break; case LFUN_INSET_DIALOG_SHOW: { InsetOld * inset = view()->getLyXText()->getInset(); - if (inset) + if (inset) inset->dispatch(FuncRequest(view(), LFUN_INSET_DIALOG_SHOW)); break; } @@ -1556,7 +1557,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose) argument = split(argument, countstr, ' '); istringstream is(countstr); int count = 0; - is >> count; + is >> count; lyxerr << "repeat: count: " << count << " cmd: " << argument << endl; for (int i = 0; i < count; ++i) dispatch(lyxaction.lookupFunc(argument)); @@ -1631,7 +1632,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose) if (isStrInt(argument)) { pid_t const pid = strToInt(argument); ForkedcallsController & fcc = ForkedcallsController::get(); - fcc.kill(pid); + fcc.kill(pid); } break; diff --git a/src/lyxtext.h b/src/lyxtext.h index 3250ee0133..5ed7f5f72a 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -150,7 +150,7 @@ public: void metrics(MetricsInfo & mi, Dimension & dim); /// - dispatch_result dispatch(FuncRequest const & cmd); + DispatchResult dispatch(FuncRequest const & cmd); BufferView * bv(); @@ -409,7 +409,7 @@ private: /// FIXME int labelEnd(ParagraphList::iterator pit, Row const & row) const; - + /// void charInserted(); diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 5115db8168..3d13851000 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,19 @@ +2003-10-29 Lars Gullik Bjønnes + + * math_scriptinset.h: change dispatch to priv_dispatch and make it + protected + + * math_nestinset.h: make priv_dispatch protected + + * math_hullinset.h: make priv_dispatch protected + + * math_gridinset.h: make priv_dispatch protected + + * command_inset.[Ch]: change dispatch to priv_dispatch and make it + protected. + + * several files: dispatch_result -> DispatchResult + 2003-10-22 Angus Leeming * formula.C (generatePreview): changes due to the changed @@ -15,7 +31,7 @@ into this (localDispatch): delete - * math_nestinset.C (dispatch): + * math_nestinset.C (dispatch): * math_hullinset.C (dispatch): * math_gridinset.C (dispatch): * formulabase.C (openNewInset, priv_dispatch, mathDispatch): diff --git a/src/mathed/command_inset.C b/src/mathed/command_inset.C index 811f2d17c1..128ad21305 100644 --- a/src/mathed/command_inset.C +++ b/src/mathed/command_inset.C @@ -13,6 +13,7 @@ #include "command_inset.h" #include "math_data.h" #include "math_mathmlstream.h" +#include "dispatchresult.h" #include "funcrequest.h" #include "support/std_sstream.h" @@ -52,8 +53,10 @@ void CommandInset::draw(PainterInfo & pi, int x, int y) const button_.draw(pi, x, y); } -dispatch_result -CommandInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) + +DispatchResult +CommandInset::priv_dispatch(FuncRequest const & cmd, + idx_type & idx, pos_type & pos) { switch (cmd.action) { default: diff --git a/src/mathed/command_inset.h b/src/mathed/command_inset.h index 553adc165d..c9739b48e2 100644 --- a/src/mathed/command_inset.h +++ b/src/mathed/command_inset.h @@ -33,14 +33,16 @@ public: // // void infoize(std::ostream & os) const; /// - dispatch_result dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos); - /// virtual std::string const screenLabel() const; /// generate something that will be understood by the Dialogs. std::string const createDialogStr(std::string const & name) const; std::string const & commandname() const { return name_; } - +protected: + /// + virtual + DispatchResult + priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos); private: std::string name_; mutable bool set_label_; diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 495f412781..40c4d1111e 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -26,6 +26,7 @@ #include "BufferView.h" #include "bufferview_funcs.h" +#include "dispatchresult.h" #include "debug.h" #include "funcrequest.h" #include "gettext.h" @@ -211,7 +212,7 @@ void InsetFormulaBase::toggleInsetSelection(BufferView * bv) } -dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd) +DispatchResult InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd) { if (!mathcursor) return UNDISPATCHED; @@ -256,7 +257,7 @@ dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd) } -dispatch_result InsetFormulaBase::lfunMousePress(FuncRequest const & cmd) +DispatchResult InsetFormulaBase::lfunMousePress(FuncRequest const & cmd) { BufferView * bv = cmd.view(); //lyxerr << "lfunMousePress: buttons: " << cmd.button() << endl; @@ -288,7 +289,7 @@ dispatch_result InsetFormulaBase::lfunMousePress(FuncRequest const & cmd) } -dispatch_result InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd) +DispatchResult InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd) { if (!mathcursor) return DISPATCHED; @@ -316,7 +317,7 @@ dispatch_result InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd) } -dispatch_result +DispatchResult InsetFormulaBase::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &) { @@ -370,7 +371,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd, return UNDISPATCHED; string argument = cmd.argument; - dispatch_result result = DISPATCHED; + DispatchResult result = DISPATCHED; bool sel = false; bool was_macro = mathcursor->inMacroMode(); bool was_selection = mathcursor->selection(); @@ -494,7 +495,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd, // case LFUN_GETXY: // sprintf(dispatch_buffer, "%d %d",); - // dispatch_result = dispatch_buffer; + // DispatchResult= dispatch_buffer; // break; case LFUN_SETXY: { lyxerr << "LFUN_SETXY broken!" << endl; diff --git a/src/mathed/formulabase.h b/src/mathed/formulabase.h index 885ba98da1..56075c6b9c 100644 --- a/src/mathed/formulabase.h +++ b/src/mathed/formulabase.h @@ -84,7 +84,7 @@ public: protected: /// To allow transparent use of math editing functions virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const &, idx_type &, pos_type &); private: /// unimplemented @@ -92,11 +92,11 @@ private: /// common base for handling accents void handleAccent(BufferView * bv, std::string const & arg, std::string const & name); /// lfun handler - dispatch_result lfunMousePress(FuncRequest const &); + DispatchResult lfunMousePress(FuncRequest const &); /// - dispatch_result lfunMouseRelease(FuncRequest const &); + DispatchResult lfunMouseRelease(FuncRequest const &); /// - dispatch_result lfunMouseMotion(FuncRequest const &); + DispatchResult lfunMouseMotion(FuncRequest const &); protected: diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 2194fc4e36..1e4f7a7f0e 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -11,11 +11,12 @@ #include +#include "math_cursor.h" #include "lyxrc.h" #include "support/limited_stack.h" +#include "dispatchresult.h" #include "debug.h" #include "support/std_sstream.h" -#include "math_cursor.h" #include "formulabase.h" #include "funcrequest.h" #include "math_braceinset.h" @@ -1406,7 +1407,7 @@ CursorPos MathCursor::normalAnchor() const } -dispatch_result MathCursor::dispatch(FuncRequest const & cmd) +DispatchResult MathCursor::dispatch(FuncRequest const & cmd) { // mouse clicks are somewhat special // check @@ -1416,7 +1417,7 @@ dispatch_result MathCursor::dispatch(FuncRequest const & cmd) case LFUN_MOUSE_RELEASE: case LFUN_MOUSE_DOUBLE: { CursorPos & pos = Cursor_.back(); - dispatch_result res = UNDISPATCHED; + DispatchResult res = UNDISPATCHED; int x = 0, y = 0; getPos(x, y); if (x < cmd.x && hasPrevAtom()) { @@ -1436,7 +1437,7 @@ dispatch_result MathCursor::dispatch(FuncRequest const & cmd) for (int i = Cursor_.size() - 1; i >= 0; --i) { CursorPos & pos = Cursor_[i]; - dispatch_result res = pos.inset_->dispatch(cmd, pos.idx_, pos.pos_); + DispatchResult res = pos.inset_->dispatch(cmd, pos.idx_, pos.pos_); if (res != UNDISPATCHED) { if (res == DISPATCHED_POP) { Cursor_.shrink(i + 1); diff --git a/src/mathed/math_cursor.h b/src/mathed/math_cursor.h index b43e1268c6..c6a15a1ef4 100644 --- a/src/mathed/math_cursor.h +++ b/src/mathed/math_cursor.h @@ -217,9 +217,6 @@ public: CursorPos const & cursor() const; /// how deep are we nested? unsigned depth() const; - - /// local dispatcher - dispatch_result dispatch(FuncRequest const & cmd); /// describe the situation std::string info() const; /// dump selection information for debugging @@ -246,7 +243,9 @@ public: void pullArg(); /// split font inset etc void handleFont(std::string const & font); - + /// + DispatchResult + dispatch(FuncRequest const & cmd); private: /// moves cursor index one cell to the left bool idxLeft(); diff --git a/src/mathed/math_gridinset.C b/src/mathed/math_gridinset.C index 89135398fa..4636f6562a 100644 --- a/src/mathed/math_gridinset.C +++ b/src/mathed/math_gridinset.C @@ -14,6 +14,7 @@ #include "math_data.h" #include "math_mathmlstream.h" #include "math_streamstr.h" +#include "dispatchresult.h" #include "debug.h" #include "funcrequest.h" #include "LColor.h" @@ -1041,7 +1042,7 @@ void MathGridInset::splitCell(idx_type & idx, pos_type & pos) } -dispatch_result MathGridInset::priv_dispatch(FuncRequest const & cmd, +DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { switch (cmd.action) { diff --git a/src/mathed/math_gridinset.h b/src/mathed/math_gridinset.h index 1757d245b8..c60ed8108f 100644 --- a/src/mathed/math_gridinset.h +++ b/src/mathed/math_gridinset.h @@ -135,10 +135,6 @@ public: MathGridInset * asGridInset() { return this; } /// identifies GridInset MathGridInset const * asGridInset() const { return this; } - /// local dispatcher - dispatch_result priv_dispatch(FuncRequest const & cmd, - idx_type & idx, pos_type & pos); - /// col_type ncols() const; /// @@ -219,6 +215,11 @@ public: //void octave(OctaveStream &) const; protected: + /// + virtual + DispatchResult + priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos); + /// returns x offset of cell compared to inset int cellXOffset(idx_type idx) const; /// returns y offset of cell compared to inset diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C index 0a81fcf1a5..3bfaf6a9c6 100644 --- a/src/mathed/math_hullinset.C +++ b/src/mathed/math_hullinset.C @@ -18,6 +18,7 @@ #include "math_extern.h" #include "math_charinset.h" #include "textpainter.h" +#include "dispatchresult.h" #include "debug.h" #include "funcrequest.h" #include "gettext.h" @@ -771,7 +772,7 @@ void MathHullInset::doExtern } -dispatch_result MathHullInset::priv_dispatch +DispatchResult MathHullInset::priv_dispatch (FuncRequest const & cmd, idx_type & idx, pos_type & pos) { switch (cmd.action) { diff --git a/src/mathed/math_hullinset.h b/src/mathed/math_hullinset.h index 82256f7494..e568af0db6 100644 --- a/src/mathed/math_hullinset.h +++ b/src/mathed/math_hullinset.h @@ -50,9 +50,6 @@ public: bool display() const; /// bool ams() const; - /// local dispatcher - dispatch_result priv_dispatch(FuncRequest const & cmd, - idx_type & idx, pos_type & pos); /// Appends \c list with all labels found within this inset. void getLabelList(Buffer const &, std::vector & list) const; @@ -100,6 +97,10 @@ public: void infoize(std::ostream & os) const; protected: + /// + virtual + DispatchResult + priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos); /// std::string eolString(row_type row, bool fragile) const; diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index 3e4f3457bf..418e39345c 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -15,6 +15,7 @@ #include "math_mathmlstream.h" #include "math_parser.h" #include "BufferView.h" +#include "dispatchresult.h" #include "debug.h" #include "funcrequest.h" #include "LColor.h" @@ -285,8 +286,9 @@ void MathNestInset::notifyCursorLeaves(idx_type idx) } -dispatch_result MathNestInset::priv_dispatch(FuncRequest const & cmd, - idx_type & idx, pos_type & pos) +DispatchResult +MathNestInset::priv_dispatch(FuncRequest const & cmd, + idx_type & idx, pos_type & pos) { BufferView * bv = cmd.view(); diff --git a/src/mathed/math_nestinset.h b/src/mathed/math_nestinset.h index 4db158a2ba..2c4a6f14c7 100644 --- a/src/mathed/math_nestinset.h +++ b/src/mathed/math_nestinset.h @@ -101,12 +101,12 @@ public: void write(WriteStream & os) const; /// writes [, name(), and args in [] void normalize(NormalStream & os) const; - - /// local dispatcher - dispatch_result priv_dispatch(FuncRequest const & cmd, - idx_type & idx, pos_type & pos); - protected: + /// + virtual + DispatchResult + priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos); + /// we store the cells in a vector typedef std::vector cells_type; /// thusly: @@ -123,7 +123,6 @@ protected: void metricsMarkers(int frame = 1) const; /// add space for markers void metricsMarkers2(int frame = 1) const; - }; #endif diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index 524a2d5801..df73bf0ed4 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -15,6 +15,7 @@ #include "math_mathmlstream.h" #include "math_support.h" #include "math_symbolinset.h" +#include "dispatchresult.h" #include "debug.h" #include "funcrequest.h" @@ -511,8 +512,9 @@ void MathScriptInset::notifyCursorLeaves(idx_type idx) } -dispatch_result MathScriptInset::dispatch - (FuncRequest const & cmd, idx_type & idx, pos_type & pos) +DispatchResult +MathScriptInset::priv_dispatch(FuncRequest const & cmd, + idx_type & idx, pos_type & pos) { if (cmd.action == LFUN_MATH_LIMITS) { if (!cmd.argument.empty()) { diff --git a/src/mathed/math_scriptinset.h b/src/mathed/math_scriptinset.h index 408f9015bb..5253d0f660 100644 --- a/src/mathed/math_scriptinset.h +++ b/src/mathed/math_scriptinset.h @@ -95,9 +95,11 @@ public: void infoize(std::ostream & os) const; /// say whether we have displayed limits void infoize2(std::ostream & os) const; - /// local dispatcher - dispatch_result dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos); - +protected: + /// + virtual + DispatchResult + priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos); private: /// returns x offset for main part int dxx() const; diff --git a/src/mathed/ref_inset.C b/src/mathed/ref_inset.C index d762e5060f..163c5999ba 100644 --- a/src/mathed/ref_inset.C +++ b/src/mathed/ref_inset.C @@ -15,6 +15,7 @@ #include "math_factory.h" #include "BufferView.h" +#include "dispatchresult.h" #include "debug.h" #include "funcrequest.h" #include "math_support.h" @@ -52,8 +53,9 @@ void RefInset::infoize(std::ostream & os) const } -dispatch_result -RefInset::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) +DispatchResult +RefInset::priv_dispatch(FuncRequest const & cmd, + idx_type & idx, pos_type & pos) { switch (cmd.action) { case LFUN_INSET_MODIFY: diff --git a/src/mathed/ref_inset.h b/src/mathed/ref_inset.h index 3a5d327ba2..7d70b71744 100644 --- a/src/mathed/ref_inset.h +++ b/src/mathed/ref_inset.h @@ -43,7 +43,7 @@ public: int docbook(std::ostream & os, bool) const; /// small wrapper for the time being - dispatch_result localDispatch(FuncRequest const & cmd); + DispatchResult localDispatch(FuncRequest const & cmd); struct ref_type_info { /// @@ -61,7 +61,7 @@ public: protected: /// virtual - dispatch_result + DispatchResult priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos); }; diff --git a/src/text.C b/src/text.C index 1cdea810c8..05c612da29 100644 --- a/src/text.C +++ b/src/text.C @@ -22,6 +22,7 @@ #include "bufferparams.h" #include "BufferView.h" #include "debug.h" +#include "dispatchresult.h" #include "encoding.h" #include "funcrequest.h" #include "gettext.h" @@ -200,7 +201,7 @@ int LyXText::singleWidth(ParagraphList::iterator pit, return font_metrics::width(c, font); } - if (c == Paragraph::META_INSET) + if (c == Paragraph::META_INSET) return pit->getInset(pos)->width(); if (IsSeparatorChar(c)) @@ -409,7 +410,7 @@ namespace { pos_type addressBreakPoint(pos_type i, Paragraph const & par) { pos_type const end = par.size(); - + for (; i < end; ++i) if (par.isNewline(i)) return i + 1; @@ -428,7 +429,7 @@ void LyXText::rowBreakPoint(ParagraphList::iterator pit, Row & row) const row.endpos(end); return; } - + // maximum pixel width of a row. int width = workWidth() - rightMargin(*pit, *bv()->buffer()); // - leftMargin(pit, row); @@ -472,7 +473,7 @@ void LyXText::rowBreakPoint(ParagraphList::iterator pit, Row & row) const point = i + 1; break; } - // Break before... + // Break before... if (i + 1 < end) { InsetOld * in = pit->getInset(i + 1); if (in && in->display()) { @@ -488,12 +489,12 @@ void LyXText::rowBreakPoint(ParagraphList::iterator pit, Row & row) const } char const c = pit->getChar(i); - + if (i > endPosOfFontSpan) { font = getFont(pit, i); endPosOfFontSpan = pit->getEndPosOfFontSpan(i); } - + { int thiswidth = singleWidth(pit, i, c, font); @@ -512,7 +513,7 @@ void LyXText::rowBreakPoint(ParagraphList::iterator pit, Row & row) const //<< x << " width: " << width << endl; chunkwidth += thiswidth; } - + // break before a character that will fall off // the right of the row @@ -521,7 +522,7 @@ void LyXText::rowBreakPoint(ParagraphList::iterator pit, Row & row) const if (point == end || chunkwidth >= width - left) { if (i > pos) { point = i; - break; + break; } } // exit on last registered breakpoint: @@ -537,7 +538,7 @@ void LyXText::rowBreakPoint(ParagraphList::iterator pit, Row & row) const // some insets are line separators too if (pit->isLineSeparator(i)) { // register breakpoint: - point = i + 1; + point = i + 1; chunkwidth = 0; } } @@ -709,7 +710,7 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, Row & row) BufferParams const & bufparams = bv()->buffer()->params(); // some parksips VERY EASY IMPLEMENTATION if (bv()->buffer()->params().paragraph_separation - == BufferParams::PARSEP_SKIP + == BufferParams::PARSEP_SKIP && pit != ownerParagraphs().begin() && ((layout->isParagraph() && pit->getDepth() == 0) || (boost::prior(pit)->layout()->isParagraph() @@ -1106,7 +1107,7 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit, Row & row) const { align = LYX_ALIGN_CENTER; } - + switch (align) { case LYX_ALIGN_BLOCK: { int const ns = numberOfSeparators(*pit, row); diff --git a/src/text2.C b/src/text2.C index feca17135c..49c5bbcc49 100644 --- a/src/text2.C +++ b/src/text2.C @@ -29,6 +29,7 @@ #include "counters.h" #include "CutAndPaste.h" #include "debug.h" +#include "dispatchresult.h" #include "errorlist.h" #include "Floating.h" #include "FloatList.h" @@ -602,7 +603,7 @@ void LyXText::toggleFree(LyXFont const & font, bool toggleall) // If there is a change in the language the implicit word selection // is disabled. LyXCursor resetCursor = cursor; - bool implicitSelection = + bool implicitSelection = font.language() == ignore_language && font.number() == LyXFont::IGNORE && selectWordWhenUnderCursor(lyx::WHOLE_WORD_STRICT); @@ -1354,7 +1355,7 @@ float LyXText::getCursorX(ParagraphList::iterator pit, Row const & row, double fill_label_hfill = row.fill_label_hfill(); pos_type const row_pos = row.pos(); pos_type const end = row.endpos(); - + if (end <= row_pos) cursor_vpos = row_pos; else if (pos >= end && !boundary) diff --git a/src/text3.C b/src/text3.C index 62eaa28e74..de43850150 100644 --- a/src/text3.C +++ b/src/text3.C @@ -21,6 +21,7 @@ #include "bufferparams.h" #include "BufferView.h" #include "debug.h" +#include "dispatchresult.h" #include "factory.h" #include "funcrequest.h" #include "gettext.h" @@ -389,7 +390,7 @@ void doInsertInset(LyXText * lt, FuncRequest const & cmd, } // anon namespace -dispatch_result LyXText::dispatch(FuncRequest const & cmd) +DispatchResult LyXText::dispatch(FuncRequest const & cmd) { lyxerr[Debug::ACTION] << "LyXText::dispatch: action[" << cmd.action <<"] arg[" << cmd.argument << ']' << "xy[" << -- 2.39.2