static void gimp_sample_point_editor_points_changed (GimpSamplePointEditor *editor) { GimpImageEditor *image_editor = GIMP_IMAGE_EDITOR (editor); GList *sample_points; gint n_points = 0; gint i; if (image_editor->image) { sample_points = gimp_image_get_sample_points (image_editor->image); n_points = MIN (4, g_list_length (sample_points)); } for (i = 0; i < n_points; i++) { gtk_widget_set_sensitive (editor->color_frames[i], TRUE); editor->dirty[i] = TRUE; } for (i = n_points; i < 4; i++) { gtk_widget_set_sensitive (editor->color_frames[i], FALSE); gimp_color_frame_set_invalid (GIMP_COLOR_FRAME (editor->color_frames[i])); editor->dirty[i] = FALSE; } if (n_points > 0) gimp_sample_point_editor_dirty (editor, -1); }
static void gimp_sample_point_editor_proj_update (GimpImage *image, gboolean now, gint x, gint y, gint width, gint height, GimpSamplePointEditor *editor) { GimpImageEditor *image_editor = GIMP_IMAGE_EDITOR (editor); GList *sample_points; gint n_points = 0; GList *list; gint i; sample_points = gimp_image_get_sample_points (image_editor->image); n_points = MIN (4, g_list_length (sample_points)); for (i = 0, list = sample_points; i < n_points; i++, list = g_list_next (list)) { GimpSamplePoint *sample_point = list->data; if (sample_point->x >= x && sample_point->x < (x + width) && sample_point->y >= y && sample_point->y < (y + height)) { gimp_sample_point_editor_dirty (editor, i); } } }
static void gimp_sample_point_editor_point_moved (GimpImage *image, GimpSamplePoint *sample_point, GimpSamplePointEditor *editor) { gint i = g_list_index (gimp_image_get_sample_points (image), sample_point); if (i < 4) gimp_sample_point_editor_dirty (editor, i); }
void gimp_sample_point_editor_set_sample_merged (GimpSamplePointEditor *editor, gboolean sample_merged) { g_return_if_fail (GIMP_IS_SAMPLE_POINT_EDITOR (editor)); sample_merged = sample_merged ? TRUE : FALSE; if (editor->sample_merged != sample_merged) { gint i; editor->sample_merged = sample_merged; for (i = 0; i < 4; i++) editor->dirty[i] = TRUE; gimp_sample_point_editor_dirty (editor, -1); g_object_notify (G_OBJECT (editor), "sample-merged"); } }