[Haiku-commits] r33293 - haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker

aldeck at BerliOS aldeck at mail.berlios.de
Fri Sep 25 16:22:56 CEST 2009


Author: aldeck
Date: 2009-09-25 16:22:53 +0200 (Fri, 25 Sep 2009)
New Revision: 33293
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=33293&view=rev

Added:
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/Cursors.h
Modified:
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/ContainerWindow.cpp
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/DesktopPoseView.cpp
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FSUtils.cpp
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FavoritesConfig.cpp
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FilePanelPriv.cpp
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FindPanel.cpp
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/InfoWindow.cpp
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/InfoWindow.h
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/Pose.cpp
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/Pose.h
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/PoseView.cpp
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/SettingsViews.cpp
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/TextWidget.cpp
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/TextWidget.h
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/TrackerSettings.cpp
   haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/WidgetAttributeText.cpp
Log:
* Synchronize with trunk. Merged trunk changes from 31883 to 33258 in src/kits/tracker.
I had been working on a switched directory, will now merge trunk changes from the whole tree.



Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/ContainerWindow.cpp
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/ContainerWindow.cpp	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/ContainerWindow.cpp	2009-09-25 14:22:53 UTC (rev 33293)
@@ -1587,9 +1587,20 @@
 							entry.GetRef(&targetref);
 
 							//	if they don't match, move/copy
-							if (targetref != parentref)
+							if (targetref != parentref) {
+								uint32 moveMode = kMoveSelectionTo;
+								node_ref targetNode;
+								node_ref parentNode;
+								if (entry.GetNodeRef(&targetNode) == B_OK
+									&& itemparent.GetNodeRef(&parentNode)
+										== B_OK) {
+									if (targetNode.device != parentNode.device)
+										moveMode = kCopySelectionTo;
+								}
 								//	copy drag contents to target ref in message
-								FSMoveToFolder(list, new BEntry(entry), kMoveSelectionTo);
+								FSMoveToFolder(list, new BEntry(entry),
+									moveMode);
+							}
 
 						} else {
 							// 	current message sent to apps is only B_REFS_RECEIVED
@@ -2775,6 +2786,15 @@
 		for (int32 index = 0; index < count; index++) {
 			BPose *pose = PoseView()->SelectionList()->ItemAt(index);
 			AddMimeTypeString(mimeTypes, pose->TargetModel());
+			// If it's a symlink, resolves it and add the Target's MimeType
+			if (pose->TargetModel()->IsSymLink()) {
+				Model* resolved = new Model(
+					pose->TargetModel()->EntryRef(), true, true);
+				if (resolved->InitCheck() == B_OK) {
+					AddMimeTypeString(mimeTypes, resolved);
+				}
+				delete resolved;
+			}
 		}
 	}
 
@@ -3058,9 +3078,9 @@
 	ASSERT(PoseView());
 
 	BMenuItem *item;
-	menu->AddItem(item = new BMenuItem("Copy Attributes", new BMessage(kCopyAttributes)));
+	menu->AddItem(item = new BMenuItem("Copy Layout", new BMessage(kCopyAttributes)));
 	item->SetTarget(PoseView());
-	menu->AddItem(item = new BMenuItem("Paste Attributes", new BMessage(kPasteAttributes)));
+	menu->AddItem(item = new BMenuItem("Paste Layout", new BMessage(kPasteAttributes)));
 	item->SetTarget(PoseView());
 	menu->AddSeparatorItem();
 

Copied: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/Cursors.h (from rev 33258, haiku/trunk/src/kits/tracker/Cursors.h)

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/DesktopPoseView.cpp
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/DesktopPoseView.cpp	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/DesktopPoseView.cpp	2009-09-25 14:22:53 UTC (rev 33293)
@@ -101,15 +101,15 @@
 		return NULL;
 
 	CachedEntryIteratorList *result = new DesktopEntryListCollection();
-	
+
 	ASSERT(!sourceModel.IsQuery());
 	ASSERT(sourceModel.Node());
 	BDirectory *sourceDirectory = dynamic_cast<BDirectory *>(sourceModel.Node());
 
 	dev_t sourceDevice = sourceModel.NodeRef()->device;
-	
+
 	ASSERT(sourceDirectory);
-	
+
 	// build an iterator list, start with boot
 	EntryListBase *perDesktopIterator = new CachedDirectoryEntryList(
 		*sourceDirectory);
@@ -153,7 +153,7 @@
 			}
 		}
 	}
-	
+
 	if (result->Rewind() != B_OK) {
 		delete result;
 		if (nodeMonitoringTarget)
@@ -205,7 +205,7 @@
 				&& otherDesktop.GetEntry(&entry) == B_OK) {
 				// place desktop items from the mounted volume onto the desktop
 				Model model(&entry);
-				if (model.InitCheck() == B_OK) 
+				if (model.InitCheck() == B_OK)
 					AddPoses(&model);
 			}
 		}
