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

View File

@ -20,9 +20,10 @@
#include "funcrequest.h"
#include "iterators.h"
#include "lfuns.h"
#include "lyxfunc.h" // only for setMessage()
#include "lyxrc.h"
#include "lyxtext.h"
#include "lyxrow.h"
#include "lyxtext.h"
#include "paragraph.h"
#include "insets/updatableinset.h"
@ -34,6 +35,7 @@
#include "mathed/math_support.h"
#include "support/limited_stack.h"
#include "frontends/LyXView.h"
#include <boost/assert.hpp>
@ -574,9 +576,8 @@ void LCursor::info(std::ostream & os)
cursor_[i].inset()->infoize(os);
os << " ";
}
#warning FIXME
//if (pos() != 0)
// prevAtom()->infoize2(os);
if (pos() != 0)
prevInset()->infoize2(os);
// overwite old message
os << " ";
}
@ -1831,3 +1832,14 @@ InsetBase * LCursor::prevInset()
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 releaseMathCursor();
/// are we in mathed?
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:
/// moves cursor index one cell to the left
bool idxLeft();

View File

@ -11,15 +11,12 @@
#include <config.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 <iostream>
#include <vector>
using std::endl;
using std::getline;
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)
{
istringstream is(str);

View File

@ -18,6 +18,7 @@
#include <string>
#include <iosfwd>
/**
* This class encapsulates a LyX action and its argument
* in order to pass it around easily.
@ -38,11 +39,6 @@ public:
/// access to button
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
std::string getArg(unsigned int i) const;

View File

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