fiix FIXMEs by moving message() from FuncRequest to the cursor

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8390 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2004-02-03 11:49:05 +00:00
parent 04296d3738
commit 14d27fe324
6 changed files with 40 additions and 50 deletions

View File

@ -1184,7 +1184,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
cur.clearSelection(); cur.clearSelection();
bv_->update(); bv_->update();
cur.resetAnchor(); cur.resetAnchor();
cmd.message(N_("Mark off")); cur.message(N_("Mark off"));
break; break;
case LFUN_MARK_ON: case LFUN_MARK_ON:
@ -1192,23 +1192,23 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
cur.mark() = true; cur.mark() = true;
bv_->update(); bv_->update();
cur.resetAnchor(); cur.resetAnchor();
cmd.message(N_("Mark on")); cur.message(N_("Mark on"));
break; break;
case LFUN_SETMARK: case LFUN_SETMARK:
cur.clearSelection(); cur.clearSelection();
if (cur.mark()) { if (cur.mark()) {
cmd.message(N_("Mark removed")); cur.message(N_("Mark removed"));
} else { } else {
cur.mark() = true; cur.mark() = true;
cmd.message(N_("Mark set")); cur.message(N_("Mark set"));
} }
cur.resetAnchor(); cur.resetAnchor();
bv_->update(); bv_->update();
break; break;
case LFUN_UNKNOWN_ACTION: case LFUN_UNKNOWN_ACTION:
cmd.errorMessage(N_("Unknown function!")); cur.errorMessage(N_("Unknown function!"));
break; break;
default: default:

View File

@ -20,9 +20,10 @@
#include "funcrequest.h" #include "funcrequest.h"
#include "iterators.h" #include "iterators.h"
#include "lfuns.h" #include "lfuns.h"
#include "lyxfunc.h" // only for setMessage()
#include "lyxrc.h" #include "lyxrc.h"
#include "lyxtext.h"
#include "lyxrow.h" #include "lyxrow.h"
#include "lyxtext.h"
#include "paragraph.h" #include "paragraph.h"
#include "insets/updatableinset.h" #include "insets/updatableinset.h"
@ -34,6 +35,7 @@
#include "mathed/math_support.h" #include "mathed/math_support.h"
#include "support/limited_stack.h" #include "support/limited_stack.h"
#include "frontends/LyXView.h"
#include <boost/assert.hpp> #include <boost/assert.hpp>
@ -574,9 +576,8 @@ void LCursor::info(std::ostream & os)
cursor_[i].inset()->infoize(os); cursor_[i].inset()->infoize(os);
os << " "; os << " ";
} }
#warning FIXME if (pos() != 0)
//if (pos() != 0) prevInset()->infoize2(os);
// prevAtom()->infoize2(os);
// overwite old message // overwite old message
os << " "; os << " ";
} }
@ -1831,3 +1832,14 @@ InsetBase * LCursor::prevInset()
return par.isInset(pos() - 1) ? par.getInset(pos() - 1) : 0; return par.isInset(pos() - 1) ? par.getInset(pos() - 1) : 0;
} }
void LCursor::message(string const & msg) const
{
bv().owner()->getLyXFunc().setMessage(msg);
}
void LCursor::errorMessage(string const & msg) const
{
bv().owner()->getLyXFunc().setErrorMessage(msg);
}

View File

@ -401,9 +401,14 @@ public:
void handleFont(std::string const & font); void handleFont(std::string const & font);
void releaseMathCursor(); void releaseMathCursor();
/// are we in mathed?
bool inMathed() const; bool inMathed() const;
/// display a message
void message(std::string const & msg) const;
/// display an error message
void errorMessage(std::string const & msg) const;
private: private:
/// moves cursor index one cell to the left /// moves cursor index one cell to the left
bool idxLeft(); bool idxLeft();

View File

