From 2f0cd34e32817a61ed560502fbd0bd293cdf5140 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Thu, 16 Feb 2017 00:27:56 +0000 Subject: [PATCH] remove old screen code git-svn-id: svn://qnap.local/TwoTerm/branches/fix-gno-scrolling-region@3163 5590a31f-7b70-45f8-8c82-aa3a8e5f4507 --- cpp/Screen_TextPort.cpp | 124 --------------------------- cpp/Screen_obsolete.cpp | 183 ---------------------------------------- 2 files changed, 307 deletions(-) delete mode 100644 cpp/Screen_TextPort.cpp delete mode 100644 cpp/Screen_obsolete.cpp diff --git a/cpp/Screen_TextPort.cpp b/cpp/Screen_TextPort.cpp deleted file mode 100644 index cce2d7c..0000000 --- a/cpp/Screen_TextPort.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// -// Screen_TextPort.cpp -// 2Term -// -// Created by Kelvin Sherlock on 1/11/2011. -// Copyright 2011 __MyCompanyName__. All rights reserved. -// - -#include "Screen.h" - - - -void Screen::setTextPort(const TextPort& textPort) -{ - TextPort tmp(textPort); - - // call virtual method... - setSize(textPort.frame.width(), textPort.frame.height()); - - tmp.frame.origin = iPoint(0, 0); - _port = tmp; -} - -/* - * Non-destructive tab. - * Sets the horizontal cursor position, may wrap and scroll - * - * - */ -void Screen::tabTo(TextPort *textPort, unsigned xPos) -{ - - if (!textPort) textPort = &_port; - - iRect frame = textPort->frame; - - // best case -- no wrapping needed. - if (xPos < frame.width()) - { - textPort->cursor.x = xPos; - - } - else if (textPort->rightMargin == TextPort::MarginWrap) - { - // worst case -- wrapping needed. - textPort->cursor.x = 0; - incrementY(textPort); - - if (textPort != &_port) _port.cursor = textPort->absoluteCursor(); - - return; - } - else - { - // clamp to right margin. - textPort->cursor.x = frame.width() - 1; - } - - if (textPort != &_port) _port.cursor = textPort->absoluteCursor(); - - return; -} - -// insert a character at the current cursor position, -// moving all characters right 1. -// no wrapping is performed. -void Screen::insertc(TextPort *textPort, uint8_t c) -{ - if (!textPort) textPort = &_port; - - iRect frame = textPort->frame; - iPoint cursor = textPort->cursor; - iPoint absoluteCursor = textPort->absoluteCursor(); - - if (cursor.x >= frame.width()) return; - if (cursor.y >= frame.height()) return; - - CharInfoIterator iter = _screen[absoluteCursor.y].begin(); - CharInfoIterator begin = iter + absoluteCursor.x; - CharInfoIterator end = iter + frame.maxX(); - - CharInfo ci(c, _flag); - // move all chars forward 1. - for (iter = begin; iter < end; ++iter) - { - std::swap(ci, *iter); - } - - _updates.push_back(absoluteCursor); - _updates.push_back(iPoint(frame.maxX(), absoluteCursor.y)); -} - -// delete the character at the current cursor position, -// moving any character to the right left 1 spot -// the final position is blank filled. -// no wrapping is performed. -void Screen::deletec(TextPort *textPort) -{ - if (!textPort) textPort = &_port; - - iRect frame = textPort->frame; - iPoint cursor = textPort->cursor; - iPoint absoluteCursor = textPort->absoluteCursor(); - - if (cursor.x >= frame.width()) return; - if (cursor.y >= frame.height()) return; - - CharInfoIterator iter = _screen[absoluteCursor.y].begin(); - CharInfoIterator begin = iter + absoluteCursor.x; - CharInfoIterator end = iter + frame.maxX() - 1; - - - for (iter = begin; iter < end; ++iter) - { - iter[0] = iter[1]; - - } - - // not sure about the flag situation... - *iter = CharInfo(' ', _flag); - - _updates.push_back(absoluteCursor); - _updates.push_back(iPoint(frame.maxX(), absoluteCursor.y)); -} \ No newline at end of file diff --git a/cpp/Screen_obsolete.cpp b/cpp/Screen_obsolete.cpp deleted file mode 100644 index d366c88..0000000 --- a/cpp/Screen_obsolete.cpp +++ /dev/null @@ -1,183 +0,0 @@ -// -// Screen_obsolete.cpp -// 2Term -// -// Created by Kelvin Sherlock on 1/11/2011. -// Copyright 2011 __MyCompanyName__. All rights reserved. -// - -#include "Screen.h" - -void Screen::setX(int x, bool clamp) -{ - if (x < 0) - { - if (clamp) _port.cursor.x = 0; - return; - } - if (x >= width()) - { - if (clamp) _port.cursor.x = width() - 1; - return; - } - - _port.cursor.x = x; -} - - -void Screen::setY(int y, bool clamp) -{ - if (y < 0) - { - if (clamp) _port.cursor.y = 0; - return; - } - if (y >= height()) - { - if (clamp) _port.cursor.y = height() - 1; - return; - } - - _port.cursor.y = y; -} - -int Screen::incrementX(bool clamp) -{ - setX(_port.cursor.x + 1, clamp); - return _port.cursor.x; -} - -int Screen::decrementX(bool clamp) -{ - setX(_port.cursor.x - 1, clamp); - return _port.cursor.x; -} - -int Screen::incrementY(bool clamp) -{ - setY(_port.cursor.y + 1, clamp); - return _port.cursor.y; -} - -int Screen::decrementY(bool clamp) -{ - setY(_port.cursor.y - 1, clamp); - return _port.cursor.y; -} - -void Screen::tabTo(unsigned xPos) -{ - CharInfo clear(' ', _flag); - CharInfoIterator iter; - - xPos = std::min((int)xPos, width() - 1); - - - _updates.push_back(_port.cursor); - _updates.push_back(iPoint(xPos, _port.cursor.y)); - - for (unsigned x = _port.cursor.x; x < xPos; ++x) - { - _screen[_port.cursor.y][x] = clear; - } - _port.cursor.x = xPos; -} - - - - -void Screen::putc(uint8_t c, bool incrementX) -{ - if (_port.cursor.x < width()) - { - _updates.push_back(_port.cursor); - - _screen[_port.cursor.y][_port.cursor.x] = CharInfo(c, _flag); - - if (incrementX && _port.cursor.x < width() - 1) ++_port.cursor.x; - } -} - - - -void Screen::deletec() -{ - // delete character at cursor. - // move following character up - // set final character to ' ' (retaining flags from previous char) - - if (_port.cursor.x >= width()) return; - - _updates.push_back(_port.cursor); - _updates.push_back(iPoint(width() - 1, _port.cursor.y)); - - - CharInfoIterator end = _screen[_port.cursor.y].end() - 1; - CharInfoIterator iter = _screen[_port.cursor.y].begin() + _port.cursor.x; - - - for ( ; iter != end; ++iter) - { - iter[0] = iter[1]; - - } - // retain the flags previously there. - end->c = ' '; -} - - -void Screen::insertc(uint8_t c) -{ - // insert character at cursor. - // move following characters up (retaining flags). - - if (_port.cursor.x >= width()) return; - - _updates.push_back(_port.cursor); - _updates.push_back(iPoint(width() - 1, _port.cursor.y)); - - CharInfoIterator end = _screen[_port.cursor.y].end() - 1; - CharInfoIterator iter = _screen[_port.cursor.y].begin() + _port.cursor.x; - - for ( ; iter != end; ++iter) - { - iter[1] = iter[0]; - } - - iter->c = ' '; -} - -void Screen::eraseLine() -{ - // erases everything to the right of, and including, the cursor - - for (CharInfoIterator ciIter = _screen[y()].begin() + x(); ciIter < _screen[y()].end(); ++ciIter) - { - *ciIter = CharInfo(0, _flag); - } - - _updates.push_back(cursor()); - _updates.push_back(iPoint(width() - 1, y())); -} - -void Screen::eraseScreen() -{ - // returns everything to the right of, and including, the cursor as well as all subsequent lines. - - eraseLine(); - - if (y() == height() -1) return; - - for (ScreenIterator iter = _screen.begin() + y(); iter < _screen.end(); ++iter) - { - for (CharInfoIterator ciIter = iter->begin(); ciIter < iter->end(); ++ciIter) - { - *ciIter = CharInfo(0, _flag); - } - - } - - _updates.push_back(iPoint(0, y() + 1)); - _updates.push_back(iPoint(width() - 1, height() - 1)); -} -