9 Commits

Author SHA1 Message Date
G.K.MacGregor
86e2856d50 Tag version 0.6.2-alpha 2023-08-15 19:50:56 +01:00
G.K.MacGregor
116b02d68f Refresh page when C5 or C6 bits are toggled 2023-08-15 18:41:26 +01:00
G.K.MacGregor
c9a0d0bf84 Change default page timing from 8 to 20 seconds 2023-08-15 18:36:33 +01:00
G.K.MacGregor
f36143e10f Really show correct G0 and G2 character set in widgets
Amendment to 7b59c78. This should prevent spurious NOS character sets from
appearing in the widgets, and should also prevent the G0 and G2 character
sets from getting mixed up in the widgets when those triplets are within
object definitions.

The G0 and G2 character set in the widgets may still be incorrect in corner
cases of objects invoked within areas of the page where the character set
has been changed either with the ESC/Switch spacing attribute or with the
"modified G0/G2 character set designation" triplet.
2023-08-15 18:11:40 +01:00
G.K.MacGregor
6185ca7110 Make full screen+row colours and CLUT remapping undoable 2023-08-13 21:47:22 +01:00
G.K.MacGregor
3729b293f0 Fix pasting 0x7f on unmapped plain text character 2023-08-13 14:38:56 +01:00
G.K.MacGregor
b71c178840 Fix crash if Termination or Define Object was only triplet 2023-08-09 22:20:20 +01:00
G.K.MacGregor
ba2d1241d0 Fix flashing rows with mixed 1Hz and 2Hz rates 2023-08-06 16:49:44 +01:00
G.K.MacGregor
07e0d757bb Forgot to remove "no mod'd G0 and G2 designation" from README 2023-06-24 23:55:55 +01:00
14 changed files with 259 additions and 59 deletions

View File

@@ -28,7 +28,6 @@ Optionally, type `make install` afterwards to place the executable into /usr/loc
The following X/26 enhancement triplets are not rendered by the editor, although the list is fully aware of them.
- Invocation of Objects from POP and GPOP pages.
- DRCS characters.
- Modified G0 and G2 character set designation using X/26 triplets with mode 01000.
- Proportional font spacing on Level 3.5
## Using the X/26 triplet editor

View File

