]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
remove more forms.h cruft
[lyx.git] / src / text2.C
index 4a451e408931f714205905fc2a2d6c0c4f22bd64..749911ab15b9c2df6485c8e483877f003046ee8c 100644 (file)
@@ -10,9 +10,6 @@
 
 #include <config.h>
 
-#include FORMS_H_LOCATION
-
-
 #ifdef __GNUG__
 #pragma implementation "lyxtext.h"
 #endif
@@ -261,11 +258,11 @@ void LyXText::setCharFont(BufferView * bv, Paragraph * par,
        if (par->getChar(pos) == Paragraph::META_INSET) {
                Inset * inset = par->getInset(pos);
                if (inset) {
-                       if (inset->Editable()==Inset::HIGHLY_EDITABLE) {
+                       if (inset->editable()==Inset::HIGHLY_EDITABLE) {
                                UpdatableInset * uinset = static_cast<UpdatableInset *>(inset);
-                               uinset->SetFont(bv, fnt, toggleall, true);
+                               uinset->setFont(bv, fnt, toggleall, true);
                        }
-                       font = inset->ConvertFont(font);
+                       font = inset->convertFont(font);
                }
        }
 
@@ -307,7 +304,7 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par,
        LyXFont font(fnt);
        // Let the insets convert their font
        if (par->getChar(pos) == Paragraph::META_INSET) {
-               font = par->getInset(pos)->ConvertFont(font);
+               font = par->getInset(pos)->convertFont(font);
        }
 
        LyXLayout const & layout =
@@ -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;
@@ -972,7 +1002,7 @@ void LyXText::setSelection(BufferView * bview)
                selection.set(false);
 
        if (inset_owner && (selection.set() || lsel))
-               inset_owner->SetUpdateStatus(bview, InsetText::SELECTION);
+               inset_owner->setUpdateStatus(bview, InsetText::SELECTION);
 }
 
 
@@ -1087,7 +1117,7 @@ void LyXText::toggleFree(BufferView * bview,
                selection.cursor = cursor;
        }
        if (inset_owner)
-               inset_owner->SetUpdateStatus(bview, InsetText::CURSOR_PAR);
+               inset_owner->setUpdateStatus(bview, InsetText::CURSOR_PAR);
 }
 
 
@@ -1545,7 +1575,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
                // the caption hack:
                if (layout.labeltype == LABEL_SENSITIVE) {
                        bool isOK (par->InInset() && par->InInset()->owner() &&
-                                  (par->InInset()->owner()->LyxCode() == Inset::FLOAT_CODE));
+                                  (par->InInset()->owner()->lyxCode() == Inset::FLOAT_CODE));
                        
                        if (isOK) {
                                InsetFloat * tmp = static_cast<InsetFloat*>(par->InInset()->owner());
@@ -1623,7 +1653,7 @@ void LyXText::insertInset(BufferView * bview, Inset * inset)
        // inset now after the Undo LyX tries to call inset->Edit(...) again
        // and cannot do this as the cursor is behind the inset and GetInset
        // does not return the inset!
-       if (inset->Editable() == Inset::HIGHLY_EDITABLE) {
+       if (inset->editable() == Inset::HIGHLY_EDITABLE) {
                cursorLeft(bview, true);
        }
 #endif
@@ -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);
@@ -1958,7 +1982,7 @@ bool LyXText::gotoNextInset(BufferView * bview,
        } while (res.par() && 
                 !(res.par()->getChar(res.pos()) == Paragraph::META_INSET
                   && (inset = res.par()->getInset(res.pos())) != 0
-                  && find(codes.begin(), codes.end(), inset->LyxCode())
+                  && find(codes.begin(), codes.end(), inset->lyxCode())
                      != codes.end()
                   && (contents.empty() ||
                       static_cast<InsetCommand *>(res.par()->getInset(res.pos()))->getContents()