Allow header row editing
This commit is contained in:
@@ -68,6 +68,7 @@ TeletextDocument::TeletextDocument()
|
||||
m_undoStack = new QUndoStack(this);
|
||||
m_cursorRow = 1;
|
||||
m_cursorColumn = 0;
|
||||
m_rowZeroAllowed = false;
|
||||
m_selectionCornerRow = m_selectionCornerColumn = -1;
|
||||
m_selectionSubPage = nullptr;
|
||||
|
||||
@@ -252,7 +253,7 @@ void TeletextDocument::cursorUp(bool shiftKey)
|
||||
if (shiftKey && !selectionActive())
|
||||
setSelectionCorner(m_cursorRow, m_cursorColumn);
|
||||
|
||||
if (--m_cursorRow == 0)
|
||||
if (--m_cursorRow == 0 - (int)m_rowZeroAllowed)
|
||||
m_cursorRow = 24;
|
||||
|
||||
if (shiftKey)
|
||||
@@ -269,7 +270,7 @@ void TeletextDocument::cursorDown(bool shiftKey)
|
||||
setSelectionCorner(m_cursorRow, m_cursorColumn);
|
||||
|
||||
if (++m_cursorRow == 25)
|
||||
m_cursorRow = 1;
|
||||
m_cursorRow = (int)!m_rowZeroAllowed;
|
||||
|
||||
if (shiftKey)
|
||||
emit selectionMoved();
|
||||
@@ -333,6 +334,13 @@ void TeletextDocument::moveCursor(int cursorRow, int cursorColumn, bool selectio
|
||||
emit cursorMoved();
|
||||
}
|
||||
|
||||
void TeletextDocument::setRowZeroAllowed(bool allowed)
|
||||
{
|
||||
m_rowZeroAllowed = allowed;
|
||||
if (m_cursorRow == 0 && !allowed)
|
||||
cursorDown();
|
||||
}
|
||||
|
||||
void TeletextDocument::setSelectionCorner(int row, int column)
|
||||
{
|
||||
if (m_selectionCornerRow != row || m_selectionCornerColumn != column) {
|
||||
|
||||
@@ -89,6 +89,8 @@ public:
|
||||
void cursorLeft(bool shiftKey=false);
|
||||
void cursorRight(bool shiftKey=false);
|
||||
void moveCursor(int cursorRow, int cursorColumn, bool selectionInProgress=false);
|
||||
bool rowZeroAllowed() const { return m_rowZeroAllowed; };
|
||||
void setRowZeroAllowed(bool allowed);
|
||||
int selectionTopRow() const { return m_selectionCornerRow == -1 ? m_cursorRow : qMin(m_selectionCornerRow, m_cursorRow); }
|
||||
int selectionBottomRow() const { return qMax(m_selectionCornerRow, m_cursorRow); }
|
||||
int selectionLeftColumn() const { return m_selectionCornerColumn == -1 ? m_cursorColumn : qMin(m_selectionCornerColumn, m_cursorColumn); }
|
||||
@@ -123,6 +125,7 @@ private:
|
||||
std::vector<LevelOnePage *> m_recycleSubPages;
|
||||
QUndoStack *m_undoStack;
|
||||
int m_cursorRow, m_cursorColumn, m_selectionCornerRow, m_selectionCornerColumn;
|
||||
bool m_rowZeroAllowed;
|
||||
LevelOnePage *m_selectionSubPage;
|
||||
ClutModel *m_clutModel;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user