Пример #1
0
static void
file_open_sanitize_image (GimpImage *image,
                          gboolean   as_new)
{
    if (as_new)
        gimp_image_set_uri (image, NULL);

    /* clear all undo steps */
    gimp_image_undo_free (image);

    /* make sure that undo is enabled */
    while (! gimp_image_undo_is_enabled (image))
        gimp_image_undo_thaw (image);

    /* Set the image to clean. Note that export dirtiness is not set to
     * clean here; we can only consider export clean after the first
     * export
     */
    gimp_image_clean_all (image);

    /* make sure the entire projection is properly constructed, because
     * load plug-ins are not required to call gimp_drawable_update() or
     * anything.
     */
    gimp_image_invalidate (image,
                           0, 0,
                           gimp_image_get_width  (image),
                           gimp_image_get_height (image));
    gimp_image_flush (image);

    /* same for drawable previews */
    gimp_image_invalidate_previews (image);
}
Пример #2
0
static void
file_open_sanitize_image (GimpImage *image,
                          gboolean   as_new)
{
  if (as_new)
    gimp_image_set_file (image, NULL);

  /* clear all undo steps */
  gimp_image_undo_free (image);

  /* make sure that undo is enabled */
  while (! gimp_image_undo_is_enabled (image))
    gimp_image_undo_thaw (image);

  /* Set the image to clean. Note that export dirtiness is not set to
   * clean here; we can only consider export clean after the first
   * export
   */
  gimp_image_clean_all (image);

  /* Make sure the projection is completely constructed from valid
   * layers, this is needed in case something triggers projection or
   * image preview creation before all layers are loaded, see bug #767663.
   */
  gimp_image_invalidate (image, 0, 0,
                         gimp_image_get_width  (image),
                         gimp_image_get_height (image));

  /* Make sure all image states are up-to-date */
  gimp_image_flush (image);
}
Пример #3
0
static GValueArray *
image_undo_thaw_invoker (GimpProcedure      *procedure,
                         Gimp               *gimp,
                         GimpContext        *context,
                         GimpProgress       *progress,
                         const GValueArray  *args,
                         GError            **error)
{
  gboolean success = TRUE;
  GValueArray *return_vals;
  GimpImage *image;
  gboolean thawed = FALSE;

  image = gimp_value_get_image (&args->values[0], gimp);

  if (success)
    {
    #if 0
      GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;

      if (plug_in)
        success = gimp_plug_in_cleanup_undo_thaw (plug_in, image);
    #endif

      if (success)
        thawed = gimp_image_undo_thaw (image);
    }

  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_boolean (&return_vals->values[1], thawed);

  return return_vals;
}