2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-07-05 23:34:26 +08:00
|
|
|
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
|
2003-10-11 22:30:18 +08:00
|
|
|
*
|
2001-07-05 23:34:26 +08:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
#include <glib-object.h>
|
2001-07-05 23:34:26 +08:00
|
|
|
|
2005-01-26 03:11:26 +08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2001-07-05 23:34:26 +08:00
|
|
|
|
2005-01-26 03:11:26 +08:00
|
|
|
#include "core-types.h"
|
2002-11-19 04:50:31 +08:00
|
|
|
|
2007-07-16 21:49:17 +08:00
|
|
|
#include "config/gimpcoreconfig.h"
|
|
|
|
|
2001-07-05 23:34:26 +08:00
|
|
|
#include "gimp.h"
|
|
|
|
#include "gimpimage.h"
|
|
|
|
#include "gimpimage-new.h"
|
2003-04-04 01:50:56 +08:00
|
|
|
#include "gimptemplate.h"
|
2001-07-05 23:34:26 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2001-07-05 23:34:26 +08:00
|
|
|
|
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
GimpTemplate *
|
2003-04-04 23:11:30 +08:00
|
|
|
gimp_image_new_get_last_template (Gimp *gimp,
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image)
|
2001-07-05 23:34:26 +08:00
|
|
|
{
|
2003-04-04 01:50:56 +08:00
|
|
|
GimpTemplate *template;
|
2001-07-05 23:34:26 +08:00
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL);
|
2001-07-05 23:34:26 +08:00
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
template = gimp_template_new ("image new values");
|
2001-07-05 23:34:26 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if (image)
|
2007-07-16 21:49:17 +08:00
|
|
|
{
|
|
|
|
gimp_config_sync (G_OBJECT (gimp->config->default_image),
|
|
|
|
G_OBJECT (template), 0);
|
|
|
|
gimp_template_set_from_image (template, image);
|
|
|
|
}
|
2001-07-05 23:34:26 +08:00
|
|
|
else
|
2007-07-16 21:49:17 +08:00
|
|
|
{
|
|
|
|
gimp_config_sync (G_OBJECT (gimp->image_new_last_template),
|
|
|
|
G_OBJECT (template), 0);
|
|
|
|
}
|
2001-07-05 23:34:26 +08:00
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
return template;
|
2001-07-05 23:34:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-04-04 01:50:56 +08:00
|
|
|
gimp_image_new_set_last_template (Gimp *gimp,
|
|
|
|
GimpTemplate *template)
|
2001-07-05 23:34:26 +08:00
|
|
|
{
|
2003-04-04 01:50:56 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (GIMP_IS_TEMPLATE (template));
|
2001-07-05 23:34:26 +08:00
|
|
|
|
2005-04-07 18:05:54 +08:00
|
|
|
gimp_config_sync (G_OBJECT (template),
|
|
|
|
G_OBJECT (gimp->image_new_last_template), 0);
|
2001-07-05 23:34:26 +08:00
|
|
|
}
|