mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
First step towards a little bit more independence of GuiWorkArea (WRT GuiView). Ideally, GuiWorkArea should not at all about GuiView. GuiWorkArea now uses a new signal busy() to inform its container (GuiView) about its status.
I also added 2 FIXME where we should not call GuiView directly. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39948 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8e8c214bef
commit
5c5850e28f
@ -994,6 +994,8 @@ void GuiView::updateWindowTitle(GuiWorkArea * wa)
|
||||
|
||||
void GuiView::on_currentWorkAreaChanged(GuiWorkArea * wa)
|
||||
{
|
||||
QObject::disconnect(d.current_work_area_, SIGNAL(busy(bool)),
|
||||
this, SLOT(setBusy(bool)));
|
||||
disconnectBuffer();
|
||||
disconnectBufferView();
|
||||
connectBufferView(wa->bufferView());
|
||||
@ -1001,6 +1003,7 @@ void GuiView::on_currentWorkAreaChanged(GuiWorkArea * wa)
|
||||
d.current_work_area_ = wa;
|
||||
QObject::connect(wa, SIGNAL(titleChanged(GuiWorkArea *)),
|
||||
this, SLOT(updateWindowTitle(GuiWorkArea *)));
|
||||
QObject::connect(wa, SIGNAL(busy(bool)), this, SLOT(setBusy(bool)));
|
||||
updateWindowTitle(wa);
|
||||
|
||||
structureChanged();
|
||||
@ -1173,20 +1176,12 @@ void GuiView::setBusy(bool busy)
|
||||
// busy state didn't change
|
||||
return;
|
||||
|
||||
if (d.current_work_area_) {
|
||||
//Why would we want to stop updates only for one workarea and
|
||||
//not for the others ? This leads to problems as in #7314 (vfr).
|
||||
//d.current_work_area_->setUpdatesEnabled(!busy);
|
||||
if (busy)
|
||||
d.current_work_area_->stopBlinkingCursor();
|
||||
else
|
||||
d.current_work_area_->startBlinkingCursor();
|
||||
}
|
||||
|
||||
if (busy)
|
||||
if (busy) {
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
else
|
||||
return;
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
updateLayoutList();
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,8 +77,6 @@ public:
|
||||
|
||||
int id() const { return id_; }
|
||||
|
||||
///
|
||||
void setBusy(bool);
|
||||
/// are we busy ?
|
||||
bool busy() const;
|
||||
|
||||
@ -207,6 +205,8 @@ Q_SIGNALS:
|
||||
void triggerShowDialog(QString const & qname, QString const & qdata, Inset * inset);
|
||||
|
||||
public Q_SLOTS:
|
||||
///
|
||||
void setBusy(bool);
|
||||
/// idle timeout.
|
||||
/// clear any temporary message and replace with current status.
|
||||
void clearMessage();
|
||||
|
@ -531,6 +531,7 @@ void GuiWorkArea::Private::dispatch(FuncRequest const & cmd0, KeyModifier mod)
|
||||
buffer_view_->mouseEventDispatch(cmd);
|
||||
|
||||
// Skip these when selecting
|
||||
// FIXME: let GuiView take care of those.
|
||||
if (cmd.action() != LFUN_MOUSE_MOTION) {
|
||||
completer_->updateVisibility(false, false);
|
||||
lyx_view_->updateDialogs();
|
||||
@ -542,6 +543,7 @@ void GuiWorkArea::Private::dispatch(FuncRequest const & cmd0, KeyModifier mod)
|
||||
// Slight hack: this is only called currently when we
|
||||
// clicked somewhere, so we force through the display
|
||||
// of the new status here.
|
||||
// FIXME: let GuiView take care of those.
|
||||
lyx_view_->clearMessage();
|
||||
|
||||
// Show the cursor immediately after any operation
|
||||
@ -556,7 +558,10 @@ void GuiWorkArea::Private::resizeBufferView()
|
||||
{
|
||||
// WARNING: Please don't put any code that will trigger a repaint here!
|
||||
// We are already inside a paint event.
|
||||
lyx_view_->setBusy(true);
|
||||
p->stopBlinkingCursor();
|
||||
// Warn our container (GuiView).
|
||||
p->busy(true);
|
||||
|
||||
Point point;
|
||||
int h = 0;
|
||||
buffer_view_->cursorPosAndHeight(point, h);
|
||||
@ -572,9 +577,13 @@ void GuiWorkArea::Private::resizeBufferView()
|
||||
// as the scrollbar paramters are then set for the first time.
|
||||
updateScrollbar();
|
||||
|
||||
lyx_view_->updateLayoutList();
|
||||
lyx_view_->setBusy(false);
|
||||
need_resize_ = false;
|
||||
p->busy(false);
|
||||
// Eventually, restart the cursor after the resize event.
|
||||
// We might be resizing even if the focus is on another widget so we only
|
||||
// restart the cursor if we have the focus.
|
||||
if (p->hasFocus())
|
||||
QTimer::singleShot(50, p, SLOT(startBlinkingCursor()));
|
||||
}
|
||||
|
||||
|
||||
@ -655,6 +664,7 @@ void GuiWorkArea::scrollTo(int value)
|
||||
|
||||
if (lyxrc.cursor_follows_scrollbar) {
|
||||
d->buffer_view_->setCursorFromScrollbar();
|
||||
// FIXME: let GuiView take care of those.
|
||||
d->lyx_view_->updateLayoutList();
|
||||
}
|
||||
// Show the cursor immediately after any operation.
|
||||
|
@ -69,10 +69,7 @@ public:
|
||||
BufferView const & bufferView() const;
|
||||
///
|
||||
void redraw(bool update_metrics);
|
||||
///
|
||||
void stopBlinkingCursor();
|
||||
///
|
||||
void startBlinkingCursor();
|
||||
|
||||
/// Process Key pressed event.
|
||||
/// This needs to be public because it is accessed externally by GuiView.
|
||||
void processKeySym(KeySymbol const & key, KeyModifier mod);
|
||||
@ -89,9 +86,17 @@ public:
|
||||
GuiView const & view() const;
|
||||
GuiView & view();
|
||||
|
||||
public Q_SLOTS:
|
||||
///
|
||||
void stopBlinkingCursor();
|
||||
///
|
||||
void startBlinkingCursor();
|
||||
|
||||
Q_SIGNALS:
|
||||
///
|
||||
void titleChanged(GuiWorkArea *);
|
||||
///
|
||||
void busy(bool);
|
||||
|
||||
private Q_SLOTS:
|
||||
/// Scroll the BufferView.
|
||||
|
Loading…
Reference in New Issue
Block a user