Icon View patch



While starting to look at the patch from Lee Willis for DnD photos to
tag (excellent idea!), I make some corrections to his selection code in
IconView.cs. The selection now behaves like selecting files in nautilus.
If you drag many files to The Gimp, it will open all of them.

Here is the patch to apply to the current head IconView.cs .

I hope Larry Ewing or someone that have commit capabilities will soon
take a look to the patch and give back his opinion. I want to spend some
time working on f-spot but the lack of communication on the mailing-list
isn't encouraging.

-- 
MOREAU Vincent <vmoreau orange fr>
--- src/IconView.cs	2004-06-06 21:02:23.000000000 +0000
+++ src/IconView.cs	2004-06-07 22:10:58.000000000 +0000
@@ -601,21 +601,21 @@
 			if (args.Event.Button != 1
 			    || (args.Event.State &  (ModifierType.ControlMask
 						     | ModifierType.ShiftMask)) != 0)
-				return;
+				break;
 			if (DoubleClicked != null)
 				DoubleClicked (this, cell_num);
-			return;
+			break;
 
 		case EventType.ButtonPress:
 			if (args.Event.Button != 1)
-				return;
+				break;
 
 			GrabFocus ();
 			if ((args.Event.State & ModifierType.ControlMask) != 0) {
 				ToggleCell (cell_num);
 			} else if ((args.Event.State & ModifierType.ShiftMask) != 0) {
 				SelectCellRange (focus_cell, cell_num);
-			} else {
+			} else if(!CellIsSelected(cell_num)){
 				UnselectAllCells ();
 				SelectCell (cell_num);
 			}
@@ -629,11 +629,11 @@
 
 			focus_cell = cell_num;
 
-			return;
+			break;
 
 		default:
 			args.RetVal = false;
-			return;
+			break;
 		}
 	}
 
@@ -641,6 +641,32 @@
 	{
 		Gdk.Pointer.Ungrab (args.Event.Time);
 		in_drag = false;
+		
+		int cell_num = CellAtPosition ((int) args.Event.X, (int) args.Event.Y);
+
+		args.RetVal = true;
+
+		if (cell_num < 0) {
+			args.RetVal = false;
+			return;
+		}
+		
+		switch (args.Event.Type) {
+			case EventType.ButtonRelease:
+				if ((args.Event.State & ModifierType.ControlMask) == 0 &&
+				    (args.Event.State & ModifierType.ShiftMask  ) == 0 &&
+					(selected_cells.Count>1)) {
+					UnselectAllCells ();
+					SelectCell (cell_num);
+				}
+	
+				break;
+
+			default:
+				args.RetVal = false;
+				break;
+		}
+					
 	}
 
  	private void HandleMotionNotifyEvent (object sender, MotionNotifyEventArgs args)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]