Got rid of TermBaseView

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21679 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2007-07-21 19:56:55 +00:00
parent 90c6c3e8a4
commit 0ed5650b01
6 changed files with 11 additions and 102 deletions
-1
View File
@@ -17,7 +17,6 @@ Application Terminal :
PrefWindow.cpp
Shell.cpp
TermApp.cpp
TermBaseView.cpp
TermBuffer.cpp
TermParse.cpp
TermView.cpp
-44
View File
@@ -1,44 +0,0 @@
/*
* Copyright (c) 2001-2005, Haiku, Inc.
* Copyright (c) 2003-4 Kian Duffy <[email protected]>
* 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);
}
-29
View File
@@ -1,29 +0,0 @@
/*
* Copyright (c) 2001-2005, Haiku, Inc.
* Copyright (c) 2003-4 Kian Duffy <[email protected]>
* 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 <View.h>
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 */
+1 -1
View File
@@ -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),
+10 -26
View File
@@ -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;
}
-1
View File
@@ -79,7 +79,6 @@ private:
*fWindowSizeMenu,
*fNewFontMenu;
TermView *fTermView;
BView *fBaseView;
CodeConv *fCodeConv;
BMessage *fPrintSettings;
PrefWindow *fPrefWindow;