lilypond-0.0.5
[lilypond.git] / lookupsyms.cc
blob66cbd6db084623fd5647d087d513c422a5b5155c
1 #include "lookupsyms.hh"
2 #include "debug.hh"
3 #include "symtable.hh"
4 #include "dimen.hh"
5 #include "tex.hh"
7 Symtables the_sym_tables("symbol.ini");
9 Symbol
10 Lookup::ball(int j)
12 if (j > 4) j = 4;
13 Symtable * st = the_sym_tables("balls");
14 return st->lookup(String(j));
17 Symbol
18 Lookup::rest(int j)
20 return the_sym_tables("rests")->lookup(String(j));
24 Symbol
25 Lookup::bar(String s)
27 return the_sym_tables("bars")->lookup(s);
29 Symbol
30 Lookup::dots(int j)
32 if (j>3)
33 error("max 3 dots");
34 return the_sym_tables("dots")->lookup(j);
37 /****************************************************************/
38 // bare bones.
40 struct Linestaf_symbol : Parametric_symbol {
41 int lines;
42 Linestaf_symbol(int n) { lines = n;}
43 Symbol eval(svec<String>)const;
47 Symbol
48 Linestaf_symbol::eval(svec<String> w)const
50 Real wid = w[0].fvalue();
52 Symbol s;
53 s.dim.x = Interval(0,wid);
54 s.dim.y = Interval(0, lines*convert_dimen(5,"pt"));
55 svec<String> a;
56 a.add(lines);
57 a.add(w[0]);
58 s.tex = the_sym_tables("param")->lookup("linestaf").tex;
59 s.tex = substitute_args(s.tex, a);
60 return s;
63 /****************************************************************
67 struct Meter_sym:Parametric_symbol {
69 Symbol eval(svec<String> a) const{
70 Symbol s;
71 s.dim.x = Interval(0, convert_dimen(10,"pt"));
72 s.dim.y = Interval(0, convert_dimen(10,"pt") );
73 String src = the_sym_tables("param")->lookup("meter").tex;
74 s.tex = substitute_args(src,a);
75 return s;
78 /****************************************************************/
80 Parametric_symbol *
81 Lookup::meter(String )
83 return new Meter_sym;
86 Parametric_symbol *
87 Lookup::linestaff(int n)
89 return new Linestaf_symbol(n);