1 /* 2 This file is part of LilyPond, the GNU music typesetter. 3 4 Copyright (C) 2005--2021 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 TIE_CONFIGURATION_HH 21 #define TIE_CONFIGURATION_HH 22 23 #include "direction.hh" 24 #include "interval.hh" 25 #include "lily-proto.hh" 26 27 #include <vector> 28 29 class Tie_configuration 30 { 31 std::string score_card_; 32 Real score_; 33 bool scored_; 34 35 public: score() const36 Real score () const { return score_; } card() const37 std::string card () const { return score_card_; } 38 39 int position_; 40 Direction dir_; 41 Real delta_y_; 42 Drul_array<int> column_ranks_; 43 44 /* computed. */ 45 Interval attachment_x_; 46 47 void add_score (Real, const std::string &); is_scored() const48 bool is_scored () const { return scored_; } set_scored()49 void set_scored () { scored_ = true; } 50 Tie_configuration (); 51 void center_tie_vertically (Tie_details const &); 52 Bezier get_transformed_bezier (Tie_details const &) const; 53 Bezier get_untransformed_bezier (Tie_details const &) const; 54 Real height (Tie_details const &) const; 55 int column_span_length () const; 56 57 static Real distance (Tie_configuration const &a, 58 Tie_configuration const &b); 59 }; 60 61 class Ties_configuration : private std::vector<Tie_configuration> 62 { 63 Real score_; 64 std::string score_card_; 65 bool scored_; 66 std::vector<std::string> tie_score_cards_; 67 68 public: 69 Ties_configuration (); 70 void add_score (Real amount, const std::string &description); 71 void add_tie_score (Real amount, vsize i, const std::string &description); is_scored() const72 bool is_scored () const { return scored_; } set_scored()73 void set_scored () { scored_ = true; } 74 Real score () const; 75 void reset_score (); 76 std::string card () const; tie_card(vsize i) const77 std::string tie_card (vsize i) const { return tie_score_cards_[i]; } 78 std::string complete_tie_card (vsize i) const; 79 std::string complete_score_card () const; 80 81 public: // exposed subset of vector interface 82 using vector::back; 83 using vector::begin; 84 using vector::empty; 85 using vector::end; 86 using vector::front; 87 using vector::operator []; 88 using vector::push_back; 89 using vector::size; 90 }; 91 92 #endif /* TIE_CONFIGURATION_HH */ 93 94