#include "insets/InsetText.h"
-#include "mathed/MathMacroTemplate.h"
+#include "mathed/InsetMathMacroTemplate.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
}
-}
+} // namespace
/////////////////////////////////////////////////////////////////////
//
// do the metric calculation
Dimension dim;
- int const w = max_width_ - leftMargin(max_width_, pit, ii->pos)
+ int const w = max_width_ - leftMargin(pit, ii->pos)
- right_margin - eop;
Font const & font = ii->inset->inheritFont() ?
displayFont(pit, ii->pos) : bufferfont;
if (text_->getPar(pit).layout().margintype != MARGIN_MANUAL)
return 0;
// return the beginning of the body
- return leftMargin(max_width_, pit);
+ return leftMargin(pit);
}
namespace {
pos_type bodypos_;
};
-} // anon namespace
+} // namespace
/** This is the function where the hard work is done. The code here is
* very sensitive to small changes :) Note that part of the
bool need_new_row = false;
row.clear();
- row.left_margin = leftMargin(max_width_, row.pit(), pos);
+ row.left_margin = leftMargin(row.pit(), pos);
row.right_margin = right_margin;
if (is_rtl)
swap(row.left_margin, row.right_margin);
// if the row is too large, try to cut at last separator. In case
// of success, reset indication that the row was broken abruptly.
- int const next_width = max_width_ - leftMargin(max_width_, row.pit(), row.endpos())
+ int const next_width = max_width_ - leftMargin(row.pit(), row.endpos())
- rightMargin(row.pit());
row.shortenIfNeeded(body_pos, width, next_width);
// Try to descend recursively inside the inset.
Inset * edited = inset->editXY(cur, x, y);
- if (edited == inset && cur.pos() == it->pos) {
+ // FIXME: it is not clear that the test on position is needed
+ // Remove it if/when semantics of editXY is clarified
+ if (cur.text() == text_ && cur.pos() == it->pos) {
// non-editable inset, set cursor after the inset if x is
// nearer to that position (bug 9628)
bool bound = false; // is modified by getPosNearX
}
-int TextMetrics::leftMargin(int max_width, pit_type pit) const
+int TextMetrics::leftMargin(pit_type pit) const
{
- return leftMargin(max_width, pit, text_->paragraphs()[pit].size());
+ return leftMargin(pit, text_->paragraphs()[pit].size());
}
-int TextMetrics::leftMargin(int max_width,
- pit_type const pit, pos_type const pos) const
+int TextMetrics::leftMargin(pit_type const pit, pos_type const pos) const
{
ParagraphList const & pars = text_->paragraphs();
int nestmargin = depth * nestMargin();
if (text_->isMainText())
nestmargin += changebarMargin();
- l_margin = max(leftMargin(max_width, newpar), nestmargin);
+ l_margin = max(leftMargin(newpar), nestmargin);
// Remove the parindent that has been added
// if the paragraph was empty.
if (pars[newpar].empty() &&
ParagraphMetrics const & pm = par_metrics_[pit];
RowList::const_iterator rit = pm.rows().begin();
RowList::const_iterator end = pm.rows().end();
- int minfill = max_width;
+ int minfill = max_width_;
for ( ; rit != end; ++rit)
if (rit->fill() < minfill)
minfill = rit->fill();
l_margin += minfill;
#endif
// also wrong, but much shorter.
- l_margin += max_width / 2;
+ l_margin += max_width_ / 2;
break;
}
}
if (!par.params().leftIndent().zero())
- l_margin += par.params().leftIndent().inPixels(max_width, lfm.em());
+ l_margin += par.params().leftIndent().inPixels(max_width_, lfm.em());
LyXAlignment align = par.getAlign();