From 7b59c78cee01d528264a4a913056617470e41627 Mon Sep 17 00:00:00 2001 From: "G.K.MacGregor" Date: Fri, 23 Jun 2023 18:39:36 +0100 Subject: [PATCH] Show correct G0 and G2 character set from page in widgets --- x26dockwidget.cpp | 11 ++++------- x26model.cpp | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/x26dockwidget.cpp b/x26dockwidget.cpp index dc0d77b..7fda6d5 100644 --- a/x26dockwidget.cpp +++ b/x26dockwidget.cpp @@ -749,16 +749,13 @@ void X26DockWidget::updateAllCookedTripletWidgets(const QModelIndex &index) case 0x29: // G0 character case 0x2b: // G3 character at Level 2.5 case 0x2f ... 0x3f: // G2 character, G0 character with diacritical - // TODO non-Latin G0 and G2 character sets m_characterCodeComboBox->blockSignals(true); - if (modeExt == 0x22 || modeExt == 0x2b) - m_characterListModel.setCharacterSet(26); - else if (modeExt == 0x2f) - m_characterListModel.setCharacterSet(7); - else if (modeExt == 0x21) + if (modeExt == 0x21) m_characterListModel.setCharacterSet(24); + else if (modeExt == 0x22 || modeExt == 0x2b) + m_characterListModel.setCharacterSet(26); 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->blockSignals(false); m_tripletParameterStackedLayout->setCurrentIndex(2); diff --git a/x26model.cpp b/x26model.cpp index f3c2586..b92a23f 100644 --- a/x26model.cpp +++ b/x26model.cpp @@ -368,16 +368,11 @@ QVariant X26Model::data(const QModelIndex &index, int role) const if (triplet.data() >= 0x20) return m_fontBitmap.rawBitmap()->copy((triplet.data()-32)*12, 26*10, 12, 10); 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 0x2f: // G2 character case 0x30 ... 0x3f: // G0 diacritical mark - // TODO non-Latin G0 character sets 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; }; @@ -493,9 +488,16 @@ QVariant X26Model::data(const QModelIndex &index, int role) const return triplet.data() >> 4; } 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) return triplet.data();