Hooked up Qt TAS edit menu functions.
This commit is contained in:
parent
b2244b3a0b
commit
1251b8df93
|
@ -311,6 +311,7 @@ TasEditorWindow::TasEditorWindow(QWidget *parent)
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
mainLayout->setMenuBar( menuBar );
|
mainLayout->setMenuBar( menuBar );
|
||||||
|
pianoRoll->setFocus();
|
||||||
|
|
||||||
initModules();
|
initModules();
|
||||||
|
|
||||||
|
@ -398,7 +399,7 @@ void TasEditorWindow::closeWindow(void)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
QMenuBar *TasEditorWindow::buildMenuBar(void)
|
QMenuBar *TasEditorWindow::buildMenuBar(void)
|
||||||
{
|
{
|
||||||
QMenu *fileMenu;
|
QMenu *fileMenu, *editMenu;
|
||||||
//QActionGroup *actGroup;
|
//QActionGroup *actGroup;
|
||||||
QAction *act;
|
QAction *act;
|
||||||
int useNativeMenuBar=0;
|
int useNativeMenuBar=0;
|
||||||
|
@ -490,13 +491,186 @@ QMenuBar *TasEditorWindow::buildMenuBar(void)
|
||||||
|
|
||||||
// File -> Quit
|
// File -> Quit
|
||||||
act = new QAction(tr("&Quit Window"), this);
|
act = new QAction(tr("&Quit Window"), this);
|
||||||
act->setShortcut(QKeySequence::Close);
|
act->setShortcut(QKeySequence(tr("Alt+F4")));
|
||||||
act->setStatusTip(tr("Close Window"));
|
act->setStatusTip(tr("Close Window"));
|
||||||
act->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
|
act->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
|
||||||
connect(act, SIGNAL(triggered()), this, SLOT(closeWindow(void)) );
|
connect(act, SIGNAL(triggered()), this, SLOT(closeWindow(void)) );
|
||||||
|
|
||||||
fileMenu->addAction(act);
|
fileMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
editMenu = menuBar->addMenu(tr("&Edit"));
|
||||||
|
|
||||||
|
// Edit -> Undo
|
||||||
|
act = new QAction(tr("&Undo"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ctrl+Z")));
|
||||||
|
act->setStatusTip(tr("Undo Changes"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editUndoCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit -> Redo
|
||||||
|
act = new QAction(tr("&Redo"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ctrl+Y")));
|
||||||
|
act->setStatusTip(tr("Redo Changes"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editRedoCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit -> Selection Undo
|
||||||
|
act = new QAction(tr("Selection &Undo"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ctrl+Q")));
|
||||||
|
act->setStatusTip(tr("Undo Selection"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editUndoSelCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit -> Selection Redo
|
||||||
|
act = new QAction(tr("Selection &Redo"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ctrl+W")));
|
||||||
|
act->setStatusTip(tr("Redo Selection"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editRedoSelCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
editMenu->addSeparator();
|
||||||
|
|
||||||
|
// Edit -> Deselect
|
||||||
|
act = new QAction(tr("Deselect"), this);
|
||||||
|
//act->setShortcut(QKeySequence(tr("Ctrl+W")));
|
||||||
|
act->setStatusTip(tr("Deselect"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editDeselectAll(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit -> Select All
|
||||||
|
act = new QAction(tr("Select All"), this);
|
||||||
|
//act->setShortcut(QKeySequence(tr("Ctrl+W")));
|
||||||
|
act->setStatusTip(tr("Select All"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editSelectAll(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit -> Select Between Markers
|
||||||
|
act = new QAction(tr("Select Between Markers"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ctrl+A")));
|
||||||
|
act->setStatusTip(tr("Select Between Markers"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editSelBtwMkrs(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit -> Reselect Clipboard
|
||||||
|
act = new QAction(tr("Reselect Clipboard"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ctrl+B")));
|
||||||
|
act->setStatusTip(tr("Reselect Clipboard"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editReselectClipboard(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
editMenu->addSeparator();
|
||||||
|
|
||||||
|
// Edit -> Copy
|
||||||
|
act = new QAction(tr("Copy"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ctrl+C")));
|
||||||
|
act->setStatusTip(tr("Copy"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editCopyCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit -> Paste
|
||||||
|
act = new QAction(tr("Paste"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ctrl+V")));
|
||||||
|
act->setStatusTip(tr("Paste"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editPasteCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit -> Paste Insert
|
||||||
|
act = new QAction(tr("Paste Insert"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ctrl+Shift+V")));
|
||||||
|
act->setStatusTip(tr("Paste Insert"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editPasteInsertCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit -> Cut
|
||||||
|
act = new QAction(tr("Cut"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ctrl+X")));
|
||||||
|
act->setStatusTip(tr("Cut"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editCutCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
editMenu->addSeparator();
|
||||||
|
|
||||||
|
// Edit -> Clear
|
||||||
|
act = new QAction(tr("Clear"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Del")));
|
||||||
|
act->setStatusTip(tr("Clear"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editClearCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit -> Delete
|
||||||
|
act = new QAction(tr("Delete"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ctrl+Del")));
|
||||||
|
act->setStatusTip(tr("Delete"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editDeleteCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit -> Clone
|
||||||
|
act = new QAction(tr("Clone"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ctrl+Ins")));
|
||||||
|
act->setStatusTip(tr("Clone"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editCloneCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit -> Insert
|
||||||
|
act = new QAction(tr("Insert"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ctrl+Shift+Ins")));
|
||||||
|
act->setStatusTip(tr("Insert"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editInsertCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
// Edit -> Insert # of Frames
|
||||||
|
act = new QAction(tr("Insert # of Frames"), this);
|
||||||
|
act->setShortcut(QKeySequence(tr("Ins")));
|
||||||
|
act->setStatusTip(tr("Insert # of Frames"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editInsertNumFramesCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
|
editMenu->addSeparator();
|
||||||
|
|
||||||
|
// Edit -> Truncate Movie
|
||||||
|
act = new QAction(tr("Truncate Movie"), this);
|
||||||
|
//act->setShortcut(QKeySequence(tr("Ctrl+Ins")));
|
||||||
|
act->setStatusTip(tr("Truncate Movie"));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(editTruncateMovieCB(void)) );
|
||||||
|
|
||||||
|
editMenu->addAction(act);
|
||||||
|
|
||||||
return menuBar;
|
return menuBar;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -747,6 +921,11 @@ void TasEditorWindow::buildSideControlPanel(void)
|
||||||
shortcut = new QShortcut( QKeySequence("Shift+PgDown"), this);
|
shortcut = new QShortcut( QKeySequence("Shift+PgDown"), this);
|
||||||
connect( shortcut, SIGNAL(activated(void)), this, SLOT(playbackFrameForwardFull(void)) );
|
connect( shortcut, SIGNAL(activated(void)), this, SLOT(playbackFrameForwardFull(void)) );
|
||||||
|
|
||||||
|
shortcut = new QShortcut( QKeySequence("Ctrl+Up"), this);
|
||||||
|
connect( shortcut, SIGNAL(activated(void)), this, SLOT(scrollSelectionUpOne(void)) );
|
||||||
|
|
||||||
|
shortcut = new QShortcut( QKeySequence("Ctrl+Down"), this);
|
||||||
|
connect( shortcut, SIGNAL(activated(void)), this, SLOT(scrollSelectionDnOne(void)) );
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int TasEditorWindow::initModules(void)
|
int TasEditorWindow::initModules(void)
|
||||||
|
@ -1182,6 +1361,129 @@ void TasEditorWindow::recordingChanged(int state)
|
||||||
FCEUI_MovieToggleReadOnly();
|
FCEUI_MovieToggleReadOnly();
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editUndoCB(void)
|
||||||
|
{
|
||||||
|
history.undo();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editRedoCB(void)
|
||||||
|
{
|
||||||
|
history.redo();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editUndoSelCB(void)
|
||||||
|
{
|
||||||
|
int dragMode = pianoRoll->getDragMode();
|
||||||
|
|
||||||
|
if ( (dragMode != DRAG_MODE_SELECTION) && (dragMode != DRAG_MODE_DESELECTION) )
|
||||||
|
{
|
||||||
|
selection.undo();
|
||||||
|
pianoRoll->followSelection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editRedoSelCB(void)
|
||||||
|
{
|
||||||
|
int dragMode = pianoRoll->getDragMode();
|
||||||
|
|
||||||
|
if ( (dragMode != DRAG_MODE_SELECTION) && (dragMode != DRAG_MODE_DESELECTION) )
|
||||||
|
{
|
||||||
|
selection.redo();
|
||||||
|
pianoRoll->followSelection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editDeselectAll(void)
|
||||||
|
{
|
||||||
|
int dragMode = pianoRoll->getDragMode();
|
||||||
|
|
||||||
|
if ( (dragMode != DRAG_MODE_SELECTION) && (dragMode != DRAG_MODE_DESELECTION) )
|
||||||
|
{
|
||||||
|
selection.clearAllRowsSelection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editSelectAll(void)
|
||||||
|
{
|
||||||
|
int dragMode = pianoRoll->getDragMode();
|
||||||
|
|
||||||
|
if ( (dragMode != DRAG_MODE_SELECTION) && (dragMode != DRAG_MODE_DESELECTION) )
|
||||||
|
{
|
||||||
|
selection.selectAllRows();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editSelBtwMkrs(void)
|
||||||
|
{
|
||||||
|
int dragMode = pianoRoll->getDragMode();
|
||||||
|
|
||||||
|
if ( (dragMode != DRAG_MODE_SELECTION) && (dragMode != DRAG_MODE_DESELECTION) )
|
||||||
|
{
|
||||||
|
selection.selectAllRowsBetweenMarkers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editReselectClipboard(void)
|
||||||
|
{
|
||||||
|
int dragMode = pianoRoll->getDragMode();
|
||||||
|
|
||||||
|
if ( (dragMode != DRAG_MODE_SELECTION) && (dragMode != DRAG_MODE_DESELECTION) )
|
||||||
|
{
|
||||||
|
selection.reselectClipboard();
|
||||||
|
pianoRoll->followSelection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editCutCB(void)
|
||||||
|
{
|
||||||
|
splicer.cutSelectedInputToClipboard();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editCopyCB(void)
|
||||||
|
{
|
||||||
|
splicer.copySelectedInputToClipboard();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editPasteCB(void)
|
||||||
|
{
|
||||||
|
splicer.pasteInputFromClipboard();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editPasteInsertCB(void)
|
||||||
|
{
|
||||||
|
splicer.pasteInsertInputFromClipboard();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editClearCB(void)
|
||||||
|
{
|
||||||
|
splicer.clearSelectedFrames();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editDeleteCB(void)
|
||||||
|
{
|
||||||
|
splicer.deleteSelectedFrames();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editCloneCB(void)
|
||||||
|
{
|
||||||
|
splicer.cloneSelectedFrames();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editInsertCB(void)
|
||||||
|
{
|
||||||
|
splicer.insertSelectedFrames();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editInsertNumFramesCB(void)
|
||||||
|
{
|
||||||
|
splicer.insertNumberOfFrames();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::editTruncateMovieCB(void)
|
||||||
|
{
|
||||||
|
splicer.truncateMovie();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void TasEditorWindow::superImposedChanged(int state)
|
void TasEditorWindow::superImposedChanged(int state)
|
||||||
{
|
{
|
||||||
if ( state == Qt::Checked )
|
if ( state == Qt::Checked )
|
||||||
|
@ -1250,6 +1552,48 @@ void TasEditorWindow::playbackFrameForwardFull(void)
|
||||||
fceuWrapperUnLock();
|
fceuWrapperUnLock();
|
||||||
}
|
}
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::scrollSelectionUpOne(void)
|
||||||
|
{
|
||||||
|
int dragMode = pianoRoll->getDragMode();
|
||||||
|
|
||||||
|
fceuWrapperLock();
|
||||||
|
|
||||||
|
//printf("DragMode: %i\n", dragMode);
|
||||||
|
|
||||||
|
if ( (dragMode != DRAG_MODE_SELECTION) && (dragMode != DRAG_MODE_DESELECTION) )
|
||||||
|
{
|
||||||
|
selection.transposeVertically(-1);
|
||||||
|
int selectionBeginning = selection.getCurrentRowsSelectionBeginning();
|
||||||
|
if (selectionBeginning >= 0)
|
||||||
|
{
|
||||||
|
pianoRoll->ensureTheLineIsVisible(selectionBeginning);
|
||||||
|
}
|
||||||
|
pianoRoll->update();
|
||||||
|
}
|
||||||
|
fceuWrapperUnLock();
|
||||||
|
}
|
||||||
|
// ----------------------------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::scrollSelectionDnOne(void)
|
||||||
|
{
|
||||||
|
int dragMode = pianoRoll->getDragMode();
|
||||||
|
|
||||||
|
fceuWrapperLock();
|
||||||
|
|
||||||
|
//printf("DragMode: %i\n", dragMode);
|
||||||
|
|
||||||
|
if ( (dragMode != DRAG_MODE_SELECTION) && (dragMode != DRAG_MODE_DESELECTION) )
|
||||||
|
{
|
||||||
|
selection.transposeVertically(1);
|
||||||
|
int selectionEnd = selection.getCurrentRowsSelectionEnd();
|
||||||
|
if (selectionEnd >= 0)
|
||||||
|
{
|
||||||
|
pianoRoll->ensureTheLineIsVisible(selectionEnd);
|
||||||
|
}
|
||||||
|
pianoRoll->update();
|
||||||
|
}
|
||||||
|
fceuWrapperUnLock();
|
||||||
|
}
|
||||||
|
// ----------------------------------------------------------------------------------------------
|
||||||
void TasEditorWindow::loadClipboard(const char *txt)
|
void TasEditorWindow::loadClipboard(const char *txt)
|
||||||
{
|
{
|
||||||
clipboard->setText( tr(txt), QClipboard::Clipboard );
|
clipboard->setText( tr(txt), QClipboard::Clipboard );
|
||||||
|
@ -1384,6 +1728,7 @@ QPianoRoll::QPianoRoll(QWidget *parent)
|
||||||
pal.setColor(QPalette::WindowText, fg );
|
pal.setColor(QPalette::WindowText, fg );
|
||||||
}
|
}
|
||||||
this->parent = qobject_cast <TasEditorWindow*>( parent );
|
this->parent = qobject_cast <TasEditorWindow*>( parent );
|
||||||
|
this->setFocusPolicy(Qt::StrongFocus);
|
||||||
this->setMouseTracking(true);
|
this->setMouseTracking(true);
|
||||||
this->setPalette(pal);
|
this->setPalette(pal);
|
||||||
|
|
||||||
|
@ -1565,6 +1910,27 @@ void QPianoRoll::drawArrow( QPainter *painter, int xl, int yl, int value )
|
||||||
painter->drawPolygon( p, 3 );
|
painter->drawPolygon( p, 3 );
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
bool QPianoRoll::lineIsVisible( int lineNum )
|
||||||
|
{
|
||||||
|
int lineEnd = lineOffset + viewLines;
|
||||||
|
|
||||||
|
return ( (lineNum >= lineOffset) && (lineNum < lineEnd) );
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void QPianoRoll::ensureTheLineIsVisible( int lineNum )
|
||||||
|
{
|
||||||
|
if ( !lineIsVisible( lineNum ) )
|
||||||
|
{
|
||||||
|
lineOffset = lineNum - 3;
|
||||||
|
|
||||||
|
if ( lineOffset < 0 )
|
||||||
|
{
|
||||||
|
lineOffset = 0;
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void QPianoRoll::resizeEvent(QResizeEvent *event)
|
void QPianoRoll::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
viewWidth = event->size().width();
|
viewWidth = event->size().width();
|
||||||
|
@ -2027,6 +2393,81 @@ void QPianoRoll::updateDrag(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void QPianoRoll::followSelection(void)
|
||||||
|
{
|
||||||
|
RowsSelection* current_selection = selection->getCopyOfCurrentRowsSelection();
|
||||||
|
if (current_selection->size() == 0) return;
|
||||||
|
|
||||||
|
int list_items = viewLines - 1;
|
||||||
|
int selection_start = *current_selection->begin();
|
||||||
|
int selection_end = *current_selection->rbegin();
|
||||||
|
int selection_items = 1 + selection_end - selection_start;
|
||||||
|
|
||||||
|
if (selection_items <= list_items)
|
||||||
|
{
|
||||||
|
// selected region can fit in screen
|
||||||
|
int lower_border = (list_items - selection_items) / 2;
|
||||||
|
int upper_border = (list_items - selection_items) - lower_border;
|
||||||
|
int index = selection_end + lower_border;
|
||||||
|
if (index >= currMovieData.getNumRecords())
|
||||||
|
{
|
||||||
|
index = currMovieData.getNumRecords()-1;
|
||||||
|
}
|
||||||
|
ensureTheLineIsVisible(index);
|
||||||
|
|
||||||
|
index = selection_start - upper_border;
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
ensureTheLineIsVisible(index);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// selected region is too big to fit in screen
|
||||||
|
// oh well, just center at selection_start
|
||||||
|
centerListAroundLine(selection_start);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void QPianoRoll::followMarker(int markerID)
|
||||||
|
{
|
||||||
|
if (markerID > 0)
|
||||||
|
{
|
||||||
|
int frame = markersManager->getMarkerFrameNumber(markerID);
|
||||||
|
if (frame >= 0)
|
||||||
|
{
|
||||||
|
centerListAroundLine(frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ensureTheLineIsVisible(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void QPianoRoll::centerListAroundLine(int rowIndex)
|
||||||
|
{
|
||||||
|
int numItemsPerPage = viewLines - 1;
|
||||||
|
int lowerBorder = (numItemsPerPage - 1) / 2;
|
||||||
|
int upperBorder = (numItemsPerPage - 1) - lowerBorder;
|
||||||
|
int index = rowIndex + lowerBorder;
|
||||||
|
if (index >= currMovieData.getNumRecords())
|
||||||
|
{
|
||||||
|
index = currMovieData.getNumRecords()-1;
|
||||||
|
}
|
||||||
|
ensureTheLineIsVisible(index);
|
||||||
|
|
||||||
|
index = rowIndex - upperBorder;
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
ensureTheLineIsVisible(index);
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void QPianoRoll::startDraggingPlaybackCursor(void)
|
void QPianoRoll::startDraggingPlaybackCursor(void)
|
||||||
{
|
{
|
||||||
|
@ -2211,6 +2652,7 @@ void QPianoRoll::paintEvent(QPaintEvent *event)
|
||||||
QColor white("white"), black("black"), blkColor;
|
QColor white("white"), black("black"), blkColor;
|
||||||
static const char *buttonNames[] = { "A", "B", "S", "T", "U", "D", "L", "R", NULL };
|
static const char *buttonNames[] = { "A", "B", "S", "T", "U", "D", "L", "R", NULL };
|
||||||
char stmp[32];
|
char stmp[32];
|
||||||
|
char rowIsSel=0;
|
||||||
|
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
viewWidth = event->rect().width();
|
viewWidth = event->rect().width();
|
||||||
|
@ -2280,6 +2722,8 @@ void QPianoRoll::paintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
int frame_lag = greenzone->lagLog.getLagInfoAtFrame(lineNum);
|
int frame_lag = greenzone->lagLog.getLagInfoAtFrame(lineNum);
|
||||||
|
|
||||||
|
rowIsSel = selection->isRowSelected( lineNum );
|
||||||
|
|
||||||
for (int i=0; i<numCtlr; i++)
|
for (int i=0; i<numCtlr; i++)
|
||||||
{
|
{
|
||||||
x = pxFrameCtlX[i] - pxLineXScroll;
|
x = pxFrameCtlX[i] - pxLineXScroll;
|
||||||
|
@ -2359,6 +2803,17 @@ void QPianoRoll::paintEvent(QPaintEvent *event)
|
||||||
painter.fillRect( x, y, pxWidthCtlCol, pxLineSpacing, blkColor );
|
painter.fillRect( x, y, pxWidthCtlCol, pxLineSpacing, blkColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( rowIsSel )
|
||||||
|
{
|
||||||
|
painter.fillRect( 0, y, viewWidth, pxLineSpacing, QColor( 10, 36, 106 ) );
|
||||||
|
|
||||||
|
painter.setPen( QColor( 255, 255, 255 ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
painter.setPen( QColor( 0, 0, 0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
for (int i=0; i<numCtlr; i++)
|
for (int i=0; i<numCtlr; i++)
|
||||||
{
|
{
|
||||||
data = currMovieData.records[ lineNum ].joysticks[i];
|
data = currMovieData.records[ lineNum ].joysticks[i];
|
||||||
|
@ -2373,7 +2828,7 @@ void QPianoRoll::paintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
x += pxWidthBtnCol;
|
x += pxWidthBtnCol;
|
||||||
}
|
}
|
||||||
painter.drawLine( x, 0, x, viewHeight );
|
//painter.drawLine( x, y, x, pxLineSpacing );
|
||||||
}
|
}
|
||||||
|
|
||||||
x = -pxLineXScroll + pxFrameColX + (pxWidthFrameCol - 10*pxCharWidth) / 2;
|
x = -pxLineXScroll + pxFrameColX + (pxWidthFrameCol - 10*pxCharWidth) / 2;
|
||||||
|
@ -2431,12 +2886,18 @@ void QPianoRoll::paintEvent(QPaintEvent *event)
|
||||||
|
|
||||||
for (int j=0; j<8; j++)
|
for (int j=0; j<8; j++)
|
||||||
{
|
{
|
||||||
painter.drawLine( x, 0, x, viewHeight );
|
painter.setPen( QColor( 128, 128, 128 ) );
|
||||||
|
painter.drawLine( x, 0, x, viewHeight ); x++;
|
||||||
|
painter.setPen( QColor( 0, 0, 0 ) );
|
||||||
|
painter.drawLine( x, 0, x, viewHeight ); x--;
|
||||||
|
|
||||||
painter.drawText( x + pxCharWidth, pxLineTextOfs, tr(buttonNames[j]) );
|
painter.drawText( x + pxCharWidth, pxLineTextOfs, tr(buttonNames[j]) );
|
||||||
|
|
||||||
x += pxWidthBtnCol;
|
x += pxWidthBtnCol;
|
||||||
}
|
}
|
||||||
|
painter.setPen( QColor( 128, 128, 128 ) );
|
||||||
|
painter.drawLine( x, 0, x, viewHeight ); x++;
|
||||||
|
painter.setPen( QColor( 0, 0, 0 ) );
|
||||||
painter.drawLine( x, 0, x, viewHeight );
|
painter.drawLine( x, 0, x, viewHeight );
|
||||||
}
|
}
|
||||||
y = 0;
|
y = 0;
|
||||||
|
|
|
@ -72,6 +72,15 @@ class QPianoRoll : public QWidget
|
||||||
|
|
||||||
QFont getFont(void){ return font; };
|
QFont getFont(void){ return font; };
|
||||||
|
|
||||||
|
int getDragMode(void){ return dragMode; };
|
||||||
|
|
||||||
|
bool lineIsVisible( int lineNum );
|
||||||
|
|
||||||
|
void centerListAroundLine(int rowIndex);
|
||||||
|
void ensureTheLineIsVisible( int lineNum );
|
||||||
|
void followMarker(int markerID);
|
||||||
|
void followSelection(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void calcFontData(void);
|
void calcFontData(void);
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
|
@ -259,6 +268,26 @@ class TasEditorWindow : public QDialog
|
||||||
void playbackFrameForward(void);
|
void playbackFrameForward(void);
|
||||||
void playbackFrameRewindFull(void);
|
void playbackFrameRewindFull(void);
|
||||||
void playbackFrameForwardFull(void);
|
void playbackFrameForwardFull(void);
|
||||||
|
void scrollSelectionUpOne(void);
|
||||||
|
void scrollSelectionDnOne(void);
|
||||||
|
void editUndoCB(void);
|
||||||
|
void editRedoCB(void);
|
||||||
|
void editUndoSelCB(void);
|
||||||
|
void editRedoSelCB(void);
|
||||||
|
void editDeselectAll(void);
|
||||||
|
void editSelectAll(void);
|
||||||
|
void editSelBtwMkrs(void);
|
||||||
|
void editReselectClipboard(void);
|
||||||
|
void editCutCB(void);
|
||||||
|
void editCopyCB(void);
|
||||||
|
void editPasteCB(void);
|
||||||
|
void editPasteInsertCB(void);
|
||||||
|
void editClearCB(void);
|
||||||
|
void editDeleteCB(void);
|
||||||
|
void editCloneCB(void);
|
||||||
|
void editInsertCB(void);
|
||||||
|
void editInsertNumFramesCB(void);
|
||||||
|
void editTruncateMovieCB(void);
|
||||||
|
|
||||||
friend class RECORDER;
|
friend class RECORDER;
|
||||||
friend class SPLICER;
|
friend class SPLICER;
|
||||||
|
|
|
@ -391,20 +391,8 @@ bool SELECTION::skipLoadSelection(EMUFILE *is)
|
||||||
// used to track selection
|
// used to track selection
|
||||||
void SELECTION::noteThatItemRangeChanged(int startItem, int endItem, int newValue )
|
void SELECTION::noteThatItemRangeChanged(int startItem, int endItem, int newValue )
|
||||||
{
|
{
|
||||||
int oldValue = 0;
|
bool ON = newValue;
|
||||||
std::map <int, int>::iterator it;
|
bool OFF = !newValue;
|
||||||
|
|
||||||
if ( selList.size() > 0 )
|
|
||||||
{
|
|
||||||
it = selList.find(startItem);
|
|
||||||
|
|
||||||
if ( it != selList.end() )
|
|
||||||
{
|
|
||||||
oldValue = it->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bool ON = !oldValue && newValue;
|
|
||||||
bool OFF = oldValue && !newValue;
|
|
||||||
|
|
||||||
if (ON)
|
if (ON)
|
||||||
{
|
{
|
||||||
|
@ -580,14 +568,33 @@ void SELECTION::clearRegionOfRowsSelection(int start, int end)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
std::map <int, int>::iterator start_it, end_it;
|
||||||
//for (int i = start; i < end; ++i)
|
//for (int i = start; i < end; ++i)
|
||||||
// ListView_SetItemState(pianoRoll.hwndList, i, 0, LVIS_SELECTED);
|
// ListView_SetItemState(pianoRoll.hwndList, i, 0, LVIS_SELECTED);
|
||||||
|
|
||||||
for (int i = start; i < end; ++i)
|
start_it = selList.find(start);
|
||||||
|
end_it = selList.find(end);
|
||||||
|
|
||||||
|
if ( (start_it != selList.end()) )
|
||||||
{
|
{
|
||||||
selList[i] = 0;
|
if ( (end_it != selList.end()) )
|
||||||
|
{
|
||||||
|
selList.erase( start_it, end_it );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (start_it != selList.end())
|
||||||
|
{
|
||||||
|
start_it = selList.erase( start_it );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
noteThatItemRangeChanged(start, end, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selList.clear();
|
||||||
|
noteThatItemChanged( -1, 0);
|
||||||
}
|
}
|
||||||
noteThatItemRangeChanged(start, end, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SELECTION::selectAllRows(void)
|
void SELECTION::selectAllRows(void)
|
||||||
|
@ -781,6 +788,7 @@ void SELECTION::transposeVertically(int shift)
|
||||||
{
|
{
|
||||||
//ListView_SetItemState(pianoRoll.hwndList, pos, LVIS_SELECTED, LVIS_SELECTED);
|
//ListView_SetItemState(pianoRoll.hwndList, pos, LVIS_SELECTED, LVIS_SELECTED);
|
||||||
selList[pos] = 1;
|
selList[pos] = 1;
|
||||||
|
noteThatItemChanged(pos, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -794,6 +802,7 @@ void SELECTION::transposeVertically(int shift)
|
||||||
{
|
{
|
||||||
//ListView_SetItemState(pianoRoll.hwndList, pos, LVIS_SELECTED, LVIS_SELECTED);
|
//ListView_SetItemState(pianoRoll.hwndList, pos, LVIS_SELECTED, LVIS_SELECTED);
|
||||||
selList[pos] = 1;
|
selList[pos] = 1;
|
||||||
|
noteThatItemChanged(pos, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -791,7 +791,8 @@ void SPLICER::redrawInfoAboutClipboard(void)
|
||||||
char num[16];
|
char num[16];
|
||||||
char new_text[128];
|
char new_text[128];
|
||||||
|
|
||||||
strcpy(new_text, clipboardText);
|
//strcpy(new_text, clipboardText);
|
||||||
|
new_text[0] = 0;
|
||||||
// rows
|
// rows
|
||||||
if (clipboardSelection.size() > 1)
|
if (clipboardSelection.size() > 1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue