Warn when Active Position differs between Levels
This commit is contained in:
@@ -238,11 +238,18 @@ void X26TripletList::updateInternalData()
|
||||
case 0x22: // G3 mosaic character at level 1.5
|
||||
case 0x2f: // G2 character
|
||||
activePosition.setColumn(triplet->addressColumn());
|
||||
|
||||
if (activePosition.row() != triplet->m_activePositionRow || activePosition.column() != triplet->m_activePositionColumn)
|
||||
triplet->m_activePosition1p5Differs = true;
|
||||
break;
|
||||
default:
|
||||
if (triplet->modeExt() >= 0x30 && triplet->modeExt() <= 0x3f)
|
||||
if (triplet->modeExt() >= 0x30 && triplet->modeExt() <= 0x3f) {
|
||||
// G0 diacritical mark
|
||||
activePosition.setColumn(triplet->addressColumn());
|
||||
|
||||
if (activePosition.row() != triplet->m_activePositionRow || activePosition.column() != triplet->m_activePositionColumn)
|
||||
triplet->m_activePosition1p5Differs = true;
|
||||
}
|
||||
}
|
||||
|
||||
triplet->m_activePositionRow1p5 = activePosition.row();
|
||||
|
||||
@@ -66,6 +66,7 @@ public:
|
||||
X26TripletError error() const { return m_error; }
|
||||
bool reservedMode() const { return m_reservedMode; }
|
||||
bool reservedData() const { return m_reservedData; }
|
||||
bool activePosition1p5Differs() const { return m_activePosition1p5Differs; }
|
||||
|
||||
friend class X26TripletList;
|
||||
|
||||
@@ -77,6 +78,7 @@ private:
|
||||
int m_activePositionColumn = -1;
|
||||
int m_activePositionRow1p5 = -1;
|
||||
int m_activePositionColumn1p5 = -1;
|
||||
bool m_activePosition1p5Differs = false;
|
||||
X26TripletError m_error = NoError;
|
||||
bool m_reservedMode = false;
|
||||
bool m_reservedData = false;
|
||||
|
||||
@@ -69,19 +69,27 @@ QVariant X26Model::data(const QModelIndex &index, int role) const
|
||||
if (role == Qt::ForegroundRole) {
|
||||
if (triplet.error() != X26Triplet::NoError && index.column() == m_tripletErrors[triplet.error()].columnHighlight)
|
||||
return QColor(252, 252, 252);
|
||||
else if ((index.column() == 2 && triplet.reservedMode()) || (index.column() == 3 && triplet.reservedData()))
|
||||
if ((index.column() == 2 && triplet.reservedMode()) || (index.column() == 3 && triplet.reservedData()))
|
||||
return QColor(35, 38, 39);
|
||||
if (index.column() <= 1 && triplet.activePosition1p5Differs())
|
||||
return QColor(35, 38, 39);
|
||||
}
|
||||
|
||||
if (role == Qt::BackgroundRole) {
|
||||
if (triplet.error() != X26Triplet::NoError && index.column() == m_tripletErrors[triplet.error()].columnHighlight)
|
||||
return QColor(218, 68, 63);
|
||||
else if ((index.column() == 2 && triplet.reservedMode()) || (index.column() == 3 && triplet.reservedData()))
|
||||
if ((index.column() == 2 && triplet.reservedMode()) || (index.column() == 3 && triplet.reservedData()))
|
||||
return QColor(246, 116, 0);
|
||||
if (index.column() <= 1 && triplet.activePosition1p5Differs())
|
||||
return QColor(246, 116, 0);
|
||||
}
|
||||
|
||||
if (role == Qt::ToolTipRole && triplet.error() != X26Triplet::NoError)
|
||||
return m_tripletErrors[triplet.error()].message;
|
||||
if (role == Qt::ToolTipRole) {
|
||||
if (triplet.error() != X26Triplet::NoError)
|
||||
return m_tripletErrors[triplet.error()].message;
|
||||
if (triplet.activePosition1p5Differs())
|
||||
return "Active Position differs between Level 1.5 and higher levels";
|
||||
}
|
||||
|
||||
if (role == Qt::DisplayRole || role == Qt::EditRole)
|
||||
switch (index.column()) {
|
||||
|
||||
Reference in New Issue
Block a user