@@ -67,7 +67,7 @@ void TeletextPageDecode::Invocation::buildMap(int level)
int endTripletNumber;
if (m_endTripletNumber == -1)
endTripletNumber = m_tripletList->size();
endTripletNumber = m_tripletList->size()-1;
else
endTripletNumber = m_endTripletNumber;
@@ -466,8 +466,8 @@ void TeletextPageDecode::decodeRow(int r)
if (c == 0 || c == 40 || c == 56) {
level1CharSet = m_level1DefaultCharSet;
m_level1ActivePainter.g0CharSet = m_g0CharacterMap.value(m_defaultG0andG2, 0);
m_level1ActivePainter.g2CharSet = m_g2CharacterMap.value(m_defaultG0andG2, 7);
m_level1ActivePainter.result.g0Set = m_g0CharacterMap.value(m_defaultG0andG2, 0);
m_level1ActivePainter.result.g2Set = m_g2CharacterMap.value(m_defaultG0andG2, 7);
m_level1ActivePainter.attribute.flash.mode = 0;
m_level1ActivePainter.attribute.flash.ratePhase = 0;
@@ -661,12 +661,12 @@ void TeletextPageDecode::decodeRow(int r)
break;
case 0x28: // Modified G0 and G2 character set designation
if (m_level == 3 || triplet.data() == m_defaultG0andG2 || triplet.data() == m_secondG0andG2) {
painter->g0CharSet = m_g0CharacterMap.value(triplet.data(), 0);
painter->g2CharSet = m_g2CharacterMap.value(triplet.data(), 7);
painter->result.g0Set = m_g0CharacterMap.value(triplet.data(), 0);
painter->result.g2Set = m_g2CharacterMap.value(triplet.data(), 7);
} else if (m_secondG0andG2 == -1) {
m_secondG0andG2 = triplet.data();
painter->g0CharSet = m_g0CharacterMap.value(triplet.data(), 0);
painter->g2CharSet = m_g2CharacterMap.value(triplet.data(), 7);
painter->result.g0Set = m_g0CharacterMap.value(triplet.data(), 0);
painter->result.g2Set = m_g2CharacterMap.value(triplet.data(), 7);
}
break;
case 0x2c: // Display attributes
@@ -754,9 +754,9 @@ void TeletextPageDecode::decodeRow(int r)
if (result.code != 0x00) {
m_level1ActivePainter.result.character = result;
if (result.set == 0)
m_level1ActivePainter.result.character.set = m_level1ActivePainter.g0CharSet;
m_level1ActivePainter.result.character.set = m_level1ActivePainter.result.g0Set;
else if (result.set == 2)
m_level1ActivePainter.result.character.set = m_level1ActivePainter.g2CharSet;
m_level1ActivePainter.result.character.set = m_level1ActivePainter.result.g2Set;
x26Character = 1;
}
} else if (m_level >= 2)
@@ -779,10 +779,10 @@ void TeletextPageDecode::decodeRow(int r)
painter->result.character = result;
switch (result.set) {
case 0:
painter->result.character.set = painter->g0CharSet;
painter->result.character.set = painter->result.g0Set;
break;
case 2:
painter->result.character.set = painter->g2CharSet;
painter->result.character.set = painter->result.g2Set;
break;
case 24:
if (painter->attribute.display.underlineSeparated)

View File

@@ -46,6 +46,8 @@ public:
unsigned char cellCharacterCode(int r, int c) const { return m_cell[r][c].character.code; };
int cellCharacterSet(int r, int c) const { return m_cell[r][c].character.set; };
int cellCharacterDiacritical(int r, int c) const { return m_cell[r][c].character.diacritical; };
int cellG0CharacterSet(int r, int c) const { return m_cell[r][c].g0Set; };
int cellG2CharacterSet(int r, int c) const { return m_cell[r][c].g2Set; };
int cellForegroundCLUT(int r, int c) const { return m_cell[r][c].attribute.foregroundCLUT; };
int cellBackgroundCLUT(int r, int c) const { return m_cell[r][c].attribute.backgroundCLUT; };
QColor cellForegroundQColor(int, int);
@@ -164,6 +166,8 @@ private:
textCharacter character;
textAttributes attribute;
CharacterFragment fragment=NormalSize;
int g0Set=0;
int g2Set=7;
};
friend inline bool operator!=(const textCell &lhs, const textCell &rhs)
@@ -179,9 +183,6 @@ private:
textCell rightHalfCell;
textCell bottomHalfCell[72];
int g0CharSet=0;
int g2CharSet=7;
int styleSpreadRows=0;
int setProportionalRows[72], clearProportionalRows[72];
int setBoldRows[72], clearBoldRows[72];

View File

@@ -108,6 +108,7 @@ signals:
void selectionMoved();
void colourChanged(int);
void contentsChange(int);
void pageOptionsChanged();
void aboutToChangeSubPage();
void subPageSelected();
void refreshNeeded();

View File

