From: fred Date: Tue, 26 Mar 2002 23:10:12 +0000 (+0000) Subject: lilypond-1.3.40 X-Git-Tag: release/1.5.59~1717 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0f4e2c6373929a36f28d38e470054b07ca0df4da;p=lilypond.git lilypond-1.3.40 --- diff --git a/Documentation/user/properties.itely b/Documentation/user/properties.itely index ecfcfd0c50..36dbac92da 100644 --- a/Documentation/user/properties.itely +++ b/Documentation/user/properties.itely @@ -13,6 +13,18 @@ generic properties. These are properties than can be plugged into the backend directly. See the init file @file{generic-property.scm} for details. For internal use only. + +@item @code{XXXVerticalExtent}@indexcode{groupVerticalExtent} +@propertytype{Interval: a cons of numbers} + + Hard code the size of the vertical group in context XXX, example +@example + \property Staff.StaffVerticalExtent = #(-5.0 . 5.0) +@end example + The value is a cons of real numbers, that measure the extent in +staff spaces + + @cindex properties!Lyrics @table @samp diff --git a/input/test/asciscript5.ly b/input/test/asciscript5.ly new file mode 100644 index 0000000000..cdc0727eb1 --- /dev/null +++ b/input/test/asciscript5.ly @@ -0,0 +1,16 @@ +\include "paper-as5.ly" + +\score { + \notes\relative c''{ + \time 4/4; + g1 a b c + g2 a b c + g4 a b c + } + \paper { + \paper_as_five + \translator { \StaffContext barSize = #5 } + } + +} + diff --git a/input/test/lyrics.ly b/input/test/lyrics.ly new file mode 100644 index 0000000000..89146f1c4e --- /dev/null +++ b/input/test/lyrics.ly @@ -0,0 +1,66 @@ +\version "1.3.5"; + +$somewhat_long = \lyrics{ + \property Lyrics . textStyle = "roman" + AaaaaaA2 + BbbbbbB2 + CcccccC2 + DdddddD2 + EeeeeeE2 + FfffffF2 +} + +$rather_long = \lyrics{ + \property Lyrics . textStyle = "roman" + LLLLoooonggggg2 + Syyllllaaabbble2 + LLLLoooonggggg2 + Syyllllllaaabbble2 + LLLLoooonggggg2 + Syyyylllaaabbble2 +} + +$quite_long = \lyrics{ + \property Lyrics . textStyle = "roman" + LLLLLLLLLooooongggggggg2 + Syyyyyyyyyyyyylllllllaaaaaabbble2 + LLLLLLLLLooooongggggggg2 + Syyyyyyyyyyyyylllllllaaaaaabbble2 + LLLLLLLLLooooongggggggg2 + Syyyyyyyyyyyyylllllllaaaaaabbble2 +} + +$somewhat_long_lyrics_staff = \context Lyrics = somewhat < + \$somewhat_long +> + +$rather_long_lyrics_staff = \context Lyrics = rather < + \$rather_long +> + +$quite_long_lyrics_staff = \context Lyrics = quite < + \$quite_long +> + +melody = \notes +\transpose c'{ + c4 e4 g4 e4 c4 e4 g4 e4 c4 e4 g4 e4 c4 e4 g4 e4 + c4 e4 g4 e4 c4 e4 g4 e4 c4 e4 g4 e4 c4 e4 g4 e4 +} + +$melodic_staff = \context Staff = mel < + \melody +> + +\score +{ + < + \$melodic_staff + \$somewhat_long_lyrics_staff +% \$rather_long_lyrics_staff + \$quite_long_lyrics_staff + > + \paper{ +% castingalgorithm = \Wordwrap; + } +} diff --git a/input/test/vertical-extent.ly b/input/test/vertical-extent.ly new file mode 100644 index 0000000000..b944b43fe2 --- /dev/null +++ b/input/test/vertical-extent.ly @@ -0,0 +1,7 @@ + +\score { +\notes \context Staff { + \property Staff.StaffVerticalExtent = #'(-15.0 . 15.0) + c1 \break c1 +} +} diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc index 69ea5fee61..d6f881d6fc 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -10,6 +10,8 @@ #include "spanner.hh" #include "paper-column.hh" #include "axis-group-interface.hh" +#include "dimension-cache.hh" +#include "engraver-group-engraver.hh" Axis_group_engraver::Axis_group_engraver () { @@ -35,6 +37,16 @@ Axis_group_engraver::get_spanner_p () const void Axis_group_engraver::do_removal_processing () { + String name = daddy_grav_l ()->type_str_ + "VerticalExtent"; + SCM dims = get_property (name); + + if (gh_pair_p (dims) && gh_number_p (gh_car (dims)) + && gh_number_p (gh_cdr (dims))) + { + staffline_p_->dim_cache_[Y_AXIS]->set_extent_callback (&Score_element::preset_extent); + staffline_p_->set_elt_property ("extent-Y", dims); + } + staffline_p_->set_bound(RIGHT,get_staff_info().command_pcol_l ()); typeset_element (staffline_p_); staffline_p_ = 0; diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index f15c84ca5c..8cdb9ef67a 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -98,8 +98,8 @@ Axis_group_interface::set_axes (Axis a1, Axis a2) if (a1 != Y_AXIS && a2 != Y_AXIS) elt_l_->set_empty (Y_AXIS); - elt_l_->dim_cache_[a1]->set_callback (Axis_group_interface::group_extent_callback); - elt_l_->dim_cache_[a2]->set_callback (Axis_group_interface::group_extent_callback); + elt_l_->dim_cache_[a1]->set_extent_callback (Axis_group_interface::group_extent_callback); + elt_l_->dim_cache_[a2]->set_extent_callback (Axis_group_interface::group_extent_callback); } Link_array diff --git a/lily/dimension-cache.cc b/lily/dimension-cache.cc index eb6f7c24a9..ad4c630c0a 100644 --- a/lily/dimension-cache.cc +++ b/lily/dimension-cache.cc @@ -136,7 +136,7 @@ Dimension_cache::get_dim () const } void -Dimension_cache::set_callback (Dim_cache_callback c) +Dimension_cache::set_extent_callback (Dim_cache_callback c) { extent_callback_l_ =c; } diff --git a/lily/extender-spanner.cc b/lily/extender-spanner.cc index dd9e1a9bdd..5f0a9d2dae 100644 --- a/lily/extender-spanner.cc +++ b/lily/extender-spanner.cc @@ -24,7 +24,7 @@ Extender_spanner::Extender_spanner () : Spanner () { dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0; - dim_cache_[Y_AXIS]->set_callback (Dimension_cache::point_dimension_callback); + dim_cache_[Y_AXIS]->set_extent_callback (Dimension_cache::point_dimension_callback); } diff --git a/lily/hyphen-spanner.cc b/lily/hyphen-spanner.cc index 5f41e23d53..d1429698a3 100644 --- a/lily/hyphen-spanner.cc +++ b/lily/hyphen-spanner.cc @@ -27,7 +27,7 @@ Hyphen_spanner::Hyphen_spanner () { dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0; - dim_cache_[Y_AXIS]->set_callback (Dimension_cache::point_dimension_callback); + dim_cache_[Y_AXIS]->set_extent_callback (Dimension_cache::point_dimension_callback); } Molecule diff --git a/lily/include/dimension-cache.hh b/lily/include/dimension-cache.hh index e110041d0b..f40337564c 100644 --- a/lily/include/dimension-cache.hh +++ b/lily/include/dimension-cache.hh @@ -45,7 +45,7 @@ public: static Interval point_dimension_callback (Dimension_cache const* ); Axis axis () const; Real get_offset () const; - void set_callback (Dim_cache_callback); + void set_extent_callback (Dim_cache_callback); Dimension_cache * parent_l_; Score_element *element_l () const { return elt_l_; } diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 51893560cc..f181878735 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -126,6 +126,8 @@ public: void add_dependency (Score_element*); virtual Line_of_score * line_l () const; bool linked_b () const; + + VIRTUAL_COPY_CONS(Score_element); /** @@ -150,6 +152,9 @@ public: /// do calculations before determining horizontal spacing virtual void before_line_breaking (); + static Interval preset_extent (Dimension_cache const*); + static Interval molecule_extent (Dimension_cache const*); + protected: /** @@ -158,8 +163,7 @@ protected: virtual ~Score_element (); virtual void output_processing (); - static Interval molecule_extent (Dimension_cache const*); - + /// do printing of derived info. virtual void do_print () const; /// generate the molecule diff --git a/lily/lexer.ll b/lily/lexer.ll index b567746c36..cbe754c5c3 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -511,7 +511,7 @@ My_lily_lexer::scan_bare_word (String str) yylval.pitch->set_spot (Input (source_file_l (), here_ch_C ())); return (YYSTATE == notes) ? NOTENAME_PITCH : TONICNAME_PITCH; - } else if ((pitch = scm_hashq_ref (pitchname_tab_, sym, SCM_BOOL_F))!= SCM_BOOL_F) + } else if ((pitch = scm_hashq_ref (chordmodifier_tab_, sym, SCM_BOOL_F))!= SCM_BOOL_F) { yylval.pitch = new Musical_pitch (pitch); yylval.pitch->set_spot (Input (source_file_l (), diff --git a/lily/paper-score.cc b/lily/paper-score.cc index 7da9928364..247b5fecad 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -187,7 +187,6 @@ Paper_score::process () */ line_l_->output_lines (); - SCM font_names = ly_quote_scm (all_fonts_global_p->font_descriptions ()); gh_set_cdr_x (before_output, gh_cons (gh_list (ly_symbol2scm ("define-fonts"), @@ -243,7 +242,7 @@ Paper_score::fixup_refpoints () { Score_element * se = unsmob_element (e); se->fixup_refpoint (); - + if (!dynamic_cast (se) && !se->parent_l (Y_AXIS)) { programming_error ("No parent!"); diff --git a/lily/score-element.cc b/lily/score-element.cc index 49de87c742..342270343c 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -27,7 +27,6 @@ #include "dimension-cache.hh" #include "side-position-interface.hh" #include "item.hh" - /* TODO: @@ -44,8 +43,8 @@ Score_element::Score_element() // junkme. used_b_ = false; - dim_cache_[X_AXIS]->set_callback (molecule_extent); - dim_cache_[Y_AXIS]->set_callback (molecule_extent); + dim_cache_[X_AXIS]->set_extent_callback (molecule_extent); + dim_cache_[Y_AXIS]->set_extent_callback (molecule_extent); used_b_ = false; pscore_l_=0; lookup_l_ =0; @@ -135,11 +134,31 @@ Score_element::set_elt_property (String k, SCM v) } Interval -Score_element::molecule_extent(Dimension_cache const *c) +Score_element::molecule_extent (Dimension_cache const *c) { Score_element *s = dynamic_cast(c->element_l()); Molecule m = s->do_brew_molecule(); - return m.extent()[c->axis ()]; + return m.extent()[c->axis ()]; +} + +Interval +Score_element::preset_extent (Dimension_cache const *c) +{ + Score_element *s = dynamic_cast(c->element_l()); + SCM ext = s->get_elt_property ((c->axis () == X_AXIS) + ? "extent-X" + : "extent-Y"); + + if (gh_pair_p (ext)) + { + Real l = gh_scm2double (gh_car (ext)); + Real r = gh_scm2double (gh_cdr (ext)); + l *= s->paper_l ()->get_var ("staffspace"); + r *= s->paper_l ()->get_var ("staffspace"); + return Interval (l, r); + } + + return Interval (); } @@ -555,7 +574,7 @@ Score_element::fixup_refpoint () if (!parent) continue; - if (parent->line_l () != line_l ()) + if (parent->line_l () != line_l () && line_l ()) { Score_element * newparent = parent->find_broken_piece (line_l ()); set_parent (newparent, ax); diff --git a/lily/span-bar.cc b/lily/span-bar.cc index d16081928e..ac458ad177 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -152,7 +152,7 @@ Span_bar::get_bar_size () const Span_bar::Span_bar () { group (this).set_interface (); - dim_cache_[X_AXIS]->set_callback (width_callback); - dim_cache_[Y_AXIS]->set_callback (height_callback); + dim_cache_[X_AXIS]->set_extent_callback (width_callback); + dim_cache_[Y_AXIS]->set_extent_callback (height_callback); } diff --git a/lily/volta-spanner.cc b/lily/volta-spanner.cc index 79c1829824..b9467fb081 100644 --- a/lily/volta-spanner.cc +++ b/lily/volta-spanner.cc @@ -24,12 +24,15 @@ Volta_spanner::Volta_spanner () { - //dim_cache_ [Y_AXIS]->set_callback (dim_callback); set_elt_property ("bars", SCM_EOL); side_position (this).set_axis (Y_AXIS); directional_element (this).set (UP); } + +/* + this is too complicated. Yet another version of side-positioning, + badly implemented. */ Molecule Volta_spanner::do_brew_molecule () const { diff --git a/ly/engraver.ly b/ly/engraver.ly index 4d867868af..571ca885ed 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -255,7 +255,7 @@ LyricsContext = \translator { \type "Engraver_group_engraver"; \name Lyrics; \consists Vertical_align_engraver;%need this for getting folded repeats right. - + Generic_property_list = #generic-lyrics-properties \consists "Property_engraver"; \consistsend "Axis_group_engraver"; diff --git a/scm/generic-property.scm b/scm/generic-property.scm index 358e1f3a71..554408caff 100644 --- a/scm/generic-property.scm +++ b/scm/generic-property.scm @@ -177,6 +177,14 @@ )) ) + + + + +;;;;;;;;;; +;; don't forget to add these to the Generic_property_list property in +;; engraver.ly + (define generic-voice-properties (list generic-stem-properties @@ -225,5 +233,4 @@ (define generic-lyrics-properties (list generic-text-properties ) - )