]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
Small fix.
[lyx.git] / src / BufferView_pimpl.C
index f9082ab94e1cbd82a138841eadca79268e64eb0c..f7151736c66e9f50dea2a17302f50f1d1937e026 100644 (file)
 #include "TextCache.h"
 #include "bufferlist.h"
 #include "insets/insetbib.h"
-#include "menus.h"
 #include "lyx_gui_misc.h"
 #include "lyxrc.h"
 #include "intl.h"
 #include "support/LAssert.h"
 #include "frontends/Dialogs.h"
-#include "insets/insetcite.h"
+#ifndef NEW_MENUBAR
+# include "menus.h"
+#endif
 
 #ifdef SIGC_CXX_NAMESPACES
 using SigC::slot;
@@ -45,6 +46,7 @@ bool selection_possible = false;
 extern BufferList bufferlist;
 extern char ascii_type;
 
+extern "C" void TimerCB(FL_OBJECT *, long); 
 extern void sigchldhandler(pid_t pid, int * status);
 extern int bibitemMaxWidth(BufferView *, LyXFont const &);
 
@@ -131,7 +133,6 @@ void BufferView::Pimpl::buffer(Buffer * b)
        if (buffer_) {
                lyxerr[Debug::INFO] << "Buffer addr: " << buffer_ << endl;
                buffer_->addUser(bv_);
-               owner_->getMenus()->showMenus();
                // If we don't have a text object for this, we make one
                if (bv_->text == 0) {
                        resizeCurrentBuffer();
@@ -140,12 +141,23 @@ void BufferView::Pimpl::buffer(Buffer * b)
                        updateScrollbar();
                }
                bv_->text->first = screen_->TopCursorVisible(bv_->text);
+#ifdef NEW_MENUBAR
+               owner_->updateMenubar();
+#else
+               owner_->getMenus()->showMenus();
+#endif
+               owner_->updateToolbar();
                redraw();
                owner_->getDialogs()->updateBufferDependent();
                bv_->insetWakeup();
        } else {
                lyxerr[Debug::INFO] << "  No Buffer!" << endl;
+#ifdef NEW_MENUBAR
+               owner_->updateMenubar();
+#else
                owner_->getMenus()->hideMenus();
+#endif
+               owner_->updateToolbar();
                updateScrollbar();
                workarea_->redraw();
 
@@ -271,10 +283,8 @@ int BufferView::Pimpl::resizeCurrentBuffer()
                }
        }
        bv_->text->first = screen_->TopCursorVisible(bv_->text);
-       /* this will scroll the
-        * screen such that the
-        * cursor becomes
-        * visible */ 
+       buffer_->resizeInsets(bv_);
+       // this will scroll the screen such that the cursor becomes visible
        updateScrollbar();
        redraw();
        owner_->getMiniBuffer()->Init();
@@ -757,7 +767,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
        if (button >= 2) return;
 
        bv_->setState();
-       owner_->getMiniBuffer()->Set(CurrentState(bv_));
+       owner_->showState();
 
        // Did we hit an editable inset?
        if (inset_hit != 0) {
@@ -790,18 +800,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
                        inset->InsetButtonRelease(bv_, x, y, button);
                } else {
                        inset_hit->InsetButtonRelease(bv_, x, y, button);
-
-                       switch( inset_hit->LyxCode() ) {
-                       case Inset::CITATION_CODE:
-                       {
-                               owner_->getDialogs()->
-                                       showCitation( (InsetCitation *)inset_hit );
-                       }
-                       break;
-                       default:
-                               inset_hit->Edit(bv_, x, y, button);
-                       break;
-                       }
+                       inset_hit->Edit(bv_, x, y, button);
                }
                return;
        }
@@ -815,6 +814,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
                        c = bv_->text->cursor.par()->
                                GetChar(bv_->text->cursor.pos());
                }
+#ifndef NEW_INSETS
                if (c == LyXParagraph::META_FOOTNOTE
                    || c == LyXParagraph::META_MARGIN
                    || c == LyXParagraph::META_FIG
@@ -823,9 +823,12 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
                    || c == LyXParagraph::META_WIDE_TAB
                     || c == LyXParagraph::META_ALGORITHM){
                        hit = true;
-               } else if (bv_->text->cursor.pos() - 1 >= 0) {
+               } else
+#endif
+                       if (bv_->text->cursor.pos() - 1 >= 0) {
                        c = bv_->text->cursor.par()->
                                GetChar(bv_->text->cursor.pos() - 1);
+#ifndef NEW_INSETS
                        if (c == LyXParagraph::META_FOOTNOTE
                            || c == LyXParagraph::META_MARGIN
                            || c == LyXParagraph::META_FIG
@@ -837,14 +840,18 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
                                bv_->text->CursorLeft(bv_);
                                hit = true;
                        }
+#endif
                }
                if (hit == true) {
+#ifndef NEW_INSETS
                        bv_->toggleFloat();
+#endif
                        selection_possible = false;
                        return;
                }
        }
 
+#ifndef NEW_INSETS
        // Do we want to close a float? (click on the float-label)
        if (bv_->text->cursor.row()->par()->footnoteflag == 
            LyXParagraph::OPEN_FOOTNOTE
@@ -870,6 +877,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
                        return;
                }
        }
+#endif
 
        // Maybe we want to edit a bibitem ale970302
        if (bv_->text->cursor.par()->bibkey && x < 20 +