Pulled the TermView interface used by TermParse into a new interface
class TerminalBuffer, which will evolve into a TermBuffer replacement and decouple the parse thread from the window. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25787 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -20,6 +20,7 @@ Application Terminal :
|
|||||||
SmartTabView.cpp
|
SmartTabView.cpp
|
||||||
TermApp.cpp
|
TermApp.cpp
|
||||||
TermBuffer.cpp
|
TermBuffer.cpp
|
||||||
|
TerminalBuffer.cpp
|
||||||
TermParse.cpp
|
TermParse.cpp
|
||||||
TermView.cpp
|
TermView.cpp
|
||||||
TermWindow.cpp
|
TermWindow.cpp
|
||||||
@@ -29,4 +30,4 @@ Application Terminal :
|
|||||||
VTPrsTbl.c
|
VTPrsTbl.c
|
||||||
: be game tracker textencoding
|
: be game tracker textencoding
|
||||||
: Terminal.rdef Terminal.icons.rdef
|
: Terminal.rdef Terminal.icons.rdef
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -10,11 +10,6 @@
|
|||||||
|
|
||||||
#include "Shell.h"
|
#include "Shell.h"
|
||||||
|
|
||||||
#include "TermConst.h"
|
|
||||||
#include "TermParse.h"
|
|
||||||
|
|
||||||
#include <OS.h>
|
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@@ -31,6 +26,13 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include "TermConst.h"
|
||||||
|
#include "TermParse.h"
|
||||||
|
#include "TermView.h"
|
||||||
|
// TODO: Fix dependency!
|
||||||
|
|
||||||
|
|
||||||
#ifndef CEOF
|
#ifndef CEOF
|
||||||
#define CEOF ('D'&037)
|
#define CEOF ('D'&037)
|
||||||
@@ -225,6 +227,7 @@ Shell::FD() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Fix this dependency!
|
||||||
void
|
void
|
||||||
Shell::ViewAttached(TermView *view)
|
Shell::ViewAttached(TermView *view)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
// TODO: Maybe merge TermParse and Shell classes ?
|
// TODO: Maybe merge TermParse and Shell classes ?
|
||||||
class TermParse;
|
class TermParse;
|
||||||
class TermView;
|
class TermView;
|
||||||
|
|
||||||
class Shell {
|
class Shell {
|
||||||
public:
|
public:
|
||||||
Shell();
|
Shell();
|
||||||
|
|||||||
@@ -6,11 +6,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "TermParse.h"
|
#include "TermParse.h"
|
||||||
|
|
||||||
#include "CodeConv.h"
|
|
||||||
#include "TermConst.h"
|
|
||||||
#include "TermView.h"
|
|
||||||
#include "VTparse.h"
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -20,6 +15,11 @@
|
|||||||
#include <Beep.h>
|
#include <Beep.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
|
|
||||||
|
#include "CodeConv.h"
|
||||||
|
#include "TermConst.h"
|
||||||
|
#include "TerminalBuffer.h"
|
||||||
|
#include "VTparse.h"
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// EscParse ... Escape sequence parse and character encoding.
|
// EscParse ... Escape sequence parse and character encoding.
|
||||||
@@ -56,7 +56,7 @@ TermParse::TermParse(int fd)
|
|||||||
fReaderLocker(-1),
|
fReaderLocker(-1),
|
||||||
fBufferPosition(0),
|
fBufferPosition(0),
|
||||||
fLockFlag(0),
|
fLockFlag(0),
|
||||||
fView(NULL),
|
fBuffer(NULL),
|
||||||
fQuitting(true)
|
fQuitting(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -69,24 +69,24 @@ TermParse::~TermParse()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
TermParse::StartThreads(TermView *view)
|
TermParse::StartThreads(TerminalBuffer *buffer)
|
||||||
{
|
{
|
||||||
if (fView != NULL)
|
if (fBuffer != NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
fQuitting = false;
|
fQuitting = false;
|
||||||
fView = view;
|
fBuffer = buffer;
|
||||||
|
|
||||||
status_t status = InitPtyReader();
|
status_t status = InitPtyReader();
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
fView = NULL;
|
fBuffer = NULL;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = InitTermParse();
|
status = InitTermParse();
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
StopPtyReader();
|
StopPtyReader();
|
||||||
fView = NULL;
|
fBuffer = NULL;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ TermParse::StartThreads(TermView *view)
|
|||||||
status_t
|
status_t
|
||||||
TermParse::StopThreads()
|
TermParse::StopThreads()
|
||||||
{
|
{
|
||||||
if (fView == NULL)
|
if (fBuffer == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
fQuitting = true;
|
fQuitting = true;
|
||||||
@@ -105,7 +105,7 @@ TermParse::StopThreads()
|
|||||||
StopPtyReader();
|
StopPtyReader();
|
||||||
StopTermParse();
|
StopTermParse();
|
||||||
|
|
||||||
fView = NULL;
|
fBuffer = NULL;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -121,11 +121,11 @@ TermParse::GetReaderBuf(uchar &c)
|
|||||||
} while (status == B_INTERRUPTED);
|
} while (status == B_INTERRUPTED);
|
||||||
|
|
||||||
if (status == B_TIMED_OUT) {
|
if (status == B_TIMED_OUT) {
|
||||||
fView->ScrollAtCursor();
|
fBuffer->ScrollAtCursor();
|
||||||
fView->UpdateLine();
|
fBuffer->UpdateLine();
|
||||||
|
|
||||||
// Reset cursor blinking time and turn on cursor blinking.
|
// Reset cursor blinking time and turn on cursor blinking.
|
||||||
fView->SetCurDraw(true);
|
fBuffer->SetCurDraw(true);
|
||||||
|
|
||||||
// wait new input from pty.
|
// wait new input from pty.
|
||||||
do {
|
do {
|
||||||
@@ -146,7 +146,7 @@ TermParse::GetReaderBuf(uchar &c)
|
|||||||
release_sem(fReaderLocker);
|
release_sem(fReaderLocker);
|
||||||
}
|
}
|
||||||
|
|
||||||
fView->SetCurDraw(false);
|
fBuffer->SetCurDraw(false);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ TermParse::PtyReader()
|
|||||||
uchar buf[READ_BUF_SIZE];
|
uchar buf[READ_BUF_SIZE];
|
||||||
int nread = read(fFd, buf, READ_BUF_SIZE - (read_p - fBufferPosition));
|
int nread = read(fFd, buf, READ_BUF_SIZE - (read_p - fBufferPosition));
|
||||||
if (nread <= 0) {
|
if (nread <= 0) {
|
||||||
fView->NotifyQuit(errno);
|
fBuffer->NotifyQuit(errno);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,11 +348,11 @@ TermParse::EscParse()
|
|||||||
|
|
||||||
//DumpState(groundtable, parsestate, c);
|
//DumpState(groundtable, parsestate, c);
|
||||||
|
|
||||||
if (now_coding != fView->Encoding()) {
|
if (now_coding != fBuffer->Encoding()) {
|
||||||
/*
|
/*
|
||||||
* Change coding, change parse table.
|
* Change coding, change parse table.
|
||||||
*/
|
*/
|
||||||
switch (fView->Encoding()) {
|
switch (fBuffer->Encoding()) {
|
||||||
case B_ISO1_CONVERSION:
|
case B_ISO1_CONVERSION:
|
||||||
case B_ISO2_CONVERSION:
|
case B_ISO2_CONVERSION:
|
||||||
case B_ISO3_CONVERSION:
|
case B_ISO3_CONVERSION:
|
||||||
@@ -379,14 +379,14 @@ TermParse::EscParse()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
now_coding = fView->Encoding();
|
now_coding = fBuffer->Encoding();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (parsestate[c]) {
|
switch (parsestate[c]) {
|
||||||
case CASE_PRINT:
|
case CASE_PRINT:
|
||||||
cbuf[0] = c;
|
cbuf[0] = c;
|
||||||
cbuf[1] = '\0';
|
cbuf[1] = '\0';
|
||||||
fView->Insert(cbuf, attr);
|
fBuffer->Insert(cbuf, attr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_PRINT_GR:
|
case CASE_PRINT_GR:
|
||||||
@@ -427,7 +427,7 @@ TermParse::EscParse()
|
|||||||
else
|
else
|
||||||
CodeConv::ConvertToInternal((char*)cbuf, -1, (char*)dstbuf, B_EUC_CONVERSION);
|
CodeConv::ConvertToInternal((char*)cbuf, -1, (char*)dstbuf, B_EUC_CONVERSION);
|
||||||
|
|
||||||
fView->Insert(dstbuf, attr);
|
fBuffer->Insert(dstbuf, attr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_PRINT_CS96:
|
case CASE_PRINT_CS96:
|
||||||
@@ -436,22 +436,22 @@ TermParse::EscParse()
|
|||||||
cbuf[1] |= 0x80;
|
cbuf[1] |= 0x80;
|
||||||
cbuf[2] = 0;
|
cbuf[2] = 0;
|
||||||
CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, B_EUC_CONVERSION);
|
CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, B_EUC_CONVERSION);
|
||||||
fView->Insert(dstbuf, attr);
|
fBuffer->Insert(dstbuf, attr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_LF:
|
case CASE_LF:
|
||||||
fView->InsertLF();
|
fBuffer->InsertLF();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_CR:
|
case CASE_CR:
|
||||||
fView->InsertCR();
|
fBuffer->InsertCR();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_SJIS_KANA:
|
case CASE_SJIS_KANA:
|
||||||
cbuf[0] = (uchar)c;
|
cbuf[0] = (uchar)c;
|
||||||
cbuf[1] = '\0';
|
cbuf[1] = '\0';
|
||||||
CodeConv::ConvertToInternal((char*)cbuf, 1, (char*)dstbuf, now_coding);
|
CodeConv::ConvertToInternal((char*)cbuf, 1, (char*)dstbuf, now_coding);
|
||||||
fView->Insert(dstbuf, attr);
|
fBuffer->Insert(dstbuf, attr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_SJIS_INSTRING:
|
case CASE_SJIS_INSTRING:
|
||||||
@@ -459,7 +459,7 @@ TermParse::EscParse()
|
|||||||
GetReaderBuf(cbuf[1]);
|
GetReaderBuf(cbuf[1]);
|
||||||
cbuf[2] = '\0';
|
cbuf[2] = '\0';
|
||||||
CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, now_coding);
|
CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, now_coding);
|
||||||
fView->Insert(dstbuf, attr);
|
fBuffer->Insert(dstbuf, attr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_UTF8_2BYTE:
|
case CASE_UTF8_2BYTE:
|
||||||
@@ -470,7 +470,7 @@ TermParse::EscParse()
|
|||||||
cbuf[1] = (uchar)c;
|
cbuf[1] = (uchar)c;
|
||||||
cbuf[2] = '\0';
|
cbuf[2] = '\0';
|
||||||
|
|
||||||
fView->Insert(cbuf, attr);
|
fBuffer->Insert(cbuf, attr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_UTF8_3BYTE:
|
case CASE_UTF8_3BYTE:
|
||||||
@@ -485,7 +485,7 @@ TermParse::EscParse()
|
|||||||
break;
|
break;
|
||||||
cbuf[2] = c;
|
cbuf[2] = c;
|
||||||
cbuf[3] = '\0';
|
cbuf[3] = '\0';
|
||||||
fView->Insert(cbuf, attr);
|
fBuffer->Insert(cbuf, attr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_MBCS:
|
case CASE_MBCS:
|
||||||
@@ -517,13 +517,13 @@ TermParse::EscParse()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_BS:
|
case CASE_BS:
|
||||||
fView->MoveCurLeft(1);
|
fBuffer->MoveCurLeft(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_TAB:
|
case CASE_TAB:
|
||||||
tmp = fView->GetCurX();
|
tmp = fBuffer->GetCurX();
|
||||||
tmp %= 8;
|
tmp %= 8;
|
||||||
fView->MoveCurRight(8 - tmp);
|
fBuffer->MoveCurRight(8 - tmp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_ESC:
|
case CASE_ESC:
|
||||||
@@ -583,7 +583,7 @@ TermParse::EscParse()
|
|||||||
/* ICH */
|
/* ICH */
|
||||||
if ((row = param[0]) < 1)
|
if ((row = param[0]) < 1)
|
||||||
row = 1;
|
row = 1;
|
||||||
fView->InsertSpace(row);
|
fBuffer->InsertSpace(row);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -591,7 +591,7 @@ TermParse::EscParse()
|
|||||||
/* CUU */
|
/* CUU */
|
||||||
if ((row = param[0]) < 1)
|
if ((row = param[0]) < 1)
|
||||||
row = 1;
|
row = 1;
|
||||||
fView->MoveCurUp(row);
|
fBuffer->MoveCurUp(row);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -599,7 +599,7 @@ TermParse::EscParse()
|
|||||||
/* CUD */
|
/* CUD */
|
||||||
if ((row = param[0]) < 1)
|
if ((row = param[0]) < 1)
|
||||||
row = 1;
|
row = 1;
|
||||||
fView->MoveCurDown(row);
|
fBuffer->MoveCurDown(row);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -607,7 +607,7 @@ TermParse::EscParse()
|
|||||||
/* CUF */
|
/* CUF */
|
||||||
if ((row = param[0]) < 1)
|
if ((row = param[0]) < 1)
|
||||||
row = 1;
|
row = 1;
|
||||||
fView->MoveCurRight(row);
|
fBuffer->MoveCurRight(row);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -615,7 +615,7 @@ TermParse::EscParse()
|
|||||||
/* CUB */
|
/* CUB */
|
||||||
if ((row = param[0]) < 1)
|
if ((row = param[0]) < 1)
|
||||||
row = 1;
|
row = 1;
|
||||||
fView->MoveCurLeft(row);
|
fBuffer->MoveCurLeft(row);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -626,7 +626,7 @@ TermParse::EscParse()
|
|||||||
if (nparam < 2 || (col = param[1]) < 1)
|
if (nparam < 2 || (col = param[1]) < 1)
|
||||||
col = 1;
|
col = 1;
|
||||||
|
|
||||||
fView->SetCurPos(col - 1, row - 1 );
|
fBuffer->SetCurPos(col - 1, row - 1 );
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -635,15 +635,15 @@ TermParse::EscParse()
|
|||||||
switch (param[0]) {
|
switch (param[0]) {
|
||||||
case DEFAULT:
|
case DEFAULT:
|
||||||
case 0:
|
case 0:
|
||||||
fView->EraseBelow();
|
fBuffer->EraseBelow();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
fView->SetCurPos(0, 0);
|
fBuffer->SetCurPos(0, 0);
|
||||||
fView->EraseBelow();
|
fBuffer->EraseBelow();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
@@ -651,7 +651,7 @@ TermParse::EscParse()
|
|||||||
|
|
||||||
case CASE_EL: // delete line
|
case CASE_EL: // delete line
|
||||||
/* EL */
|
/* EL */
|
||||||
fView->DeleteColumns();
|
fBuffer->DeleteColumns();
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -659,7 +659,7 @@ TermParse::EscParse()
|
|||||||
/* IL */
|
/* IL */
|
||||||
if ((row = param[0]) < 1)
|
if ((row = param[0]) < 1)
|
||||||
row = 1;
|
row = 1;
|
||||||
fView->InsertNewLine(row);
|
fBuffer->InsertNewLine(row);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -667,7 +667,7 @@ TermParse::EscParse()
|
|||||||
/* DL */
|
/* DL */
|
||||||
if ((row = param[0]) < 1)
|
if ((row = param[0]) < 1)
|
||||||
row = 1;
|
row = 1;
|
||||||
fView->DeleteLine(row);
|
fBuffer->DeleteLine(row);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -675,19 +675,19 @@ TermParse::EscParse()
|
|||||||
/* DCH */
|
/* DCH */
|
||||||
if ((row = param[0]) < 1)
|
if ((row = param[0]) < 1)
|
||||||
row = 1;
|
row = 1;
|
||||||
fView->DeleteChar(row);
|
fBuffer->DeleteChar(row);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_SET:
|
case CASE_SET:
|
||||||
/* SET */
|
/* SET */
|
||||||
fView->SetInsertMode(MODE_INSERT);
|
fBuffer->SetInsertMode(MODE_INSERT);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_RST:
|
case CASE_RST:
|
||||||
/* RST */
|
/* RST */
|
||||||
fView->SetInsertMode(MODE_OVER);
|
fBuffer->SetInsertMode(MODE_OVER);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -766,7 +766,7 @@ TermParse::EscParse()
|
|||||||
case CASE_CPR:
|
case CASE_CPR:
|
||||||
// Q & D hack by Y.Hayakawa ([email protected])
|
// Q & D hack by Y.Hayakawa ([email protected])
|
||||||
// 21-JUL-99
|
// 21-JUL-99
|
||||||
fView->DeviceStatusReport(param[0]);
|
fBuffer->DeviceStatusReport(param[0]);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -785,7 +785,7 @@ TermParse::EscParse()
|
|||||||
bot--;
|
bot--;
|
||||||
|
|
||||||
if (bot > top)
|
if (bot > top)
|
||||||
fView->SetScrollRegion(top, bot);
|
fBuffer->SetScrollRegion(top, bot);
|
||||||
|
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
@@ -822,13 +822,13 @@ TermParse::EscParse()
|
|||||||
|
|
||||||
case CASE_DECSC:
|
case CASE_DECSC:
|
||||||
/* DECSC */
|
/* DECSC */
|
||||||
fView->SaveCursor();
|
fBuffer->SaveCursor();
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_DECRC:
|
case CASE_DECRC:
|
||||||
/* DECRC */
|
/* DECRC */
|
||||||
fView->RestoreCursor();
|
fBuffer->RestoreCursor();
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -840,7 +840,7 @@ TermParse::EscParse()
|
|||||||
|
|
||||||
case CASE_RI:
|
case CASE_RI:
|
||||||
/* RI */
|
/* RI */
|
||||||
fView->ScrollRegion(-1, -1, SCRDOWN, 1);
|
fBuffer->ScrollRegion(-1, -1, SCRDOWN, 1);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -890,7 +890,7 @@ TermParse::EscParse()
|
|||||||
switch (mode_char) {
|
switch (mode_char) {
|
||||||
case '0':
|
case '0':
|
||||||
case '2':
|
case '2':
|
||||||
fView->SetTitle(string);
|
fBuffer->SetTitle(string);
|
||||||
break;
|
break;
|
||||||
case '1':
|
case '1':
|
||||||
break;
|
break;
|
||||||
@@ -939,7 +939,7 @@ TermParse::EscParse()
|
|||||||
row = 1;
|
row = 1;
|
||||||
|
|
||||||
// note beterm wants it 1-based unlike usual terminals
|
// note beterm wants it 1-based unlike usual terminals
|
||||||
fView->SetCurY(row - 1);
|
fBuffer->SetCurY(row - 1);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -949,7 +949,7 @@ TermParse::EscParse()
|
|||||||
col = 1;
|
col = 1;
|
||||||
|
|
||||||
// note beterm wants it 1-based unlike usual terminals
|
// note beterm wants it 1-based unlike usual terminals
|
||||||
fView->SetCurX(col - 1);
|
fBuffer->SetCurX(col - 1);
|
||||||
parsestate = groundtable;
|
parsestate = groundtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -40,13 +40,14 @@
|
|||||||
//PtyReader buffer size.
|
//PtyReader buffer size.
|
||||||
#define READ_BUF_SIZE 2048
|
#define READ_BUF_SIZE 2048
|
||||||
|
|
||||||
class TermView;
|
class TerminalBuffer;
|
||||||
|
|
||||||
class TermParse : public BHandler {
|
class TermParse : public BHandler {
|
||||||
public:
|
public:
|
||||||
TermParse(int fd);
|
TermParse(int fd);
|
||||||
~TermParse();
|
~TermParse();
|
||||||
|
|
||||||
status_t StartThreads(TermView *view);
|
status_t StartThreads(TerminalBuffer *view);
|
||||||
status_t StopThreads();
|
status_t StopThreads();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -80,7 +81,7 @@ private:
|
|||||||
|
|
||||||
int fLockFlag;
|
int fLockFlag;
|
||||||
|
|
||||||
TermView *fView;
|
TerminalBuffer *fBuffer;
|
||||||
|
|
||||||
bool fQuitting;
|
bool fQuitting;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,13 +12,13 @@
|
|||||||
#ifndef TERMVIEW_H
|
#ifndef TERMVIEW_H
|
||||||
#define TERMVIEW_H
|
#define TERMVIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include "CurPos.h"
|
|
||||||
|
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
#include "CurPos.h"
|
||||||
|
#include "TerminalBuffer.h"
|
||||||
|
|
||||||
|
|
||||||
class BClipboard;
|
class BClipboard;
|
||||||
class BMessageRunner;
|
class BMessageRunner;
|
||||||
@@ -26,7 +26,8 @@ class BScrollBar;
|
|||||||
class BString;
|
class BString;
|
||||||
class Shell;
|
class Shell;
|
||||||
class TermBuffer;
|
class TermBuffer;
|
||||||
class TermView : public BView {
|
|
||||||
|
class TermView : public BView, public TerminalBuffer {
|
||||||
public:
|
public:
|
||||||
TermView(BRect frame, int32 argc, const char **argv, int32 historySize = 1000);
|
TermView(BRect frame, int32 argc, const char **argv, int32 historySize = 1000);
|
||||||
TermView(int rows, int columns, int32 argc, const char **argv, int32 historySize = 1000);
|
TermView(int rows, int columns, int32 argc, const char **argv, int32 historySize = 1000);
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "TerminalBuffer.h"
|
||||||
|
|
||||||
|
|
||||||
|
TerminalBuffer::TerminalBuffer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TerminalBuffer::~TerminalBuffer()
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef TERMINAL_BUFFER_H
|
||||||
|
#define TERMINAL_BUFFER_H
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
class TerminalBuffer {
|
||||||
|
public:
|
||||||
|
TerminalBuffer();
|
||||||
|
virtual ~TerminalBuffer();
|
||||||
|
|
||||||
|
virtual int Encoding() const = 0;
|
||||||
|
|
||||||
|
// Output Character
|
||||||
|
virtual void Insert(uchar* string, ushort attr) = 0;
|
||||||
|
virtual void InsertCR() = 0;
|
||||||
|
virtual void InsertLF() = 0;
|
||||||
|
virtual void InsertNewLine(int num) = 0;
|
||||||
|
virtual void SetInsertMode(int flag) = 0;
|
||||||
|
virtual void InsertSpace(int num) = 0;
|
||||||
|
|
||||||
|
// Delete Character
|
||||||
|
virtual void EraseBelow() = 0;
|
||||||
|
virtual void DeleteChar(int num) = 0;
|
||||||
|
virtual void DeleteColumns() = 0;
|
||||||
|
virtual void DeleteLine(int num) = 0;
|
||||||
|
|
||||||
|
// Get and Set Cursor position
|
||||||
|
virtual void SetCurPos(int x, int y) = 0;
|
||||||
|
virtual void SetCurX(int x) = 0;
|
||||||
|
virtual void SetCurY(int y) = 0;
|
||||||
|
virtual int GetCurX() = 0;
|
||||||
|
virtual void SaveCursor() = 0;
|
||||||
|
virtual void RestoreCursor() = 0;
|
||||||
|
|
||||||
|
// Move Cursor
|
||||||
|
virtual void MoveCurRight(int num) = 0;
|
||||||
|
virtual void MoveCurLeft(int num) = 0;
|
||||||
|
virtual void MoveCurUp(int num) = 0;
|
||||||
|
virtual void MoveCurDown(int num) = 0;
|
||||||
|
|
||||||
|
// Cursor setting
|
||||||
|
virtual void SetCurDraw(bool flag) = 0;
|
||||||
|
|
||||||
|
// Scroll region
|
||||||
|
virtual void ScrollRegion(int top, int bot, int dir,
|
||||||
|
int num) = 0;
|
||||||
|
virtual void SetScrollRegion(int top, int bot) = 0;
|
||||||
|
virtual void ScrollAtCursor() = 0;
|
||||||
|
|
||||||
|
// Other
|
||||||
|
virtual void DeviceStatusReport(int) = 0;
|
||||||
|
virtual void UpdateLine() = 0;
|
||||||
|
|
||||||
|
virtual void SetTitle(const char* title) = 0;
|
||||||
|
virtual void NotifyQuit(int32 reason) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TERMINAL_BUFFER_H
|
||||||
Reference in New Issue
Block a user