Simplify storage of NOS control bits
This commit is contained in:
@@ -255,41 +255,27 @@ bool LevelOnePage::packetExists(int y, int d) const
|
|||||||
return PageX26Base::packetExists(y, d);
|
return PageX26Base::packetExists(y, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LevelOnePage::controlBit(int b) const
|
|
||||||
{
|
|
||||||
switch (b) {
|
|
||||||
case C12NOS:
|
|
||||||
return (m_defaultNOS & 1) == 1;
|
|
||||||
case C13NOS:
|
|
||||||
return (m_defaultNOS & 2) == 2;
|
|
||||||
case C14NOS:
|
|
||||||
return (m_defaultNOS & 4) == 4;
|
|
||||||
default:
|
|
||||||
return PageX26Base::controlBit(b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LevelOnePage::setControlBit(int b, bool active)
|
bool LevelOnePage::setControlBit(int b, bool active)
|
||||||
{
|
{
|
||||||
switch (b) {
|
switch (b) {
|
||||||
case C12NOS:
|
case C12NOS:
|
||||||
m_defaultNOS &= 0x06;
|
m_defaultNOS &= 0x6;
|
||||||
if (active)
|
if (active)
|
||||||
m_defaultNOS |= 0x01;
|
m_defaultNOS |= 0x1;
|
||||||
return true;
|
break;
|
||||||
case C13NOS:
|
case C13NOS:
|
||||||
m_defaultNOS &= 0x05;
|
m_defaultNOS &= 0x5;
|
||||||
if (active)
|
if (active)
|
||||||
m_defaultNOS |= 0x02;
|
m_defaultNOS |= 0x2;
|
||||||
return true;
|
break;
|
||||||
case C14NOS:
|
case C14NOS:
|
||||||
m_defaultNOS &= 0x03;
|
m_defaultNOS &= 0x3;
|
||||||
if (active)
|
if (active)
|
||||||
m_defaultNOS |= 0x04;
|
m_defaultNOS |= 0x4;
|
||||||
return true;
|
break;
|
||||||
default:
|
|
||||||
return PageX26Base::setControlBit(b, active);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return PageX26Base::setControlBit(b, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void LevelOnePage::setSubPageNumber(int newSubPageNumber) { m_subPageNumber = newSubPageNumber; } */
|
/* void LevelOnePage::setSubPageNumber(int newSubPageNumber) { m_subPageNumber = newSubPageNumber; } */
|
||||||
@@ -300,6 +286,10 @@ void LevelOnePage::setDefaultCharSet(int newDefaultCharSet) { m_defaultCharSet =
|
|||||||
void LevelOnePage::setDefaultNOS(int defaultNOS)
|
void LevelOnePage::setDefaultNOS(int defaultNOS)
|
||||||
{
|
{
|
||||||
m_defaultNOS = defaultNOS;
|
m_defaultNOS = defaultNOS;
|
||||||
|
|
||||||
|
PageX26Base::setControlBit(C12NOS, m_defaultNOS & 0x1);
|
||||||
|
PageX26Base::setControlBit(C13NOS, m_defaultNOS & 0x2);
|
||||||
|
PageX26Base::setControlBit(C14NOS, m_defaultNOS & 0x4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelOnePage::setSecondCharSet(int newSecondCharSet)
|
void LevelOnePage::setSecondCharSet(int newSecondCharSet)
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ public:
|
|||||||
bool setPacket(int y, int d, QByteArray pkt) override;
|
bool setPacket(int y, int d, QByteArray pkt) override;
|
||||||
bool packetExists(int y, int d) const override;
|
bool packetExists(int y, int d) const override;
|
||||||
|
|
||||||
bool controlBit(int b) const override;
|
|
||||||
bool setControlBit(int b, bool active) override;
|
bool setControlBit(int b, bool active) override;
|
||||||
|
|
||||||
void clearPage();
|
void clearPage();
|
||||||
|
|||||||
Reference in New Issue
Block a user