Rework copy message dispatching to auto-dispatch to the focus view rather than targetting the textview specifically.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31571 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2009-07-14 22:42:15 +00:00
parent 9e1a62419e
commit 6c6e9cdb1a
3 changed files with 50 additions and 38 deletions

View File

@ -213,6 +213,7 @@ public:
virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void MakeFocus(bool isFocused);
virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint where);
virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage);
@ -947,6 +948,22 @@ SourceView::TextView::MakeFocus(bool isFocused)
}
void
SourceView::TextView::MessageReceived(BMessage* message)
{
switch (message->what)
{
case B_COPY:
CopySelectionToClipboard();
break;
default:
SourceView::BaseView::MessageReceived(message);
break;
}
}
void
SourceView::TextView::MouseDown(BPoint where)
{
@ -1337,21 +1354,6 @@ SourceView::TargetedByScrollView(BScrollView* scrollView)
}
void
SourceView::MessageReceived(BMessage* message)
{
switch (message->what)
{
case B_COPY:
fTextView->CopySelectionToClipboard();
break;
default:
BView::MessageReceived(message);
break;
}
}
BSize
SourceView::MinSize()
{

View File

@ -45,7 +45,6 @@ public:
void HighlightBorder(bool state);
virtual void TargetedByScrollView(BScrollView* scrollView);
virtual void MessageReceived(BMessage *message);
virtual BSize MinSize();
virtual BSize MaxSize();

View File

@ -117,29 +117,40 @@ void
TeamWindow::DispatchMessage(BMessage* message, BHandler* handler)
{
// Handle function key shortcuts for stepping
if (fActiveThread != NULL && message->what == B_KEY_DOWN) {
int32 key;
uint32 modifiers;
if (message->FindInt32("key", &key) == B_OK
&& message->FindInt32("modifiers", (int32*)&modifiers) == B_OK) {
switch (key) {
case B_F10_KEY:
fListener->ThreadActionRequested(this, fActiveThread->ID(),
MSG_THREAD_STEP_OVER);
break;
case B_F11_KEY:
if ((modifiers & B_SHIFT_KEY) != 0) {
fListener->ThreadActionRequested(this,
fActiveThread->ID(), MSG_THREAD_STEP_OUT);
} else {
fListener->ThreadActionRequested(this,
fActiveThread->ID(), MSG_THREAD_STEP_INTO);
switch (message->what) {
case B_KEY_DOWN:
if (fActiveThread != NULL) {
int32 key;
uint32 modifiers;
if (message->FindInt32("key", &key) == B_OK
&& message->FindInt32("modifiers", (int32*)&modifiers)
== B_OK) {
switch (key) {
case B_F10_KEY:
fListener->ThreadActionRequested(this,
fActiveThread->ID(), MSG_THREAD_STEP_OVER);
break;
case B_F11_KEY:
if ((modifiers & B_SHIFT_KEY) != 0) {
fListener->ThreadActionRequested(this,
fActiveThread->ID(), MSG_THREAD_STEP_OUT);
} else {
fListener->ThreadActionRequested(this,
fActiveThread->ID(), MSG_THREAD_STEP_INTO);
}
break;
default:
break;
}
break;
default:
break;
}
}
}
break;
case B_COPY:
BView* focusView = CurrentFocus();
if (focusView != NULL)
focusView->MessageReceived(message);
break;
}
BWindow::DispatchMessage(message, handler);
}
@ -401,7 +412,7 @@ TeamWindow::_Init()
fMenuBar->AddItem(menu);
item = new BMenuItem("Copy", new BMessage(B_COPY), 'C');
menu->AddItem(item);
item->SetTarget(fSourceView);
item->SetTarget(this);
AutoLocker<TeamDebugModel> locker(fDebugModel);
_UpdateRunButtons();