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:
@@ -17,7 +17,6 @@ Application Terminal :
|
|||||||
PrefWindow.cpp
|
PrefWindow.cpp
|
||||||
Shell.cpp
|
Shell.cpp
|
||||||
TermApp.cpp
|
TermApp.cpp
|
||||||
TermBaseView.cpp
|
|
||||||
TermBuffer.cpp
|
TermBuffer.cpp
|
||||||
TermParse.cpp
|
TermParse.cpp
|
||||||
TermView.cpp
|
TermView.cpp
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
@@ -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 */
|
|
||||||
@@ -62,7 +62,7 @@ const static rgb_color kTermColorTable[16] = {
|
|||||||
|
|
||||||
|
|
||||||
TermView::TermView(BRect frame, CodeConv *inCodeConv)
|
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),
|
fShell(NULL),
|
||||||
fFontWidth(0),
|
fFontWidth(0),
|
||||||
fFontHeight(0),
|
fFontHeight(0),
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
#include "PrefWindow.h"
|
#include "PrefWindow.h"
|
||||||
#include "PrefView.h"
|
#include "PrefView.h"
|
||||||
#include "PrefHandler.h"
|
#include "PrefHandler.h"
|
||||||
#include "TermBaseView.h"
|
|
||||||
#include "TermBuffer.h"
|
#include "TermBuffer.h"
|
||||||
#include "TermParse.h"
|
#include "TermParse.h"
|
||||||
#include "TermView.h"
|
#include "TermView.h"
|
||||||
@@ -65,7 +64,6 @@ TermWindow::TermWindow(BRect frame, const char* title, const char *command)
|
|||||||
fWindowSizeMenu(NULL),
|
fWindowSizeMenu(NULL),
|
||||||
fNewFontMenu(NULL),
|
fNewFontMenu(NULL),
|
||||||
fTermView(NULL),
|
fTermView(NULL),
|
||||||
fBaseView(NULL),
|
|
||||||
fCodeConv(NULL),
|
fCodeConv(NULL),
|
||||||
fPrintSettings(NULL),
|
fPrintSettings(NULL),
|
||||||
fPrefWindow(NULL),
|
fPrefWindow(NULL),
|
||||||
@@ -162,17 +160,10 @@ TermWindow::InitWindow()
|
|||||||
textframe.top = fMenubar->Bounds().bottom + 1.0;
|
textframe.top = fMenubar->Bounds().bottom + 1.0;
|
||||||
|
|
||||||
fCodeConv = new CodeConv();
|
fCodeConv = new CodeConv();
|
||||||
fTermView = new TermView(Bounds(), fCodeConv);
|
fTermView = new TermView(textframe, fCodeConv);
|
||||||
|
|
||||||
fTermView->AttachShell(fShell);
|
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)
|
// Initialize TermView. (font, size and color)
|
||||||
|
|
||||||
fTermView->SetTermFont(&halfFont, &fullFont);
|
fTermView->SetTermFont(&halfFont, &fullFont);
|
||||||
@@ -186,19 +177,15 @@ TermWindow::InitWindow()
|
|||||||
MIN_COLS * height, MAX_COLS * height);
|
MIN_COLS * height, MAX_COLS * height);
|
||||||
|
|
||||||
fTermView->SetTermColor();
|
fTermView->SetTermColor();
|
||||||
fBaseView->SetViewColor(PrefHandler::Default()->getRGB(PREF_TEXT_BACK_COLOR));
|
|
||||||
|
|
||||||
// Add offset to baseview.
|
// Add offset to baseview.
|
||||||
rect.InsetBy(-VIEW_OFFSET, -VIEW_OFFSET);
|
rect.InsetBy(-VIEW_OFFSET, -VIEW_OFFSET);
|
||||||
|
|
||||||
// Resize Window
|
// Resize Window
|
||||||
|
|
||||||
ResizeTo(rect.Width()+ B_V_SCROLL_BAR_WIDTH,
|
ResizeTo(rect.Width()+ B_V_SCROLL_BAR_WIDTH,
|
||||||
rect.Height() + fMenubar->Bounds().Height());
|
rect.Height() + fMenubar->Bounds().Height());
|
||||||
|
|
||||||
fBaseView->ResizeTo(rect.Width(), rect.Height());
|
fTermView->ResizeTo(rect.Width(), rect.Height());
|
||||||
fBaseView->AddChild(fTermView);
|
|
||||||
fTermView->MoveBy(VIEW_OFFSET, VIEW_OFFSET);
|
|
||||||
|
|
||||||
// Make Scroll Bar.
|
// Make Scroll Bar.
|
||||||
|
|
||||||
@@ -212,9 +199,8 @@ TermWindow::InitWindow()
|
|||||||
fTermView->SetScrollBar(scrollBar);
|
fTermView->SetScrollBar(scrollBar);
|
||||||
|
|
||||||
AddChild(scrollBar);
|
AddChild(scrollBar);
|
||||||
AddChild(fBaseView);
|
AddChild(fTermView);
|
||||||
|
|
||||||
// Set fEditmenu's target to fTermView. (Oh!...)
|
|
||||||
fEditmenu->SetTargetForItems(fTermView);
|
fEditmenu->SetTargetForItems(fTermView);
|
||||||
|
|
||||||
// Initialize TermParse
|
// Initialize TermParse
|
||||||
@@ -553,8 +539,8 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
BScreen screen(this);
|
BScreen screen(this);
|
||||||
fTermView->ScrollBar()->Hide();
|
fTermView->ScrollBar()->Hide();
|
||||||
fMenubar->Hide();
|
fMenubar->Hide();
|
||||||
fBaseView->MoveTo(0,0);
|
//fTermView->MoveTo(0,0);
|
||||||
fBaseView->ResizeBy(B_V_SCROLL_BAR_WIDTH, mbHeight);
|
fTermView->ResizeBy(B_V_SCROLL_BAR_WIDTH, mbHeight);
|
||||||
fSavedLook = Look();
|
fSavedLook = Look();
|
||||||
// done before ResizeTo to work around a Dano bug (not erasing the decor)
|
// done before ResizeTo to work around a Dano bug (not erasing the decor)
|
||||||
SetLook(B_NO_BORDER_WINDOW_LOOK);
|
SetLook(B_NO_BORDER_WINDOW_LOOK);
|
||||||
@@ -566,8 +552,8 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
fTermView->ScrollBar()->Show();
|
fTermView->ScrollBar()->Show();
|
||||||
ResizeTo(fSavedFrame.Width(), fSavedFrame.Height());
|
ResizeTo(fSavedFrame.Width(), fSavedFrame.Height());
|
||||||
MoveTo(fSavedFrame.left, fSavedFrame.top);
|
MoveTo(fSavedFrame.left, fSavedFrame.top);
|
||||||
fBaseView->ResizeBy(-B_V_SCROLL_BAR_WIDTH, -mbHeight);
|
fTermView->ResizeBy(-B_V_SCROLL_BAR_WIDTH, -mbHeight);
|
||||||
fBaseView->MoveTo(0,mbHeight);
|
//fTermView->MoveTo(0,mbHeight);
|
||||||
SetLook(fSavedLook);
|
SetLook(fSavedLook);
|
||||||
fSavedFrame = BRect(0,0,-1,-1);
|
fSavedFrame = BRect(0,0,-1,-1);
|
||||||
}
|
}
|
||||||
@@ -579,9 +565,7 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MSG_COLOR_CHANGED: {
|
case MSG_COLOR_CHANGED: {
|
||||||
fBaseView->SetViewColor (PrefHandler::Default()->getRGB (PREF_TEXT_BACK_COLOR));
|
|
||||||
fTermView->SetTermColor();
|
fTermView->SetTermColor();
|
||||||
fBaseView->Invalidate();
|
|
||||||
fTermView->Invalidate();
|
fTermView->Invalidate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ private:
|
|||||||
*fWindowSizeMenu,
|
*fWindowSizeMenu,
|
||||||
*fNewFontMenu;
|
*fNewFontMenu;
|
||||||
TermView *fTermView;
|
TermView *fTermView;
|
||||||
BView *fBaseView;
|
|
||||||
CodeConv *fCodeConv;
|
CodeConv *fCodeConv;
|
||||||
BMessage *fPrintSettings;
|
BMessage *fPrintSettings;
|
||||||
PrefWindow *fPrefWindow;
|
PrefWindow *fPrefWindow;
|
||||||
|
|||||||
Reference in New Issue
Block a user