Removed dependency to the global gMouseClipboard from TermView. Now there's
a SetMouseClipboard() method to set one (defaults to be_clipboard, maybe it's not a good idea and should default to NULL instead). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34178 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
752639885a
commit
a2ba3d6562
@ -46,7 +46,6 @@
|
||||
#include <Window.h>
|
||||
|
||||
#include "CodeConv.h"
|
||||
#include "Globals.h"
|
||||
#include "Shell.h"
|
||||
#include "TermConst.h"
|
||||
#include "TerminalCharClassifier.h"
|
||||
@ -165,7 +164,7 @@ private:
|
||||
|
||||
TermView::TermView(BRect frame, int32 argc, const char** argv, int32 historySize)
|
||||
: BView(frame, "termview", B_FOLLOW_ALL,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED),
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE),
|
||||
fColumns(COLUMNS_DEFAULT),
|
||||
fRows(ROWS_DEFAULT),
|
||||
fEncoding(M_UTF8),
|
||||
@ -183,7 +182,7 @@ TermView::TermView(BRect frame, int32 argc, const char** argv, int32 historySize
|
||||
TermView::TermView(int rows, int columns, int32 argc, const char** argv,
|
||||
int32 historySize)
|
||||
: BView(BRect(0, 0, 0, 0), "termview", B_FOLLOW_ALL,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED),
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE),
|
||||
fColumns(columns),
|
||||
fRows(rows),
|
||||
fEncoding(M_UTF8),
|
||||
@ -223,8 +222,8 @@ TermView::TermView(BMessage* archive)
|
||||
fReportButtonMouseEvent(false),
|
||||
fReportAnyMouseEvent(false)
|
||||
{
|
||||
// We need this
|
||||
SetFlags(Flags() | B_WILL_DRAW | B_PULSE_NEEDED);
|
||||
SetFlags(Flags() | B_WILL_DRAW | B_FRAME_EVENTS
|
||||
| B_FULL_UPDATE_ON_RESIZE);
|
||||
|
||||
if (archive->FindInt32("encoding", (int32*)&fEncoding) < B_OK)
|
||||
fEncoding = M_UTF8;
|
||||
@ -296,6 +295,7 @@ TermView::_InitObject(int32 argc, const char** argv)
|
||||
fReportNormalMouseEvent = false;
|
||||
fReportButtonMouseEvent = false;
|
||||
fReportAnyMouseEvent = false;
|
||||
fMouseClipboard = be_clipboard;
|
||||
|
||||
fTextBuffer = new(std::nothrow) TerminalBuffer;
|
||||
if (fTextBuffer == NULL)
|
||||
@ -326,7 +326,6 @@ TermView::_InitObject(int32 argc, const char** argv)
|
||||
|
||||
SetTermFont(be_fixed_font);
|
||||
SetTermSize(fRows, fColumns, false);
|
||||
//SetIMAware(false);
|
||||
|
||||
status_t status = fShell->Open(fRows, fColumns,
|
||||
EncodingAsShortString(fEncoding), argc, argv);
|
||||
@ -365,8 +364,9 @@ TermView::~TermView()
|
||||
BArchivable *
|
||||
TermView::Instantiate(BMessage* data)
|
||||
{
|
||||
if (validate_instantiation(data, "TermView"))
|
||||
if (validate_instantiation(data, "TermView")) {
|
||||
return new (std::nothrow) TermView(data);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -577,6 +577,13 @@ TermView::SetEncoding(int encoding)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermView::SetMouseClipboard(BClipboard *clipboard)
|
||||
{
|
||||
fMouseClipboard = clipboard;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermView::GetTermFont(BFont *font) const
|
||||
{
|
||||
@ -632,10 +639,9 @@ void
|
||||
TermView::SetScrollBar(BScrollBar *scrollBar)
|
||||
{
|
||||
fScrollBar = scrollBar;
|
||||
if (fScrollBar != NULL) {
|
||||
if (fScrollBar != NULL)
|
||||
fScrollBar->SetSteps(fFontHeight, fFontHeight * fRows);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
@ -1470,19 +1476,19 @@ TermView::MessageReceived(BMessage *msg)
|
||||
// the contents of the mouse clipboard with the ones from the
|
||||
// system clipboard, in case it contains text data.
|
||||
if (be_clipboard->Lock()) {
|
||||
if (gMouseClipboard->Lock()) {
|
||||
if (fMouseClipboard->Lock()) {
|
||||
BMessage* clipMsgA = be_clipboard->Data();
|
||||
const char* text;
|
||||
ssize_t numBytes;
|
||||
if (clipMsgA->FindData("text/plain", B_MIME_TYPE,
|
||||
(const void**)&text, &numBytes) == B_OK ) {
|
||||
gMouseClipboard->Clear();
|
||||
BMessage* clipMsgB = gMouseClipboard->Data();
|
||||
fMouseClipboard->Clear();
|
||||
BMessage* clipMsgB = fMouseClipboard->Data();
|
||||
clipMsgB->AddData("text/plain", B_MIME_TYPE,
|
||||
text, numBytes);
|
||||
gMouseClipboard->Commit();
|
||||
fMouseClipboard->Commit();
|
||||
}
|
||||
gMouseClipboard->Unlock();
|
||||
fMouseClipboard->Unlock();
|
||||
}
|
||||
be_clipboard->Unlock();
|
||||
}
|
||||
@ -2154,7 +2160,7 @@ TermView::MouseDown(BPoint where)
|
||||
|
||||
// paste button
|
||||
if ((buttons & (B_SECONDARY_MOUSE_BUTTON | B_TERTIARY_MOUSE_BUTTON)) != 0) {
|
||||
Paste(gMouseClipboard);
|
||||
Paste(fMouseClipboard);
|
||||
fLastClickPoint = where;
|
||||
return;
|
||||
}
|
||||
@ -2338,7 +2344,7 @@ TermView::MouseUp(BPoint where)
|
||||
} else {
|
||||
if ((buttons & B_PRIMARY_MOUSE_BUTTON) == 0
|
||||
&& (fMouseButtons & B_PRIMARY_MOUSE_BUTTON) != 0) {
|
||||
Copy(gMouseClipboard);
|
||||
Copy(fMouseClipboard);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -62,10 +62,11 @@ public:
|
||||
int Encoding() const;
|
||||
void SetEncoding(int encoding);
|
||||
|
||||
//void SetIMAware(bool);
|
||||
void SetScrollBar(BScrollBar* scrollBar);
|
||||
BScrollBar* ScrollBar() const { return fScrollBar; };
|
||||
|
||||
void SetMouseClipboard(BClipboard *);
|
||||
|
||||
virtual void SetTitle(const char* title);
|
||||
virtual void NotifyQuit(int32 reason);
|
||||
|
||||
@ -266,6 +267,7 @@ private:
|
||||
bool fReportNormalMouseEvent;
|
||||
bool fReportButtonMouseEvent;
|
||||
bool fReportAnyMouseEvent;
|
||||
BClipboard* fMouseClipboard;
|
||||
|
||||
// Input Method parameter.
|
||||
int fIMViewPtr;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "AppearPrefView.h"
|
||||
#include "Encoding.h"
|
||||
#include "FindWindow.h"
|
||||
#include "Globals.h"
|
||||
#include "PrefWindow.h"
|
||||
#include "PrefHandler.h"
|
||||
#include "SmartTabView.h"
|
||||
@ -800,7 +801,7 @@ TermWindow::_AddTab(Arguments *args)
|
||||
// and update the title using the last executed command ?
|
||||
// Or like Gnome's Terminal and use the current path ?
|
||||
view->SetScrollBar(scrollView->ScrollBar(B_VERTICAL));
|
||||
|
||||
view->SetMouseClipboard(gMouseClipboard);
|
||||
view->SetEncoding(EncodingID(
|
||||
PrefHandler::Default()->getString(PREF_TEXT_ENCODING)));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user