@ -11,15 +11,12 @@
#include <config.h> #include <config.h>
#include "funcrequest.h" #include "funcrequest.h"
#include "BufferView.h"
#include "lyxfunc.h" // only for setMessage()
#include "frontends/LyXView.h"
#include "debug.h"
#include "support/std_sstream.h" #include "support/std_sstream.h"
#include <iostream> #include <iostream>
#include <vector>
using std::endl;
using std::getline; using std::getline;
using std::istringstream; using std::istringstream;
@ -59,26 +56,6 @@ mouse_button::state FuncRequest::button() const
} }
void FuncRequest::message(string const & msg) const
{
#warning FIXME
//if (view_)
// view_->owner()->getLyXFunc().setMessage(msg);
//else
lyxerr << "Dropping message '" << msg << "'" << endl;
}
void FuncRequest::errorMessage(string const & msg) const
{
#warning FIXME
//if (view_)
// view_->owner()->getLyXFunc().setErrorMessage(msg);
//else
lyxerr << "Dropping error message '" << msg << "'" << endl;
}
void split(vector<string> & args, string str) void split(vector<string> & args, string str)
{ {
istringstream is(str); istringstream is(str);

View File

@ -18,6 +18,7 @@
#include <string> #include <string>
#include <iosfwd> #include <iosfwd>
/** /**
* This class encapsulates a LyX action and its argument * This class encapsulates a LyX action and its argument
* in order to pass it around easily. * in order to pass it around easily.
@ -38,11 +39,6 @@ public:
/// access to button /// access to button
mouse_button::state button() const; mouse_button::state button() const;
/// output a message
void message(std::string const & msg) const;
/// output an error message
void errorMessage(std::string const & msg) const;
/// argument parsing, extract argument i as std::string /// argument parsing, extract argument i as std::string
std::string getArg(unsigned int i) const; std::string getArg(unsigned int i) const;

View File

@ -935,7 +935,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
break; break;
case LFUN_PASTE: case LFUN_PASTE:
cmd.message(_("Paste")); cur.message(_("Paste"));
replaceSelection(bv->getLyXText()); replaceSelection(bv->getLyXText());
#warning FIXME Check if the arg is in the domain of available selections. #warning FIXME Check if the arg is in the domain of available selections.
if (isStrUnsignedInt(cmd.argument)) if (isStrUnsignedInt(cmd.argument))
@ -950,13 +950,13 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
case LFUN_CUT: case LFUN_CUT:
cutSelection(true, true); cutSelection(true, true);
cmd.message(_("Cut")); cur.message(_("Cut"));
bv->update(); bv->update();
break; break;
case LFUN_COPY: case LFUN_COPY:
copySelection(); copySelection();
cmd.message(_("Copy")); cur.message(_("Copy"));
break; break;
case LFUN_BEGINNINGBUFSEL: case LFUN_BEGINNINGBUFSEL:
@ -978,7 +978,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
break; break;
case LFUN_GETXY: case LFUN_GETXY:
cmd.message(tostr(cursorX(cur.current())) + ' ' cur.message(tostr(cursorX(cur.current())) + ' '
+ tostr(cursorY(cur.current()))); + tostr(cursorY(cur.current())));
break; break;
@ -997,15 +997,15 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
case LFUN_GETFONT: case LFUN_GETFONT:
if (current_font.shape() == LyXFont::ITALIC_SHAPE) if (current_font.shape() == LyXFont::ITALIC_SHAPE)
cmd.message("E"); cur.message("E");
else if (current_font.shape() == LyXFont::SMALLCAPS_SHAPE) else if (current_font.shape() == LyXFont::SMALLCAPS_SHAPE)
cmd.message("N"); cur.message("N");
else else
cmd.message("0"); cur.message("0");
break; break;
case LFUN_GETLAYOUT: case LFUN_GETLAYOUT:
cmd.message(cursorPar()->layout()->name()); cur.message(cursorPar()->layout()->name());
break; break;
case LFUN_LAYOUT: { case LFUN_LAYOUT: {
@ -1018,7 +1018,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
// function list/array with information about what // function list/array with information about what
// functions needs arguments and their type. // functions needs arguments and their type.
if (cmd.argument.empty()) { if (cmd.argument.empty()) {
cmd.errorMessage(_("LyX function 'layout' needs an argument.")); cur.errorMessage(_("LyX function 'layout' needs an argument."));
break; break;
} }
@ -1036,7 +1036,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
} }
if (!hasLayout) { if (!hasLayout) {
cmd.errorMessage(string(N_("Layout ")) + cmd.argument + cur.errorMessage(string(N_("Layout ")) + cmd.argument +
N_(" not known")); N_(" not known"));
break; break;
} }