]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/slur-configuration.hh
5114815619659f834461230d21512715fda383f1
[lilypond.git] / lily / include / slur-configuration.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2004--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef SLUR_CONFIGURATION_HH
21 #define SLUR_CONFIGURATION_HH
22
23 #include "bezier.hh"
24 #include "lily-proto.hh"
25 #include "std-vector.hh"
26
27 class Slur_configuration
28 {
29   Real score_;
30   string score_card_;
31
32 public:
33   Drul_array<Offset> attachment_;
34   Bezier curve_;
35   Real height_;
36   int index_;
37
38   enum Slur_scorers
39   {
40     INITIAL_SCORE,
41     SLOPE,
42     EDGES,
43     EXTRA_ENCOMPASS,
44     ENCOMPASS,
45     NUM_SCORERS,
46   };
47
48   int next_scorer_todo;
49
50   Slur_configuration ();
51
52   Real score () const { return score_; }
53   string card () const { return score_card_; }
54   void add_score (Real, const string&);
55
56   void generate_curve (Slur_score_state const &state, Real r0, Real h_inf,
57                        vector<Offset> const &);
58   void run_next_scorer (Slur_score_state const &);
59   bool done () const;
60   static Slur_configuration *new_config (Drul_array<Offset> const &offs, int idx);
61
62 protected:
63   void score_extra_encompass (Slur_score_state const &);
64   void score_slopes (Slur_score_state const &);
65   void score_edges (Slur_score_state const &);
66   void score_encompass (Slur_score_state const &);
67
68   friend class Slur_configuration_less;
69 };
70
71 // Comparator for a queue of Beam_configuration*.
72 class Slur_configuration_less
73 {
74 public:
75   bool operator () (Slur_configuration *const &l, Slur_configuration *const &r)
76   {
77     // Invert
78     return l->score_ > r->score_;
79   }
80 };
81
82 #endif /* SLUR_CONFIGURATION_HH */
83