]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
More fixes to insettabular/text (and some missing features added).
[lyx.git] / src / text2.C
index 24ff26b183f8c25159986b91d1543562aa014915..16fe687dc3057cc29c3c0af02da180ff8c9a6ce2 100644 (file)
@@ -870,7 +870,7 @@ void LyXText::SetFont(BufferView * bview, LyXFont const & font, bool toggleall)
                        layoutfont = GetFont(bview->buffer(), cursor.par(),-1);
                // Update current font
                real_current_font.update(font,
-                                        bview->buffer()->params.language_info,
+                                        bview->buffer()->params.language,
                                         toggleall);
 
                // Reduce to implicit settings
@@ -914,7 +914,7 @@ void LyXText::SetFont(BufferView * bview, LyXFont const & font, bool toggleall)
                        LyXFont newfont = GetFont(bview->buffer(), 
                                                  cursor.par(), cursor.pos());
                        newfont.update(font,
-                                      bview->buffer()->params.language_info,
+                                      bview->buffer()->params.language,
                                       toggleall);
                        SetCharFont(bview->buffer(),
                                    cursor.par(), cursor.pos(), newfont);
@@ -1203,6 +1203,8 @@ string const LyXText::selectionAsString(Buffer const * buffer) const
 
 void LyXText::ClearSelection() const
 {
+       if (selection)
+               status = LyXText::NEED_MORE_REFRESH;
        selection = false;
        mark_set = false;
 }
@@ -1279,7 +1281,8 @@ void LyXText::ToggleFree(BufferView * bview,
        // If there is a change in the language the implicit word selection 
        // is disabled.
        LyXCursor resetCursor = cursor;
-       bool implicitSelection = (font.language() == ignore_language)
+       bool implicitSelection = (font.language() == ignore_language
+                                 && font.number() == LyXFont::IGNORE)
                ? SelectWordWhenUnderCursor(bview) : false;
 
        // Set font
@@ -1718,7 +1721,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
         // entry in the marginnote and the enclosing
         // environment is an enum/item then correct for the
         // LaTeX behaviour (ARRae)
-        if(par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
+        if (par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
           && par->footnotekind == LyXParagraph::MARGIN
            && par->Previous()
            && par->Previous()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE
@@ -2034,7 +2037,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
                                Floating const & fl
                                        = floatList.getType(tmp->type());
                                // We should get the correct number here too.
-                               s = fl.name + " #:";
+                               s = fl.name() + " #:";
                        } else {
                                /* par->SetLayout(0); 
                                   s = layout->labelstring;  */
@@ -2186,7 +2189,7 @@ void LyXText::CutSelection(BufferView * bview, bool doclear)
                return;
    
        // OK, we have a selection. This is always between sel_start_cursor
-       // and sel_end cursor
+       // and sel_end_cursor
 #ifndef NEW_INSETS
        // Check whether there are half footnotes in the selection
        if (sel_start_cursor.par()->footnoteflag != LyXParagraph::NO_FOOTNOTE
@@ -2660,7 +2663,7 @@ void LyXText::CheckParagraph(BufferView * bview, LyXParagraph * par,
        // is there a break one row above
        if (row->previous() && row->previous()->par() == row->par()) {
                z = NextBreakPoint(bview, row->previous(), workWidth(bview));
-               if ( z >= row->pos()) {
+               if (z >= row->pos()) {
                        // set the dimensions of the row above
                        y -= row->previous()->height();
                        refresh_y = y;
@@ -2671,7 +2674,8 @@ void LyXText::CheckParagraph(BufferView * bview, LyXParagraph * par,
                        
                        // set the cursor again. Otherwise
                        // dangling pointers are possible
-                       SetCursor(bview, cursor.par(), cursor.pos());
+                       SetCursor(bview, cursor.par(), cursor.pos(),
+                                 false, cursor.boundary());
                        sel_cursor = cursor;
                        return;
                }
@@ -2706,20 +2710,25 @@ void LyXText::CheckParagraph(BufferView * bview, LyXParagraph * par,
    
        if (selection) {
                tmpcursor = cursor;
-               SetCursorIntern(bview, sel_cursor.par(), sel_cursor.pos());
+               SetCursorIntern(bview, sel_cursor.par(), sel_cursor.pos(),
+                               false, sel_cursor.boundary());
                sel_cursor = cursor; 
                SetCursorIntern(bview, sel_start_cursor.par(),
-                               sel_start_cursor.pos());
+                               sel_start_cursor.pos(),
+                               false, sel_start_cursor.boundary());
                sel_start_cursor = cursor; 
                SetCursorIntern(bview, sel_end_cursor.par(),
-                               sel_end_cursor.pos());
+                               sel_end_cursor.pos(),
+                               false, sel_end_cursor.boundary());
                sel_end_cursor = cursor; 
                SetCursorIntern(bview, last_sel_cursor.par(),
-                               last_sel_cursor.pos());
+                               last_sel_cursor.pos(),
+                               false, last_sel_cursor.boundary());
                last_sel_cursor = cursor; 
                cursor = tmpcursor;
        }
-       SetCursorIntern(bview, cursor.par(), cursor.pos());
+       SetCursorIntern(bview, cursor.par(), cursor.pos(),
+                       false, cursor.boundary());
 }
 
 
@@ -3091,7 +3100,7 @@ void LyXText::DeleteEmptyParagraphMechanism(BufferView * bview,
        LyXCursor tmpcursor;
 
        if (old_cursor.par() != cursor.par()) {
-               if ( (old_cursor.par()->Last() == 0
+               if ((old_cursor.par()->Last() == 0
                      || (old_cursor.par()->Last() == 1
                          && old_cursor.par()->IsLineSeparator(0)))
 #ifndef NEW_INSETS
@@ -3498,9 +3507,9 @@ Undo * LyXText::CreateUndo(Buffer * buf, Undo::undo_kind kind,
                        end = end->next;
        }
 
-       if (start && end
-           && start != end->next
-           && (before != behind || (!before && !behind))) {
+       if (start && end && (start != end->next) &&
+           ((before != behind) || (!before && !behind)))
+       {
                tmppar = start;
                tmppar2 = tmppar->Clone();
                tmppar2->id(tmppar->id());