[haiku-commits] r42235 - haiku/trunk/src/kits/tracker

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 18 Jun 2011 16:17:17 +0200 (CEST)

Author: anevilyak
Date: 2011-06-18 16:17:17 +0200 (Sat, 18 Jun 2011)
New Revision: 42235
Changeset: https://dev.haiku-os.org/changeset/42235

Modified:
   haiku/trunk/src/kits/tracker/ContainerWindow.cpp
   haiku/trunk/src/kits/tracker/PoseView.cpp
Log:
* 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.



Modified: haiku/trunk/src/kits/tracker/ContainerWindow.cpp
===================================================================
--- haiku/trunk/src/kits/tracker/ContainerWindow.cpp    2011-06-18 09:53:56 UTC 
(rev 42234)
+++ haiku/trunk/src/kits/tracker/ContainerWindow.cpp    2011-06-18 14:17:17 UTC 
(rev 42235)
@@ -1570,6 +1570,7 @@
                                //
                                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 @@
                                        //      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 @@
                EnableNamedMenuItem(menu, kDelete, selectCount > 0);
                EnableNamedMenuItem(menu, kDuplicateSelection, selectCount > 0);
        }
-       
+
        Model *selectedModel = NULL;
        if (selectCount == 1)
                selectedModel = 
PoseView()->SelectionList()->FirstItem()->TargetModel();

Modified: haiku/trunk/src/kits/tracker/PoseView.cpp
===================================================================
--- haiku/trunk/src/kits/tracker/PoseView.cpp   2011-06-18 09:53:56 UTC (rev 
42234)
+++ haiku/trunk/src/kits/tracker/PoseView.cpp   2011-06-18 14:17:17 UTC (rev 
42235)
@@ -6716,6 +6716,8 @@
        if (!window)
                return;
 
+       window->DragStart(message);
+
        switch (moveCode) {
                case B_INSIDE_VIEW:
                case B_ENTERED_VIEW:
@@ -7022,10 +7024,6 @@
                } else
                        DragMessage(&message, dragRect);
 
-               BContainerWindow* window = ContainerWindow();
-               if (window != NULL)
-                       window->DragStart(&message);
-
                // turn on auto scrolling
                fAutoScrollState = kWaitForTransition;
                Window()->SetPulseRate(100000);


Other related posts:

  • » [haiku-commits] r42235 - haiku/trunk/src/kits/tracker - anevilyak