Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix scrolling direction in SongEditor due to stuck Ctrl/Shift.
  • Loading branch information
Cyp committed Dec 23, 2019
commit f96b544c87c37f07a109c1b31e5bf25875fc131f
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ ENDIF()

# Due to a regression in gcc-4.8.X, we need to disable array-bounds check
IF (CMAKE_COMPILER_IS_GNUCXX AND ((CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "4.8.0") OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.8.0") OR LMMS_BUILD_WIN32))
SET(WERROR_FLAGS "${WERROR_FLAGS} -Wno-array-bounds")
SET(WERROR_FLAGS "${WERROR_FLAGS} -Wno-array-bounds -Wno-attributes")
ENDIF()

IF(NOT CMAKE_BUILD_TYPE)
Expand Down
21 changes: 6 additions & 15 deletions include/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,12 @@ class MainWindow : public QMainWindow

void clearKeyModifiers();

bool isCtrlPressed()
{
return m_keyMods.m_ctrl;
}

[[deprecated]] // TODO Remove this function, since m_shift can get stuck down.
bool isShiftPressed()
{
return m_keyMods.m_shift;
}

bool isAltPressed()
{
return m_keyMods.m_alt;
}

static void saveWidgetState( QWidget * _w, QDomElement & _de );
static void restoreWidgetState( QWidget * _w, const QDomElement & _de );

Expand Down Expand Up @@ -176,11 +167,11 @@ public slots:
void autoSave();

protected:
virtual void closeEvent( QCloseEvent * _ce );
virtual void focusOutEvent( QFocusEvent * _fe );
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void keyReleaseEvent( QKeyEvent * _ke );
virtual void timerEvent( QTimerEvent * _ev );
void closeEvent( QCloseEvent * _ce ) override;
void focusOutEvent( QFocusEvent * _fe ) override;
void keyPressEvent( QKeyEvent * _ke ) override;
void keyReleaseEvent( QKeyEvent * _ke ) override;
void timerEvent( QTimerEvent * _ev ) override;


private:
Expand Down
2 changes: 1 addition & 1 deletion src/core/Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ void TrackContentObjectView::mousePressEvent( QMouseEvent * me )
dataFile.toString(), thumbnail, this );
}
else if( me->button() == Qt::LeftButton &&
/* engine::mainWindow()->isShiftPressed() == false &&*/
/* (me->modifiers() & Qt::ShiftModifier) &&*/
fixedTCOs() == false )
{
m_tco->addJournalCheckPoint();
Expand Down
1 change: 1 addition & 0 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,7 @@ void MainWindow::sessionCleanup()

void MainWindow::focusOutEvent( QFocusEvent * _fe )
{
// TODO Remove this function, since it is apparently never actually called!
// when loosing focus we do not receive key-(release!)-events anymore,
// so we might miss release-events of one the modifiers we're watching!
clearKeyModifiers();
Expand Down
11 changes: 5 additions & 6 deletions src/gui/editors/SongEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,13 @@ void SongEditor::setEditModeSelect()

void SongEditor::keyPressEvent( QKeyEvent * ke )
{
if( /*_ke->modifiers() & Qt::ShiftModifier*/
gui->mainWindow()->isShiftPressed() == true &&
bool isShiftPressed = ke->modifiers() & Qt::ShiftModifier;
if( isShiftPressed &&
( ke->key() == Qt::Key_Insert || ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return ) )
{
m_song->insertBar();
}
else if(/* _ke->modifiers() & Qt::ShiftModifier &&*/
gui->mainWindow()->isShiftPressed() == true &&
else if( isShiftPressed &&
( ke->key() == Qt::Key_Delete || ke->key() == Qt::Key_Backspace ) )
{
m_song->removeBar();
Expand Down Expand Up @@ -458,7 +457,7 @@ void SongEditor::keyPressEvent( QKeyEvent * ke )

void SongEditor::wheelEvent( QWheelEvent * we )
{
if( gui->mainWindow()->isCtrlPressed() == true )
if( we->modifiers() & Qt::ControlModifier )
{
int z = m_zoomingModel->value();

Expand All @@ -480,7 +479,7 @@ void SongEditor::wheelEvent( QWheelEvent * we )
// and make sure, all TCO's are resized and relocated
realignTracks();
}
else if( gui->mainWindow()->isShiftPressed() == true || we->orientation() == Qt::Horizontal )
else if( (we->modifiers() & Qt::ShiftModifier) || we->orientation() == Qt::Horizontal )
{
m_leftRightScroll->setValue( m_leftRightScroll->value() -
we->delta() / 30 );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/widgets/Knob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ void Knob::mousePressEvent( QMouseEvent * _me )
m_buttonPressed = true;
}
else if( _me->button() == Qt::LeftButton &&
gui->mainWindow()->isShiftPressed() == true )
(_me->modifiers() & Qt::ShiftModifier) )
{
new StringPairDrag( "float_value",
QString::number( model()->value() ),
Expand Down
2 changes: 1 addition & 1 deletion src/gui/widgets/LcdSpinBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void LcdSpinBox::mouseMoveEvent( QMouseEvent* event )
if( m_mouseMoving )
{
int dy = event->globalY() - m_origMousePos.y();
if( gui->mainWindow()->isShiftPressed() )
if( event->modifiers() & Qt::ShiftModifier )
dy = qBound( -4, dy/4, 4 );
if( dy > 1 || dy < -1 )
{
Expand Down