Convert storeCharacters to a function

This commit is contained in:
G.K.MacGregor
2024-07-09 22:16:58 +01:00
parent 98071d823c
commit 9045160d3a
2 changed files with 23 additions and 29 deletions

View File

@@ -31,23 +31,14 @@ public:
LevelOneCommand(TeletextDocument *teletextDocument, QUndoCommand *parent = 0);
protected:
QByteArrayList storeCharacters(int topRow, int leftColumn, int bottomRow, int rightColumn);
void retrieveCharacters(int topRow, int leftColumn, const QByteArrayList &oldChars);
TeletextDocument *m_teletextDocument;
int m_subPageIndex, m_row, m_column;
bool m_firstDo;
};
class StoreOldCharactersCommand : public LevelOneCommand
{
public:
StoreOldCharactersCommand(TeletextDocument *teletextDocument, QUndoCommand *parent = 0);
protected:
void storeOldCharacters(int topRow, int leftColumn, int bottomRow, int rightColumn);
void retrieveOldCharacters(int topRow, int leftColumn, int bottomRow, int rightColumn);
QByteArrayList m_oldCharacters;
};
class TypeCharacterCommand : public LevelOneCommand
{
public:
@@ -164,7 +155,7 @@ private:
};
#ifndef QT_NO_CLIPBOARD
class CutCommand : public StoreOldCharactersCommand
class CutCommand : public LevelOneCommand
{
public:
CutCommand(TeletextDocument *teletextDocument, QUndoCommand *parent = 0);
@@ -173,11 +164,12 @@ public:
void undo() override;
private:
QByteArrayList m_oldCharacters;
int m_selectionTopRow, m_selectionBottomRow, m_selectionLeftColumn, m_selectionRightColumn;
int m_selectionCornerRow, m_selectionCornerColumn;
};
class PasteCommand : public StoreOldCharactersCommand
class PasteCommand : public LevelOneCommand
{
public:
PasteCommand(TeletextDocument *teletextDocument, int pageCharSet, QUndoCommand *parent = 0);
@@ -186,7 +178,7 @@ public:
void undo() override;
private:
QByteArrayList m_pastingCharacters;
QByteArrayList m_oldCharacters, m_pastingCharacters;
int m_pasteTopRow, m_pasteBottomRow, m_pasteLeftColumn, m_pasteRightColumn;
int m_clipboardDataHeight, m_clipboardDataWidth;
int m_selectionCornerRow, m_selectionCornerColumn;