]> git.lyx.org Git - lyx.git/blobdiff - src/figureForm.C
fix build, thesaurus
[lyx.git] / src / figureForm.C
index 4f6cd057599871dacbc83f1b2a66d6ec45c4f905..6361915fb09954c4a81bef49aaa811e144ac853a 100644 (file)
@@ -4,7 +4,7 @@
  *           LyX, The Document Processor
  *      
  *         Copyright 1995 Matthias Ettrich,
- *          Copyright 1995-2000 The LyX Team.
+ *          Copyright 1995-2001 The LyX Team.
  *
  * ====================================================== */
 
@@ -22,6 +22,7 @@
 #include "BufferView.h"
 #include "lyxtext.h"
 #include "LyXView.h"
+#include "undo_funcs.h"
 #include "gettext.h"
 
 extern FD_form_figure * fd_form_figure;
@@ -40,7 +41,8 @@ void Figure()
 
 
 /* callbacks for form form_figure */
-extern "C"
+extern "C" {
+       
 void FigureApplyCB(FL_OBJECT *, long)
 {
        if (!current_view->available())
@@ -55,7 +57,7 @@ void FigureApplyCB(FL_OBJECT *, long)
                InsetFig * new_inset = new InsetFig(100, 20, *buffer);
                current_view->insertInset(new_inset);
                current_view->owner()->message(_("Figure inserted"));
-               new_inset->Edit(current_view, 0, 0, 0);
+               new_inset->edit(current_view, 0, 0, 0);
                return;
        }
        
@@ -63,73 +65,50 @@ void FigureApplyCB(FL_OBJECT *, long)
        current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR);
        current_view->beforeChange(current_view->text);
       
-       current_view->text->SetCursorParUndo(current_view->buffer()); 
-       current_view->text->FreezeUndo();
+       setCursorParUndo(current_view); 
+       freezeUndo();
 
-       current_view->text->BreakParagraph(current_view);
+       current_view->text->breakParagraph(current_view);
        current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
 
-#ifndef NEW_INSETS
-       if (current_view->text->cursor.par()->Last()) {
-#else
        if (current_view->text->cursor.par()->size()) {
-#endif
-               current_view->text->CursorLeft(current_view);
+               current_view->text->cursorLeft(current_view);
         
-               current_view->text->BreakParagraph(current_view);
+               current_view->text->breakParagraph(current_view);
                current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
        }
 
        // The standard layout should always be numer 0;
-       current_view->text->SetLayout(current_view, 0);
-
-#ifndef NEW_INSETS
-       if (current_view->text->cursor.par()->footnoteflag == 
-           LyXParagraph::NO_FOOTNOTE) {
-#endif
-               current_view->text->
-                       SetParagraph(current_view, 0, 0,
-                                    0, 0,
-                                    VSpace (0.3 * buffer->params.spacing.getValue(),
-                                            LyXLength::CM),
-                                    VSpace (0.3 *
-                                            buffer->params.spacing.getValue(),
-                                            LyXLength::CM),
-                                    LYX_ALIGN_CENTER, string(), 0);
-#ifndef NEW_INSETS
-       } else {
-               current_view->text->SetParagraph(current_view, 0, 0,
-                                                0, 0,
-                                                VSpace(VSpace::NONE),
-                                                VSpace(VSpace::NONE),
-                                                LYX_ALIGN_CENTER, 
-                                                string(),
-                                                0);
-       }
-#endif
+       current_view->text->setLayout(current_view, 0);
+
+       LyXLength len(0.3 * buffer->params.spacing.getValue(), LyXLength::CM);
+       current_view->text->setParagraph(current_view, 0, 0, 0, 0,
+               VSpace(len), VSpace(len), Spacing(),
+               LYX_ALIGN_CENTER, string(), 0);
        
        current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
       
        Inset * new_inset = new InsetFig(100, 100, *buffer);
        current_view->insertInset(new_inset);
-       new_inset->Edit(current_view, 0, 0, 0);
+       new_inset->edit(current_view, 0, 0, 0);
        current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR);
        current_view->owner()->message(_("Figure inserted"));
-       current_view->text->UnFreezeUndo();
+       unFreezeUndo();
        current_view->setState();
 }
 
 
-extern "C"
 void FigureCancelCB(FL_OBJECT *, long)
 {
        fl_hide_form(fd_form_figure->form_figure);
 }
 
 
-extern "C"
 void FigureOKCB(FL_OBJECT * ob, long data)
 {
        FigureApplyCB(ob, data);
        FigureCancelCB(ob, data);
 }
+
+}
+