@@ -247,7 +247,7 @@
 		deviceDesktop.GetNodeRef(&nref);
 		return nref == *ref;
 	}
-	
+
 	return _inherited::Represents(ref);
 }
 
@@ -266,15 +266,16 @@
 DesktopPoseView::ShowVolumes(bool visible, bool showShared)
 {
 	if (LockLooper()) {
+		SavePoseLocations();
 		if (!visible)
 			RemoveRootPoses();
 		else
-			AddRootPoses(true, showShared);	
+			AddRootPoses(true, showShared);
 		UnlockLooper();
 	}
 }
- 
 
+
 void
 DesktopPoseView::RemoveNonBootItems()
 {
@@ -294,7 +295,7 @@
 		return;
 
 	BVolumeRoster volumeRoster;
- 
+
 	BVolume boot;
 	volumeRoster.GetBootVolume(&boot);
 
@@ -310,9 +311,9 @@
 			&& otherDesktop.GetEntry(&entry) == B_OK) {
 			// place desktop items from the mounted volume onto the desktop
 			Model model(&entry);
-			if (model.InitCheck() == B_OK) 
+			if (model.InitCheck() == B_OK)
 				AddPoses(&model);
-		}	
+		}
 	}
 }
 
@@ -359,7 +360,7 @@
 	if (model.InitCheck() == B_OK) {
 		BMessage entryMessage;
 		entryMessage.what = B_NODE_MONITOR;
-		
+
 		if (showDisksIcon)
 			entryMessage.AddInt32("opcode", B_ENTRY_CREATED);
 		else {
@@ -392,7 +393,7 @@
 	bool mountVolumesOnDesktop = true;
 	bool mountSharedVolumesOntoDesktop = true;
 	bool integrateNonBootBeOSDesktops = true;
-	
+
 	message->FindBool("MountVolumesOntoDesktop", &mountVolumesOnDesktop);
 	message->FindBool("MountSharedVolumesOntoDesktop", &mountSharedVolumesOntoDesktop);
 	message->FindBool("IntegrateNonBootBeOSDesktops", &integrateNonBootBeOSDesktops);
@@ -442,7 +443,7 @@
 					&& volume != bootVolume) {
 					// place desktop items from the volume onto the desktop
 					Model model(&entry);
-					if (model.InitCheck() == B_OK) 
+					if (model.InitCheck() == B_OK)
 						AddPoses(&model);
 				}
 			}

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FSUtils.cpp
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FSUtils.cpp	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FSUtils.cpp	2009-09-25 14:22:53 UTC (rev 33293)
@@ -545,7 +545,7 @@
 		if (gStatusWindow)
 			gStatusWindow->RemoveStatusItem(thread);
 
-		BAlert *alert = new BAlert("", 
+		BAlert *alert = new BAlert("",
 			"You can't move or copy items to read-only volumes.",
 			"Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
 		alert->SetShortcut(0, B_ESCAPE);
@@ -1735,7 +1735,7 @@
 		const char *verb = (moveMode == kMoveSelectionTo) ? "moving" : "copying";
 		char replaceMsg[256];
 		sprintf(replaceMsg, kReplaceManyStr, verb, verb);
-		
+
 		BAlert *alert = new BAlert("", replaceMsg,
 			"Cancel", "Prompt", "Replace All");
 		alert->SetShortcut(0, B_ESCAPE);
@@ -2950,21 +2950,12 @@
 
 extern "C" char** environ;
 
-#ifdef HAIKU_TARGET_PLATFORM_HAIKU
 extern "C" status_t _kern_load_image(const char * const *flatArgs,
 	size_t flatArgsSize, int32 argCount, int32 envCount, int32 priority,
 	uint32 flags, port_id errorPort, uint32 errorToken);
 extern "C" status_t __flatten_process_args(const char * const *args,
 	int32 argCount, const char * const *env, int32 envCount, char ***_flatArgs,
 	size_t *_flatSize);
-#else
-extern "C"
-#	if !B_BEOS_VERSION_DANO
-_IMPEXP_ROOT
-#	endif
-status_t _kload_image_etc_(int argc, char **argv, char **envp,
-	char *buf, int bufsize);
-#endif
 
 
 static status_t
@@ -2979,7 +2970,6 @@
 
 	char *argv[2] = { const_cast<char *>(path.Path()), 0};
 
-#ifdef HAIKU_TARGET_PLATFORM_HAIKU
 	port_id errorPort = create_port(1, "Tracker loader error");
 
 	// count environment variables
@@ -3063,11 +3053,6 @@
 	}
 
 	return B_OK;
-#else
-	result = _kload_image_etc_(1, argv, environ, details.LockBuffer(1024), 1024);
-	details.UnlockBuffer();
-#endif
-	return B_OK;
 }
 
 

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FavoritesConfig.cpp
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FavoritesConfig.cpp	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FavoritesConfig.cpp	2009-09-25 14:22:53 UTC (rev 33293)
@@ -856,8 +856,8 @@
 			entry_ref ref;
 
 			// get reference to application directory
