Make LYX_ALIGN_LAYOUT always be available. (Trunk committed at r19332).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@19810 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2007-08-26 19:55:46 +00:00
parent 85c58e0337
commit 896b797e05
5 changed files with 13 additions and 13 deletions

View File

@ -115,7 +115,7 @@ Layout::Layout ()
labelbottomsep = 0.0;
parsep = 0;
align = LYX_ALIGN_BLOCK;
alignpossible = LYX_ALIGN_BLOCK;
alignpossible = LYX_ALIGN_NONE | LYX_ALIGN_LAYOUT;
labeltype = LABEL_NO_LABEL;
endlabeltype = END_LABEL_NO_LABEL;
// Should or should not. That is the question.
@ -552,7 +552,7 @@ void Layout::readAlignPossible(Lexer & lexrc)
};
lexrc.pushTable(alignTags, AT_LAYOUT);
alignpossible = LYX_ALIGN_NONE;
alignpossible = LYX_ALIGN_NONE | LYX_ALIGN_LAYOUT;
int lineno = lexrc.getLineNo();
do {
int le = lexrc.lex();

View File

@ -78,6 +78,13 @@ void operator|=(LyXAlignment & la1, LyXAlignment la2) {
}
///
inline
LyXAlignment operator|(LyXAlignment la1, LyXAlignment la2) {
return static_cast<LyXAlignment>(static_cast<int>(la1) | static_cast<int>(la2));
}
/// The different LaTeX-Types
enum LYX_LATEX_TYPES {
///

View File

@ -1685,10 +1685,8 @@ void Paragraph::applyLayout(Layout_ptr const & new_layout)
{
layout(new_layout);
LyXAlignment const oldAlign = params().align();
// FIXME The first check is due to the fact that LYX_ALIGN_LAYOUT
// is not required to be possible. A fix is on the way.
if ((oldAlign != LYX_ALIGN_LAYOUT) &&
!(oldAlign & layout()->alignpossible)) {
if (!(oldAlign & layout()->alignpossible)) {
frontend::Alert::warning(_("Alignment not permitted"),
_("The new layout does not permit the alignment previously used.\nSetting to default."));
params().align(LYX_ALIGN_LAYOUT);

View File

@ -253,8 +253,7 @@ void ParagraphParameters::apply(
{
spacing(p.spacing());
// does the layout allow the new alignment?
if ((p.align() == LYX_ALIGN_LAYOUT) ||
(p.align() & layout.alignpossible))
if (p.align() & layout.alignpossible)
align(p.align());
labelWidthString(p.labelWidthString());
noindent(p.noindent());

View File

@ -117,11 +117,7 @@ void QParagraphDialog::checkAlignmentRadioButtons() {
QPRadioMap::iterator it = radioMap.begin();
for (; it != radioMap.end(); ++it) {
LyXAlignment const align = it->first;
//FIXME The reason we need the second check is because
//LYX_ALIGN_LAYOUT isn't required to be possible. It
//should be...and will be.
it->second->setEnabled((align & alignPossible) ||
(align == LYX_ALIGN_LAYOUT));
it->second->setEnabled(align & alignPossible);
}
docstring label = labelMap[LYX_ALIGN_LAYOUT];
if (!form_->controller().haveMulitParSelection())