mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Rename empty layout stuff to plain layout stuff.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25541 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f57a0a5dac
commit
780bce0f96
@ -938,7 +938,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT:
|
||||
flag.setEnabled(!cur.inset().forceEmptyLayout(cur.idx()));
|
||||
flag.setEnabled(!cur.inset().forcePlainLayout(cur.idx()));
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT_PARAGRAPH:
|
||||
|
@ -129,15 +129,15 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
|
||||
}
|
||||
|
||||
// set the paragraphs to empty layout if necessary
|
||||
if (cur.inset().useEmptyLayout()) {
|
||||
bool forceEmptyLayout = cur.inset().forceEmptyLayout();
|
||||
if (cur.inset().usePlainLayout()) {
|
||||
bool forcePlainLayout = cur.inset().forcePlainLayout();
|
||||
Layout const & emptyLayout = newDocClass->emptyLayout();
|
||||
Layout const & defaultLayout = newDocClass->defaultLayout();
|
||||
ParagraphList::iterator const end = insertion.end();
|
||||
ParagraphList::iterator par = insertion.begin();
|
||||
for (; par != end; ++par) {
|
||||
Layout const & parLayout = par->layout();
|
||||
if (forceEmptyLayout || parLayout == defaultLayout)
|
||||
if (forcePlainLayout || parLayout == defaultLayout)
|
||||
par->setLayout(emptyLayout);
|
||||
}
|
||||
} else { // check if we need to reset from empty layout
|
||||
@ -511,7 +511,7 @@ void switchBetweenClasses(DocumentClass const * const oldone,
|
||||
docstring const name = it->layout().name();
|
||||
bool hasLayout = newtc.hasLayout(name);
|
||||
|
||||
if (in.useEmptyLayout())
|
||||
if (in.usePlainLayout())
|
||||
it->setLayout(newtc.emptyLayout());
|
||||
else if (hasLayout)
|
||||
it->setLayout(newtc[name]);
|
||||
|
@ -1605,12 +1605,12 @@ void Paragraph::setBeginOfBody()
|
||||
}
|
||||
|
||||
|
||||
bool Paragraph::forceEmptyLayout() const
|
||||
bool Paragraph::forcePlainLayout() const
|
||||
{
|
||||
Inset const * const inset = inInset();
|
||||
if (!inset)
|
||||
return true;
|
||||
return inset->forceEmptyLayout();
|
||||
return inset->forcePlainLayout();
|
||||
}
|
||||
|
||||
|
||||
@ -1623,12 +1623,12 @@ bool Paragraph::allowParagraphCustomization() const
|
||||
}
|
||||
|
||||
|
||||
bool Paragraph::useEmptyLayout() const
|
||||
bool Paragraph::usePlainLayout() const
|
||||
{
|
||||
Inset const * const inset = inInset();
|
||||
if (!inset)
|
||||
return false;
|
||||
return inset->useEmptyLayout();
|
||||
return inset->usePlainLayout();
|
||||
}
|
||||
|
||||
|
||||
@ -1822,7 +1822,7 @@ bool Paragraph::latex(BufferParams const & bparams,
|
||||
|
||||
bool return_value = false;
|
||||
|
||||
bool asdefault = forceEmptyLayout();
|
||||
bool asdefault = forcePlainLayout();
|
||||
|
||||
Layout const & style = asdefault ?
|
||||
bparams.documentClass().emptyLayout() :
|
||||
@ -2365,9 +2365,9 @@ void Paragraph::setLayout(Layout const & layout)
|
||||
}
|
||||
|
||||
|
||||
void Paragraph::setEmptyOrDefaultLayout(DocumentClass const & tclass)
|
||||
void Paragraph::setPlainOrDefaultLayout(DocumentClass const & tclass)
|
||||
{
|
||||
if (useEmptyLayout())
|
||||
if (usePlainLayout())
|
||||
setLayout(tclass.emptyLayout());
|
||||
else
|
||||
setLayout(tclass.defaultLayout());
|
||||
|
@ -156,11 +156,11 @@ public:
|
||||
///
|
||||
InsetCode ownerCode() const;
|
||||
///
|
||||
bool forceEmptyLayout() const;
|
||||
bool forcePlainLayout() const;
|
||||
///
|
||||
bool allowParagraphCustomization() const;
|
||||
///
|
||||
bool useEmptyLayout() const;
|
||||
bool usePlainLayout() const;
|
||||
///
|
||||
pos_type size() const;
|
||||
///
|
||||
@ -171,7 +171,7 @@ public:
|
||||
/// Do not pass a temporary to this!
|
||||
void setLayout(Layout const & layout);
|
||||
///
|
||||
void setEmptyOrDefaultLayout(DocumentClass const & tc);
|
||||
void setPlainOrDefaultLayout(DocumentClass const & tc);
|
||||
|
||||
/// This is the item depth, only used by enumerate and itemize
|
||||
signed char itemdepth;
|
||||
|
10
src/Text.cpp
10
src/Text.cpp
@ -102,10 +102,10 @@ void readParToken(Buffer const & buf, Paragraph & par, Lexer & lex,
|
||||
if (layoutname.empty())
|
||||
layoutname = tclass.defaultLayoutName();
|
||||
|
||||
if (par.forceEmptyLayout()) {
|
||||
if (par.forcePlainLayout()) {
|
||||
// in this case only the empty layout is allowed
|
||||
layoutname = tclass.emptyLayoutName();
|
||||
} else if (par.useEmptyLayout()) {
|
||||
} else if (par.usePlainLayout()) {
|
||||
// in this case, default layout maps to empty layout
|
||||
if (layoutname == tclass.defaultLayoutName())
|
||||
layoutname = tclass.emptyLayoutName();
|
||||
@ -121,7 +121,7 @@ void readParToken(Buffer const & buf, Paragraph & par, Lexer & lex,
|
||||
errorList.push_back(ErrorItem(_("Unknown layout"),
|
||||
bformat(_("Layout '%1$s' does not exist in textclass '%2$s'\nTrying to use the default instead.\n"),
|
||||
layoutname, from_utf8(tclass.name())), par.id(), 0, par.size()));
|
||||
layoutname = par.useEmptyLayout() ?
|
||||
layoutname = par.usePlainLayout() ?
|
||||
tclass.emptyLayoutName() :
|
||||
tclass.defaultLayoutName();
|
||||
}
|
||||
@ -1030,7 +1030,7 @@ bool Text::handleBibitems(Cursor & cur)
|
||||
}
|
||||
|
||||
// otherwise reset to default
|
||||
cur.paragraph().setEmptyOrDefaultLayout(bufparams.documentClass());
|
||||
cur.paragraph().setPlainOrDefaultLayout(bufparams.documentClass());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1120,7 +1120,7 @@ bool Text::backspacePos0(Cursor & cur)
|
||||
// or the empty layout.
|
||||
else if (par.layout() == prevpar.layout()
|
||||
|| tclass.isDefaultLayout(par.layout())
|
||||
|| tclass.isEmptyLayout(par.layout())) {
|
||||
|| tclass.isPlainLayout(par.layout())) {
|
||||
cur.recordUndo(ATOMIC_UNDO, prevcur.pit());
|
||||
mergeParagraph(bufparams, plist, prevcur.pit());
|
||||
needsUpdate = true;
|
||||
|
@ -224,7 +224,7 @@ static bool doInsertInset(Cursor & cur, Text * text,
|
||||
if (insetText && !insetText->allowMultiPar() || cur.lastpit() == 0) {
|
||||
// reset first par to default
|
||||
cur.text()->paragraphs().begin()
|
||||
->setEmptyOrDefaultLayout(bparams.documentClass());
|
||||
->setPlainOrDefaultLayout(bparams.documentClass());
|
||||
cur.pos() = 0;
|
||||
cur.pit() = 0;
|
||||
// Merge multiple paragraphs -- hack
|
||||
@ -232,7 +232,7 @@ static bool doInsertInset(Cursor & cur, Text * text,
|
||||
mergeParagraph(bparams, cur.text()->paragraphs(), 0);
|
||||
} else {
|
||||
// reset surrounding par to default
|
||||
docstring const layoutname = insetText->useEmptyLayout()
|
||||
docstring const layoutname = insetText->usePlainLayout()
|
||||
? bparams.documentClass().emptyLayoutName()
|
||||
: bparams.documentClass().defaultLayoutName();
|
||||
cur.leaveInset(*inset);
|
||||
@ -1007,10 +1007,10 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (layout.empty())
|
||||
layout = tclass.defaultLayoutName();
|
||||
|
||||
if (para.forceEmptyLayout())
|
||||
if (para.forcePlainLayout())
|
||||
// in this case only the empty layout is allowed
|
||||
layout = tclass.emptyLayoutName();
|
||||
else if (para.useEmptyLayout()) {
|
||||
else if (para.usePlainLayout()) {
|
||||
// in this case, default layout maps to empty layout
|
||||
if (layout == tclass.defaultLayoutName())
|
||||
layout = tclass.emptyLayoutName();
|
||||
@ -1398,7 +1398,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
// add a separate paragraph for the caption inset
|
||||
pars.push_back(Paragraph());
|
||||
pars.back().setInsetOwner(pars[0].inInset());
|
||||
pars.back().setEmptyOrDefaultLayout(tclass);
|
||||
pars.back().setPlainOrDefaultLayout(tclass);
|
||||
int cap_pit = pars.size() - 1;
|
||||
|
||||
// if an empty inset was created, we create an additional empty
|
||||
@ -1407,7 +1407,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (!content) {
|
||||
pars.push_back(Paragraph());
|
||||
pars.back().setInsetOwner(pars[0].inInset());
|
||||
pars.back().setEmptyOrDefaultLayout(tclass);
|
||||
pars.back().setPlainOrDefaultLayout(tclass);
|
||||
}
|
||||
|
||||
// reposition the cursor to the caption
|
||||
@ -1690,7 +1690,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
breakParagraph(cur);
|
||||
}
|
||||
|
||||
docstring const laystr = cur.inset().useEmptyLayout() ?
|
||||
docstring const laystr = cur.inset().usePlainLayout() ?
|
||||
tclass.emptyLayoutName() :
|
||||
tclass.defaultLayoutName();
|
||||
setLayout(cur, laystr);
|
||||
|
@ -1042,7 +1042,7 @@ bool TextClass::isDefaultLayout(Layout const & layout) const
|
||||
}
|
||||
|
||||
|
||||
bool TextClass::isEmptyLayout(Layout const & layout) const
|
||||
bool TextClass::isPlainLayout(Layout const & layout) const
|
||||
{
|
||||
return layout.name() == emptyLayoutName();
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public:
|
||||
///
|
||||
bool isDefaultLayout(Layout const &) const;
|
||||
///
|
||||
bool isEmptyLayout(Layout const &) const;
|
||||
bool isPlainLayout(Layout const &) const;
|
||||
/// returns a special layout for use when we don't really want one,
|
||||
/// e.g., in table cells
|
||||
Layout const & emptyLayout() const
|
||||
|
@ -1784,7 +1784,7 @@ int TextMetrics::leftMargin(int max_width,
|
||||
l_margin = leftMargin(max_width, newpar);
|
||||
}
|
||||
if (tclass.isDefaultLayout(par.layout())
|
||||
|| tclass.isEmptyLayout(par.layout())) {
|
||||
|| tclass.isPlainLayout(par.layout())) {
|
||||
if (pars[newpar].params().noindent())
|
||||
parindent.erase();
|
||||
else
|
||||
@ -1906,7 +1906,7 @@ int TextMetrics::leftMargin(int max_width,
|
||||
&& par.isInset(pos)
|
||||
&& par.getInset(pos)->display())
|
||||
&& (!(tclass.isDefaultLayout(par.layout())
|
||||
|| tclass.isEmptyLayout(par.layout()))
|
||||
|| tclass.isPlainLayout(par.layout()))
|
||||
|| buffer.params().paragraph_separation == BufferParams::ParagraphIndentSeparation)
|
||||
)
|
||||
{
|
||||
|
@ -607,7 +607,7 @@ void GuiLayoutBox::updateContents(bool reset)
|
||||
|
||||
for (; lit != len; ++lit) {
|
||||
docstring const & name = lit->name();
|
||||
bool const useEmpty = inset_->forceEmptyLayout() || inset_->useEmptyLayout();
|
||||
bool const useEmpty = inset_->forcePlainLayout() || inset_->usePlainLayout();
|
||||
// if this inset requires the empty layout, we skip the default
|
||||
// layout
|
||||
if (name == text_class_->defaultLayoutName() && inset_ && useEmpty)
|
||||
|
@ -354,10 +354,10 @@ public:
|
||||
virtual bool insetAllowed(InsetCode) const { return false; }
|
||||
/// should this inset use the empty layout by default rather than
|
||||
/// the standard layout? (default: only if that is forced.)
|
||||
virtual bool useEmptyLayout() const { return forceEmptyLayout(); }
|
||||
virtual bool usePlainLayout() const { return forcePlainLayout(); }
|
||||
/// if this inset has paragraphs should they be forced to use the
|
||||
/// empty layout?
|
||||
virtual bool forceEmptyLayout(idx_type = 0) const { return false; }
|
||||
virtual bool forcePlainLayout(idx_type = 0) const { return false; }
|
||||
/// if this inset has paragraphs should the user be allowed to
|
||||
/// customize alignment, etc?
|
||||
virtual bool allowParagraphCustomization(idx_type = 0) const { return true; }
|
||||
|
@ -96,7 +96,7 @@ BoxTranslatorLoc const & boxtranslator_loc()
|
||||
InsetBox::InsetBox(Buffer const & buffer, string const & label)
|
||||
: InsetCollapsable(buffer), params_(label)
|
||||
{
|
||||
if (forceEmptyLayout())
|
||||
if (forcePlainLayout())
|
||||
paragraphs().back().setLayout(buffer.params().documentClass().emptyLayout());
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ void InsetBox::metrics(MetricsInfo & m, Dimension & dim) const
|
||||
}
|
||||
|
||||
|
||||
bool InsetBox::forceEmptyLayout(idx_type) const
|
||||
bool InsetBox::forcePlainLayout(idx_type) const
|
||||
{
|
||||
return !params_.inner_box && params_.type != "Framed";
|
||||
}
|
||||
|
@ -105,9 +105,9 @@ private:
|
||||
///
|
||||
DisplayType display() const { return Inline; }
|
||||
///
|
||||
bool allowParagraphCustomization(idx_type = 0) { return forceEmptyLayout(); }
|
||||
bool allowParagraphCustomization(idx_type = 0) { return forcePlainLayout(); }
|
||||
///
|
||||
bool forceEmptyLayout(idx_type = 0) const;
|
||||
bool forcePlainLayout(idx_type = 0) const;
|
||||
///
|
||||
bool neverIndent() const { return true; }
|
||||
///
|
||||
|
@ -84,7 +84,7 @@ private:
|
||||
///
|
||||
void setParams(InsetBranchParams const & params) { params_ = params; }
|
||||
///
|
||||
virtual bool useEmptyLayout() { return false; }
|
||||
virtual bool usePlainLayout() { return false; }
|
||||
|
||||
/** \returns true if params_.branch is listed as 'selected' in
|
||||
\c buffer. This handles the case of child documents.
|
||||
@ -104,7 +104,7 @@ private:
|
||||
///
|
||||
docstring toolTip(BufferView const & bv, int x, int y) const;
|
||||
///
|
||||
bool useEmptyLayout() const { return false; }
|
||||
bool usePlainLayout() const { return false; }
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
///
|
||||
|
@ -73,7 +73,7 @@ private:
|
||||
///
|
||||
void addToToc(DocIterator const &);
|
||||
///
|
||||
virtual bool forceEmptyLayout(idx_type = 0) const { return true; }
|
||||
virtual bool forcePlainLayout(idx_type = 0) const { return true; }
|
||||
/// Captions don't accept alignment, spacing, etc.
|
||||
virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
|
||||
///
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
/// to name()
|
||||
void setLayout(DocumentClass const * const tc);
|
||||
///
|
||||
virtual bool useEmptyLayout() { return true; }
|
||||
virtual bool usePlainLayout() { return true; }
|
||||
///
|
||||
void read(Lexer &);
|
||||
///
|
||||
@ -144,7 +144,7 @@ public:
|
||||
/// Force inset into LTR environment if surroundings are RTL?
|
||||
virtual bool forceLTR() const { return layout_->isForceLtr(); }
|
||||
///
|
||||
virtual bool useEmptyLayout() const { return true; }
|
||||
virtual bool usePlainLayout() const { return true; }
|
||||
/// Is this inset's layout defined in the document's textclass?
|
||||
/// May be wrong after textclass change or paste from another document
|
||||
bool undefined() const;
|
||||
|
@ -63,7 +63,7 @@ private:
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
virtual bool forceEmptyLayout(idx_type = 0) const { return true; }
|
||||
virtual bool forcePlainLayout(idx_type = 0) const { return true; }
|
||||
///
|
||||
virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
|
||||
/// should paragraph indendation be omitted in any case?
|
||||
|
@ -2716,7 +2716,7 @@ InsetTableCell::InsetTableCell(Buffer const & buf,
|
||||
{}
|
||||
|
||||
|
||||
bool InsetTableCell::forceEmptyLayout(idx_type) const
|
||||
bool InsetTableCell::forcePlainLayout(idx_type) const
|
||||
{
|
||||
LASSERT(table_, /**/);
|
||||
LASSERT(cell_data_, /**/);
|
||||
@ -2736,7 +2736,7 @@ bool InsetTableCell::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
bool enabled;
|
||||
switch (cmd.action) {
|
||||
case LFUN_LAYOUT:
|
||||
enabled = !forceEmptyLayout();
|
||||
enabled = !forcePlainLayout();
|
||||
break;
|
||||
case LFUN_LAYOUT_PARAGRAPH:
|
||||
enabled = allowParagraphCustomization();
|
||||
@ -4697,7 +4697,7 @@ bool InsetTabular::allowParagraphCustomization(idx_type cell) const
|
||||
}
|
||||
|
||||
|
||||
bool InsetTabular::forceEmptyLayout(idx_type cell) const
|
||||
bool InsetTabular::forcePlainLayout(idx_type cell) const
|
||||
{
|
||||
return !tabular.getPWidth(cell).zero();
|
||||
}
|
||||
|
@ -636,9 +636,9 @@ public:
|
||||
///
|
||||
Inset * clone() { return new InsetTableCell(*this); }
|
||||
///
|
||||
virtual bool useEmptyLayout() const { return true; }
|
||||
virtual bool usePlainLayout() const { return true; }
|
||||
///
|
||||
virtual bool forceEmptyLayout(idx_type = 0) const;
|
||||
virtual bool forcePlainLayout(idx_type = 0) const;
|
||||
///
|
||||
virtual bool allowParagraphCustomization(idx_type = 0) const;
|
||||
///
|
||||
@ -746,9 +746,9 @@ public:
|
||||
/// should all paragraphs be output with "Standard" layout?
|
||||
virtual bool allowParagraphCustomization(idx_type cell = 0) const;
|
||||
///
|
||||
virtual bool forceEmptyLayout(idx_type cell = 0) const;
|
||||
virtual bool forcePlainLayout(idx_type cell = 0) const;
|
||||
///
|
||||
virtual bool useEmptyLayout() { return true; }
|
||||
virtual bool usePlainLayout() { return true; }
|
||||
///
|
||||
void addPreview(graphics::PreviewLoader &) const;
|
||||
|
||||
|
@ -98,7 +98,7 @@ void InsetText::initParagraphs(Buffer const & buf)
|
||||
buffer_ = const_cast<Buffer *>(&buf);
|
||||
paragraphs().push_back(Paragraph());
|
||||
Paragraph & ourpar = paragraphs().back();
|
||||
ourpar.setEmptyOrDefaultLayout(buf.params().documentClass());
|
||||
ourpar.setPlainOrDefaultLayout(buf.params().documentClass());
|
||||
ourpar.setInsetOwner(this);
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ TeXEnvironment(Buffer const & buf,
|
||||
|
||||
BufferParams const & bparams = buf.params();
|
||||
|
||||
Layout const & style = pit->forceEmptyLayout() ?
|
||||
Layout const & style = pit->forcePlainLayout() ?
|
||||
bparams.documentClass().emptyLayout() : pit->layout();
|
||||
|
||||
ParagraphList const & paragraphs = text.paragraphs();
|
||||
@ -309,7 +309,7 @@ TeXOnePar(Buffer const & buf,
|
||||
return nextpit;
|
||||
}
|
||||
|
||||
Layout const style = pit->forceEmptyLayout() ?
|
||||
Layout const style = pit->forcePlainLayout() ?
|
||||
bparams.documentClass().emptyLayout() : pit->layout();
|
||||
|
||||
OutputParams runparams = runparams_in;
|
||||
@ -784,7 +784,7 @@ void latexParagraphs(Buffer const & buf,
|
||||
// if only_body
|
||||
while (par != endpar) {
|
||||
lastpar = par;
|
||||
Layout const & layout = par->forceEmptyLayout() ?
|
||||
Layout const & layout = par->forcePlainLayout() ?
|
||||
tclass.emptyLayout() :
|
||||
par->layout();
|
||||
|
||||
|
@ -77,7 +77,7 @@ void breakParagraph(BufferParams const & bparams,
|
||||
tmp->setInsetOwner(par.inInset());
|
||||
// without doing that we get a crash when typing <Return> at the
|
||||
// end of a paragraph
|
||||
tmp->setEmptyOrDefaultLayout(bparams.documentClass());
|
||||
tmp->setPlainOrDefaultLayout(bparams.documentClass());
|
||||
|
||||
// layout stays the same with latex-environments
|
||||
if (keep_layout) {
|
||||
@ -142,7 +142,7 @@ void breakParagraph(BufferParams const & bparams,
|
||||
par.params().clear();
|
||||
// do not lose start of appendix marker (bug 4212)
|
||||
par.params().startOfAppendix(soa);
|
||||
par.setEmptyOrDefaultLayout(bparams.documentClass());
|
||||
par.setPlainOrDefaultLayout(bparams.documentClass());
|
||||
}
|
||||
|
||||
// layout stays the same with latex-environments
|
||||
|
Loading…
Reference in New Issue
Block a user