* SmartTabView::MouseDown(): Also notify the listener when the click didn't hit
a tab. * TermWindow: Add a new tab on double-click in the tab view's tab-free area. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39481 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d365030ea5
commit
b28dba722e
@ -70,24 +70,22 @@ SmartTabView::MouseDown(BPoint point)
|
||||
|
||||
if (CountTabs() > 1) {
|
||||
int32 tabIndex = _ClickedTabIndex(point);
|
||||
if (tabIndex >= 0) {
|
||||
int32 buttons = 0;
|
||||
int32 clickCount = 0;
|
||||
Window()->CurrentMessage()->FindInt32("buttons", &buttons);
|
||||
Window()->CurrentMessage()->FindInt32("clicks", &clickCount);
|
||||
int32 buttons = 0;
|
||||
int32 clickCount = 0;
|
||||
Window()->CurrentMessage()->FindInt32("buttons", &buttons);
|
||||
Window()->CurrentMessage()->FindInt32("clicks", &clickCount);
|
||||
|
||||
if ((buttons & B_PRIMARY_MOUSE_BUTTON) != 0 && clickCount == 2) {
|
||||
if (fListener != NULL)
|
||||
fListener->TabDoubleClicked(this, point, tabIndex);
|
||||
} else if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) {
|
||||
if (fListener != NULL)
|
||||
fListener->TabRightClicked(this, point, tabIndex);
|
||||
handled = true;
|
||||
} else if ((buttons & B_TERTIARY_MOUSE_BUTTON) != 0) {
|
||||
if (fListener != NULL)
|
||||
fListener->TabMiddleClicked(this, point, tabIndex);
|
||||
handled = true;
|
||||
}
|
||||
if ((buttons & B_PRIMARY_MOUSE_BUTTON) != 0 && clickCount == 2) {
|
||||
if (fListener != NULL)
|
||||
fListener->TabDoubleClicked(this, point, tabIndex);
|
||||
} else if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) {
|
||||
if (fListener != NULL)
|
||||
fListener->TabRightClicked(this, point, tabIndex);
|
||||
handled = true;
|
||||
} else if ((buttons & B_TERTIARY_MOUSE_BUTTON) != 0) {
|
||||
if (fListener != NULL)
|
||||
fListener->TabMiddleClicked(this, point, tabIndex);
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -688,16 +688,7 @@ TermWindow::MessageReceived(BMessage *message)
|
||||
}
|
||||
|
||||
case kNewTab:
|
||||
if (fTabView->CountTabs() < kMaxTabs) {
|
||||
if (fFullScreen)
|
||||
_ActiveTermView()->ScrollBar()->Show();
|
||||
|
||||
ActiveProcessInfo info;
|
||||
if (_ActiveTermView()->GetActiveProcessInfo(info))
|
||||
_AddTab(NULL, info.CurrentDirectory());
|
||||
else
|
||||
_AddTab(NULL);
|
||||
}
|
||||
_NewTab();
|
||||
break;
|
||||
|
||||
case kCloseView:
|
||||
@ -837,6 +828,22 @@ TermWindow::_DoPrint()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermWindow::_NewTab()
|
||||
{
|
||||
if (fTabView->CountTabs() < kMaxTabs) {
|
||||
if (fFullScreen)
|
||||
_ActiveTermView()->ScrollBar()->Show();
|
||||
|
||||
ActiveProcessInfo info;
|
||||
if (_ActiveTermView()->GetActiveProcessInfo(info))
|
||||
_AddTab(NULL, info.CurrentDirectory());
|
||||
else
|
||||
_AddTab(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermWindow::_AddTab(Arguments* args, const BString& currentDirectory)
|
||||
{
|
||||
@ -1029,20 +1036,29 @@ TermWindow::TabSelected(SmartTabView* tabView, int32 index)
|
||||
void
|
||||
TermWindow::TabDoubleClicked(SmartTabView* tabView, BPoint point, int32 index)
|
||||
{
|
||||
// TODO:...
|
||||
if (index >= 0) {
|
||||
// TODO: Open the change title dialog!
|
||||
} else {
|
||||
// not clicked on a tab -- create a new one
|
||||
_NewTab();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermWindow::TabMiddleClicked(SmartTabView* tabView, BPoint point, int32 index)
|
||||
{
|
||||
_RemoveTab(index);
|
||||
if (index >= 0)
|
||||
_RemoveTab(index);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermWindow::TabRightClicked(SmartTabView* tabView, BPoint point, int32 index)
|
||||
{
|
||||
if (index < 0)
|
||||
return;
|
||||
|
||||
TermView* termView = _TermViewAt(index);
|
||||
if (termView == NULL)
|
||||
return;
|
||||
|
@ -96,6 +96,7 @@ private:
|
||||
void _GetPreferredFont(BFont &font);
|
||||
status_t _DoPageSetup();
|
||||
void _DoPrint();
|
||||
void _NewTab();
|
||||
void _AddTab(Arguments* args,
|
||||
const BString& currentDirectory
|
||||
= BString());
|
||||
|
Loading…
Reference in New Issue
Block a user