Made TermBuffer fit a bit better into our coding style. Removed some
useless stuff. Not yet finished. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21523 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5f470189bc
commit
6b5ac907c4
@ -86,6 +86,10 @@ but it font is full width font on preference panel.
|
|||||||
#include "CurPos.h"
|
#include "CurPos.h"
|
||||||
#include "PrefHandler.h"
|
#include "PrefHandler.h"
|
||||||
|
|
||||||
|
#define ARRAY_SIZE 512
|
||||||
|
#define ROW(x) (((x) + fRowOffset) % fBufferSize)
|
||||||
|
|
||||||
|
|
||||||
extern PrefHandler *gTermPref;
|
extern PrefHandler *gTermPref;
|
||||||
|
|
||||||
|
|
||||||
@ -98,35 +102,35 @@ TermBuffer::TermBuffer(int rows, int cols)
|
|||||||
else if (cols > MAX_COLS)
|
else if (cols > MAX_COLS)
|
||||||
cols = MAX_COLS;
|
cols = MAX_COLS;
|
||||||
|
|
||||||
mColSize = MAX_COLS;
|
fColumnSize = MAX_COLS;
|
||||||
mNowColSize = cols;
|
fCurrentColumnSize = cols;
|
||||||
mRowSize = rows;
|
fRowSize = rows;
|
||||||
|
|
||||||
mRowOffset = 0;
|
fRowOffset = 0;
|
||||||
|
|
||||||
mSelStart.Set(-1,-1);
|
fSelStart.Set(-1,-1);
|
||||||
mSelEnd.Set(-1,-1);
|
fSelEnd.Set(-1,-1);
|
||||||
|
|
||||||
buffer_size = gTermPref->getInt32(PREF_HISTORY_SIZE);
|
fBufferSize = gTermPref->getInt32(PREF_HISTORY_SIZE);
|
||||||
if (buffer_size < 1000)
|
if (fBufferSize < 1000)
|
||||||
buffer_size = 1000;
|
fBufferSize = 1000;
|
||||||
|
|
||||||
// Allocate buffer
|
// Allocate buffer
|
||||||
mBase = (term_buffer**)malloc(sizeof(term_buffer*) * buffer_size);
|
fBuffer = (term_buffer**)malloc(sizeof(term_buffer*) * fBufferSize);
|
||||||
|
|
||||||
for (int i = 0; i < buffer_size; i++) {
|
for (int i = 0; i < fBufferSize; i++) {
|
||||||
mBase[i] = (term_buffer *)calloc(mColSize + 1, sizeof(term_buffer));
|
fBuffer[i] = (term_buffer *)calloc(fColumnSize + 1, sizeof(term_buffer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TermBuffer::~TermBuffer()
|
TermBuffer::~TermBuffer()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < buffer_size; i++) {
|
for (int i = 0; i < fBufferSize; i++) {
|
||||||
free(mBase[i]);
|
free(fBuffer[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(mBase);
|
free(fBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -137,7 +141,7 @@ TermBuffer::GetChar(int row, int col, uchar *buf, ushort *attr)
|
|||||||
if (row < 0 || col < 0)
|
if (row < 0 || col < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
term_buffer *ptr = (mBase[row % buffer_size] + col);
|
term_buffer *ptr = (fBuffer[row % fBufferSize] + col);
|
||||||
|
|
||||||
if (ptr->status == A_CHAR)
|
if (ptr->status == A_CHAR)
|
||||||
memcpy(buf, (char *)(ptr->code), 4);
|
memcpy(buf, (char *)(ptr->code), 4);
|
||||||
@ -156,14 +160,14 @@ TermBuffer::GetString(int row, int col, int num, uchar *buf,
|
|||||||
int count = 0, all_count = 0;
|
int count = 0, all_count = 0;
|
||||||
term_buffer *ptr;
|
term_buffer *ptr;
|
||||||
|
|
||||||
ptr = (mBase[row % buffer_size]);
|
ptr = (fBuffer[row % fBufferSize]);
|
||||||
ptr += col;
|
ptr += col;
|
||||||
*attr = ptr->attr;
|
*attr = ptr->attr;
|
||||||
|
|
||||||
if (ptr->status == NO_CHAR) {
|
if (ptr->status == NO_CHAR) {
|
||||||
// Buffer is empty and No selected by mouse.
|
// Buffer is empty and No selected by mouse.
|
||||||
do {
|
do {
|
||||||
if (col >= mNowColSize)
|
if (col >= fCurrentColumnSize)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
@ -172,13 +176,13 @@ TermBuffer::GetString(int row, int col, int num, uchar *buf,
|
|||||||
if (ptr->status == A_CHAR)
|
if (ptr->status == A_CHAR)
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
if (mSelStart.y == row) {
|
if (fSelStart.y == row) {
|
||||||
if (col == mSelStart.x)
|
if (col == fSelStart.x)
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSelEnd.y == row) {
|
if (fSelEnd.y == row) {
|
||||||
if (col - 1 == mSelEnd.x)
|
if (col - 1 == fSelEnd.x)
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
} while (col <= num);
|
} while (col <= num);
|
||||||
@ -204,12 +208,12 @@ TermBuffer::GetString(int row, int col, int num, uchar *buf,
|
|||||||
ptr++;
|
ptr++;
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
if (mSelStart.y == row) {
|
if (fSelStart.y == row) {
|
||||||
if (col == mSelStart.x)
|
if (col == fSelStart.x)
|
||||||
return all_count;
|
return all_count;
|
||||||
}
|
}
|
||||||
if (mSelEnd.y == row) {
|
if (fSelEnd.y == row) {
|
||||||
if (col - 1 == mSelEnd.x)
|
if (col - 1 == fSelEnd.x)
|
||||||
return all_count;
|
return all_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +231,7 @@ TermBuffer::WriteChar(const CurPos &pos, const uchar *u, ushort attr)
|
|||||||
const int row = pos.y;
|
const int row = pos.y;
|
||||||
const int col = pos.x;
|
const int col = pos.x;
|
||||||
|
|
||||||
ptr = (mBase[ROW(row)] + col);
|
ptr = (fBuffer[ROW(row)] + col);
|
||||||
memcpy ((char *)ptr->code, u, 4);
|
memcpy ((char *)ptr->code, u, 4);
|
||||||
|
|
||||||
if (IS_WIDTH(attr))
|
if (IS_WIDTH(attr))
|
||||||
@ -245,7 +249,7 @@ TermBuffer::WriteCR(const CurPos &pos)
|
|||||||
int row = pos.y;
|
int row = pos.y;
|
||||||
int col = pos.x;
|
int col = pos.x;
|
||||||
|
|
||||||
term_buffer *ptr = (mBase[ROW(row)] + col);
|
term_buffer *ptr = (fBuffer[ROW(row)] + col);
|
||||||
ptr->attr |= DUMPCR;
|
ptr->attr |= DUMPCR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,11 +261,11 @@ TermBuffer::InsertSpace(const CurPos &pos, int num)
|
|||||||
const int row = pos.y;
|
const int row = pos.y;
|
||||||
const int col = pos.x;
|
const int col = pos.x;
|
||||||
|
|
||||||
for (int i = mNowColSize - num; i >= col; i--) {
|
for (int i = fCurrentColumnSize - num; i >= col; i--) {
|
||||||
*(mBase[ROW(row)] + i + num) = *(mBase[ROW(row)] + i);
|
*(fBuffer[ROW(row)] + i + num) = *(fBuffer[ROW(row)] + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(mBase[ROW(row)] + col, 0, num * sizeof(term_buffer));
|
memset(fBuffer[ROW(row)] + col, 0, num * sizeof(term_buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -272,11 +276,11 @@ TermBuffer::DeleteChar(const CurPos &pos, int num)
|
|||||||
const int row = pos.y;
|
const int row = pos.y;
|
||||||
const int col = pos.x;
|
const int col = pos.x;
|
||||||
|
|
||||||
term_buffer *ptr = mBase[ROW(row)];
|
term_buffer *ptr = fBuffer[ROW(row)];
|
||||||
size_t movesize = mNowColSize - (col + num);
|
size_t movesize = fCurrentColumnSize - (col + num);
|
||||||
|
|
||||||
memmove(ptr + col, ptr + col + num, movesize * sizeof(term_buffer));
|
memmove(ptr + col, ptr + col + num, movesize * sizeof(term_buffer));
|
||||||
memset(ptr + (mNowColSize - num), 0, num * sizeof(term_buffer));
|
memset(ptr + (fCurrentColumnSize - num), 0, num * sizeof(term_buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -287,9 +291,9 @@ TermBuffer::EraseBelow(const CurPos &pos)
|
|||||||
const int row = pos.y;
|
const int row = pos.y;
|
||||||
const int col = pos.x;
|
const int col = pos.x;
|
||||||
|
|
||||||
memset(mBase[ROW(row)] + col, 0, (mColSize - col ) * sizeof(term_buffer));
|
memset(fBuffer[ROW(row)] + col, 0, (fColumnSize - col ) * sizeof(term_buffer));
|
||||||
|
|
||||||
for (int i = row; i < mRowSize; i++) {
|
for (int i = row; i < fRowSize; i++) {
|
||||||
EraseLine(i);
|
EraseLine(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,25 +305,25 @@ TermBuffer::ScrollRegion(int top, int bot, int dir, int num)
|
|||||||
{
|
{
|
||||||
if (dir == SCRUP) {
|
if (dir == SCRUP) {
|
||||||
for (int i = 0; i < num; i++) {
|
for (int i = 0; i < num; i++) {
|
||||||
term_buffer *ptr = mBase[ROW(top)];
|
term_buffer *ptr = fBuffer[ROW(top)];
|
||||||
|
|
||||||
for (int j = top; j < bot; j++) {
|
for (int j = top; j < bot; j++) {
|
||||||
mBase[ROW(j)] = mBase[ROW(j+1)];
|
fBuffer[ROW(j)] = fBuffer[ROW(j+1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
mBase[ROW(bot)] = ptr;
|
fBuffer[ROW(bot)] = ptr;
|
||||||
EraseLine(bot);
|
EraseLine(bot);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// scroll up
|
// scroll up
|
||||||
for (int i = 0; i < num; i++) {
|
for (int i = 0; i < num; i++) {
|
||||||
term_buffer *ptr = mBase[ROW(bot)];
|
term_buffer *ptr = fBuffer[ROW(bot)];
|
||||||
|
|
||||||
for (int j = bot; j > top; j--) {
|
for (int j = bot; j > top; j--) {
|
||||||
mBase[ROW(j)] = mBase[ROW(j-1)];
|
fBuffer[ROW(j)] = fBuffer[ROW(j-1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
mBase[ROW(top)] = ptr;
|
fBuffer[ROW(top)] = ptr;
|
||||||
EraseLine(top);
|
EraseLine(top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -330,11 +334,11 @@ TermBuffer::ScrollRegion(int top, int bot, int dir, int num)
|
|||||||
void
|
void
|
||||||
TermBuffer::ScrollLine()
|
TermBuffer::ScrollLine()
|
||||||
{
|
{
|
||||||
for (int i = mRowSize; i < mRowSize * 2; i++) {
|
for (int i = fRowSize; i < fRowSize * 2; i++) {
|
||||||
EraseLine(i);
|
EraseLine(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
mRowOffset++;
|
fRowOffset++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -353,44 +357,44 @@ TermBuffer::ResizeTo(int newRows, int newCols, int offset)
|
|||||||
else if (newCols > MAX_COLS)
|
else if (newCols > MAX_COLS)
|
||||||
newCols = MAX_COLS;
|
newCols = MAX_COLS;
|
||||||
|
|
||||||
if (newRows <= mRowSize) {
|
if (newRows <= fRowSize) {
|
||||||
for (i = newRows; i <= mRowSize; i++)
|
for (i = newRows; i <= fRowSize; i++)
|
||||||
EraseLine(i);
|
EraseLine(i);
|
||||||
} else {
|
} else {
|
||||||
for (i = mRowSize; i <= newRows * 2; i++)
|
for (i = fRowSize; i <= newRows * 2; i++)
|
||||||
EraseLine(i);
|
EraseLine(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
mNowColSize = newCols;
|
fCurrentColumnSize = newCols;
|
||||||
mRowOffset += offset;
|
fRowOffset += offset;
|
||||||
mRowSize = newRows;
|
fRowSize = newRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Get the buffer's size.
|
//! Get the buffer's size.
|
||||||
int32
|
int32
|
||||||
TermBuffer::GetArraySize()
|
TermBuffer::Size() const
|
||||||
{
|
{
|
||||||
return buffer_size;
|
return fBufferSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TermBuffer::EraseLine(int row)
|
TermBuffer::EraseLine(int row)
|
||||||
{
|
{
|
||||||
memset(mBase[ROW(row)], 0, mColSize * sizeof(term_buffer));
|
memset(fBuffer[ROW(row)], 0, fColumnSize * sizeof(term_buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Clear the contents of the TermBuffer.
|
//! Clear the contents of the TermBuffer.
|
||||||
void
|
void
|
||||||
TermBuffer::ClearAll()
|
TermBuffer::Clear()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < buffer_size; i++) {
|
for (int i = 0; i < fBufferSize; i++) {
|
||||||
memset(mBase[i], 0, mColSize * sizeof(term_buffer));
|
memset(fBuffer[i], 0, fColumnSize * sizeof(term_buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
mRowOffset = 0;
|
fRowOffset = 0;
|
||||||
DeSelect();
|
DeSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,11 +404,11 @@ void
|
|||||||
TermBuffer::Select(const CurPos &start, const CurPos &end)
|
TermBuffer::Select(const CurPos &start, const CurPos &end)
|
||||||
{
|
{
|
||||||
if (end < start) {
|
if (end < start) {
|
||||||
mSelStart = end;
|
fSelStart = end;
|
||||||
mSelEnd = start;
|
fSelEnd = start;
|
||||||
} else {
|
} else {
|
||||||
mSelStart = start;
|
fSelStart = start;
|
||||||
mSelEnd = end;
|
fSelEnd = end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,8 +417,8 @@ TermBuffer::Select(const CurPos &start, const CurPos &end)
|
|||||||
void
|
void
|
||||||
TermBuffer::DeSelect()
|
TermBuffer::DeSelect()
|
||||||
{
|
{
|
||||||
mSelStart.Set(-1, -1);
|
fSelStart.Set(-1, -1);
|
||||||
mSelEnd.Set(-1, -1);
|
fSelEnd.Set(-1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -422,7 +426,7 @@ TermBuffer::DeSelect()
|
|||||||
int
|
int
|
||||||
TermBuffer::CheckSelectedRegion (const CurPos &pos)
|
TermBuffer::CheckSelectedRegion (const CurPos &pos)
|
||||||
{
|
{
|
||||||
return mSelStart.y == pos.y || mSelEnd.y == pos.y;
|
return fSelStart.y == pos.y || fSelEnd.y == pos.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -445,7 +449,7 @@ TermBuffer::FindWord(const CurPos &pos, CurPos *start, CurPos *end)
|
|||||||
start_x = x;
|
start_x = x;
|
||||||
|
|
||||||
// Search end point
|
// Search end point
|
||||||
for (x = pos.x; x < mColSize; x++) {
|
for (x = pos.x; x < fColumnSize; x++) {
|
||||||
if (GetChar(y, x, buf, &attr) == NO_CHAR || *buf == ' ') {
|
if (GetChar(y, x, buf, &attr) == NO_CHAR || *buf == ' ') {
|
||||||
--x;
|
--x;
|
||||||
break;
|
break;
|
||||||
@ -455,11 +459,11 @@ TermBuffer::FindWord(const CurPos &pos, CurPos *start, CurPos *end)
|
|||||||
if (start_x > x)
|
if (start_x > x)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mSelStart.Set(start_x, y);
|
fSelStart.Set(start_x, y);
|
||||||
if (start != NULL)
|
if (start != NULL)
|
||||||
start->Set(start_x, y);
|
start->Set(start_x, y);
|
||||||
|
|
||||||
mSelEnd.Set(x, y);
|
fSelEnd.Set(x, y);
|
||||||
if (end != NULL)
|
if (end != NULL)
|
||||||
end->Set(x, y);
|
end->Set(x, y);
|
||||||
|
|
||||||
@ -496,6 +500,7 @@ TermBuffer::GetCharFromRegion(int x, int y, BString &str)
|
|||||||
|
|
||||||
|
|
||||||
//! Delete useless char at end of line and convert LF code.
|
//! Delete useless char at end of line and convert LF code.
|
||||||
|
/* static */
|
||||||
inline void
|
inline void
|
||||||
TermBuffer::AvoidWaste(BString &str)
|
TermBuffer::AvoidWaste(BString &str)
|
||||||
{
|
{
|
||||||
@ -521,27 +526,27 @@ TermBuffer::GetStringFromRegion(BString &str)
|
|||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
if (mSelStart.y == mSelEnd.y) {
|
if (fSelStart.y == fSelEnd.y) {
|
||||||
y = mSelStart.y;
|
y = fSelStart.y;
|
||||||
for (int x = mSelStart.x ; x <= mSelEnd.x; x++) {
|
for (int x = fSelStart.x ; x <= fSelEnd.x; x++) {
|
||||||
GetCharFromRegion(x, y, str);
|
GetCharFromRegion(x, y, str);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
y = mSelStart.y;
|
y = fSelStart.y;
|
||||||
for (int x = mSelStart.x ; x < mNowColSize; x++) {
|
for (int x = fSelStart.x ; x < fCurrentColumnSize; x++) {
|
||||||
GetCharFromRegion(x, y, str);
|
GetCharFromRegion(x, y, str);
|
||||||
}
|
}
|
||||||
AvoidWaste(str);
|
AvoidWaste(str);
|
||||||
|
|
||||||
for (y = mSelStart.y + 1 ; y < mSelEnd.y; y++) {
|
for (y = fSelStart.y + 1 ; y < fSelEnd.y; y++) {
|
||||||
for (int x = 0 ; x < mNowColSize; x++) {
|
for (int x = 0 ; x < fCurrentColumnSize; x++) {
|
||||||
GetCharFromRegion(x, y, str);
|
GetCharFromRegion(x, y, str);
|
||||||
}
|
}
|
||||||
AvoidWaste(str);
|
AvoidWaste(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
y = mSelEnd.y;
|
y = fSelEnd.y;
|
||||||
for (int x = 0 ; x <= mSelEnd.x; x++) {
|
for (int x = 0 ; x <= fSelEnd.x; x++) {
|
||||||
GetCharFromRegion(x, y, str);
|
GetCharFromRegion(x, y, str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -551,8 +556,8 @@ TermBuffer::GetStringFromRegion(BString &str)
|
|||||||
void
|
void
|
||||||
TermBuffer::ToString(BString &str)
|
TermBuffer::ToString(BString &str)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < mRowSize; y++) {
|
for (int y = 0; y < fRowSize; y++) {
|
||||||
for (int x = 0; x < mNowColSize; x++) {
|
for (int x = 0; x < fCurrentColumnSize; x++) {
|
||||||
GetCharFromRegion(x, y, str);
|
GetCharFromRegion(x, y, str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,122 +27,103 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef TERMBUFFER_H_INCLUDED
|
#ifndef _TERMBUFFER_H
|
||||||
#define TERMBUFFER_H_INCLUDED
|
#define _TERMBUFFER_H
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
#include "TermConst.h"
|
#include "TermConst.h"
|
||||||
#include "CurPos.h"
|
#include "CurPos.h"
|
||||||
|
|
||||||
// Scroll direction
|
|
||||||
const int array_up = 0;
|
|
||||||
const int array_down = 1;
|
|
||||||
|
|
||||||
#define ARRAY_SIZE 512
|
|
||||||
|
|
||||||
#define MIN_COLS 10
|
#define MIN_COLS 10
|
||||||
#define MAX_COLS 256
|
#define MAX_COLS 256
|
||||||
|
|
||||||
#define ROW(x) (((x) + mRowOffset) % buffer_size)
|
|
||||||
|
|
||||||
typedef struct term_buffer
|
struct term_buffer
|
||||||
{
|
{
|
||||||
uchar code[4];
|
uchar code[4];
|
||||||
int16 attr;
|
int16 attr;
|
||||||
int16 status;
|
int16 status;
|
||||||
} term_buffer;
|
};
|
||||||
|
|
||||||
|
|
||||||
class CurPos;
|
class CurPos;
|
||||||
class BString;
|
class BString;
|
||||||
|
|
||||||
class TermBuffer
|
class TermBuffer {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
TermBuffer(int row, int col);
|
TermBuffer(int row, int col);
|
||||||
~TermBuffer();
|
~TermBuffer();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get and Put charactor.
|
// Get and Put charactor.
|
||||||
//
|
//
|
||||||
int GetChar (int row, int col, uchar *u, ushort *attr);
|
int GetChar(int row, int col, uchar *u, ushort *attr);
|
||||||
|
int GetString(int row, int col, int num, uchar *u, ushort *attr);
|
||||||
|
void GetStringFromRegion (BString ©Str);
|
||||||
|
|
||||||
int GetString (int row, int col, int num, uchar *u, ushort *attr);
|
void WriteChar(const CurPos &pos, const uchar *u, ushort attr);
|
||||||
void GetStringFromRegion (BString ©Str);
|
void WriteCR(const CurPos &pos);
|
||||||
|
void InsertSpace(const CurPos &pos, int num);
|
||||||
|
|
||||||
void WriteChar (const CurPos &pos, const uchar *u, ushort attr);
|
//
|
||||||
void WriteCR (const CurPos &pos);
|
// Delete Character.
|
||||||
void InsertSpace (const CurPos &pos, int num);
|
//
|
||||||
|
void DeleteChar(const CurPos &pos, int num);
|
||||||
|
void EraseBelow(const CurPos &pos);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Delete Charactor.
|
// Movement and Scroll buffer.
|
||||||
//
|
//
|
||||||
void DeleteChar (const CurPos &pos, int num);
|
void ScrollRegion(int top, int bot, int dir, int num);
|
||||||
void EraseBelow (const CurPos &pos);
|
void ScrollLine();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Movement and Scroll buffer.
|
// Resize buffer.
|
||||||
//
|
//
|
||||||
void ScrollRegion (int top, int bot, int dir, int num);
|
void ResizeTo(int newRows, int newCols, int offset);
|
||||||
void ScrollLine (void);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Resize buffer.
|
// Clear contents of TermBuffer.
|
||||||
//
|
//
|
||||||
void ResizeTo(int newRows, int newCols, int offset);
|
void Clear();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Clear contents of TermBuffer.
|
// Selection Methods
|
||||||
//
|
//
|
||||||
void ClearAll (void);
|
void Select(const CurPos &start, const CurPos &end);
|
||||||
|
void DeSelect();
|
||||||
|
|
||||||
//
|
const CurPos &GetSelectionStart() { return fSelStart; };
|
||||||
// Selection Methods
|
const CurPos &GetSelectionEnd() { return fSelEnd; };
|
||||||
//
|
|
||||||
void Select (const CurPos &start, const CurPos &end);
|
|
||||||
void DeSelect (void);
|
|
||||||
|
|
||||||
const CurPos &GetSelectionStart (void) { return mSelStart; };
|
int CheckSelectedRegion (const CurPos &pos);
|
||||||
const CurPos &GetSelectionEnd (void) { return mSelEnd; };
|
|
||||||
|
|
||||||
int CheckSelectedRegion (const CurPos &pos);
|
//
|
||||||
|
// Other methods
|
||||||
|
//
|
||||||
|
bool FindWord (const CurPos &pos, CurPos *start, CurPos *end);
|
||||||
|
|
||||||
//
|
void GetCharFromRegion (int x, int y, BString &str);
|
||||||
// Other methods
|
static void AvoidWaste (BString &str);
|
||||||
//
|
|
||||||
bool FindWord (const CurPos &pos, CurPos *start, CurPos *end);
|
|
||||||
|
|
||||||
void GetCharFromRegion (int x, int y, BString &str);
|
void ToString(BString &str);
|
||||||
void AvoidWaste (BString &str);
|
|
||||||
|
|
||||||
void ToString (BString &str);
|
int32 Size() const;
|
||||||
|
|
||||||
int32 GetArraySize (void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PRIVATE MEMBER FUNCTIONS.
|
|
||||||
*/
|
|
||||||
private:
|
private:
|
||||||
|
void EraseLine(int line);
|
||||||
|
|
||||||
//
|
term_buffer **fBuffer;
|
||||||
// Erase 1 column.
|
int fBufferSize;
|
||||||
//
|
|
||||||
void EraseLine (int row);
|
|
||||||
|
|
||||||
/*
|
int fColumnSize;
|
||||||
* DATA MEMBER.
|
int fRowSize;
|
||||||
*/
|
int fCurrentColumnSize;
|
||||||
term_buffer **mBase;
|
int fRowOffset;
|
||||||
|
|
||||||
int mColSize;
|
|
||||||
int mRowSize;
|
|
||||||
int mNowColSize;
|
|
||||||
int mRowOffset;
|
|
||||||
|
|
||||||
CurPos mSelStart;
|
|
||||||
CurPos mSelEnd;
|
|
||||||
|
|
||||||
int buffer_size;
|
|
||||||
|
|
||||||
|
CurPos fSelStart;
|
||||||
|
CurPos fSelEnd;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //TERMARAY_H_INCLUDED
|
#endif // _TERMBUFFER_H
|
||||||
|
@ -1651,7 +1651,7 @@ void
|
|||||||
TermView::DoClearAll(void)
|
TermView::DoClearAll(void)
|
||||||
{
|
{
|
||||||
DeSelect();
|
DeSelect();
|
||||||
fTextBuffer->ClearAll();
|
fTextBuffer->Clear();
|
||||||
|
|
||||||
fTop = 0;
|
fTop = 0;
|
||||||
ScrollTo(0, 0);
|
ScrollTo(0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user