mirror of https://github.com/GNOME/gimp.git
register GimpImageType.
2002-04-17 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch]: register GimpImageType. * app/core/gimpimagefile.[ch]: read and write more image properties in thumbnails. * app/gui/file-open-dialog.c: changed accordingly. * app/widgets/gimpdialogfactory.c: disabled debugging output. * app/widgets/gimpdocumentview.c: changed the "Refresh" button to regenerate the preview on click and reload all previews on shift+click. * tools/pdbgen/enums.pl: regenerated.
This commit is contained in:
parent
8dfccd03bb
commit
4aa4803dd0
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2002-04-17 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/core-enums.[ch]: register GimpImageType.
|
||||
|
||||
* app/core/gimpimagefile.[ch]: read and write more image properties
|
||||
in thumbnails.
|
||||
|
||||
* app/gui/file-open-dialog.c: changed accordingly.
|
||||
|
||||
* app/widgets/gimpdialogfactory.c: disabled debugging output.
|
||||
|
||||
* app/widgets/gimpdocumentview.c: changed the "Refresh" button to
|
||||
regenerate the preview on click and reload all previews on
|
||||
shift+click.
|
||||
|
||||
* tools/pdbgen/enums.pl: regenerated.
|
||||
|
||||
2002-04-16 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimpimagefile.c (gimp_imagefile_png_thumb_path): create
|
||||
|
|
|
@ -141,6 +141,29 @@ gimp_image_base_type_get_type (void)
|
|||
}
|
||||
|
||||
|
||||
static const GEnumValue gimp_image_type_enum_values[] =
|
||||
{
|
||||
{ GIMP_RGB_IMAGE, N_("RGB"), "rgb-image" },
|
||||
{ GIMP_RGBA_IMAGE, N_("RGB-Alpha"), "rgba-image" },
|
||||
{ GIMP_GRAY_IMAGE, N_("Grayscale"), "gray-image" },
|
||||
{ GIMP_GRAYA_IMAGE, N_("Grayscale-Alpha"), "graya-image" },
|
||||
{ GIMP_INDEXED_IMAGE, N_("Indexed"), "indexed-image" },
|
||||
{ GIMP_INDEXEDA_IMAGE, N_("Indexed-Alpha"), "indexeda-image" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
GType
|
||||
gimp_image_type_get_type (void)
|
||||
{
|
||||
static GType enum_type = 0;
|
||||
|
||||
if (!enum_type)
|
||||
enum_type = g_enum_register_static ("GimpImageType", gimp_image_type_enum_values);
|
||||
|
||||
return enum_type;
|
||||
}
|
||||
|
||||
|
||||
static const GEnumValue gimp_preview_size_enum_values[] =
|
||||
{
|
||||
{ GIMP_PREVIEW_SIZE_NONE, N_("None"), "none" },
|
||||
|
|
|
@ -126,6 +126,21 @@ typedef enum
|
|||
} GimpImageBaseType;
|
||||
|
||||
|
||||
#define GIMP_TYPE_IMAGE_TYPE (gimp_image_type_get_type ())
|
||||
|
||||
GType gimp_image_type_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_RGB_IMAGE, /*< desc="RGB" >*/
|
||||
GIMP_RGBA_IMAGE, /*< desc="RGB-Alpha" >*/
|
||||
GIMP_GRAY_IMAGE, /*< desc="Grayscale" >*/
|
||||
GIMP_GRAYA_IMAGE, /*< desc="Grayscale-Alpha" >*/
|
||||
GIMP_INDEXED_IMAGE, /*< desc="Indexed" >*/
|
||||
GIMP_INDEXEDA_IMAGE /*< desc="Indexed-Alpha" >*/
|
||||
} GimpImageType;
|
||||
|
||||
|
||||
#define GIMP_TYPE_PREVIEW_SIZE (gimp_preview_size_get_type ())
|
||||
|
||||
GType gimp_preview_size_get_type (void) G_GNUC_CONST;
|
||||
|
@ -240,16 +255,6 @@ typedef enum /*< pdb-skip >*/ /*< skip >*/
|
|||
GIMP_GRAD_HSV_CW /* clockwise hue */
|
||||
} GimpGradientSegmentColor;
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
GIMP_RGB_IMAGE,
|
||||
GIMP_RGBA_IMAGE,
|
||||
GIMP_GRAY_IMAGE,
|
||||
GIMP_GRAYA_IMAGE,
|
||||
GIMP_INDEXED_IMAGE,
|
||||
GIMP_INDEXEDA_IMAGE
|
||||
} GimpImageType;
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
GIMP_ADD_WHITE_MASK,
|
||||
|
|
|
@ -55,6 +55,16 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define TAG_DESCRIPTION "tEXt::Description"
|
||||
#define TAG_SOFTWARE "tEXt::Software"
|
||||
#define TAG_THUMB_URI "tEXt::Thumb::URI"
|
||||
#define TAG_THUMB_MTIME "tEXt::Thumb::MTime"
|
||||
#define TAG_THUMB_SIZE "tEXt::Thumb::Size"
|
||||
#define TAG_THUMB_IMAGE_WIDTH "tEXt::Thumb::Image::Width"
|
||||
#define TAG_THUMB_IMAGE_HEIGHT "tEXt::Thumb::Image::Height"
|
||||
#define TAG_THUMB_GIMP_TYPE "tEXt::Thumb::X-GIMP::Type"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
INFO_CHANGED,
|
||||
|
@ -80,7 +90,8 @@ static void gimp_imagefile_name_changed (GimpObject *object);
|
|||
static void gimp_imagefile_set_info (GimpImagefile *imagefile,
|
||||
gint width,
|
||||
gint height,
|
||||
gint size);
|
||||
gint size,
|
||||
GimpImageType type);
|
||||
static TempBuf * gimp_imagefile_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height);
|
||||
|
@ -102,7 +113,8 @@ static guchar * readXVThumb (const gchar *filename,
|
|||
gchar **imginfo);
|
||||
|
||||
static gboolean gimp_imagefile_test (const gchar *filename,
|
||||
time_t *mtime);
|
||||
time_t *mtime,
|
||||
off_t *size);
|
||||
|
||||
|
||||
static guint gimp_imagefile_signals[LAST_SIGNAL] = { 0 };
|
||||
|
@ -160,6 +172,8 @@ gimp_imagefile_class_init (GimpImagefileClass *klass)
|
|||
|
||||
object_class->name_changed = gimp_imagefile_name_changed;
|
||||
viewable_class->get_new_preview = gimp_imagefile_get_new_preview;
|
||||
|
||||
g_type_class_ref (GIMP_TYPE_IMAGE_TYPE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -168,6 +182,7 @@ gimp_imagefile_init (GimpImagefile *imagefile)
|
|||
imagefile->width = -1;
|
||||
imagefile->height = -1;
|
||||
imagefile->size = -1;
|
||||
imagefile->type = -1;
|
||||
imagefile->image_state = GIMP_IMAGEFILE_STATE_UNKNOWN;
|
||||
imagefile->image_mtime = 0;
|
||||
imagefile->thumb_state = GIMP_IMAGEFILE_STATE_UNKNOWN;
|
||||
|
@ -213,7 +228,7 @@ gimp_imagefile_update (GimpImagefile *imagefile)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (! gimp_imagefile_test (filename, &imagefile->image_mtime))
|
||||
if (! gimp_imagefile_test (filename, &imagefile->image_mtime, NULL))
|
||||
{
|
||||
imagefile->image_state = GIMP_IMAGEFILE_STATE_NOT_FOUND;
|
||||
goto cleanup;
|
||||
|
@ -241,20 +256,22 @@ gimp_imagefile_update (GimpImagefile *imagefile)
|
|||
cleanup:
|
||||
g_free (filename);
|
||||
g_free (thumbname);
|
||||
}
|
||||
|
||||
{
|
||||
GimpViewable *viewable;
|
||||
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (imagefile));
|
||||
|
||||
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (imagefile));
|
||||
if (uri)
|
||||
{
|
||||
GimpImagefile *documents_imagefile;
|
||||
|
||||
viewable = (GimpViewable *)
|
||||
gimp_container_get_child_by_name (the_gimp->documents,
|
||||
uri);
|
||||
documents_imagefile = (GimpImagefile *)
|
||||
gimp_container_get_child_by_name (the_gimp->documents, uri);
|
||||
|
||||
if (GIMP_IS_VIEWABLE (viewable) &&
|
||||
(viewable != GIMP_VIEWABLE (imagefile)))
|
||||
gimp_viewable_invalidate_preview (viewable);
|
||||
}
|
||||
if (GIMP_IS_IMAGEFILE (documents_imagefile) &&
|
||||
(documents_imagefile != imagefile))
|
||||
{
|
||||
gimp_imagefile_update (GIMP_IMAGEFILE (documents_imagefile));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,6 +291,7 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile)
|
|||
gchar *filename;
|
||||
gchar *thumb_name;
|
||||
time_t mtime;
|
||||
off_t size;
|
||||
|
||||
filename = g_filename_from_uri (uri, NULL, NULL);
|
||||
|
||||
|
@ -286,7 +304,7 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile)
|
|||
if (! thumb_name)
|
||||
return;
|
||||
|
||||
if (gimp_imagefile_test (filename, &mtime))
|
||||
if (gimp_imagefile_test (filename, &mtime, &size))
|
||||
{
|
||||
gimage = file_open_image (the_gimp,
|
||||
uri,
|
||||
|
@ -304,10 +322,6 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile)
|
|||
gchar *temp_name = NULL;
|
||||
GdkPixbuf *pixbuf;
|
||||
gint width, height;
|
||||
gchar *w_str;
|
||||
gchar *h_str;
|
||||
gchar *t_str;
|
||||
GError *error = NULL;
|
||||
|
||||
if (gimage->width <= 128 && gimage->height <= 128)
|
||||
{
|
||||
|
@ -332,24 +346,53 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile)
|
|||
gimp_viewable_get_new_preview_pixbuf (GIMP_VIEWABLE (gimage),
|
||||
width, height);
|
||||
|
||||
w_str = g_strdup_printf ("%d", gimage->width);
|
||||
h_str = g_strdup_printf ("%d", gimage->height);
|
||||
t_str = g_strdup_printf ("%ld", mtime);
|
||||
{
|
||||
GEnumClass *enum_class;
|
||||
GimpImageType type;
|
||||
gchar *type_str;
|
||||
gchar *desc;
|
||||
gchar *t_str;
|
||||
gchar *w_str;
|
||||
gchar *h_str;
|
||||
gchar *s_str;
|
||||
GError *error = NULL;
|
||||
|
||||
if (! gdk_pixbuf_save (pixbuf, thumb_name, "png", &error,
|
||||
"tEXt::Thumb::Image::Width", w_str,
|
||||
"tEXt::Thumb::Image::Height", h_str,
|
||||
"tEXt::Thumb::URI", uri,
|
||||
"tEXt::Thumb::MTime", t_str,
|
||||
NULL))
|
||||
{
|
||||
g_message (_("Couldn't write thumbnail for '%s'\nas '%s'.\n%s"),
|
||||
type = GIMP_IMAGE_TYPE_FROM_BASE_TYPE (gimp_image_base_type (gimage));
|
||||
|
||||
if (gimp_image_has_alpha (gimage))
|
||||
type = GIMP_IMAGE_TYPE_WITH_ALPHA (type);
|
||||
|
||||
enum_class = g_type_class_peek (GIMP_TYPE_IMAGE_TYPE);
|
||||
type_str = g_enum_get_value (enum_class, type)->value_nick;
|
||||
|
||||
desc = g_strdup_printf ("Thumbnail of %s", uri);
|
||||
t_str = g_strdup_printf ("%ld", mtime);
|
||||
w_str = g_strdup_printf ("%d", gimage->width);
|
||||
h_str = g_strdup_printf ("%d", gimage->height);
|
||||
s_str = g_strdup_printf ("%ld", size);
|
||||
|
||||
if (! gdk_pixbuf_save (pixbuf, thumb_name, "png", &error,
|
||||
TAG_DESCRIPTION, desc,
|
||||
TAG_SOFTWARE, "The GIMP",
|
||||
TAG_THUMB_URI, uri,
|
||||
TAG_THUMB_MTIME, t_str,
|
||||
TAG_THUMB_SIZE, s_str,
|
||||
TAG_THUMB_IMAGE_WIDTH, w_str,
|
||||
TAG_THUMB_IMAGE_HEIGHT, h_str,
|
||||
TAG_THUMB_GIMP_TYPE, type_str,
|
||||
NULL))
|
||||
{
|
||||
g_message (_("Couldn't write thumbnail for '%s'\nas '%s'.\n%s"),
|
||||
uri, thumb_name, error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_free (w_str);
|
||||
g_free (h_str);
|
||||
g_free (desc);
|
||||
g_free (t_str);
|
||||
g_free (w_str);
|
||||
g_free (h_str);
|
||||
g_free (s_str);
|
||||
}
|
||||
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
g_object_unref (G_OBJECT (gimage));
|
||||
|
@ -375,6 +418,7 @@ gimp_imagefile_name_changed (GimpObject *object)
|
|||
imagefile->width = -1;
|
||||
imagefile->height = -1;
|
||||
imagefile->size = -1;
|
||||
imagefile->type = -1;
|
||||
|
||||
imagefile->image_state = GIMP_IMAGEFILE_STATE_UNKNOWN;
|
||||
imagefile->image_mtime = 0;
|
||||
|
@ -389,17 +433,20 @@ static void
|
|||
gimp_imagefile_set_info (GimpImagefile *imagefile,
|
||||
gint width,
|
||||
gint height,
|
||||
gint size)
|
||||
gint size,
|
||||
GimpImageType type)
|
||||
{
|
||||
gboolean changed;
|
||||
|
||||
changed = (imagefile->width != width ||
|
||||
imagefile->height != height ||
|
||||
imagefile->size != size);
|
||||
imagefile->size != size ||
|
||||
imagefile->type != type);
|
||||
|
||||
imagefile->width = width;
|
||||
imagefile->height = height;
|
||||
imagefile->size = size;
|
||||
imagefile->type = type;
|
||||
|
||||
if (changed)
|
||||
g_signal_emit (G_OBJECT (imagefile),
|
||||
|
@ -410,24 +457,38 @@ static void
|
|||
gimp_imagefile_set_info_from_pixbuf (GimpImagefile *imagefile,
|
||||
GdkPixbuf *pixbuf)
|
||||
{
|
||||
const gchar *option;
|
||||
gint img_width;
|
||||
gint img_height;
|
||||
gint img_size;
|
||||
const gchar *option;
|
||||
gint img_width = -1;
|
||||
gint img_height = -1;
|
||||
gint img_size = -1;
|
||||
GimpImageType img_type = -1;
|
||||
|
||||
option = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Width");
|
||||
option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_IMAGE_WIDTH);
|
||||
if (!option || sscanf (option, "%d", &img_width) != 1)
|
||||
img_width = -1;
|
||||
|
||||
option = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Height");
|
||||
option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_IMAGE_HEIGHT);
|
||||
if (!option || sscanf (option, "%d", &img_height) != 1)
|
||||
img_height = -1;
|
||||
|
||||
option = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Size");
|
||||
option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_SIZE);
|
||||
if (!option || sscanf (option, "%d", &img_size) != 1)
|
||||
img_size = -1;
|
||||
|
||||
gimp_imagefile_set_info (imagefile, img_width, img_height, img_size);
|
||||
option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_GIMP_TYPE);
|
||||
if (option)
|
||||
{
|
||||
GEnumClass *enum_class;
|
||||
GEnumValue *enum_value;
|
||||
|
||||
enum_class = g_type_class_peek (GIMP_TYPE_IMAGE_TYPE);
|
||||
enum_value = g_enum_get_value_by_nick (enum_class, option);
|
||||
|
||||
if (enum_value)
|
||||
img_type = enum_value->value;
|
||||
}
|
||||
|
||||
gimp_imagefile_set_info (imagefile, img_width, img_height, img_size, img_type);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
|
@ -501,11 +562,11 @@ gimp_imagefile_read_png_thumb (GimpImagefile *imagefile,
|
|||
|
||||
/* URI and mtime from the thumbnail need to match our file */
|
||||
|
||||
option = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI");
|
||||
option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_URI);
|
||||
if (!option || strcmp (option, GIMP_OBJECT (imagefile)->name))
|
||||
goto cleanup;
|
||||
|
||||
option = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::MTime");
|
||||
option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_MTIME);
|
||||
if (!option || sscanf (option, "%ld", &y) != 1 || y != imagefile->image_mtime)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -635,7 +696,7 @@ gimp_imagefile_find_png_thumb (const gchar *uri,
|
|||
thumb_sizes[i].dirname,
|
||||
name, NULL);
|
||||
|
||||
if (gimp_imagefile_test (thumb_name, thumb_mtime) &&
|
||||
if (gimp_imagefile_test (thumb_name, thumb_mtime, NULL) &&
|
||||
image_mtime < *thumb_mtime)
|
||||
return thumb_name;
|
||||
|
||||
|
@ -648,7 +709,7 @@ gimp_imagefile_find_png_thumb (const gchar *uri,
|
|||
thumb_sizes[i].dirname,
|
||||
name, NULL);
|
||||
|
||||
if (gimp_imagefile_test (thumb_name, thumb_mtime) &&
|
||||
if (gimp_imagefile_test (thumb_name, thumb_mtime, NULL) &&
|
||||
image_mtime < *thumb_mtime)
|
||||
return thumb_name;
|
||||
|
||||
|
@ -685,7 +746,7 @@ gimp_imagefile_read_xv_thumb (GimpImagefile *imagefile)
|
|||
return NULL;
|
||||
|
||||
/* check if the image file exists at all */
|
||||
if (!gimp_imagefile_test (filename, &file_mtime))
|
||||
if (!gimp_imagefile_test (filename, &file_mtime, NULL))
|
||||
{
|
||||
g_free (filename);
|
||||
return NULL;
|
||||
|
@ -701,7 +762,7 @@ gimp_imagefile_read_xv_thumb (GimpImagefile *imagefile)
|
|||
g_free (dirname);
|
||||
g_free (basename);
|
||||
|
||||
if (gimp_imagefile_test (thumbname, &thumb_mtime) &&
|
||||
if (gimp_imagefile_test (thumbname, &thumb_mtime, NULL) &&
|
||||
thumb_mtime >= file_mtime)
|
||||
{
|
||||
raw_thumb = readXVThumb (thumbname, &width, &height, &image_info);
|
||||
|
@ -722,7 +783,7 @@ gimp_imagefile_read_xv_thumb (GimpImagefile *imagefile)
|
|||
img_width = 0;
|
||||
img_height = 0;
|
||||
}
|
||||
gimp_imagefile_set_info (imagefile, img_width, img_height, -1);
|
||||
gimp_imagefile_set_info (imagefile, img_width, img_height, -1, -1);
|
||||
|
||||
g_free (image_info);
|
||||
}
|
||||
|
@ -837,7 +898,8 @@ readXVThumb (const gchar *fnam,
|
|||
|
||||
static gboolean
|
||||
gimp_imagefile_test (const gchar *filename,
|
||||
time_t *mtime)
|
||||
time_t *mtime,
|
||||
off_t *size)
|
||||
{
|
||||
struct stat s;
|
||||
|
||||
|
@ -850,6 +912,9 @@ gimp_imagefile_test (const gchar *filename,
|
|||
if (mtime)
|
||||
*mtime = s.st_mtime;
|
||||
|
||||
if (size)
|
||||
*size = s.st_size;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,11 +48,12 @@ typedef struct _GimpImagefileClass GimpImagefileClass;
|
|||
|
||||
struct _GimpImagefile
|
||||
{
|
||||
GimpViewable parent_instance;
|
||||
GimpViewable parent_instance;
|
||||
|
||||
gint width;
|
||||
gint height;
|
||||
gint size;
|
||||
gint width;
|
||||
gint height;
|
||||
gssize size;
|
||||
GimpImageType type;
|
||||
|
||||
GimpImagefileState image_state;
|
||||
time_t image_mtime;
|
||||
|
|
|
@ -32,11 +32,6 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning GTK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
#undef GTK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
@ -51,6 +46,7 @@
|
|||
#include "core/gimpcoreconfig.h"
|
||||
#include "core/gimpdocuments.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-new.h"
|
||||
#include "core/gimpimagefile.h"
|
||||
|
||||
#include "plug-in/plug-in-types.h"
|
||||
|
@ -353,11 +349,36 @@ file_open_imagefile_info_changed (GimpImagefile *imagefile,
|
|||
}
|
||||
else
|
||||
{
|
||||
gchar *str;
|
||||
GEnumClass *enum_class;
|
||||
GEnumValue *enum_value;
|
||||
gchar *str;
|
||||
gchar *size_str;
|
||||
gchar *type_str;
|
||||
|
||||
str = g_strdup_printf (_("(%d x %d)"),
|
||||
imagefile->width,
|
||||
imagefile->height);
|
||||
size_str = gimp_image_new_get_memsize_string (imagefile->size);
|
||||
|
||||
enum_class = g_type_class_peek (GIMP_TYPE_IMAGE_TYPE);
|
||||
enum_value = g_enum_get_value (enum_class, imagefile->type);
|
||||
|
||||
if (enum_value)
|
||||
{
|
||||
type_str = gettext (enum_value->value_name);
|
||||
|
||||
str = g_strdup_printf ("%d x %d (%s, %s)",
|
||||
imagefile->width,
|
||||
imagefile->height,
|
||||
size_str,
|
||||
type_str);
|
||||
}
|
||||
else
|
||||
{
|
||||
str = g_strdup_printf ("%d x %d (%s)",
|
||||
imagefile->width,
|
||||
imagefile->height,
|
||||
size_str);
|
||||
}
|
||||
|
||||
g_free (size_str);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (open_options_label), str);
|
||||
g_free (str);
|
||||
|
|
|
@ -32,11 +32,6 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning GTK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
#undef GTK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
@ -51,6 +46,7 @@
|
|||
#include "core/gimpcoreconfig.h"
|
||||
#include "core/gimpdocuments.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-new.h"
|
||||
#include "core/gimpimagefile.h"
|
||||
|
||||
#include "plug-in/plug-in-types.h"
|
||||
|
@ -353,11 +349,36 @@ file_open_imagefile_info_changed (GimpImagefile *imagefile,
|
|||
}
|
||||
else
|
||||
{
|
||||
gchar *str;
|
||||
GEnumClass *enum_class;
|
||||
GEnumValue *enum_value;
|
||||
gchar *str;
|
||||
gchar *size_str;
|
||||
gchar *type_str;
|
||||
|
||||
str = g_strdup_printf (_("(%d x %d)"),
|
||||
imagefile->width,
|
||||
imagefile->height);
|
||||
size_str = gimp_image_new_get_memsize_string (imagefile->size);
|
||||
|
||||
enum_class = g_type_class_peek (GIMP_TYPE_IMAGE_TYPE);
|
||||
enum_value = g_enum_get_value (enum_class, imagefile->type);
|
||||
|
||||
if (enum_value)
|
||||
{
|
||||
type_str = gettext (enum_value->value_name);
|
||||
|
||||
str = g_strdup_printf ("%d x %d (%s, %s)",
|
||||
imagefile->width,
|
||||
imagefile->height,
|
||||
size_str,
|
||||
type_str);
|
||||
}
|
||||
else
|
||||
{
|
||||
str = g_strdup_printf ("%d x %d (%s)",
|
||||
imagefile->width,
|
||||
imagefile->height,
|
||||
size_str);
|
||||
}
|
||||
|
||||
g_free (size_str);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (open_options_label), str);
|
||||
g_free (str);
|
||||
|
|
|
@ -43,6 +43,15 @@
|
|||
#include "gimpitemfactory.h"
|
||||
|
||||
|
||||
/* #define DEBUG_FACTORY */
|
||||
|
||||
#ifdef DEBUG_FACTORY
|
||||
#define DEBUG(...) g_print(...)
|
||||
#else
|
||||
#define DEBUG(...)
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_DIALOG_VISIBILITY_UNKNOWN = 0,
|
||||
|
@ -691,10 +700,10 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
|
|||
|
||||
toplevel = GTK_WIDGET_TOPLEVEL (dialog);
|
||||
|
||||
g_print ("%s: adding %s \"%s\"\n",
|
||||
G_GNUC_FUNCTION,
|
||||
toplevel ? "toplevel" : "dockable",
|
||||
entry->identifier);
|
||||
DEBUG ("%s: adding %s \"%s\"\n",
|
||||
G_GNUC_FUNCTION,
|
||||
toplevel ? "toplevel" : "dockable",
|
||||
entry->identifier);
|
||||
|
||||
for (list = factory->session_infos; list; list = g_list_next (list))
|
||||
{
|
||||
|
@ -710,9 +719,9 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
|
|||
g_warning ("%s: singleton dialog \"%s\" created twice",
|
||||
G_GNUC_FUNCTION, entry->identifier);
|
||||
|
||||
g_print ("%s: corrupt session info: %p (widget %p)\n",
|
||||
G_GNUC_FUNCTION,
|
||||
info, info->widget);
|
||||
DEBUG ("%s: corrupt session info: %p (widget %p)\n",
|
||||
G_GNUC_FUNCTION,
|
||||
info, info->widget);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -722,11 +731,11 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
|
|||
|
||||
info->widget = dialog;
|
||||
|
||||
g_print ("%s: updating session info %p (widget %p) for %s \"%s\"\n",
|
||||
G_GNUC_FUNCTION,
|
||||
info, info->widget,
|
||||
toplevel ? "toplevel" : "dockable",
|
||||
entry->identifier);
|
||||
DEBUG ("%s: updating session info %p (widget %p) for %s \"%s\"\n",
|
||||
G_GNUC_FUNCTION,
|
||||
info, info->widget,
|
||||
toplevel ? "toplevel" : "dockable",
|
||||
entry->identifier);
|
||||
|
||||
if (entry->session_managed)
|
||||
{
|
||||
|
@ -743,11 +752,11 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
|
|||
|
||||
info->widget = dialog;
|
||||
|
||||
g_print ("%s: creating session info %p (widget %p) for %s \"%s\"\n",
|
||||
G_GNUC_FUNCTION,
|
||||
info, info->widget,
|
||||
toplevel ? "toplevel" : "dockable",
|
||||
entry->identifier);
|
||||
DEBUG ("%s: creating session info %p (widget %p) for %s \"%s\"\n",
|
||||
G_GNUC_FUNCTION,
|
||||
info, info->widget,
|
||||
toplevel ? "toplevel" : "dockable",
|
||||
entry->identifier);
|
||||
|
||||
if (toplevel)
|
||||
info->toplevel_entry = entry;
|
||||
|
@ -759,7 +768,7 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
|
|||
}
|
||||
else /* dialog is a GimpDock */
|
||||
{
|
||||
g_print ("%s: adding dock\n", G_GNUC_FUNCTION);
|
||||
DEBUG ("%s: adding dock\n", G_GNUC_FUNCTION);
|
||||
|
||||
for (list = factory->session_infos; list; list = g_list_next (list))
|
||||
{
|
||||
|
@ -772,9 +781,9 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
|
|||
{
|
||||
info->widget = dialog;
|
||||
|
||||
g_print ("%s: updating session info %p (widget %p) for dock\n",
|
||||
G_GNUC_FUNCTION,
|
||||
info, info->widget);
|
||||
DEBUG ("%s: updating session info %p (widget %p) for dock\n",
|
||||
G_GNUC_FUNCTION,
|
||||
info, info->widget);
|
||||
|
||||
gimp_dialog_factory_set_window_geometry (info->widget, info);
|
||||
|
||||
|
@ -788,9 +797,9 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
|
|||
|
||||
info->widget = dialog;
|
||||
|
||||
g_print ("%s: creating session info %p (widget %p) for dock\n",
|
||||
G_GNUC_FUNCTION,
|
||||
info, info->widget);
|
||||
DEBUG ("%s: creating session info %p (widget %p) for dock\n",
|
||||
G_GNUC_FUNCTION,
|
||||
info, info->widget);
|
||||
|
||||
factory->session_infos = g_list_append (factory->session_infos, info);
|
||||
}
|
||||
|
@ -841,9 +850,9 @@ gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
|
|||
return;
|
||||
}
|
||||
|
||||
g_print ("%s: removing \"%s\"\n",
|
||||
G_GNUC_FUNCTION,
|
||||
entry ? entry->identifier : "dock");
|
||||
DEBUG ("%s: removing \"%s\"\n",
|
||||
G_GNUC_FUNCTION,
|
||||
entry ? entry->identifier : "dock");
|
||||
|
||||
for (list = factory->session_infos; list; list = g_list_next (list))
|
||||
{
|
||||
|
@ -851,10 +860,10 @@ gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
|
|||
|
||||
if (session_info->widget == dialog)
|
||||
{
|
||||
g_print ("%s: clearing session info %p (widget %p) for \"%s\"\n",
|
||||
G_GNUC_FUNCTION,
|
||||
session_info, session_info->widget,
|
||||
entry ? entry->identifier : "dock");
|
||||
DEBUG ("%s: clearing session info %p (widget %p) for \"%s\"\n",
|
||||
G_GNUC_FUNCTION,
|
||||
session_info, session_info->widget,
|
||||
entry ? entry->identifier : "dock");
|
||||
|
||||
session_info->widget = NULL;
|
||||
|
||||
|
|
|
@ -175,8 +175,8 @@ gimp_document_view_new (GimpViewType view_type,
|
|||
document_view->refresh_button =
|
||||
gimp_editor_add_button (GIMP_EDITOR (editor->view),
|
||||
GTK_STOCK_REFRESH,
|
||||
_("Refresh preview\n"
|
||||
"<Shift> Recreate preview"),
|
||||
_("Recreate preview\n"
|
||||
"<Shift> Reload all previews"),
|
||||
NULL,
|
||||
G_CALLBACK (gimp_document_view_refresh_clicked),
|
||||
G_CALLBACK (gimp_document_view_refresh_extended_clicked),
|
||||
|
@ -323,7 +323,7 @@ gimp_document_view_refresh_clicked (GtkWidget *widget,
|
|||
if (imagefile && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (imagefile)))
|
||||
{
|
||||
gimp_imagefile_update (imagefile);
|
||||
gimp_imagefile_create_thumbnail (imagefile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,17 +333,14 @@ gimp_document_view_refresh_extended_clicked (GtkWidget *widget,
|
|||
GimpDocumentView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpImagefile *imagefile;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
|
||||
imagefile = gimp_context_get_imagefile (editor->view->context);
|
||||
|
||||
if (imagefile && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (imagefile)))
|
||||
if (state & GDK_SHIFT_MASK)
|
||||
{
|
||||
if (state & GDK_SHIFT_MASK)
|
||||
gimp_imagefile_create_thumbnail (imagefile);
|
||||
gimp_container_foreach (editor->view->container,
|
||||
(GFunc) gimp_imagefile_update,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -231,6 +231,19 @@ package Gimp::CodeGen::enums;
|
|||
GIMP_GRAY => '1',
|
||||
GIMP_INDEXED => '2' }
|
||||
},
|
||||
GimpImageType =>
|
||||
{ contig => 1,
|
||||
header => 'core/core-enums.h',
|
||||
symbols => [ qw(GIMP_RGB_IMAGE GIMP_RGBA_IMAGE GIMP_GRAY_IMAGE
|
||||
GIMP_GRAYA_IMAGE GIMP_INDEXED_IMAGE
|
||||
GIMP_INDEXEDA_IMAGE) ],
|
||||
mapping => { GIMP_RGB_IMAGE => '0',
|
||||
GIMP_RGBA_IMAGE => '1',
|
||||
GIMP_GRAY_IMAGE => '2',
|
||||
GIMP_GRAYA_IMAGE => '3',
|
||||
GIMP_INDEXED_IMAGE => '4',
|
||||
GIMP_INDEXEDA_IMAGE => '5' }
|
||||
},
|
||||
GimpRepeatMode =>
|
||||
{ contig => 1,
|
||||
header => 'core/core-enums.h',
|
||||
|
@ -281,19 +294,6 @@ package Gimp::CodeGen::enums;
|
|||
GIMP_TRANSPARENT_FILL => '3',
|
||||
GIMP_NO_FILL => '4' }
|
||||
},
|
||||
GimpImageType =>
|
||||
{ contig => 1,
|
||||
header => 'core/core-enums.h',
|
||||
symbols => [ qw(GIMP_RGB_IMAGE GIMP_RGBA_IMAGE GIMP_GRAY_IMAGE
|
||||
GIMP_GRAYA_IMAGE GIMP_INDEXED_IMAGE
|
||||
GIMP_INDEXEDA_IMAGE) ],
|
||||
mapping => { GIMP_RGB_IMAGE => '0',
|
||||
GIMP_RGBA_IMAGE => '1',
|
||||
GIMP_GRAY_IMAGE => '2',
|
||||
GIMP_GRAYA_IMAGE => '3',
|
||||
GIMP_INDEXED_IMAGE => '4',
|
||||
GIMP_INDEXEDA_IMAGE => '5' }
|
||||
},
|
||||
GimpAddMaskType =>
|
||||
{ contig => 1,
|
||||
header => 'core/core-enums.h',
|
||||
|
|
Loading…
Reference in New Issue