* Moved duplicated initializers to the _InitObject() method.
* Cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28127 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+215
-274
@@ -147,6 +147,213 @@ private:
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
TermView::TermView(BRect frame, int32 argc, const char** argv, int32 historySize)
|
||||
: BView(frame, "termview", B_FOLLOW_ALL,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED),
|
||||
fTermRows(ROWS_DEFAULT),
|
||||
fTermColumns(COLUMNS_DEFAULT),
|
||||
fEncoding(M_UTF8),
|
||||
fScrBufSize(historySize)
|
||||
{
|
||||
_InitObject(argc, argv);
|
||||
}
|
||||
|
||||
|
||||
TermView::TermView(int rows, int columns, int32 argc, const char** argv,
|
||||
int32 historySize)
|
||||
: BView(BRect(0, 0, 0, 0), "termview", B_FOLLOW_ALL,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED),
|
||||
fTermRows(rows),
|
||||
fTermColumns(columns),
|
||||
fEncoding(M_UTF8),
|
||||
fScrBufSize(historySize)
|
||||
{
|
||||
_InitObject(argc, argv);
|
||||
SetTermSize(fTermRows, fTermColumns, true);
|
||||
|
||||
// TODO: Don't show the dragger, since replicant capabilities
|
||||
// don't work very well ATM.
|
||||
/*
|
||||
BRect rect(0, 0, 16, 16);
|
||||
rect.OffsetTo(Bounds().right - rect.Width(),
|
||||
Bounds().bottom - rect.Height());
|
||||
|
||||
SetFlags(Flags() | B_DRAW_ON_CHILDREN | B_FOLLOW_ALL);
|
||||
AddChild(new BDragger(rect, this,
|
||||
B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM, B_WILL_DRAW));*/
|
||||
}
|
||||
|
||||
|
||||
TermView::TermView(BMessage* archive)
|
||||
:
|
||||
BView(archive),
|
||||
fTermRows(ROWS_DEFAULT),
|
||||
fTermColumns(COLUMNS_DEFAULT),
|
||||
fEncoding(M_UTF8),
|
||||
fScrBufSize(1000)
|
||||
{
|
||||
// We need this
|
||||
SetFlags(Flags() | B_WILL_DRAW | B_PULSE_NEEDED);
|
||||
|
||||
if (archive->FindInt32("encoding", (int32*)&fEncoding) < B_OK)
|
||||
fEncoding = M_UTF8;
|
||||
if (archive->FindInt32("columns", (int32*)&fTermColumns) < B_OK)
|
||||
fTermColumns = COLUMNS_DEFAULT;
|
||||
if (archive->FindInt32("rows", (int32*)&fTermRows) < B_OK)
|
||||
fTermRows = ROWS_DEFAULT;
|
||||
|
||||
int32 argc = 0;
|
||||
if (archive->HasInt32("argc"))
|
||||
archive->FindInt32("argc", &argc);
|
||||
|
||||
const char **argv = new const char*[argc];
|
||||
for (int32 i = 0; i < argc; i++) {
|
||||
archive->FindString("argv", i, (const char**)&argv[i]);
|
||||
}
|
||||
|
||||
// TODO: Retrieve colors, history size, etc. from archive
|
||||
_InitObject(argc, argv);
|
||||
|
||||
delete[] argv;
|
||||
}
|
||||
|
||||
|
||||
/*! Initializes the object for further use.
|
||||
The members fTermRows, fTermColumns, fEncoding, and fScrBufSize must
|
||||
already be initialized; they are not touched by this method.
|
||||
*/
|
||||
status_t
|
||||
TermView::_InitObject(int32 argc, const char** argv)
|
||||
{
|
||||
fShell = NULL;
|
||||
fWinchRunner = NULL;
|
||||
fCursorBlinkRunner = NULL;
|
||||
fAutoScrollRunner = NULL;
|
||||
fResizeRunner = NULL;
|
||||
fResizeView = NULL;
|
||||
fCharClassifier = NULL;
|
||||
fFontWidth = 0;
|
||||
fFontHeight = 0;
|
||||
fFontAscent = 0;
|
||||
fFrameResized = false;
|
||||
fLastActivityTime = 0;
|
||||
fCursorState = 0;
|
||||
fCursorHeight = 0;
|
||||
fCursor = TermPos(0, 0);
|
||||
fTextBuffer = NULL;
|
||||
fVisibleTextBuffer = NULL;
|
||||
fScrollBar = NULL;
|
||||
fTextForeColor = kBlackColor;
|
||||
fTextBackColor = kWhiteColor;
|
||||
fCursorForeColor = kWhiteColor;
|
||||
fCursorBackColor = kBlackColor;
|
||||
fSelectForeColor = kWhiteColor;
|
||||
fSelectBackColor = kBlackColor;
|
||||
fScrollOffset = 0;
|
||||
fLastSyncTime = 0;
|
||||
fScrolledSinceLastSync = 0;
|
||||
fSyncRunner = NULL;
|
||||
fConsiderClockedSync = false;
|
||||
fSelStart = TermPos(-1, -1);
|
||||
fSelEnd = TermPos(-1, -1);
|
||||
fMouseTracking = false;
|
||||
fIMflag = false;
|
||||
|
||||
fTextBuffer = new(std::nothrow) TerminalBuffer;
|
||||
if (fTextBuffer == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
fVisibleTextBuffer = new(std::nothrow) BasicTerminalBuffer;
|
||||
if (fVisibleTextBuffer == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
// TODO: Make the special word chars user-settable!
|
||||
fCharClassifier = new(std::nothrow) CharClassifier(
|
||||
kDefaultSpecialWordChars);
|
||||
if (fCharClassifier == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
status_t error = fTextBuffer->Init(fTermColumns, fTermRows, fScrBufSize);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
fTextBuffer->SetEncoding(fEncoding);
|
||||
|
||||
error = fVisibleTextBuffer->Init(fTermColumns, fTermRows + 2, 0);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
fShell = new (std::nothrow) Shell();
|
||||
if (fShell == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
SetTermFont(be_fixed_font);
|
||||
SetTermSize(fTermRows, fTermColumns, false);
|
||||
//SetIMAware(false);
|
||||
|
||||
status_t status = fShell->Open(fTermRows, fTermColumns,
|
||||
EncodingAsShortString(fEncoding), argc, argv);
|
||||
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
status = _AttachShell(fShell);
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
SetLowColor(fTextBackColor);
|
||||
SetViewColor(B_TRANSPARENT_32_BIT);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
TermView::~TermView()
|
||||
{
|
||||
Shell* shell = fShell;
|
||||
// _DetachShell sets fShell to NULL
|
||||
|
||||
_DetachShell();
|
||||
|
||||
delete fSyncRunner;
|
||||
delete fAutoScrollRunner;
|
||||
delete fCharClassifier;
|
||||
delete fVisibleTextBuffer;
|
||||
delete fTextBuffer;
|
||||
delete shell;
|
||||
}
|
||||
|
||||
|
||||
/* static */
|
||||
BArchivable *
|
||||
TermView::Instantiate(BMessage* data)
|
||||
{
|
||||
if (validate_instantiation(data, "TermView"))
|
||||
return new (std::nothrow) TermView(data);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
TermView::Archive(BMessage* data, bool deep) const
|
||||
{
|
||||
status_t status = BView::Archive(data, deep);
|
||||
if (status == B_OK)
|
||||
status = data->AddString("add_on", TERM_SIGNATURE);
|
||||
if (status == B_OK)
|
||||
status = data->AddInt32("encoding", (int32)fEncoding);
|
||||
if (status == B_OK)
|
||||
status = data->AddInt32("columns", (int32)fTermColumns);
|
||||
if (status == B_OK)
|
||||
status = data->AddInt32("rows", (int32)fTermRows);
|
||||
|
||||
if (data->ReplaceString("class", "TermView") != B_OK)
|
||||
data->AddString("class", "TermView");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
inline int32
|
||||
TermView::_LineAt(float y)
|
||||
{
|
||||
@@ -194,274 +401,6 @@ TermView::_InvalidateTextRect(int32 x1, int32 y1, int32 x2, int32 y2)
|
||||
}
|
||||
|
||||
|
||||
TermView::TermView(BRect frame, int32 argc, const char **argv, int32 historySize)
|
||||
: BView(frame, "termview", B_FOLLOW_ALL,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED),
|
||||
fShell(NULL),
|
||||
fWinchRunner(NULL),
|
||||
fCursorBlinkRunner(NULL),
|
||||
fAutoScrollRunner(NULL),
|
||||
fResizeRunner(NULL),
|
||||
fResizeView(NULL),
|
||||
fCharClassifier(NULL),
|
||||
fFontWidth(0),
|
||||
fFontHeight(0),
|
||||
fFontAscent(0),
|
||||
fFrameResized(false),
|
||||
fLastActivityTime(0),
|
||||
fCursorState(0),
|
||||
fCursorHeight(0),
|
||||
fCursor(0, 0),
|
||||
fTermRows(ROWS_DEFAULT),
|
||||
fTermColumns(COLUMNS_DEFAULT),
|
||||
fEncoding(M_UTF8),
|
||||
fTextBuffer(NULL),
|
||||
fVisibleTextBuffer(NULL),
|
||||
fScrollBar(NULL),
|
||||
fTextForeColor(kBlackColor),
|
||||
fTextBackColor(kWhiteColor),
|
||||
fCursorForeColor(kWhiteColor),
|
||||
fCursorBackColor(kBlackColor),
|
||||
fSelectForeColor(kWhiteColor),
|
||||
fSelectBackColor(kBlackColor),
|
||||
fScrollOffset(0),
|
||||
fScrBufSize(historySize),
|
||||
fLastSyncTime(0),
|
||||
fScrolledSinceLastSync(0),
|
||||
fSyncRunner(NULL),
|
||||
fConsiderClockedSync(false),
|
||||
fSelStart(-1, -1),
|
||||
fSelEnd(-1, -1),
|
||||
fMouseTracking(false),
|
||||
fIMflag(false)
|
||||
{
|
||||
_InitObject(argc, argv);
|
||||
}
|
||||
|
||||
|
||||
TermView::TermView(int rows, int columns, int32 argc, const char **argv, int32 historySize)
|
||||
: BView(BRect(0, 0, 0, 0), "termview", B_FOLLOW_ALL,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED),
|
||||
fShell(NULL),
|
||||
fWinchRunner(NULL),
|
||||
fCursorBlinkRunner(NULL),
|
||||
fAutoScrollRunner(NULL),
|
||||
fResizeRunner(NULL),
|
||||
fResizeView(NULL),
|
||||
fCharClassifier(NULL),
|
||||
fFontWidth(0),
|
||||
fFontHeight(0),
|
||||
fFontAscent(0),
|
||||
fFrameResized(false),
|
||||
fLastActivityTime(0),
|
||||
fCursorState(0),
|
||||
fCursorHeight(0),
|
||||
fCursor(0, 0),
|
||||
fTermRows(rows),
|
||||
fTermColumns(columns),
|
||||
fEncoding(M_UTF8),
|
||||
fTextBuffer(NULL),
|
||||
fVisibleTextBuffer(NULL),
|
||||
fScrollBar(NULL),
|
||||
fTextForeColor(kBlackColor),
|
||||
fTextBackColor(kWhiteColor),
|
||||
fCursorForeColor(kWhiteColor),
|
||||
fCursorBackColor(kBlackColor),
|
||||
fSelectForeColor(kWhiteColor),
|
||||
fSelectBackColor(kBlackColor),
|
||||
fScrollOffset(0),
|
||||
fScrBufSize(historySize),
|
||||
fLastSyncTime(0),
|
||||
fScrolledSinceLastSync(0),
|
||||
fSyncRunner(NULL),
|
||||
fConsiderClockedSync(false),
|
||||
fSelStart(-1, -1),
|
||||
fSelEnd(-1, -1),
|
||||
fMouseTracking(false),
|
||||
fIMflag(false)
|
||||
{
|
||||
_InitObject(argc, argv);
|
||||
SetTermSize(fTermRows, fTermColumns, true);
|
||||
|
||||
// TODO: Don't show the dragger, since replicant capabilities
|
||||
// don't work very well ATM.
|
||||
/*
|
||||
BRect rect(0, 0, 16, 16);
|
||||
rect.OffsetTo(Bounds().right - rect.Width(),
|
||||
Bounds().bottom - rect.Height());
|
||||
|
||||
SetFlags(Flags() | B_DRAW_ON_CHILDREN | B_FOLLOW_ALL);
|
||||
AddChild(new BDragger(rect, this,
|
||||
B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM, B_WILL_DRAW));*/
|
||||
}
|
||||
|
||||
|
||||
TermView::TermView(BMessage *archive)
|
||||
:
|
||||
BView(archive),
|
||||
fShell(NULL),
|
||||
fWinchRunner(NULL),
|
||||
fCursorBlinkRunner(NULL),
|
||||
fAutoScrollRunner(NULL),
|
||||
fResizeRunner(NULL),
|
||||
fResizeView(NULL),
|
||||
fCharClassifier(NULL),
|
||||
fFontWidth(0),
|
||||
fFontHeight(0),
|
||||
fFontAscent(0),
|
||||
fFrameResized(false),
|
||||
fLastActivityTime(0),
|
||||
fCursorState(0),
|
||||
fCursorHeight(0),
|
||||
fCursor(0, 0),
|
||||
fTermRows(ROWS_DEFAULT),
|
||||
fTermColumns(COLUMNS_DEFAULT),
|
||||
fEncoding(M_UTF8),
|
||||
fTextBuffer(NULL),
|
||||
fVisibleTextBuffer(NULL),
|
||||
fScrollBar(NULL),
|
||||
fTextForeColor(kBlackColor),
|
||||
fTextBackColor(kWhiteColor),
|
||||
fCursorForeColor(kWhiteColor),
|
||||
fCursorBackColor(kBlackColor),
|
||||
fSelectForeColor(kWhiteColor),
|
||||
fSelectBackColor(kBlackColor),
|
||||
fScrBufSize(1000),
|
||||
fLastSyncTime(0),
|
||||
fScrolledSinceLastSync(0),
|
||||
fSyncRunner(NULL),
|
||||
fConsiderClockedSync(false),
|
||||
fSelStart(-1, -1),
|
||||
fSelEnd(-1, -1),
|
||||
fMouseTracking(false),
|
||||
fIMflag(false)
|
||||
{
|
||||
// We need this
|
||||
SetFlags(Flags() | B_WILL_DRAW | B_PULSE_NEEDED);
|
||||
|
||||
if (archive->FindInt32("encoding", (int32 *)&fEncoding) < B_OK)
|
||||
fEncoding = M_UTF8;
|
||||
if (archive->FindInt32("columns", (int32 *)&fTermColumns) < B_OK)
|
||||
fTermColumns = COLUMNS_DEFAULT;
|
||||
if (archive->FindInt32("rows", (int32 *)&fTermRows) < B_OK)
|
||||
fTermRows = ROWS_DEFAULT;
|
||||
|
||||
int32 argc = 0;
|
||||
if (archive->HasInt32("argc"))
|
||||
archive->FindInt32("argc", &argc);
|
||||
|
||||
const char **argv = new const char*[argc];
|
||||
for (int32 i = 0; i < argc; i++) {
|
||||
archive->FindString("argv", i, (const char **)&argv[i]);
|
||||
}
|
||||
|
||||
// TODO: Retrieve colors, history size, etc. from archive
|
||||
_InitObject(argc, argv);
|
||||
|
||||
delete[] argv;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
TermView::_InitObject(int32 argc, const char **argv)
|
||||
{
|
||||
fTextBuffer = new(std::nothrow) TerminalBuffer;
|
||||
if (fTextBuffer == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
fVisibleTextBuffer = new(std::nothrow) BasicTerminalBuffer;
|
||||
if (fVisibleTextBuffer == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
// TODO: Make the special word chars user-settable!
|
||||
fCharClassifier = new(std::nothrow) CharClassifier(
|
||||
kDefaultSpecialWordChars);
|
||||
if (fCharClassifier == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
status_t error = fTextBuffer->Init(fTermColumns, fTermRows, fScrBufSize);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
fTextBuffer->SetEncoding(fEncoding);
|
||||
|
||||
error = fVisibleTextBuffer->Init(fTermColumns, fTermRows + 2, 0);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
fShell = new (std::nothrow) Shell();
|
||||
if (fShell == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
SetTermFont(be_fixed_font);
|
||||
SetTermSize(fTermRows, fTermColumns, false);
|
||||
//SetIMAware(false);
|
||||
|
||||
status_t status = fShell->Open(fTermRows, fTermColumns,
|
||||
EncodingAsShortString(fEncoding),
|
||||
argc, argv);
|
||||
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
status = _AttachShell(fShell);
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
|
||||
SetLowColor(fTextBackColor);
|
||||
SetViewColor(B_TRANSPARENT_32_BIT);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
TermView::~TermView()
|
||||
{
|
||||
Shell *shell = fShell;
|
||||
// _DetachShell sets fShell to NULL
|
||||
|
||||
_DetachShell();
|
||||
|
||||
delete fSyncRunner;
|
||||
delete fAutoScrollRunner;
|
||||
delete fCharClassifier;
|
||||
delete fVisibleTextBuffer;
|
||||
delete fTextBuffer;
|
||||
delete shell;
|
||||
}
|
||||
|
||||
|
||||
/* static */
|
||||
BArchivable *
|
||||
TermView::Instantiate(BMessage* data)
|
||||
{
|
||||
if (validate_instantiation(data, "TermView"))
|
||||
return new (std::nothrow) TermView(data);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
TermView::Archive(BMessage* data, bool deep) const
|
||||
{
|
||||
status_t status = BView::Archive(data, deep);
|
||||
if (status == B_OK)
|
||||
status = data->AddString("add_on", TERM_SIGNATURE);
|
||||
if (status == B_OK)
|
||||
status = data->AddInt32("encoding", (int32)fEncoding);
|
||||
if (status == B_OK)
|
||||
status = data->AddInt32("columns", (int32)fTermColumns);
|
||||
if (status == B_OK)
|
||||
status = data->AddInt32("rows", (int32)fTermRows);
|
||||
|
||||
if (data->ReplaceString("class", "TermView") != B_OK)
|
||||
data->AddString("class", "TermView");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermView::GetPreferredSize(float *width, float *height)
|
||||
{
|
||||
@@ -1602,13 +1541,15 @@ TermView::ScrollTo(BPoint where)
|
||||
|
||||
|
||||
BHandler*
|
||||
TermView::ResolveSpecifier(BMessage *message, int32 index, BMessage *specifier,
|
||||
int32 what, const char *property)
|
||||
TermView::ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier,
|
||||
int32 what, const char* property)
|
||||
{
|
||||
BHandler *target = this;
|
||||
BHandler* target = this;
|
||||
BPropertyInfo propInfo(sPropList);
|
||||
if (propInfo.FindMatch(message, index, specifier, what, property) < B_OK)
|
||||
target = BView::ResolveSpecifier(message, index, specifier, what, property);
|
||||
if (propInfo.FindMatch(message, index, specifier, what, property) < B_OK) {
|
||||
target = BView::ResolveSpecifier(message, index, specifier, what,
|
||||
property);
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
@@ -1616,7 +1557,7 @@ TermView::ResolveSpecifier(BMessage *message, int32 index, BMessage *specifier,
|
||||
|
||||
//! Gets dropped file full path and display it at cursor position.
|
||||
void
|
||||
TermView::_DoFileDrop(entry_ref &ref)
|
||||
TermView::_DoFileDrop(entry_ref& ref)
|
||||
{
|
||||
BEntry ent(&ref);
|
||||
BPath path(&ent);
|
||||
|
||||
+166
-156
@@ -8,7 +8,6 @@
|
||||
* Stefano Ceccherini <stefano.ceccherini@gmail.com>
|
||||
* Kian Duffy, myob@users.sourceforge.net
|
||||
*/
|
||||
|
||||
#ifndef TERMVIEW_H
|
||||
#define TERMVIEW_H
|
||||
|
||||
@@ -32,216 +31,227 @@ class ResizeWindow;
|
||||
|
||||
class TermView : public BView {
|
||||
public:
|
||||
TermView(BRect frame, int32 argc, const char **argv, int32 historySize);
|
||||
TermView(int rows, int columns, int32 argc, const char **argv,
|
||||
int32 historySize);
|
||||
TermView(BMessage *archive);
|
||||
~TermView();
|
||||
TermView(BRect frame, int32 argc, const char** argv,
|
||||
int32 historySize);
|
||||
TermView(int rows, int columns, int32 argc,
|
||||
const char** argv, int32 historySize);
|
||||
TermView(BMessage* archive);
|
||||
~TermView();
|
||||
|
||||
static BArchivable* Instantiate(BMessage* data);
|
||||
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||
static BArchivable* Instantiate(BMessage* data);
|
||||
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||
|
||||
virtual void GetPreferredSize(float *width, float *height);
|
||||
virtual void GetPreferredSize(float* _width, float* _height);
|
||||
|
||||
const char *TerminalName() const;
|
||||
const char* TerminalName() const;
|
||||
|
||||
inline TerminalBuffer* TextBuffer() const { return fTextBuffer; }
|
||||
inline TerminalBuffer* TextBuffer() const { return fTextBuffer; }
|
||||
|
||||
void GetTermFont(BFont *font) const;
|
||||
void SetTermFont(const BFont *font);
|
||||
void GetTermFont(BFont* font) const;
|
||||
void SetTermFont(const BFont* font);
|
||||
|
||||
void GetFontSize(int *width, int *height);
|
||||
BRect SetTermSize(int rows, int cols, bool resize);
|
||||
void GetFontSize(int* width, int* height);
|
||||
BRect SetTermSize(int rows, int cols, bool resize);
|
||||
|
||||
void SetTextColor(rgb_color fore, rgb_color back);
|
||||
void SetSelectColor(rgb_color fore, rgb_color back);
|
||||
void SetCursorColor(rgb_color fore, rgb_color back);
|
||||
void SetTextColor(rgb_color fore, rgb_color back);
|
||||
void SetSelectColor(rgb_color fore, rgb_color back);
|
||||
void SetCursorColor(rgb_color fore, rgb_color back);
|
||||
|
||||
int Encoding() const;
|
||||
void SetEncoding(int encoding);
|
||||
int Encoding() const;
|
||||
void SetEncoding(int encoding);
|
||||
|
||||
// void SetIMAware (bool);
|
||||
void SetScrollBar(BScrollBar *scrbar);
|
||||
BScrollBar *ScrollBar() const { return fScrollBar; };
|
||||
//void SetIMAware(bool);
|
||||
void SetScrollBar(BScrollBar* scrollBar);
|
||||
BScrollBar* ScrollBar() const { return fScrollBar; };
|
||||
|
||||
virtual void SetTitle(const char *title);
|
||||
virtual void NotifyQuit(int32 reason);
|
||||
virtual void SetTitle(const char* title);
|
||||
virtual void NotifyQuit(int32 reason);
|
||||
|
||||
// edit functions
|
||||
void Copy(BClipboard *clipboard);
|
||||
void Paste(BClipboard *clipboard);
|
||||
void SelectAll();
|
||||
void Clear();
|
||||
// edit functions
|
||||
void Copy(BClipboard* clipboard);
|
||||
void Paste(BClipboard* clipboard);
|
||||
void SelectAll();
|
||||
void Clear();
|
||||
|
||||
// Other
|
||||
void GetFrameSize(float *width, float *height);
|
||||
bool Find(const BString &str, bool forwardSearch, bool matchCase, bool matchWord);
|
||||
void GetSelection(BString &str);
|
||||
// Other
|
||||
void GetFrameSize(float* width, float* height);
|
||||
bool Find(const BString& str, bool forwardSearch,
|
||||
bool matchCase, bool matchWord);
|
||||
void GetSelection(BString& string);
|
||||
|
||||
void CheckShellGone();
|
||||
void CheckShellGone();
|
||||
|
||||
void InitiateDrag();
|
||||
void InitiateDrag();
|
||||
|
||||
protected:
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void WindowActivated(bool active);
|
||||
virtual void KeyDown(const char*, int32);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void WindowActivated(bool active);
|
||||
virtual void KeyDown(const char* bytes, int32 numBytes);
|
||||
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void MouseMoved(BPoint, uint32, const BMessage *);
|
||||
virtual void MouseUp(BPoint where);
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void MouseMoved(BPoint where, uint32 transit,
|
||||
const BMessage* message);
|
||||
virtual void MouseUp(BPoint where);
|
||||
|
||||
virtual void FrameResized(float width, float height);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void FrameResized(float width, float height);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
virtual void ScrollTo(BPoint where);
|
||||
virtual void ScrollTo(BPoint where);
|
||||
|
||||
virtual status_t GetSupportedSuites(BMessage *msg);
|
||||
virtual BHandler* ResolveSpecifier(BMessage *msg, int32 index,
|
||||
BMessage *specifier, int32 form,
|
||||
const char *property);
|
||||
virtual status_t GetSupportedSuites(BMessage* msg);
|
||||
virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index,
|
||||
BMessage* specifier, int32 form,
|
||||
const char* property);
|
||||
|
||||
private:
|
||||
// point and text offset conversion
|
||||
inline int32 _LineAt(float y);
|
||||
inline float _LineOffset(int32 index);
|
||||
inline TermPos _ConvertToTerminal(const BPoint &p);
|
||||
inline BPoint _ConvertFromTerminal(const TermPos &pos);
|
||||
// point and text offset conversion
|
||||
inline int32 _LineAt(float y);
|
||||
inline float _LineOffset(int32 index);
|
||||
inline TermPos _ConvertToTerminal(const BPoint& point);
|
||||
inline BPoint _ConvertFromTerminal(const TermPos& pos);
|
||||
|
||||
inline void _InvalidateTextRect(int32 x1, int32 y1, int32 x2, int32 y2);
|
||||
inline void _InvalidateTextRect(int32 x1, int32 y1, int32 x2,
|
||||
int32 y2);
|
||||
|
||||
status_t _InitObject(int32 argc, const char **argv);
|
||||
status_t _InitObject(int32 argc, const char** argv);
|
||||
|
||||
status_t _AttachShell(Shell *shell);
|
||||
void _DetachShell();
|
||||
status_t _AttachShell(Shell* shell);
|
||||
void _DetachShell();
|
||||
|
||||
void _AboutRequested();
|
||||
void _AboutRequested();
|
||||
|
||||
void _DrawLinePart(int32 x1, int32 y1, uint16 attr, char *buf,
|
||||
int32 width, bool mouse, bool cursor, BView *inView);
|
||||
void _DrawCursor();
|
||||
void _InvalidateTextRange(TermPos start, TermPos end);
|
||||
void _DrawLinePart(int32 x1, int32 y1, uint16 attr,
|
||||
char* buffer, int32 width, bool mouse,
|
||||
bool cursor, BView* inView);
|
||||
void _DrawCursor();
|
||||
void _InvalidateTextRange(TermPos start, TermPos end);
|
||||
|
||||
bool _IsCursorVisible() const;
|
||||
void _BlinkCursor();
|
||||
void _ActivateCursor(bool invalidate);
|
||||
bool _IsCursorVisible() const;
|
||||
void _BlinkCursor();
|
||||
void _ActivateCursor(bool invalidate);
|
||||
|
||||
void _DoPrint(BRect updateRect);
|
||||
void _UpdateScrollBarRange();
|
||||
void _DoFileDrop(entry_ref &ref);
|
||||
void _DoPrint(BRect updateRect);
|
||||
void _UpdateScrollBarRange();
|
||||
void _DoFileDrop(entry_ref &ref);
|
||||
|
||||
void _SynchronizeWithTextBuffer(int32 visibleDirtyTop,
|
||||
int32 visibleDirtyBottom);
|
||||
void _SynchronizeWithTextBuffer(int32 visibleDirtyTop,
|
||||
int32 visibleDirtyBottom);
|
||||
|
||||
void _WritePTY(const char* text, int32 numBytes);
|
||||
void _WritePTY(const char* text, int32 numBytes);
|
||||
|
||||
// Comunicate Input Method
|
||||
// void _DoIMStart (BMessage* message);
|
||||
// void _DoIMStop (BMessage* message);
|
||||
// void _DoIMChange (BMessage* message);
|
||||
// void _DoIMLocation (BMessage* message);
|
||||
// void _DoIMConfirm (void);
|
||||
// void _ConfirmString(const char *, int32);
|
||||
// Comunicate Input Method
|
||||
// void _DoIMStart (BMessage* message);
|
||||
// void _DoIMStop (BMessage* message);
|
||||
// void _DoIMChange (BMessage* message);
|
||||
// void _DoIMLocation (BMessage* message);
|
||||
// void _DoIMConfirm (void);
|
||||
// void _ConfirmString(const char *, int32);
|
||||
|
||||
// selection
|
||||
void _Select(TermPos start, TermPos end, bool inclusive,
|
||||
bool setInitialSelection);
|
||||
void _ExtendSelection(TermPos, bool inclusive, bool useInitialSelection);
|
||||
void _Deselect();
|
||||
bool _HasSelection() const;
|
||||
void _SelectWord(BPoint where, bool extend, bool useInitialSelection);
|
||||
void _SelectLine(BPoint where, bool extend, bool useInitialSelection);
|
||||
// selection
|
||||
void _Select(TermPos start, TermPos end, bool inclusive,
|
||||
bool setInitialSelection);
|
||||
void _ExtendSelection(TermPos, bool inclusive,
|
||||
bool useInitialSelection);
|
||||
void _Deselect();
|
||||
bool _HasSelection() const;
|
||||
void _SelectWord(BPoint where, bool extend,
|
||||
bool useInitialSelection);
|
||||
void _SelectLine(BPoint where, bool extend,
|
||||
bool useInitialSelection);
|
||||
|
||||
void _AutoScrollUpdate();
|
||||
void _AutoScrollUpdate();
|
||||
|
||||
bool _CheckSelectedRegion(const TermPos &pos) const;
|
||||
bool _CheckSelectedRegion(int32 row, int32 firstColumn,
|
||||
int32& lastColumn) const;
|
||||
bool _CheckSelectedRegion(const TermPos& pos) const;
|
||||
bool _CheckSelectedRegion(int32 row, int32 firstColumn,
|
||||
int32& lastColumn) const;
|
||||
|
||||
void _UpdateSIGWINCH();
|
||||
void _UpdateSIGWINCH();
|
||||
|
||||
void _ScrollTo(float y, bool scrollGfx);
|
||||
void _ScrollToRange(TermPos start, TermPos end);
|
||||
void _ScrollTo(float y, bool scrollGfx);
|
||||
void _ScrollToRange(TermPos start, TermPos end);
|
||||
|
||||
private:
|
||||
class CharClassifier;
|
||||
|
||||
Shell *fShell;
|
||||
Shell* fShell;
|
||||
|
||||
BMessageRunner *fWinchRunner;
|
||||
BMessageRunner *fCursorBlinkRunner;
|
||||
BMessageRunner *fAutoScrollRunner;
|
||||
BMessageRunner *fResizeRunner;
|
||||
BStringView *fResizeView;
|
||||
CharClassifier *fCharClassifier;
|
||||
BMessageRunner* fWinchRunner;
|
||||
BMessageRunner* fCursorBlinkRunner;
|
||||
BMessageRunner* fAutoScrollRunner;
|
||||
BMessageRunner* fResizeRunner;
|
||||
BStringView* fResizeView;
|
||||
CharClassifier* fCharClassifier;
|
||||
|
||||
// Font and Width
|
||||
BFont fHalfFont;
|
||||
int fFontWidth;
|
||||
int fFontHeight;
|
||||
int fFontAscent;
|
||||
struct escapement_delta fEscapement;
|
||||
// Font and Width
|
||||
BFont fHalfFont;
|
||||
int fFontWidth;
|
||||
int fFontHeight;
|
||||
int fFontAscent;
|
||||
struct escapement_delta fEscapement;
|
||||
|
||||
// frame resized flag.
|
||||
bool fFrameResized;
|
||||
// frame resized flag.
|
||||
bool fFrameResized;
|
||||
|
||||
// Cursor Blinking, draw flag.
|
||||
bigtime_t fLastActivityTime;
|
||||
int32 fCursorState;
|
||||
int fCursorHeight;
|
||||
// Cursor Blinking, draw flag.
|
||||
bigtime_t fLastActivityTime;
|
||||
int32 fCursorState;
|
||||
int fCursorHeight;
|
||||
|
||||
// Cursor position.
|
||||
TermPos fCursor;
|
||||
// Cursor position.
|
||||
TermPos fCursor;
|
||||
|
||||
int32 fMouseButtons;
|
||||
int32 fMouseButtons;
|
||||
|
||||
// Terminal rows and columns.
|
||||
int fTermRows;
|
||||
int fTermColumns;
|
||||
// Terminal rows and columns.
|
||||
int fTermRows;
|
||||
int fTermColumns;
|
||||
|
||||
int fEncoding;
|
||||
int fEncoding;
|
||||
|
||||
// Object pointer.
|
||||
TerminalBuffer *fTextBuffer;
|
||||
BasicTerminalBuffer *fVisibleTextBuffer;
|
||||
BScrollBar *fScrollBar;
|
||||
// Object pointer.
|
||||
TerminalBuffer* fTextBuffer;
|
||||
BasicTerminalBuffer* fVisibleTextBuffer;
|
||||
BScrollBar* fScrollBar;
|
||||
|
||||
// Color and Attribute.
|
||||
rgb_color fTextForeColor, fTextBackColor;
|
||||
rgb_color fCursorForeColor, fCursorBackColor;
|
||||
rgb_color fSelectForeColor, fSelectBackColor;
|
||||
// Color and Attribute.
|
||||
rgb_color fTextForeColor;
|
||||
rgb_color fTextBackColor;
|
||||
rgb_color fCursorForeColor;
|
||||
rgb_color fCursorBackColor;
|
||||
rgb_color fSelectForeColor;
|
||||
rgb_color fSelectBackColor;
|
||||
|
||||
// Scroll Region
|
||||
float fScrollOffset;
|
||||
int32 fScrBufSize;
|
||||
// TODO: That's the history capacity -- only needed until the text
|
||||
// buffer is created.
|
||||
float fAutoScrollSpeed;
|
||||
// Scroll Region
|
||||
float fScrollOffset;
|
||||
int32 fScrBufSize;
|
||||
// TODO: That's the history capacity -- only needed
|
||||
// until the text buffer is created.
|
||||
float fAutoScrollSpeed;
|
||||
|
||||
// redraw management
|
||||
bigtime_t fLastSyncTime;
|
||||
int32 fScrolledSinceLastSync;
|
||||
BMessageRunner* fSyncRunner;
|
||||
bool fConsiderClockedSync;
|
||||
// redraw management
|
||||
bigtime_t fLastSyncTime;
|
||||
int32 fScrolledSinceLastSync;
|
||||
BMessageRunner* fSyncRunner;
|
||||
bool fConsiderClockedSync;
|
||||
|
||||
// selection
|
||||
TermPos fSelStart;
|
||||
TermPos fSelEnd;
|
||||
TermPos fInitialSelectionStart;
|
||||
TermPos fInitialSelectionEnd;
|
||||
bool fMouseTracking;
|
||||
int fSelectGranularity;
|
||||
// selection
|
||||
TermPos fSelStart;
|
||||
TermPos fSelEnd;
|
||||
TermPos fInitialSelectionStart;
|
||||
TermPos fInitialSelectionEnd;
|
||||
bool fMouseTracking;
|
||||
int fSelectGranularity;
|
||||
|
||||
// Input Method parameter.
|
||||
int fIMViewPtr;
|
||||
TermPos fIMStartPos;
|
||||
TermPos fIMEndPos;
|
||||
BString fIMString;
|
||||
bool fIMflag;
|
||||
BMessenger fIMMessenger;
|
||||
int32 fImCodeState;
|
||||
// Input Method parameter.
|
||||
int fIMViewPtr;
|
||||
TermPos fIMStartPos;
|
||||
TermPos fIMEndPos;
|
||||
BString fIMString;
|
||||
bool fIMflag;
|
||||
BMessenger fIMMessenger;
|
||||
int32 fImCodeState;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user