#include "insets/render_preview.h"
#include "insets/insetlabel.h"
-#include "frontends/Dialogs.h"
-#include "frontends/LyXView.h"
-
#include "graphics/PreviewImage.h"
#include "graphics/PreviewLoader.h"
{
bool n = numberedType();
- if (type_ == hullNone)
- ;
+ switch(type_) {
+ case hullNone:
+ break;
- else if (type_ == hullSimple) {
+ case hullSimple:
os << '$';
if (cell(0).empty())
os << ' ';
- }
+ break;
- else if (type_ == hullEquation) {
+ case hullEquation:
if (n)
os << "\\begin{equation" << star(n) << "}\n";
else
os << "\\[\n";
- }
+ break;
- else if (type_ == hullEqnArray || type_ == hullAlign || type_ ==
-hullFlAlign
- || type_ == hullGather || type_ == hullMultline)
- os << "\\begin{" << type_ << star(n) << "}\n";
+ case hullEqnArray:
+ case hullAlign:
+ case hullFlAlign:
+ case hullGather:
+ case hullMultline:
+ os << "\\begin{" << hullName(type_) << star(n) << "}\n";
+ break;
- else if (type_ == hullAlignAt || type_ == hullXAlignAt)
- os << "\\begin{" << type_ << star(n) << '}'
+ case hullAlignAt:
+ case hullXAlignAt:
+ os << "\\begin{" << hullName(type_) << star(n) << '}'
<< '{' << static_cast<unsigned int>((ncols() + 1)/2) << "}\n";
+ break;
- else if (type_ == hullXXAlignAt)
- os << "\\begin{" << type_ << '}'
+ case hullXXAlignAt:
+ os << "\\begin{" << hullName(type_) << '}'
<< '{' << static_cast<unsigned int>((ncols() + 1)/2) << "}\n";
+ break;
- else
+ default:
os << "\\begin{unknown" << star(n) << '}';
+ break;
+ }
}
{
bool n = numberedType();
- if (type_ == hullNone)
+ switch(type_) {
+ case hullNone:
os << "\n";
+ break;
- else if (type_ == hullSimple)
+ case hullSimple:
os << '$';
+ break;
- else if (type_ == hullEquation)
+ case hullEquation:
if (n)
os << "\\end{equation" << star(n) << "}\n";
else
os << "\\]\n";
+ break;
- else if (type_ == hullEqnArray || type_ == hullAlign || type_ ==
-hullFlAlign
- || type_ == hullAlignAt || type_ == hullXAlignAt
- || type_ == hullGather || type_ == hullMultline)
- os << "\\end{" << type_ << star(n) << "}\n";
+ case hullEqnArray:
+ case hullAlign:
+ case hullFlAlign:
+ case hullAlignAt:
+ case hullXAlignAt:
+ case hullGather:
+ case hullMultline:
+ os << "\\end{" << hullName(type_) << star(n) << "}\n";
+ break;
- else if (type_ == hullXXAlignAt)
- os << "\\end{" << type_ << "}\n";
+ case hullXXAlignAt:
+ os << "\\end{" << hullName(type_) << "}\n";
+ break;
- else
+ default:
os << "\\end{unknown" << star(n) << '}';
+ break;
+ }
}
}
else {
- lyxerr << "mutation from '" << type_
- << "' to '" << newtype << "' not implemented" << endl;
+ lyxerr << "mutation from '" << hullName(type_)
+ << "' to '" << hullName(newtype)
+ << "' not implemented" << endl;
}
}
void InsetMathHull::normalize(NormalStream & os) const
{
- os << "[formula " << type_ << ' ';
+ os << "[formula " << hullName(type_) << ' ';
InsetMathGrid::normalize(os);
os << "] ";
}
void InsetMathHull::infoize(ostream & os) const
{
- os << "Type: " << type_;
+ os << "Type: " << hullName(type_);
}
string const data = InsetCommandMailer::params2string("label", p);
if (cmd.argument().empty())
- cur.bv().owner()->getDialogs().show("label", data, 0);
+ cur.bv().showInsetDialog("label", data, 0);
else {
FuncRequest fr(LFUN_INSET_INSERT, data);
dispatch(cur, fr);
}
break;
}
- MathArray ar;
- if (createInsetMath_fromDialogStr(lyx::to_utf8(cmd.argument()), ar)) {
- recordUndo(cur);
- cur.insert(ar);
- } else
- cur.undispatched();
- break;
+ InsetMathGrid::doDispatch(cur, cmd);
+ return;
}
case LFUN_MATH_EXTERN:
case LFUN_LABEL_INSERT:
status.enabled(type_ != hullSimple);
return true;
- case LFUN_INSET_INSERT: {
- // Don't test createInsetMath_fromDialogStr(), since
- // getStatus is not called with a valid reference and the
- // dialog would not be applyable.
- string const name = cmd.getArg(0);
- status.enabled(name == "ref" ||
- (name == "label" && type_ != hullSimple));
- break;
- }
+ case LFUN_INSET_INSERT:
+ if (cmd.getArg(0) == "label") {
+ status.enabled(type_ != hullSimple);
+ return true;
+ }
+ return InsetMathGrid::getStatus(cur, cmd, status);
case LFUN_TABULAR_FEATURE: {
istringstream is(lyx::to_utf8(cmd.argument()));
string s;
view_->getIntl()->getTransManager().TranslateAndInsert(*cit, lt);
// remove ourselves
- //view_->owner()->dispatch(LFUN_ESCAPE);
+ //theApp->lyxFunc().dispatch(LFUN_ESCAPE);
#endif
}