~ubuntu-branches/ubuntu/maverick/gimp/maverick-updates

« back to all changes in this revision

Viewing changes to app/core/gimpimage-new.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-12-09 19:44:52 UTC
  • Revision ID: james.westby@ubuntu.com-20051209194452-yggpemjlofpjqyf4
Tags: upstream-2.2.9
ImportĀ upstreamĀ versionĀ 2.2.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* The GIMP -- an image manipulation program
 
2
 * Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
#include "config.h"
 
20
 
 
21
#include <glib-object.h>
 
22
 
 
23
#include "core-types.h"
 
24
 
 
25
#include "config/gimpconfig.h"
 
26
#include "config/gimpconfig-utils.h"
 
27
 
 
28
#include "gimp.h"
 
29
#include "gimpbuffer.h"
 
30
#include "gimpimage.h"
 
31
#include "gimpimage-new.h"
 
32
#include "gimptemplate.h"
 
33
 
 
34
#include "gimp-intl.h"
 
35
 
 
36
 
 
37
GimpTemplate *
 
38
gimp_image_new_get_last_template (Gimp      *gimp,
 
39
                                  GimpImage *gimage)
 
40
{
 
41
  GimpTemplate *template;
 
42
 
 
43
  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
 
44
  g_return_val_if_fail (gimage == NULL || GIMP_IS_IMAGE (gimage), NULL);
 
45
 
 
46
  template = gimp_template_new ("image new values");
 
47
 
 
48
  if (gimage)
 
49
    gimp_template_set_from_image (template, gimage);
 
50
  else
 
51
    gimp_config_sync (GIMP_CONFIG (gimp->image_new_last_template),
 
52
                      GIMP_CONFIG (template), 0);
 
53
 
 
54
  if (gimp->global_buffer && gimp->have_current_cut_buffer)
 
55
    {
 
56
      g_object_set (template,
 
57
                    "width",  gimp_buffer_get_width (gimp->global_buffer),
 
58
                    "height", gimp_buffer_get_height (gimp->global_buffer),
 
59
                    NULL);
 
60
    }
 
61
 
 
62
  return template;
 
63
}
 
64
 
 
65
void
 
66
gimp_image_new_set_last_template (Gimp         *gimp,
 
67
                                  GimpTemplate *template)
 
68
{
 
69
  g_return_if_fail (GIMP_IS_GIMP (gimp));
 
70
  g_return_if_fail (GIMP_IS_TEMPLATE (template));
 
71
 
 
72
  gimp_config_sync (GIMP_CONFIG (template),
 
73
                    GIMP_CONFIG (gimp->image_new_last_template), 0);
 
74
 
 
75
  gimp->have_current_cut_buffer = FALSE;
 
76
}