]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/stencil.hh
($(outdir)/%.pdf): add DVIPS_FLAGS. This will
[lilypond.git] / lily / include / stencil.hh
1 /*
2   stencil.hh -- declare Stencil
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8 #ifndef STENCIL_HH
9 #define STENCIL_HH
10
11 #include <stdlib.h>             // size_t
12 #include "lily-proto.hh"
13 #include "box.hh"
14 #include "axes.hh"
15 #include "direction.hh"
16 #include "lily-guile.hh"
17 #include "smobs.hh"
18
19 /** a group of individually translated symbols. You can add stencils
20     to the top, to the right, etc.
21
22     It is implemented as a "tree" of scheme expressions, as in
23
24      Expr = combine Expr Expr
25               | translate Offset Expr
26               | SCHEME
27               ;
28
29     SCHEME is a Scheme expression that --when eval'd-- produces the
30     desired output.  
31
32
33     Because of the way that Stencil is implemented, it is the most
34     efficient to add "fresh" stencils to what you're going to build.
35     
36     Dimension behavior:
37
38     Empty stencils have empty dimensions.  If add_at_edge is used to
39     init the stencil, we assume that
40     DIMENSIONS = (Interval (0,0),Interval (0,0)
41 */
42 class Stencil
43 {
44   friend SCM ly_stencil_set_extent_x (SCM, SCM, SCM);
45   
46   Box dim_;
47   SCM expr_;
48   
49   DECLARE_SIMPLE_SMOBS (Stencil,);  
50 public:
51   Stencil (Box, SCM s);
52   Stencil ();
53
54
55   SCM smobbed_copy () const;
56   SCM get_expr () const;
57
58   /**
59      Set dimensions to empty, or to (Interval (0,0),Interval (0,0) */
60   void set_empty (bool);
61   void add_at_edge (Axis a, Direction d, const Stencil &m, Real padding,
62                     Real minimum);
63   void add_stencil (Stencil const &m);
64   void translate (Offset);
65   void align_to (Axis a, Real x);
66   void translate_axis (Real,Axis);
67   
68   Interval extent (Axis) const;
69   Box extent_box () const;
70   /**
71      codify THIS into a Scheme expression.
72    */
73   SCM create_scheme () const;
74   bool is_empty () const;
75
76
77   static SCM ly_get_stencil_extent (SCM mol, SCM axis);
78   static SCM ly_set_stencil_extent_x (SCM,SCM,SCM);
79   static SCM ly_stencil_combined_at_edge (SCM,SCM,SCM,SCM,SCM);
80 };
81
82
83 DECLARE_UNSMOB(Stencil,stencil);
84 SCM fontify_atom (Font_metric const*, SCM atom);
85
86 Stencil create_stencil (SCM print);
87
88
89
90 #endif