git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37755 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2010-07-26 12:33:52 +00:00
parent 6491fb598a
commit ed47eeec78
+29 -29
View File
@@ -135,7 +135,7 @@ 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, BWindow(frame, title, B_DOCUMENT_WINDOW,
B_CURRENT_WORKSPACE | B_QUIT_ON_WINDOW_CLOSE), B_CURRENT_WORKSPACE | B_QUIT_ON_WINDOW_CLOSE),
@@ -247,9 +247,9 @@ TermWindow::QuitRequested()
} }
if (isBusy) { if (isBusy) {
const char *alertMessage = B_TRANSLATE("A process is still running.\n" const char* alertMessage = B_TRANSLATE("A process is still running.\n"
"If you close the Terminal the process will be killed."); "If you close the Terminal the process will be killed.");
BAlert *alert = new BAlert(B_TRANSLATE("Really quit?"), BAlert* alert = new BAlert(B_TRANSLATE("Really quit?"),
alertMessage, B_TRANSLATE("OK"), B_TRANSLATE("Cancel"), NULL, alertMessage, B_TRANSLATE("OK"), B_TRANSLATE("Cancel"), NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT); B_WIDTH_AS_USUAL, B_WARNING_ALERT);
int32 result = alert->Go(); int32 result = alert->Go();
@@ -264,10 +264,10 @@ TermWindow::QuitRequested()
void void
TermWindow::MenusBeginning() TermWindow::MenusBeginning()
{ {
TermView *view = _ActiveTermView(); TermView* view = _ActiveTermView();
// Syncronize Encode Menu Pop-up menu and Preference. // Syncronize Encode Menu Pop-up menu and Preference.
BMenuItem *item = fEncodingmenu->FindItem( BMenuItem* item = fEncodingmenu->FindItem(
EncodingAsString(view->Encoding())); EncodingAsString(view->Encoding()));
if (item != NULL) if (item != NULL)
item->SetMarked(true); item->SetMarked(true);
@@ -285,10 +285,10 @@ TermWindow::MenusBeginning()
/* static */ /* static */
BMenu * BMenu*
TermWindow::_MakeEncodingMenu() TermWindow::_MakeEncodingMenu()
{ {
BMenu *menu = new (std::nothrow) BMenu(B_TRANSLATE("Text encoding")); BMenu* menu = new (std::nothrow) BMenu(B_TRANSLATE("Text encoding"));
if (menu == NULL) if (menu == NULL)
return NULL; return NULL;
@@ -399,13 +399,13 @@ TermWindow::_SetupMenu()
void void
TermWindow::_GetPreferredFont(BFont &font) TermWindow::_GetPreferredFont(BFont& font)
{ {
// Default to be_fixed_font // Default to be_fixed_font
font = be_fixed_font; font = be_fixed_font;
const char *family = PrefHandler::Default()->getString(PREF_HALF_FONT_FAMILY); const char* family = PrefHandler::Default()->getString(PREF_HALF_FONT_FAMILY);
const char *style = PrefHandler::Default()->getString(PREF_HALF_FONT_STYLE); const char* style = PrefHandler::Default()->getString(PREF_HALF_FONT_STYLE);
font.SetFamilyAndStyle(family, style); font.SetFamilyAndStyle(family, style);
@@ -461,7 +461,6 @@ TermWindow::MessageReceived(BMessage *message)
case MENU_PREF_OPEN: case MENU_PREF_OPEN:
if (!fPrefWindow) { if (!fPrefWindow) {
fPrefWindow = new PrefWindow(this); fPrefWindow = new PrefWindow(this);
//fPrefWindow->
} }
else else
fPrefWindow->Activate(); fPrefWindow->Activate();
@@ -509,7 +508,7 @@ TermWindow::MessageReceived(BMessage *message)
findresult = _ActiveTermView()->Find(fFindString, fForwardSearch, fMatchCase, fMatchWord); findresult = _ActiveTermView()->Find(fFindString, fForwardSearch, fMatchCase, fMatchWord);
if (!findresult) { if (!findresult) {
BAlert *alert = new BAlert(B_TRANSLATE("Find failed"), BAlert* alert = new BAlert(B_TRANSLATE("Find failed"),
B_TRANSLATE("Text not found."), B_TRANSLATE("Text not found."),
B_TRANSLATE("OK"), NULL, NULL, B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT); B_WIDTH_AS_USUAL, B_WARNING_ALERT);
@@ -532,7 +531,7 @@ TermWindow::MessageReceived(BMessage *message)
(message->what == MENU_FIND_NEXT) == fForwardSearch, (message->what == MENU_FIND_NEXT) == fForwardSearch,
fMatchCase, fMatchWord); fMatchCase, fMatchWord);
if (!findresult) { if (!findresult) {
BAlert *alert = new BAlert(B_TRANSLATE("Find failed"), BAlert* alert = new BAlert(B_TRANSLATE("Find failed"),
B_TRANSLATE("Not found."), B_TRANSLATE("OK"), B_TRANSLATE("Not found."), B_TRANSLATE("OK"),
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(0, B_ESCAPE);
@@ -689,7 +688,7 @@ TermWindow::MessageReceived(BMessage *message)
case kIncreaseFontSize: case kIncreaseFontSize:
case kDecreaseFontSize: case kDecreaseFontSize:
{ {
TermView *view = _ActiveTermView(); TermView* view = _ActiveTermView();
BFont font; BFont font;
view->GetTermFont(&font); view->GetTermFont(&font);
@@ -728,7 +727,7 @@ TermWindow::WindowActivated(bool activated)
void void
TermWindow::_SetTermColors(TermViewContainerView *containerView) TermWindow::_SetTermColors(TermViewContainerView* containerView)
{ {
PrefHandler* handler = PrefHandler::Default(); PrefHandler* handler = PrefHandler::Default();
rgb_color background = handler->getRGB(PREF_TEXT_BACK_COLOR); rgb_color background = handler->getRGB(PREF_TEXT_BACK_COLOR);
@@ -808,10 +807,10 @@ TermWindow::_DoPrint()
void void
TermWindow::_AddTab(Arguments *args) TermWindow::_AddTab(Arguments* args)
{ {
int argc = 0; int argc = 0;
const char *const *argv = NULL; const char* const* argv = NULL;
if (args != NULL) if (args != NULL)
args->GetShellArguments(argc, argv); args->GetShellArguments(argc, argv);
@@ -820,14 +819,14 @@ TermWindow::_AddTab(Arguments *args)
// only to avoid adding it as a dependency: in other words, to keep // only to avoid adding it as a dependency: in other words, to keep
// the TermView class as agnostic as possible about the surrounding // the TermView class as agnostic as possible about the surrounding
// world. // world.
CustomTermView *view = new CustomTermView( CustomTermView* view = new CustomTermView(
PrefHandler::Default()->getInt32(PREF_ROWS), PrefHandler::Default()->getInt32(PREF_ROWS),
PrefHandler::Default()->getInt32(PREF_COLS), PrefHandler::Default()->getInt32(PREF_COLS),
argc, (const char **)argv, argc, (const char**)argv,
PrefHandler::Default()->getInt32(PREF_HISTORY_SIZE)); PrefHandler::Default()->getInt32(PREF_HISTORY_SIZE));
TermViewContainerView *containerView = new TermViewContainerView(view); TermViewContainerView* containerView = new TermViewContainerView(view);
BScrollView *scrollView = new TermScrollView("scrollView", BScrollView* scrollView = new TermScrollView("scrollView",
containerView, view, fSessions.IsEmpty()); containerView, view, fSessions.IsEmpty());
if (fSessions.IsEmpty()) if (fSessions.IsEmpty())
@@ -863,7 +862,7 @@ TermWindow::_AddTab(Arguments *args)
// is one pixel wider than its parent. // is one pixel wider than its parent.
} }
BTab *tab = new BTab; BTab* tab = new BTab;
fTabView->AddTab(scrollView, tab); fTabView->AddTab(scrollView, tab);
tab->SetLabel(session->name.String()); tab->SetLabel(session->name.String());
// TODO: Use a better name. For example, do like MacOS X's Terminal // TODO: Use a better name. For example, do like MacOS X's Terminal
@@ -931,7 +930,7 @@ TermWindow::_TermViewContainerViewAt(int32 index) const
} }
TermView * TermView*
TermWindow::_ActiveTermView() const TermWindow::_ActiveTermView() const
{ {
return _ActiveTermViewContainerView()->GetTermView(); return _ActiveTermViewContainerView()->GetTermView();
@@ -987,7 +986,7 @@ TermWindow::FrameResized(float newWidth, float newHeight)
{ {
BWindow::FrameResized(newWidth, newHeight); BWindow::FrameResized(newWidth, newHeight);
TermView *view = _ActiveTermView(); TermView* view = _ActiveTermView();
PrefHandler::Default()->setInt32(PREF_COLS, view->Columns()); PrefHandler::Default()->setInt32(PREF_COLS, view->Columns());
PrefHandler::Default()->setInt32(PREF_ROWS, view->Rows()); PrefHandler::Default()->setInt32(PREF_ROWS, view->Rows());
} }
@@ -1009,7 +1008,8 @@ TermWindow::_ResizeView(TermView *view)
minimumHeight + MIN_ROWS * fontHeight - 1, minimumHeight + MIN_ROWS * fontHeight - 1,
minimumHeight + MAX_ROWS * fontHeight - 1); minimumHeight + MAX_ROWS * fontHeight - 1);
float width, height; float width;
float height;
view->Parent()->GetPreferredSize(&width, &height); view->Parent()->GetPreferredSize(&width, &height);
width += B_V_SCROLL_BAR_WIDTH; width += B_V_SCROLL_BAR_WIDTH;
// NOTE: Width is one pixel too small, since the scroll view // NOTE: Width is one pixel too small, since the scroll view
@@ -1026,7 +1026,7 @@ TermWindow::_ResizeView(TermView *view)
BMenu* BMenu*
TermWindow::_MakeWindowSizeMenu() TermWindow::_MakeWindowSizeMenu()
{ {
BMenu *menu = new (std::nothrow) BMenu(B_TRANSLATE("Window size")); BMenu* menu = new (std::nothrow) BMenu(B_TRANSLATE("Window size"));
if (menu == NULL) if (menu == NULL)
return NULL; return NULL;
@@ -1043,7 +1043,7 @@ TermWindow::_MakeWindowSizeMenu()
int32 columns = windowSizes[i][0]; int32 columns = windowSizes[i][0];
int32 rows = windowSizes[i][1]; int32 rows = windowSizes[i][1];
snprintf(label, sizeof(label), "%ldx%ld", columns, rows); snprintf(label, sizeof(label), "%ldx%ld", columns, rows);
BMessage *message = new BMessage(MSG_COLS_CHANGED); BMessage* message = new BMessage(MSG_COLS_CHANGED);
message->AddInt32("columns", columns); message->AddInt32("columns", columns);
message->AddInt32("rows", rows); message->AddInt32("rows", rows);
menu->AddItem(new BMenuItem(label, message)); menu->AddItem(new BMenuItem(label, message));
@@ -1091,7 +1091,7 @@ CustomTermView::CustomTermView(int32 rows, int32 columns, int32 argc, const char
void void
CustomTermView::NotifyQuit(int32 reason) CustomTermView::NotifyQuit(int32 reason)
{ {
BWindow *window = Window(); BWindow* window = Window();
// TODO: If we got this from a view in a tab not currently selected, // TODO: If we got this from a view in a tab not currently selected,
// Window() will be NULL, as the view is detached. // Window() will be NULL, as the view is detached.
// So we send the message to the first application window // So we send the message to the first application window
@@ -1110,7 +1110,7 @@ CustomTermView::NotifyQuit(int32 reason)
void void
CustomTermView::SetTitle(const char *title) CustomTermView::SetTitle(const char* title)
{ {
dynamic_cast<TermWindow*>(Window())->SetSessionWindowTitle(this, title); dynamic_cast<TermWindow*>(Window())->SetSessionWindowTitle(this, title);
} }