]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/WorkArea.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / WorkArea.C
index 277e3ee560dd15d016f7b482d0f5e5f447158470..aa4089a26cffe60a294cd48de75149ace8e9f1c5 100644 (file)
 #include "graphics/GraphicsImage.h"
 #include "graphics/GraphicsLoader.h"
 
+#include "gettext.h"
 #include "support/filetools.h" // LibFileSearch
 #include "support/forkedcontr.h"
 
 #include <boost/utility.hpp>
 #include <boost/bind.hpp>
 #include <boost/current_function.hpp>
-#include <boost/signals/trackable.hpp>
 
 using lyx::support::libFileSearch;
 using lyx::support::ForkedcallsController;
@@ -159,9 +159,21 @@ WorkArea::WorkArea(LyXView & lyx_view)
 
 void WorkArea::setBufferView(BufferView * buffer_view)
 {
+       if (buffer_view_) {
+               message_connection_.disconnect();
+               lyx_view_.disconnectBufferView();
+       }
+
+       theApp->setBufferView(buffer_view);
+
        hideCursor();
        buffer_view_ = buffer_view;
        toggleCursor();
+
+       message_connection_ = buffer_view_->message.connect(
+                       boost::bind(&WorkArea::displayMessage, this, _1));
+
+       lyx_view_.connectBufferView(*buffer_view);
 }
 
 
@@ -191,6 +203,7 @@ void WorkArea::redraw()
 
        if (!buffer_view_->buffer()) {
                greyOut();
+               updateScrollbar();
                return;
        }
 
@@ -228,7 +241,7 @@ void WorkArea::processKeySym(LyXKeySymPtr key,
         * of the cursor. Note we cannot do this inside
         * dispatch() itself, because that's called recursively.
         */
-//     if (buffer_view_->available())
+//     if (buffer_view_->buffer())
        toggleCursor();
        
        // uneeded "redraw()" call commented out for now.
@@ -251,6 +264,7 @@ void WorkArea::dispatch(FuncRequest const & cmd0)
        // Skip these when selecting
        if (cmd0.action != LFUN_MOUSE_MOTION) {
                lyx_view_.updateLayoutChoice();
+               lyx_view_.updateMenubar();
                lyx_view_.updateToolbars();
        }
 
@@ -265,9 +279,13 @@ void WorkArea::dispatch(FuncRequest const & cmd0)
 
 void WorkArea::resizeBufferView()
 {
+       lyx_view_.busy(true);
+       lyx_view_.message(_("Formatting document..."));
        buffer_view_->workAreaResize(width(), height());
        lyx_view_.updateLayoutChoice();
        redraw();
+       lyx_view_.busy(false);
+       lyx_view_.clearMessage();
 }
 
 
@@ -332,7 +350,7 @@ void WorkArea::showCursor()
        if (cursor_visible_)
                return;
 
-       if (!buffer_view_->available())
+       if (!buffer_view_->buffer())
                return;
 
        CursorShape shape = BAR_SHAPE;
@@ -400,5 +418,11 @@ void WorkArea::toggleCursor()
        cursor_timeout_.restart();
 }
 
+
+void WorkArea::displayMessage(lyx::docstring const & message)
+{
+       lyx_view_.message(message);
+}
+
 } // namespace frontend
 } // namespace lyx