diff --git a/src/drivers/Qt/TasEditor/markers_manager.cpp b/src/drivers/Qt/TasEditor/markers_manager.cpp index acd80c9d..e4ea282c 100644 --- a/src/drivers/Qt/TasEditor/markers_manager.cpp +++ b/src/drivers/Qt/TasEditor/markers_manager.cpp @@ -592,12 +592,12 @@ void MARKERS_MANAGER::updateEditedMarkerNote() char new_text[MAX_NOTE_LEN]; if (markerNoteEditMode == MARKER_NOTE_EDIT_UPPER) { - len = tasWin->upperMarkerLabel->text().size(); + len = tasWin->upperMarkerNote->text().size(); if ( len >= MAX_NOTE_LEN ) { len = MAX_NOTE_LEN-1; } - strncpy( new_text, tasWin->upperMarkerLabel->text().toStdString().c_str(), MAX_NOTE_LEN ); + strncpy( new_text, tasWin->upperMarkerNote->text().toStdString().c_str(), MAX_NOTE_LEN ); new_text[len] = 0; // check changes if (strcmp(getNoteCopy(playback->displayedMarkerNumber).c_str(), new_text)) @@ -618,12 +618,12 @@ void MARKERS_MANAGER::updateEditedMarkerNote() } else if (markerNoteEditMode == MARKER_NOTE_EDIT_LOWER) { - len = tasWin->lowerMarkerLabel->text().size(); + len = tasWin->lowerMarkerNote->text().size(); if ( len >= MAX_NOTE_LEN ) { len = MAX_NOTE_LEN-1; } - strncpy( new_text, tasWin->lowerMarkerLabel->text().toStdString().c_str(), MAX_NOTE_LEN ); + strncpy( new_text, tasWin->lowerMarkerNote->text().toStdString().c_str(), MAX_NOTE_LEN ); new_text[len] = 0; // check changes diff --git a/src/drivers/Qt/TasEditor/playback.cpp b/src/drivers/Qt/TasEditor/playback.cpp index 37b71ad8..bab5a905 100644 --- a/src/drivers/Qt/TasEditor/playback.cpp +++ b/src/drivers/Qt/TasEditor/playback.cpp @@ -680,3 +680,28 @@ void UpperMarkerNoteEdit::focusOutEvent(QFocusEvent *event) QLineEdit::focusOutEvent(event); } // ------------------------------------------------------------------------- +void UpperMarkerNoteEdit::keyPressEvent(QKeyEvent *event) +{ + //printf("Key Press: 0x%x \n", event->key() ); + + if ( event->key() == Qt::Key_Escape) + { + setText( QString::fromStdString(markersManager->getNoteCopy(playback->displayedMarkerNumber)) ); + event->accept(); + } + else if ( (event->key() == Qt::Key_Enter) || (event->key() == Qt::Key_Return) ) + { + if (markersManager->markerNoteEditMode == MARKER_NOTE_EDIT_UPPER) + { + markersManager->updateEditedMarkerNote(); + markersManager->markerNoteEditMode = MARKER_NOTE_EDIT_NONE; + } + tasWin->pianoRoll->setFocus(); + event->accept(); + } + else + { + QLineEdit::keyPressEvent(event); + } +} +// ------------------------------------------------------------------------- diff --git a/src/drivers/Qt/TasEditor/playback.h b/src/drivers/Qt/TasEditor/playback.h index 5d356dac..4a063fb5 100644 --- a/src/drivers/Qt/TasEditor/playback.h +++ b/src/drivers/Qt/TasEditor/playback.h @@ -21,6 +21,7 @@ class UpperMarkerNoteEdit : public QLineEdit protected: void focusInEvent(QFocusEvent *event); void focusOutEvent(QFocusEvent *event); + void keyPressEvent(QKeyEvent *event); }; class PLAYBACK diff --git a/src/drivers/Qt/TasEditor/selection.cpp b/src/drivers/Qt/TasEditor/selection.cpp index c346cf17..65cdfc99 100644 --- a/src/drivers/Qt/TasEditor/selection.cpp +++ b/src/drivers/Qt/TasEditor/selection.cpp @@ -118,7 +118,8 @@ void SELECTION::update() { buttonHoldTimer = clock(); jumpToNextMarker(); - } else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < clock()) + } + else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < clock()) { jumpToNextMarker(); } @@ -210,6 +211,8 @@ void SELECTION::redrawMarkerData() // change Marker Note strcpy(new_text, markersManager->getNoteCopy(displayedMarkerNumber).c_str()); tasWin->lowerMarkerNote->setText( QObject::tr(new_text) ); + + printf("Marker %i: '%s'\n", displayedMarkerNumber, new_text ); } void SELECTION::jumpToPreviousMarker(int speed) @@ -957,3 +960,28 @@ void LowerMarkerNoteEdit::focusOutEvent(QFocusEvent *event) QLineEdit::focusOutEvent(event); } // ------------------------------------------------------------------------- +void LowerMarkerNoteEdit::keyPressEvent(QKeyEvent *event) +{ + //printf("Key Press: 0x%x \n", event->key() ); + + if ( event->key() == Qt::Key_Escape) + { + setText( QString::fromStdString(markersManager->getNoteCopy(selection->displayedMarkerNumber)) ); + event->accept(); + } + else if ( (event->key() == Qt::Key_Enter) || (event->key() == Qt::Key_Return) ) + { + if (markersManager->markerNoteEditMode == MARKER_NOTE_EDIT_LOWER) + { + markersManager->updateEditedMarkerNote(); + markersManager->markerNoteEditMode = MARKER_NOTE_EDIT_NONE; + } + tasWin->pianoRoll->setFocus(); + event->accept(); + } + else + { + QLineEdit::keyPressEvent(event); + } +} +// ------------------------------------------------------------------------- diff --git a/src/drivers/Qt/TasEditor/selection.h b/src/drivers/Qt/TasEditor/selection.h index 2c3f977d..029e823e 100644 --- a/src/drivers/Qt/TasEditor/selection.h +++ b/src/drivers/Qt/TasEditor/selection.h @@ -22,6 +22,7 @@ class LowerMarkerNoteEdit : public QLineEdit protected: void focusInEvent(QFocusEvent *event); void focusOutEvent(QFocusEvent *event); + void keyPressEvent(QKeyEvent *event); }; class SELECTION