Handle sending a FuncRequest object to lyxerr

* Implement the corresponding operator<<

  * Use it in a couple new places
This commit is contained in:
Jean-Marc Lasgouttes 2012-06-07 17:19:04 +02:00
parent 6db7ac6eb9
commit fb80ce20ca
5 changed files with 19 additions and 12 deletions

View File

@ -1204,14 +1204,7 @@ void BufferView::editInset(string const & name, Inset * inset)
void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
{
//lyxerr << [ cmd = " << cmd << "]" << endl;
// Make sure that the cached BufferView is correct.
LYXERR(Debug::ACTION, " action[" << cmd.action() << ']'
<< " arg[" << to_utf8(cmd.argument()) << ']'
<< " x[" << cmd.x() << ']'
<< " y[" << cmd.y() << ']'
<< " button[" << cmd.button() << ']');
LYXERR(Debug::ACTION, "BufferView::dispatch: cmd: " << cmd);
string const argument = to_utf8(cmd.argument());
Cursor & cur = d->cursor_;

View File

@ -13,6 +13,7 @@
#include "FuncRequest.h"
#include "LyXAction.h"
#include "support/debug.h"
#include "support/lstrings.h"
#include <climits>
@ -132,12 +133,19 @@ bool operator==(FuncRequest const & lhs, FuncRequest const & rhs)
ostream & operator<<(ostream & os, FuncRequest const & cmd)
{
return os
<< " action: " << cmd.action()
<< " [" << lyxaction.getActionName(cmd.action()) << "] "
<< " action: " << cmd.action()
<< " [" << lyxaction.getActionName(cmd.action()) << "] "
<< " arg: '" << to_utf8(cmd.argument()) << "'"
<< " x: " << cmd.x()
<< " y: " << cmd.y();
}
LyXErr & operator<<(LyXErr &l, FuncRequest const &fr)
{
ostringstream oss;
oss << fr;
return l << oss.str();
}
} // namespace lyx

View File

@ -21,6 +21,8 @@
namespace lyx {
class LyXErr;
/**
* This class encapsulates a LyX action and its argument
* in order to pass it around easily.
@ -108,6 +110,8 @@ bool operator==(FuncRequest const & lhs, FuncRequest const & rhs);
std::ostream & operator<<(std::ostream &, FuncRequest const &);
LyXErr & operator<<(LyXErr &, FuncRequest const &);
} // namespace lyx

View File

@ -261,8 +261,7 @@ Inset * InsetText::editXY(Cursor & cur, int x, int y)
void InsetText::doDispatch(Cursor & cur, FuncRequest & cmd)
{
LYXERR(Debug::ACTION, "InsetText::doDispatch()"
<< " [ cmd.action() = " << cmd.action() << ']');
LYXERR(Debug::ACTION, "InsetText::doDispatch(): cmd: " << cmd);
if (getLayout().isPassThru()) {
// Force any new text to latex_language FIXME: This

View File

@ -291,6 +291,9 @@ What's new
- Fixed compilation with clang.
- In debugging messages related to LyX actions, make sure that the
action and its arguments are correctly reported.
- Included the qt gif plugin in the Windows installer. This
enables the busy icon in the status bar.