Show correct G0 and G2 character set from page in widgets

This commit is contained in:
G.K.MacGregor
2023-06-23 18:39:36 +01:00
parent c8f61d4d2c
commit 7b59c78cee
2 changed files with 14 additions and 15 deletions

View File

@@ -749,16 +749,13 @@ void X26DockWidget::updateAllCookedTripletWidgets(const QModelIndex &index)
case 0x29: // G0 character case 0x29: // G0 character
case 0x2b: // G3 character at Level 2.5 case 0x2b: // G3 character at Level 2.5
case 0x2f ... 0x3f: // G2 character, G0 character with diacritical case 0x2f ... 0x3f: // G2 character, G0 character with diacritical
// TODO non-Latin G0 and G2 character sets
m_characterCodeComboBox->blockSignals(true); m_characterCodeComboBox->blockSignals(true);
if (modeExt == 0x22 || modeExt == 0x2b) if (modeExt == 0x21)
m_characterListModel.setCharacterSet(26);
else if (modeExt == 0x2f)
m_characterListModel.setCharacterSet(7);
else if (modeExt == 0x21)
m_characterListModel.setCharacterSet(24); m_characterListModel.setCharacterSet(24);
else if (modeExt == 0x22 || modeExt == 0x2b)
m_characterListModel.setCharacterSet(26);
else else
m_characterListModel.setCharacterSet(0); m_characterListModel.setCharacterSet(index.model()->data(index.model()->index(index.row(), 0), Qt::UserRole+2).toInt());
m_characterCodeComboBox->setCurrentIndex(index.model()->data(index.model()->index(index.row(), 0), Qt::UserRole+1).toInt()-32); m_characterCodeComboBox->setCurrentIndex(index.model()->data(index.model()->index(index.row(), 0), Qt::UserRole+1).toInt()-32);
m_characterCodeComboBox->blockSignals(false); m_characterCodeComboBox->blockSignals(false);
m_tripletParameterStackedLayout->setCurrentIndex(2); m_tripletParameterStackedLayout->setCurrentIndex(2);

View File

@@ -368,16 +368,11 @@ QVariant X26Model::data(const QModelIndex &index, int role) const
if (triplet.data() >= 0x20) if (triplet.data() >= 0x20)
return m_fontBitmap.rawBitmap()->copy((triplet.data()-32)*12, 26*10, 12, 10); return m_fontBitmap.rawBitmap()->copy((triplet.data()-32)*12, 26*10, 12, 10);
break; break;
case 0x2f: // G2 character
// TODO non-Latin G2 character sets
if (triplet.data() >= 0x20)
return m_fontBitmap.rawBitmap()->copy((triplet.data()-32)*12, 7*10, 12, 10);
break;
case 0x29: // G0 character case 0x29: // G0 character
case 0x2f: // G2 character
case 0x30 ... 0x3f: // G0 diacritical mark case 0x30 ... 0x3f: // G0 diacritical mark
// TODO non-Latin G0 character sets
if (triplet.data() >= 0x20) if (triplet.data() >= 0x20)
return m_fontBitmap.rawBitmap()->copy((triplet.data()-32)*12, 0, 12, 10); return m_fontBitmap.rawBitmap()->copy((triplet.data()-32)*12, m_parentMainWidget->pageDecode()->cellCharacterSet(triplet.activePositionRow(), triplet.activePositionColumn())*10, 12, 10);
break; break;
}; };
@@ -493,9 +488,16 @@ QVariant X26Model::data(const QModelIndex &index, int role) const
return triplet.data() >> 4; return triplet.data() >> 4;
} }
break; break;
case 0x29: // G0 character
case 0x2f: // G2 character
case 0x30 ... 0x3f: // G0 diacritical mark
// Qt::UserRole+1 is character number, returned by default below
if (role == Qt::UserRole+2) // Character set
return m_parentMainWidget->pageDecode()->cellCharacterSet(triplet.activePositionRow(), triplet.activePositionColumn());
break;
}; };
// Fpr other triplet modes, return the complete data value // For characters and other triplet modes, return the complete data value
if (role == Qt::UserRole+1) if (role == Qt::UserRole+1)
return triplet.data(); return triplet.data();