]> git.donarmstrong.com Git - lilypond.git/blob - lily/tie-helper.cc
* scm/framework-ps.scm (write-preamble): use it to pick exactly
[lilypond.git] / lily / tie-helper.cc
1 /*
2   tie-helper.cc -- implement Tie_configuration, Tie_details
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
7
8 */
9
10 #include "tie.hh"
11 #include "bezier.hh"
12 #include "grob.hh"
13 #include "staff-symbol-referencer.hh"
14 #include "warn.hh"
15 #include "tie-formatting-problem.hh"
16
17
18 /*
19   this is a macro because we want ly_symbol2scm() 
20  */
21 #define get_real_detail(src, defvalue) \
22   robust_scm2double(ly_assoc_get (ly_symbol2scm (src), details, SCM_EOL), defvalue)
23
24 void
25 Tie_details::from_grob (Grob *me)
26 {
27   staff_symbol_referencer_ = me;
28   staff_space_ = Staff_symbol_referencer::staff_space (me);
29
30   SCM details = me->get_property ("details");
31
32   height_limit_ = get_real_detail("height-limit", 0.75);
33   ratio_ = get_real_detail("ratio", .333);  
34   between_length_limit_ = get_real_detail ("between-length-limit", 1.0);
35   
36   wrong_direction_offset_penalty_ = get_real_detail("wrong-direction-offset-penalty", 10);
37   
38   length_penalty_factor_ = get_real_detail("length-penalty-factor", 1.0);
39   min_length_ = get_real_detail("min-length", 0.333);
40
41   // in half-space
42   center_staff_line_clearance_ = get_real_detail ("center-staff-line-clearance", 0.4);
43   tip_staff_line_clearance_ = get_real_detail ("tip-staff-line-clearance", 0.4);
44   staff_line_collision_penalty_ = get_real_detail("staff-line-collision-penalty", 5);
45   dot_collision_clearance_ = get_real_detail ( "dot-collision-clearance", 0.25);
46   dot_collision_penalty_ = get_real_detail ( "dot-collision-penalty", 0.25);
47   x_gap_ = get_real_detail ("note-head-gap", 0.2);
48   stem_gap_ = get_real_detail ("stem-gap", 0.3);
49   tie_column_monotonicity_penalty_ = get_real_detail ("tie-column-monotonicity-penalty", 100);
50   tie_tie_collision_penalty_ = get_real_detail ("tie-tie-collision-penalty", 30);
51   tie_tie_collision_distance_ = get_real_detail ("tie-tie-collision-distance", .25);
52   horizontal_distance_penalty_factor_ = get_real_detail ("horizontal-distance-penalty-factor", 5);
53   vertical_distance_penalty_factor_ = get_real_detail ("vertical-distance-penalty-factor", 5);
54   intra_space_threshold_ = get_real_detail ("intra-space-threshold", 1.0);
55   outer_tie_length_symmetry_penalty_factor_ = get_real_detail ("outer-tie-length-symmetry-penalty-factor", 3.0);
56   outer_tie_vertical_distance_symmetry_penalty_factor_ = get_real_detail ("outer-tie-vertical-distance-symmetry-penalty-factor", 3.0);
57   
58 }
59
60 Tie_details::Tie_details ()
61 {
62   staff_space_ = 1.0; 
63   height_limit_ = 1.0;
64   ratio_ = .333;   
65 }
66