marlin r1331 - trunk/marlin



Author: iain
Date: Sat Nov  1 01:37:39 2008
New Revision: 1331
URL: http://svn.gnome.org/viewvc/marlin?rev=1331&view=rev

Log:
Squashed commit of the following:

commit 6230696a4bc8758793e680a8fc10e8b011d5664b
Author: iain <iain gnome org>
Date:   Tue Oct 28 01:55:49 2008 +0000

    Add docs
    Remove whitespace

commit 2a1510cb98089eacc2fcd2efb287e52cb371f018
Author: iain <iain gnome org>
Date:   Tue Oct 28 01:37:36 2008 +0000

    Add a cscope target


Modified:
   trunk/marlin/marlin-sample-view.c
   trunk/marlin/marlin-undo-manager.c
   trunk/marlin/marlin-undoable.c

Modified: trunk/marlin/marlin-sample-view.c
==============================================================================
--- trunk/marlin/marlin-sample-view.c	(original)
+++ trunk/marlin/marlin-sample-view.c	Sat Nov  1 01:37:39 2008
@@ -1634,12 +1634,12 @@
 	MarlinSampleViewPrivate *priv;
 	GdkRectangle rect, inter;
 	int pixel_width;
-	
+
 	priv = view->priv;
 	widget = GTK_WIDGET (view);
 
 	pixel_width = (int) (priv->number_of_frames / priv->frames_per_pixel);
-	
+
 	/* Area of samples */
 	rect.x = 0;
 	rect.y = 0;
@@ -1658,7 +1658,7 @@
 
 	if (gdk_rectangle_intersect (area, &rect, &inter)) {
 		draw_dead_area (view, &inter, state_type);
-	} 
+	}
 
 	/* Draw markers */
 	draw_markers (view, area, state_type);
@@ -1678,14 +1678,14 @@
 }
 
 static int
