marlin r1317 - trunk/marlin



Author: iain
Date: Sun Oct 19 01:35:46 2008
New Revision: 1317
URL: http://svn.gnome.org/viewvc/marlin?rev=1317&view=rev

Log:
Prevent crashes whenever entire sample has been selected


Modified:
   trunk/marlin/ChangeLog
   trunk/marlin/marlin-sample-view.c

Modified: trunk/marlin/marlin-sample-view.c
==============================================================================
--- trunk/marlin/marlin-sample-view.c	(original)
+++ trunk/marlin/marlin-sample-view.c	Sun Oct 19 01:35:46 2008
@@ -1947,9 +1947,9 @@
 		     guint64 *end_mark)
 {
 	GList *markers;
-	
+
 	*start_mark = 0;
-	*end_mark = view->priv->number_of_frames;
+	*end_mark = view->priv->number_of_frames - 1;
 
 	for (markers = view->priv->markers; markers; markers = markers->next) {
 		struct _VMarker *vm = markers->data;
@@ -2351,10 +2351,10 @@
 	priv->toplevel_motion_notify_handler_id =
 		g_signal_connect (toplevel, "motion-notify-event",
 				  G_CALLBACK (toplevel_motion_notify_cb), view);
-	priv->toplevel_button_release_handler_id = 
+	priv->toplevel_button_release_handler_id =
 		g_signal_connect (toplevel, "button-release-event",
 				  G_CALLBACK (toplevel_button_release_cb), view);
-	priv->grab_notify_handler_id = 
+	priv->grab_notify_handler_id =
 		g_signal_connect (view, "grab-notify",
 				  G_CALLBACK (grab_notify_cb), view);
 
@@ -2373,7 +2373,7 @@
 	int y, channel_height;
 	guint64 position;
 	guint64 start_mark, end_mark;
-	
+
 	/* Grab focus back */
 	gtk_widget_grab_focus (widget);
 
@@ -2385,7 +2385,7 @@
 	}
 
 	channel_height = widget->allocation.height / priv->number_of_channels;
-	
+
 	y = event->y;
 	if (priv->number_of_channels == 1) {
 		priv->cursor->coverage = MARLIN_COVERAGE_BOTH;
@@ -2400,7 +2400,7 @@
 	}
 
 	position = (event->x + priv->xofs) * priv->frames_per_pixel;
-	
+
 	if (position > priv->number_of_frames) {
 		/* We're in the dead area...
 		   We don't care about clicks here */
@@ -2416,7 +2416,7 @@
 				/* Don't do anything */
 			} else if (can_expand_selection (view, position)) {
 				GdkCursor *cursor;
-				
+
 				cursor = marlin_cursor_get (widget, LEFT_RIGHT_ARROW);
 				gdk_pointer_grab (widget->window, FALSE,
 						  GDK_POINTER_MOTION_MASK |
@@ -2427,7 +2427,7 @@
 
 				priv->in_selection = FALSE;
 				priv->expand = TRUE;
-	
+
  				priv->sel_initial = position;
 				priv->sel_ctxt = marlin_undo_manager_context_begin (priv->undo, _("Select Region"));
 				marlin_sample_selection_get (priv->selection,
@@ -2441,16 +2441,16 @@
 									   priv->cursor->coverage,
 									   position) == FALSE) {
 				GdkCursor *cursor;
-				
+
 				move_cursor (view, position, FALSE);
 				/* Clear the previous selection */
 				if (event->state & GDK_SHIFT_MASK) {
 					/* Nothing yet...*/
 				} else {
 					priv->sel_ctxt = marlin_undo_manager_context_begin (priv->undo, _("Select Region"));
- 					marlin_sample_selection_clear (selection, priv->sel_ctxt); 
-				} 
-			
+ 					marlin_sample_selection_clear (selection, priv->sel_ctxt);
+				}
+
 				/* Start a grab for creating a selection */
 				cursor = marlin_cursor_get (widget, LEFT_RIGHT_ARROW);
 				gdk_pointer_grab (widget->window, FALSE,
@@ -2459,16 +2459,16 @@
 						  GDK_BUTTON_RELEASE_MASK,
 						  NULL, cursor, event->time);
 				gdk_cursor_unref (cursor);
-				
+
 				priv->in_selection = TRUE;
 				priv->expand = TRUE;
 
 #if 0
 				/* FIXME: Implement custom undo */
-				marlin_sample_selection_set (selection, 
+				marlin_sample_selection_set (selection,
 							     priv->cursor->coverage,
 							     position,
-							     
+
 							     position + priv->frames_per_pixel - 1,
 							     NULL);
 #endif
@@ -2486,7 +2486,7 @@
 
 				if (event->state & GDK_SHIFT_MASK) {
 					GdkCursor *cursor;
-					
+
 					cursor = marlin_cursor_get (widget, HAND_CLOSED);
 					gdk_pointer_grab (widget->window,
 							  FALSE,
@@ -2495,7 +2495,7 @@
 							  GDK_BUTTON_RELEASE_MASK,
 							  NULL, cursor, event->time);
 					gdk_cursor_unref (cursor);
-					
+
 					priv->moving_selection = TRUE;
 					priv->grab_position = position;
 



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