Added _SessionAt() helper method.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39498 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -200,7 +200,7 @@ TermWindow::~TermWindow()
|
|||||||
|
|
||||||
PrefHandler::DeleteDefault();
|
PrefHandler::DeleteDefault();
|
||||||
|
|
||||||
for (int32 i = 0; Session* session = (Session*)fSessions.ItemAt(i); i++)
|
for (int32 i = 0; Session* session = _SessionAt(i); i++)
|
||||||
delete session;
|
delete session;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -976,7 +976,7 @@ TermWindow::_RemoveTab(int32 index)
|
|||||||
if (Session* session = (Session*)fSessions.RemoveItem(index)) {
|
if (Session* session = (Session*)fSessions.RemoveItem(index)) {
|
||||||
if (fSessions.CountItems() == 1) {
|
if (fSessions.CountItems() == 1) {
|
||||||
fTabView->SetScrollView(dynamic_cast<BScrollView*>(
|
fTabView->SetScrollView(dynamic_cast<BScrollView*>(
|
||||||
((Session*)fSessions.ItemAt(0))->containerView->Parent()));
|
(_SessionAt(0))->containerView->Parent()));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete session;
|
delete session;
|
||||||
@@ -1022,7 +1022,7 @@ TermWindow::_ActiveTermViewContainerView() const
|
|||||||
TermViewContainerView*
|
TermViewContainerView*
|
||||||
TermWindow::_TermViewContainerViewAt(int32 index) const
|
TermWindow::_TermViewContainerViewAt(int32 index) const
|
||||||
{
|
{
|
||||||
if (Session* session = (Session*)fSessions.ItemAt(index))
|
if (Session* session = _SessionAt(index))
|
||||||
return session->containerView;
|
return session->containerView;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1060,10 +1060,17 @@ TermWindow::_IndexOfTermView(TermView* termView) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline TermWindow::Session*
|
||||||
|
TermWindow::_SessionAt(int32 index) const
|
||||||
|
{
|
||||||
|
return (Session*)fSessions.ItemAt(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TermWindow::Session*
|
TermWindow::Session*
|
||||||
TermWindow::_SessionForID(const SessionID& sessionID) const
|
TermWindow::_SessionForID(const SessionID& sessionID) const
|
||||||
{
|
{
|
||||||
for (int32 i = 0; Session* session = (Session*)fSessions.ItemAt(i); i++) {
|
for (int32 i = 0; Session* session = _SessionAt(i); i++) {
|
||||||
if (session->id == sessionID)
|
if (session->id == sessionID)
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
@@ -1077,7 +1084,7 @@ TermWindow::_CheckChildren()
|
|||||||
{
|
{
|
||||||
int32 count = fSessions.CountItems();
|
int32 count = fSessions.CountItems();
|
||||||
for (int32 i = count - 1; i >= 0; i--) {
|
for (int32 i = count - 1; i >= 0; i--) {
|
||||||
Session* session = (Session*)fSessions.ItemAt(i);
|
Session* session = _SessionAt(i);
|
||||||
if (session->containerView->GetTermView()->CheckShellGone())
|
if (session->containerView->GetTermView()->CheckShellGone())
|
||||||
NotifyTermViewQuit(session->containerView->GetTermView(), 0);
|
NotifyTermViewQuit(session->containerView->GetTermView(), 0);
|
||||||
}
|
}
|
||||||
@@ -1125,7 +1132,7 @@ TermWindow::TabDoubleClicked(SmartTabView* tabView, BPoint point, int32 index)
|
|||||||
B_TRANSLATE("Set tab title"), B_TRANSLATE("Tab title:"),
|
B_TRANSLATE("Set tab title"), B_TRANSLATE("Tab title:"),
|
||||||
toolTip);
|
toolTip);
|
||||||
|
|
||||||
Session* session = (Session*)fSessions.ItemAt(index);
|
Session* session = _SessionAt(index);
|
||||||
bool userDefined = session->title.patternUserDefined;
|
bool userDefined = session->title.patternUserDefined;
|
||||||
const BString& title = userDefined
|
const BString& title = userDefined
|
||||||
? session->title.pattern : fSessionTitlePattern;
|
? session->title.pattern : fSessionTitlePattern;
|
||||||
@@ -1196,7 +1203,7 @@ void
|
|||||||
TermWindow::SetTermViewTitle(TermView* view, const char* title)
|
TermWindow::SetTermViewTitle(TermView* view, const char* title)
|
||||||
{
|
{
|
||||||
int32 index = _IndexOfTermView(view);
|
int32 index = _IndexOfTermView(view);
|
||||||
if (Session* session = (Session*)fSessions.ItemAt(index)) {
|
if (Session* session = _SessionAt(index)) {
|
||||||
session->title.pattern = title;
|
session->title.pattern = title;
|
||||||
session->title.patternUserDefined = true;
|
session->title.patternUserDefined = true;
|
||||||
_UpdateSessionTitle(index);
|
_UpdateSessionTitle(index);
|
||||||
@@ -1334,7 +1341,7 @@ TermWindow::_UpdateTitles()
|
|||||||
void
|
void
|
||||||
TermWindow::_UpdateSessionTitle(int32 index)
|
TermWindow::_UpdateSessionTitle(int32 index)
|
||||||
{
|
{
|
||||||
Session* session = (Session*)fSessions.ItemAt(index);
|
Session* session = _SessionAt(index);
|
||||||
if (session == NULL)
|
if (session == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1406,7 +1413,7 @@ TermWindow::_NewSessionIndex()
|
|||||||
bool used = false;
|
bool used = false;
|
||||||
|
|
||||||
for (int32 i = 0;
|
for (int32 i = 0;
|
||||||
Session* session = (Session*)fSessions.ItemAt(i); i++) {
|
Session* session = _SessionAt(i); i++) {
|
||||||
if (id == session->index) {
|
if (id == session->index) {
|
||||||
used = true;
|
used = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ private:
|
|||||||
TermView* _ActiveTermView() const;
|
TermView* _ActiveTermView() const;
|
||||||
TermView* _TermViewAt(int32 index) const;
|
TermView* _TermViewAt(int32 index) const;
|
||||||
int32 _IndexOfTermView(TermView* termView) const;
|
int32 _IndexOfTermView(TermView* termView) const;
|
||||||
|
inline Session* _SessionAt(int32 index) const;
|
||||||
Session* _SessionForID(const SessionID& sessionID) const;
|
Session* _SessionForID(const SessionID& sessionID) const;
|
||||||
|
|
||||||
void _CheckChildren();
|
void _CheckChildren();
|
||||||
|
|||||||
Reference in New Issue
Block a user