(editor-command-template-alist): Use char iso
[lilypond/patrick.git] / lily / include / stencil.hh
blob2be9a3d7bbf61c9b7bcd214c99906c0d69da95af
1 /*
2 stencil.hh -- declare Stencil
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8 #ifndef STENCIL_HH
9 #define STENCIL_HH
11 #include <cstdlib> // size_t
13 #include "lily-proto.hh"
14 #include "box.hh"
15 #include "smobs.hh"
17 /** a group of individually translated symbols. You can add stencils
18 to the top, to the right, etc.
20 It is implemented as a "tree" of scheme expressions, as in
22 Expr = combine Expr-list
23 | translate Offset Expr
24 | origin (ORIGIN) Expr
25 | no-origin Expr
26 | (SCHEME)
29 SCHEME is a Scheme expression that --when eval'd-- produces the
30 desired output.
32 Notes:
34 * Because of the way that Stencil is implemented, it is the most
35 efficient to add "fresh" stencils to what you're going to build.
37 * Do not create Stencil objects on the heap. That includes passing
38 around Stencil* which are produced by unsmob_stencil(). Either
39 copy Stencil objects, or use SCM references.
41 * Empty stencils have empty dimensions. If add_at_edge is used to
42 init the stencil, we assume that
44 DIMENSIONS = (Interval (0, 0), Interval (0, 0)
46 class Stencil
48 friend SCM ly_stencil_set_extent_x (SCM, SCM, SCM);
51 This provides the reference point of the symbol, for example with
52 characters, it is on the base line of the character. Usually,
53 ORIGIN is inside DIM_
55 Offset origin_;
56 Box dim_;
57 SCM expr_;
59 DECLARE_SIMPLE_SMOBS (Stencil,);
60 public:
61 Stencil (Box, SCM s);
62 Stencil ();
64 Offset origin () const;
65 SCM expr () const;
67 /**
68 Set dimensions to empty, or to (Interval (0, 0), Interval (0, 0) */
69 void set_empty (bool);
70 Stencil moved_to_edge (Axis a, Direction d, const Stencil &m, Real padding,
71 Real minimum) const;
73 void add_at_edge (Axis a, Direction d, const Stencil &m, Real padding,
74 Real minimum);
75 void add_stencil (Stencil const &m);
76 void translate (Offset);
77 void align_to (Axis a, Real x);
78 void translate_axis (Real, Axis);
80 Interval extent (Axis) const;
81 Box extent_box () const;
82 bool is_empty () const;
83 Stencil in_color (Real r, Real g, Real b) const;
85 static SCM ly_get_stencil_extent (SCM mol, SCM axis);
86 static SCM ly_set_stencil_extent_x (SCM, SCM, SCM);
87 static SCM ly_stencil_combined_at_edge (SCM, SCM, SCM, SCM, SCM);
90 DECLARE_UNSMOB (Stencil, stencil);
92 void interpret_stencil_expression (SCM expr,
93 void (*func) (void *, SCM),
94 void *func_arg,
95 Offset o);
96 SCM find_expression_fonts (SCM expr);
98 void register_stencil_head (SCM symbol);
99 bool is_stencil_head (SCM symbol);
100 SCM all_stencil_heads ();
102 #endif /* STENCIL_HH */