static void gimp_color_notebook_switch_page (GtkNotebook *gtk_notebook, gpointer page, guint page_num, GimpColorNotebook *notebook) { GimpColorSelector *selector = GIMP_COLOR_SELECTOR (notebook); GtkWidget *page_widget; page_widget = gtk_notebook_get_nth_page (gtk_notebook, page_num); notebook->cur_page = GIMP_COLOR_SELECTOR (page_widget); g_signal_handlers_block_by_func (notebook->cur_page, gimp_color_notebook_color_changed, notebook); g_signal_handlers_block_by_func (notebook->cur_page, gimp_color_notebook_channel_changed, notebook); gimp_color_selector_set_color (notebook->cur_page, &selector->rgb, &selector->hsv); gimp_color_selector_set_channel (notebook->cur_page, selector->channel); g_signal_handlers_unblock_by_func (notebook->cur_page, gimp_color_notebook_color_changed, notebook); g_signal_handlers_unblock_by_func (notebook->cur_page, gimp_color_notebook_channel_changed, notebook); }
static void gimp_color_notebook_set_color (GimpColorSelector *selector, const GimpRGB *rgb, const GimpHSV *hsv) { GimpColorNotebook *notebook = GIMP_COLOR_NOTEBOOK (selector); g_signal_handlers_block_by_func (notebook->cur_page, gimp_color_notebook_color_changed, notebook); gimp_color_selector_set_color (notebook->cur_page, rgb, hsv); g_signal_handlers_unblock_by_func (notebook->cur_page, gimp_color_notebook_color_changed, notebook); }
GtkWidget * gimp_color_selector_new (GType selector_type, const GimpRGB *rgb, const GimpHSV *hsv, GimpColorSelectorChannel channel) { GimpColorSelector *selector; g_return_val_if_fail (g_type_is_a (selector_type, GIMP_TYPE_COLOR_SELECTOR), NULL); g_return_val_if_fail (rgb != NULL, NULL); g_return_val_if_fail (hsv != NULL, NULL); selector = g_object_new (selector_type, NULL); gimp_color_selector_set_color (selector, rgb, hsv); gimp_color_selector_set_channel (selector, channel); return GTK_WIDGET (selector); }
static void gimp_color_selection_update (GimpColorSelection *selection, UpdateType update) { if (update & UPDATE_NOTEBOOK) { g_signal_handlers_block_by_func (selection->notebook, gimp_color_selection_notebook_changed, selection); gimp_color_selector_set_color (GIMP_COLOR_SELECTOR (selection->notebook), &selection->rgb, &selection->hsv); g_signal_handlers_unblock_by_func (selection->notebook, gimp_color_selection_notebook_changed, selection); } if (update & UPDATE_SCALES) { g_signal_handlers_block_by_func (selection->scales, gimp_color_selection_scales_changed, selection); gimp_color_selector_set_color (GIMP_COLOR_SELECTOR (selection->scales), &selection->rgb, &selection->hsv); g_signal_handlers_unblock_by_func (selection->scales, gimp_color_selection_scales_changed, selection); } if (update & UPDATE_ENTRY) { GimpColorHexEntry *entry; entry = g_object_get_data (G_OBJECT (selection), "color-hex-entry"); g_signal_handlers_block_by_func (entry, gimp_color_selection_entry_changed, selection); gimp_color_hex_entry_set_color (entry, &selection->rgb); g_signal_handlers_unblock_by_func (entry, gimp_color_selection_entry_changed, selection); } if (update & UPDATE_COLOR) { g_signal_handlers_block_by_func (selection->new_color, gimp_color_selection_new_color_changed, selection); gimp_color_area_set_color (GIMP_COLOR_AREA (selection->new_color), &selection->rgb); g_signal_handlers_unblock_by_func (selection->new_color, gimp_color_selection_new_color_changed, selection); } }