removed BTextView subview, it will not work for background text, complex cursor control, and will probably have problems with wide character alignment. also fixed long-standing scrollbar bug (stupid missing argument bug).

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4270 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shatty 2003-08-10 14:25:09 +00:00
parent d85db6a722
commit 3349a7ac9d
6 changed files with 11 additions and 90 deletions

View File

@ -8,7 +8,6 @@ AddResources Terminal :
App Terminal :
Terminal.cpp
TerminalTextView.cpp
TerminalWindow.cpp
TerminalApp.cpp
;

View File

@ -233,7 +233,7 @@ TerminalApp::ArgvReceived(int32 argc, char * const argv[], const char * cwd)
}
break;
case '?':
printf("wth is that?\n");
// getopt prints error message
return;
break;
default:

View File

@ -1,47 +0,0 @@
#include <Handler.h>
#include <Messenger.h>
#include <Rect.h>
#include <TerminalTextView.h>
#include <Constants.h>
TerminalTextView::TerminalTextView(BRect viewFrame, BRect textBounds,
const BFont * initialFont,
const rgb_color * initialColor,
BHandler *handler)
: BTextView(viewFrame, "textview", textBounds,
initialFont, initialColor,
B_FOLLOW_ALL, B_FRAME_EVENTS|B_WILL_DRAW)
{
fHandler = handler;
fMessenger = new BMessenger(handler);
SetWordWrap(false);
}
TerminalTextView::~TerminalTextView()
{
delete fMessenger;
}
void
TerminalTextView::Select(int32 start, int32 finish)
{
if (start == finish) {
fMessenger->SendMessage(DISABLE_ITEMS);
} else {
fMessenger->SendMessage(ENABLE_ITEMS);
}
BTextView::Select(start, finish);
}
void
TerminalTextView::FrameResized(float width, float height)
{
BTextView::FrameResized(width, height);
BRect textRect;
textRect = Bounds();
textRect.OffsetTo(B_ORIGIN);
textRect.InsetBy(TEXT_INSET,TEXT_INSET);
SetTextRect(textRect);
}

View File

@ -1,21 +0,0 @@
#ifndef TERMINAL_TEXT_VIEW_H
#define TERMINAL_TEXT_VIEW_H
#include <TextView.h>
class TerminalTextView : public BTextView {
public:
TerminalTextView(BRect viewframe, BRect textframe,
const BFont * initialFont, const rgb_color * initialColor,
BHandler *handler);
~TerminalTextView();
virtual void Select(int32 start, int32 finish);
virtual void FrameResized(float width, float height);
private:
BHandler *fHandler;
BMessenger *fMessenger;
};
#endif // TERMINAL_TEXT_VIEW_H

View File

@ -19,7 +19,6 @@
#include <Constants.h>
#include <TerminalApp.h>
#include <TerminalTextView.h>
#include <TerminalWindow.h>
#include <debugger.h>
@ -79,19 +78,13 @@ TerminalWindow::InitWindow(int32 id, entry_ref * settingsRef)
viewFrame.right -= B_V_SCROLL_BAR_WIDTH;
viewFrame.left = 0;
textBounds = viewFrame;
textBounds.OffsetTo(B_ORIGIN);
textBounds.InsetBy(TEXT_INSET, TEXT_INSET);
BFont textFont(be_plain_font);
textFont.SetSpacing(B_FIXED_SPACING);
rgb_color black = {0,0,0,0};
fTextView = new TerminalTextView(viewFrame, textBounds, &textFont, &black, this);
fTextView->SetStylable(true);
fShellView = new BView(viewFrame,"shellview",B_FOLLOW_ALL, B_FRAME_EVENTS|B_WILL_DRAW);
fShellView->SetLowColor(170,45,45);
fScrollView = new BScrollView("scrollview", fTextView, B_FOLLOW_ALL, true, false, B_PLAIN_BORDER);
fScrollView = new BScrollView("scrollview", fShellView, B_FOLLOW_ALL,
B_FRAME_EVENTS|B_WILL_DRAW, false, true, B_PLAIN_BORDER);
AddChild(fScrollView);
fTextView->MakeFocus(true);
fShellView->MakeFocus(true);
// Terminal menu
fTerminal = new BMenu("Terminal");
@ -113,18 +106,15 @@ TerminalWindow::InitWindow(int32 id, entry_ref * settingsRef)
fCopy = new BMenuItem("Copy", new BMessage(B_COPY), 'C');
fEdit->AddItem(fCopy);
fCopy->SetTarget(fTextView);
fCopy->SetEnabled(false);
fPaste = new BMenuItem("Paste", new BMessage(B_PASTE), 'V');
fEdit->AddItem(fPaste);
fPaste->SetTarget(fTextView);
fEdit->AddSeparatorItem();
fSelectAll = new BMenuItem("Select All", new BMessage(B_SELECT_ALL), 'A');
fEdit->AddItem(fSelectAll);
fSelectAll->SetTarget(fTextView);
fWriteSelection = new BMenuItem("Write Selection...", new BMessage(EDIT_WRITE_SELECTION));
fEdit->AddItem(fWriteSelection);
@ -382,18 +372,18 @@ TerminalWindow::DisableEditItems(BMessage * message)
void
TerminalWindow::EditCopy(BMessage * message)
{
fTextView->Copy(be_clipboard);
// fTextView->Copy(be_clipboard);
}
void
TerminalWindow::EditPaste(BMessage * message)
{
fTextView->Paste(be_clipboard);
// fTextView->Paste(be_clipboard);
}
void
TerminalWindow::EditClearAll(BMessage * message)
{
fTextView->SelectAll();
fTextView->Clear();
// fTextView->SelectAll();
// fTextView->Clear();
}

View File

@ -73,7 +73,7 @@ private:
BMenuItem *fSaveAsSettingsFile;
// Main views
TerminalTextView*fTextView;
BView *fShellView;
BScrollView *fScrollView;
// File panels