Fixed Qt TAS editor notes.
This commit is contained in:
parent
4133ea900c
commit
080ab42f80
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
// -------------------------------------------------------------------------
|
||||
|
|
|
@ -21,6 +21,7 @@ class UpperMarkerNoteEdit : public QLineEdit
|
|||
protected:
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
};
|
||||
|
||||
class PLAYBACK
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
// -------------------------------------------------------------------------
|
||||
|
|
|
@ -22,6 +22,7 @@ class LowerMarkerNoteEdit : public QLineEdit
|
|||
protected:
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
};
|
||||
|
||||
class SELECTION
|
||||
|
|
Loading…
Reference in New Issue