Implement CLUT context menu

This commit is contained in:
G.K.MacGregor
2024-04-30 21:12:35 +01:00
parent 12649e3adf
commit 05cf313b63
3 changed files with 60 additions and 1 deletions

View File

@@ -1049,7 +1049,7 @@ void X26DockWidget::deleteTriplet()
void X26DockWidget::customMenuRequested(QPoint pos)
{
QMenu *customMenu;
QMenu *customMenu = nullptr;
QModelIndex index = m_x26View->indexAt(pos);
@@ -1064,6 +1064,23 @@ void X26DockWidget::customMenuRequested(QPoint pos)
const int modeExt = index.model()->data(index.model()->index(index.row(), 2), Qt::EditRole).toInt();
switch (modeExt) {
case 0x01: // Full Row colour
case 0x07: // Address row 0
customMenu = new TripletCLUTQMenu(true, this);
connect(static_cast<TripletCLUTQMenu *>(customMenu)->action(32), &QAction::triggered, [=]() { updateModelFromCookedWidget(0, Qt::UserRole+2); updateAllCookedTripletWidgets(index); });
connect(static_cast<TripletCLUTQMenu *>(customMenu)->action(33), &QAction::triggered, [=]() { updateModelFromCookedWidget(1, Qt::UserRole+2); updateAllCookedTripletWidgets(index); });
// fall-through
case 0x00: // Full Screen colour
case 0x20: // Foreground colour
case 0x23: // Background colour
if (!customMenu)
customMenu = new TripletCLUTQMenu(false, this);
for (int m=0; m<32; m++) {
static_cast<TripletCLUTQMenu *>(customMenu)->setColour(m, m_parentMainWidget->document()->currentSubPage()->CLUTtoQColor(m));
connect(static_cast<TripletCLUTQMenu *>(customMenu)->action(m), &QAction::triggered, [=]() { updateModelFromCookedWidget(m, Qt::UserRole+1); updateAllCookedTripletWidgets(index); });
}
customMenu->addSeparator();
break;
case 0x21: // G1 mosaic character
case 0x22: // G3 mosaic character at level 1.5
case 0x2b: // G3 mosaic character at level >=2.5