]> git.lyx.org Git - lyx.git/blobdiff - src/Text.cpp
adjust
[lyx.git] / src / Text.cpp
index 9fde15b3a2429dd00f17f65497d743693b14565f..c6c1d1dc875536ebd27fa47c61feef20ca450f76 100644 (file)
@@ -45,6 +45,7 @@
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
 #include "Undo.h"
+#include "TextMetrics.h"
 #include "VSpace.h"
 #include "WordLangTuple.h"
 
@@ -68,6 +69,7 @@
 #include "support/convert.h"
 
 #include <boost/current_function.hpp>
+#include <boost/next_prior.hpp>
 
 #include <sstream>
 
@@ -356,7 +358,7 @@ double Text::spacing(Buffer const & buffer,
 }
 
 
-void Text::breakParagraph(Cursor & cur, bool keep_layout)
+void Text::breakParagraph(Cursor & cur, bool inverse_logic)
 {
        BOOST_ASSERT(this == cur.text());
 
@@ -381,11 +383,9 @@ void Text::breakParagraph(Cursor & cur, bool keep_layout)
                cpar.eraseChar(cur.pos(), cur.buffer().params().trackChanges);
 
        // What should the layout for the new paragraph be?
-       int preserve_layout = 0;
-       if (keep_layout)
-               preserve_layout = 2;
-       else
-               preserve_layout = layout->isEnvironment();
+       bool keep_layout = inverse_logic ? 
+               !layout->isEnvironment() 
+               : layout->isEnvironment();
 
        // We need to remember this before we break the paragraph, because
        // that invalidates the layout variable
@@ -395,7 +395,7 @@ void Text::breakParagraph(Cursor & cur, bool keep_layout)
        bool const isempty = cpar.allowEmpty() && cpar.empty();
 
        lyx::breakParagraph(cur.buffer().params(), paragraphs(), cpit,
-                        cur.pos(), preserve_layout);
+                        cur.pos(), keep_layout);
 
        // After this, neither paragraph contains any rows!
 
@@ -521,7 +521,7 @@ void Text::insertChar(Cursor & cur, char_type c)
                        // adjacent character whose direction is the paragraph's
                        // direction; don't touch other properties of the font
                        Language const * lang = 
-                               (pre_space_rtl == par.isRightToLeftPar(buffer.params())) ?
+                               (pre_space_rtl == par.isRTL(buffer.params())) ?
                                pre_space_font.language() : post_space_font.language();
 
                        Font space_font = tm.getDisplayFont(cur.pit(), cur.pos() - 1);
@@ -1141,7 +1141,7 @@ bool Text::dissolveInset(Cursor & cur) {
                                        b.getLanguage());
                }
 
-               pasteParagraphList(cur, plist, b.params().getTextClass_ptr(),
+               pasteParagraphList(cur, plist, b.params().getTextClassPtr(),
                                   b.errorList("Paste"));
                // restore position
                cur.pit() = std::min(cur.lastpit(), spit);
@@ -1376,17 +1376,17 @@ docstring Text::getPossibleLabel(Cursor & cur) const
                name = from_ascii(layout->latexname());
 
        // for captions, we just take the caption type
-       Inset * caption_inset = cur.innerInsetOfType(Inset::CAPTION_CODE);
+       Inset * caption_inset = cur.innerInsetOfType(CAPTION_CODE);
        if (caption_inset)
                name = from_ascii(static_cast<InsetCaption *>(caption_inset)->type());
 
        // If none of the above worked, we'll see if we're inside various
        // types of insets and take our abbreviation from them.
        if (name.empty()) {
-               Inset::Code const codes[] = {
-                       Inset::FLOAT_CODE,
-                       Inset::WRAP_CODE,
-                       Inset::FOOT_CODE
+               InsetCode const codes[] = {
+                       FLOAT_CODE,
+                       WRAP_CODE,
+                       FOOT_CODE
                };
                for (unsigned int i = 0; i < (sizeof codes / sizeof codes[0]); ++i) {
                        Inset * float_inset = cur.innerInsetOfType(codes[i]);