Add the add_on field in TermView::Archive(). This way instantiating a

replicant works (thank you Marc). Return errno instead of the return 
value of read() (thank you Jerome).
Terminal now can be instantiated as a replicant, although input doesn't 
work :((.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21745 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2007-07-30 11:48:35 +00:00
parent 948b80756a
commit 2240e7df9b
3 changed files with 14 additions and 54 deletions

View File

@ -149,9 +149,8 @@ TermParse::PtyReader()
uchar buf[READ_BUF_SIZE];
int nread = read(fFd, buf, READ_BUF_SIZE - (read_p - fBufferPosition));
if (nread <= 0) {
// TODO: errno ? (Jerome ?) :)
fView->NotifyQuit(nread);
exit_thread(B_ERROR);
fView->NotifyQuit(errno);
exit_thread(errno);
}
// Copy read string to PtyBuffer.

View File

@ -206,7 +206,6 @@ TermView::TermView(BMessage *archive)
fQuitting(false),
fIMflag(false)
{
printf("TermView(BMessage *)\n");
if (archive->FindInt32("encoding", (int32 *)&fEncoding) < B_OK)
fEncoding = M_UTF8;
if (archive->FindInt32("columns", (int32 *)&fTermColumns) < B_OK)
@ -215,7 +214,7 @@ TermView::TermView(BMessage *archive)
fTermRows = 25;
// TODO: Retrieve command, colors, history size, etc. from archive
printf("_InitObject() returned %s\n", strerror(_InitObject(NULL)));
_InitObject(NULL);
}
@ -266,11 +265,9 @@ TermView::~TermView()
BArchivable *
TermView::Instantiate(BMessage* data)
{
printf("TermView::Instantiate()\n");
if (validate_instantiation(data, "TermView"))
return new (std::nothrow) TermView(data);
printf("Returned NULL\n");
return NULL;
}
@ -278,15 +275,16 @@ TermView::Instantiate(BMessage* data)
status_t
TermView::Archive(BMessage* data, bool deep) const
{
printf("TermView::Archive()\n");
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);
printf("Archive() returned %s\n", strerror(status));
return status;
}

View File

@ -50,51 +50,6 @@
const static float kViewOffset = 3;
#if 0
TermWindow::TermWindow(BRect frame, const char* title, const char *command)
:
BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE),
fTabView(NULL),
fTermView(NULL),
fMenubar(NULL),
fFilemenu(NULL),
fEditmenu(NULL),
fEncodingmenu(NULL),
fHelpmenu(NULL),
fFontMenu(NULL),
fWindowSizeMenu(NULL),
fNewFontMenu(NULL),
fPrintSettings(NULL),
fPrefWindow(NULL),
fFindPanel(NULL),
fSavedFrame(0, 0, -1, -1),
fFindString(""),
fFindForwardMenuItem(NULL),
fFindBackwardMenuItem(NULL),
fFindSelection(false),
fForwardSearch(false),
fMatchCase(false),
fMatchWord(false)
{
fTabView = new SmartTabView(Bounds(), "Tab view");
AddChild(fTabView);
_NewTab(command);
_NewTab(NULL);
fTabView->Select(0);
/*
BView *view = new TermView(Bounds());
AddChild(view);
BRect _WritePTYdraggerFrame(0, 0, 16, 16);
draggerFrame.OffsetTo(Bounds().RightBottom() - BPoint(16, 16));
BDragger *dragger = new BDragger(draggerFrame, view, B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM, B_WILL_DRAW);
view->AddChild(dragger);*/
}
#endif
TermWindow::TermWindow(BRect frame, const char* title, const char *command)
: BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE),
fTabView(NULL),
@ -120,6 +75,14 @@ TermWindow::TermWindow(BRect frame, const char* title, const char *command)
fMatchWord(false)
{
_InitWindow(command);
/*BView *view = new TermView(Bounds());
AddChild(view);
BRect draggerFrame(0, 0, 16, 16);
draggerFrame.OffsetTo(Bounds().RightBottom() - BPoint(16, 16));
BDragger *dragger = new BDragger(draggerFrame, view, B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM, B_WILL_DRAW);
view->AddChild(dragger);*/
}