]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathScript.cpp
de.po
[lyx.git] / src / mathed / InsetMathScript.cpp
1 /**
2  * \file InsetMathScript.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "InsetMathScript.h"
14
15 #include "InsetMathBrace.h"
16 #include "InsetMathSymbol.h"
17 #include "MathData.h"
18 #include "MathStream.h"
19 #include "MathSupport.h"
20
21 #include "BufferView.h"
22 #include "Cursor.h"
23 #include "DispatchResult.h"
24 #include "FuncRequest.h"
25 #include "FuncStatus.h"
26 #include "LaTeXFeatures.h"
27 #include "MetricsInfo.h"
28
29 #include "support/debug.h"
30 #include "support/gettext.h"
31 #include "support/lassert.h"
32
33
34 using namespace std;
35
36 namespace lyx {
37
38
39 InsetMathScript::InsetMathScript(Buffer * buf)
40         : InsetMathNest(buf, 1), cell_1_is_up_(false), limits_(0)
41 {}
42
43
44 InsetMathScript::InsetMathScript(Buffer * buf, bool up)
45         : InsetMathNest(buf, 2), cell_1_is_up_(up), limits_(0)
46 {}
47
48
49 InsetMathScript::InsetMathScript(Buffer * buf, MathAtom const & at, bool up)
50         : InsetMathNest(buf, 2), cell_1_is_up_(up), limits_(0)
51 {
52         LATTEST(nargs() >= 1);
53         cell(0).push_back(at);
54 }
55
56
57 Inset * InsetMathScript::clone() const
58 {
59         return new InsetMathScript(*this);
60 }
61
62
63 InsetMathScript const * InsetMathScript::asScriptInset() const
64 {
65         return this;
66 }
67
68
69 InsetMathScript * InsetMathScript::asScriptInset()
70 {
71         return this;
72 }
73
74
75 MathData const & InsetMathScript::down() const
76 {
77         if (nargs() == 3)
78                 return cell(2);
79         LBUFERR(nargs() > 1);
80         return cell(1);
81 }
82
83
84 MathData & InsetMathScript::down()
85 {
86         if (nargs() == 3)
87                 return cell(2);
88         LBUFERR(nargs() > 1);
89         return cell(1);
90 }
91
92
93 MathData const & InsetMathScript::up() const
94 {
95         LBUFERR(nargs() > 1);
96         return cell(1);
97 }
98
99
100 MathData & InsetMathScript::up()
101 {
102         LBUFERR(nargs() > 1);
103         return cell(1);
104 }
105
106
107 void InsetMathScript::ensure(bool up)
108 {
109         if (nargs() == 1) {
110                 // just nucleus so far
111                 cells_.push_back(MathData());
112                 cell_1_is_up_ = up;
113         } else if (nargs() == 2 && !has(up)) {
114                 if (up) {
115                         cells_.push_back(cell(1));
116                         cell(1).clear();
117                 } else {
118                         cells_.push_back(MathData());
119                 }
120         }
121 }
122
123
124 MathData const & InsetMathScript::nuc() const
125 {
126         return cell(0);
127 }
128
129
130 MathData & InsetMathScript::nuc()
131 {
132         return cell(0);
133 }
134
135
136 int InsetMathScript::dy01(BufferView const & bv, int asc, int des, int what) const
137 {
138         int dasc = 0;
139         int slevel = 0;
140         bool isCharBox = !nuc().empty() ? isAlphaSymbol(nuc().back()) : false;
141         if (hasDown()) {
142                 Dimension const & dimdown = down().dimension(bv);
143                 dasc = dimdown.ascent();
144                 slevel = nuc().slevel();
145                 int ascdrop = dasc - slevel;
146                 int desdrop = isCharBox ? 0 : des + nuc().sshift();
147                 int mindes = nuc().mindes();
148                 des = max(desdrop, ascdrop);
149                 des = max(mindes, des);
150         }
151         if (hasUp()) {
152                 Dimension const & dimup = up().dimension(bv);
153                 int minasc = nuc().minasc();
154                 int ascdrop = isCharBox ? 0 : asc - up().mindes();
155                 int udes = dimup.descent();
156                 asc = udes + nuc().sshift();
157                 asc = max(ascdrop, asc);
158                 asc = max(minasc, asc);
159                 if (hasDown()) {
160                         int del = asc - udes - dasc;
161                         if (del + des <= 2) {
162                                 int newdes = 2 - del;
163                                 del = slevel - asc + udes;
164                                 if (del > 0) {
165                                         asc += del;
166                                         newdes -= del;
167                                 }
168                                 des = max(des, newdes);
169                         }
170                 }
171         }
172         return what ? asc : des;
173 }
174
175
176 int InsetMathScript::dy0(BufferView const & bv) const
177 {
178         int nd = ndes(bv);
179         if (!hasDown())
180                 return nd;
181         int des = down().dimension(bv).ascent();
182         if (hasLimits())
183                 des += nd + 2;
184         else {
185                 int na = nasc(bv);
186                 des = dy01(bv, na, nd, 0);
187         }
188         return des;
189 }
190
191
192 int InsetMathScript::dy1(BufferView const & bv) const
193 {
194         int na = nasc(bv);
195         if (!hasUp())
196                 return na;
197         int asc = up().dimension(bv).descent();
198         if (hasLimits())
199                 asc += na + 2;
200         else {
201                 int nd = ndes(bv);
202                 asc = dy01(bv, na, nd, 1);
203         }
204         asc = max(asc, 5);
205         return asc;
206 }
207
208
209 int InsetMathScript::dx0(BufferView const & bv) const
210 {
211         LASSERT(hasDown(), return 0);
212         Dimension const dim = dimension(bv);
213         return hasLimits() ? (dim.wid - down().dimension(bv).width()) / 2
214                 : nwid(bv) + min(nker(&bv), 0);
215 }
216
217
218 int InsetMathScript::dx1(BufferView const & bv) const
219 {
220         LASSERT(hasUp(), return 0);
221         Dimension const dim = dimension(bv);
222         return hasLimits() ? (dim.wid - up().dimension(bv).width()) / 2
223                 : nwid(bv) + max(nker(&bv), 0);
224 }
225
226
227 int InsetMathScript::dxx(BufferView const & bv) const
228 {
229         Dimension const dim = dimension(bv);
230         return hasLimits() ? (dim.wid - nwid(bv)) / 2  :  0;
231 }
232
233
234 int InsetMathScript::nwid(BufferView const & bv) const
235 {
236         return !nuc().empty() ? nuc().dimension(bv).width() : 2;
237 }
238
239
240 int InsetMathScript::nasc(BufferView const & bv) const
241 {
242         return !nuc().empty() ? nuc().dimension(bv).ascent() : 5;
243 }
244
245
246 int InsetMathScript::ndes(BufferView const & bv) const
247 {
248         return !nuc().empty() ? nuc().dimension(bv).descent() : 0;
249 }
250
251
252 int InsetMathScript::nker(BufferView const * bv) const
253 {
254         if (!nuc().empty())
255                 return nuc().kerning(bv);
256         return 0;
257 }
258
259
260 MathClass InsetMathScript::mathClass() const
261 {
262         // FIXME: this is a hack, since the class will not be correct if
263         // the nucleus has several elements or if the last element is a math macro
264         // or a macro argument proxy.
265         // The correct implementation would require to linearize the nucleus.
266         if (nuc().empty())
267                 return MC_ORD;
268         else {
269                 // return the class of last element since this is the one that counts.
270                 MathClass mc = nuc().back()->mathClass();
271                 return (mc == MC_UNKNOWN) ? MC_ORD : mc;
272         }
273 }
274
275
276 void InsetMathScript::metrics(MetricsInfo & mi, Dimension & dim) const
277 {
278         Changer dummy2 = mi.base.changeEnsureMath();
279         Dimension dim0;
280         Dimension dim1;
281         Dimension dim2;
282         cell(0).metrics(mi, dim0);
283         Changer dummy = mi.base.changeScript();
284         if (nargs() > 1)
285                 cell(1).metrics(mi, dim1);
286         if (nargs() > 2)
287                 cell(2).metrics(mi, dim2);
288
289         dim.wid = 0;
290         BufferView & bv = *mi.base.bv;
291         // FIXME: data copying... not very efficient.
292         Dimension dimup;
293         Dimension dimdown;
294         if (hasUp())
295                 dimup = up().dimension(bv);
296         if (hasDown())
297                 dimdown = down().dimension(bv);
298
299         if (hasLimits()) {
300                 dim.wid = nwid(bv);
301                 if (hasUp())
302                         dim.wid = max(dim.wid, dimup.width());
303                 if (hasDown())
304                         dim.wid = max(dim.wid, dimdown.width());
305         } else {
306                 if (hasUp())
307                         dim.wid = max(dim.wid, max(nker(mi.base.bv), 0) + dimup.width());
308                 if (hasDown())
309                         dim.wid = max(dim.wid, min(nker(mi.base.bv), 0) + dimdown.width());
310                 dim.wid += nwid(bv);
311         }
312         int na = nasc(bv);
313         if (hasUp()) {
314                 int asc = dy1(bv) + dimup.ascent();
315                 dim.asc = max(na, asc);
316         } else
317                 dim.asc = na;
318         int nd = ndes(bv);
319         if (hasDown()) {
320                 int des = dy0(bv) + dimdown.descent();
321                 dim.des = max(nd, des);
322         } else
323                 dim.des = nd;
324 }
325
326
327 void InsetMathScript::draw(PainterInfo & pi, int x, int y) const
328 {
329         Changer dummy2 = pi.base.changeEnsureMath();
330         BufferView & bv = *pi.base.bv;
331         if (!nuc().empty())
332                 nuc().draw(pi, x + dxx(bv), y);
333         else {
334                 nuc().setXY(bv, x + dxx(bv), y);
335                 if (editing(&bv))
336                         pi.draw(x + dxx(bv), y, char_type('.'));
337         }
338         Changer dummy = pi.base.changeScript();
339         if (hasUp())
340                 up().draw(pi, x + dx1(bv), y - dy1(bv));
341         if (hasDown())
342                 down().draw(pi, x + dx0(bv), y + dy0(bv));
343 }
344
345
346 void InsetMathScript::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
347 {
348         if (hasUp())
349                 up().metricsT(mi, dim);
350         if (hasDown())
351                 down().metricsT(mi, dim);
352         nuc().metricsT(mi, dim);
353 }
354
355
356 void InsetMathScript::drawT(TextPainter & pain, int x, int y) const
357 {
358         // FIXME: BROKEN
359         if (!nuc().empty())
360                 nuc().drawT(pain, x + 1, y);
361         if (hasUp())
362                 up().drawT(pain, x + 1, y - 1 /*dy1()*/);
363         if (hasDown())
364                 down().drawT(pain, x + 1, y + 1 /*dy0()*/);
365 }
366
367
368 // FIXME: See InsetMathSymbol::takesLimits, which seems to attempt the
369 // same in a hardcoded way. takeLimits use is currently commented out in
370 // InsetMathScript::metrics. It seems that the mathop test is general
371 // enough, but only time will tell.
372 bool InsetMathScript::allowsLimits() const
373 {
374         if (nuc().empty())
375                 return false;
376         // Only makes sense for insets of mathop class
377         if (nuc().back()->mathClass() != MC_OP)
378                 return false;
379         return true;
380 }
381
382
383 bool InsetMathScript::hasLimits() const
384 {
385         // obvious cases
386         if (limits_ == 1)
387                 return true;
388         if (limits_ == -1)
389                 return false;
390
391         // we can only display limits if the nucleus wants some
392         if (!allowsLimits())
393                 return false;
394         // FIXME: this is some hardcoding done in InsetMathSymbol::metrics.
395         if (!nuc().back()->isScriptable())
396                 return false;
397
398         if (nuc().back()->asSymbolInset()) {
399                 // \intop is an alias for \int\limits, \ointop == \oint\limits
400                 if (nuc().back()->asSymbolInset()->name().find(from_ascii("intop")) != string::npos)
401                         return true;
402                 // per default \int has limits beside the \int even in displayed formulas
403                 if (nuc().back()->asSymbolInset()->name().find(from_ascii("int")) != string::npos)
404                         return false;
405         }
406
407         // assume "real" limits for everything else
408         return true;
409 }
410
411
412 void InsetMathScript::removeScript(bool up)
413 {
414         if (nargs() == 2) {
415                 if (up == cell_1_is_up_)
416                         cells_.pop_back();
417         } else if (nargs() == 3) {
418                 if (up == true) {
419                         swap(cells_[1], cells_[2]);
420                         cell_1_is_up_ = false;
421                 } else {
422                         cell_1_is_up_ = true;
423                 }
424                 cells_.pop_back();
425         }
426 }
427
428
429 bool InsetMathScript::has(bool up) const
430 {
431         return idxOfScript(up);
432 }
433
434
435 bool InsetMathScript::hasUp() const
436 {
437         //lyxerr << "1up: " << bool(cell_1_is_up_));
438         //lyxerr << "hasUp: " << bool(idxOfScript(true)));
439         return idxOfScript(true);
440 }
441
442
443 bool InsetMathScript::hasDown() const
444 {
445         //LYXERR0("1up: " << bool(cell_1_is_up_));
446         //LYXERR0("hasDown: " << bool(idxOfScript(false)));
447         return idxOfScript(false);
448 }
449
450
451 Inset::idx_type InsetMathScript::idxOfScript(bool up) const
452 {
453         if (nargs() == 1)
454                 return 0;
455         if (nargs() == 2)
456                 return (cell_1_is_up_ == up) ? 1 : 0;
457         if (nargs() == 3)
458                 return up ? 1 : 2;
459         LASSERT(false, return 0);
460 }
461
462
463 bool InsetMathScript::idxForward(Cursor &) const
464 {
465         return false;
466 }
467
468
469 bool InsetMathScript::idxBackward(Cursor &) const
470 {
471         return false;
472 }
473
474
475 bool InsetMathScript::idxUpDown(Cursor & cur, bool up) const
476 {
477         // in nucleus?
478         if (cur.idx() == 0) {
479                 // don't go up/down if there is no cell in this direction
480                 if (!has(up))
481                         return false;
482                 // go up/down only if in the last position
483                 // or in the first position of something with displayed limits
484                 if (cur.pos() == cur.lastpos() || (cur.pos() == 0 && hasLimits())) {
485                         cur.idx() = idxOfScript(up);
486                         cur.pos() = 0;
487                         return true;
488                 }
489                 return false;
490         }
491
492         // Are we 'up'?
493         if (cur.idx() == idxOfScript(true)) {
494                 // can't go further up
495                 if (up)
496                         return false;
497                 // otherwise go to last position in the nucleus
498                 cur.idx() = 0;
499                 cur.pos() = cur.lastpos();
500                 return true;
501         }
502
503         // Are we 'down'?
504         if (cur.idx() == idxOfScript(false)) {
505                 // can't go further down
506                 if (!up)
507                         return false;
508                 // otherwise go to last position in the nucleus
509                 cur.idx() = 0;
510                 cur.pos() = cur.lastpos();
511                 return true;
512         }
513
514         return false;
515 }
516
517
518 void InsetMathScript::write(WriteStream & os) const
519 {
520         MathEnsurer ensurer(os);
521
522         if (!nuc().empty()) {
523                 os << nuc();
524                 //if (nuc().back()->takesLimits()) {
525                         if (limits_ == -1)
526                                 os << "\\nolimits ";
527                         if (limits_ == 1)
528                                 os << "\\limits ";
529                 //}
530         } else {
531                 if (os.firstitem())
532                         LYXERR(Debug::MATHED, "suppressing {} when writing");
533                 else
534                         os << "{}";
535         }
536
537         if (hasDown() /*&& !down().empty()*/)
538                 os << "_{" << down() << '}';
539
540         if (hasUp() /*&& !up().empty()*/) {
541                 // insert space if up() is empty or an empty brace inset
542                 // (see bug 8305)
543                 if (os.latex() && (up().empty() ||
544                     (up().size() == 1 && up().back()->asBraceInset() &&
545                      up().back()->asBraceInset()->cell(0).empty())))
546                         os << "^ {}";
547                 else
548                         os << "^{" << up() << '}';
549         }
550
551         if (lock_ && !os.latex())
552                 os << "\\lyxlock ";
553 }
554
555
556 void InsetMathScript::normalize(NormalStream & os) const
557 {
558         bool d = hasDown() && !down().empty();
559         bool u = hasUp() && !up().empty();
560
561         if (u && d)
562                 os << "[subsup ";
563         else if (u)
564                 os << "[sup ";
565         else if (d)
566                 os << "[sub ";
567
568         if (!nuc().empty())
569                 os << nuc() << ' ';
570         else
571                 os << "[par]";
572
573         if (u && d)
574                 os << down() << ' ' << up() << ']';
575         else if (d)
576                 os << down() << ']';
577         else if (u)
578                 os << up() << ']';
579 }
580
581
582 void InsetMathScript::maple(MapleStream & os) const
583 {
584         if (!nuc().empty())
585                 os << nuc();
586         if (hasDown() && !down().empty())
587                 os << '[' << down() << ']';
588         if (hasUp() && !up().empty())
589                 os << "^(" << up() << ')';
590 }
591
592
593 void InsetMathScript::mathematica(MathematicaStream & os) const
594 {
595         bool d = hasDown() && !down().empty();
596         bool u = hasUp() && !up().empty();
597
598         if (!nuc().empty()) {
599                 if (d)
600                         os << "Subscript[" << nuc();
601                 else
602                         os << nuc();
603         }
604
605         if (u)
606                 os << "^(" << up() << ')';
607
608         if (!nuc().empty()) {
609                 if (d)
610                         os << ',' << down() << ']';
611         }
612 }
613
614
615 void InsetMathScript::mathmlize(MathStream & os) const
616 {
617         bool d = hasDown() && !down().empty();
618         bool u = hasUp() && !up().empty();
619         bool l = hasLimits();
620
621         if (u && d)
622                 os << MTag(l ? "munderover" : "msubsup");
623         else if (u)
624                 os << MTag(l ? "mover" : "msup");
625         else if (d)
626                 os << MTag(l ? "munder" : "msub");
627
628         if (!nuc().empty())
629                 os << MTag("mrow") << nuc() << ETag("mrow");
630         else
631                 os << "<mrow />";
632
633         if (u && d)
634                 os << MTag("mrow") << down() << ETag("mrow")
635                    << MTag("mrow") << up() << ETag("mrow")
636                    << ETag(l ? "munderover" : "msubsup");
637         else if (u)
638                 os << MTag("mrow") << up() << ETag("mrow") << ETag(l ? "mover" : "msup");
639         else if (d)
640                 os << MTag("mrow") << down() << ETag("mrow") << ETag(l ? "munder" : "msub");
641 }
642
643
644 void InsetMathScript::htmlize(HtmlStream & os) const
645 {
646         bool d = hasDown() && !down().empty();
647         bool u = hasUp() && !up().empty();
648
649         if (!nuc().empty())
650                 os << nuc();
651
652         if (u && d)
653                 os << MTag("span", "class='scripts'")
654                          << MTag("span") << up() << ETag("span")
655                          << MTag("span") << down() << ETag("span")
656                          << ETag("span");
657         else if (u)
658                 os << MTag("sup", "class='math'") << up() << ETag("sup");
659         else if (d)
660                 os << MTag("sub", "class='math'") << down() << ETag("sub");
661 }
662
663
664 void InsetMathScript::octave(OctaveStream & os) const
665 {
666         if (!nuc().empty())
667                 os << nuc();
668         if (hasDown() && !down().empty())
669                 os << '[' << down() << ']';
670         if (hasUp() && !up().empty())
671                 os << "^(" << up() << ')';
672 }
673
674
675 void InsetMathScript::infoize(odocstream & os) const
676 {
677         os << "Scripts";
678 }
679
680
681 void InsetMathScript::infoize2(odocstream & os) const
682 {
683         if (limits_)
684                 os << from_ascii(limits_ == 1 ? ", Displayed limits" : ", Inlined limits");
685 }
686
687
688 bool InsetMathScript::notifyCursorLeaves(Cursor const & old, Cursor & cur)
689 {
690         InsetMathNest::notifyCursorLeaves(old, cur);
691
692         //LYXERR0("InsetMathScript::notifyCursorLeaves: 1 " << cur);
693
694         // Remove empty scripts if possible:
695
696         // The case of two scripts, but only one got empty (1 = super, 2 = sub).
697         // We keep the script inset, but remove the empty script.
698         if (nargs() > 2 && (!cell(1).empty() || !cell(2).empty())) {
699                 if (cell(2).empty()) {
700                         // must be a subscript...
701                         old.recordUndoInset();
702                         removeScript(false);
703                         cur.screenUpdateFlags(cur.result().screenUpdate() | Update::SinglePar);
704                         return true;
705                 } else if (cell(1).empty()) {
706                         // must be a superscript...
707                         old.recordUndoInset();
708                         removeScript(true);
709                         cur.screenUpdateFlags(cur.result().screenUpdate() | Update::SinglePar);
710                         return true;
711                 }
712         }
713         // Now the two suicide cases:
714         // * we have only one script which is empty
715         // * we have two scripts which are both empty.
716         // The script inset is removed completely.
717         if ((nargs() == 2 && cell(1).empty())
718             || (nargs() == 3 && cell(1).empty() && cell(2).empty())) {
719                 // Make undo step. We cannot use cur for this because
720                 // it does not necessarily point to us anymore. But we
721                 // should be on top of the cursor old.
722                 Cursor insetCur = old;
723                 int scriptSlice = insetCur.find(this);
724                 LASSERT(scriptSlice != -1, /**/);
725                 insetCur.cutOff(scriptSlice);
726                 insetCur.recordUndoInset();
727
728                 // Let the script inset commit suicide. This is
729                 // modelled on Cursor.pullArg(), but tries not to
730                 // invoke notifyCursorLeaves again and does not touch
731                 // cur (since the top slice will be deleted
732                 // afterwards)
733                 MathData ar = cell(0);
734                 insetCur.pop();
735                 insetCur.cell().erase(insetCur.pos());
736                 insetCur.cell().insert(insetCur.pos(), ar);
737
738                 // redraw
739                 cur.screenUpdateFlags(cur.result().screenUpdate() | Update::SinglePar);
740                 return true;
741         }
742
743         //LYXERR0("InsetMathScript::notifyCursorLeaves: 2 " << cur);
744         return false;
745 }
746
747
748 void InsetMathScript::doDispatch(Cursor & cur, FuncRequest & cmd)
749 {
750         //LYXERR("InsetMathScript: request: " << cmd);
751
752         if (cmd.action() == LFUN_MATH_LIMITS) {
753                 // only when nucleus allows this
754                 if (!allowsLimits())
755                         return;
756                 cur.recordUndoInset();
757                 if (!cmd.argument().empty()) {
758                         if (cmd.argument() == "limits")
759                                 limits_ = 1;
760                         else if (cmd.argument() == "nolimits")
761                                 limits_ = -1;
762                         else
763                                 limits_ = 0;
764                 } else if (limits_ == 0)
765                         limits_ = hasLimits() ? -1 : 1;
766                 else
767                         limits_ = 0;
768                 return;
769         }
770
771         InsetMathNest::doDispatch(cur, cmd);
772 }
773
774
775 bool InsetMathScript::getStatus(Cursor & cur, FuncRequest const & cmd,
776                                 FuncStatus & flag) const
777 {
778         if (cmd.action() == LFUN_MATH_LIMITS) {
779                 // only when nucleus allows this
780                 if (allowsLimits()) {
781                         if (!cmd.argument().empty()) {
782                                 if (cmd.argument() == "limits")
783                                         flag.setOnOff(limits_ == 1);
784                                 else if (cmd.argument() == "nolimits")
785                                         flag.setOnOff(limits_ == -1);
786                                 else
787                                         flag.setOnOff(limits_ == 0);
788                         }
789                         flag.setEnabled(true);
790                 } else
791                         flag.setEnabled(false);
792                 return true;
793         }
794
795         return InsetMathNest::getStatus(cur, cmd, flag);
796 }
797
798
799 // the idea for dual scripts came from the eLyXer code
800 void InsetMathScript::validate(LaTeXFeatures & features) const
801 {
802         if (features.runparams().math_flavor == OutputParams::MathAsHTML)
803                 features.addCSSSnippet(
804                         "span.scripts{display: inline-block; vertical-align: middle; text-align:center; font-size: 75%;}\n"
805                         "span.scripts span {display: block;}\n"
806                         "sub.math{font-size: 75%;}\n"
807                         "sup.math{font-size: 75%;}");
808         InsetMathNest::validate(features);
809 }
810
811 } // namespace lyx