Commit f13028bc authored by Peter Wu's avatar Peter Wu

Fix regression in scroll handling

Before commit de87cab0 ("Apply some clazzy fixes"), the "scroll"
method was overloaded as signal to set the correct position in the main
view. After that change, this subtle override is gone. The last trace
was removed in commit f136b953 ("remove broken connects").

Restore the original behavior with renamed signals to avoid confusion.

Reviewed By: mreeves

Differential Revision: https://phabricator.kde.org/D15411
parent ff5adaf6
......@@ -392,7 +392,7 @@ void DiffTextWindow::setFastSelectorRange(int line1, int nofLines)
getNofVisibleLines());
if(newFirstLine != d->m_firstLine)
{
scroll(0, newFirstLine - d->m_firstLine);
emit scrollDiffTextWindow(0, newFirstLine - d->m_firstLine);
}
update();
......@@ -584,7 +584,7 @@ void DiffTextWindow::mouseMoveEvent(QMouseEvent* e)
{
d->m_scrollDeltaX = deltaX;
d->m_scrollDeltaY = deltaY;
scroll(deltaX, deltaY);
emit scrollDiffTextWindow(deltaX, deltaY);
if(d->m_delayedDrawTimer)
killTimer(d->m_delayedDrawTimer);
d->m_delayedDrawTimer = startTimer(50);
......@@ -645,7 +645,7 @@ void DiffTextWindow::timerEvent(QTimerEvent*)
if(d->m_scrollDeltaX != 0 || d->m_scrollDeltaY != 0)
{
d->m_selection.end(d->m_selection.getLastLine() + d->m_scrollDeltaY, d->m_selection.getLastPos() + d->m_scrollDeltaX);
scroll(d->m_scrollDeltaX, d->m_scrollDeltaY);
emit scrollDiffTextWindow(d->m_scrollDeltaX, d->m_scrollDeltaY);
killTimer(d->m_delayedDrawTimer);
d->m_delayedDrawTimer = startTimer(50);
}
......
......@@ -82,6 +82,7 @@ public:
Q_SIGNALS:
void resizeHeightChangedSignal(int nofVisibleLines);
void resizeWidthChangedSignal(int nofVisibleColumns);
void scrollDiffTextWindow( int deltaX, int deltaY );
void newSelection();
void selectionEnd();
void setFastSelectorLine( int line );
......
......@@ -952,7 +952,7 @@ void MergeResultWindow::setFastSelector(MergeLineList::iterator i)
int newFirstLine = getBestFirstLine(line1, nofLines, m_firstLine, getNofVisibleLines());
if(newFirstLine != m_firstLine)
{
scroll(0, newFirstLine - m_firstLine);
emit scrollMergeResultWindow(0, newFirstLine - m_firstLine);
}
if(m_selection.isEmpty())
......@@ -1618,7 +1618,7 @@ void MergeResultWindow::timerEvent(QTimerEvent*)
if(m_scrollDeltaX != 0 || m_scrollDeltaY != 0)
{
m_selection.end(m_selection.getLastLine() + m_scrollDeltaY, m_selection.getLastPos() + m_scrollDeltaX);
scroll(m_scrollDeltaX, m_scrollDeltaY);
emit scrollMergeResultWindow(m_scrollDeltaX, m_scrollDeltaY);
killTimer(m_delayedDrawTimer);
m_delayedDrawTimer = startTimer(50);
}
......@@ -2214,7 +2214,7 @@ void MergeResultWindow::mouseMoveEvent(QMouseEvent* e)
m_scrollDeltaY = deltaY;
if(deltaX != 0 || deltaY != 0)
{
scroll(deltaX, deltaY);
emit scrollMergeResultWindow(deltaX, deltaY);
}
}
}
......@@ -2244,7 +2244,7 @@ void MergeResultWindow::wheelEvent(QWheelEvent* e)
{
int d = -e->delta() * QApplication::wheelScrollLines() / 120;
e->accept();
scroll(0, std::min(d, getNofVisibleLines()));
emit scrollMergeResultWindow(0, std::min(d, getNofVisibleLines()));
}
bool MergeResultWindow::event(QEvent* e)
......@@ -2649,7 +2649,7 @@ void MergeResultWindow::keyPressEvent(QKeyEvent* e)
update();
if(newFirstLine != m_firstLine || newHorizScrollOffset != m_horizScrollOffset)
{
scroll(newHorizScrollOffset - m_horizScrollOffset, newFirstLine - m_firstLine);
emit scrollMergeResultWindow(newHorizScrollOffset - m_horizScrollOffset, newFirstLine - m_firstLine);
return;
}
}
......
......@@ -164,6 +164,7 @@ public Q_SLOTS:
void slotStatusMessageChanged( const QString& );
Q_SIGNALS:
void scrollMergeResultWindow( int deltaX, int deltaY );
void modifiedChanged(bool bModified);
void setFastSelectorRange( int line1, int nofLines );
void sourceMask( int srcMask, int enabledMask );
......
......@@ -641,24 +641,28 @@ void KDiff3App::initView()
connect(m_pHScrollBar, SIGNAL(valueChanged2(int)), m_pDiffTextWindow1, SLOT(setHorizScrollOffset(int)));
connect(m_pDiffTextWindow1, SIGNAL(newSelection()), this, SLOT(slotSelectionStart()));
connect(m_pDiffTextWindow1, SIGNAL(selectionEnd()), this, SLOT(slotSelectionEnd()));
connect(m_pDiffTextWindow1, SIGNAL(scrollDiffTextWindow(int, int)), this, SLOT(scrollDiffTextWindow(int, int)));
m_pDiffTextWindow1->installEventFilter(this);
connect(m_pDiffVScrollBar, SIGNAL(valueChanged(int)), m_pDiffTextWindow2, SLOT(setFirstLine(int)));
connect(m_pHScrollBar, SIGNAL(valueChanged2(int)), m_pDiffTextWindow2, SLOT(setHorizScrollOffset(int)));
connect(m_pDiffTextWindow2, SIGNAL(newSelection()), this, SLOT(slotSelectionStart()));
connect(m_pDiffTextWindow2, SIGNAL(selectionEnd()), this, SLOT(slotSelectionEnd()));
connect(m_pDiffTextWindow2, SIGNAL(scrollDiffTextWindow(int, int)), this, SLOT(scrollDiffTextWindow(int, int)));
m_pDiffTextWindow2->installEventFilter(this);
connect(m_pDiffVScrollBar, SIGNAL(valueChanged(int)), m_pDiffTextWindow3, SLOT(setFirstLine(int)));
connect(m_pHScrollBar, SIGNAL(valueChanged2(int)), m_pDiffTextWindow3, SLOT(setHorizScrollOffset(int)));
connect(m_pDiffTextWindow3, SIGNAL(newSelection()), this, SLOT(slotSelectionStart()));
connect(m_pDiffTextWindow3, SIGNAL(selectionEnd()), this, SLOT(slotSelectionEnd()));
connect(m_pDiffTextWindow3, SIGNAL(scrollDiffTextWindow(int, int)), this, SLOT(scrollDiffTextWindow(int, int)));
m_pDiffTextWindow3->installEventFilter(this);
MergeResultWindow* p = m_pMergeResultWindow;
connect(m_pMergeVScrollBar, &QScrollBar::valueChanged, p, &MergeResultWindow::setFirstLine);
connect(m_pHScrollBar, &ReversibleScrollBar::valueChanged2, p, &MergeResultWindow::setHorizScrollOffset);
connect(p, SIGNAL(scrollMergeResultWindow(int, int)), this, SLOT(scrollMergeResultWindow(int, int)));
connect(p, SIGNAL(sourceMask(int, int)), this, SLOT(sourceMask(int, int)));
connect(p, SIGNAL(resizeSignal()), this, SLOT(resizeMergeResultWindow()));
connect(p, SIGNAL(selectionEnd()), this, SLOT(slotSelectionEnd()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment