* Revert r42223 since it breaks some cases.

* Simplify handling a bit. Instead of more or less duplicating some of the
  move logic from PoseView, simply construct an appropriate target model and
  let PoseView's HandleDropCommon() take care of understanding what to do with
  the drag message. This has the side effect that things like dropping a text
  clipping message onto a target in an x-ray menu actually works as expected
  now.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42235 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2011-06-18 14:17:17 +00:00
parent 828a3e9558
commit 7560163d8c
2 changed files with 9 additions and 35 deletions
+7 -31
View File
@@ -1570,6 +1570,7 @@ BContainerWindow::MessageReceived(BMessage *message)
//
entry_ref ref;
if (message->FindRef("refs", &ref) == B_OK) {
//printf("BContainerWindow::MessageReceived - refs received\n");
fWaitingForRefs = false;
BEntry entry(&ref, true);
@@ -1577,37 +1578,12 @@ BContainerWindow::MessageReceived(BMessage *message)
// don't copy to printers dir
if (!FSIsPrintersDir(&entry)) {
if (entry.InitCheck() == B_OK && entry.IsDirectory()) {
uint32 moveMode = kMoveSelectionTo;
int32 buttons = fDragMessage->FindInt32("buttons");
if (buttons & B_SECONDARY_MOUSE_BUTTON || modifiers() & B_CONTROL_KEY) {
BPoint dropPoint;
PoseView()->GetMouse(&dropPoint, NULL, true);
moveMode = ShowDropContextMenu(dropPoint);
if (moveMode == kCancelButton)
break;
}
//
// build of list of entry_refs from the list
// in the drag message
entry_ref dragref;
int32 index = 0;
BObjectList<entry_ref> *list = new BObjectList<entry_ref>(0, true);
while (fDragMessage->FindRef("refs", index++, &dragref) == B_OK)
list->AddItem(new entry_ref(dragref));
//
// compare the target and one of the drag items' parent
//
Model targetModel(&entry, true, false);
if (!CheckDevicesEqual(list->ItemAt(0), &targetModel))
moveMode = kCopySelectionTo;
// copy drag contents to target ref in message
FSMoveToFolder(list, new BEntry(entry),
moveMode);
targetModel.CloseNode();
} else {
// current message sent to apps is only B_REFS_RECEIVED
fDragMessage->what = B_REFS_RECEIVED;
FSLaunchItem(&ref, (const BMessage *)fDragMessage, true, true);
BPoint dropPoint;
uint32 buttons;
PoseView()->GetMouse(&dropPoint, &buttons, true);
PoseView()->HandleDropCommon(fDragMessage, &targetModel, NULL,
PoseView(), dropPoint);
}
}
}
@@ -3029,7 +3005,7 @@ BContainerWindow::UpdateMenu(BMenu *menu, UpdateMenuContext context)
EnableNamedMenuItem(menu, kDelete, selectCount > 0);
EnableNamedMenuItem(menu, kDuplicateSelection, selectCount > 0);
}
Model *selectedModel = NULL;
if (selectCount == 1)
selectedModel = PoseView()->SelectionList()->FirstItem()->TargetModel();
+2 -4
View File
@@ -6716,6 +6716,8 @@ BPoseView::MouseMoved(BPoint mouseLoc, uint32 moveCode, const BMessage *message)
if (!window)
return;
window->DragStart(message);
switch (moveCode) {
case B_INSIDE_VIEW:
case B_ENTERED_VIEW:
@@ -7022,10 +7024,6 @@ BPoseView::DragSelectedPoses(const BPose *pose, BPoint clickPoint)
} else
DragMessage(&message, dragRect);
BContainerWindow* window = ContainerWindow();
if (window != NULL)
window->DragStart(&message);
// turn on auto scrolling
fAutoScrollState = kWaitForTransition;
Window()->SetPulseRate(100000);