Moved cursor blinking functionality from TermParse into TermView (and

from a BMessageRunner into Pulse()). Removed more unused stuff. 
Moved around some constants and definitions. Many style changes. Sorry, 
I know the two should be separated, but I had already done so many changes...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21695 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2007-07-24 12:18:24 +00:00
parent 40ba6c7004
commit abc4720231
9 changed files with 380 additions and 387 deletions
+16 -27
View File
@@ -1,4 +1,5 @@
/* /*
* Copyright 2007 Haiku
* Copyright (c) 2003-4 Kian Duffy <[email protected]> * Copyright (c) 2003-4 Kian Duffy <[email protected]>
* Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
* *
@@ -28,35 +29,23 @@
* *
*/ */
#include <Box.h> #include "PrefView.h"
#include <Button.h>
#include <RadioButton.h>
#include <ColorControl.h>
#include <StringView.h>
#include <TextControl.h>
#include <CheckBox.h>
#include <MenuField.h>
#include <Message.h>
#include <String.h>
#include <Window.h>
#include "PrefHandler.h" #include "PrefHandler.h"
#include "TermConst.h" #include "TermConst.h"
#include "PrefView.h"
#include "TTextControl.h" #include "TTextControl.h"
/************************************************************************ #include <ColorControl.h>
* #include <Message.h>
* PUBLIC MEMBER FUNCTIONS. #include <String.h>
*
***********************************************************************/
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// PrefView () // PrefView ()
// Constructor. // Constructor.
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
PrefView::PrefView (BRect frame, const char *name) PrefView::PrefView(BRect frame, const char *name)
:BView (frame, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW) :BView(frame, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fLabel.SetTo(name); fLabel.SetTo(name);
@@ -73,18 +62,18 @@ PrefView::~PrefView()
const char * const char *
PrefView::ViewLabel (void) const PrefView::ViewLabel() const
{ {
return fLabel.String(); return fLabel.String();
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// CanApply() // CanApply()
// Determines whether view can respont Apply command or not. // Determines whether view can reply to Apply command or not.
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
bool bool
PrefView::CanApply () PrefView::CanApply()
{ {
return true; return true;
} }
@@ -115,10 +104,10 @@ PrefView::MessageReceived(BMessage* msg)
// Make BColorControl. // Make BColorControl.
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
BColorControl * BColorControl *
PrefView::SetupBColorControl(BPoint p, color_control_layout layout, float cell_size, ulong msg) PrefView::SetupBColorControl(BPoint point, color_control_layout layout, float cellSize, ulong message)
{ {
BColorControl *col = new BColorControl( p, layout, cell_size, "", new BMessage(msg)); BColorControl *control = new BColorControl(point, layout, cellSize, "", new BMessage(message));
AddChild(col); AddChild(control);
return col; return control;
} }
+10 -11
View File
@@ -107,12 +107,10 @@ typedef struct
#define PTY_WS 2 /* pty need WINSIZE (row and col ) */ #define PTY_WS 2 /* pty need WINSIZE (row and col ) */
static pid_t sShPid;
Shell::Shell() Shell::Shell()
: :
fFd(-1), fFd(-1),
fProcessID(-1),
fTermParse(NULL), fTermParse(NULL),
fAttached(false) fAttached(false)
{ {
@@ -152,7 +150,8 @@ Shell::Close()
if (fFd >= 0) { if (fFd >= 0) {
close(fFd); close(fFd);
kill(-sShPid, SIGHUP); kill(-fProcessID, SIGHUP);
fProcessID = -1;
int status; int status;
wait(&status); wait(&status);
fFd = -1; fFd = -1;
@@ -187,21 +186,21 @@ Shell::Write(const void *buffer, size_t numBytes)
} }
void status_t
Shell::UpdateWindowSize(int rows, int columns) Shell::UpdateWindowSize(int rows, int columns)
{ {
struct winsize winSize; struct winsize winSize;
winSize.ws_row = rows; winSize.ws_row = rows;
winSize.ws_col = columns; winSize.ws_col = columns;
ioctl(fFd, TIOCSWINSZ, &winSize); ioctl(fFd, TIOCSWINSZ, &winSize);
Signal(SIGWINCH); return Signal(SIGWINCH);
} }
void status_t
Shell::Signal(int signal) Shell::Signal(int signal)
{ {
kill(-sShPid, signal); return send_signal(-fProcessID, signal);
} }
@@ -316,7 +315,7 @@ Shell::_Spawn(int row, int col, const char *command, const char *coding)
thread_id terminalThread = find_thread(NULL); thread_id terminalThread = find_thread(NULL);
/* Fork a child process. */ /* Fork a child process. */
if ((sShPid = fork()) < 0) { if ((fProcessID = fork()) < 0) {
close(master); close(master);
return B_ERROR; return B_ERROR;
} }
@@ -324,7 +323,7 @@ Shell::_Spawn(int row, int col, const char *command, const char *coding)
handshake_t handshake; handshake_t handshake;
if (sShPid == 0) { if (fProcessID == 0) {
// Now in child process. // Now in child process.
/* /*
@@ -583,7 +582,7 @@ Shell::_Spawn(int row, int col, const char *command, const char *coding)
handshake.row = row; handshake.row = row;
handshake.col = col; handshake.col = col;
handshake.status = PTY_WS; handshake.status = PTY_WS;
send_handshake_message(sShPid, handshake); send_handshake_message(fProcessID, handshake);
break; break;
} }
} }
+3 -2
View File
@@ -97,8 +97,8 @@ public:
ssize_t Read(void *buffer, size_t numBytes); ssize_t Read(void *buffer, size_t numBytes);
ssize_t Write(const void *buffer, size_t numBytes); ssize_t Write(const void *buffer, size_t numBytes);
void UpdateWindowSize(int row, int columns); status_t UpdateWindowSize(int row, int columns);
void Signal(int signal); status_t Signal(int signal);
status_t GetAttr(struct termios &attr); status_t GetAttr(struct termios &attr);
status_t SetAttr(struct termios &attr); status_t SetAttr(struct termios &attr);
@@ -110,6 +110,7 @@ public:
private: private:
int fFd; int fFd;
pid_t fProcessID;
TermParse *fTermParse; TermParse *fTermParse;
bool fAttached; bool fAttached;
+3 -12
View File
@@ -40,6 +40,9 @@
// Message constants for menu items // Message constants for menu items
#include <SupportDefs.h>
// Menu Message // Menu Message
const uint32 MENU_SWITCH_TERM = 'MSWT'; const uint32 MENU_SWITCH_TERM = 'MSWT';
const uint32 MENU_NEW_TERM = 'MNTE'; const uint32 MENU_NEW_TERM = 'MNTE';
@@ -59,7 +62,6 @@ const uint32 MENU_SHOW_COLOR = 'Mcol';
const uint32 M_GET_DEVICE_NUM = 'Mgdn'; const uint32 M_GET_DEVICE_NUM = 'Mgdn';
// Message Runner // Message Runner
const uint32 MSGRUN_CURSOR = 'Rcur';
const uint32 MSGRUN_WINDOW = 'Rwin'; const uint32 MSGRUN_WINDOW = 'Rwin';
// Preference Message // Preference Message
@@ -144,14 +146,6 @@ enum{
#define MODE_OVER 0 #define MODE_OVER 0
#define MODE_INSERT 1 #define MODE_INSERT 1
const float VIEW_OFFSET = 3;
#define CURSOR_RECT \
BRect r (fFontWidth * fCurPos.x, \
fFontHeight * fCurPos.y + fTop, \
fFontWidth * (fCurPos.x + 1) - 1, \
fFontHeight * fCurPos.y + fTop + fCursorHeight - 1)
// Define TermBuffer internal code // Define TermBuffer internal code
#define NO_CHAR 0x00 #define NO_CHAR 0x00
#define A_CHAR 0x01 #define A_CHAR 0x01
@@ -186,8 +180,5 @@ const float VIEW_OFFSET = 3;
#define FORECOLORED(x) ((x) << 3) #define FORECOLORED(x) ((x) << 3)
#define BACKCOLORED(x) ((x) << 0) #define BACKCOLORED(x) ((x) << 0)
// TypeDefs
typedef unsigned short ushort;
#endif // TERMCONST_H_INCLUDED #endif // TERMCONST_H_INCLUDED
+76 -64
View File
@@ -4,6 +4,13 @@
* Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT license.
*/ */
#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>
@@ -13,13 +20,7 @@
#include <Application.h> #include <Application.h>
#include <Beep.h> #include <Beep.h>
#include <Message.h> #include <Message.h>
#include <MessageRunner.h>
#include "TermParse.h"
#include "TermView.h"
#include "VTparse.h"
#include "TermConst.h"
#include "CodeConv.h"
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// EscParse ... Escape sequence parse and character encoding. // EscParse ... Escape sequence parse and character encoding.
@@ -50,16 +51,14 @@ extern int mbcstable[]; /* ESC $ */
TermParse::TermParse(int fd) TermParse::TermParse(int fd)
: :
fFd(fd), fFd(fd),
fViewObj(NULL),
fParseThread(-1), fParseThread(-1),
fParseSem(-1),
fReaderThread(-1), fReaderThread(-1),
fReaderSem(-1), fReaderSem(-1),
fReaderLocker(-1), fReaderLocker(-1),
fCursorUpdate(NULL), fBufferPosition(0),
fParser_p(0),
fLockFlag(0), fLockFlag(0),
fQuitting(false) fView(NULL),
fQuitting(true)
{ {
} }
@@ -73,16 +72,27 @@ TermParse::~TermParse()
status_t status_t
TermParse::StartThreads(TermView *view) TermParse::StartThreads(TermView *view)
{ {
fViewObj = view; if (fView != NULL)
return B_ERROR;
fQuitting = false;
fView = view;
status_t status = InitPtyReader(); status_t status = InitPtyReader();
if (status < B_OK) if (status < B_OK) {
fView = NULL;
return status; return status;
}
status = InitTermParse(); status = InitTermParse();
if (status < B_OK) { if (status < B_OK) {
//AbortPtyReader(); delete_sem(fReaderSem);
delete_sem(fReaderLocker);
fQuitting = true;
status_t dummy;
wait_for_thread(fReaderThread, &dummy);
fView = NULL;
return status; return status;
} }
@@ -93,19 +103,26 @@ TermParse::StartThreads(TermView *view)
status_t status_t
TermParse::StopThreads() TermParse::StopThreads()
{ {
if (fView == NULL)
return B_ERROR;
fQuitting = true; fQuitting = true;
delete_sem(fReaderSem); delete_sem(fReaderSem);
fReaderSem = -1;
delete_sem(fReaderLocker); delete_sem(fReaderLocker);
fReaderSem = -1;
//suspend_thread(fReaderThread); //suspend_thread(fReaderThread);
// TODO: interrupt read() - doesn't work for whatever reason // TODO: interrupt read() - doesn't work for whatever reason
status_t dummy; status_t dummy;
wait_for_thread(fReaderThread, &dummy); wait_for_thread(fReaderThread, &dummy);
fReaderThread = -1;
wait_for_thread(fParseThread, &dummy); wait_for_thread(fParseThread, &dummy);
fReaderThread = -1;
fViewObj = NULL; fView = NULL;
return B_OK; return B_OK;
} }
@@ -118,7 +135,7 @@ TermParse::PtyReader()
uint read_p = 0; uint read_p = 0;
while (!fQuitting) { while (!fQuitting) {
// If Pty Buffer nearly full, snooze this thread, and continue. // If Pty Buffer nearly full, snooze this thread, and continue.
if ((read_p - fParser_p) > READ_BUF_SIZE - 16) { if ((read_p - fBufferPosition) > READ_BUF_SIZE - 16) {
fLockFlag = READ_BUF_SIZE / 2; fLockFlag = READ_BUF_SIZE / 2;
status_t status; status_t status;
do { do {
@@ -130,7 +147,7 @@ TermParse::PtyReader()
// Read PTY // Read PTY
uchar buf[READ_BUF_SIZE]; uchar buf[READ_BUF_SIZE];
int nread = read(fFd, buf, READ_BUF_SIZE - (read_p - fParser_p)); int nread = read(fFd, buf, READ_BUF_SIZE - (read_p - fBufferPosition));
if (nread <= 0) { if (nread <= 0) {
be_app->PostMessage(B_QUIT_REQUESTED); be_app->PostMessage(B_QUIT_REQUESTED);
exit_thread(B_ERROR); exit_thread(B_ERROR);
@@ -142,10 +159,10 @@ TermParse::PtyReader()
int mod = read_p % READ_BUF_SIZE; int mod = read_p % READ_BUF_SIZE;
if (nread >= left) { if (nread >= left) {
memcpy(fReadBuf + mod, buf, left); memcpy(fReadBuffer + mod, buf, left);
memcpy(fReadBuf, buf + left, nread - left); memcpy(fReadBuffer, buf + left, nread - left);
} else } else
memcpy(fReadBuf + mod, buf, nread); memcpy(fReadBuffer + mod, buf, nread);
read_p += nread; read_p += nread;
@@ -168,12 +185,11 @@ TermParse::GetReaderBuf(uchar &c)
} while (status == B_INTERRUPTED); } while (status == B_INTERRUPTED);
if (status == B_TIMED_OUT) { if (status == B_TIMED_OUT) {
fViewObj->ScrollAtCursor(); fView->ScrollAtCursor();
fViewObj->UpdateLine(); fView->UpdateLine();
// Reset cursor blinking time and turn on cursor blinking. // Reset cursor blinking time and turn on cursor blinking.
fCursorUpdate->SetInterval (1000000); fView->SetCurDraw(CURON);
fViewObj->SetCurDraw (CURON);
// wait new input from pty. // wait new input from pty.
do { do {
@@ -186,15 +202,15 @@ TermParse::GetReaderBuf(uchar &c)
} else } else
return status; return status;
c = fReadBuf[fParser_p % READ_BUF_SIZE]; c = fReadBuffer[fBufferPosition % READ_BUF_SIZE];
fParser_p++; fBufferPosition++;
// If PtyReader thread locked, decrement counter and unlock thread. // If PtyReader thread locked, decrement counter and unlock thread.
if (fLockFlag != 0) { if (fLockFlag != 0) {
if (--fLockFlag == 0) if (--fLockFlag == 0)
release_sem(fReaderLocker); release_sem(fReaderLocker);
} }
fViewObj->SetCurDraw(CUROFF); fView->SetCurDraw(CUROFF);
return B_OK; return B_OK;
} }
@@ -206,10 +222,6 @@ TermParse::InitTermParse()
if (fParseThread >= 0) if (fParseThread >= 0)
return B_ERROR; // we might want to return B_OK instead ? return B_ERROR; // we might want to return B_OK instead ?
BMessage cursor(MSGRUN_CURSOR);
fCursorUpdate = new BMessageRunner(BMessenger(fViewObj),
&cursor, 1000000);
fParseThread = spawn_thread(_escparse_thread, "EscParse", fParseThread = spawn_thread(_escparse_thread, "EscParse",
B_DISPLAY_PRIORITY, this); B_DISPLAY_PRIORITY, this);
@@ -314,7 +326,7 @@ TermParse::EscParse()
cbuf[0] = c; cbuf[0] = c;
cbuf[1] = '\0'; cbuf[1] = '\0';
width = HALF_WIDTH; width = HALF_WIDTH;
fViewObj->PutChar(cbuf, attr, width); fView->PutChar(cbuf, attr, width);
break; break;
case CASE_PRINT_GR: case CASE_PRINT_GR:
@@ -359,7 +371,7 @@ TermParse::EscParse()
else else
CodeConv::ConvertToInternal((char*)cbuf, -1, (char*)dstbuf, M_EUC_JP); CodeConv::ConvertToInternal((char*)cbuf, -1, (char*)dstbuf, M_EUC_JP);
fViewObj->PutChar(dstbuf, attr, width); fView->PutChar(dstbuf, attr, width);
break; break;
case CASE_PRINT_CS96: case CASE_PRINT_CS96:
@@ -369,15 +381,15 @@ TermParse::EscParse()
cbuf[2] = 0; cbuf[2] = 0;
width = 2; width = 2;
CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, M_EUC_JP); CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, M_EUC_JP);
fViewObj->PutChar(dstbuf, attr, width); fView->PutChar(dstbuf, attr, width);
break; break;
case CASE_LF: case CASE_LF:
fViewObj->PutLF(); fView->PutLF();
break; break;
case CASE_CR: case CASE_CR:
fViewObj->PutCR(); fView->PutCR();
break; break;
case CASE_SJIS_KANA: case CASE_SJIS_KANA:
@@ -385,7 +397,7 @@ TermParse::EscParse()
cbuf[1] = '\0'; cbuf[1] = '\0';
CodeConv::ConvertToInternal((char*)cbuf, 1, (char*)dstbuf, now_coding); CodeConv::ConvertToInternal((char*)cbuf, 1, (char*)dstbuf, now_coding);
width = 1; width = 1;
fViewObj->PutChar(dstbuf, attr, width); fView->PutChar(dstbuf, attr, width);
break; break;
case CASE_SJIS_INSTRING: case CASE_SJIS_INSTRING:
@@ -394,7 +406,7 @@ TermParse::EscParse()
cbuf[2] = '\0'; cbuf[2] = '\0';
CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, now_coding); CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, now_coding);
width = 2; width = 2;
fViewObj->PutChar(dstbuf, attr, width); fView->PutChar(dstbuf, attr, width);
break; break;
case CASE_UTF8_2BYTE: case CASE_UTF8_2BYTE:
@@ -405,7 +417,7 @@ TermParse::EscParse()
cbuf[1] = (uchar)c; cbuf[1] = (uchar)c;
cbuf[2] = '\0'; cbuf[2] = '\0';
width = CodeConv::UTF8GetFontWidth((char*)cbuf); width = CodeConv::UTF8GetFontWidth((char*)cbuf);
fViewObj->PutChar(cbuf, attr, width); fView->PutChar(cbuf, attr, width);
break; break;
case CASE_UTF8_3BYTE: case CASE_UTF8_3BYTE:
@@ -421,7 +433,7 @@ TermParse::EscParse()
cbuf[2] = c; cbuf[2] = c;
cbuf[3] = '\0'; cbuf[3] = '\0';
width = CodeConv::UTF8GetFontWidth((char*)cbuf); width = CodeConv::UTF8GetFontWidth((char*)cbuf);
fViewObj->PutChar (cbuf, attr, width); fView->PutChar (cbuf, attr, width);
break; break;
case CASE_MBCS: case CASE_MBCS:
@@ -453,13 +465,13 @@ TermParse::EscParse()
break; break;
case CASE_BS: case CASE_BS:
fViewObj->MoveCurLeft(1); fView->MoveCurLeft(1);
break; break;
case CASE_TAB: case CASE_TAB:
tmp = fViewObj->GetCurX(); tmp = fView->GetCurX();
tmp %= 8; tmp %= 8;
fViewObj->MoveCurRight(8 - tmp); fView->MoveCurRight(8 - tmp);
break; break;
case CASE_ESC: case CASE_ESC:
@@ -519,7 +531,7 @@ TermParse::EscParse()
/* ICH */ /* ICH */
if ((row = param[0]) < 1) if ((row = param[0]) < 1)
row = 1; row = 1;
fViewObj->InsertSpace(row); fView->InsertSpace(row);
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -527,7 +539,7 @@ TermParse::EscParse()
/* CUU */ /* CUU */
if ((row = param[0]) < 1) if ((row = param[0]) < 1)
row = 1; row = 1;
fViewObj->MoveCurUp(row); fView->MoveCurUp(row);
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -535,7 +547,7 @@ TermParse::EscParse()
/* CUD */ /* CUD */
if ((row = param[0]) < 1) if ((row = param[0]) < 1)
row = 1; row = 1;
fViewObj->MoveCurDown(row); fView->MoveCurDown(row);
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -543,7 +555,7 @@ TermParse::EscParse()
/* CUF */ /* CUF */
if ((row = param[0]) < 1) if ((row = param[0]) < 1)
row = 1; row = 1;
fViewObj->MoveCurRight(row); fView->MoveCurRight(row);
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -551,7 +563,7 @@ TermParse::EscParse()
/* CUB */ /* CUB */
if ((row = param[0]) < 1) if ((row = param[0]) < 1)
row = 1; row = 1;
fViewObj->MoveCurLeft(row); fView->MoveCurLeft(row);
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -562,7 +574,7 @@ TermParse::EscParse()
if (nparam < 2 || (col = param[1]) < 1) if (nparam < 2 || (col = param[1]) < 1)
col = 1; col = 1;
fViewObj->SetCurPos(col - 1, row - 1 ); fView->SetCurPos(col - 1, row - 1 );
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -571,15 +583,15 @@ TermParse::EscParse()
switch (param[0]) { switch (param[0]) {
case DEFAULT: case DEFAULT:
case 0: case 0:
fViewObj->EraseBelow(); fView->EraseBelow();
break; break;
case 1: case 1:
break; break;
case 2: case 2:
fViewObj->SetCurPos(0, 0); fView->SetCurPos(0, 0);
fViewObj->EraseBelow(); fView->EraseBelow();
break; break;
} }
parsestate = groundtable; parsestate = groundtable;
@@ -587,7 +599,7 @@ TermParse::EscParse()
case CASE_EL: // delete line case CASE_EL: // delete line
/* EL */ /* EL */
fViewObj->DeleteColumns(); fView->DeleteColumns();
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -595,7 +607,7 @@ TermParse::EscParse()
/* IL */ /* IL */
if ((row = param[0]) < 1) if ((row = param[0]) < 1)
row = 1; row = 1;
fViewObj->PutNL(row); fView->PutNL(row);
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -603,7 +615,7 @@ TermParse::EscParse()
/* DL */ /* DL */
if ((row = param[0]) < 1) if ((row = param[0]) < 1)
row = 1; row = 1;
fViewObj->DeleteLine(row); fView->DeleteLine(row);
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -611,19 +623,19 @@ TermParse::EscParse()
/* DCH */ /* DCH */
if ((row = param[0]) < 1) if ((row = param[0]) < 1)
row = 1; row = 1;
fViewObj->DeleteChar(row); fView->DeleteChar(row);
parsestate = groundtable; parsestate = groundtable;
break; break;
case CASE_SET: case CASE_SET:
/* SET */ /* SET */
fViewObj->SetInsertMode(MODE_INSERT); fView->SetInsertMode(MODE_INSERT);
parsestate = groundtable; parsestate = groundtable;
break; break;
case CASE_RST: case CASE_RST:
/* RST */ /* RST */
fViewObj->SetInsertMode(MODE_OVER); fView->SetInsertMode(MODE_OVER);
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -690,7 +702,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
fViewObj->DeviceStatusReport(param[0]); fView->DeviceStatusReport(param[0]);
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -709,7 +721,7 @@ TermParse::EscParse()
bot--; bot--;
if (bot > top) if (bot > top)
fViewObj->SetScrollRegion(top, bot); fView->SetScrollRegion(top, bot);
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -746,13 +758,13 @@ TermParse::EscParse()
case CASE_DECSC: case CASE_DECSC:
/* DECSC */ /* DECSC */
fViewObj->SaveCursor(); fView->SaveCursor();
parsestate = groundtable; parsestate = groundtable;
break; break;
case CASE_DECRC: case CASE_DECRC:
/* DECRC */ /* DECRC */
fViewObj->RestoreCursor(); fView->RestoreCursor();
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -764,7 +776,7 @@ TermParse::EscParse()
case CASE_RI: case CASE_RI:
/* RI */ /* RI */
fViewObj->ScrollRegion(-1, -1, SCRDOWN, 1); fView->ScrollRegion(-1, -1, SCRDOWN, 1);
parsestate = groundtable; parsestate = groundtable;
break; break;
@@ -814,7 +826,7 @@ TermParse::EscParse()
switch (mode_char) { switch (mode_char) {
case '0': case '0':
case '2': case '2':
fViewObj->Window()->SetTitle(string); fView->Window()->SetTitle(string);
break; break;
case '1': case '1':
break; break;
+7 -15
View File
@@ -33,9 +33,9 @@
#include "TermConst.h" #include "TermConst.h"
#include <OS.h>
#include <Handler.h> #include <Handler.h>
#include <MessageRunner.h> #include <OS.h>
//PtyReader buffer size. //PtyReader buffer size.
#define READ_BUF_SIZE 2048 #define READ_BUF_SIZE 2048
@@ -54,10 +54,6 @@ private:
status_t InitTermParse(); status_t InitTermParse();
status_t InitPtyReader(); status_t InitPtyReader();
// Delete TermParse and PtyReader thread.
status_t AbortTermParse();
status_t AbortPtyReader();
int32 EscParse(); int32 EscParse();
int32 PtyReader(); int32 PtyReader();
@@ -69,23 +65,19 @@ private:
int fFd; int fFd;
TermView *fViewObj;
thread_id fParseThread; thread_id fParseThread;
sem_id fParseSem;
thread_id fReaderThread; thread_id fReaderThread;
sem_id fReaderSem; sem_id fReaderSem;
sem_id fReaderLocker; sem_id fReaderLocker;
BMessageRunner *fCursorUpdate; uint fBufferPosition;
uchar fReadBuffer[READ_BUF_SIZE];
uint fParser_p; /* EscParse reading buffer pointer */ int fLockFlag;
int fLockFlag; /* PtyReader lock flag */
TermView *fView;
bool fQuitting; bool fQuitting;
uchar fReadBuf[READ_BUF_SIZE]; /* Reading buffer */
}; };
#endif // TERMPARSE_H #endif // TERMPARSE_H
+74 -20
View File
@@ -12,17 +12,17 @@
#include "TermView.h" #include "TermView.h"
#include "TermWindow.h"
#include "TermApp.h"
#include "TermParse.h"
#include "TermBuffer.h"
#include "CodeConv.h" #include "CodeConv.h"
#include "VTkeymap.h"
#include "TermConst.h"
#include "PrefHandler.h"
#include "MenuUtil.h" #include "MenuUtil.h"
#include "PrefHandler.h"
#include "PrefView.h" #include "PrefView.h"
#include "Shell.h" #include "Shell.h"
#include "TermApp.h"
#include "TermBuffer.h"
#include "TermConst.h"
#include "TermParse.h"
#include "TermWindow.h"
#include "VTkeymap.h"
#include <Autolock.h> #include <Autolock.h>
#include <Beep.h> #include <Beep.h>
@@ -61,8 +61,54 @@ const static rgb_color kTermColorTable[16] = {
}; };
const unsigned char M_ADD_CURSOR[] = {
16, // Size
1, // Color depth
0, // Hot spot y
1, // Hot spot x
// Cursor image
0x70, 0x00,
0x48, 0x00,
0x48, 0x00,
0x27, 0xc0,
0x24, 0xb8,
0x12, 0x54,
0x10, 0x02,
0x78, 0x02,
0x98, 0x02,
0x84, 0x02,
0x60, 0x02,
0x18, 0x12,
0x04, 0x10,
0x02, 0x7c,
0x00, 0x10,
0x00, 0x10,
// Mask image
0x70, 0x00,
0x78, 0x00,
0x78, 0x00,
0x3f, 0xc0,
0x3f, 0xf8,
0x1f, 0xfc,
0x1f, 0xfe,
0x7f, 0xfe,
0xff, 0xfe,
0xff, 0xfe,
0x7f, 0xfe,
0x1f, 0xfe,
0x07, 0xfc,
0x03, 0xfc,
0x00, 0x10,
0x00, 0x10,
};
#define MOUSE_THR_CODE 'mtcd'
TermView::TermView(BRect frame, const char *command) TermView::TermView(BRect frame, const char *command)
: BView(frame, "termview", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS), : BView(frame, "termview", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_PULSE_NEEDED),
fShell(NULL), fShell(NULL),
fFontWidth(0), fFontWidth(0),
fFontHeight(0), fFontHeight(0),
@@ -72,6 +118,7 @@ TermView::TermView(BRect frame, const char *command)
fScrollUpCount(0), fScrollUpCount(0),
fScrollBarRange(0), fScrollBarRange(0),
fFrameResized(false), fFrameResized(false),
fLastCursorTime(0),
fCursorDrawFlag(CURON), fCursorDrawFlag(CURON),
fCursorStatus(CURON), fCursorStatus(CURON),
fCursorBlinkingFlag(CURON), fCursorBlinkingFlag(CURON),
@@ -379,9 +426,9 @@ TermView::TermDraw(const CurPos &start, const CurPos &end)
int x2 = end.x; int x2 = end.x;
int y2 = end.y; int y2 = end.y;
// Send Draw Rectangle data to Draw Engine thread.
Redraw(x1, y1 + fTop / fFontHeight, Redraw(x1, y1 + fTop / fFontHeight,
x2, y2 + fTop / fFontHeight); x2, y2 + fTop / fFontHeight);
return 0; return 0;
} }
@@ -442,8 +489,7 @@ TermView::TermDrawRegion(CurPos start, CurPos end)
Redraw(0, start.y + 1, Redraw(0, start.y + 1,
fTermColumns - 1, end.y - 1); fTermColumns - 1, end.y - 1);
} }
Redraw(0, end.y, Redraw(0, end.y, end.x, end.y);
end.x, end.y);
} }
return 0; return 0;
@@ -624,18 +670,18 @@ TermView::MoveCurDown(int num)
} }
// TODO: Cleanup the next 3 functions!!!
void void
TermView::DrawCursor() TermView::DrawCursor()
{ {
CURSOR_RECT; BRect rect(fFontWidth * fCurPos.x, fFontHeight * fCurPos.y + fTop,
fFontWidth * (fCurPos.x + 1) - 1, fFontHeight * fCurPos.y + fTop + fCursorHeight - 1);
uchar buf[4]; uchar buf[4];
ushort attr; ushort attr;
int top = fTop / fFontHeight; int top = fTop / fFontHeight;
int m_flag = false; bool m_flag = CheckSelectedRegion(CurPos(fCurPos.x, fCurPos.y + fTop / fFontHeight));
m_flag = CheckSelectedRegion(CurPos(fCurPos.x,
fCurPos.y + fTop / fFontHeight));
if (fTextBuffer->GetChar(fCurPos.y + top, fCurPos.x, buf, &attr) == A_CHAR) { if (fTextBuffer->GetChar(fCurPos.y + top, fCurPos.x, buf, &attr) == A_CHAR) {
int width; int width;
if (IS_WIDTH(attr)) if (IS_WIDTH(attr))
@@ -652,7 +698,7 @@ TermView::DrawCursor()
else else
SetHighColor(fCursorBackColor); SetHighColor(fCursorBackColor);
FillRect(r); FillRect(rect);
} }
Sync(); Sync();
@@ -671,6 +717,7 @@ TermView::BlinkCursor()
DrawCursor(); DrawCursor();
fCursorStatus = fCursorStatus == CURON ? CUROFF : CURON; fCursorStatus = fCursorStatus == CURON ? CUROFF : CURON;
fLastCursorTime = system_time();
} }
} }
@@ -1107,6 +1154,16 @@ TermView::AttachedToWindow()
SetFont(&fHalfFont); SetFont(&fHalfFont);
MakeFocus(true); MakeFocus(true);
fScrollBar->SetSteps(fFontHeight, fFontHeight * fTermRows); fScrollBar->SetSteps(fFontHeight, fFontHeight * fTermRows);
Window()->SetPulseRate(1000000);
}
void
TermView::Pulse()
{
//if (system_time() > fLastCursorTime + 1000000)
BlinkCursor();
} }
@@ -1470,9 +1527,6 @@ TermView::MessageReceived(BMessage *msg)
fShell->Write(ctrl_l, 1); fShell->Write(ctrl_l, 1);
break; break;
case MSGRUN_CURSOR:
BlinkCursor();
break;
// case B_INPUT_METHOD_EVENT: // case B_INPUT_METHOD_EVENT:
// { // {
+180 -228
View File
@@ -36,295 +36,247 @@
#include "TermConst.h" #include "TermConst.h"
#include "TermWindow.h" #include "TermWindow.h"
#include <View.h> #include <Messenger.h>
#include <String.h> #include <String.h>
#include <MessageRunner.h> #include <View.h>
/* Cursor Blinking flag */ /* Cursor Blinking flag */
#define CUROFF 0 #define CUROFF 0
#define CURON 1 #define CURON 1
#define MOUSE_THR_CODE 'mtcd'
#define RECT_BUF_SIZE 32
const unsigned char M_ADD_CURSOR [] = {
16, // Size
1, // Color depth
0, // Hot spot y
1, // Hot spot x
// Cursor image
0x70, 0x00,
0x48, 0x00,
0x48, 0x00,
0x27, 0xc0,
0x24, 0xb8,
0x12, 0x54,
0x10, 0x02,
0x78, 0x02,
0x98, 0x02,
0x84, 0x02,
0x60, 0x02,
0x18, 0x12,
0x04, 0x10,
0x02, 0x7c,
0x00, 0x10,
0x00, 0x10,
// Mask image
0x70, 0x00,
0x78, 0x00,
0x78, 0x00,
0x3f, 0xc0,
0x3f, 0xf8,
0x1f, 0xfc,
0x1f, 0xfe,
0x7f, 0xfe,
0xff, 0xfe,
0xff, 0xfe,
0x7f, 0xfe,
0x1f, 0xfe,
0x07, 0xfc,
0x03, 0xfc,
0x00, 0x10,
0x00, 0x10,
};
class BPopUpMenu; class BPopUpMenu;
class BScrollBar; class BScrollBar;
class BString; class BString;
class Shell; class Shell;
class TermBuffer; class TermBuffer;
class TermView : public BView { class TermView : public BView {
public: public:
TermView(BRect frame, const char *command); TermView(BRect frame, const char *command);
~TermView(); ~TermView();
status_t AttachShell(Shell *shell); status_t AttachShell(Shell *shell);
void DetachShell(); void DetachShell();
const char *TerminalName() const; const char *TerminalName() const;
void SetTermFont(const BFont *halfFont, const BFont *fullFont); void SetTermFont(const BFont *halfFont, const BFont *fullFont);
void GetFontSize(int *width, int *height); void GetFontSize(int *width, int *height);
BRect SetTermSize(int rows, int cols, bool flag); BRect SetTermSize(int rows, int cols, bool flag);
void SetTermColor(); void SetTermColor();
void SetMouseCursor(); void SetMouseCursor();
// void SetIMAware (bool); // void SetIMAware (bool);
void SetScrollBar(BScrollBar *scrbar); void SetScrollBar(BScrollBar *scrbar);
BScrollBar *ScrollBar() const { return fScrollBar; }; BScrollBar *ScrollBar() const { return fScrollBar; };
// Output Charactor
void PutChar(uchar *string, ushort attr, int width);
void PutCR(void);
void PutLF(void);
void PutNL(int num);
void SetInsertMode(int flag);
void InsertSpace(int num);
int TermDraw(const CurPos &start, const CurPos &end);
int TermDrawRegion(CurPos start, CurPos end);
int TermDrawSelectedRegion(CurPos start, CurPos end);
// Output Charactor
void PutChar(uchar *string, ushort attr, int width);
void PutCR(void);
void PutLF(void);
void PutNL(int num);
void SetInsertMode(int flag);
void InsertSpace(int num);
int TermDraw(const CurPos &start, const CurPos &end);
int TermDrawRegion(CurPos start, CurPos end);
int TermDrawSelectedRegion(CurPos start, CurPos end);
// Delete Charactor // Delete Charactor
void EraseBelow(); void EraseBelow();
void DeleteChar(int num); void DeleteChar(int num);
void DeleteColumns(); void DeleteColumns();
void DeleteLine(int num); void DeleteLine(int num);
// Get and Set Cursor position // Get and Set Cursor position
void SetCurPos(int x, int y); void SetCurPos(int x, int y);
void SetCurX(int x); void SetCurX(int x);
void SetCurY(int y); void SetCurY(int y);
void GetCurPos(CurPos *inCurPos);
int GetCurX();
int GetCurY();
void SaveCursor();
void RestoreCursor();
void GetCurPos(CurPos *inCurPos); // Move Cursor
int GetCurX(); void MoveCurRight(int num);
int GetCurY(); void MoveCurLeft(int num);
void MoveCurUp(int num);
void MoveCurDown(int num);
void SaveCursor(); // Cursor setting
void RestoreCursor(); void DrawCursor();
void BlinkCursor();
void SetCurDraw(bool flag);
void SetCurBlinking(bool flag);
// Move Cursor // Scroll region
void MoveCurRight(int num); void ScrollRegion(int top, int bot, int dir, int num);
void MoveCurLeft(int num); void SetScrollRegion(int top, int bot);
void MoveCurUp(int num); void ScrollAtCursor();
void MoveCurDown(int num);
// Cursor setting // Other
void DrawCursor(); void UpdateSIGWINCH();
void BlinkCursor(); void DeviceStatusReport(int);
void SetCurDraw(bool flag); void UpdateLine();
void SetCurBlinking(bool flag); void ScrollScreen();
void ScrollScreenDraw();
void GetFrameSize(float *width, float *height);
void GetFontInfo(int *, int*);
bool Find(const BString &str, bool forwardSearch, bool matchCase, bool matchWord);
void GetSelection(BString &str);
// Scroll region protected:
void ScrollRegion(int top, int bot, int dir, int num); virtual void AttachedToWindow();
void SetScrollRegion(int top, int bot); virtual void Pulse();
void ScrollAtCursor(); virtual void Draw(BRect updateRect);
virtual void WindowActivated(bool active);
virtual void KeyDown(const char*, int32);
virtual void MouseDown(BPoint where);
virtual void MouseMoved(BPoint, uint32, const BMessage *);
// Other virtual void FrameResized(float width, float height);
void UpdateSIGWINCH(); virtual void MessageReceived(BMessage* message);
void DeviceStatusReport(int);
void UpdateLine();
void ScrollScreen();
void ScrollScreenDraw();
void GetFrameSize(float *width, float *height);
void GetFontInfo(int *, int*);
bool Find(const BString &str, bool forwardSearch, bool matchCase, bool matchWord);
void GetSelection(BString &str);
protected: private:
virtual void AttachedToWindow(void); static int32 MouseTracking(void *);
virtual void Draw(BRect updateRect);
virtual void WindowActivated(bool active);
virtual void KeyDown(const char*, int32);
virtual void MouseDown(BPoint where);
virtual void MouseMoved(BPoint, uint32, const BMessage *);
virtual void FrameResized(float width, float height); status_t _InitMouseThread(void);
virtual void MessageReceived(BMessage* message); void DrawLines(int , int, ushort, uchar *, int, int, int, BView *);
void DoPrint(BRect updateRect);
void ResizeScrBarRange (void);
void DoFileDrop(entry_ref &ref);
private: // edit menu function.
static int32 MouseTracking(void *); void DoCopy();
void DoPaste();
void DoSelectAll();
void DoClearAll();
status_t _InitMouseThread(void); void WritePTY (const uchar *text, int num_byteses);
void DrawLines(int , int, ushort, uchar *, int, int, int, BView *);
void DoPrint(BRect updateRect);
void ResizeScrBarRange (void);
void DoFileDrop(entry_ref &ref);
// edit menu function. // Comunicate Input Method
void DoCopy(); // void DoIMStart (BMessage* message);
void DoPaste(); // void DoIMStop (BMessage* message);
void DoSelectAll(); // void DoIMChange (BMessage* message);
void DoClearAll(); // void DoIMLocation (BMessage* message);
// void DoIMConfirm (void);
void ConfirmString (const char *, int32);
int32 GetCharFromUTF8String (const char *, char *);
int32 GetWidthFromUTF8String (const char *);
void WritePTY (const uchar *text, int num_byteses); // Mouse select
void Select(CurPos start, CurPos end);
void AddSelectRegion(CurPos);
void ResizeSelectRegion(CurPos);
// Comunicate Input Method void DeSelect();
// void DoIMStart (BMessage* message); bool HasSelection() const;
// void DoIMStop (BMessage* message);
// void DoIMChange (BMessage* message);
// void DoIMLocation (BMessage* message);
// void DoIMConfirm (void);
void ConfirmString (const char *, int32);
int32 GetCharFromUTF8String (const char *, char *);
int32 GetWidthFromUTF8String (const char *);
// Mouse select // select word function
void Select(CurPos start, CurPos end); void SelectWord(BPoint where, int mod);
void AddSelectRegion(CurPos); void SelectLine(BPoint where, int mod);
void ResizeSelectRegion(CurPos);
void DeSelect(); // point and text offset conversion.
bool HasSelection() const; CurPos BPointToCurPos(const BPoint &p);
BPoint CurPosToBPoint(const CurPos &pos);
// select word function bool CheckSelectedRegion(const CurPos &pos);
void SelectWord(BPoint where, int mod); inline void Redraw(int, int, int, int);
void SelectLine(BPoint where, int mod);
// point and text offset conversion. Shell *fShell;
CurPos BPointToCurPos(const BPoint &p);
BPoint CurPosToBPoint(const CurPos &pos);
bool CheckSelectedRegion(const CurPos &pos); // Font and Width
inline void Redraw(int, int, int, int); BFont fHalfFont;
BFont fFullFont;
int fFontWidth;
int fFontHeight;
int fFontAscent;
struct escapement_delta fEscapement;
Shell *fShell; // Flags
// Font and Width // Update flag (Set on PutChar).
BFont fHalfFont; bool fUpdateFlag;
BFont fFullFont;
int fFontWidth;
int fFontHeight;
int fFontAscent;
struct escapement_delta fEscapement;
// Flags // Terminal insertmode flag (use PutChar).
bool fInsertModeFlag;
// Update flag (Set on PutChar). // Scroll count, range.
bool fUpdateFlag; int fScrollUpCount;
int fScrollBarRange;
// Terminal insertmode flag (use PutChar). // Frame Resized flag.
bool fInsertModeFlag; bool fFrameResized;
// Scroll count, range. // Cursor Blinking, draw flag.
int fScrollUpCount; bigtime_t fLastCursorTime;
int fScrollBarRange; bool fCursorDrawFlag;
bool fCursorStatus;
bool fCursorBlinkingFlag;
bool fCursorRedrawFlag;
// Frame Resized flag. int fCursorHeight;
bool fFrameResized;
// Cursor Blinking, draw flag. // terminal text attribute flag.
bool fCursorDrawFlag; bool fInverseFlag;
bool fCursorStatus; bool fBoldFlag;
bool fCursorBlinkingFlag; bool fUnderlineFlag;
bool fCursorRedrawFlag;
int fCursorHeight; // Cursor position.
CurPos fCurPos;
CurPos fCurStack;
// terminal text attribute flag. int fBufferStartPos;
bool fInverseFlag;
bool fBoldFlag;
bool fUnderlineFlag;
// Cursor position. // Terminal rows and columns.
CurPos fCurPos; int fTermRows;
CurPos fCurStack; int fTermColumns;
int fBufferStartPos; // Terminal view pointer.
int fTop;
// Terminal rows and columns. // Object pointer.
int fTermRows;
int fTermColumns;
// Terminal view pointer. TermBuffer *fTextBuffer;
int fTop; BScrollBar *fScrollBar;
// Object pointer. // Offscreen Bitmap and View.
TermBuffer *fTextBuffer; BRect fSrcRect;
BScrollBar *fScrollBar; BRect fDstRect;
// Offscreen Bitmap and View. // Color and Attribute.
BRect fSrcRect; rgb_color fTextForeColor, fTextBackColor;
BRect fDstRect; rgb_color fCursorForeColor, fCursorBackColor;
rgb_color fSelectForeColor, fSelectBackColor;
uchar fTermAttr;
// Color and Attribute. // Scroll Region
int fScrTop;
int fScrBot;
int fScrBufSize;
bool fScrRegionSet;
rgb_color fTextForeColor, fTextBackColor; bool fMouseImage;
rgb_color fCursorForeColor, fCursorBackColor;
rgb_color fSelectForeColor, fSelectBackColor;
uchar fTermAttr;
// Scroll Region BPoint fPreviousMousePoint;
int fScrTop;
int fScrBot;
int fScrBufSize;
bool fScrRegionSet;
bool fMouseImage; // view selection
CurPos fSelStart;
CurPos fSelEnd;
bool fMouseTracking;
BPoint fPreviousMousePoint; // thread ID / flags.
thread_id fMouseThread;
bool fQuitting;
// view selection // Input Method parameter.
CurPos fSelStart; int fIMViewPtr;
CurPos fSelEnd; CurPos fIMStartPos;
bool fMouseTracking; CurPos fIMEndPos;
BString fIMString;
bool fIMflag;
BMessenger fIMMessenger;
// thread ID / flags. int32 fImCodeState;
thread_id fMouseThread;
bool fQuitting;
// Input Method parameter.
int fIMViewPtr;
CurPos fIMStartPos;
CurPos fIMEndPos;
BString fIMString;
bool fIMflag;
BMessenger fIMMessenger;
int32 fImCodeState;
}; };
+8 -5
View File
@@ -50,6 +50,9 @@
//#define CHLP_FILE "file:///boot/beos/documentation/Shell%20Tools/index.html" //#define CHLP_FILE "file:///boot/beos/documentation/Shell%20Tools/index.html"
const static float kViewOffset = 3;
TermWindow::TermWindow(BRect frame, const char* title, const char *command) TermWindow::TermWindow(BRect frame, const char* title, const char *command)
: BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE), : BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE),
fMenubar(NULL), fMenubar(NULL),
@@ -147,7 +150,7 @@ TermWindow::_InitWindow(const char *command)
fTermView->SetTermColor(); fTermView->SetTermColor();
// Add offset to baseview. // Add offset to baseview.
rect.InsetBy(-VIEW_OFFSET, -VIEW_OFFSET); rect.InsetBy(-kViewOffset, -kViewOffset);
// Resize Window // Resize Window
ResizeTo(rect.Width()+ B_V_SCROLL_BAR_WIDTH, ResizeTo(rect.Width()+ B_V_SCROLL_BAR_WIDTH,
@@ -425,8 +428,8 @@ TermWindow::MessageReceived(BMessage *message)
r = fTermView->SetTermSize (PrefHandler::Default()->getInt32 (PREF_ROWS), r = fTermView->SetTermSize (PrefHandler::Default()->getInt32 (PREF_ROWS),
PrefHandler::Default()->getInt32 (PREF_COLS), 0); PrefHandler::Default()->getInt32 (PREF_COLS), 0);
ResizeTo (r.Width()+ B_V_SCROLL_BAR_WIDTH + VIEW_OFFSET * 2, ResizeTo (r.Width()+ B_V_SCROLL_BAR_WIDTH + kViewOffset * 2,
r.Height()+fMenubar->Bounds().Height() + VIEW_OFFSET *2); r.Height()+fMenubar->Bounds().Height() + kViewOffset *2);
BPath path; BPath path;
if (PrefHandler::GetDefaultPath(path) == B_OK) if (PrefHandler::GetDefaultPath(path) == B_OK)
@@ -456,8 +459,8 @@ TermWindow::MessageReceived(BMessage *message)
SetSizeLimits (MIN_COLS * width, MAX_COLS * width, SetSizeLimits (MIN_COLS * width, MAX_COLS * width,
MIN_COLS * height, MAX_COLS * height); MIN_COLS * height, MAX_COLS * height);
ResizeTo (r.Width()+ B_V_SCROLL_BAR_WIDTH + VIEW_OFFSET * 2, ResizeTo (r.Width()+ B_V_SCROLL_BAR_WIDTH + kViewOffset * 2,
r.Height()+fMenubar->Bounds().Height() + VIEW_OFFSET * 2); r.Height()+fMenubar->Bounds().Height() + kViewOffset * 2);
fTermView->Invalidate(); fTermView->Invalidate();
break; break;