Reenabled setting the window title. Changed things a bit, though: Each
session (tab) has it's own window title. Switching between them changes the window title, too. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25987 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -90,6 +90,7 @@ private:
|
|||||||
struct TermWindow::Session {
|
struct TermWindow::Session {
|
||||||
int32 id;
|
int32 id;
|
||||||
BString name;
|
BString name;
|
||||||
|
BString windowTitle;
|
||||||
TermViewContainerView* containerView;
|
TermViewContainerView* containerView;
|
||||||
|
|
||||||
Session(int32 id, TermViewContainerView* containerView)
|
Session(int32 id, TermViewContainerView* containerView)
|
||||||
@@ -112,6 +113,12 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void Select(int32 tab)
|
||||||
|
{
|
||||||
|
SmartTabView::Select(tab);
|
||||||
|
fWindow->SessionChanged();
|
||||||
|
}
|
||||||
|
|
||||||
virtual void RemoveAndDeleteTab(int32 index)
|
virtual void RemoveAndDeleteTab(int32 index)
|
||||||
{
|
{
|
||||||
fWindow->_RemoveTab(index);
|
fWindow->_RemoveTab(index);
|
||||||
@@ -123,7 +130,10 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
TermWindow::TermWindow(BRect frame, const char* title, Arguments *args)
|
TermWindow::TermWindow(BRect frame, const char* title, Arguments *args)
|
||||||
: BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE),
|
:
|
||||||
|
BWindow(frame, title, B_DOCUMENT_WINDOW,
|
||||||
|
B_CURRENT_WORKSPACE | B_QUIT_ON_WINDOW_CLOSE),
|
||||||
|
fInitialTitle(title),
|
||||||
fTabView(NULL),
|
fTabView(NULL),
|
||||||
fMenubar(NULL),
|
fMenubar(NULL),
|
||||||
fFilemenu(NULL),
|
fFilemenu(NULL),
|
||||||
@@ -165,6 +175,29 @@ TermWindow::~TermWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TermWindow::SetSessionWindowTitle(TermView* termView, const char* title)
|
||||||
|
{
|
||||||
|
int32 index = _IndexOfTermView(termView);
|
||||||
|
if (Session* session = (Session*)fSessions.ItemAt(index)) {
|
||||||
|
session->windowTitle = title;
|
||||||
|
BTab* tab = fTabView->TabAt(index);
|
||||||
|
tab->SetLabel(session->windowTitle.String());
|
||||||
|
if (index == fTabView->Selection())
|
||||||
|
SetTitle(session->windowTitle.String());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TermWindow::SessionChanged()
|
||||||
|
{
|
||||||
|
int32 index = fTabView->Selection();
|
||||||
|
if (Session* session = (Session*)fSessions.ItemAt(index))
|
||||||
|
SetTitle(session->windowTitle.String());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TermWindow::_InitWindow()
|
TermWindow::_InitWindow()
|
||||||
{
|
{
|
||||||
@@ -664,6 +697,7 @@ TermWindow::_AddTab(Arguments *args)
|
|||||||
containerView, view);
|
containerView, view);
|
||||||
|
|
||||||
Session* session = new Session(_NewSessionID(), containerView);
|
Session* session = new Session(_NewSessionID(), containerView);
|
||||||
|
session->windowTitle = fInitialTitle;
|
||||||
fSessions.AddItem(session);
|
fSessions.AddItem(session);
|
||||||
|
|
||||||
BTab *tab = new BTab;
|
BTab *tab = new BTab;
|
||||||
@@ -898,6 +932,6 @@ CustomTermView::NotifyQuit(int32 reason)
|
|||||||
void
|
void
|
||||||
CustomTermView::SetTitle(const char *title)
|
CustomTermView::SetTitle(const char *title)
|
||||||
{
|
{
|
||||||
//Window()->SetTitle(title);
|
dynamic_cast<TermWindow*>(Window())->SetSessionWindowTitle(this, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ public:
|
|||||||
TermWindow(BRect frame, const char* title, Arguments *args);
|
TermWindow(BRect frame, const char* title, Arguments *args);
|
||||||
virtual ~TermWindow();
|
virtual ~TermWindow();
|
||||||
|
|
||||||
|
void SetSessionWindowTitle(TermView* termView,
|
||||||
|
const char* title);
|
||||||
|
void SessionChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
virtual void WindowActivated(bool);
|
virtual void WindowActivated(bool);
|
||||||
@@ -79,6 +83,7 @@ private:
|
|||||||
void _BuildWindowSizeMenu(BMenu *menu);
|
void _BuildWindowSizeMenu(BMenu *menu);
|
||||||
int32 _NewSessionID();
|
int32 _NewSessionID();
|
||||||
|
|
||||||
|
BString fInitialTitle;
|
||||||
BList fSessions;
|
BList fSessions;
|
||||||
|
|
||||||
TabView *fTabView;
|
TabView *fTabView;
|
||||||
|
|||||||
Reference in New Issue
Block a user