}
static int
-valid_image_instantiator_format_p (Lisp_Object format)
+valid_image_instantiator_format_p (Lisp_Object format, Lisp_Object locale)
{
- return (decode_image_instantiator_format (format, ERROR_ME_NOT) != 0);
+ int i;
+ struct image_instantiator_methods* meths =
+ decode_image_instantiator_format (format, ERROR_ME_NOT);
+ struct console* console = decode_console (locale);
+ Lisp_Object contype = console ? CONSOLE_TYPE (console) : locale;
+ /* nothing is valid in all locales */
+ if (EQ (format, Qnothing))
+ return 1;
+ /* reject unknown formats */
+ else if (!console || !meths)
+ return 0;
+
+ for (i = 0; i < Dynarr_length (meths->consoles); i++)
+ if (EQ (contype, Dynarr_at (meths->consoles, i).symbol))
+ return 1;
+ return 0;
}
DEFUN ("valid-image-instantiator-format-p", Fvalid_image_instantiator_format_p,
- 1, 1, 0, /*
+ 1, 2, 0, /*
Given an IMAGE-INSTANTIATOR-FORMAT, return non-nil if it is valid.
+If LOCALE is non-nil then the format is checked in that domain.
+If LOCALE is nil the current console is used.
Valid formats are some subset of 'nothing, 'string, 'formatted-string,
'xpm, 'xbm, 'xface, 'gif, 'jpeg, 'png, 'tiff, 'cursor-font, 'font,
'autodetect, 'widget and 'subwindow, depending on how XEmacs was compiled.
*/
- (image_instantiator_format))
+ (image_instantiator_format, locale))
{
- return valid_image_instantiator_format_p (image_instantiator_format) ?
+ return valid_image_instantiator_format_p (image_instantiator_format, locale) ?
Qt : Qnil;
}
int methp = 0;
GCPRO1 (ii);
+ if (!valid_image_instantiator_format_p (XVECTOR_DATA (instantiator)[0], device))
+ signal_simple_error
+ ("Image instantiator format is invalid in this locale.",
+ instantiator);
+
meths = decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0],
ERROR_ME);
methp = (int)HAS_IIFORMAT_METH_P (meths, instantiate);
markobj (IMAGE_INSTANCE_WIDGET_TYPE (i));
markobj (IMAGE_INSTANCE_WIDGET_PROPS (i));
markobj (IMAGE_INSTANCE_WIDGET_FACE (i));
- mark_gui_item (&IMAGE_INSTANCE_WIDGET_ITEM (i), markobj);
+ markobj (IMAGE_INSTANCE_WIDGET_ITEM (i));
case IMAGE_SUBWINDOW:
markobj (IMAGE_INSTANCE_SUBWINDOW_FRAME (i));
break;
break;
case IMAGE_WIDGET:
+ /*
if (!NILP (IMAGE_INSTANCE_WIDGET_CALLBACK (ii)))
{
print_internal (IMAGE_INSTANCE_WIDGET_CALLBACK (ii), printcharfun, 0);
write_c_string (", ", printcharfun);
}
+ */
if (!NILP (IMAGE_INSTANCE_WIDGET_FACE (ii)))
{
write_c_string (" (", printcharfun);
case IMAGE_WIDGET:
if (!(EQ (IMAGE_INSTANCE_WIDGET_TYPE (i1),
- IMAGE_INSTANCE_WIDGET_TYPE (i2)) &&
- EQ (IMAGE_INSTANCE_WIDGET_CALLBACK (i1),
- IMAGE_INSTANCE_WIDGET_CALLBACK (i2))
+ IMAGE_INSTANCE_WIDGET_TYPE (i2))
+ && internal_equal (IMAGE_INSTANCE_WIDGET_ITEM (i1),
+ IMAGE_INSTANCE_WIDGET_ITEM (i2),
+ depth + 1)
&& internal_equal (IMAGE_INSTANCE_WIDGET_PROPS (i1),
IMAGE_INSTANCE_WIDGET_PROPS (i2),
depth + 1)
- && internal_equal (IMAGE_INSTANCE_WIDGET_TEXT (i1),
- IMAGE_INSTANCE_WIDGET_TEXT (i2),
- depth + 1)))
+ ))
return 0;
case IMAGE_SUBWINDOW:
if (!(IMAGE_INSTANCE_SUBWINDOW_WIDTH (i1) ==
hash = HASH4 (hash,
internal_hash (IMAGE_INSTANCE_WIDGET_TYPE (i), depth + 1),
internal_hash (IMAGE_INSTANCE_WIDGET_PROPS (i), depth + 1),
- internal_hash (IMAGE_INSTANCE_WIDGET_CALLBACK (i), depth + 1));
+ internal_hash (IMAGE_INSTANCE_WIDGET_ITEM (i), depth + 1));
case IMAGE_SUBWINDOW:
hash = HASH4 (hash, IMAGE_INSTANCE_SUBWINDOW_WIDTH (i),
IMAGE_INSTANCE_SUBWINDOW_HEIGHT (i),
DEFINE_LRECORD_IMPLEMENTATION ("image-instance", image_instance,
mark_image_instance, print_image_instance,
finalize_image_instance, image_instance_equal,
- image_instance_hash,
+ image_instance_hash, 0,
struct Lisp_Image_Instance);
static Lisp_Object
allocate_image_instance (Lisp_Object device)
{
struct Lisp_Image_Instance *lp =
- alloc_lcrecord_type (struct Lisp_Image_Instance, lrecord_image_instance);
+ alloc_lcrecord_type (struct Lisp_Image_Instance, &lrecord_image_instance);
Lisp_Object val;
zero_lcrecord (lp);
return result;
}
+static const struct lrecord_description glyph_description[] = {
+ { XD_LISP_OBJECT, offsetof(struct Lisp_Glyph, image), 5 },
+ { XD_END }
+};
+
DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS ("glyph", glyph,
mark_glyph, print_glyph, 0,
- glyph_equal, glyph_hash,
+ glyph_equal, glyph_hash, glyph_description,
glyph_getprop, glyph_putprop,
glyph_remprop, glyph_plist,
struct Lisp_Glyph);
/* This function can GC */
Lisp_Object obj = Qnil;
struct Lisp_Glyph *g =
- alloc_lcrecord_type (struct Lisp_Glyph, lrecord_glyph);
+ alloc_lcrecord_type (struct Lisp_Glyph, &lrecord_glyph);
g->type = type;
g->image = Fmake_specifier (Qimage); /* This function can GC */
{
struct font_metric_info fm;
Lisp_Object string = XIMAGE_INSTANCE_TEXT_STRING (instance);
- unsigned char charsets[NUM_LEADING_BYTES];
+ Charset_ID charsets[NUM_LEADING_BYTES];
struct face_cachel frame_cachel;
struct face_cachel *cachel;
IIFORMAT_HAS_METHOD (formatted_string, validate);
IIFORMAT_HAS_METHOD (formatted_string, possible_dest_types);
IIFORMAT_HAS_METHOD (formatted_string, instantiate);
-
IIFORMAT_VALID_KEYWORD (formatted_string, Q_data, check_valid_string);
/* subwindows */