(U+6215): Apply new conventions for glyph granularity.
[chise/xemacs-chise.git.1] / src / glyphs.h
index e1867af..9ad7f3e 100644 (file)
@@ -97,8 +97,9 @@ enum image_instance_geometry
 #define IMAGE_UNSPECIFIED_GEOMETRY -1
 #define IMAGE_UNCHANGED_GEOMETRY -2
 
-#define WIDGET_BORDER_HEIGHT 4
-#define WIDGET_BORDER_WIDTH 4
+#define DEFAULT_WIDGET_BORDER_WIDTH 2
+#define DEFAULT_WIDGET_SPACING 3
+#define DEFAULT_WIDGET_SHADOW_WIDTH 2
 
 enum governing_domain
 {
@@ -222,19 +223,19 @@ extern struct image_instantiator_methods *format##_image_instantiator_methods
 struct image_instantiator_methods *format##_image_instantiator_methods
 
 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name)  \
-do {                                                           \
-  format##_image_instantiator_methods =                                \
-    xnew_and_zero (struct image_instantiator_methods);         \
-  format##_image_instantiator_methods->symbol = Q##format;     \
-  format##_image_instantiator_methods->device = Qnil;          \
-  format##_image_instantiator_methods->keywords =              \
-    Dynarr_new (ii_keyword_entry);                             \
-  format##_image_instantiator_methods->consoles =              \
-    Dynarr_new (console_type_entry);                           \
-  add_entry_to_image_instantiator_format_list                  \
-    (Q##format, format##_image_instantiator_methods);          \
-  dumpstruct (&format##_image_instantiator_methods,            \
-              &iim_description);                               \
+do {                                                                   \
+  format##_image_instantiator_methods =                                        \
+    xnew_and_zero (struct image_instantiator_methods);                 \
+  format##_image_instantiator_methods->symbol = Q##format;             \
+  format##_image_instantiator_methods->device = Qnil;                  \
+  format##_image_instantiator_methods->keywords =                      \
+    Dynarr_new (ii_keyword_entry);                                     \
+  format##_image_instantiator_methods->consoles =                      \
+    Dynarr_new (console_type_entry);                                   \
+  add_entry_to_image_instantiator_format_list                          \
+    (Q##format, format##_image_instantiator_methods);                  \
+  dump_add_root_struct_ptr (&format##_image_instantiator_methods,      \
+                           &iim_description);                          \
 } while (0)
 
 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format, obj_name) \
@@ -300,19 +301,19 @@ IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 0, 0)
 DECLARE_IMAGE_INSTANTIATOR_FORMAT(format);     \
 struct image_instantiator_methods *type##_##format##_image_instantiator_methods
 
-#define INITIALIZE_DEVICE_IIFORMAT(type, format)                       \
-do {                                                                   \
-  type##_##format##_image_instantiator_methods =                       \
-    xnew_and_zero (struct image_instantiator_methods);                 \
-  type##_##format##_image_instantiator_methods->symbol = Q##format;    \
-  type##_##format##_image_instantiator_methods->device = Q##type;      \
-  type##_##format##_image_instantiator_methods->keywords =             \
-    Dynarr_new (ii_keyword_entry);                                     \
-  add_entry_to_device_ii_format_list                                   \
-    (Q##type, Q##format, type##_##format##_image_instantiator_methods);        \
-  IIFORMAT_VALID_CONSOLE(type,format);                                 \
-  dumpstruct (&type##_##format##_image_instantiator_methods,           \
-              &iim_description);                                       \
+#define INITIALIZE_DEVICE_IIFORMAT(type, format)                               \
+do {                                                                           \
+  type##_##format##_image_instantiator_methods =                               \
+    xnew_and_zero (struct image_instantiator_methods);                         \
+  type##_##format##_image_instantiator_methods->symbol = Q##format;            \
+  type##_##format##_image_instantiator_methods->device = Q##type;              \
+  type##_##format##_image_instantiator_methods->keywords =                     \
+    Dynarr_new (ii_keyword_entry);                                             \
+  add_entry_to_device_ii_format_list                                           \
+    (Q##type, Q##format, type##_##format##_image_instantiator_methods);                \
+  IIFORMAT_VALID_CONSOLE(type,format);                                         \
+  dump_add_root_struct_ptr (&type##_##format##_image_instantiator_methods,     \
+                           &iim_description);                                  \
 } while (0)
 
 /* Declare that image-instantiator format FORMAT has method M; used in
@@ -327,6 +328,8 @@ do {                                                                        \
 #define IIFORMAT_INHERITS_SHARED_DEVMETHOD(type, from, format, m, fromformat) \
   (type##_##format##_image_instantiator_methods->m##_method = from##_##fromformat##_##m)
 
+#define INSTANTIATOR_TYPE(inst) (XVECTOR_DATA ((inst))[0])
+
 struct image_instantiator_methods *
 decode_device_ii_format (Lisp_Object device, Lisp_Object format,
                         Error_behavior errb);
@@ -374,6 +377,7 @@ int layout_layout (Lisp_Object image_instance,
                   int width, int height, int xoffset, int yoffset,
                   Lisp_Object domain);
 int invalidate_glyph_geometry_maybe (Lisp_Object glyph_or_ii, struct window* w);
+Lisp_Object make_image_instance_cache_hash_table (void);
 
 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator,
                                                  int given_dest_mask,
@@ -402,7 +406,7 @@ struct image_specifier
   Lisp_Object attachee_property;/* property of that face or glyph */
 };
 
-#define IMAGE_SPECIFIER_DATA(g) (SPECIFIER_TYPE_DATA (g, image))
+#define IMAGE_SPECIFIER_DATA(g) SPECIFIER_TYPE_DATA (g, image)
 #define IMAGE_SPECIFIER_ALLOWED(g) (IMAGE_SPECIFIER_DATA (g)->allowed)
 #define IMAGE_SPECIFIER_ATTACHEE(g) (IMAGE_SPECIFIER_DATA (g)->attachee)
 #define IMAGE_SPECIFIER_ATTACHEE_PROPERTY(g) \
@@ -584,7 +588,8 @@ struct Lisp_Image_Instance
       unsigned int v_resize : 1;       /* Whether the vsize is allowed to change. */
       unsigned int h_resize : 1;       /* Whether the hsize is allowed to change. */
       unsigned int orientation : 1; /* Vertical or horizontal. */
-      unsigned int justification : 2; /* Left, right or center. */
+      unsigned int h_justification : 2; /* left, right or center. */
+      unsigned int v_justification : 2; /* top, bottom or center. */
       /* Face for colors and font. We specify this here because we
         want people to be able to put :face in the instantiator
         spec. Using glyph-face is more inconvenient, although more
@@ -613,7 +618,9 @@ struct Lisp_Image_Instance
 #define LAYOUT_VERTICAL        1
 
 #define LAYOUT_JUSTIFY_LEFT 0
+#define LAYOUT_JUSTIFY_TOP 0
 #define LAYOUT_JUSTIFY_RIGHT 1
+#define LAYOUT_JUSTIFY_BOTTOM 1
 #define LAYOUT_JUSTIFY_CENTER 2
 
 #define IMAGE_INSTANCE_HASH_DEPTH 0
@@ -705,8 +712,26 @@ struct Lisp_Image_Instance
 ((i)->u.subwindow.h_resize)
 #define IMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \
 ((i)->u.subwindow.orientation)
-#define IMAGE_INSTANCE_SUBWINDOW_JUSTIFY(i) \
-((i)->u.subwindow.justification)
+#define IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) \
+((i)->u.subwindow.h_justification)
+#define IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) \
+((i)->u.subwindow.v_justification)
+#define IMAGE_INSTANCE_SUBWINDOW_RIGHT_JUSTIFIED(i) \
+ (IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) == LAYOUT_JUSTIFY_RIGHT)
+#define IMAGE_INSTANCE_SUBWINDOW_LEFT_JUSTIFIED(i) \
+ (IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) == LAYOUT_JUSTIFY_LEFT)
+#define IMAGE_INSTANCE_SUBWINDOW_TOP_JUSTIFIED(i) \
+ (IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) == LAYOUT_JUSTIFY_TOP)
+#define IMAGE_INSTANCE_SUBWINDOW_BOTTOM_JUSTIFIED(i) \
+ (IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) == LAYOUT_JUSTIFY_BOTTOM)
+#define IMAGE_INSTANCE_SUBWINDOW_H_CENTERED(i) \
+ (IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) == LAYOUT_JUSTIFY_CENTER)
+#define IMAGE_INSTANCE_SUBWINDOW_V_CENTERED(i) \
+ (IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) == LAYOUT_JUSTIFY_CENTER)
+#define IMAGE_INSTANCE_SUBWINDOW_LOGICAL_LAYOUT(i) \
+ (IMAGE_INSTANCE_SUBWINDOW_ORIENT (i) \
+  == LAYOUT_VERTICAL && !IMAGE_INSTANCE_SUBWINDOW_V_CENTERED (i))
+
 #define IMAGE_INSTANCE_SUBWINDOW_FACE(i) \
 ((i)->u.subwindow.face)
 
@@ -729,10 +754,11 @@ struct Lisp_Image_Instance
 #define IMAGE_INSTANCE_WIDGET_PENDING_ITEMS(i) \
   ((i)->u.subwindow.pending_items)
 #define IMAGE_INSTANCE_WIDGET_ITEM(i)          \
-(CONSP (IMAGE_INSTANCE_WIDGET_ITEMS (i)) ?     \
-XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (i)) :       \
-  IMAGE_INSTANCE_WIDGET_ITEMS (i))
-#define IMAGE_INSTANCE_WIDGET_TEXT(i) XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (i))->name
+  (CONSP (IMAGE_INSTANCE_WIDGET_ITEMS (i)) ?   \
+   XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (i)) :    \
+   IMAGE_INSTANCE_WIDGET_ITEMS (i))
+#define IMAGE_INSTANCE_WIDGET_TEXT(i) \
+   XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (i))->name
 
 /* Layout properties */
 #define IMAGE_INSTANCE_LAYOUT_CHILDREN(i) ((i)->u.subwindow.children)
@@ -1144,4 +1170,6 @@ struct expose_ignore
 int check_for_ignored_expose (struct frame* f, int x, int y, int width, int height);
 extern int hold_ignored_expose_registration;
 
+#define ROUND_UP(arg, unit) (((int)((arg) + (unit) - 1) / (int)(unit)) * (int)(unit))
+
 #endif /* INCLUDED_glyphs_h_ */