diff --git a/src/apps/terminal/Jamfile b/src/apps/terminal/Jamfile index a5c1f022d5..7a68a26b08 100644 --- a/src/apps/terminal/Jamfile +++ b/src/apps/terminal/Jamfile @@ -17,7 +17,6 @@ Application Terminal : PrefWindow.cpp Shell.cpp TermApp.cpp - TermBaseView.cpp TermBuffer.cpp TermParse.cpp TermView.cpp diff --git a/src/apps/terminal/TermBaseView.cpp b/src/apps/terminal/TermBaseView.cpp deleted file mode 100644 index 7839e27202..0000000000 --- a/src/apps/terminal/TermBaseView.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2001-2005, Haiku, Inc. - * Copyright (c) 2003-4 Kian Duffy - * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. - * Distributed under the terms of the MIT license. - */ - -/*! This view is a shell for the TermView and makes sure it's always - resized in whole character sizes. - It doesn't serve any other purpose (and could possibly removed - with a tiny bit smarter programming). -*/ - - -#include "TermBaseView.h" -#include "TermView.h" - - -TermBaseView::TermBaseView(BRect frame, TermView *inTermView) - : BView(frame, "baseview", B_FOLLOW_ALL_SIDES, - B_WILL_DRAW | B_FRAME_EVENTS) -{ - fTermView = inTermView; -} - - -TermBaseView::~TermBaseView() -{ -} - - -void -TermBaseView::FrameResized(float width, float height) -{ - int fontWidth, fontHeight; - int cols, rows; - - fTermView->GetFontInfo(&fontWidth, &fontHeight); - - cols = (int)(width - VIEW_OFFSET * 2) / fontWidth; - rows = (int)(height - VIEW_OFFSET * 2) / fontHeight; - - fTermView->ResizeTo(cols * fontWidth - 1, rows * fontHeight - 1); -} diff --git a/src/apps/terminal/TermBaseView.h b/src/apps/terminal/TermBaseView.h deleted file mode 100644 index 04a6c4a4b3..0000000000 --- a/src/apps/terminal/TermBaseView.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2001-2005, Haiku, Inc. - * Copyright (c) 2003-4 Kian Duffy - * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. - * Distributed under the terms of the MIT license. - */ -#ifndef TERM_BASE_VIEW_H -#define TERM_BASE_VIEW_H - - -#include - - -class TermView; - - -class TermBaseView : public BView { - public: - TermBaseView(BRect frame, TermView *); - ~TermBaseView(); - - private: - void SetBaseColor(rgb_color); - virtual void FrameResized(float newWidth, float newHeight); - - TermView *fTermView; -}; - -#endif /* TERM_BASE_VIEW_H */ diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index 7dd407a87f..07eb9ec23f 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -62,7 +62,7 @@ const static rgb_color kTermColorTable[16] = { TermView::TermView(BRect frame, CodeConv *inCodeConv) - : BView(frame, "termview", B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS), + : BView(frame, "termview", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS), fShell(NULL), fFontWidth(0), fFontHeight(0), diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index 775ede05d6..0755115c97 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -34,7 +34,6 @@ #include "PrefWindow.h" #include "PrefView.h" #include "PrefHandler.h" -#include "TermBaseView.h" #include "TermBuffer.h" #include "TermParse.h" #include "TermView.h" @@ -65,7 +64,6 @@ TermWindow::TermWindow(BRect frame, const char* title, const char *command) fWindowSizeMenu(NULL), fNewFontMenu(NULL), fTermView(NULL), - fBaseView(NULL), fCodeConv(NULL), fPrintSettings(NULL), fPrefWindow(NULL), @@ -162,17 +160,10 @@ TermWindow::InitWindow() textframe.top = fMenubar->Bounds().bottom + 1.0; fCodeConv = new CodeConv(); - fTermView = new TermView(Bounds(), fCodeConv); + fTermView = new TermView(textframe, fCodeConv); fTermView->AttachShell(fShell); - /* - * MuTerm has two views. BaseView is window base view. - * TermView is character Terminal view on BaseView. It has paste - * on BaseView shift as VIEW_OFFSET. - */ - fBaseView = new TermBaseView(textframe, fTermView); - // Initialize TermView. (font, size and color) fTermView->SetTermFont(&halfFont, &fullFont); @@ -186,20 +177,16 @@ TermWindow::InitWindow() MIN_COLS * height, MAX_COLS * height); fTermView->SetTermColor(); - fBaseView->SetViewColor(PrefHandler::Default()->getRGB(PREF_TEXT_BACK_COLOR)); - + // Add offset to baseview. rect.InsetBy(-VIEW_OFFSET, -VIEW_OFFSET); // Resize Window - ResizeTo(rect.Width()+ B_V_SCROLL_BAR_WIDTH, rect.Height() + fMenubar->Bounds().Height()); - fBaseView->ResizeTo(rect.Width(), rect.Height()); - fBaseView->AddChild(fTermView); - fTermView->MoveBy(VIEW_OFFSET, VIEW_OFFSET); - + fTermView->ResizeTo(rect.Width(), rect.Height()); + // Make Scroll Bar. BRect scrollRect(0, 0, B_V_SCROLL_BAR_WIDTH, @@ -212,9 +199,8 @@ TermWindow::InitWindow() fTermView->SetScrollBar(scrollBar); AddChild(scrollBar); - AddChild(fBaseView); - - // Set fEditmenu's target to fTermView. (Oh!...) + AddChild(fTermView); + fEditmenu->SetTargetForItems(fTermView); // Initialize TermParse @@ -553,8 +539,8 @@ TermWindow::MessageReceived(BMessage *message) BScreen screen(this); fTermView->ScrollBar()->Hide(); fMenubar->Hide(); - fBaseView->MoveTo(0,0); - fBaseView->ResizeBy(B_V_SCROLL_BAR_WIDTH, mbHeight); + //fTermView->MoveTo(0,0); + fTermView->ResizeBy(B_V_SCROLL_BAR_WIDTH, mbHeight); fSavedLook = Look(); // done before ResizeTo to work around a Dano bug (not erasing the decor) SetLook(B_NO_BORDER_WINDOW_LOOK); @@ -566,8 +552,8 @@ TermWindow::MessageReceived(BMessage *message) fTermView->ScrollBar()->Show(); ResizeTo(fSavedFrame.Width(), fSavedFrame.Height()); MoveTo(fSavedFrame.left, fSavedFrame.top); - fBaseView->ResizeBy(-B_V_SCROLL_BAR_WIDTH, -mbHeight); - fBaseView->MoveTo(0,mbHeight); + fTermView->ResizeBy(-B_V_SCROLL_BAR_WIDTH, -mbHeight); + //fTermView->MoveTo(0,mbHeight); SetLook(fSavedLook); fSavedFrame = BRect(0,0,-1,-1); } @@ -579,9 +565,7 @@ TermWindow::MessageReceived(BMessage *message) break; } case MSG_COLOR_CHANGED: { - fBaseView->SetViewColor (PrefHandler::Default()->getRGB (PREF_TEXT_BACK_COLOR)); fTermView->SetTermColor(); - fBaseView->Invalidate(); fTermView->Invalidate(); break; } diff --git a/src/apps/terminal/TermWindow.h b/src/apps/terminal/TermWindow.h index 05f2b0aedc..791cf5a96e 100644 --- a/src/apps/terminal/TermWindow.h +++ b/src/apps/terminal/TermWindow.h @@ -79,7 +79,6 @@ private: *fWindowSizeMenu, *fNewFontMenu; TermView *fTermView; - BView *fBaseView; CodeConv *fCodeConv; BMessage *fPrintSettings; PrefWindow *fPrefWindow;