#include "insetnote.h"
#include "BufferView.h"
+#include "cursor.h"
#include "debug.h"
#include "dispatchresult.h"
#include "funcrequest.h"
#include "paragraph.h"
#include "support/lyxalgo.h"
-#include "support/std_sstream.h"
#include "support/translator.h"
+#include <sstream>
using std::string;
using std::auto_ptr;
}
-DispatchResult
-InsetNote::priv_dispatch(FuncRequest const & cmd,
- idx_type & idx, pos_type & pos)
+void InsetNote::priv_dispatch(LCursor & cur, FuncRequest & cmd)
{
- BufferView * bv = cmd.view();
-
switch (cmd.action) {
- case LFUN_INSET_MODIFY: {
+ case LFUN_INSET_MODIFY:
InsetNoteMailer::string2params(cmd.argument, params_);
setButtonLabel();
- bv->update();
- return DispatchResult(true, true);
- }
+ cur.bv().update();
+ break;
case LFUN_INSET_DIALOG_UPDATE:
- InsetNoteMailer(*this).updateDialog(bv);
- return DispatchResult(true, true);
+ InsetNoteMailer(*this).updateDialog(&cur.bv());
+ break;
case LFUN_MOUSE_RELEASE:
- if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
- InsetNoteMailer(*this).showDialog(bv);
- return DispatchResult(true, true);
- }
- // fallthrough:
+ if (cmd.button() == mouse_button::button3 && hitButton(cmd))
+ InsetNoteMailer(*this).showDialog(&cur.bv());
+ else
+ InsetCollapsable::priv_dispatch(cur, cmd);
+ break;
default:
- return InsetCollapsable::priv_dispatch(cmd, idx, pos);
+ InsetCollapsable::priv_dispatch(cur, cmd);
+ break;
}
}
ostringstream ss;
ss << "%\n\\begin{" << type << "}\n";
- inset.latex(buf, ss, runparams);
+ InsetText::latex(buf, ss, runparams);
ss << "%\n\\end{" << type << "}\n";
string const str = ss.str();
if (params_.type == InsetNoteParams::Comment)
ss << "<comment>\n";
- inset.linuxdoc(buf, ss, runparams);
+ InsetText::linuxdoc(buf, ss, runparams);
if (params_.type == InsetNoteParams::Comment)
ss << "\n</comment>\n";
if (params_.type == InsetNoteParams::Comment)
ss << "<remark>\n";
- inset.docbook(buf, ss, runparams);
+ InsetText::docbook(buf, ss, runparams);
if (params_.type == InsetNoteParams::Comment)
ss << "\n</remark>\n";
ostringstream ss;
ss << "[";
- inset.plaintext(buf, ss, runparams);
+ InsetText::plaintext(buf, ss, runparams);
ss << "]";
string const str = ss.str();
features.require("color");
features.require("lyxgreyedout");
}
- inset.validate(features);
+ InsetText::validate(features);
}
-string const InsetNoteMailer:: name_("note");
+string const InsetNoteMailer::name_("note");
InsetNoteMailer::InsetNoteMailer(InsetNote & inset)
: inset_(inset)