]> git.lyx.org Git - features.git/commitdiff
Make LYX_ALIGN_LAYOUT always be an available layout. This simplifies a couple
authorRichard Heck <rgheck@comcast.net>
Mon, 6 Aug 2007 05:04:38 +0000 (05:04 +0000)
committerRichard Heck <rgheck@comcast.net>
Mon, 6 Aug 2007 05:04:38 +0000 (05:04 +0000)
chunks of code and makes a lot of sense.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19332 a592a061-630c-0410-9148-cb99ea01b6c8

src/Layout.cpp
src/Layout.h
src/Paragraph.cpp
src/Text2.cpp
src/frontends/qt4/QParagraph.cpp

index 96acc0e087592e545ece7cd4f6b642fa4c89bf31..4d0a468d2b8b1980f1e0baa76c25e7951faf5598 100644 (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();
index 91850d10c4c6fec1ad20f04aca88ab6a27499a54..eca24dcc8d821b77fbf09cc24621d42fc53b26ba 100644 (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 {
        ///
index f669ca7c954487ee29bfc460ad207b1984732a74..a07f33eca7807fe6f508916e1a7cf98fd82a1a4d 100644 (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);
index 38aba0b4e2896abc2122fcb436d8b18f54038553..7b1206a96c040009eeedf117ced332f8ff8ae174 100644 (file)
@@ -649,12 +649,8 @@ void Text::setParagraph(Cursor & cur,
                params.spacing(spacing);
 
                // does the layout allow the new alignment?
-               //FIXME The reason we need the first check is because
-               //LYX_ALIGN_LAYOUT isn't required to be possible. It
-               //should be...and will be.
-               if ((align == LYX_ALIGN_LAYOUT) ||
-                   (align & par.layout()->alignpossible))
-                       params.align(align);
+               if (align & par.layout()->alignpossible)
+                       params.align(align);
                par.setLabelWidthString(labelwidthstring);
                params.noindent(noindent);
        }
index 61aace7310d268f0b69370af3dec965066451808..d31c4df4516094837b0bd96c5c8b17d068242eeb 100644 (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())