]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
remove more forms.h cruft
[lyx.git] / src / text2.C
index 471a65be75f117113a32f860b7f472397c35baf7..749911ab15b9c2df6485c8e483877f003046ee8c 100644 (file)
@@ -10,9 +10,6 @@
 
 #include <config.h>
 
-#include FORMS_H_LOCATION
-
-
 #ifdef __GNUG__
 #pragma implementation "lyxtext.h"
 #endif
@@ -761,6 +758,8 @@ void LyXText::redoHeightOfParagraph(BufferView * bview, LyXCursor const & cur)
        int y = cur.y() - tmprow->baseline();
 
        setHeightOfRow(bview, tmprow);
+       
+#if 0
        Paragraph * first_phys_par = tmprow->par();
 
        // find the first row of the paragraph
@@ -776,6 +775,13 @@ void LyXText::redoHeightOfParagraph(BufferView * bview, LyXCursor const & cur)
                y -= tmprow->height();
                setHeightOfRow(bview, tmprow);
        }
+#else
+       while (tmprow->previous() && tmprow->previous()->par() == tmprow->par()) {
+               tmprow = tmprow->previous();
+               y -= tmprow->height();
+               setHeightOfRow(bview, tmprow);
+       }
+#endif
        
        // we can set the refreshing parameters now
        status = LyXText::NEED_MORE_REFRESH;
@@ -791,6 +797,8 @@ void LyXText::redoDrawingOfParagraph(BufferView * bview, LyXCursor const & cur)
    
        int y = cur.y() - tmprow->baseline();
        setHeightOfRow(bview, tmprow);
+
+#if 0
        Paragraph * first_phys_par = tmprow->par();
 
        // find the first row of the paragraph
@@ -803,7 +811,12 @@ void LyXText::redoDrawingOfParagraph(BufferView * bview, LyXCursor const & cur)
                tmprow = tmprow->previous();
                y -= tmprow->height();
        }
-   
+#else
+       while (tmprow->previous() && tmprow->previous()->par() == tmprow->par())  {
+               tmprow = tmprow->previous();
+               y -= tmprow->height();
+       }
+#endif
        // we can set the refreshing parameters now
        if (status == LyXText::UNCHANGED || y < refresh_y) {
                refresh_y = y;
@@ -821,13 +834,15 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
                             Paragraph const * endpar) const
 {
        Row * tmprow2;
-       Paragraph * tmppar = 0, * first_phys_par = 0;
+       Paragraph * tmppar = 0;
+       Paragraph * first_phys_par = 0;
    
        Row * tmprow = cur.row();
    
        int y = cur.y() - tmprow->baseline();
-   
-       if (!tmprow->previous()){
+
+#if 0
+       if (!tmprow->previous()) {
                first_phys_par = firstParagraph();   // a trick/hack for UNDO
        } else {
                first_phys_par = tmprow->par();
@@ -844,7 +859,22 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
                        y -= tmprow->height();
                }
        }
-   
+#else
+       if (!tmprow->previous()) {
+               // a trick/hack for UNDO
+               // Can somebody please tell me _why_ this solves
+               // anything. (Lgb)
+               first_phys_par = firstParagraph();
+       } else {
+               first_phys_par = tmprow->par();
+               while (tmprow->previous()
+                      && tmprow->previous()->par() == first_phys_par) {
+                       tmprow = tmprow->previous();
+                       y -= tmprow->height();
+               }
+       }
+#endif
+       
        // we can set the refreshing parameters now
        status = LyXText::NEED_MORE_REFRESH;
        refresh_y = y;
@@ -1678,22 +1708,20 @@ void LyXText::cutSelection(BufferView * bview, bool doclear)
                selection.start.par()->previous(),
                undoendpar);
     
-       CutAndPaste cap;
-
        // there are two cases: cut only within one paragraph or
        // more than one paragraph
        if (selection.start.par() == selection.end.par()) {
                // only within one paragraph
                endpar = selection.end.par();
                int pos = selection.end.pos();
-               cap.cutSelection(selection.start.par(), &endpar,
+               CutAndPaste::cutSelection(selection.start.par(), &endpar,
                                 selection.start.pos(), pos,
                                 bview->buffer()->params.textclass, doclear);
                selection.end.pos(pos);
        } else {
                endpar = selection.end.par();
                int pos = selection.end.pos();
-               cap.cutSelection(selection.start.par(), &endpar,
+               CutAndPaste::cutSelection(selection.start.par(), &endpar,
                                 selection.start.pos(), pos,
                                 bview->buffer()->params.textclass, doclear);
                cursor.par(endpar);
@@ -1748,9 +1776,7 @@ void LyXText::copySelection(BufferView * bview)
                   || selection.start.pos() < selection.end.pos()))
                selection.start.pos(selection.start.pos() + 1); 
 
-       CutAndPaste cap;
-
-       cap.copySelection(selection.start.par(), selection.end.par(),
+       CutAndPaste::copySelection(selection.start.par(), selection.end.par(),
                          selection.start.pos(), selection.end.pos(),
                          bview->buffer()->params.textclass);
 }
@@ -1758,10 +1784,8 @@ void LyXText::copySelection(BufferView * bview)
 
 void LyXText::pasteSelection(BufferView * bview)
 {
-       CutAndPaste cap;
-
        // this does not make sense, if there is nothing to paste
-       if (!cap.checkPastePossible(cursor.par()))
+       if (!CutAndPaste::checkPastePossible(cursor.par()))
                return;
 
        setUndo(bview->buffer(), Undo::INSERT,
@@ -1772,7 +1796,7 @@ void LyXText::pasteSelection(BufferView * bview)
        Paragraph * actpar = cursor.par();
 
        int pos = cursor.pos();
-       cap.pasteSelection(&actpar, &endpar, pos,
+       CutAndPaste::pasteSelection(&actpar, &endpar, pos,
                           bview->buffer()->params.textclass);
     
        redoParagraphs(bview, cursor, endpar);