@@ -561,7 +561,7 @@ PasteCommand::PasteCommand(TeletextDocument *teletextDocument, int pageCharSet,
// Either a Latin character or non-Latin character that can't be converted
// See if it's a Latin character
convertedChar = charToConvert.toLatin1();
if (convertedChar == 0)
if (convertedChar <= 0)
// Couldn't convert - make it a block character so it doesn't need to be inserted-between later on
convertedChar = 0x7f;
}
@@ -732,6 +732,161 @@ void DeleteSubPageCommand::undo()
}
SetFullScreenColourCommand::SetFullScreenColourCommand(TeletextDocument *teletextDocument, int newColour, QUndoCommand *parent) : LevelOneCommand(teletextDocument, parent)
{
m_oldColour = teletextDocument->currentSubPage()->defaultScreenColour();
m_newColour = newColour;
setText(QObject::tr("full screen colour"));
}
void SetFullScreenColourCommand::redo()
{
m_teletextDocument->selectSubPageIndex(m_subPageIndex);
m_teletextDocument->currentSubPage()->setDefaultScreenColour(m_newColour);
emit m_teletextDocument->refreshNeeded();
emit m_teletextDocument->pageOptionsChanged();
}
void SetFullScreenColourCommand::undo()
{
m_teletextDocument->selectSubPageIndex(m_subPageIndex);
m_teletextDocument->currentSubPage()->setDefaultScreenColour(m_oldColour);
emit m_teletextDocument->refreshNeeded();
emit m_teletextDocument->pageOptionsChanged();
}
bool SetFullScreenColourCommand::mergeWith(const QUndoCommand *command)
{
const SetFullScreenColourCommand *newerCommand = static_cast<const SetFullScreenColourCommand *>(command);
if (m_subPageIndex != newerCommand->m_subPageIndex)
return false;
m_newColour = newerCommand->m_newColour;
return true;
}
SetFullRowColourCommand::SetFullRowColourCommand(TeletextDocument *teletextDocument, int newColour, QUndoCommand *parent) : LevelOneCommand(teletextDocument, parent)
{
m_oldColour = teletextDocument->currentSubPage()->defaultRowColour();
m_newColour = newColour;
setText(QObject::tr("full row colour"));
}
void SetFullRowColourCommand::redo()
{
m_teletextDocument->selectSubPageIndex(m_subPageIndex);
m_teletextDocument->currentSubPage()->setDefaultRowColour(m_newColour);
emit m_teletextDocument->refreshNeeded();
emit m_teletextDocument->pageOptionsChanged();
}
void SetFullRowColourCommand::undo()
{
m_teletextDocument->selectSubPageIndex(m_subPageIndex);
m_teletextDocument->currentSubPage()->setDefaultRowColour(m_oldColour);
emit m_teletextDocument->refreshNeeded();
emit m_teletextDocument->pageOptionsChanged();
}
bool SetFullRowColourCommand::mergeWith(const QUndoCommand *command)
{
const SetFullRowColourCommand *newerCommand = static_cast<const SetFullRowColourCommand *>(command);
if (m_subPageIndex != newerCommand->m_subPageIndex)
return false;
m_newColour = newerCommand->m_newColour;
return true;
}
SetCLUTRemapCommand::SetCLUTRemapCommand(TeletextDocument *teletextDocument, int newMap, QUndoCommand *parent) : LevelOneCommand(teletextDocument, parent)
{
m_oldMap = teletextDocument->currentSubPage()->colourTableRemap();
m_newMap = newMap;
setText(QObject::tr("CLUT remapping"));
}
void SetCLUTRemapCommand::redo()
{
m_teletextDocument->selectSubPageIndex(m_subPageIndex);
m_teletextDocument->currentSubPage()->setColourTableRemap(m_newMap);
emit m_teletextDocument->refreshNeeded();
emit m_teletextDocument->pageOptionsChanged();
}
void SetCLUTRemapCommand::undo()
{
m_teletextDocument->selectSubPageIndex(m_subPageIndex);
m_teletextDocument->currentSubPage()->setColourTableRemap(m_oldMap);
emit m_teletextDocument->refreshNeeded();
emit m_teletextDocument->pageOptionsChanged();
}
bool SetCLUTRemapCommand::mergeWith(const QUndoCommand *command)
{
const SetCLUTRemapCommand *newerCommand = static_cast<const SetCLUTRemapCommand *>(command);
if (m_subPageIndex != newerCommand->m_subPageIndex)
return false;
m_newMap = newerCommand->m_newMap;
return true;
}
SetBlackBackgroundSubstCommand::SetBlackBackgroundSubstCommand(TeletextDocument *teletextDocument, bool newSub, QUndoCommand *parent) : LevelOneCommand(teletextDocument, parent)
{
m_oldSub = teletextDocument->currentSubPage()->blackBackgroundSubst();
m_newSub = newSub;
setText(QObject::tr("black background substitution"));
}
void SetBlackBackgroundSubstCommand::redo()
{
m_teletextDocument->selectSubPageIndex(m_subPageIndex);
m_teletextDocument->currentSubPage()->setBlackBackgroundSubst(m_newSub);
emit m_teletextDocument->refreshNeeded();
emit m_teletextDocument->pageOptionsChanged();
}
void SetBlackBackgroundSubstCommand::undo()
{
m_teletextDocument->selectSubPageIndex(m_subPageIndex);
m_teletextDocument->currentSubPage()->setBlackBackgroundSubst(m_oldSub);
emit m_teletextDocument->refreshNeeded();
emit m_teletextDocument->pageOptionsChanged();
}
bool SetBlackBackgroundSubstCommand::mergeWith(const QUndoCommand *command)
{
const SetBlackBackgroundSubstCommand *newerCommand = static_cast<const SetBlackBackgroundSubstCommand *>(command);
if (m_subPageIndex != newerCommand->m_subPageIndex)
return false;
setObsolete(true);
return true;
}
SetColourCommand::SetColourCommand(TeletextDocument *teletextDocument, int colourIndex, int newColour, QUndoCommand *parent) : LevelOneCommand(teletextDocument, parent)
{
m_colourIndex = colourIndex;

View File

@@ -183,6 +183,70 @@ private:
};
#endif // !QT_NO_CLIPBOARD
class SetFullScreenColourCommand : public LevelOneCommand
{
public:
enum { Id = 105 };
SetFullScreenColourCommand(TeletextDocument *, int, QUndoCommand *parent = 0);
void redo() override;
void undo() override;
bool mergeWith(const QUndoCommand *) override;
int id() const override { return Id; }
private:
int m_oldColour, m_newColour;
};
class SetFullRowColourCommand : public LevelOneCommand
{
public:
enum { Id = 106 };
SetFullRowColourCommand(TeletextDocument *, int, QUndoCommand *parent = 0);
void redo() override;
void undo() override;
bool mergeWith(const QUndoCommand *) override;
int id() const override { return Id; }
private:
int m_oldColour, m_newColour;
};
class SetCLUTRemapCommand : public LevelOneCommand
{
public:
enum { Id = 107 };
SetCLUTRemapCommand(TeletextDocument *, int, QUndoCommand *parent = 0);
void redo() override;
void undo() override;
bool mergeWith(const QUndoCommand *) override;
int id() const override { return Id; }
private:
int m_oldMap, m_newMap;
};
class SetBlackBackgroundSubstCommand : public LevelOneCommand
{
public:
enum { Id = 108 };
SetBlackBackgroundSubstCommand(TeletextDocument *, bool, QUndoCommand *parent = 0);
void redo() override;
void undo() override;
bool mergeWith(const QUndoCommand *) override;
int id() const override { return Id; }
private:
int m_oldSub, m_newSub;
};
class SetColourCommand : public LevelOneCommand
{
public:

View File

@@ -64,7 +64,7 @@ void LevelOnePage::clearPage()
m_fastTextLink[i] = { 0x0ff, 0x3f7f };
/* m_subPageNumber = 0x0000; */
m_cycleValue = 8;
m_cycleValue = 20;
m_cycleType = CTseconds;
m_defaultCharSet = 0;
m_defaultNOS = 0;

View File

@@ -30,7 +30,7 @@ int main(int argc, char *argv[])
QApplication::setApplicationDisplayName(QApplication::applicationName());
QApplication::setOrganizationName("gkmac.co.uk");
QApplication::setOrganizationDomain("gkmac.co.uk");
QApplication::setApplicationVersion("0.6.1-alpha");
QApplication::setApplicationVersion("0.6.2-alpha");
QCommandLineParser parser;
parser.setApplicationDescription(QApplication::applicationName());
parser.addHelpOption();

View File

@@ -187,6 +187,7 @@ void TeletextWidget::setControlBit(int bitNumber, bool active)
if (bitNumber == 1 || bitNumber == 2) {
m_pageDecode.decodePage();
m_pageRender.renderPage(true);
update();
}
}
@@ -200,33 +201,6 @@ void TeletextWidget::setDefaultNOS(int newDefaultNOS)
m_levelOnePage->setDefaultNOS(newDefaultNOS);
}
void TeletextWidget::setDefaultScreenColour(int newColour)
{
m_levelOnePage->setDefaultScreenColour(newColour);
m_pageDecode.decodePage();
}
void TeletextWidget::setDefaultRowColour(int newColour)
{
m_levelOnePage->setDefaultRowColour(newColour);
m_pageDecode.decodePage();
update();
}
void TeletextWidget::setColourTableRemap(int newMap)
{
m_levelOnePage->setColourTableRemap(newMap);
m_pageDecode.decodePage();
update();
}
void TeletextWidget::setBlackBackgroundSubst(bool substOn)
{
m_levelOnePage->setBlackBackgroundSubst(substOn);
m_pageDecode.decodePage();
update();
}
void TeletextWidget::setSidePanelWidths(int newLeftSidePanelColumns, int newRightSidePanelColumns)
{
m_levelOnePage->setLeftSidePanelDisplayed(newLeftSidePanelColumns != 0);

View File

@@ -74,10 +74,6 @@ public slots:
void setControlBit(int, bool);
void setDefaultCharSet(int);
void setDefaultNOS(int);
void setDefaultScreenColour(int);
void setDefaultRowColour(int);
void setColourTableRemap(int);
void setBlackBackgroundSubst(bool);
void setSidePanelWidths(int, int);
void setSidePanelAtL35Only(bool);

View File

@@ -285,6 +285,7 @@ void MainWindow::init()
connect(m_textWidget->document()->undoStack(), &QUndoStack::cleanChanged, this, [=]() { setWindowModified(!m_textWidget->document()->undoStack()->isClean()); } );
connect(m_textWidget->document(), &TeletextDocument::aboutToChangeSubPage, m_x26DockWidget, &X26DockWidget::unloadX26List);
connect(m_textWidget->document(), &TeletextDocument::subPageSelected, this, &MainWindow::updatePageWidgets);
connect(m_textWidget->document(), &TeletextDocument::pageOptionsChanged, this, &MainWindow::updatePageWidgets);
connect(m_textWidget, &TeletextWidget::sizeChanged, this, &MainWindow::setSceneDimensions);
connect(m_textWidget->pageDecode(), &TeletextPageDecode::fullScreenColourChanged, m_textScene, &LevelOneScene::setFullScreenColour);
connect(m_textWidget->pageDecode(), &TeletextPageDecode::fullRowColourChanged, m_textScene, &LevelOneScene::setFullRowColour);

View File

@@ -26,6 +26,8 @@
#include "pageenhancementsdockwidget.h"
#include "levelonecommands.h"
PageEnhancementsDockWidget::PageEnhancementsDockWidget(TeletextWidget *parent): QDockWidget(parent)
{
QVBoxLayout *pageEnhancementsLayout = new QVBoxLayout;
@@ -48,9 +50,9 @@ PageEnhancementsDockWidget::PageEnhancementsDockWidget(TeletextWidget *parent):
m_defaultRowColourCombo = new QComboBox;
m_defaultRowColourCombo->setModel(m_parentMainWidget->document()->clutModel());
colourLayout->addWidget(m_defaultScreenColourCombo, 0, 1, 1, 1, Qt::AlignTop);
connect(m_defaultScreenColourCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){ m_parentMainWidget->setDefaultScreenColour(index); });
connect(m_defaultScreenColourCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){ m_parentMainWidget->document()->undoStack()->push(new SetFullScreenColourCommand(m_parentMainWidget->document(), index)); });
colourLayout->addWidget(m_defaultRowColourCombo, 1, 1, 1, 1, Qt::AlignTop);
connect(m_defaultRowColourCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){ m_parentMainWidget->setDefaultRowColour(index); });
connect(m_defaultRowColourCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){ m_parentMainWidget->document()->undoStack()->push(new SetFullRowColourCommand(m_parentMainWidget->document(), index)); });
// CLUT remapping
colourLayout->addWidget(new QLabel(tr("CLUT remapping")), 2, 0, 1, 1);
@@ -64,12 +66,12 @@ PageEnhancementsDockWidget::PageEnhancementsDockWidget(TeletextWidget *parent):
m_colourTableCombo->addItem("Fore 2 Back 2");
m_colourTableCombo->addItem("Fore 2 Back 3");
colourLayout->addWidget(m_colourTableCombo, 2, 1, 1, 1, Qt::AlignTop);
connect(m_colourTableCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){ m_parentMainWidget->setColourTableRemap(index); });
connect(m_colourTableCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){ m_parentMainWidget->document()->undoStack()->push(new SetCLUTRemapCommand(m_parentMainWidget->document(), index)); });
// Black background colour substitution
m_blackBackgroundSubstAct = new QCheckBox("Black background colour substitution");
colourLayout->addWidget(m_blackBackgroundSubstAct, 3, 0, 1, 2, Qt::AlignTop);
connect(m_blackBackgroundSubstAct, &QCheckBox::stateChanged, m_parentMainWidget, &TeletextWidget::setBlackBackgroundSubst);
connect(m_blackBackgroundSubstAct, &QCheckBox::stateChanged, [=](int state){ m_parentMainWidget->document()->undoStack()->push(new SetBlackBackgroundSubstCommand(m_parentMainWidget->document(), state)); });
// Add group box to the main layout
colourGroupBox->setLayout(colourLayout);

