* 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) {
|
if (CountTabs() > 1) {
|
||||||
int32 tabIndex = _ClickedTabIndex(point);
|
int32 tabIndex = _ClickedTabIndex(point);
|
||||||
if (tabIndex >= 0) {
|
int32 buttons = 0;
|
||||||
int32 buttons = 0;
|
int32 clickCount = 0;
|
||||||
int32 clickCount = 0;
|
Window()->CurrentMessage()->FindInt32("buttons", &buttons);
|
||||||
Window()->CurrentMessage()->FindInt32("buttons", &buttons);
|
Window()->CurrentMessage()->FindInt32("clicks", &clickCount);
|
||||||
Window()->CurrentMessage()->FindInt32("clicks", &clickCount);
|
|
||||||
|
|
||||||
if ((buttons & B_PRIMARY_MOUSE_BUTTON) != 0 && clickCount == 2) {
|
if ((buttons & B_PRIMARY_MOUSE_BUTTON) != 0 && clickCount == 2) {
|
||||||
if (fListener != NULL)
|
if (fListener != NULL)
|
||||||
fListener->TabDoubleClicked(this, point, tabIndex);
|
fListener->TabDoubleClicked(this, point, tabIndex);
|
||||||
} else if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) {
|
} else if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) {
|
||||||
if (fListener != NULL)
|
if (fListener != NULL)
|
||||||
fListener->TabRightClicked(this, point, tabIndex);
|
fListener->TabRightClicked(this, point, tabIndex);
|
||||||
handled = true;
|
handled = true;
|
||||||
} else if ((buttons & B_TERTIARY_MOUSE_BUTTON) != 0) {
|
} else if ((buttons & B_TERTIARY_MOUSE_BUTTON) != 0) {
|
||||||
if (fListener != NULL)
|
if (fListener != NULL)
|
||||||
fListener->TabMiddleClicked(this, point, tabIndex);
|
fListener->TabMiddleClicked(this, point, tabIndex);
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,16 +688,7 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case kNewTab:
|
case kNewTab:
|
||||||
if (fTabView->CountTabs() < kMaxTabs) {
|
_NewTab();
|
||||||
if (fFullScreen)
|
|
||||||
_ActiveTermView()->ScrollBar()->Show();
|
|
||||||
|
|
||||||
ActiveProcessInfo info;
|
|
||||||
if (_ActiveTermView()->GetActiveProcessInfo(info))
|
|
||||||
_AddTab(NULL, info.CurrentDirectory());
|
|
||||||
else
|
|
||||||
_AddTab(NULL);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kCloseView:
|
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
|
void
|
||||||
TermWindow::_AddTab(Arguments* args, const BString& currentDirectory)
|
TermWindow::_AddTab(Arguments* args, const BString& currentDirectory)
|
||||||
{
|
{
|
||||||
@ -1029,20 +1036,29 @@ TermWindow::TabSelected(SmartTabView* tabView, int32 index)
|
|||||||
void
|
void
|
||||||
TermWindow::TabDoubleClicked(SmartTabView* tabView, BPoint point, int32 index)
|
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
|
void
|
||||||
TermWindow::TabMiddleClicked(SmartTabView* tabView, BPoint point, int32 index)
|
TermWindow::TabMiddleClicked(SmartTabView* tabView, BPoint point, int32 index)
|
||||||
{
|
{
|
||||||
_RemoveTab(index);
|
if (index >= 0)
|
||||||
|
_RemoveTab(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TermWindow::TabRightClicked(SmartTabView* tabView, BPoint point, int32 index)
|
TermWindow::TabRightClicked(SmartTabView* tabView, BPoint point, int32 index)
|
||||||
{
|
{
|
||||||
|
if (index < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
TermView* termView = _TermViewAt(index);
|
TermView* termView = _TermViewAt(index);
|
||||||
if (termView == NULL)
|
if (termView == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -96,6 +96,7 @@ private:
|
|||||||
void _GetPreferredFont(BFont &font);
|
void _GetPreferredFont(BFont &font);
|
||||||
status_t _DoPageSetup();
|
status_t _DoPageSetup();
|
||||||
void _DoPrint();
|
void _DoPrint();
|
||||||
|
void _NewTab();
|
||||||
void _AddTab(Arguments* args,
|
void _AddTab(Arguments* args,
|
||||||
const BString& currentDirectory
|
const BString& currentDirectory
|
||||||
= BString());
|
= BString());
|
||||||
|
Loading…
Reference in New Issue
Block a user