genius r746 - in trunk: . src



Author: jirka
Date: Thu Mar  5 07:48:06 2009
New Revision: 746
URL: http://svn.gnome.org/viewvc/genius?rev=746&view=rev

Log:

Thu Mar 05 01:47:55 2009  Jiri (George) Lebl <jirka 5z com>

	* src/graphing.c: LinePlotDrawLegends parameter actually updates
	  the legends drawing in real time.  Don't store the parameter value
	  as an extra.

	* src/graphing.c: always update spinboxes before plotting something
	  not just on activate.



Modified:
   trunk/ChangeLog
   trunk/src/graphing.c

Modified: trunk/src/graphing.c
==============================================================================
--- trunk/src/graphing.c	(original)
+++ trunk/src/graphing.c	Thu Mar  5 07:48:06 2009
@@ -141,7 +141,6 @@
 
 static gboolean lineplot_draw_legends = TRUE;
 static gboolean lineplot_draw_legends_cb = TRUE;
-static gboolean lineplot_draw_legends_parameter = TRUE;
 static gboolean vectorfield_normalize_arrow_length = FALSE;
 static gboolean vectorfield_normalize_arrow_length_cb = FALSE;
 static gboolean vectorfield_normalize_arrow_length_parameter = FALSE;
@@ -293,6 +292,27 @@
 	/* errors? */
 }
 
+/* FIXME: This seems like a rather ugly hack, am I missing something about
+ * spinboxes or are they really this stupid */
+static void
+update_spinboxes (GtkWidget *w)
+{
+	if (GTK_IS_SPIN_BUTTON (w))
+		gtk_spin_button_update (GTK_SPIN_BUTTON (w));
+	else if (GTK_IS_CONTAINER (w)) {
+		GList *children, *li;
+
+		children = gtk_container_get_children (GTK_CONTAINER (w));
+
+		for (li = children; li != NULL; li = li->next) {
+			update_spinboxes (li->data);
+		}
+
+		g_list_free (children);
+	}
+}
+
+
 static void
 plot_window_setup (void)
 {
@@ -1499,6 +1519,7 @@
 solver_dialog_response (GtkWidget *w, int response, gpointer data)
 {
 	if (response == RESPONSE_PLOT) {
+		update_spinboxes (w);
 		if (plot_mode == MODE_LINEPLOT_SLOPEFIELD)
 			slopefield_draw_solution (solver_x, solver_y, solver_xinc);
 		else
@@ -3716,8 +3737,6 @@
 				  w1);
 	}
 	g_signal_connect (G_OBJECT (w), "activate",
-			  G_CALLBACK (gtk_spin_button_update), NULL);
-	g_signal_connect (G_OBJECT (w), "activate",
 			  G_CALLBACK (activate_callback), NULL);
 	gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (w), TRUE);
 	gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (w), GTK_UPDATE_ALWAYS);
@@ -3744,8 +3763,6 @@
 					  w2);
 		}
 		g_signal_connect (G_OBJECT (w), "activate",
-				  G_CALLBACK (gtk_spin_button_update), NULL);
-		g_signal_connect (G_OBJECT (w), "activate",
 				  G_CALLBACK (activate_callback), NULL);
 		gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (w), TRUE);
 		gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (w), GTK_UPDATE_ALWAYS);
@@ -3773,8 +3790,6 @@
 					  wb);
 		}
 		g_signal_connect (G_OBJECT (w), "activate",
-				  G_CALLBACK (gtk_spin_button_update), NULL);
-		g_signal_connect (G_OBJECT (w), "activate",
 				  G_CALLBACK (activate_callback), NULL);
 		gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (w), TRUE);
 		gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (w), GTK_UPDATE_ALWAYS);
@@ -4991,6 +5006,7 @@
 		gtk_widget_destroy (plot_dialog);
 	} else if (response == RESPONSE_PLOT) {
 		int pg = gtk_notebook_get_current_page (GTK_NOTEBOOK (plot_notebook));
+		update_spinboxes (w);
 		if (pg == 0 /* line plot */)
 			plot_from_dialog ();
 		else if (pg == 1 /* surface plot */)
@@ -5384,8 +5400,6 @@
 	reset_ploty1 = ploty1 = y1;
 	reset_ploty2 = ploty2 = y2;
 
-	lineplot_draw_legends = lineplot_draw_legends_parameter;
-
 	plot_mode = MODE_LINEPLOT_SLOPEFIELD;
 	plot_functions (FALSE /* do_window_present */);
 
@@ -5499,7 +5513,6 @@
 	reset_ploty1 = ploty1 = y1;
 	reset_ploty2 = ploty2 = y2;
 
-	lineplot_draw_legends = lineplot_draw_legends_parameter;
 	vectorfield_normalize_arrow_length =
 		vectorfield_normalize_arrow_length_parameter;
 
@@ -5620,8 +5633,6 @@
 	reset_ploty1 = ploty1 = y1;
 	reset_ploty2 = ploty2 = y2;
 
-	lineplot_draw_legends = lineplot_draw_legends_parameter;
-
 	plot_mode = MODE_LINEPLOT;
 	plot_functions (FALSE /* do_window_present */);
 
@@ -5765,8 +5776,6 @@
 	plott2 = t2;
 	plottinc = tinc;
 
-	lineplot_draw_legends = lineplot_draw_legends_parameter;
-
 	plot_mode = MODE_LINEPLOT_PARAMETRIC;
 	plot_functions (FALSE /* do_window_present */);
 
@@ -5906,8 +5915,6 @@
 	plott2 = t2;
 	plottinc = tinc;
 
-	lineplot_draw_legends = lineplot_draw_legends_parameter;
-
 	plot_mode = MODE_LINEPLOT_PARAMETRIC;
 	plot_functions (FALSE /* do_window_present */);
 
@@ -6485,17 +6492,26 @@
 	if G_UNLIKELY ( ! check_argument_bool (&a, 0, "set_LinePlotDrawLegend"))
 		return NULL;
 	if (a->type == VALUE_NODE)
-		lineplot_draw_legends_parameter
+		lineplot_draw_legends
 			= ! mpw_zero_p (a->val.value);
 	else /* a->type == BOOL_NODE */
-		lineplot_draw_legends_parameter = a->bool_.bool_;
+		lineplot_draw_legends = a->bool_.bool_;
+
+	if (line_plot != NULL) {
+		if (lineplot_draw_legends)
+			gtk_plot_show_legends (GTK_PLOT (line_plot));
+		else
+			gtk_plot_hide_legends (GTK_PLOT (line_plot));
+
+		line_plot_move_about ();
+	}
 
-	return gel_makenum_bool (lineplot_draw_legends_parameter);
+	return gel_makenum_bool (lineplot_draw_legends);
 }
 static GelETree *
 get_LinePlotDrawLegends (void)
 {
-	return gel_makenum_bool (lineplot_draw_legends_parameter);
+	return gel_makenum_bool (lineplot_draw_legends);
 }
 
 void



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