1) crash in GuiWorkArea::paintEvent(), this one is solved by by encapsulating the file loading in LyXView by busy(true)/busy(false) and by disabling/enabling the work area update in GuiView::busy().
2) crash in the cursor blinking because the cursor is timed out at the moment you click on "Revert". So the blinking cursor is now disabled/enabled in GuiView::busy().
3) crash in BufferView::setBuffer() because the current buffer was already closed folling the "revert" command.
* BufferView::loadLyXFile(): set buffer_ to 0 in case of a reload (when document is reverted)
* LyXView:
- busy() is not const anymore (work_area_ is modified in GuiView)
- loadLyXFile(): encapsulate the file loading with busy(true)/busy(false)
- setBuffer(): encapsulate the buffer-switching with busy(true)/busy(false)
* GuiView::busy()
- disable/enable workarea updates.
- disable/enable blinking cursor.
* WorkArea: new startBlinkingCursor() and stopBlinkingCursor() methods.
* rowpainter.C:
- paintText(): make sure there is a Buffer from which to paint.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15556
a592a061-630c-0410-9148-
cb99ea01b6c8
if (!theBufferList().close(theBufferList().getBuffer(s), false))
return false;
// Fall through to new load. (Asger)
+ buffer_ = 0;
}
Buffer * b = 0;
void LyXView::setBuffer(Buffer * b)
{
+ busy(true);
+
if (work_area_->bufferView().buffer())
disconnectBuffer();
updateLayoutChoice();
updateWindowTitle();
updateStatusBar();
+ busy(false);
work_area_->redraw();
}
bool LyXView::loadLyXFile(string const & filename, bool tolastfiles)
{
+ busy(true);
+
if (work_area_->bufferView().buffer())
disconnectBuffer();
showErrorList("Parse");
}
updateStatusBar();
+ busy(false);
work_area_->redraw();
return loaded;
}
virtual void saveGeometry() = 0;
/// show busy cursor
- virtual void busy(bool) const = 0;
+ virtual void busy(bool) = 0;
virtual Toolbars::ToolbarPtr makeToolbar(ToolbarBackend::Toolbar const & tbb) = 0;
}
+void WorkArea::stopBlinkingCursor()
+{
+ cursor_timeout_.stop();
+}
+
+
+void WorkArea::startBlinkingCursor()
+{
+ cursor_timeout_.restart();
+}
+
+
void WorkArea::checkAndGreyOut()
{
if (greyed_out_)
virtual void redraw();
///
void checkAndGreyOut();
+ ///
+ void stopBlinkingCursor();
+ void startBlinkingCursor();
protected:
/// grey out (no buffer)
#include <config.h>
-#include "GuiImplementation.h"
-
#include "GuiView.h"
+
+#include "GuiImplementation.h"
+#include "GuiWorkArea.h"
#include "QLMenubar.h"
#include "QLToolbar.h"
#include "QCommandBuffer.h"
}
-void GuiView::busy(bool yes) const
+void GuiView::busy(bool yes)
{
- if (yes)
+ static_cast<GuiWorkArea *>(work_area_)->setUpdatesEnabled(!yes);
+
+ if (yes) {
+ work_area_->stopBlinkingCursor();
QApplication::setOverrideCursor(Qt::WaitCursor);
- else
+ }
+ else {
+ work_area_->startBlinkingCursor();
QApplication::restoreOverrideCursor();
+ }
}
int posx, int posy,
bool maximize);
virtual void saveGeometry();
- virtual void busy(bool) const;
+ virtual void busy(bool);
Toolbars::ToolbarPtr makeToolbar(ToolbarBackend::Toolbar const & tbb);
virtual void updateStatusBar();
virtual void message(lyx::docstring const & str);
void paintText(BufferView & bv, ViewMetricsInfo const & vi,
Painter & pain)
{
+ if (!bv.buffer())
+ return;
+
LyXText & text = bv.buffer()->text();
bool const select = bv.cursor().selection();