Split Insert triplet button, and add mode menus

The "insert before" and "insert after" buttons will drop a menu to
select the new triplet mode, allowing triplets with different modes to
be inserted with one less mouse click.

The "insert copy" button still does the old behaviour of inserting a
copy of the currently selected triplet.
This commit is contained in:
G.K.MacGregor
2022-03-06 12:00:53 +00:00
parent cda458b5bf
commit 74ebc91ee6
5 changed files with 154 additions and 87 deletions

View File

@@ -797,13 +797,6 @@ QVariant X26Model::headerData(int section, Qt::Orientation orientation, int role
return QVariant();
}
bool X26Model::insertFirstRow()
{
m_parentMainWidget->document()->undoStack()->push(new InsertTripletCommand(m_parentMainWidget->document(), this, 0, 1, X26Triplet(63, 31, 7)));
return true;
}
bool X26Model::insertRows(int row, int count, const QModelIndex &parent)
{
Q_UNUSED(parent);
@@ -815,6 +808,17 @@ bool X26Model::insertRows(int row, int count, const QModelIndex &parent)
return true;
}
bool X26Model::insertRows(int row, int count, const QModelIndex &parent, X26Triplet triplet)
{
Q_UNUSED(parent);
if (m_parentMainWidget->document()->currentSubPage()->enhancements()->size() + count > m_parentMainWidget->document()->currentSubPage()->maxEnhancements())
return false;
m_parentMainWidget->document()->undoStack()->push(new InsertTripletCommand(m_parentMainWidget->document(), this, row, count, triplet));
return true;
}
bool X26Model::removeRows(int row, int count, const QModelIndex &index)
{
Q_UNUSED(index);