[goffice] Update property page when style changes after reordering. [#604229]



commit ecac19cd180a7f92711becdaabd9f4f782d1f994
Author: Jean Brefort <jean brefort normalesup org>
Date:   Thu Dec 10 14:47:33 2009 +0100

    Update property page when style changes after reordering. [#604229]

 ChangeLog                               |   14 +++---
 NEWS                                    |    1 +
 docs/reference/goffice-0.8-sections.txt |    1 +
 goffice/gtk/go-marker-selector.c        |   17 +++++++
 goffice/gtk/go-marker-selector.h        |    2 +
 goffice/utils/go-style.c                |   73 ++++++++++++++++++++++++++-----
 6 files changed, 91 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4042e49..16b7da3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,11 @@
-2009-12-09  Jean Brefort  <jean brefort normalesup org>
-
-	reviewed by: <delete if not using a buddy>
-
-	* goffice/canvas/goc-graph.c (goc_graph_do_tooltip):
-	* goffice/graph/gog-view.c (gog_view_get_view_at_point):
+2009-12-10  Jean Brefort  <jean brefort normalesup org>
+
+	* docs/reference/goffice-0.8-sections.txt: add new function.
+	* goffice/gtk/go-marker-selector.c (go_marker_selector_set_shape): ditto.
+	* goffice/gtk/go-marker-selector.h: ditto.
+	* goffice/utils/go-style.c (outline_init), (line_init),
+	(marker_init), (cb_style_changed): update property page after style changes
+	when reordering. [#604229]
 
 2009-12-09  Jean Brefort  <jean brefort normalesup org>
 
diff --git a/NEWS b/NEWS
index dffdc36..5a2e984 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ goffice 0.7.17:
 
 Jean:
 	* Fixed a canvas perfomrance issue. [#603813]
+	+ Update property page when style changes after reordering. [#604229]
 
 Jody:
 	* Fix context sensitive help support on win32.
diff --git a/docs/reference/goffice-0.8-sections.txt b/docs/reference/goffice-0.8-sections.txt
index 3a3787b..7a44ced 100644
--- a/docs/reference/goffice-0.8-sections.txt
+++ b/docs/reference/goffice-0.8-sections.txt
@@ -1758,6 +1758,7 @@ go_marker_create_cairo_surface
 go_marker_render
 go_marker_selector_new
 go_marker_selector_set_colors
+go_marker_selector_set_shape
 </SECTION>
 
 <SECTION>
diff --git a/goffice/gtk/go-marker-selector.c b/goffice/gtk/go-marker-selector.c
index bd47ce2..8b34c17 100644
--- a/goffice/gtk/go-marker-selector.c
+++ b/goffice/gtk/go-marker-selector.c
@@ -111,3 +111,20 @@ go_marker_selector_set_colors (GOSelector *selector, GOColor outline, GOColor fi
 	state->fill_color = fill;
 	go_selector_update_swatch (selector);
 }
+
+/**
+ * go_marker_selector_set_shape:
+ * @selector: a #GOSelector
+ * @shape: new marker shape
+ *
+ * Updates marker shape of @selector.
+ **/
+void
+go_marker_selector_set_shape (GOSelector *selector, GOMarkerShape shape)
+{
+	g_return_if_fail (GO_IS_SELECTOR (selector));
+
+	go_selector_set_active (GO_SELECTOR (selector),
+				CLAMP (shape, 0, GO_MARKER_MAX - 1));
+	go_selector_update_swatch (selector);
+}
diff --git a/goffice/gtk/go-marker-selector.h b/goffice/gtk/go-marker-selector.h
index 4b85e55..1212ec4 100644
--- a/goffice/gtk/go-marker-selector.h
+++ b/goffice/gtk/go-marker-selector.h
@@ -31,6 +31,8 @@ GtkWidget	*go_marker_selector_new		(GOMarkerShape initial_shape,
 void 		 go_marker_selector_set_colors  (GOSelector *selector,
 						 GOColor outline,
 						 GOColor fill);
+void		 go_marker_selector_set_shape   (GOSelector *selector,
+						 GOMarkerShape shape);
 
 G_END_DECLS
 
diff --git a/goffice/utils/go-style.c b/goffice/utils/go-style.c
index 06d80cb..4cb2ba3 100644
--- a/goffice/utils/go-style.c
+++ b/goffice/utils/go-style.c
@@ -83,17 +83,17 @@ typedef struct {
 		} image;
 	} fill;
 	struct {
+		GtkWidget *color;
+	} line;
+	struct {
 		GtkWidget *selector;
+		GtkWidget *fill;
+		GtkWidget *outline;
 	} marker;
 	GODoc *doc;
 } StylePrefState;
 
 static void
-cb_style_changed (GOStyledObject *obj, GOStyle *style, StylePrefState *state)
-{
-}
-
-static void
 set_style (StylePrefState const *state)
 {
 	if (state->object_with_style != NULL) {
@@ -219,7 +219,7 @@ outline_init (StylePrefState *state, gboolean enable, GOEditor *editor)
 		"value_changed",
 		G_CALLBACK (cb_outline_size_changed), state);
 	/* Color */
-	w = create_go_combo_color (state,
+	state->line.color = w = create_go_combo_color (state,
 		style->line.color, default_style->line.color,
 		state->gui,
 		"outline_color", "outline_color_label",
@@ -295,7 +295,7 @@ line_init (StylePrefState *state, gboolean enable, GOEditor *editor)
 		G_CALLBACK (cb_line_size_changed), state);
 
 	/* Colour */
-	w = create_go_combo_color (state,
+	state->line.color = w = create_go_combo_color (state,
 		style->line.color, default_style->line.color,
 		state->gui,
 		"line_color", "line_color_label",
@@ -763,13 +763,13 @@ marker_init (StylePrefState *state, gboolean enable, GOEditor *editor, GOCmdCont
 	gtk_widget_show (selector);
 
 	if ((style->interesting_fields & GO_STYLE_MARKER_NO_COLOR ) == 0)
-		w = create_go_combo_color (state,
+		state->marker.fill = w = create_go_combo_color (state,
 			go_marker_get_fill_color (style->marker.mark),
 			go_marker_get_fill_color (default_style->marker.mark),
 			gui, "pattern_background", "marker_fill_label",
 			G_CALLBACK (cb_marker_fill_color_changed));
 	else {
-		w = create_go_combo_color (state,
+		state->marker.fill = w = create_go_combo_color (state,
 			GO_COLOR_BLUE, GO_COLOR_BLUE,
 			gui, "pattern_background", "marker_fill_label",
 			G_CALLBACK (cb_marker_fill_color_changed));
@@ -778,13 +778,13 @@ marker_init (StylePrefState *state, gboolean enable, GOEditor *editor, GOCmdCont
 	gtk_table_attach (GTK_TABLE (table), w, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
 
 	if ((style->interesting_fields & GO_STYLE_MARKER_NO_COLOR ) == 0)
-		w = create_go_combo_color (state,
+		state->marker.outline = w = create_go_combo_color (state,
 			go_marker_get_outline_color (style->marker.mark),
 			go_marker_get_outline_color (default_style->marker.mark),
 			gui, "pattern_foreground", "marker_outline_label",
 			G_CALLBACK (cb_marker_outline_color_changed));
 	else {
-		w = create_go_combo_color (state,
+		state->marker.outline = w = create_go_combo_color (state,
 			GO_COLOR_BLUE, GO_COLOR_BLUE,
 			gui, "pattern_background", "marker_fill_label",
 			G_CALLBACK (cb_marker_outline_color_changed));
@@ -938,6 +938,57 @@ go_style_pref_state_free (StylePrefState *state)
 	g_free (state);
 }
 
+static void
+cb_style_changed (GOStyledObject *obj, GOStyle *style, StylePrefState *state)
+{
+	if (style->interesting_fields & GO_STYLE_FILL)
+		fill_update_selectors (state);
+	if (style->interesting_fields & GO_STYLE_LINE) {
+		g_signal_handlers_block_by_func (state->line.color, cb_line_color_changed,
+						 (gpointer) state);
+		go_color_selector_set_color (GO_SELECTOR (state->line.color),
+					     style->line.color);
+		g_signal_handlers_unblock_by_func (state->line.color, cb_line_color_changed,
+						 (gpointer) state);
+	}
+	if (style->interesting_fields & GO_STYLE_OUTLINE) {
+		g_signal_handlers_block_by_func (state->line.color, cb_outline_color_changed,
+						 (gpointer) state);
+		go_color_selector_set_color (GO_SELECTOR (state->line.color),
+					     style->line.color);
+		g_signal_handlers_unblock_by_func (state->line.color, cb_outline_color_changed,
+						 (gpointer) state);
+	}
+	if (style->interesting_fields & GO_STYLE_MARKER) {
+		g_signal_handlers_block_by_func (state->marker.selector, cb_marker_shape_changed,
+						 (gpointer) state);
+		go_marker_selector_set_shape (GO_SELECTOR (state->marker.selector),
+					       go_marker_get_shape (style->marker.mark));
+		if ((style->interesting_fields & GO_STYLE_MARKER_NO_COLOR )== 0)
+			go_marker_selector_set_colors (GO_SELECTOR (state->marker.selector),
+						       go_marker_get_outline_color (style->marker.mark),
+						       go_marker_get_fill_color (style->marker.mark));
+		else
+			go_marker_selector_set_colors (GO_SELECTOR (state->marker.selector),
+						       GO_COLOR_BLUE, GO_COLOR_BLUE);
+		g_signal_handlers_unblock_by_func (state->marker.selector, cb_marker_shape_changed,
+						 (gpointer) state);
+		g_signal_handlers_block_by_func (state->marker.fill, cb_marker_fill_color_changed,
+						 (gpointer) state);
+		go_color_selector_set_color (GO_SELECTOR (state->marker.fill),
+					     go_marker_get_fill_color (style->marker.mark));
+		g_signal_handlers_unblock_by_func (state->marker.fill, cb_marker_fill_color_changed,
+						 (gpointer) state);
+		g_signal_handlers_block_by_func (state->marker.outline, cb_marker_outline_color_changed,
+						 (gpointer) state);
+		go_color_selector_set_color (GO_SELECTOR (state->marker.outline),
+					     go_marker_get_outline_color (style->marker.mark));
+		g_signal_handlers_unblock_by_func (state->marker.outline, cb_marker_outline_color_changed,
+						 (gpointer) state);
+	}
+
+}
+
 void
 go_style_populate_editor (GOStyle *style,
 			   GOEditor *editor,



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