Merge adjacent "character typed" undo commands

This commit is contained in:
G.K.MacGregor
2021-01-03 21:47:29 +00:00
parent 3455625fb6
commit 8ab3681b52
2 changed files with 94 additions and 26 deletions

View File

@@ -27,21 +27,26 @@
class OverwriteCharacterCommand : public QUndoCommand
{
public:
enum { Id = 101 };
OverwriteCharacterCommand(TeletextDocument *, unsigned char, QUndoCommand *parent = 0);
void redo() override;
void undo() override;
bool mergeWith(const QUndoCommand *) override;
int id() const override { return Id; }
private:
TeletextDocument *m_teletextDocument;
unsigned char m_oldCharacter, m_newCharacter;
int m_subPageIndex, m_row, m_column;
unsigned char m_newCharacter, m_oldRowContents[40], m_newRowContents[40];
int m_subPageIndex, m_row, m_columnStart, m_columnEnd;
bool m_firstDo;
};
class ToggleMosaicBitCommand : public QUndoCommand
{
public:
enum { Id = 2 };
enum { Id = 102 };
ToggleMosaicBitCommand(TeletextDocument *, unsigned char, QUndoCommand *parent = 0);
@@ -59,15 +64,20 @@ private:
class BackspaceCommand : public QUndoCommand
{
public:
enum { Id = 103 };
BackspaceCommand(TeletextDocument *, QUndoCommand *parent = 0);
void redo() override;
void undo() override;
bool mergeWith(const QUndoCommand *) override;
int id() const override { return Id; }
private:
TeletextDocument *m_teletextDocument;
unsigned char m_deletedCharacter;
int m_subPageIndex, m_row, m_column;
unsigned char m_oldRowContents[40], m_newRowContents[40];
int m_subPageIndex, m_row, m_columnStart, m_columnEnd;
bool m_firstDo;
};
class InsertSubPageCommand : public QUndoCommand