-expose_event (GtkWidget *widget,
+expose_event (GtkWidget      *widget,
 	      GdkEventExpose *event)
 {
 	if (GTK_WIDGET_DRAWABLE (widget)) {
 		MarlinSampleView *view = MARLIN_SAMPLE_VIEW (widget);
 		GdkRectangle *rects;
 		int i, n_rects;
-		
+
 		gdk_region_get_rectangles (event->region, &rects, &n_rects);
 		for (i = 0; i < n_rects; i++) {
 			_marlin_sample_view_paint (view, &rects[i],
@@ -1706,17 +1706,17 @@
 	guint64 start, finish;
 	int ds, de;
 
-	marlin_sample_selection_get (view->priv->selection, NULL, 
+	marlin_sample_selection_get (view->priv->selection, NULL,
 				     &start, &finish);
 
 	ds = (position - start) / view->priv->frames_per_pixel;
 	de = (position -  finish) / view->priv->frames_per_pixel;
-	
+
 	if (abs (ds) <= THRESHOLD ||
 	    abs (de) <= THRESHOLD) {
 		return TRUE;
 	}
-	
+
 	return FALSE;
 }
 
@@ -1728,7 +1728,7 @@
 	MarlinSampleViewPrivate *priv;
 	GdkRectangle window_area, sub_area, inter;
 	guint64 old_start, old_end, length, min_start, max_end;
-	
+
 	priv = view->priv;
 
 	length = priv->sel_finish - priv->sel_start;
@@ -1742,7 +1742,7 @@
 	} else {
 		return;
 	}
-	
+
 	marlin_sample_selection_set (priv->selection, priv->sel_coverage,
 				     priv->sel_start, priv->sel_finish,
 				     NULL);
@@ -1751,16 +1751,16 @@
 	window_area.width = widget->allocation.width;
 	window_area.y = 0;
 	window_area.height = widget->allocation.height;
-	
+
 	/* Redraw the area from min_start -> max_end */
 	min_start = MIN (priv->sel_start, old_start);
 	max_end = MAX (priv->sel_finish, old_end);
-	
+
 	sub_area.x = (int) (min_start / priv->frames_per_pixel) - priv->xofs;
 	sub_area.width = (int) (max_end - min_start) / priv->frames_per_pixel;
 	sub_area.y = 0;
 	sub_area.height = widget->allocation.height;
-	
+
 	if (gdk_rectangle_intersect (&window_area, &sub_area, &inter)) {
 		gdk_window_invalidate_rect (widget->window, &inter, FALSE);
 	}
@@ -1793,7 +1793,7 @@
 
 	old_start = priv->sel_start;
 	old_end = priv->sel_finish;
-	
+
 	priv->sel_coverage = coverage;
 
 	if (position < priv->sel_start ||
@@ -1803,10 +1803,10 @@
 	} else {
 		if (priv->in_selection == FALSE) {
 			guint64 ds, de;
-			
+
 			ds = position - priv->sel_start;
 			de = priv->sel_finish - position;
-			
+
 			if (ds < de) {
 				priv->sel_start = start = position;
 				finish = priv->sel_finish;
@@ -1833,16 +1833,16 @@
 	window_area.width = widget->allocation.width;
 	window_area.y = 0;
 	window_area.height = widget->allocation.height;
-	
+
 	/* Redraw the area from min_start -> max_end */
 	min_start = MIN (start, old_start);
 	max_end = MAX (finish, old_end);
-	
+
 	sub_area.x = (int) (min_start / priv->frames_per_pixel) - priv->xofs;
 	sub_area.width = (int) (max_end - min_start) / priv->frames_per_pixel;
 	sub_area.y = 0;
 	sub_area.height = widget->allocation.height;
-	
+
 	if (gdk_rectangle_intersect (&window_area, &sub_area, &inter)) {
 		gdk_window_invalidate_rect (widget->window, &inter, FALSE);
 	}
@@ -1862,7 +1862,7 @@
 	float value;
 	MarlinCoverage coverage;
 	gint64 position;
-	
+
 	priv = view->priv;
 
 	gdk_window_get_pointer (widget->window, &x, &y, NULL);
@@ -1880,7 +1880,7 @@
 
 	value = priv->hadj->value + x_scroll;
 	doc_width = priv->number_of_frames / priv->frames_per_pixel;
-	
+
 	if (doc_width > widget->allocation.width) {
 		max = doc_width - widget->allocation.width;
 	} else {
@@ -1890,7 +1890,7 @@
 	value = CLAMP (value, 0.0, (float) max);
 	gtk_adjustment_set_value (priv->hadj, value);
 	priv->xofs = value;
-	
+
 	channel_height = widget->allocation.height / priv->number_of_channels;
 	if (priv->number_of_channels == 1) {
 		coverage = MARLIN_COVERAGE_BOTH;
@@ -1912,10 +1912,10 @@
 		move_selection (view, position - priv->grab_position);
 		priv->grab_position = position;
 	}
-	
+
 	return TRUE;
 }
-	
+
 static void
 setup_scroll_timeout (MarlinSampleView *view)
 {

Modified: trunk/marlin/marlin-undo-manager.c
==============================================================================
--- trunk/marlin/marlin-undo-manager.c	(original)
+++ trunk/marlin/marlin-undo-manager.c	Sat Nov  1 01:37:39 2008
@@ -107,12 +107,11 @@
 	GList *p;
 
 	READ_LOCK (ctxt->lock);
-	for (p = ctxt->undoables; p; p = p->next) {
-		MarlinUndoable *u = p->data;
 
-		if (u->undo) {
-			u->undo (u->closure);
-		}
+	/* Work through the undoables in the context, calling their undo
+	   function */
+	for (p = ctxt->undoables; p; p = p->next) {
+		marlin_undoable_undo (p->data);
 	}
 	READ_UNLOCK (ctxt->lock);
 }
@@ -123,12 +122,11 @@
 	GList *p;
 
 	READ_LOCK (ctxt->lock);
-	for (p = g_list_last (ctxt->undoables); p; p = p->prev) {
-		MarlinUndoable *u = p->data;
 
-		if (u->redo) {
-			u->redo (u->closure);
-		}
+	/* Work though the undoables in the context backwards, calling
+	   their redo function */
+	for (p = g_list_last (ctxt->undoables); p; p = p->prev) {
+		marlin_undoable_redo (p->data);
 	}
 	READ_UNLOCK (ctxt->lock);
 }
@@ -307,6 +305,10 @@
  * @manager: A #MarlinUndoManager object
  * @name: The name of the MarlinUndoContext
  *
+ * Begins a new context in @manager called @name. If a context is already
+ * in progress, then the current context will be returned.
+ *
+ * Return value: A #MarlinUndoContext struct.
  */
 MarlinUndoContext *
 marlin_undo_manager_context_begin (MarlinUndoManager *manager,
@@ -334,6 +336,14 @@
 	return ctxt;
 }
 
+/**
+ * marlin_undo_manager_context_end:
+ * @manager: A #MarlinUndoManager object
+ * @ctxt: A #MarlinUndoContext
+ *
+ * Ends @ctxt adding it to the undo/redo list managed by @manager, then emits
+ * the changed signal.
+ */
 void
 marlin_undo_manager_context_end (MarlinUndoManager *manager,
 				 MarlinUndoContext *ctxt)
@@ -390,6 +400,13 @@
 	g_signal_emit (manager, signals[CHANGED], 0);
 }
 
+/**
+ * marlin_undo_manager_context_cancel:
+ * @manager: A #MarlinUndoManager object
+ * @ctxt: A #MarlinUndoContext
+ *
+ * Cancels @ctxt freeing it.
+ */
 void
 marlin_undo_manager_context_cancel (MarlinUndoManager *manager,
 				    MarlinUndoContext *ctxt)
@@ -400,6 +417,12 @@
 	context_free (ctxt);
 }
 
+/**
+ * marlin_undo_manager_undo:
+ * @manager: A #MarlinUndoManager object
+ *
+ * Undoes the next item in the undo list and emits the changed signal.
+ */
 void
 marlin_undo_manager_undo (MarlinUndoManager *manager)
 {
@@ -412,6 +435,12 @@
 	}
 }
 
+/**
+ * marlin_undo_manager_redo:
+ * @manager: A #MarlinUndoManager object
+ *
+ * Redoes the next item in the redo list and emits the changed signal.
+ */
 void
 marlin_undo_manager_redo (MarlinUndoManager *manager)
 {
@@ -472,6 +501,13 @@
 	return history;
 }
 
+/**
+ * marlin_undo_manager_free_history_list:
+ * @history_list: A #GList containing #MarlinUndoHistory structs
+ *
+ * Frees a list of #MarlinUndoHistory structs that is returned from
+ * marlin_undo_manager_get_history.
+ */
 void
 marlin_undo_manager_free_history_list (GList *history_list)
 {

Modified: trunk/marlin/marlin-undoable.c
==============================================================================
--- trunk/marlin/marlin-undoable.c	(original)
+++ trunk/marlin/marlin-undoable.c	Sat Nov  1 01:37:39 2008
@@ -26,11 +26,24 @@
 
 #include <marlin/marlin-undoable.h>
 
+/**
+ * marlin_undoable_new:
+ * @undo: A #MarlinUndoableFunc
+ * @redo: A #MarlinUndoableFunc
+ * @destroy: A #MarlinUndoableFunc
+ * @closure: Userdata that will be passed to the functions
+ *
+ * Creates a #MarlinUndoable struct that will be undone by calling @undo,
+ * redone via @redo and @destroy will be called when it is freed. @closure
+ * will be passed into the functions.
+ *
+ * Return value: A newly allocated #MarlinUndoable
+ */
 MarlinUndoable *
 marlin_undoable_new (MarlinUndoableFunc undo,
 		     MarlinUndoableFunc redo,
 		     MarlinUndoableFunc destroy,
-		     gpointer closure)
+		     gpointer           closure)
 {
 	MarlinUndoable *u;
 



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