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:
@@ -282,16 +282,21 @@ TermView::TermView(BMessage *archive)
|
|||||||
if (archive->FindInt32("rows", (int32 *)&fTermRows) < B_OK)
|
if (archive->FindInt32("rows", (int32 *)&fTermRows) < B_OK)
|
||||||
fTermRows = 25;
|
fTermRows = 25;
|
||||||
|
|
||||||
const char *argv[] = { "/bin/sh", "--login" };
|
|
||||||
|
|
||||||
// TODO: Retrieve arguments, colors, history size, etc. from archive
|
// TODO: Retrieve arguments, colors, history size, etc. from archive
|
||||||
_InitObject(2, argv);
|
_InitObject(0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
TermView::_InitObject(int32 argc, const char **argv)
|
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);
|
SetTermFont(be_fixed_font, be_fixed_font);
|
||||||
|
|
||||||
fTextBuffer = new (std::nothrow) TermBuffer(fTermRows, fTermColumns, fScrBufSize);
|
fTextBuffer = new (std::nothrow) TermBuffer(fTermRows, fTermColumns, fScrBufSize);
|
||||||
|
|||||||
@@ -418,7 +418,8 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
BScreen screen(this);
|
BScreen screen(this);
|
||||||
_ActiveTermView()->ScrollBar()->Hide();
|
_ActiveTermView()->ScrollBar()->Hide();
|
||||||
fMenubar->Hide();
|
fMenubar->Hide();
|
||||||
_ActiveTermView()->ResizeBy(B_V_SCROLL_BAR_WIDTH, mbHeight);
|
fTabView->ResizeBy(0, mbHeight);
|
||||||
|
fTabView->MoveBy(0, -mbHeight);
|
||||||
fSavedLook = Look();
|
fSavedLook = Look();
|
||||||
// done before ResizeTo to work around a Dano bug (not erasing the decor)
|
// done before ResizeTo to work around a Dano bug (not erasing the decor)
|
||||||
SetLook(B_NO_BORDER_WINDOW_LOOK);
|
SetLook(B_NO_BORDER_WINDOW_LOOK);
|
||||||
@@ -430,7 +431,8 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
_ActiveTermView()->ScrollBar()->Show();
|
_ActiveTermView()->ScrollBar()->Show();
|
||||||
ResizeTo(fSavedFrame.Width(), fSavedFrame.Height());
|
ResizeTo(fSavedFrame.Width(), fSavedFrame.Height());
|
||||||
MoveTo(fSavedFrame.left, fSavedFrame.top);
|
MoveTo(fSavedFrame.left, fSavedFrame.top);
|
||||||
_ActiveTermView()->ResizeBy(-B_V_SCROLL_BAR_WIDTH, -mbHeight);
|
fTabView->ResizeBy(0, -mbHeight);
|
||||||
|
fTabView->MoveBy(0, mbHeight);
|
||||||
SetLook(fSavedLook);
|
SetLook(fSavedLook);
|
||||||
fSavedFrame = BRect(0,0,-1,-1);
|
fSavedFrame = BRect(0,0,-1,-1);
|
||||||
}
|
}
|
||||||
@@ -585,8 +587,9 @@ TermWindow::_AddTab(Arguments *args)
|
|||||||
fullFont.SetSpacing(B_FIXED_SPACING);
|
fullFont.SetSpacing(B_FIXED_SPACING);
|
||||||
|
|
||||||
// Make Terminal text view.
|
// Make Terminal text view.
|
||||||
int argc;
|
int argc = 0;
|
||||||
const char *const *argv = NULL;
|
const char *const *argv = NULL;
|
||||||
|
if (args != NULL)
|
||||||
args->GetShellArguments(argc, argv);
|
args->GetShellArguments(argc, argv);
|
||||||
|
|
||||||
// Note: I don't pass the Arguments class directly to the termview,
|
// Note: I don't pass the Arguments class directly to the termview,
|
||||||
@@ -598,7 +601,13 @@ TermWindow::_AddTab(Arguments *args)
|
|||||||
|
|
||||||
BScrollView *scrollView = new BScrollView("scrollView", view, B_FOLLOW_ALL,
|
BScrollView *scrollView = new BScrollView("scrollView", view, B_FOLLOW_ALL,
|
||||||
B_WILL_DRAW|B_FRAME_EVENTS, false, true);
|
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));
|
view->SetScrollBar(scrollView->ScrollBar(B_VERTICAL));
|
||||||
|
|
||||||
// TODO: Resize the vertical scrollbar to take the window gripping handle into account
|
// TODO: Resize the vertical scrollbar to take the window gripping handle into account
|
||||||
|
|||||||
Reference in New Issue
Block a user