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:
@@ -8,7 +8,6 @@ AddResources Terminal :
|
|||||||
|
|
||||||
App Terminal :
|
App Terminal :
|
||||||
Terminal.cpp
|
Terminal.cpp
|
||||||
TerminalTextView.cpp
|
|
||||||
TerminalWindow.cpp
|
TerminalWindow.cpp
|
||||||
TerminalApp.cpp
|
TerminalApp.cpp
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ TerminalApp::ArgvReceived(int32 argc, char * const argv[], const char * cwd)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
printf("wth is that?\n");
|
// getopt prints error message
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <Constants.h>
|
#include <Constants.h>
|
||||||
#include <TerminalApp.h>
|
#include <TerminalApp.h>
|
||||||
#include <TerminalTextView.h>
|
|
||||||
#include <TerminalWindow.h>
|
#include <TerminalWindow.h>
|
||||||
|
|
||||||
#include <debugger.h>
|
#include <debugger.h>
|
||||||
@@ -79,19 +78,13 @@ TerminalWindow::InitWindow(int32 id, entry_ref * settingsRef)
|
|||||||
viewFrame.right -= B_V_SCROLL_BAR_WIDTH;
|
viewFrame.right -= B_V_SCROLL_BAR_WIDTH;
|
||||||
viewFrame.left = 0;
|
viewFrame.left = 0;
|
||||||
|
|
||||||
textBounds = viewFrame;
|
fShellView = new BView(viewFrame,"shellview",B_FOLLOW_ALL, B_FRAME_EVENTS|B_WILL_DRAW);
|
||||||
textBounds.OffsetTo(B_ORIGIN);
|
fShellView->SetLowColor(170,45,45);
|
||||||
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);
|
|
||||||
|
|
||||||
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);
|
AddChild(fScrollView);
|
||||||
fTextView->MakeFocus(true);
|
fShellView->MakeFocus(true);
|
||||||
|
|
||||||
// Terminal menu
|
// Terminal menu
|
||||||
fTerminal = new BMenu("Terminal");
|
fTerminal = new BMenu("Terminal");
|
||||||
@@ -113,18 +106,15 @@ TerminalWindow::InitWindow(int32 id, entry_ref * settingsRef)
|
|||||||
|
|
||||||
fCopy = new BMenuItem("Copy", new BMessage(B_COPY), 'C');
|
fCopy = new BMenuItem("Copy", new BMessage(B_COPY), 'C');
|
||||||
fEdit->AddItem(fCopy);
|
fEdit->AddItem(fCopy);
|
||||||
fCopy->SetTarget(fTextView);
|
|
||||||
fCopy->SetEnabled(false);
|
fCopy->SetEnabled(false);
|
||||||
|
|
||||||
fPaste = new BMenuItem("Paste", new BMessage(B_PASTE), 'V');
|
fPaste = new BMenuItem("Paste", new BMessage(B_PASTE), 'V');
|
||||||
fEdit->AddItem(fPaste);
|
fEdit->AddItem(fPaste);
|
||||||
fPaste->SetTarget(fTextView);
|
|
||||||
|
|
||||||
fEdit->AddSeparatorItem();
|
fEdit->AddSeparatorItem();
|
||||||
|
|
||||||
fSelectAll = new BMenuItem("Select All", new BMessage(B_SELECT_ALL), 'A');
|
fSelectAll = new BMenuItem("Select All", new BMessage(B_SELECT_ALL), 'A');
|
||||||
fEdit->AddItem(fSelectAll);
|
fEdit->AddItem(fSelectAll);
|
||||||
fSelectAll->SetTarget(fTextView);
|
|
||||||
|
|
||||||
fWriteSelection = new BMenuItem("Write Selection...", new BMessage(EDIT_WRITE_SELECTION));
|
fWriteSelection = new BMenuItem("Write Selection...", new BMessage(EDIT_WRITE_SELECTION));
|
||||||
fEdit->AddItem(fWriteSelection);
|
fEdit->AddItem(fWriteSelection);
|
||||||
@@ -382,18 +372,18 @@ TerminalWindow::DisableEditItems(BMessage * message)
|
|||||||
void
|
void
|
||||||
TerminalWindow::EditCopy(BMessage * message)
|
TerminalWindow::EditCopy(BMessage * message)
|
||||||
{
|
{
|
||||||
fTextView->Copy(be_clipboard);
|
// fTextView->Copy(be_clipboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TerminalWindow::EditPaste(BMessage * message)
|
TerminalWindow::EditPaste(BMessage * message)
|
||||||
{
|
{
|
||||||
fTextView->Paste(be_clipboard);
|
// fTextView->Paste(be_clipboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TerminalWindow::EditClearAll(BMessage * message)
|
TerminalWindow::EditClearAll(BMessage * message)
|
||||||
{
|
{
|
||||||
fTextView->SelectAll();
|
// fTextView->SelectAll();
|
||||||
fTextView->Clear();
|
// fTextView->Clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ private:
|
|||||||
BMenuItem *fSaveAsSettingsFile;
|
BMenuItem *fSaveAsSettingsFile;
|
||||||
|
|
||||||
// Main views
|
// Main views
|
||||||
TerminalTextView*fTextView;
|
BView *fShellView;
|
||||||
BScrollView *fScrollView;
|
BScrollView *fScrollView;
|
||||||
|
|
||||||
// File panels
|
// File panels
|
||||||
|
|||||||
Reference in New Issue
Block a user