-		    get_ref_for_path(appPath, &ref);
-						fAddPanel = new BFilePanel(B_OPEN_PANEL, &messenger,
+			get_ref_for_path(appPath, &ref);
+			fAddPanel = new BFilePanel(B_OPEN_PANEL, &messenger,
 				&ref, fFilePanelNodeFlavors, true);
 		} else
 			fAddPanel = new BFilePanel(B_OPEN_PANEL, &messenger,

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FilePanelPriv.cpp
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FilePanelPriv.cpp	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FilePanelPriv.cpp	2009-09-25 14:22:53 UTC (rev 33293)
@@ -1161,7 +1161,7 @@
 				
 				fConfigWindow = new TFavoritesConfigWindow(BRect(0, 0, 320, 24),
 					"Configure Favorites", Feel() == B_MODAL_APP_WINDOW_FEEL,
-					fNodeFlavors, BMessenger(this), &startref, -1, docs, folders);
+					B_DIRECTORY_NODE, BMessenger(this), &startref, -1, docs, folders);
 			}
 			break;
 		}

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FindPanel.cpp
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FindPanel.cpp	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/FindPanel.cpp	2009-09-25 14:22:53 UTC (rev 33293)
@@ -756,9 +756,10 @@
 	rect.bottom = rect.top + 16;
 	rect.right = rect.left + 100;
 	fSearchTrashCheck = new BCheckBox(rect, "searchTrash", "Include trash", 0);
+	fSearchTrashCheck->ResizeToPreferred();
 	fMoreOptionsPane->AddItem(fSearchTrashCheck, 1);
 
-	rect.OffsetBy(120, 0);
+	rect.OffsetBy(fSearchTrashCheck->Bounds().Width() + 8, 0);
 	fTemporaryCheck = new BCheckBox(rect, "temporary", "Temporary", 0);
 	fMoreOptionsPane->AddItem(fTemporaryCheck, 1);
 	fTemporaryCheck->SetValue(1);
@@ -1839,15 +1840,15 @@
 		BRect rect = box->Bounds();
 		rect.InsetBy(5, 10);
 		rect.top = rect.bottom - 20;
