summaryrefslogtreecommitdiff
path: root/lily/script-def.cc
blob: b74cf814f00dfbbf8c89d514681350d6368dbd08 (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
92
93
94
/*
  script-def.cc -- implement 

  source file of the GNU LilyPond music typesetter

  (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/

#include "debug.hh"
#include "script-def.hh"
#include "atom.hh"
#include "paper-def.hh"
#include "lookup.hh"

Script_def::Script_def()
{
  inside_staff_b_ = false;
  symidx_str_ = "unknown" ;
  rel_stem_dir_ =CENTER;
  staff_dir_ = DOWN;
  invertsym_b_ = 0;
  priority_i_ =0;
}

void
Script_def::set_from_input (String idx,  bool follow, int stem, int staff ,bool invert, int priority_i)
{
  inside_staff_b_ = follow;
  symidx_str_ = idx ;
  rel_stem_dir_ =Direction(stem);
  staff_dir_ = Direction(staff);
  invertsym_b_ = invert;
  priority_i_ =priority_i;
}


void
Script_def::do_print() const
{
#ifndef NPRINT
  DOUT << "Script_def{ idx: " << symidx_str_ 
       << " direction, stem: " << rel_stem_dir_ << " staff : " << staff_dir_ << "}\n";
#endif
}

bool
Script_def::do_equal_b (General_script_def const *g) const 
{
  Script_def const * c = dynamic_cast<Script_def const*> (g);
  return c&& (symidx_str_ == c->symidx_str_ &&
	  rel_stem_dir_ == c->rel_stem_dir_&&
	  staff_dir_ == c->staff_dir_&&
	  invertsym_b_ == c->invertsym_b_);
}

Direction
Script_def::staff_dir() const
{
  return staff_dir_; 
}

Direction
Script_def::rel_stem_dir() const
{
  return rel_stem_dir_; 
}

bool
Script_def::inside_b() const
{
  return inside_staff_b_; 
}

Atom
Script_def::get_atom (Paper_def *p , Direction d) const
{
  String preidx_str ="";
  if (invertsym_b_)
    preidx_str = (d < 0)? "d" : "u";

  return p->lookup_l(0)->script (preidx_str + symidx_str_);
}




int
Script_def::priority_i() const
{
  return priority_i_;
}