]> git.donarmstrong.com Git - lilypond.git/blob - src/getcommands.cc
release: 0.0.23
[lilypond.git] / src / getcommands.cc
1 #include "string.hh"
2 #include "inputcommand.hh"
3 #include "parseconstruct.hh"
4 #include "command.hh"
5
6 Command*
7 get_key_typeset_command(Array<Scalar>which)
8 {
9     Command*c = new Command;
10     c->code = TYPESET;    
11     c->args = which;
12     String k("KEY");
13     c->args.insert(k,0 );
14     c->priority = 70;
15     return c;
16 }
17
18 Command *
19 get_meter_command(int n, int m)
20 {
21     Command*c = new Command;
22     
23     c->code = TYPESET;
24     c->args.add( "METER");
25     c->args.add( n );
26     c->args.add( m );
27     c->priority = 40;
28     return c;
29 }
30
31 Command
32 get_defaultbar_command()
33 {
34     Command c;
35     c.code = TYPESET;
36     c.args.add("BAR");
37     c.args.add("default");
38     return c;
39 }
40
41 void
42 split_bar_command(Command &pre_com, Command &no_break_com, Command &post_com,
43                   String s)
44 {
45     Command c;
46     c.code = TYPESET;
47     c.priority = (s=="default") ? 100: 110;
48     c.args.add("BAR");
49     if(s=="default")
50         s = "|";
51     
52     if (s == ":|:") {
53         no_break_com=post_com=pre_com = c;
54         
55         pre_com.args.add( ":|");
56         no_break_com.args.add( s);
57         post_com.args.add( "|:");
58     }else if (s=="|:") {
59         c.args.add(s);
60         no_break_com=post_com=c;
61     } else {
62         c.args.add(s);
63         pre_com= no_break_com= c;       
64     } 
65 }