- lfont_size = f.size();
- mathed_set_font(LM_TC_TEXTRM, LM_ST_TEXT); // otherwise a segfault could occur
- // in some XDrawRectangles (i.e. matrix) (Matthias)
- if (mathcursor && mathcursor->GetPar() == par) {
- if (mathcursor->Selection()) {
- int n;
- XPoint * p = mathcursor->SelGetArea(n);
- XFillPolygon(fl_display, pm, getGC(gc_selection), //LyXGetSelectionGC(),
- p, n, Nonconvex, CoordModeOrigin);
- }
- mathcursor->Draw(pm, (int)x, baseline);
- } else {
-// par->Metrics();
- par->setDrawable(pm);
- par->Draw((int)x, baseline);
- }
- x += (float)Width(f);
-
- if (par->GetType() == LM_OT_PARN || par->GetType() == LM_OT_MPARN) {
- char s[80];
- LyXFont font = WhichFont(LM_TC_BF, par->size);
- font.setLatex(LyXFont::OFF);
-
- if (par->GetType() == LM_OT_PARN) {
- if (!label.empty())
- sprintf(s, "(%s)", label.c_str());
- else
- sprintf(s, "(#)");
- font.drawString(s, pm, baseline, int(x+20));
- } else
- if (par->GetType() == LM_OT_MPARN) {
- MathMatrixInset *mt = (MathMatrixInset*)par;
- //int i= 0;
- int y;
- MathedRowSt const* crow = mt->getRowSt();
- while (crow) {
- y = baseline + crow->getBaseline();
- if (crow->isNumbered()) {
- if (crow->getLabel())
- sprintf(s, "(%s)", crow->getLabel());
- else
- sprintf(s, "(#)");
- font.drawString(s, pm, y, int(x+20));
- }
- crow = crow->getNext();
- }
- }
- }
- cursor_visible = false;
+ // otherwise a segfault could occur
+ // in some XDrawRectangles (i.e. matrix) (Matthias)
+ if (mathcursor && mathcursor->GetPar() == par) {
+ if (mathcursor->Selection()) {
+ int n;
+ int * xp = 0;
+ int * yp = 0;
+ mathcursor->SelGetArea(&xp, &yp, n);
+ pain.fillPolygon(xp, yp, n, LColor::selection);
+ }
+ mathcursor->draw(pain, int(x), baseline);
+ } else {
+ par->draw(pain, int(x), baseline);
+ }
+ x += float(width(bv, font));
+
+ if (par->GetType() == LM_OT_PARN || par->GetType() == LM_OT_MPARN) {
+ LyXFont wfont = WhichFont(LM_TC_BF, par->size);
+ wfont.setLatex(LyXFont::OFF);
+
+ if (par->GetType() == LM_OT_PARN) {
+ string str;
+ if (!label.empty())
+ str = string("(") + label + ")";
+ else
+ str = string("(#)");
+ pain.text(int(x + 20), baseline, str, wfont);
+ } else if (par->GetType() == LM_OT_MPARN) {
+ MathMatrixInset * mt =
+ static_cast<MathMatrixInset*>(par);
+ int y;
+ MathedRowSt const * crow = mt->getRowSt();
+ while (crow) {
+ y = baseline + crow->getBaseline();
+ if (crow->isNumbered()) {
+ string str;
+ if (!crow->getLabel().empty())
+ str = string("(") + crow->getLabel() + ")";
+ else
+ str = "(#)";
+ pain.text(int(x + 20), y, str, wfont);
+ }
+ crow = crow->getNext();
+ }
+ }
+ }
+ cursor_visible = false;