* Removed "move" parameter from the

TermView::Listener::{Previous,Next}TermView() methods. All B_COMMAND_KEY
  combos are intercepted by the window, so we never get them in the view.
* Added window shortcut Command-Shift-Left/Right to move the tabs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39490 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-11-19 01:08:21 +00:00
parent 52474b49a3
commit 38d5ce6271
5 changed files with 38 additions and 22 deletions
+2
View File
@@ -91,6 +91,8 @@ static const uint32 MSG_SET_TERMNAL_TITLE = 'sett';
static const uint32 MSG_QUIT_TERMNAL = 'qutt';
static const uint32 MSG_REPORT_MOUSE_EVENT = 'mous';
static const uint32 MSG_SAVE_WINDOW_POSITION = 'swps';
static const uint32 MSG_MOVE_TAB_LEFT = 'mvtl';
static const uint32 MSG_MOVE_TAB_RIGHT = 'mvtr';
// Preference Read/Write Keys
static const char* const PREF_HALF_FONT_FAMILY = "Half Font Family";
+6 -10
View File
@@ -1589,10 +1589,8 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
case B_LEFT_ARROW:
if (rawChar == B_LEFT_ARROW) {
if ((mod & B_SHIFT_KEY) != 0) {
if (fListener != NULL) {
fListener->PreviousTermView(this,
(mod & B_COMMAND_KEY) != 0);
}
if (fListener != NULL)
fListener->PreviousTermView(this);
return;
}
if ((mod & B_CONTROL_KEY) || (mod & B_COMMAND_KEY))
@@ -1605,10 +1603,8 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
case B_RIGHT_ARROW:
if (rawChar == B_RIGHT_ARROW) {
if ((mod & B_SHIFT_KEY) != 0) {
if (fListener != NULL) {
fListener->NextTermView(this,
(mod & B_COMMAND_KEY) != 0);
}
if (fListener != NULL)
fListener->NextTermView(this);
return;
}
if ((mod & B_CONTROL_KEY) || (mod & B_COMMAND_KEY))
@@ -3310,12 +3306,12 @@ TermView::Listener::SetTermViewTitle(TermView* view, const char* title)
void
TermView::Listener::PreviousTermView(TermView* view, bool move)
TermView::Listener::PreviousTermView(TermView* view)
{
}
void
TermView::Listener::NextTermView(TermView* view, bool move)
TermView::Listener::NextTermView(TermView* view)
{
}
+2 -2
View File
@@ -296,8 +296,8 @@ public:
int32 reason);
virtual void SetTermViewTitle(TermView* view,
const char* title);
virtual void PreviousTermView(TermView* view, bool move);
virtual void NextTermView(TermView* view, bool move);
virtual void PreviousTermView(TermView* view);
virtual void NextTermView(TermView* view);
};
+26 -8
View File
@@ -220,6 +220,11 @@ TermWindow::_InitWindow()
AddShortcut('1' + i, B_COMMAND_KEY, message);
}
AddShortcut(B_LEFT_ARROW, B_COMMAND_KEY | B_SHIFT_KEY,
new BMessage(MSG_MOVE_TAB_LEFT));
AddShortcut(B_RIGHT_ARROW, B_COMMAND_KEY | B_SHIFT_KEY,
new BMessage(MSG_MOVE_TAB_RIGHT));
BRect textFrame = Bounds();
textFrame.top = fMenubar->Bounds().bottom + 1.0;
@@ -677,6 +682,12 @@ TermWindow::MessageReceived(BMessage *message)
_CheckChildren();
break;
case MSG_MOVE_TAB_LEFT:
case MSG_MOVE_TAB_RIGHT:
_NavigateTab(_IndexOfTermView(_ActiveTermView()),
message->what == MSG_MOVE_TAB_LEFT ? -1 : 1, true);
break;
case kSetActiveTab:
{
int32 index;
@@ -957,12 +968,19 @@ TermWindow::_NavigateTab(int32 index, int32 direction, bool move)
if (count <= 1 || index < 0 || index >= count)
return;
int32 newIndex = (index + direction + count) % count;
if (newIndex == index)
return;
if (move) {
// TODO: Move the tab!
} else {
index += direction;
fTabView->Select((index + count) % count);
// move the given tab to the new index
Session* session = (Session*)fSessions.RemoveItem(index);
fSessions.AddItem(session, newIndex);
fTabView->MoveTab(index, newIndex);
}
// activate the respective tab
fTabView->Select(newIndex);
}
@@ -1122,16 +1140,16 @@ TermWindow::SetTermViewTitle(TermView* view, const char* title)
void
TermWindow::PreviousTermView(TermView* view, bool move)
TermWindow::PreviousTermView(TermView* view)
{
_NavigateTab(_IndexOfTermView(view), -1, move);
_NavigateTab(_IndexOfTermView(view), -1, false);
}
void
TermWindow::NextTermView(TermView* view, bool move)
TermWindow::NextTermView(TermView* view)
{
_NavigateTab(_IndexOfTermView(view), 1, move);
_NavigateTab(_IndexOfTermView(view), 1, false);
}
+2 -2
View File
@@ -82,8 +82,8 @@ private:
int32 reason);
virtual void SetTermViewTitle(TermView* view,
const char* title);
virtual void PreviousTermView(TermView* view, bool move);
virtual void NextTermView(TermView* view, bool move);
virtual void PreviousTermView(TermView* view);
virtual void NextTermView(TermView* view);
private:
struct Title {