-		rect.right = rect.left + 40;
+		rect.right = rect.left + 22 + be_plain_font->StringWidth("Add");
 
 		button = new BButton(rect, "add", "Add", new BMessage(kAddItem),
 			B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
 		button->SetTarget(this);
 		box->AddChild(button);
 
-		rect.OffsetBy(50, 0);
-		rect.right = rect.left + 55;
+		rect.OffsetBy(rect.Width() + 6, 0);
+		rect.right = rect.left + 22 + be_plain_font->StringWidth("Remove");
 		button = new BButton(rect, "remove", "Remove", new BMessage(kRemoveItem),
 			B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
 

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/InfoWindow.cpp
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/InfoWindow.cpp	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/InfoWindow.cpp	2009-09-25 14:22:53 UTC (rev 33293)
@@ -55,7 +55,7 @@
 #include <MenuField.h>
 #include <Mime.h>
 #include <NodeInfo.h>
-#include <PathMonitor.h>
+#include <NodeMonitor.h>
 #include <Path.h>
 #include <PopUpMenu.h>
 #include <Region.h>
@@ -295,7 +295,7 @@
 {
 	SetPulseRate(1000000);		// we use pulse to check freebytes on volume
 
-	StartWatchingNode();
+	TTracker::WatchNode(model->NodeRef(), B_WATCH_ALL | B_WATCH_MOUNT, this);
 
 	// window list is Locked by Tracker around this constructor
 	if (list)
@@ -388,7 +388,10 @@
 	if (!TargetModel()->IsVolume() && !TargetModel()->IsRoot()) {
 		if (TargetModel()->IsDirectory()) {
 			// if this is a folder then spawn thread to calculate size
-			StartCalcSizeThread();
+			SetSizeStr("calculating" B_UTF8_ELLIPSIS);
+			fCalcThreadID = spawn_thread(BInfoWindow::CalcSize, "CalcSize",
+				B_NORMAL_PRIORITY, this);
+			resume_thread(fCalcThreadID);
 		} else {
 			fAttributeView->SetLastSize(TargetModel()->StatBuf()->st_size);
 
@@ -449,7 +452,18 @@
 
 		case kRecalculateSize:
 		{
-			StartCalcSizeThread();
+			fStopCalc = true;
+			// Wait until any current CalcSize thread has terminated before
+			// starting a new one
+			status_t result;
+			wait_for_thread(fCalcThreadID, &result);
+
+			// Start recalculating..
+			fStopCalc = false;
+			SetSizeStr("calculating" B_UTF8_ELLIPSIS);
+			fCalcThreadID = spawn_thread(BInfoWindow::CalcSize, "CalcSize", 
+				B_NORMAL_PRIORITY, this);
+			resume_thread(fCalcThreadID);
 			break;
 		}
 
@@ -523,12 +537,12 @@
 				AttributeStreamFileNode newNode(TargetModel()->Node());
 				newNode << memoryNode;
 
+				// Start watching this again
+				TTracker::WatchNode(TargetModel()->NodeRef(), 
+					B_WATCH_ALL | B_WATCH_MOUNT, this);
 
 				// Tell the attribute view about this new model
 				fAttributeView->ReLinkTargetModel(TargetModel());
-
-				// Start watching this again
-				StartWatchingNode();
 			}
 			break;
 		}
@@ -563,14 +577,7 @@
 			FSEmptyTrash();
 			break;
 
-		case B_PATH_MONITOR:
-
-			if (!TargetModel()->IsVolume() && !TargetModel()->IsRoot()) {
-				if (TargetModel()->IsDirectory()) {
-					StartCalcSizeThread();
-				}
-			}
-
+		case B_NODE_MONITOR:
 			switch (message->FindInt32("opcode")) {
 				case B_ENTRY_REMOVED:
 					{
@@ -688,34 +695,6 @@
 }
 
 
-void
-BInfoWindow::StartWatchingNode()
-{
-	BPath path;
-	fModel->GetPath(&path);
-	BPrivate::BPathMonitor::StartWatching(path.Path(), 
-		B_WATCH_ALL | B_WATCH_RECURSIVELY | B_WATCH_MOUNT, this);
-}
-
-
-void
-BInfoWindow::StartCalcSizeThread()
-{
-	fStopCalc = true;
-	// Wait until any current CalcSize thread has terminated before
-	// starting a new one
-	status_t result;
-	wait_for_thread(fCalcThreadID, &result);
-
-	// Start recalculating..
-	fStopCalc = false;
-	SetSizeStr("calculating" B_UTF8_ELLIPSIS);
-	fCalcThreadID = spawn_thread(BInfoWindow::CalcSize, "CalcSize",
-		B_NORMAL_PRIORITY, this);
-	resume_thread(fCalcThreadID);
-}
-
-
 int32
 BInfoWindow::CalcSize(void *castToWindow)
 {

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/InfoWindow.h
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/InfoWindow.h	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/InfoWindow.h	2009-09-25 14:22:53 UTC (rev 33293)
@@ -71,9 +71,6 @@
 		virtual void Show();
 
 	private:
-		void StartWatchingNode();
-		void StartCalcSizeThread();		
-
 		static BRect InfoWindowRect(bool displayingSymlink);
 		static int32 CalcSize(void *); 
 

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/Pose.cpp
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/Pose.cpp	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/Pose.cpp	2009-09-25 14:22:53 UTC (rev 33293)
@@ -71,9 +71,9 @@
 		fWidgetList(4, true),
 		fClipboardMode(clipboardMode),
 		fPercent(-1),
+		fSelectionTime(0),
 		fIsSelected(selected),
 		fIsHighlighted(false),
-		fDelayedEdit(true),
 		fHasLocation(false),
 		fNeedsSaveLocation(false),
 		fListModeInited(false),
@@ -199,7 +199,7 @@
 		rect = widget->CalcClickRect(pose->Location(poseView), 0, poseView);
 
 	if (rect.Contains(where)) {
-		widget->MouseUp(rect, poseView, pose, where, pose->DelayedEdit());
+		widget->MouseUp(rect, poseView, pose, where);
 		return true;
 	}
 	return false;
@@ -547,11 +547,11 @@
 	if (poseView->ViewMode() == kListMode) {
 		uint32 size = poseView->IconSizeInt();
 		BRect iconRect(rect);
-		iconRect.OffsetBy(offset);
 		iconRect.left += kListOffset;
 		iconRect.right = iconRect.left + size;
 		iconRect.top = iconRect.bottom - size;
 		if (updateRect.Intersects(iconRect)) {
+			iconRect.OffsetBy(offset);
 			DrawIcon(iconRect.LeftTop(), drawView, poseView->IconSize(), directDraw,
 				!windowActive && !showSelectionWhenInactive);
 		}

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/Pose.h
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/Pose.h	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/Pose.h	2009-09-25 14:22:53 UTC (rev 33293)
@@ -82,6 +82,8 @@
 		bool IsSelected() const;
 		void Highlight(bool highlighted);
 		bool IsHighlighted() const;
+		bigtime_t SelectionTime() const;
+		bigtime_t SelectionTime() const;
 
 		BTextWidget *ActiveWidget() const;
 		BTextWidget *WidgetFor(uint32 hashAttr, int32 *index = 0) const;
@@ -138,10 +140,10 @@
 
 		uint32 fClipboardMode;
 		int32 fPercent;
+		bigtime_t fSelectionTime;
 
 		bool fIsSelected : 1;
 		bool fIsHighlighted : 1;
-		bool fDelayedEdit : 1;
 		bool fHasLocation : 1;
 		bool fNeedsSaveLocation : 1;
 		bool fListModeInited : 1;
@@ -177,6 +179,8 @@
 BPose::Select(bool on)
 {
 	fIsSelected = on;
+	if (on)
+		fSelectionTime = system_time();
 }
 
 
@@ -194,20 +198,13 @@
 }
 
 
-inline bool
-BPose::DelayedEdit() const
+inline bigtime_t
+BPose::SelectionTime()	const
 {
-	return fDelayedEdit;
+	return fSelectionTime;
 }
 
 
-inline void
-BPose::SetDelayedEdit(bool on)
-{
-	fDelayedEdit = on;
-}
-
-
 inline bool
 BPose::NeedsSaveLocation() const
 {

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/PoseView.cpp
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/PoseView.cpp	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/PoseView.cpp	2009-09-25 14:22:53 UTC (rev 33293)
@@ -71,6 +71,7 @@
 #include "ContainerWindow.h"
 #include "CountView.h"
 #include "DebugSpatialCache.h"
+#include "Cursors.h"
 #include "DeskWindow.h"
 #include "DesktopPoseView.h"
 #include "DirMenu.h"
@@ -135,18 +136,6 @@
 	// maximum size of the transparent drag bitmap, use a drag rect
 	// if larger in any direction
 
-const unsigned char kCopyCursor[] = { 16, 1, 1, 1,
-	0x00, 0x00, 0x70, 0x00, 0x48, 0x00, 0x48, 0x00,
-	0x27, 0xc0, 0x24, 0xb8, 0x12, 0x54, 0x10, 0x02,
-	0x79, 0xe2, 0x99, 0x22, 0x85, 0x7a, 0x61, 0x4a,
-	0x19, 0xca, 0x04, 0x4a, 0x02, 0x78, 0x00, 0x00,
-
-	0x00, 0x00, 0x70, 0x00, 0x78, 0x00, 0x78, 0x00,
-	0x3f, 0xc0, 0x3f, 0xf8, 0x1f, 0xfc, 0x1f, 0xfe,
-	0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfe,
-	0x1f, 0xfe, 0x07, 0xfe, 0x03, 0xf8, 0x00, 0x00
-};
-
 const char *kNoCopyToTrashStr = "Sorry, you can't copy items to the Trash.";
 const char *kNoLinkToTrashStr = "Sorry, you can't create links in the Trash.";
 const char *kNoCopyToRootStr = "You must drop items on one of the disk icons "
@@ -3217,8 +3206,10 @@
 			BPoint location(pose->Location(this));
 			BPoint newLocation(PinToGrid(location, fGrid, fOffset));
 
+			bool intersectsDesktopElements = !IsValidLocation(pose);
+
 			// do we need to move pose to a grid location?
-			if (newLocation != location) {
+			if (newLocation != location || intersectsDesktopElements) {
 				// remove pose from VSlist so it doesn't "bump" into itself
 				fPoseSpatialCache->RemovePose(pose);
 
@@ -3226,7 +3217,8 @@
 				BRect oldBounds(pose->CalcRect(this));
 				BRect poseBounds(oldBounds);
 				pose->MoveTo(newLocation, this);
-				if (SlotOccupied(oldBounds, viewBounds)) {
+				if (SlotOccupied(oldBounds, viewBounds)
+					|| intersectsDesktopElements) {
 					ResetPosePlacementHint();
 					PlacePose(pose, viewBounds);
 					poseBounds = pose->CalcRect(this);
@@ -4505,6 +4497,8 @@
 			BPoint location (pose->Location(targetView) + delta);
 			if (dropOnGrid)
 				location = targetView->PinToGrid(location, targetView->fGrid, targetView->fOffset);
+			// TODO: don't drop poses under desktop elements
+			//		 ie: replicants, deskbar
 			pose->MoveTo(location, targetView);
 
 			targetView->fPoseSpatialCache->AddPose(pose);
@@ -6563,14 +6557,13 @@
 BPoseView::MakeDragBitmap(BRect dragRect, BPoint clickedPoint, int32 clickedPoseIndex, BPoint &offset)
 {
 	BRect inner(clickedPoint.x - kTransparentDragThreshold.x / 2,
-		clickedPoint.y - kTransparentDragThreshold.x / 2,
+		clickedPoint.y - kTransparentDragThreshold.y / 2,
 		clickedPoint.x + kTransparentDragThreshold.x / 2,
-		clickedPoint.y + kTransparentDragThreshold.x / 2);
+		clickedPoint.y + kTransparentDragThreshold.y / 2);
 
 	// (BRect & BRect) doesn't work correctly if the rectangles don't intersect
 	// this catches a bug that is produced somewhere before this function is called
-	if (inner.right < dragRect.left || inner.bottom < dragRect.top
-		|| inner.left > dragRect.right || inner.top > dragRect.bottom)
+	if (!inner.Intersects(dragRect))
 		return NULL;
 
 	inner = inner & dragRect;
@@ -6615,28 +6608,6 @@
 
 	memset(bitmap->Bits(), 0, bitmap->BitsLength());
 
-//TODO: what was this supposed to do?
-	// Transparent draw magic
-//	view->SetHighColor(0, 0, 0, uint8(fade ? 10 : 0));
-//	view->FillRect(view->Bounds());
-//	view->Sync();
-//
-//	if (fade) {
-//		// If we fade out any border of the selection, the background
-//		// will be slightly darker, and we will also fade out the
-//		// edges so that everything looks smooth
-//		uint32 *bits = (uint32 *)bitmap->Bits();
-//		int32 width = bitmap->BytesPerRow() / 4;
-//
-//		FadeRGBA32Horizontal(bits, width, int32(rect.bottom),
-//			int32(rect.right), int32(rect.right) - 16);
-//		FadeRGBA32Horizontal(bits, width, int32(rect.bottom), 0, 16);
-//
-//		FadeRGBA32Vertical(bits, width, int32(rect.bottom),
-//			int32(rect.bottom), int32(rect.bottom) - 16);
-//		FadeRGBA32Vertical(bits, width, int32(rect.bottom), 0, 16);
-//	}
-
 	view->SetDrawingMode(B_OP_ALPHA);
 	view->SetHighColor(0, 0, 0, uint8(fade ? 164 : 128));
 		// set the level of transparency by value
@@ -8731,6 +8702,10 @@
 	if (targetModel == NULL)
 		targetModel = TargetModel();
 
+	// if this is an OpenWith window, we'll have no target model
+	if (targetModel == NULL)
+		return false;
+
 	entry_ref srcRef;
 	if (targetModel->IsDirectory() && dragMessage->HasRef("refs")
 			&& dragMessage->FindRef("refs", &srcRef) == B_OK) {

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/SettingsViews.cpp
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/SettingsViews.cpp	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/SettingsViews.cpp	2009-09-25 14:22:53 UTC (rev 33293)
@@ -1190,9 +1190,9 @@
 
 	TrackerSettings settings;
 
-	if (settings.ShowVolumeSpaceBar()) {
-		settings.SetShowVolumeSpaceBar(false);
-		send_bool_notices(kShowVolumeSpaceBar, "ShowVolumeSpaceBar", false);
+	if (!settings.ShowVolumeSpaceBar()) {
+		settings.SetShowVolumeSpaceBar(true);
+		send_bool_notices(kShowVolumeSpaceBar, "ShowVolumeSpaceBar", true);
 	}
 
 	if (settings.UsedSpaceColor() != kDefaultUsedSpaceColor
@@ -1213,7 +1213,7 @@
 {
 	TrackerSettings settings;
 
-	return settings.ShowVolumeSpaceBar() != false
+	return settings.ShowVolumeSpaceBar() != true
 		|| settings.UsedSpaceColor() != kDefaultUsedSpaceColor
 		|| settings.FreeSpaceColor() != kDefaultFreeSpaceColor
 		|| settings.WarningSpaceColor() != kDefaultWarningSpaceColor;

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/TextWidget.cpp
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/TextWidget.cpp	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/TextWidget.cpp	2009-09-25 14:22:53 UTC (rev 33293)
@@ -126,7 +126,7 @@
 }
 
 
-BRect 
+BRect
 BTextWidget::CalcRectCommon(BPoint poseLoc, const BColumn *column,
 	const BPoseView *view, float textWidth)
 {
@@ -211,45 +211,57 @@
 
 
 void
-BTextWidget::MouseUp(BRect bounds, BPoseView *view, BPose *pose, BPoint,
-	bool delayedEdit)
+BTextWidget::MouseUp(BRect bounds, BPoseView *view, BPose *pose, BPoint)
 {
-	// wait until a double click time to see if we are double clicking
-	// or selecting widget for editing
-	// start editing early if mouse left widget or modifier down
-	
-	if (!IsEditable())
-		return;
+	// Start editing without delay if the pose was selected recently and this
+	// click is not the second click of a doubleclick.
+	// If the pose has been selected a long time ago, check again
+	// for a double click (inducing a delay).
 
-	if (delayedEdit) {
-		bigtime_t doubleClickTime;
-		get_click_speed(&doubleClickTime);
-		doubleClickTime += system_time();
+	// TODO: re-enable modifiers, one should be enough
 
-		while (system_time() < doubleClickTime) {
-			// loop for double-click time and watch the mouse and keyboard
+	if (IsEditable() && pose->IsSelected()) {
+		bigtime_t delta = system_time() - pose->SelectionTime();
+		bigtime_t doubleClickSpeed;
+		get_click_speed(&doubleClickSpeed);
+		bigtime_t oldClickSpeed = 2 * doubleClickSpeed;
 
-			BPoint point;
-			uint32 buttons;
-			view->GetMouse(&point, &buttons, false);
-			if (buttons) 
-				// if mouse button goes down then a double click, exit
-				// without editing
-				return;
+		// freshly selected and not a double click
+		if (delta > doubleClickSpeed && delta < oldClickSpeed) {
+			StartEdit(bounds, view, pose);
+			return;
+		}
 
-			if (!bounds.Contains(point))
-				// mouse has moved outside of text widget so go into edit mode
-				break;
+		// TODO: reimplement asynchronous
+		// selected a longer time ago, redo a double click detection
+		if (delta > oldClickSpeed) {
+			// check for double click
+			bigtime_t doubleClickTime = system_time() + doubleClickSpeed;
+			while (system_time() < doubleClickTime) {
+				// loop for double-click time and watch the mouse and keyboard
 
-			if (modifiers() & (B_SHIFT_KEY | B_COMMAND_KEY | B_CONTROL_KEY | B_MENU_KEY))
-				// watch the keyboard (ignoring standard locking keys)
-				break;
+				BPoint point;
+				uint32 buttons;
+				view->GetMouse(&point, &buttons, false);
 
-			snooze(100000);
+				// double click
+				if (buttons)
+					return;
+
+				// mouse moved too far
+				if (!bounds.Contains(point))
+					return;
+
+				//if (modifiers() & (B_SHIFT_KEY | B_COMMAND_KEY
+				//	| B_CONTROL_KEY | B_MENU_KEY))
+				//	// watch the keyboard (ignoring standard locking keys)
+				//	break;
+
+				snooze(10000);
+			}
+			StartEdit(bounds, view, pose);
 		}
 	}
-
-	StartEdit(bounds, view, pose);
 }
 
 
@@ -359,7 +371,7 @@
 
 	BScrollView *scrollView = new BScrollView("BorderView", textView, 0, 0, false,
 		false, B_PLAIN_BORDER);
-	view->AddChild(scrollView);	 
+	view->AddChild(scrollView);
 
 	// configure text view
 	switch (view->ViewMode()) {
@@ -381,7 +393,7 @@
 	SetActive(true);				// for widget
 
 	textView->SelectAll();
-	textView->MakeFocus();	
+	textView->MakeFocus();
 
 	// make this text widget invisible while we edit it
 	SetVisible(false);
@@ -481,7 +493,7 @@
 //			drawView->FillRect(eraseRect, B_SOLID_LOW);
 			drawView->FillRect(textRect, B_SOLID_LOW);
 		} else
-			drawView->SetDrawingMode(B_OP_OVER);	
+			drawView->SetDrawingMode(B_OP_OVER);
 
 		// set high color
 		rgb_color highColor;
@@ -562,7 +574,7 @@
 
 			outlineColor.alpha = 200;
 			drawView->SetHighColor(outlineColor);
-	
+
 			drawView->DrawString(fittingText, loc + BPoint(1, 1));
 		}
 

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/TextWidget.h
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/TextWidget.h	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/TextWidget.h	2009-09-25 14:22:53 UTC (rev 33293)
@@ -56,8 +56,8 @@
 		// second call is used for offscreen drawing, where PoseView
 		// and current drawing view are different
 
-	void MouseUp(BRect bounds, BPoseView *, BPose *, BPoint mouseLoc,
-		bool delayedEdit);
+	void MouseUp(BRect bounds, BPoseView *, BPose *, BPoint mouseLoc);
+	
 	BRect CalcRect(BPoint poseLoc, const BColumn *, const BPoseView *);
 		// returns the rect derived from the formatted string width
 		// may force WidgetAttributeText recalculation

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/TrackerSettings.cpp
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/TrackerSettings.cpp	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/TrackerSettings.cpp	2009-09-25 14:22:53 UTC (rev 33293)
@@ -191,7 +191,7 @@
 	Add(fDateOrderFormat = new ScalarValueSetting("DateOrderFormat", 2, "", ""));
 	Add(f24HrClock = new BooleanValueSetting("24HrClock", false));
 
-	Add(fShowVolumeSpaceBar = new BooleanValueSetting("ShowVolumeSpaceBar", false));
+	Add(fShowVolumeSpaceBar = new BooleanValueSetting("ShowVolumeSpaceBar", true));
 
 	Add(fUsedSpaceColor = new HexScalarValueSetting("UsedSpaceColor", 0xc000cb00, "", ""));
 	Add(fFreeSpaceColor = new HexScalarValueSetting("FreeSpaceColor", 0xc0ffffff, "", ""));

Modified: haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/WidgetAttributeText.cpp
===================================================================
--- haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/WidgetAttributeText.cpp	2009-09-25 10:48:37 UTC (rev 33292)
+++ haiku/branches/developer/aldeck/tracker_refactor/src/kits/tracker/WidgetAttributeText.cpp	2009-09-25 14:22:53 UTC (rev 33293)
@@ -130,7 +130,7 @@
 	else if (strcmp(attrName, kAttrOriginalPath) == 0)
 		return new OriginalPathAttributeText(model, column);
 
-	return new GenericAttributeText(model, column);	
+	return new GenericAttributeText(model, column);
 }
 
 
@@ -179,7 +179,7 @@
 
 bool
 WidgetAttributeText::CheckSettingsChanged()
-{	
+{
 	return false;
 }
 
@@ -485,27 +485,27 @@
 					TruncateLeaf(&tmp);
 				} else
 					tmp = "-";
-		
+
 				if (width > 0) {
 					TruncStringBase(result, tmp.String(), tmp.Length(), view,
 						width);
 				} else
 					*result = tmp.String();
-				
+
 				return B_OK;
 			}
 			break;
-	
+
 		case kSizeType:
 //			TruncFileSizeBase(result, model->StatBuf()->st_size, view, width);
 			return B_OK;
 			break;
-		
+
 		default:
 			TRESPASS();
 			// not yet supported
 			return B_ERROR;
-	
+
 	}
 
 	TRESPASS();
@@ -594,7 +594,8 @@
 	if (fValueDirty)
 		ReadValue(&fFullValueText);
 
-	return NaturalCompare(fFullValueText.String(), compareTo->ValueAsText(view));
+	return NaturalCompare(fFullValueText.String(),
+		compareTo->ValueAsText(view));
 }
 
 
@@ -678,7 +679,8 @@
 	if (fValueDirty)
 		fValue = ReadValue();
 
-	return fValue >= compareTo->Value() ? (fValue == compareTo->Value() ? 0 : -1) : 1 ;
+	return fValue >= compareTo->Value()
+		? (fValue == compareTo->Value() ? 0 : 1) : -1;
 }
 
 
@@ -1102,7 +1104,7 @@
 
 bool
 TimeAttributeText::CheckSettingsChanged()
-{	
+{
 	bool changed = fLastClockIs24 != fSettings.ClockIs24Hr()
 		|| fLastDateOrder != fSettings.DateOrderFormat()
 		|| fLastTimeFormatSeparator != fSettings.TimeFormatSeparator();
@@ -1333,7 +1335,7 @@
 				fFullValueText.Length(), view, fOldWidth);
 			fDirty = false;
 			return;
-		
+
 		case B_OFF_T_TYPE:
 			// as a side effect update the fFullValueText to the string representation
 			// of value
@@ -1474,9 +1476,9 @@
 
 	// Sort undefined values last, regardless of the other value:
 	if (!fValueIsDefined)
-		return compareTo->fValueIsDefined ? -1 : 0;
+		return compareTo->fValueIsDefined ? 1 : 0;
 	if (!compareTo->fValueIsDefined)
-		return 1;
+		return -1;
 
 	switch (fColumn->AttrType()) {
 		case B_STRING_TYPE:
@@ -1486,61 +1488,61 @@
 		{
 			char vStr[2] = { static_cast<char>(fValue.uint8t), 0 };
 			char cStr[2] = { static_cast<char>(compareTo->fValue.uint8t), 0};
-		
+
 			BString valueStr(vStr);
 			BString compareToStr(cStr);
-		
+
 			return valueStr.ICompare(compareToStr);
 		}
 
 		case B_FLOAT_TYPE:
 			return fValue.floatt >= compareTo->fValue.floatt ?
-				(fValue.floatt == compareTo->fValue.floatt ? 0 : -1) : 1;
+				(fValue.floatt == compareTo->fValue.floatt ? 0 : 1) : -1;
 
 		case B_DOUBLE_TYPE:
 			return fValue.doublet >= compareTo->fValue.doublet ?
-				(fValue.doublet == compareTo->fValue.doublet ? 0 : -1) : 1;
+				(fValue.doublet == compareTo->fValue.doublet ? 0 : 1) : -1;
 
 		case B_BOOL_TYPE:
 			return fValue.boolt >= compareTo->fValue.boolt ?
-				(fValue.boolt == compareTo->fValue.boolt ? 0 : -1) : 1;
+				(fValue.boolt == compareTo->fValue.boolt ? 0 : 1) : -1;
 
 		case B_UINT8_TYPE:
 			return fValue.uint8t >= compareTo->fValue.uint8t ?
-				(fValue.uint8t == compareTo->fValue.uint8t ? 0 : -1) : 1;
+				(fValue.uint8t == compareTo->fValue.uint8t ? 0 : 1) : -1;
 
 		case B_INT8_TYPE:
 			return fValue.int8t >= compareTo->fValue.int8t ?
-					(fValue.int8t == compareTo->fValue.int8t ? 0 : -1) : 1;
+					(fValue.int8t == compareTo->fValue.int8t ? 0 : 1) : -1;
 

[... truncated: 133 lines follow ...]



More information about the Haiku-commits mailing list