From 2f54d108daa2f342e31d307c5cbd81bacc748a79 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 23:21:21 +0000 Subject: [PATCH] lilypond-1.3.46 --- Documentation/user/properties.itely | 29 +++++++ input/bugs/volta.ly | 42 ++++++++++ input/trip.ly | 22 ++--- lily/bar-number-engraver.cc | 120 +++++++++++++++++++++++++--- lily/mark-engraver.cc | 120 ++++++++++++++++++++++++++-- lily/side-position-interface.cc | 2 +- lily/volta-spanner.cc | 7 +- ly/engraver.ly | 3 +- 8 files changed, 317 insertions(+), 28 deletions(-) create mode 100644 input/bugs/volta.ly diff --git a/Documentation/user/properties.itely b/Documentation/user/properties.itely index a73d49e5c9..815f1a65fb 100644 --- a/Documentation/user/properties.itely +++ b/Documentation/user/properties.itely @@ -7,6 +7,10 @@ property is listed in parentheses after the property name. (\t\) @end macro + +TODO: + + @table @samp @item @code{Generic_property_list} Defines names and types for generic properties. These are properties @@ -591,6 +595,9 @@ no clef is printed upon creation. @cindex properties!Score + + + @table @samp @item @code{skipBars}@indexcode{skipBars} @propertytype{boolean} Set to 1 to skip the empty bars that are produced by @@ -621,6 +628,28 @@ r1 r1*3 R1*3\property Score.skipBars=1 r1*3 R1*3 "Time_signature" ) @end example + + +@item @code{timing}@indexcode{timing} @propertytype{boolean} + Keep administration of measure length, position, bar number, etc? +Switch off for cadenzas. + +@item @code{currentBarNumber}@indexcode{currentBarNumber} @propertytype{integer} + Contains the current barnumber. This property is incremented at +every barline. + +@item @code{measurePosition}@indexcode{measurePosition} @propertytype{Moment} + + How much of the current measure (measured in whole notes) have we had? + +@item @code{oneBeat}@indexcode{oneBeat} @propertytype{Moment} + + How long does one beat in the current time signature last? + +@item @code{measureLength}@indexcode{measureLength} @propertytype{Moment} + + How long does one measure in the current time signature last? + @end table @subsubheading ChordNamesVoice properties diff --git a/input/bugs/volta.ly b/input/bugs/volta.ly new file mode 100644 index 0000000000..48889cf91a --- /dev/null +++ b/input/bugs/volta.ly @@ -0,0 +1,42 @@ + +voice4 = \notes { +\clef bass; + \property Staff.instrument = "Bass" + \property Staff.instr = "B" + \time 4/4; f,2 ( ) f,8 r8 f8 e8 +\repeat volta 2 +{ + d8. d16 e8. f16 f8 c8 c16 c8. +} +\alternative +{ + { f,2 ( ) f,8 r8 f8 e8 ( \break } + { ) f,2. r8 c16 c16 | + } +} +} +voicedefault = \notes { + \property Staff.timeSignatureStyle="C" + \time 4/4; \key f; + \tempo 4 = 200; +} +\score{ + \notes < + + + \context Staff="4" + { + \$voicedefault + \$voice4 + } + + > + \paper { + font_normal = 12.; + \translator { + \StaffContext + \consists Instrument_name_engraver; + } + } +} + diff --git a/input/trip.ly b/input/trip.ly index 09ef7e35d8..4ea9a9beae 100644 --- a/input/trip.ly +++ b/input/trip.ly @@ -135,8 +135,8 @@ fugaIILeft = \notes { \context Voice = two { \stemdown s2 e4 | fis2 fis4 } > - \stemdown cis2 e4 | - b4. b8 b4 | + \stemboth cis2 [e16( fis a \clef "treble"; b] | + d'4 ) b8 b8 b4 | %19 } @@ -152,8 +152,6 @@ fugaIIPedal = \notes \relative c { %19 } - - % these should be two separate scores... \score{ \context Score \notes < @@ -166,14 +164,18 @@ fugaIIPedal = \notes \relative c { \property Score.midiInstrument = "church organ" - \praeludiumRight r1 \fugaIIRight } - \context Staff = bass { + \praeludiumRight + r1 \mark "B"; + \fugaIIRight } + \context Staff = bass { + \property Staff.instrument = #"left" + \property Staff.instr = #"lt" \praeludiumLeft r1 \fugaIILeft } > \context Staff = pedal \relative c < { - \property Staff.instrument = #"left" - \property Staff.instr = #"lt" + \property Staff.instrument = #"bass" + \property Staff.instr = #"bs" \time 4/4; \key e; @@ -197,7 +199,9 @@ fugaIIPedal = \notes \relative c { \paper { - \translator { \OrchestralScoreContext } + \translator { + \OrchestralScoreContext + } \translator { \PianoStaffContext \consists "Instrument_name_engraver"; } diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index 53d4cf4766..3aa50afbf2 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -6,18 +6,34 @@ (c) 1997--2000 Han-Wen Nienhuys */ -#include "bar-number-engraver.hh" -#include "engraver-group-engraver.hh" + +#include "lily-guile.hh" +#include "paper-column.hh" +#include "paper-def.hh" +#include "side-position-interface.hh" +#include "staff-symbol.hh" #include "text-item.hh" #include "moment.hh" +#include "engraver.hh" +#include "protected-scm.hh" -Bar_number_engraver::Bar_number_engraver() +class Bar_number_engraver : public Engraver { - axis_ = Y_AXIS; - type_ = "barNumber"; -} - +protected: + Text_item* text_p_; + Protected_scm visibility_lambda_; + Protected_scm staffs_; +protected: + virtual void do_creation_processing (); + virtual void do_pre_move_processing (); + virtual void acknowledge_element (Score_element_info); + void create_items(); + void do_process_music (); +public: + VIRTUAL_COPY_CONS(Translator); + Bar_number_engraver(); +}; void Bar_number_engraver::do_process_music () @@ -30,13 +46,99 @@ Bar_number_engraver::do_process_music () if (gh_number_p (bn) && !mp && now_mom () > Moment (0)) { - create_items (0); + create_items (); // guh. text_p_->set_elt_property ("text", ly_str02scm (to_str (gh_scm2int (bn)).ch_C())); - } } ADD_THIS_TRANSLATOR(Bar_number_engraver); + +Bar_number_engraver::Bar_number_engraver () +{ + text_p_ =0; + staffs_ = SCM_EOL; +} + +void +Bar_number_engraver::do_creation_processing () +{ + String t = "barNumberVisibilityFunction"; + SCM proc = get_property (t); + + if (gh_procedure_p (proc)) + visibility_lambda_ = proc; +} + + + +void +Bar_number_engraver::acknowledge_element (Score_element_info inf) +{ + Score_element * s = inf.elem_l_; + if (dynamic_cast (s)) + { + staffs_ = gh_cons (inf.elem_l_->self_scm_, staffs_); + } + else if (text_p_ + && dynamic_cast (s) + && s->get_elt_property ("break-align-symbol") == ly_symbol2scm ("Left_edge_item")) + { + /* + By default this would land on the Paper_column -- so why + doesn't it work when you leave this out? */ + text_p_->set_parent (s, X_AXIS); + } +} + +void +Bar_number_engraver::do_pre_move_processing () +{ + if (text_p_) + { + text_p_->set_elt_property ("side-support", staffs_); + typeset_element (text_p_); + text_p_ =0; + } +} + + +void +Bar_number_engraver::create_items () +{ + if (text_p_) + return; + + text_p_ = new Text_item; + text_p_->set_elt_property ("breakable", SCM_BOOL_T); // ugh + Side_position_interface staffside(text_p_); + staffside.set_axis (Y_AXIS); + + SCM prop = get_property ("barNumberDirection"); + if (!isdir_b (prop)) + { + prop = gh_int2scm (UP); + } + text_p_->set_elt_property ("direction", prop); + + SCM padding = get_property ("barNumberScriptPadding"); + if (gh_number_p(padding)) + { + text_p_->set_elt_property ("padding", padding); + } + else + { + text_p_ + ->set_elt_property ("padding", + gh_double2scm(paper_l ()->get_var ("interline"))); + } + + if (gh_procedure_p (visibility_lambda_)) + text_p_->set_elt_property ("visibility-lambda", + visibility_lambda_); + + announce_element (Score_element_info (text_p_, 0)); +} + diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 1158daec6e..0c2b543d46 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -6,19 +6,41 @@ (c) 1998--2000 Jan Nieuwenhuizen */ + +#include "bar.hh" +#include "clef-item.hh" #include "command-request.hh" -#include "bar-script-engraver.hh" +#include "dimension-cache.hh" #include "engraver-group-engraver.hh" +#include "engraver.hh" +#include "lily-guile.hh" +#include "paper-column.hh" +#include "paper-def.hh" +#include "protected-scm.hh" +#include "side-position-interface.hh" +#include "staff-symbol-referencer.hh" +#include "staff-symbol.hh" #include "text-item.hh" -/**Print rehearsal marks. - */ -class Mark_engraver : public Bar_script_engraver +/** + put stuff over or next to bars. Examples: bar numbers, marginal notes, + rehearsal marks. + */ +class Mark_engraver : public Engraver { public: - Mark_engraver (); VIRTUAL_COPY_CONS(Translator); + Mark_engraver (); protected: + Text_item* text_p_; + Protected_scm visibility_lambda_; + Protected_scm staffs_; + +protected: + virtual void do_creation_processing (); + virtual void do_pre_move_processing (); + virtual void acknowledge_element (Score_element_info); + void create_items(Request*); virtual bool do_try_music (Music *req_l); virtual void do_process_music (); virtual void do_post_move_processing (); @@ -29,13 +51,94 @@ private: ADD_THIS_TRANSLATOR (Mark_engraver); + Mark_engraver::Mark_engraver () { + text_p_ =0; mark_req_l_ = 0; - axis_ = Y_AXIS; - type_ = "mark"; + staffs_ = SCM_EOL; +} + +void +Mark_engraver::do_creation_processing () +{ + String t = "markVisibilityFunction"; + SCM proc = get_property (t); + + if (gh_procedure_p (proc)) + visibility_lambda_ = proc; +} + + + +void +Mark_engraver::acknowledge_element (Score_element_info inf) +{ + Score_element * s = inf.elem_l_; + if (dynamic_cast (s)) + { + staffs_ = gh_cons (inf.elem_l_->self_scm_, staffs_); + } + else if (text_p_ && dynamic_cast (s)) + { + /* + Ugh. Figure out how to do this right at beginning of line, (without + creating class Bar_script : public Text_item). + */ + text_p_->set_parent (s, X_AXIS); + } } +void +Mark_engraver::do_pre_move_processing () +{ + if (text_p_) + { + text_p_->set_elt_property ("side-support" , staffs_); + typeset_element (text_p_); + text_p_ =0; + } +} + + +void +Mark_engraver::create_items (Request *rq) +{ + if (text_p_) + return; + + text_p_ = new Text_item; + text_p_->set_elt_property ("breakable", SCM_BOOL_T); // ugh + Side_position_interface staffside(text_p_); + staffside.set_axis (Y_AXIS); + + SCM prop = get_property ("markDirection"); + if (!isdir_b (prop)) + { + prop = gh_int2scm (UP); + } + text_p_->set_elt_property ("direction", prop); + + SCM padding = get_property ("markScriptPadding"); + if (gh_number_p(padding)) + { + text_p_->set_elt_property ("padding", padding); + } + else + { + text_p_ + ->set_elt_property ("padding", + gh_double2scm(paper_l ()->get_var ("interline"))); + } + + if (gh_procedure_p (visibility_lambda_)) + text_p_->set_elt_property ("visibility-lambda", + visibility_lambda_); + + announce_element (Score_element_info (text_p_, rq)); +} + + void Mark_engraver::do_post_move_processing () { @@ -67,6 +170,9 @@ Mark_engraver::do_process_music () String t; + /* + automatic marks. + */ SCM m = (mark_req_l_->mark_label_ == SCM_UNDEFINED) ? get_property ("rehearsalMark") : SCM(mark_req_l_->mark_label_); diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index f93dd1856f..c11f2e8909 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -71,7 +71,7 @@ Side_position_interface::side_position (Dimension_cache const * c) SCM support = me->get_elt_property ("side-support"); for (SCM s = support; s != SCM_EOL; s = gh_cdr (s)) { - Score_element * e = unsmob_element ( gh_car (s)); + Score_element * e = unsmob_element (gh_car (s)); if (e) common = common->common_refpoint (e, axis); } diff --git a/lily/volta-spanner.cc b/lily/volta-spanner.cc index b9467fb081..f3cc65b459 100644 --- a/lily/volta-spanner.cc +++ b/lily/volta-spanner.cc @@ -32,7 +32,12 @@ Volta_spanner::Volta_spanner () /* this is too complicated. Yet another version of side-positioning, - badly implemented. */ + badly implemented. + + -- + + Should look for system_start_delim to find left edge of staff. +*/ Molecule Volta_spanner::do_brew_molecule () const { diff --git a/ly/engraver.ly b/ly/engraver.ly index e32f472d02..72a0a5678e 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -242,7 +242,7 @@ StaffGroupContext= \translator { systemStartDelimiterGlyph = #'bracket - \consistsend "Axis_group_engraver" ; + \name StaffGroup; @@ -372,6 +372,7 @@ ScoreContext = \translator { Time_signature ) \consists "Spacing_engraver"; + \consists "Vertical_align_engraver"; alignmentReference = \down; defaultClef = #"treble" -- 2.39.5