mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Use isMainText() instead of doing explicit tests
This commit is contained in:
parent
d0a318c742
commit
4fb8e9b639
@ -200,13 +200,13 @@ bool TextMetrics::metrics(MetricsInfo & mi, Dimension & dim, int min_width)
|
||||
|
||||
int TextMetrics::rightMargin(ParagraphMetrics const & pm) const
|
||||
{
|
||||
return main_text_? pm.rightMargin(*bv_) : 0;
|
||||
return text_->isMainText() ? pm.rightMargin(*bv_) : 0;
|
||||
}
|
||||
|
||||
|
||||
int TextMetrics::rightMargin(pit_type const pit) const
|
||||
{
|
||||
return main_text_? par_metrics_[pit].rightMargin(*bv_) : 0;
|
||||
return text_->isMainText() ? par_metrics_[pit].rightMargin(*bv_) : 0;
|
||||
}
|
||||
|
||||
|
||||
@ -353,7 +353,6 @@ bool TextMetrics::redoParagraph(pit_type const pit)
|
||||
pm.reset(par);
|
||||
|
||||
Buffer & buffer = bv_->buffer();
|
||||
main_text_ = (text_ == &buffer.text());
|
||||
bool changed = false;
|
||||
|
||||
// Check whether there are InsetBibItems that need fixing
|
||||
@ -1087,7 +1086,7 @@ void TextMetrics::setRowHeight(Row & row, pit_type const pit,
|
||||
// following code in another method specially tailored for the
|
||||
// main Text. The following test is thus bogus.
|
||||
// Top and bottom margin of the document (only at top-level)
|
||||
if (main_text_ && topBottomSpace) {
|
||||
if (text_->isMainText() && topBottomSpace) {
|
||||
if (pit == 0 && row.pos() == 0)
|
||||
maxasc += 20;
|
||||
if (pit + 1 == pit_type(pars.size()) &&
|
||||
|
@ -35,7 +35,7 @@ class TextMetrics
|
||||
{
|
||||
public:
|
||||
/// Default constructor (only here for STL containers).
|
||||
TextMetrics() : bv_(0), text_(0), main_text_(false), max_width_(0) {}
|
||||
TextMetrics() : bv_(0), text_(0), max_width_(0) {}
|
||||
/// The only useful constructor.
|
||||
TextMetrics(BufferView *, Text *);
|
||||
|
||||
@ -243,7 +243,6 @@ private:
|
||||
/// \todo FIXME: this should be const.
|
||||
Text * text_;
|
||||
|
||||
bool main_text_;
|
||||
/// A map from paragraph index number to paragraph metrics
|
||||
typedef std::map<pit_type, ParagraphMetrics> ParMetricsCache;
|
||||
///
|
||||
|
@ -290,7 +290,7 @@ void InsetText::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_INSET_DISSOLVE: {
|
||||
bool const main_inset = &buffer().inset() == this;
|
||||
bool const main_inset = text_.isMainText();
|
||||
bool const target_inset = cmd.argument().empty()
|
||||
|| cmd.getArg(0) == insetName(lyxCode());
|
||||
// cur.inset() is the tabular when this is a single cell (bug #9954)
|
||||
@ -323,7 +323,7 @@ bool InsetText::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
{
|
||||
switch (cmd.action()) {
|
||||
case LFUN_INSET_DISSOLVE: {
|
||||
bool const main_inset = &buffer().inset() == this;
|
||||
bool const main_inset = text_.isMainText();
|
||||
bool const target_inset = cmd.argument().empty()
|
||||
|| cmd.getArg(0) == insetName(lyxCode());
|
||||
// cur.inset() is the tabular when this is a single cell (bug #9954)
|
||||
@ -340,7 +340,7 @@ bool InsetText::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
status.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
if (&buffer().inset() == this || !cur.paragraph().layout().args().empty())
|
||||
if (text_.isMainText() || !cur.paragraph().layout().args().empty())
|
||||
return text_.getStatus(cur, cmd, status);
|
||||
|
||||
Layout::LaTeXArgMap args = getLayout().args();
|
||||
|
Loading…
Reference in New Issue
Block a user