View File

@@ -280,7 +280,7 @@ void TeletextPageRender::renderRow(int r, int ph, bool force)
if (ph == 0) {
if (m_decoder->cellFlashMode(r, c) != 0)
flashingRow = (m_decoder->cellFlashRatePhase(r, c) == 0) ? 1 : 2;
flashingRow = qMax(flashingRow, (m_decoder->cellFlashRatePhase(r, c) == 0) ? 1 : 2);
} else
force = m_decoder->cellFlashMode(r, c) != 0;

View File

@@ -368,13 +368,16 @@ 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 0x29: // G0 character
case 0x2f: // G2 character
if (triplet.data() >= 0x20)
return m_fontBitmap.rawBitmap()->copy((triplet.data()-32)*12, m_parentMainWidget->pageDecode()->cellG2CharacterSet(triplet.activePositionRow(), triplet.activePositionColumn())*10, 12, 10);
break;
case 0x29: // G0 character
case 0x30 ... 0x3f: // G0 diacritical mark
if (triplet.data() >= 0x20)
return m_fontBitmap.rawBitmap()->copy((triplet.data()-32)*12, m_parentMainWidget->pageDecode()->cellCharacterSet(triplet.activePositionRow(), triplet.activePositionColumn())*10, 12, 10);
return m_fontBitmap.rawBitmap()->copy((triplet.data()-32)*12, m_parentMainWidget->pageDecode()->cellG0CharacterSet(triplet.activePositionRow(), triplet.activePositionColumn())*10, 12, 10);
break;
};
}
if (role == Qt::EditRole && index.column() == 2)
return triplet.modeExt();
@@ -488,12 +491,16 @@ QVariant X26Model::data(const QModelIndex &index, int role) const
return triplet.data() >> 4;
}
break;
case 0x29: // G0 character
case 0x2f: // G2 character
// Qt::UserRole+1 is character number, returned by default below
if (role == Qt::UserRole+2) // Character set
return m_parentMainWidget->pageDecode()->cellG2CharacterSet(triplet.activePositionRow(), triplet.activePositionColumn());
break;
case 0x29: // G0 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());
return m_parentMainWidget->pageDecode()->cellG0CharacterSet(triplet.activePositionRow(), triplet.activePositionColumn());
break;
};