Implement cut, copy and paste

This commit is contained in:
G.K.MacGregor
2021-05-03 22:17:51 +01:00
parent 551172aed3
commit 9fa86f8c4c
6 changed files with 286 additions and 11 deletions

View File

@@ -20,6 +20,7 @@
#ifndef LEVELONECOMMANDS_H
#define LEVELONECOMMANDS_H
#include <QByteArrayList>
#include <QUndoCommand>
#include "document.h"
@@ -150,6 +151,38 @@ private:
unsigned char m_deletedRow[40];
};
#ifndef QT_NO_CLIPBOARD
class CutCommand : public LevelOneCommand
{
public:
CutCommand(TeletextDocument *, QUndoCommand *parent = 0);
void redo() override;
void undo() override;
private:
QByteArrayList m_deletedCharacters;
int m_selectionTopRow, m_selectionBottomRow, m_selectionLeftColumn, m_selectionRightColumn;
int m_selectionCornerRow, m_selectionCornerColumn;
};
class PasteCommand : public LevelOneCommand
{
public:
PasteCommand(TeletextDocument *, QUndoCommand *parent = 0);
void redo() override;
void undo() override;
private:
QByteArrayList m_deletedCharacters, m_pastingCharacters;
int m_pasteTopRow, m_pasteBottomRow, m_pasteLeftColumn, m_pasteRightColumn;
int m_clipboardDataHeight, m_clipboardDataWidth;
int m_selectionCornerRow, m_selectionCornerColumn;
bool m_selectionActive;
};
#endif // !QT_NO_CLIPBOARD
class SetColourCommand : public LevelOneCommand
{
public: