blob: 14b3ab11e3c4fe0a53443f40f7a27b962861ffcb (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#include "lookupsyms.hh"
#include "debug.hh"
#include "symtable.hh"
#include "dimen.hh"
#include "tex.hh"
Symtables the_sym_tables("symbol.ini");
Symbol
Lookup::ball(int j)
{
if (j > 4) j = 4;
Symtable * st = the_sym_tables("balls");
return st->lookup(String(j));
}
Symbol
Lookup::rest(int j)
{
return the_sym_tables("rests")->lookup(String(j));
}
Symbol
Lookup::bar(String s)
{
return the_sym_tables("bars")->lookup(s);
}
Symbol
Lookup::dots(int j)
{
if (j>3)
error("max 3 dots");
return the_sym_tables("dots")->lookup(j);
}
/****************************************************************/
// bare bones.
struct Linestaf_symbol : Parametric_symbol {
int lines;
Linestaf_symbol(int n) { lines = n;}
Symbol eval(svec<String>)const;
};
Symbol
Linestaf_symbol::eval(svec<String> w)const
{
Real wid = w[0].fvalue();
Symbol s;
s.dim.x = Interval(0,wid);
s.dim.y = Interval(0, lines*convert_dimen(5,"pt"));
svec<String> a;
a.add(lines);
a.add(w[0]);
s.tex = the_sym_tables("param")->lookup("linestaf").tex;
s.tex = substitute_args(s.tex, a);
return s;
}
/****************************************************************
*/
struct Meter_sym:Parametric_symbol {
Symbol eval(svec<String> a) const{
Symbol s;
s.dim.x = Interval( convert_dimen(-5,"pt"), convert_dimen(10,"pt"));
s.dim.y = Interval(0, convert_dimen(10,"pt") ); // todo
String src = the_sym_tables("param")->lookup("meter").tex;
s.tex = substitute_args(src,a);
return s;
}
};
/****************************************************************/
Parametric_symbol *
Lookup::meter(String )
{
return new Meter_sym;
}
Parametric_symbol *
Lookup::linestaff(int n)
{
return new Linestaf_symbol(n);
}
|