Added marker edit logic to Qt GUI TAS editor.

This commit is contained in:
mjbudd77 2021-11-18 21:07:24 -05:00
parent 1f534656ad
commit f4f1ca750a
8 changed files with 590 additions and 48 deletions

View File

@ -899,8 +899,8 @@ void TasEditorWindow::buildPianoRollDisplay(void)
pianoRollHBar = new QScrollBar( Qt::Horizontal, this );
upperMarkerLabel = new QLabel( tr("Marker 0") );
lowerMarkerLabel = new QLabel( tr("Marker 0") );
upperMarkerNote = new QLineEdit();
lowerMarkerNote = new QLineEdit();
upperMarkerNote = new UpperMarkerNoteEdit();
lowerMarkerNote = new LowerMarkerNoteEdit();
pianoRollFrame->setLineWidth(2);
pianoRollFrame->setMidLineWidth(1);
@ -2130,6 +2130,234 @@ void TasEditorWindow::setInputUsingPattern(int start, int end, int joy, int butt
if (changes_made)
greenzone.invalidateAndUpdatePlayback(history.registerChanges(MODTYPE_PATTERN, start, end, 0, patternsNames[current_pattern].c_str(), consecutivenessTag));
}
// following functions use current Selection to determine range of frames
bool TasEditorWindow::handleColumnSet(void)
{
RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection();
if (current_selection->size() == 0) return false;
RowsSelection::iterator current_selection_begin(current_selection->begin());
RowsSelection::iterator current_selection_end(current_selection->end());
// inspect the selected frames, if they are all set, then unset all, else set all
bool unset_found = false, changes_made = false;
for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++)
{
if (!markersManager.getMarkerAtFrame(*it))
{
unset_found = true;
break;
}
}
if (unset_found)
{
// set all
for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++)
{
if (!markersManager.getMarkerAtFrame(*it))
{
if (markersManager.setMarkerAtFrame(*it))
{
changes_made = true;
//pianoRoll.redrawRow(*it);
pianoRoll->update();
}
}
}
if (changes_made)
{
history.registerMarkersChange(MODTYPE_MARKER_SET, *current_selection_begin, *current_selection->rbegin());
}
}
else
{
// unset all
for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++)
{
if (markersManager.getMarkerAtFrame(*it))
{
markersManager.removeMarkerFromFrame(*it);
changes_made = true;
//pianoRoll.redrawRow(*it);
pianoRoll->update();
}
}
if (changes_made)
{
history.registerMarkersChange(MODTYPE_MARKER_REMOVE, *current_selection_begin, *current_selection->rbegin());
}
}
if (changes_made)
{
selection.mustFindCurrentMarker = playback.mustFindCurrentMarker = true;
}
return changes_made;
}
bool TasEditorWindow::handleColumnSetUsingPattern(void)
{
RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection();
if (current_selection->size() == 0) return false;
RowsSelection::iterator current_selection_begin(current_selection->begin());
RowsSelection::iterator current_selection_end(current_selection->end());
int pattern_offset = 0, current_pattern = taseditorConfig.currentPattern;
bool changes_made = false;
for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++)
{
// skip lag frames
if (taseditorConfig.autofirePatternSkipsLag && greenzone.lagLog.getLagInfoAtFrame(*it) == LAGGED_YES)
continue;
if (patterns[current_pattern][pattern_offset])
{
if (!markersManager.getMarkerAtFrame(*it))
{
if (markersManager.setMarkerAtFrame(*it))
{
changes_made = true;
pianoRoll->update();
}
}
}
else
{
if (markersManager.getMarkerAtFrame(*it))
{
markersManager.removeMarkerFromFrame(*it);
changes_made = true;
pianoRoll->update();
}
}
pattern_offset++;
if (pattern_offset >= (int)patterns[current_pattern].size())
pattern_offset -= patterns[current_pattern].size();
}
if (changes_made)
{
history.registerMarkersChange(MODTYPE_MARKER_PATTERN, *current_selection_begin, *current_selection->rbegin(), patternsNames[current_pattern].c_str());
selection.mustFindCurrentMarker = playback.mustFindCurrentMarker = true;
return true;
}
return false;
}
bool TasEditorWindow::handleInputColumnSetUsingPattern(int joy, int button)
{
if (joy < 0 || joy >= joysticksPerFrame[getInputType(currMovieData)]) return false;
RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection();
if (current_selection->size() == 0) return false;
RowsSelection::iterator current_selection_begin(current_selection->begin());
RowsSelection::iterator current_selection_end(current_selection->end());
int pattern_offset = 0, current_pattern = taseditorConfig.currentPattern;
for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++)
{
// skip lag frames
if (taseditorConfig.autofirePatternSkipsLag && greenzone.lagLog.getLagInfoAtFrame(*it) == LAGGED_YES)
continue;
currMovieData.records[*it].setBitValue(joy, button, patterns[current_pattern][pattern_offset] != 0);
pattern_offset++;
if (pattern_offset >= (int)patterns[current_pattern].size())
pattern_offset -= patterns[current_pattern].size();
}
int first_changes = history.registerChanges(MODTYPE_PATTERN, *current_selection_begin, *current_selection->rbegin(), 0, patternsNames[current_pattern].c_str());
if (first_changes >= 0)
{
greenzone.invalidateAndUpdatePlayback(first_changes);
return true;
} else
return false;
}
bool TasEditorWindow::handleInputColumnSet(int joy, int button)
{
if (joy < 0 || joy >= joysticksPerFrame[getInputType(currMovieData)]) return false;
RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection();
if (current_selection->size() == 0) return false;
RowsSelection::iterator current_selection_begin(current_selection->begin());
RowsSelection::iterator current_selection_end(current_selection->end());
//inspect the selected frames, if they are all set, then unset all, else set all
bool newValue = false;
for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++)
{
if (!(currMovieData.records[*it].checkBit(joy,button)))
{
newValue = true;
break;
}
}
// apply newValue
for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++)
currMovieData.records[*it].setBitValue(joy,button,newValue);
int first_changes;
if (newValue)
{
first_changes = history.registerChanges(MODTYPE_SET, *current_selection_begin, *current_selection->rbegin());
} else
{
first_changes = history.registerChanges(MODTYPE_UNSET, *current_selection_begin, *current_selection->rbegin());
}
if (first_changes >= 0)
{
greenzone.invalidateAndUpdatePlayback(first_changes);
return true;
}
return false;
}
void TasEditorWindow::setMarkers(void)
{
RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection();
if (current_selection->size())
{
RowsSelection::iterator current_selection_begin(current_selection->begin());
RowsSelection::iterator current_selection_end(current_selection->end());
bool changes_made = false;
for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++)
{
if (!markersManager.getMarkerAtFrame(*it))
{
if (markersManager.setMarkerAtFrame(*it))
{
changes_made = true;
pianoRoll->update();
}
}
}
if (changes_made)
{
selection.mustFindCurrentMarker = playback.mustFindCurrentMarker = true;
history.registerMarkersChange(MODTYPE_MARKER_SET, *current_selection_begin, *current_selection->rbegin());
}
}
}
void TasEditorWindow::removeMarkers(void)
{
RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection();
if (current_selection->size())
{
RowsSelection::iterator current_selection_begin(current_selection->begin());
RowsSelection::iterator current_selection_end(current_selection->end());
bool changes_made = false;
for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++)
{
if (markersManager.getMarkerAtFrame(*it))
{
markersManager.removeMarkerFromFrame(*it);
changes_made = true;
pianoRoll->update();
}
}
if (changes_made)
{
selection.mustFindCurrentMarker = playback.mustFindCurrentMarker = true;
history.registerMarkersChange(MODTYPE_MARKER_REMOVE, *current_selection_begin, *current_selection->rbegin());
}
}
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//---- TAS Piano Roll Widget
@ -2430,6 +2658,34 @@ void QPianoRoll::resizeEvent(QResizeEvent *event)
}
//----------------------------------------------------------------------------
void QPianoRoll::mouseDoubleClickEvent(QMouseEvent * event)
{
fceuCriticalSection emuLock;
int col, line, row_index, column_index, kbModifiers, alt_pressed;
QPoint c = convPixToCursor( event->pos() );
mouse_x = event->pos().x();
mouse_y = event->pos().y();
line = lineOffset + c.y();
col = calcColumn( event->pos().x() );
row_index = line;
rowUnderMouse = realRowUnderMouse = line;
columnUnderMouse = column_index = col;
kbModifiers = QApplication::keyboardModifiers();
alt_pressed = (kbModifiers & Qt::AltModifier) ? 1 : 0;
if ( event->button() == Qt::LeftButton )
{
if ( (col == COLUMN_FRAMENUM) || (col == COLUMN_FRAMENUM2) )
{
handleColumnSet( col, alt_pressed );
}
}
}
//----------------------------------------------------------------------------
void QPianoRoll::mousePressEvent(QMouseEvent * event)
{
fceuCriticalSection emuLock;
@ -2585,6 +2841,14 @@ void QPianoRoll::mousePressEvent(QMouseEvent * event)
}
//updateDrag();
}
else if ( event->button() == Qt::MiddleButton )
{
playback->handleMiddleButtonClick();
}
else if ( event->button() == Qt::RightButton )
{
//rightButtonDragMode = true;
}
}
//----------------------------------------------------------------------------
void QPianoRoll::mouseReleaseEvent(QMouseEvent * event)
@ -2612,6 +2876,10 @@ void QPianoRoll::mouseReleaseEvent(QMouseEvent * event)
finishDrag();
}
}
else if ( event->button() == Qt::RightButton )
{
//rightButtonDragMode = true;
}
}
//----------------------------------------------------------------------------
void QPianoRoll::mouseMoveEvent(QMouseEvent * event)
@ -2896,6 +3164,48 @@ void QPianoRoll::updateDrag(void)
}
}
//----------------------------------------------------------------------------
void QPianoRoll::handleColumnSet(int column, bool altPressed)
{
if (column == COLUMN_FRAMENUM || column == COLUMN_FRAMENUM2)
{
// user clicked on "Frame#" - apply ColumnSet to Markers
if (altPressed)
{
if (parent->handleColumnSetUsingPattern())
{
//setLightInHeaderColumn(COLUMN_FRAMENUM, HEADER_LIGHT_MAX);
}
}
else
{
if (parent->handleColumnSet())
{
//setLightInHeaderColumn(COLUMN_FRAMENUM, HEADER_LIGHT_MAX);
}
}
}
else
{
// user clicked on Input column - apply ColumnSet to Input
int joy = (column - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS;
int button = (column - COLUMN_JOYPAD1_A) % NUM_JOYPAD_BUTTONS;
if (altPressed)
{
if (parent->handleInputColumnSetUsingPattern(joy, button))
{
//setLightInHeaderColumn(column, HEADER_LIGHT_MAX);
}
}
else
{
if (parent->handleInputColumnSet(joy, button))
{
//setLightInHeaderColumn(column, HEADER_LIGHT_MAX);
}
}
}
}
//----------------------------------------------------------------------------
void QPianoRoll::followSelection(void)
{
RowsSelection* current_selection = selection->getCopyOfCurrentRowsSelection();
@ -3206,8 +3516,8 @@ void QPianoRoll::paintEvent(QPaintEvent *event)
// Draw Grid
painter.drawLine( -pxLineXScroll, 0, -pxLineXScroll, viewHeight );
x = pxFrameColX - pxLineXScroll;
painter.drawLine( x, 0, x, viewHeight );
//x = pxFrameColX - pxLineXScroll;
//painter.drawLine( x, 0, x, viewHeight );
for (int i=0; i<numCtlr; i++)
{
@ -3314,6 +3624,110 @@ void QPianoRoll::paintEvent(QPaintEvent *event)
painter.fillRect( x, y, pxWidthCtlCol, pxLineSpacing, blkColor );
}
// Frame number column
// font
//if (markersManager.getMarkerAtFrame(lineNum))
// SelectObject(msg->nmcd.hdc, hMainListSelectFont);
//else
// SelectObject(msg->nmcd.hdc, hMainListFont);
// bg
// frame number
if (lineNum == history->getUndoHint())
{
// undo hint here
if (markersManager->getMarkerAtFrame(lineNum) && (dragMode != DRAG_MODE_MARKER || markerDragFrameNumber != lineNum))
{
blkColor = (taseditorConfig->bindMarkersToInput) ? QColor( BINDMARKED_UNDOHINT_FRAMENUM_COLOR ) : QColor( MARKED_UNDOHINT_FRAMENUM_COLOR );
}
else
{
blkColor = QColor( UNDOHINT_FRAMENUM_COLOR );
}
}
else if (lineNum == currFrameCounter || lineNum == (playback->getFlashingPauseFrame() - 1))
{
// this is current frame
if (markersManager->getMarkerAtFrame(lineNum) && (dragMode != DRAG_MODE_MARKER || markerDragFrameNumber != lineNum))
{
blkColor = (taseditorConfig->bindMarkersToInput) ? QColor( CUR_BINDMARKED_FRAMENUM_COLOR ) : QColor( CUR_MARKED_FRAMENUM_COLOR );
}
else
{
blkColor = QColor( CUR_FRAMENUM_COLOR );
}
}
else if (markersManager->getMarkerAtFrame(lineNum) && (dragMode != DRAG_MODE_MARKER || markerDragFrameNumber != lineNum))
{
// this is marked frame
blkColor = (taseditorConfig->bindMarkersToInput) ? QColor( BINDMARKED_FRAMENUM_COLOR ) : QColor( MARKED_FRAMENUM_COLOR );
}
else if (lineNum < greenzone->getSize())
{
if (!greenzone->isSavestateEmpty(lineNum))
{
// the frame is normal Greenzone frame
if (frame_lag == LAGGED_YES)
{
blkColor = QColor( LAG_FRAMENUM_COLOR );
}
else
{
blkColor = QColor( GREENZONE_FRAMENUM_COLOR );
}
}
else if (!greenzone->isSavestateEmpty(lineNum & EVERY16TH)
|| !greenzone->isSavestateEmpty(lineNum & EVERY8TH)
|| !greenzone->isSavestateEmpty(lineNum & EVERY4TH)
|| !greenzone->isSavestateEmpty(lineNum & EVERY2ND))
{
// the frame is in a gap (in Greenzone tail)
if (frame_lag == LAGGED_YES)
{
blkColor = QColor( PALE_LAG_FRAMENUM_COLOR );
}
else
{
blkColor = QColor( PALE_GREENZONE_FRAMENUM_COLOR );
}
}
else
{
// the frame is above Greenzone tail
if (frame_lag == LAGGED_YES)
{
blkColor = QColor( VERY_PALE_LAG_FRAMENUM_COLOR );
}
else if (frame_lag == LAGGED_NO)
{
blkColor = QColor( VERY_PALE_GREENZONE_FRAMENUM_COLOR );
}
else
{
blkColor = QColor( NORMAL_FRAMENUM_COLOR );
}
}
}
else
{
// the frame is below Greenzone head
if (frame_lag == LAGGED_YES)
{
blkColor = QColor( VERY_PALE_LAG_FRAMENUM_COLOR );
}
else if (frame_lag == LAGGED_NO)
{
blkColor = QColor( VERY_PALE_GREENZONE_FRAMENUM_COLOR );
}
else
{
blkColor = QColor( NORMAL_FRAMENUM_COLOR );
}
}
x = -pxLineXScroll + pxFrameColX;
painter.fillRect( x, y, pxWidthFrameCol, pxLineSpacing, blkColor );
// Selected Line
if ( rowIsSel )
{
painter.fillRect( 0, y, viewWidth, pxLineSpacing, QColor( 10, 36, 106 ) );
@ -3342,6 +3756,13 @@ void QPianoRoll::paintEvent(QPaintEvent *event)
//painter.drawLine( x, y, x, pxLineSpacing );
}
// Frame number column
// font
//if (markersManager.getMarkerAtFrame(lineNum))
// SelectObject(msg->nmcd.hdc, hMainListSelectFont);
//else
// SelectObject(msg->nmcd.hdc, hMainListFont);
// bg
x = -pxLineXScroll + pxFrameColX + (pxWidthFrameCol - 10*pxCharWidth) / 2;
sprintf( stmp, "%010i", lineNum );
@ -3391,6 +3812,9 @@ void QPianoRoll::paintEvent(QPaintEvent *event)
y += pxLineSpacing;
}
x = pxFrameColX - pxLineXScroll;
painter.drawLine( x, 0, x, viewHeight );
for (int i=0; i<numCtlr; i++)
{
x = pxFrameCtlX[i] - pxLineXScroll;

View File

@ -79,6 +79,7 @@ class QPianoRoll : public QWidget
bool lineIsVisible( int lineNum );
void handleColumnSet(int column, bool altPressed);
void centerListAroundLine(int rowIndex);
void ensureTheLineIsVisible( int lineNum );
void followMarker(int markerID);
@ -91,6 +92,7 @@ class QPianoRoll : public QWidget
void mousePressEvent(QMouseEvent * event);
void mouseReleaseEvent(QMouseEvent * event);
void mouseMoveEvent(QMouseEvent * event);
void mouseDoubleClickEvent(QMouseEvent * event);
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
void focusInEvent(QFocusEvent *event);
@ -184,6 +186,12 @@ class TasEditorWindow : public QDialog
void loadClipboard(const char *txt);
void toggleInput(int start, int end, int joy, int button, int consecutivenessTag);
void setInputUsingPattern(int start, int end, int joy, int button, int consecutivenessTag);
bool handleColumnSet(void);
bool handleColumnSetUsingPattern(void);
bool handleInputColumnSet(int joy, int button);
bool handleInputColumnSetUsingPattern(int joy, int button);
void setMarkers(void);
void removeMarkers(void);
protected:
void closeEvent(QCloseEvent *event);
@ -223,8 +231,8 @@ class TasEditorWindow : public QDialog
QScrollBar *pianoRollVBar;
QLabel *upperMarkerLabel;
QLabel *lowerMarkerLabel;
QLineEdit *upperMarkerNote;
QLineEdit *lowerMarkerNote;
UpperMarkerNoteEdit *upperMarkerNote;
LowerMarkerNoteEdit *lowerMarkerNote;
QTabWidget *bkmkBrnchStack;
QVBoxLayout *ctlPanelMainVbox;
@ -345,6 +353,7 @@ class TasEditorWindow : public QDialog
friend class SELECTION;
friend class PLAYBACK;
friend class HISTORY;
friend class MARKERS_MANAGER;
friend class QPianoRoll;
};

View File

@ -584,41 +584,65 @@ void MARKERS_MANAGER::findNextSimilarNote()
// ------------------------------------------------------------------------------------
void MARKERS_MANAGER::updateEditedMarkerNote()
{
// if (!markerNoteEditMode) return;
// char new_text[MAX_NOTE_LEN];
// if (markerNoteEditMode == MARKER_NOTE_EDIT_UPPER)
// {
// int len = SendMessage(playback.hwndPlaybackMarkerEditField, WM_GETTEXT, MAX_NOTE_LEN, (LPARAM)new_text);
// new_text[len] = 0;
// // check changes
// if (strcmp(getNoteCopy(playback.displayedMarkerNumber).c_str(), new_text))
// {
// setNote(playback.displayedMarkerNumber, new_text);
// if (playback.displayedMarkerNumber)
// history.registerMarkersChange(MODTYPE_MARKER_RENAME, getMarkerFrameNumber(playback.displayedMarkerNumber), -1, new_text);
// else
// // zeroth Marker - just assume it's set on frame 0
// history.registerMarkersChange(MODTYPE_MARKER_RENAME, 0, -1, new_text);
// // notify Selection to change text in the lower Marker (in case both are showing same Marker)
// selection.mustFindCurrentMarker = true;
// }
// } else if (markerNoteEditMode == MARKER_NOTE_EDIT_LOWER)
// {
// int len = SendMessage(selection.hwndSelectionMarkerEditField, WM_GETTEXT, MAX_NOTE_LEN, (LPARAM)new_text);
// new_text[len] = 0;
// // check changes
// if (strcmp(getNoteCopy(selection.displayedMarkerNumber).c_str(), new_text))
// {
// setNote(selection.displayedMarkerNumber, new_text);
// if (selection.displayedMarkerNumber)
// history.registerMarkersChange(MODTYPE_MARKER_RENAME, getMarkerFrameNumber(selection.displayedMarkerNumber), -1, new_text);
// else
// // zeroth Marker - just assume it's set on frame 0
// history.registerMarkersChange(MODTYPE_MARKER_RENAME, 0, -1, new_text);
// // notify Playback to change text in upper Marker (in case both are showing same Marker)
// playback.mustFindCurrentMarker = true;
// }
// }
if (!markerNoteEditMode)
{
return;
}
int len=0;
char new_text[MAX_NOTE_LEN];
if (markerNoteEditMode == MARKER_NOTE_EDIT_UPPER)
{
len = tasWin->upperMarkerLabel->text().size();
if ( len >= MAX_NOTE_LEN )
{
len = MAX_NOTE_LEN-1;
}
strncpy( new_text, tasWin->upperMarkerLabel->text().toStdString().c_str(), MAX_NOTE_LEN );
new_text[len] = 0;
// check changes
if (strcmp(getNoteCopy(playback->displayedMarkerNumber).c_str(), new_text))
{
setNote(playback->displayedMarkerNumber, new_text);
if (playback->displayedMarkerNumber)
{
history->registerMarkersChange(MODTYPE_MARKER_RENAME, getMarkerFrameNumber(playback->displayedMarkerNumber), -1, new_text);
}
else
{
// zeroth Marker - just assume it's set on frame 0
history->registerMarkersChange(MODTYPE_MARKER_RENAME, 0, -1, new_text);
}
// notify Selection to change text in the lower Marker (in case both are showing same Marker)
selection->mustFindCurrentMarker = true;
}
}
else if (markerNoteEditMode == MARKER_NOTE_EDIT_LOWER)
{
len = tasWin->lowerMarkerLabel->text().size();
if ( len >= MAX_NOTE_LEN )
{
len = MAX_NOTE_LEN-1;
}
strncpy( new_text, tasWin->lowerMarkerLabel->text().toStdString().c_str(), MAX_NOTE_LEN );
new_text[len] = 0;
// check changes
if (strcmp(getNoteCopy(selection->displayedMarkerNumber).c_str(), new_text))
{
setNote(selection->displayedMarkerNumber, new_text);
if (selection->displayedMarkerNumber)
{
history->registerMarkersChange(MODTYPE_MARKER_RENAME, getMarkerFrameNumber(selection->displayedMarkerNumber), -1, new_text);
}
else
{
// zeroth Marker - just assume it's set on frame 0
history->registerMarkersChange(MODTYPE_MARKER_RENAME, 0, -1, new_text);
}
// notify Playback to change text in upper Marker (in case both are showing same Marker)
playback->mustFindCurrentMarker = true;
}
}
}
// ------------------------------------------------------------------------------------
//INT_PTR CALLBACK findNoteWndProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)

View File

@ -638,3 +638,31 @@ void PLAYBACK::cancelSeeking()
// return CallWindowProc(playbackMarkerEdit_oldWndproc, hWnd, msg, wParam, lParam);
//}
// -------------------------------------------------------------------------
UpperMarkerNoteEdit::UpperMarkerNoteEdit( QWidget *parent )
: QLineEdit(parent)
{
setEchoMode( QLineEdit::Normal );
}
// -------------------------------------------------------------------------
UpperMarkerNoteEdit::~UpperMarkerNoteEdit(void)
{
}
// -------------------------------------------------------------------------
void UpperMarkerNoteEdit::focusInEvent(QFocusEvent *event)
{
markersManager->markerNoteEditMode = MARKER_NOTE_EDIT_UPPER;
QLineEdit::focusInEvent(event);
}
// -------------------------------------------------------------------------
void UpperMarkerNoteEdit::focusOutEvent(QFocusEvent *event)
{
// if we were editing, save and finish editing
if (markersManager->markerNoteEditMode == MARKER_NOTE_EDIT_UPPER)
{
markersManager->updateEditedMarkerNote();
markersManager->markerNoteEditMode = MARKER_NOTE_EDIT_NONE;
}
QLineEdit::focusOutEvent(event);
}
// -------------------------------------------------------------------------

View File

@ -1,6 +1,8 @@
// Specification file for Playback class
#pragma once
#include <QLineEdit>
#define PROGRESSBAR_WIDTH 200
#define PAUSEFRAME_BLINKING_PERIOD_WHEN_SEEKING 100
@ -8,6 +10,18 @@
#define BUTTON_HOLD_REPEAT_DELAY 250 // in milliseconds
class UpperMarkerNoteEdit : public QLineEdit
{
Q_OBJECT
public:
UpperMarkerNoteEdit(QWidget *parent = 0);
~UpperMarkerNoteEdit(void);
protected:
void focusInEvent(QFocusEvent *event);
void focusOutEvent(QFocusEvent *event);
};
class PLAYBACK
{

View File

@ -930,3 +930,30 @@ RowsSelection& SELECTION::getCurrentRowsSelection()
// return CallWindowProc(selectionMarkerEdit_oldWndproc, hWnd, msg, wParam, lParam);
//}
// -------------------------------------------------------------------------
LowerMarkerNoteEdit::LowerMarkerNoteEdit( QWidget *parent )
: QLineEdit(parent)
{
setEchoMode( QLineEdit::Normal );
}
// -------------------------------------------------------------------------
LowerMarkerNoteEdit::~LowerMarkerNoteEdit(void)
{
}
// -------------------------------------------------------------------------
void LowerMarkerNoteEdit::focusInEvent(QFocusEvent *event)
{
markersManager->markerNoteEditMode = MARKER_NOTE_EDIT_LOWER;
QLineEdit::focusInEvent(event);
}
// -------------------------------------------------------------------------
void LowerMarkerNoteEdit::focusOutEvent(QFocusEvent *event)
{
if (markersManager->markerNoteEditMode == MARKER_NOTE_EDIT_LOWER)
{
markersManager->updateEditedMarkerNote();
markersManager->markerNoteEditMode = MARKER_NOTE_EDIT_NONE;
}
QLineEdit::focusOutEvent(event);
}
// -------------------------------------------------------------------------

View File

@ -4,10 +4,26 @@
#include <set>
#include <map>
#include <vector>
#include <QLineEdit>
typedef std::set<int> RowsSelection;
#define SELECTION_ID_LEN 10
class LowerMarkerNoteEdit : public QLineEdit
{
Q_OBJECT
public:
LowerMarkerNoteEdit(QWidget *parent = 0);
~LowerMarkerNoteEdit(void);
protected:
void focusInEvent(QFocusEvent *event);
void focusOutEvent(QFocusEvent *event);
};
class SELECTION
{
public:

View File

@ -3436,11 +3436,11 @@ static void gui_prepare() {
#define LUA_PIXEL_G(PIX) (((PIX) >> 8) & 0xff)
#define LUA_PIXEL_B(PIX) ((PIX) & 0xff)
template <class T> static void swap(T &one, T &two) {
T temp = one;
one = two;
two = temp;
}
//template <class T> static void swap(T &one, T &two) {
// T temp = one;
// one = two;
// two = temp;
//}
// write a pixel to buffer
static inline void blend32(uint32 *dstPixel, uint32 colour)
@ -3564,9 +3564,9 @@ static void gui_drawline_internal(int x1, int y1, int x2, int y2, bool lastPixel
static void gui_drawbox_internal(int x1, int y1, int x2, int y2, uint32 colour) {
if (x1 > x2)
swap<int>(x1, x2);
std::swap<int>(x1, x2);
if (y1 > y2)
swap<int>(y1, y2);
std::swap<int>(y1, y2);
if (x1 < 0)
x1 = -1;
if (y1 < 0)