Creating a new tab made the app crash since r21979. Use "Terminal" as

tab label instead of "scrollView". Setting Terminal to fullscreen also 
resizes and moves the TermView a bit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21981 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2007-08-16 14:17:19 +00:00
parent b438035431
commit 0f8ae3ead7
2 changed files with 22 additions and 8 deletions

View File

@ -282,16 +282,21 @@ TermView::TermView(BMessage *archive)
if (archive->FindInt32("rows", (int32 *)&fTermRows) < B_OK)
fTermRows = 25;
const char *argv[] = { "/bin/sh", "--login" };
// TODO: Retrieve arguments, colors, history size, etc. from archive
_InitObject(2, argv);
_InitObject(0, NULL);
}
status_t
TermView::_InitObject(int32 argc, const char **argv)
{
const char *defaultArgv[] = { "/bin/sh", "--login" };
if (argc == 0 || argv == NULL) {
argc = 2;
argv = defaultArgv;
}
SetTermFont(be_fixed_font, be_fixed_font);
fTextBuffer = new (std::nothrow) TermBuffer(fTermRows, fTermColumns, fScrBufSize);

View File

@ -418,7 +418,8 @@ TermWindow::MessageReceived(BMessage *message)
BScreen screen(this);
_ActiveTermView()->ScrollBar()->Hide();
fMenubar->Hide();
_ActiveTermView()->ResizeBy(B_V_SCROLL_BAR_WIDTH, mbHeight);
fTabView->ResizeBy(0, mbHeight);
fTabView->MoveBy(0, -mbHeight);
fSavedLook = Look();
// done before ResizeTo to work around a Dano bug (not erasing the decor)
SetLook(B_NO_BORDER_WINDOW_LOOK);
@ -430,7 +431,8 @@ TermWindow::MessageReceived(BMessage *message)
_ActiveTermView()->ScrollBar()->Show();
ResizeTo(fSavedFrame.Width(), fSavedFrame.Height());
MoveTo(fSavedFrame.left, fSavedFrame.top);
_ActiveTermView()->ResizeBy(-B_V_SCROLL_BAR_WIDTH, -mbHeight);
fTabView->ResizeBy(0, -mbHeight);
fTabView->MoveBy(0, mbHeight);
SetLook(fSavedLook);
fSavedFrame = BRect(0,0,-1,-1);
}
@ -585,9 +587,10 @@ TermWindow::_AddTab(Arguments *args)
fullFont.SetSpacing(B_FIXED_SPACING);
// Make Terminal text view.
int argc;
int argc = 0;
const char *const *argv = NULL;
args->GetShellArguments(argc, argv);
if (args != NULL)
args->GetShellArguments(argc, argv);
// Note: I don't pass the Arguments class directly to the termview,
// only to avoid adding it as a dependency: in other words, to keep
@ -598,7 +601,13 @@ TermWindow::_AddTab(Arguments *args)
BScrollView *scrollView = new BScrollView("scrollView", view, B_FOLLOW_ALL,
B_WILL_DRAW|B_FRAME_EVENTS, false, true);
fTabView->AddTab(scrollView);
BTab *tab = new BTab;
// TODO: Use a better name. For example, do like MacOsX's Terminal
// and update the title using the last executed command ?
// Or like Gnome's Terminal and use the current path ?
fTabView->AddTab(scrollView, tab);
tab->SetLabel("Terminal");
view->SetScrollBar(scrollView->ScrollBar(B_VERTICAL));
// TODO: Resize the vertical scrollbar to take the window gripping handle into account