static void gimp_brush_editor_set_data (GimpDataEditor *editor, GimpData *data) { GimpBrushEditor *brush_editor = GIMP_BRUSH_EDITOR (editor); GimpBrushGeneratedShape shape = GIMP_BRUSH_GENERATED_CIRCLE; gdouble radius = 0.0; gint spikes = 2; gdouble hardness = 0.0; gdouble ratio = 0.0; gdouble angle = 0.0; gdouble spacing = 0.0; if (editor->data) g_signal_handlers_disconnect_by_func (editor->data, gimp_brush_editor_notify_brush, editor); GIMP_DATA_EDITOR_CLASS (parent_class)->set_data (editor, data); if (editor->data) g_signal_connect (editor->data, "notify", G_CALLBACK (gimp_brush_editor_notify_brush), editor); gimp_view_set_viewable (GIMP_VIEW (editor->view), GIMP_VIEWABLE (data)); if (editor->data) { spacing = gimp_brush_get_spacing (GIMP_BRUSH (editor->data)); if (GIMP_IS_BRUSH_GENERATED (editor->data)) { GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (editor->data); shape = gimp_brush_generated_get_shape (brush); radius = gimp_brush_generated_get_radius (brush); spikes = gimp_brush_generated_get_spikes (brush); hardness = gimp_brush_generated_get_hardness (brush); ratio = gimp_brush_generated_get_aspect_ratio (brush); angle = gimp_brush_generated_get_angle (brush); } } gtk_widget_set_sensitive (brush_editor->options_box, editor->data_editable); gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (brush_editor->shape_group), shape); gtk_adjustment_set_value (brush_editor->radius_data, radius); gtk_adjustment_set_value (brush_editor->spikes_data, spikes); gtk_adjustment_set_value (brush_editor->hardness_data, hardness); gtk_adjustment_set_value (brush_editor->aspect_ratio_data, ratio); gtk_adjustment_set_value (brush_editor->angle_data, angle); gtk_adjustment_set_value (brush_editor->spacing_data, spacing); }
static void gimp_brush_editor_update_shape (GtkWidget *widget, GimpBrushEditor *editor) { GimpBrushGenerated *brush; if (! GIMP_IS_BRUSH_GENERATED (GIMP_DATA_EDITOR (editor)->data)) return; brush = GIMP_BRUSH_GENERATED (GIMP_DATA_EDITOR (editor)->data); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) { GimpBrushGeneratedShape shape; shape = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "gimp-item-data")); if (gimp_brush_generated_get_shape (brush) != shape) gimp_brush_generated_set_shape (brush, shape); } }