#include "math_extern.h"
#include "math_charinset.h"
#include "textpainter.h"
+#include "dispatchresult.h"
#include "debug.h"
#include "funcrequest.h"
#include "gettext.h"
using std::endl;
using std::max;
+using std::string;
using std::auto_ptr;
using std::istringstream;
using std::ostringstream;
{
if (type_ == "none")
return "lyxnochange";
- lyxerr << "standard font: mathnormal\n";
return "mathnormal";
}
}
+void MathHullInset::swapRow(row_type row)
+{
+ if (nrows() == 1)
+ return;
+ if (row + 1 == nrows())
+ --row;
+ std::swap(nonum_[row], nonum_[row + 1]);
+ std::swap(label_[row], label_[row + 1]);
+ MathGridInset::swapRow(row);
+}
+
+
void MathHullInset::delRow(row_type row)
{
if (nrows() <= 1)
void MathHullInset::mutate(string const & newtype)
{
- //lyxerr << "mutating from '" << type_ << "' to '" << newtype << "'" << endl;
+ lyxerr << "mutating from '" << type_ << "' to '" << newtype << "'" << endl;
// we try to move along the chain
// none <-> simple <-> equation <-> eqnarray
}
-dispatch_result MathHullInset::dispatch
+DispatchResult MathHullInset::priv_dispatch
(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
{
switch (cmd.action) {
mutate("eqnarray");
idx = 1;
pos = 0;
- return DISPATCHED_POP;
+ return DispatchResult(true, FINISHED);
}
- return MathGridInset::dispatch(cmd, idx, pos);
+ return MathGridInset::priv_dispatch(cmd, idx, pos);
case LFUN_MATH_NUMBER:
//lyxerr << "toggling all numbers" << endl;
numbered(row, !old);
//bv->owner()->message(old ? _("No number") : _("Number"));
}
- return DISPATCHED;
+ return DispatchResult(true, true);
case LFUN_MATH_NONUMBER:
if (display()) {
//bv->owner()->message(old ? _("No number") : _("Number"));
numbered(r, !old);
}
- return DISPATCHED;
+ return DispatchResult(true, true);
case LFUN_INSERT_LABEL: {
row_type r = (type_ == "multline") ? nrows() - 1 : row(idx);
? Alert::askForText(_("Enter new label to insert:"), default_label)
: Alert::askForText(_("Enter label:"), old_label);
if (!res.first)
- return UNDISPATCHED;
+ return DispatchResult(false);
new_label = trim(res.second);
}
if (!new_label.empty())
numbered(r, true);
label(r, new_label);
- return DISPATCHED;
+ return DispatchResult(true, true);
}
case LFUN_MATH_EXTERN:
doExtern(cmd, idx, pos);
- return DISPATCHED_POP;
+ return DispatchResult(true, FINISHED);
case LFUN_MATH_MUTATE: {
+ lyxerr << "Hull: MUTATE: " << cmd.argument << endl;
row_type r = row(idx);
col_type c = col(idx);
mutate(cmd.argument);
idx = nargs() - 1;
if (pos > cell(idx).size())
pos = cell(idx).size();
- return DISPATCHED_POP;
+ return DispatchResult(true, FINISHED);
}
case LFUN_MATH_DISPLAY: {
mutate(type_ == "simple" ? "equation" : "simple");
idx = 0;
pos = cell(idx).size();
- return DISPATCHED_POP;
+ return DispatchResult(true, FINISHED);
}
default:
- return MathGridInset::dispatch(cmd, idx, pos);
+ return MathGridInset::priv_dispatch(cmd, idx, pos);
}
}