Reverted the preference saving part of r34165 (at least for now).

Moved the AboutRequested code to a static TermView method, called from
everywhere (now TermApp knows about TermView, but no one is perfect).
Reordered and removed includes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34318 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2009-11-27 16:49:47 +00:00
parent 4ea6fb8bd4
commit b79c499571
4 changed files with 17 additions and 37 deletions
+5 -20
View File
@@ -22,14 +22,14 @@
#include <Roster.h> #include <Roster.h>
#include <Screen.h> #include <Screen.h>
#include <String.h> #include <String.h>
#include <TextView.h>
#include "Arguments.h" #include "Arguments.h"
#include "CodeConv.h"
#include "Globals.h" #include "Globals.h"
#include "PrefHandler.h" #include "PrefHandler.h"
#include "TermWindow.h"
#include "TermConst.h" #include "TermConst.h"
#include "TermView.h"
#include "TermWindow.h"
static bool sUsageRequested = false; static bool sUsageRequested = false;
@@ -139,22 +139,7 @@ TermApp::Quit()
void void
TermApp::AboutRequested() TermApp::AboutRequested()
{ {
// used spaces instead of tabs to avoid Murai's name being wrapped TermView::AboutRequested();
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();
} }
@@ -557,7 +542,7 @@ void
TermApp::_Usage(char *name) TermApp::_Usage(char *name)
{ {
fprintf(stderr, "Haiku Terminal\n" 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" "Copyright(C) 1999 Kazuho Okui and Takashi Murai.\n"
"\n" "\n"
"Usage: %s [OPTION] [SHELL]\n", name); "Usage: %s [OPTION] [SHELL]\n", name);
+9 -7
View File
@@ -13,7 +13,7 @@
*/ */
#include "TerminalBuffer.h"
#include "TermView.h" #include "TermView.h"
#include <ctype.h> #include <ctype.h>
@@ -50,11 +50,12 @@
#include "CodeConv.h" #include "CodeConv.h"
#include "Shell.h" #include "Shell.h"
#include "TermConst.h" #include "TermConst.h"
#include "TerminalBuffer.h"
#include "TerminalCharClassifier.h" #include "TerminalCharClassifier.h"
#include "VTkeymap.h" #include "VTkeymap.h"
// defined VTKeyTbl.c // defined in VTKeyTbl.c
extern int function_keycode_table[]; extern int function_keycode_table[];
extern char *function_key_char_table[]; extern char *function_key_char_table[];
@@ -1469,7 +1470,7 @@ TermView::MessageReceived(BMessage *msg)
switch (msg->what){ switch (msg->what){
case B_ABOUT_REQUESTED: case B_ABOUT_REQUESTED:
// (replicant) about box requested // (replicant) about box requested
_AboutRequested(); AboutRequested();
break; break;
case B_SIMPLE_DATA: case B_SIMPLE_DATA:
@@ -1681,8 +1682,8 @@ TermView::ScrollTo(BPoint where)
//debug_printf("TermView::ScrollTo(): %f -> %f\n", fScrollOffset, where.y); //debug_printf("TermView::ScrollTo(): %f -> %f\n", fScrollOffset, where.y);
float diff = where.y - fScrollOffset; float diff = where.y - fScrollOffset;
if (diff == 0) if (diff == 0)
return; return;
float bottom = Bounds().bottom; float bottom = Bounds().bottom;
int32 oldFirstLine = _LineAt(0); int32 oldFirstLine = _LineAt(0);
int32 oldLastLine = _LineAt(bottom); int32 oldLastLine = _LineAt(bottom);
@@ -2708,14 +2709,15 @@ TermView::InitiateDrag()
} }
/* static */
void void
TermView::_AboutRequested() TermView::AboutRequested()
{ {
BAlert *alert = new (std::nothrow) BAlert("about", BAlert *alert = new (std::nothrow) BAlert("about",
"Terminal\n" "Terminal\n"
"\twritten by Kazuho Okui and Takashi Murai\n" "\twritten by Kazuho Okui and Takashi Murai\n"
"\tupdated by Kian Duffy and others\n\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) if (alert != NULL)
alert->Go(); alert->Go();
} }
+2 -3
View File
@@ -92,7 +92,8 @@ public:
void InitiateDrag(); void InitiateDrag();
void DisableResizeView(int32 disableCount = 1); void DisableResizeView(int32 disableCount = 1);
static void AboutRequested();
protected: protected:
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void DetachedFromWindow(); virtual void DetachedFromWindow();
@@ -135,8 +136,6 @@ private:
void _Activate(); void _Activate();
void _Deactivate(); void _Deactivate();
void _AboutRequested();
void _DrawLinePart(int32 x1, int32 y1, uint16 attr, void _DrawLinePart(int32 x1, int32 y1, uint16 attr,
char* buffer, int32 width, bool mouse, char* buffer, int32 width, bool mouse,
bool cursor, BView* inView); bool cursor, BView* inView);
+1 -7
View File
@@ -162,14 +162,8 @@ TermWindow::TermWindow(BRect frame, const char* title, Arguments *args)
TermWindow::~TermWindow() 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) if (fPrefWindow)
fPrefWindow->PostMessage(B_QUIT_REQUESTED); fPrefWindow->PostMessage(B_QUIT_REQUESTED);
else
PrefHandler::Default()->SaveDefaultAsText();
if (fFindPanel && fFindPanel->Lock()) { if (fFindPanel && fFindPanel->Lock()) {
fFindPanel->Quit(); fFindPanel->Quit();