5 #include "math_gridinset.h"
6 #include "math_mathmlstream.h"
7 #include "math_streamstr.h"
9 #include "funcrequest.h"
10 #include "frontends/Painter.h"
20 void mathed_parse_normal(MathGridInset &, string const & argument);
24 string verboseHLine(int n)
27 for (int i = 0; i < n; ++i)
36 //////////////////////////////////////////////////////////////
39 MathGridInset::CellInfo::CellInfo()
46 //////////////////////////////////////////////////////////////
49 MathGridInset::RowInfo::RowInfo()
55 int MathGridInset::RowInfo::skipPixels() const
57 return crskip_.inBP();
62 //////////////////////////////////////////////////////////////
65 MathGridInset::ColInfo::ColInfo()
66 : align_('c'), leftline_(false), rightline_(false), lines_(0)
70 //////////////////////////////////////////////////////////////
73 MathGridInset::MathGridInset(char v, string const & h)
74 : MathNestInset(guessColumns(h)),
76 colinfo_(guessColumns(h) + 1),
77 cellinfo_(1 * guessColumns(h))
82 //lyxerr << "created grid with " << ncols() << " columns\n";
86 MathGridInset::MathGridInset()
97 MathGridInset::MathGridInset(col_type m, row_type n)
98 : MathNestInset(m * n),
108 MathGridInset::MathGridInset(col_type m, row_type n, char v, string const & h)
109 : MathNestInset(m * n),
121 MathInset * MathGridInset::clone() const
123 return new MathGridInset(*this);
127 MathInset::idx_type MathGridInset::index(row_type row, col_type col) const
129 return col + ncols() * row;
133 void MathGridInset::setDefaults()
136 lyxerr << "positive number of columns expected\n";
138 // lyxerr << "positive number of rows expected\n";
139 for (col_type col = 0; col < ncols(); ++col) {
140 colinfo_[col].align_ = defaultColAlign(col);
141 colinfo_[col].skip_ = defaultColSpace(col);
146 void MathGridInset::halign(string const & hh)
149 for (string::const_iterator it = hh.begin(); it != hh.end(); ++it) {
154 colinfo_[col].lines_++;
155 } else if (c == 'c' || c == 'l' || c == 'r') {
156 colinfo_[col].align_ = c;
158 colinfo_[col].lines_ = 0;
160 lyxerr << "unknown column separator: '" << c << "'\n";
165 col_type n = hh.size();
168 for (col_type col = 0; col < n; ++col)
169 colinfo_[col].align_ = hh[col];
174 MathGridInset::col_type MathGridInset::guessColumns(string const & hh) const
177 for (string::const_iterator it = hh.begin(); it != hh.end(); ++it)
178 if (*it == 'c' || *it == 'l' || *it == 'r')
180 // let's have at least one column, even if we did not recognize its
188 void MathGridInset::halign(char h, col_type col)
190 colinfo_[col].align_ = h;
194 char MathGridInset::halign(col_type col) const
196 return colinfo_[col].align_;
200 string MathGridInset::halign() const
203 for (col_type col = 0; col < ncols(); ++col) {
204 res += string(colinfo_[col].lines_, '|');
205 res += colinfo_[col].align_;
207 return res + string(colinfo_[ncols()].lines_, '|');
211 void MathGridInset::valign(char c)
217 char MathGridInset::valign() const
223 MathGridInset::col_type MathGridInset::ncols() const
225 return colinfo_.size() - 1;
229 MathGridInset::row_type MathGridInset::nrows() const
231 return rowinfo_.size() - 1;
235 MathGridInset::col_type MathGridInset::col(idx_type idx) const
237 return idx % ncols();
241 MathGridInset::row_type MathGridInset::row(idx_type idx) const
243 return idx / ncols();
247 void MathGridInset::vcrskip(LyXLength const & crskip, row_type row)
249 rowinfo_[row].crskip_ = crskip;
253 LyXLength MathGridInset::vcrskip(row_type row) const
255 return rowinfo_[row].crskip_;
259 void MathGridInset::metrics(MathMetricsInfo & mi) const
261 // let the cells adjust themselves
262 MathNestInset::metrics(mi);
264 // compute absolute sizes of vertical structure
265 for (row_type row = 0; row < nrows(); ++row) {
268 for (col_type col = 0; col < ncols(); ++col) {
269 MathArray const & c = cell(index(row, col));
270 asc = max(asc, c.ascent());
271 desc = max(desc, c.descent());
273 rowinfo_[row].ascent_ = asc;
274 rowinfo_[row].descent_ = desc;
276 rowinfo_[0].ascent_ += hlinesep() * rowinfo_[0].lines_;
277 rowinfo_[nrows()].ascent_ = 0;
278 rowinfo_[nrows()].descent_ = 0;
280 // compute vertical offsets
281 rowinfo_[0].offset_ = 0;
282 for (row_type row = 1; row <= nrows(); ++row) {
283 rowinfo_[row].offset_ =
284 rowinfo_[row - 1].offset_ +
285 rowinfo_[row - 1].descent_ +
286 rowinfo_[row - 1].skipPixels() +
288 rowinfo_[row].lines_ * hlinesep() +
289 rowinfo_[row].ascent_;
292 // adjust vertical offset
299 h = rowinfo_[nrows() - 1].offset_;
302 h = rowinfo_[nrows() - 1].offset_ / 2;
304 for (row_type row = 0; row <= nrows(); ++row)
305 rowinfo_[row].offset_ -= h;
308 // compute absolute sizes of horizontal structure
309 for (col_type col = 0; col < ncols(); ++col) {
311 for (row_type row = 0; row < nrows(); ++row)
312 wid = max(wid, cell(index(row, col)).width());
313 colinfo_[col].width_ = wid;
315 colinfo_[ncols()].width_ = 0;
317 // compute horizontal offsets
318 colinfo_[0].offset_ = border();
319 for (col_type col = 1; col <= ncols(); ++col) {
320 colinfo_[col].offset_ =
321 colinfo_[col - 1].offset_ +
322 colinfo_[col - 1].width_ +
323 colinfo_[col - 1].skip_ +
325 colinfo_[col].lines_ * vlinesep();
329 dim_.w = colinfo_[ncols() - 1].offset_
330 + colinfo_[ncols() - 1].width_
331 + vlinesep() * colinfo_[ncols()].lines_
334 dim_.a = - rowinfo_[0].offset_
335 + rowinfo_[0].ascent_
336 + hlinesep() * rowinfo_[0].lines_
339 dim_.d = rowinfo_[nrows() - 1].offset_
340 + rowinfo_[nrows() - 1].descent_
341 + hlinesep() * rowinfo_[nrows()].lines_
346 // Increase ws_[i] for 'R' columns (except the first one)
347 for (int i = 1; i < nc_; ++i)
348 if (align_[i] == 'R')
349 ws_[i] += 10 * df_width;
350 // Increase ws_[i] for 'C' column
351 if (align_[0] == 'C')
352 if (ws_[0] < 7 * workwidth / 8)
353 ws_[0] = 7 * workwidth / 8;
357 for (cxrow = row_.begin(); cxrow; ++cxrow) {
360 for (int i = 0; i < nc_; ++i) {
362 if (cxrow->getTab(i) <= 0) {
363 cxrow->setTab(i, df_width);
371 lf = (ws_[i] - cxrow->getTab(i))/2;
375 lf = ws_[i] - cxrow->getTab(i);
378 if (cxrow == row_.begin())
380 else if (cxrow.is_last())
381 lf = ws_[i] - cxrow->getTab(i);
383 lf = (ws_[i] - cxrow->getTab(i))/2;
386 int const ww = (isvoid) ? lf : lf + cxrow->getTab(i);
387 cxrow->setTab(i, lf + rg);
388 rg = ws_[i] - ww + colsep();
389 if (cxrow == row_.begin())
390 width += ws_[i] + colsep();
392 cxrow->setBaseline(cxrow->getBaseline() - ascent);
398 void MathGridInset::draw(MathPainterInfo & pi, int x, int y) const
400 for (idx_type idx = 0; idx < nargs(); ++idx)
401 cell(idx).draw(pi, x + cellXOffset(idx), y + cellYOffset(idx));
403 for (row_type row = 0; row <= nrows(); ++row)
404 for (int i = 0; i < rowinfo_[row].lines_; ++i) {
405 int yy = y + rowinfo_[row].offset_ - rowinfo_[row].ascent_
406 - i * hlinesep() - hlinesep()/2 - rowsep()/2;
407 pi.pain.line(x + 1, yy, x + width() - 1, yy);
410 for (col_type col = 0; col <= ncols(); ++col)
411 for (int i = 0; i < colinfo_[col].lines_; ++i) {
412 int xx = x + colinfo_[col].offset_
413 - i * vlinesep() - vlinesep()/2 - colsep()/2;
414 pi.pain.line(xx, y - ascent() + 1, xx, y + descent() - 1);
419 void MathGridInset::metricsT(TextMetricsInfo const & mi) const
421 // let the cells adjust themselves
422 //MathNestInset::metrics(mi);
423 for (idx_type i = 0; i < nargs(); ++i)
424 cell(i).metricsT(mi);
426 // compute absolute sizes of vertical structure
427 for (row_type row = 0; row < nrows(); ++row) {
430 for (col_type col = 0; col < ncols(); ++col) {
431 MathArray const & c = cell(index(row, col));
432 asc = max(asc, c.ascent());
433 desc = max(desc, c.descent());
435 rowinfo_[row].ascent_ = asc;
436 rowinfo_[row].descent_ = desc;
438 //rowinfo_[0].ascent_ += hlinesep() * rowinfo_[0].lines_;
439 rowinfo_[nrows()].ascent_ = 0;
440 rowinfo_[nrows()].descent_ = 0;
442 // compute vertical offsets
443 rowinfo_[0].offset_ = 0;
444 for (row_type row = 1; row <= nrows(); ++row) {
445 rowinfo_[row].offset_ =
446 rowinfo_[row - 1].offset_ +
447 rowinfo_[row - 1].descent_ +
448 //rowinfo_[row - 1].skipPixels() +
450 //rowinfo_[row].lines_ * hlinesep() +
451 rowinfo_[row].ascent_;
454 // adjust vertical offset
461 h = rowinfo_[nrows() - 1].offset_;
464 h = rowinfo_[nrows() - 1].offset_ / 2;
466 for (row_type row = 0; row <= nrows(); ++row)
467 rowinfo_[row].offset_ -= h;
470 // compute absolute sizes of horizontal structure
471 for (col_type col = 0; col < ncols(); ++col) {
473 for (row_type row = 0; row < nrows(); ++row)
474 wid = max(wid, cell(index(row, col)).width());
475 colinfo_[col].width_ = wid;
477 colinfo_[ncols()].width_ = 0;
479 // compute horizontal offsets
480 colinfo_[0].offset_ = border();
481 for (col_type col = 1; col <= ncols(); ++col) {
482 colinfo_[col].offset_ =
483 colinfo_[col - 1].offset_ +
484 colinfo_[col - 1].width_ +
485 colinfo_[col - 1].skip_ +
487 //colinfo_[col].lines_ * vlinesep();
491 dim_.w = colinfo_[ncols() - 1].offset_
492 + colinfo_[ncols() - 1].width_
493 //+ vlinesep() * colinfo_[ncols()].lines_
496 dim_.a = -rowinfo_[0].offset_
497 + rowinfo_[0].ascent_
498 //+ hlinesep() * rowinfo_[0].lines_
501 dim_.d = rowinfo_[nrows() - 1].offset_
502 + rowinfo_[nrows() - 1].descent_
503 //+ hlinesep() * rowinfo_[nrows()].lines_
509 void MathGridInset::drawT(TextPainter & pain, int x, int y) const
511 for (idx_type idx = 0; idx < nargs(); ++idx)
512 cell(idx).drawT(pain, x + cellXOffset(idx), y + cellYOffset(idx));
516 string MathGridInset::eolString(row_type row, bool fragile) const
520 if (!rowinfo_[row].crskip_.zero())
521 eol += "[" + rowinfo_[row].crskip_.asLatexString() + "]";
523 // make sure an upcoming '[' does not break anything
524 if (row + 1 < nrows()) {
525 MathArray const & c = cell(index(row + 1, 0));
526 if (c.size() && c.front()->getChar() == '[')
531 // only add \\ if necessary
532 if (eol.empty() && row + 1 == nrows())
535 return (fragile ? "\\protect\\\\" : "\\\\") + eol;
539 string MathGridInset::eocString(col_type col, col_type lastcol) const
541 if (col + 1 == lastcol)
547 void MathGridInset::addRow(row_type row)
549 rowinfo_.insert(rowinfo_.begin() + row + 1, RowInfo());
551 (cells_.begin() + (row + 1) * ncols(), ncols(), MathArray());
553 (cellinfo_.begin() + (row + 1) * ncols(), ncols(), CellInfo());
557 void MathGridInset::appendRow()
559 rowinfo_.push_back(RowInfo());
560 //cells_.insert(cells_.end(), ncols(), MathArray());
561 for (col_type col = 0; col < ncols(); ++col) {
562 cells_.push_back(cells_type::value_type());
563 cellinfo_.push_back(CellInfo());
568 void MathGridInset::delRow(row_type row)
573 cells_type::iterator it = cells_.begin() + row * ncols();
574 cells_.erase(it, it + ncols());
576 vector<CellInfo>::iterator jt = cellinfo_.begin() + row * ncols();
577 cellinfo_.erase(jt, jt + ncols());
579 rowinfo_.erase(rowinfo_.begin() + row);
583 void MathGridInset::copyRow(row_type row)
586 for (col_type col = 0; col < ncols(); ++col)
587 cells_[(row + 1) * ncols() + col] = cells_[row * ncols() + col];
591 void MathGridInset::swapRow(row_type row)
595 if (row + 1 == nrows())
597 for (col_type col = 0; col < ncols(); ++col)
598 swap(cells_[row * ncols() + col], cells_[(row + 1) * ncols() + col]);
602 void MathGridInset::addCol(col_type newcol)
604 const col_type nc = ncols();
605 const row_type nr = nrows();
606 cells_type new_cells((nc + 1) * nr);
607 vector<CellInfo> new_cellinfo((nc + 1) * nr);
609 for (row_type row = 0; row < nr; ++row)
610 for (col_type col = 0; col < nc; ++col) {
611 new_cells[row * (nc + 1) + col + (col > newcol)]
612 = cells_[row * nc + col];
613 new_cellinfo[row * (nc + 1) + col + (col > newcol)]
614 = cellinfo_[row * nc + col];
616 swap(cells_, new_cells);
617 swap(cellinfo_, new_cellinfo);
620 inf.skip_ = defaultColSpace(newcol);
621 inf.align_ = defaultColAlign(newcol);
622 colinfo_.insert(colinfo_.begin() + newcol, inf);
626 void MathGridInset::delCol(col_type col)
632 vector<CellInfo> tmpcellinfo;
633 for (col_type i = 0; i < nargs(); ++i)
634 if (i % ncols() != col) {
635 tmpcells.push_back(cells_[i]);
636 tmpcellinfo.push_back(cellinfo_[i]);
638 swap(cells_, tmpcells);
639 swap(cellinfo_, tmpcellinfo);
641 colinfo_.erase(colinfo_.begin() + col);
645 void MathGridInset::copyCol(col_type col)
648 for (row_type row = 0; row < nrows(); ++row)
649 cells_[row * ncols() + col + 1] = cells_[row * ncols() + col];
653 void MathGridInset::swapCol(col_type col)
657 if (col + 1 == ncols())
659 for (row_type row = 0; row < nrows(); ++row)
660 swap(cells_[row * ncols() + col], cells_[row * ncols() + col + 1]);
664 int MathGridInset::cellXOffset(idx_type idx) const
666 col_type c = col(idx);
667 int x = colinfo_[c].offset_;
668 char align = colinfo_[c].align_;
669 if (align == 'r' || align == 'R')
670 x += colinfo_[c].width_ - cell(idx).width();
671 if (align == 'c' || align == 'C')
672 x += (colinfo_[c].width_ - cell(idx).width()) / 2;
677 int MathGridInset::cellYOffset(idx_type idx) const
679 return rowinfo_[row(idx)].offset_;
683 bool MathGridInset::idxUpDown(idx_type & idx, pos_type & pos, bool up,
690 pos = cell(idx).x2pos(targetx - cell(idx).xo());
693 if (idx >= ncols() * (nrows() - 1))
696 pos = cell(idx).x2pos(targetx - cell(idx).xo());
702 bool MathGridInset::idxLeft(idx_type & idx, pos_type & pos) const
704 // leave matrix if on the left hand edge
708 pos = cell(idx).size();
713 bool MathGridInset::idxRight(idx_type & idx, pos_type & pos) const
715 // leave matrix if on the right hand edge
716 if (col(idx) + 1 == ncols())
724 bool MathGridInset::idxFirst(idx_type & idx, pos_type & pos) const
731 idx = (nrows() - 1) * ncols();
734 idx = ((nrows() - 1) / 2) * ncols();
741 bool MathGridInset::idxLast(idx_type & idx, pos_type & pos) const
751 idx = ((nrows() - 1) / 2 + 1) * ncols() - 1;
753 pos = cell(idx).size();
758 bool MathGridInset::idxHome(idx_type & idx, pos_type & pos) const
765 idx -= idx % ncols();
778 bool MathGridInset::idxEnd(idx_type & idx, pos_type & pos) const
780 if (pos < cell(idx).size()) {
781 pos = cell(idx).size();
784 if (col(idx) < ncols() - 1) {
785 idx = idx - idx % ncols() + ncols() - 1;
786 pos = cell(idx).size();
789 if (idx < nargs() - 1) {
791 pos = cell(idx).size();
798 bool MathGridInset::idxDelete(idx_type & idx)
800 // nothing to do if we have just one row
804 // nothing to do if we are in the middle of the last row of the inset
805 if (idx + ncols() > nargs())
808 // try to delete entire sequence of ncols() empty cells if possible
809 for (idx_type i = idx; i < idx + ncols(); ++i)
813 // move cells if necessary
814 for (idx_type i = index(row(idx), 0); i < idx; ++i)
815 std::swap(cell(i), cell(i + ncols()));
822 // undo effect of Ctrl-Tab (i.e. pull next cell)
823 //if (idx + 1 != nargs())
824 // cell(idx).swap(cell(idx + 1));
826 // we handled the event..
831 // reimplement old behaviour when pressing Delete in the last position
833 void MathGridInset::idxGlue(idx_type idx)
835 col_type c = col(idx);
836 if (c + 1 == ncols()) {
837 if (row(idx) + 1 != nrows()) {
838 for (col_type cc = 0; cc < ncols(); ++cc)
839 cell(idx).append(cell(idx + cc + 1));
840 delRow(row(idx) + 1);
843 cell(idx).append(cell(idx + 1));
844 for (col_type cc = c + 2; cc < ncols(); ++cc)
845 cell(idx - c + cc - 1) = cell(idx - c + cc);
846 cell(idx - c + ncols() - 1).clear();
851 MathGridInset::RowInfo const & MathGridInset::rowinfo(row_type row) const
853 return rowinfo_[row];
857 MathGridInset::RowInfo & MathGridInset::rowinfo(row_type row)
859 return rowinfo_[row];
863 bool MathGridInset::idxBetween(idx_type idx, idx_type from, idx_type to) const
865 row_type const ri = row(idx);
866 row_type const r1 = min(row(from), row(to));
867 row_type const r2 = max(row(from), row(to));
868 col_type const ci = col(idx);
869 col_type const c1 = min(col(from), col(to));
870 col_type const c2 = max(col(from), col(to));
871 return r1 <= ri && ri <= r2 && c1 <= ci && ci <= c2;
876 void MathGridInset::normalize(NormalStream & os) const
879 for (row_type row = 0; row < nrows(); ++row) {
881 for (col_type col = 0; col < ncols(); ++col)
882 os << "[cell " << cell(index(row, col)) << ']';
889 void MathGridInset::mathmlize(MathMLStream & os) const
891 os << MTag("mtable");
892 for (row_type row = 0; row < nrows(); ++row) {
894 for (col_type col = 0; col < ncols(); ++col)
895 os << cell(index(row, col));
898 os << ETag("mtable");
902 void MathGridInset::write(WriteStream & os) const
904 for (row_type row = 0; row < nrows(); ++row) {
905 os << verboseHLine(rowinfo_[row].lines_);
906 // don't write & and empty cells at end of line
907 col_type lastcol = 0;
908 bool emptyline = true;
909 for (col_type col = 0; col < ncols(); ++col)
910 if (!cell(index(row, col)).empty()) {
914 for (col_type col = 0; col < lastcol; ++col)
915 os << cell(index(row, col)) << eocString(col, lastcol);
916 os << eolString(row, os.fragile());
917 // append newline only if line wasn't completely empty
918 // and this was not the last line in the grid
919 if (!emptyline && row + 1 < nrows())
922 string const s = verboseHLine(rowinfo_[nrows()].lines_);
923 if (!s.empty() && s != " ") {
931 int MathGridInset::colsep() const
937 int MathGridInset::rowsep() const
943 int MathGridInset::hlinesep() const
949 int MathGridInset::vlinesep() const
955 int MathGridInset::border() const
961 void MathGridInset::splitCell(idx_type & idx, pos_type & pos)
963 if (idx + 1 == nargs())
965 MathArray ar = cell(idx);
967 cell(idx).erase(pos, cell(idx).size());
970 cell(idx).insert(0, ar);
974 MathInset::result_type MathGridInset::dispatch
975 (FuncRequest const & cmd, idx_type & idx, pos_type & pos)
977 switch (cmd.action) {
979 case LFUN_DELETE_LINE_FORWARD:
980 //autocorrect_ = false;
990 if (pos > cell(idx).size())
991 pos = cell(idx).size();
992 return DISPATCHED_POP;
995 //bv->lockedInsetStoreUndo(Undo::EDIT);
997 //updateLocal(bv, true);
998 return DISPATCHED_POP;
1000 case LFUN_BREAKLINE: {
1001 //bv->lockedInsetStoreUndo(Undo::INSERT);
1002 row_type const r = row(idx);
1006 for (col_type c = col(idx) + 1; c < ncols(); ++c)
1007 std::swap(cell(index(r, c)), cell(index(r + 1, c)));
1010 splitCell(idx, pos);
1011 std::swap(cell(idx), cell(idx + ncols() - 1));
1014 pos = cell(idx).size();
1016 //mathcursor->normalize();
1017 //updateLocal(bv, true);
1018 return DISPATCHED_POP;
1021 case LFUN_TABULAR_FEATURE:
1022 //lyxerr << "handling tabular-feature " << cmd.argument << "\n";
1023 if (cmd.argument == "valign-top")
1025 else if (cmd.argument == "valign-center")
1027 else if (cmd.argument == "valign-bottom")
1029 else if (cmd.argument == "align-left")
1030 halign('l', col(idx));
1031 else if (cmd.argument == "align-right")
1032 halign('r', col(idx));
1033 else if (cmd.argument == "align-center")
1034 halign('c', col(idx));
1035 else if (cmd.argument == "append-row")
1037 else if (cmd.argument == "delete-row") {
1041 } else if (cmd.argument == "copy-row")
1043 else if (cmd.argument == "swap-row")
1045 else if (cmd.argument == "append-column") {
1046 row_type r = row(idx);
1047 col_type c = col(idx);
1050 } else if (cmd.argument == "delete-column") {
1051 row_type r = row(idx);
1052 col_type c = col(idx);
1057 } else if (cmd.argument == "copy-column")
1059 else if (cmd.argument == "swap-column")
1062 return UNDISPATCHED;
1063 return DISPATCHED_POP;
1066 //lyxerr << "pasting '" << cmd.argument << "'\n";
1067 MathGridInset grid(1, 1);
1068 mathed_parse_normal(grid, cmd.argument);
1069 if (grid.nargs() == 1) {
1070 // single cell/part of cell
1071 cell(idx).insert(pos, grid.cell(0));
1072 pos += grid.cell(0).size();
1075 col_type const numcols = min(grid.ncols(), ncols() - col(idx));
1076 row_type const numrows = min(grid.nrows(), nrows() - row(idx));
1077 for (row_type r = 0; r < numrows; ++r) {
1078 for (col_type c = 0; c < numcols; ++c) {
1079 idx_type i = index(r + row(idx), c + col(idx));
1080 cell(i).append(grid.cell(grid.index(r, c)));
1082 // append the left over horizontal cells to the last column
1083 idx_type i = index(r + row(idx), ncols() - 1);
1084 for (MathInset::col_type c = numcols; c < grid.ncols(); ++c)
1085 cell(i).append(grid.cell(grid.index(r, c)));
1087 // append the left over vertical cells to the last _cell_
1088 idx_type i = nargs() - 1;
1089 for (row_type r = numrows; r < grid.nrows(); ++r)
1090 for (col_type c = 0; c < grid.ncols(); ++c)
1091 cell(i).append(grid.cell(grid.index(r, c)));
1093 return DISPATCHED_POP;
1097 return MathNestInset::dispatch(cmd, idx, pos);
1099 return UNDISPATCHED;