diff --git a/src/apps/terminal/TermApp.cpp b/src/apps/terminal/TermApp.cpp index f9e5bf5899..4d019ba179 100644 --- a/src/apps/terminal/TermApp.cpp +++ b/src/apps/terminal/TermApp.cpp @@ -22,14 +22,14 @@ #include #include #include -#include + #include "Arguments.h" -#include "CodeConv.h" #include "Globals.h" #include "PrefHandler.h" -#include "TermWindow.h" #include "TermConst.h" +#include "TermView.h" +#include "TermWindow.h" static bool sUsageRequested = false; @@ -139,22 +139,7 @@ TermApp::Quit() void TermApp::AboutRequested() { - // used spaces instead of tabs to avoid Murai's name being wrapped - BAlert *alert = new BAlert("about", "Terminal\n" - " written by Kazuho Okui and Takashi Murai\n" - " updated by Kian Duffy and others\n\n" - " Copyright " B_UTF8_COPYRIGHT "2003-2008, Haiku.\n", "Ok"); - BTextView *view = alert->TextView(); - - view->SetStylable(true); - - BFont font; - view->GetFont(&font); - font.SetSize(18); - font.SetFace(B_BOLD_FACE); - view->SetFontAndColor(0, 8, &font); - - alert->Go(); + TermView::AboutRequested(); } @@ -557,7 +542,7 @@ void TermApp::_Usage(char *name) { fprintf(stderr, "Haiku Terminal\n" - "Copyright 2001-2007 Haiku, Inc.\n" + "Copyright 2001-2009 Haiku, Inc.\n" "Copyright(C) 1999 Kazuho Okui and Takashi Murai.\n" "\n" "Usage: %s [OPTION] [SHELL]\n", name); diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index 0dde0faac5..41f5e83855 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -13,7 +13,7 @@ */ -#include "TerminalBuffer.h" + #include "TermView.h" #include @@ -50,11 +50,12 @@ #include "CodeConv.h" #include "Shell.h" #include "TermConst.h" +#include "TerminalBuffer.h" #include "TerminalCharClassifier.h" #include "VTkeymap.h" -// defined VTKeyTbl.c +// defined in VTKeyTbl.c extern int function_keycode_table[]; extern char *function_key_char_table[]; @@ -1469,7 +1470,7 @@ TermView::MessageReceived(BMessage *msg) switch (msg->what){ case B_ABOUT_REQUESTED: // (replicant) about box requested - _AboutRequested(); + AboutRequested(); break; case B_SIMPLE_DATA: @@ -1681,8 +1682,8 @@ TermView::ScrollTo(BPoint where) //debug_printf("TermView::ScrollTo(): %f -> %f\n", fScrollOffset, where.y); float diff = where.y - fScrollOffset; if (diff == 0) - return; - + return; + float bottom = Bounds().bottom; int32 oldFirstLine = _LineAt(0); int32 oldLastLine = _LineAt(bottom); @@ -2708,14 +2709,15 @@ TermView::InitiateDrag() } +/* static */ void -TermView::_AboutRequested() +TermView::AboutRequested() { BAlert *alert = new (std::nothrow) BAlert("about", "Terminal\n" "\twritten by Kazuho Okui and Takashi Murai\n" "\tupdated by Kian Duffy and others\n\n" - "\tCopyright " B_UTF8_COPYRIGHT "2003-2008, Haiku.\n", "Ok"); + "\tCopyright " B_UTF8_COPYRIGHT "2003-2009, Haiku.\n", "Ok"); if (alert != NULL) alert->Go(); } diff --git a/src/apps/terminal/TermView.h b/src/apps/terminal/TermView.h index ba7576f33a..c5b6744c96 100644 --- a/src/apps/terminal/TermView.h +++ b/src/apps/terminal/TermView.h @@ -92,7 +92,8 @@ public: void InitiateDrag(); void DisableResizeView(int32 disableCount = 1); - + static void AboutRequested(); + protected: virtual void AttachedToWindow(); virtual void DetachedFromWindow(); @@ -135,8 +136,6 @@ private: void _Activate(); void _Deactivate(); - void _AboutRequested(); - void _DrawLinePart(int32 x1, int32 y1, uint16 attr, char* buffer, int32 width, bool mouse, bool cursor, BView* inView); diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index be40a55bf4..370aa81b23 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -162,14 +162,8 @@ TermWindow::TermWindow(BRect frame, const char* title, Arguments *args) TermWindow::~TermWindow() { - // If there's no prefwindow, save the preferences by ourselves. - // For example, this saves the columns/rows number. - // TODO: Code duplication. Exterminate if (fPrefWindow) - fPrefWindow->PostMessage(B_QUIT_REQUESTED); - else - PrefHandler::Default()->SaveDefaultAsText(); - + fPrefWindow->PostMessage(B_QUIT_REQUESTED); if (fFindPanel && fFindPanel->Lock()) { fFindPanel->Quit();