From 8e71471369508302587de780139b5294e2b8a597 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 21:48:48 +0000 Subject: [PATCH] lilypond-1.1.38 --- Documentation/tex/refman.yo | 14 +- NEWS | 48 +++- flower/include/axes.hh | 2 - input/test/hara-kiri.ly | 6 +- input/test/incipit.ly | 36 +++ input/test/script-column.fly | 3 + lily/afm-reader.cc | 7 +- lily/axis-align-item.cc | 8 +- lily/axis-group-spanner.cc | 13 +- lily/clef-engraver.cc | 5 + lily/clef-item.cc | 15 +- lily/collision.cc | 17 +- lily/command-request.cc | 53 +--- lily/direction.cc | 5 +- lily/dynamic-engraver.cc | 3 + lily/extender-engraver.cc | 1 - lily/g-script-column-engraver.cc | 93 ++++++ lily/g-script-column.cc | 76 +++++ lily/g-script-engraver.cc | 135 +++++++++ lily/g-script.cc | 75 +++++ lily/g-staff-side.cc | 59 +++- lily/g-stem-staff-side.cc | 55 ++++ lily/g-text-item.cc | 8 +- lily/identifier.cc | 5 - lily/include/axis-align-item.hh | 3 +- lily/include/axis-group-spanner.hh | 4 +- lily/include/clef-item.hh | 2 +- lily/include/command-request.hh | 84 +++--- lily/include/g-script-column.hh | 30 ++ lily/include/g-script-engraver.hh | 31 ++ lily/include/g-script.hh | 40 +++ lily/include/g-staff-side.hh | 18 +- lily/include/g-stem-staff-side.hh | 40 +++ lily/include/g-text-item.hh | 4 + lily/include/identifier.hh | 3 +- lily/include/lily-proto.hh | 3 + lily/include/line-of-score.hh | 15 +- lily/include/lookup.hh | 4 +- lily/include/ly-symbols.hh | 1 + lily/include/musical-request.hh | 134 ++++----- lily/include/note-column.hh | 11 +- lily/include/paper-outputter.hh | 2 +- lily/include/request.hh | 32 +-- lily/include/rhythmic-column-engraver.hh | 1 - lily/include/score-element.hh | 12 +- lily/include/stem.hh | 3 +- lily/include/super-element.hh | 12 +- lily/include/tuplet-spanner.hh | 9 +- lily/include/volta-spanner.hh | 6 +- lily/line-of-score.cc | 70 ++--- lily/lookup.cc | 15 +- lily/lyric-performer.cc | 1 - lily/multi-measure-rest.cc | 13 +- lily/music-output-def.cc | 2 + lily/musical-request.cc | 187 ++---------- lily/my-lily-parser.cc | 14 - lily/note-column.cc | 48 +--- lily/p-score.cc | 3 +- lily/paper-outputter.cc | 6 +- lily/parser.yy | 348 ++++++++++------------- lily/repeat-engraver.cc | 8 +- lily/request.cc | 1 + lily/rest-collision.cc | 9 +- lily/rhythmic-column-engraver.cc | 22 +- lily/score-element.cc | 7 +- lily/score-engraver.cc | 7 +- lily/slur-engraver.cc | 5 +- lily/slur.cc | 2 +- lily/spanner.cc | 15 +- lily/stem.cc | 11 +- lily/super-element.cc | 15 +- lily/text-engraver.cc | 30 +- lily/time-signature-performer.cc | 11 +- lily/tuplet-engraver.cc | 7 +- lily/tuplet-spanner.cc | 11 +- lily/volta-spanner.cc | 21 +- ly/declarations.ly | 4 +- ly/engraver.ly | 3 +- ly/script.ly | 93 ++---- mf/feta-bolletjes.mf | 2 +- scm/lily.scm | 20 +- scm/script.scm | 38 +++ 82 files changed, 1385 insertions(+), 910 deletions(-) create mode 100644 input/test/incipit.ly create mode 100644 input/test/script-column.fly create mode 100644 lily/g-script-column-engraver.cc create mode 100644 lily/g-script-column.cc create mode 100644 lily/g-script-engraver.cc create mode 100644 lily/g-script.cc create mode 100644 lily/g-stem-staff-side.cc create mode 100644 lily/include/g-script-column.hh create mode 100644 lily/include/g-script-engraver.hh create mode 100644 lily/include/g-script.hh create mode 100644 lily/include/g-stem-staff-side.hh create mode 100644 scm/script.scm diff --git a/Documentation/tex/refman.yo b/Documentation/tex/refman.yo index 251d65d461..2eba7062cd 100644 --- a/Documentation/tex/refman.yo +++ b/Documentation/tex/refman.yo @@ -1080,7 +1080,8 @@ mudela(center)( \clef baritone; c'4_"\kern -10mm baritone" \clef varbaritone; c'4^"\kern -10mm varbaritone" \clef tenor; c'4_"\kern -10mm tenor" - \clef "G_8"; c'4^"\kern -6mm G\_8" } +% \clef "G_8"; c'4^"\kern -6mm G\_8" %%% BROKEN! + } \paper{ linewidth= 4.5 \in; } } ) @@ -1573,13 +1574,18 @@ mudela(fragment,center)( } ) -COMMENT(Broken!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!) +dit(code(restStyle)) Change the layout of rests shorter than quarter notes. +Currently, the standard layout code(restStyle="") and mensural notation +code(restStyle="mensural") are available. +dit(code(clefStyle)) Determines how clefs are typeset. When set to +code(transparent), the clefs are not printed at all, when set to +code(fullSizeChanges), clef changes in the middle of a line are +typeset with a full size clef. By default, clef changes are typeset in +smaller size. ) - - subsubsubsect(GrandStaff properties) description( diff --git a/NEWS b/NEWS index 8c09cf7b0e..00ccefc193 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,45 @@ +pl 37.script2 + - bf: AFM for BlueSky AFM files. + - \penalty = 4278 -> \penalty 4278 + - URG!! fixed major (unnoticed) bug in dependency engine + - Further Script hacking: + * G_script_column + * G_script_column_engraver + + pl 37.script1 + - major Script rehack: + * G_stem_staff_side_item + * G_script + * G_script_engraver + * G_script_req + - junked Text_def, changed \property textstyle -> \property textStyle +(todo -> convert-mudela) + - Line_of_score is an Axis_group_element, no more overlapping +lines, hopefully. + - mf: whole diamond head tweak + +pl 37.mb2 + - Added property clefStyle: "" / "transparent" / "fullSizeChanges" + - New example: input/test/incipit.ly + - Documented clefStyle and restStyle in refman.tex + - Partial bug fix: octaviated clefs. Still broken!!! - - diamond heads (probably really ugly). - - cross head. - - tweaked harmonic head a bit. - - property noteHeadStyle + +pl 37.mb1 + - Added property restStyle. + - mensural 4th, 8th and 16th rests. +pl 37.uu1 + - FreeBSD bf + +**** +pl 37 (march 30, 1999) + - note head styles, see input/test/noteheadstyle.fly + * \property noteHeadStyle: + * diamond note heads (probably really ugly) + * cross note head. + * harmonic head (mf sources were tweaked) + * transparent for no \heads + * \property noteHeadStyle ="" for normal heads. pl 36.mb2 - bf: timeSignatureStyle @@ -13,11 +50,12 @@ pl 36.hwn1 - debian fixes. - don't insert extra alignment space for empty stuff. - Align_element derives from Axis_group_element + - junk cruft for detecting upbeam / downbeam. - junk all *{horizontal,vertical}* Score_element derived classes. - G_staff_side_item::padding_f_ now generic property. - some tweaking of beam & stem. - junk pointerlist in Sources - - junk Stem::mult_i_, Stem::beam_gap_i_, G_staff_side_item::padding + - junk Stem::mult_i_, Stem::beam_gap_i_, G_staff_side_item::padding, Bar::at_line_start_b_, Key_item::c_position_, Note_head::type_str_, Note_head::staff_size, Stem::xdir_ diff --git a/flower/include/axes.hh b/flower/include/axes.hh index dfacac28a1..b67eb47766 100644 --- a/flower/include/axes.hh +++ b/flower/include/axes.hh @@ -16,13 +16,11 @@ enum Axis { NO_AXES=2, }; -#ifndef STANDALONE #include "string.hh" // ugh String axis_name_str (Axis); -#endif // STANDALONE /** the operator ++ for Axis. diff --git a/input/test/hara-kiri.ly b/input/test/hara-kiri.ly index 3acad5cad5..bdfbe78404 100644 --- a/input/test/hara-kiri.ly +++ b/input/test/hara-kiri.ly @@ -29,7 +29,7 @@ toeters = \type Staff = toeters < \toeter_ii > -zager = \type Staff = zager \notes \relative c { +zager = \type Staff = zager \notes \relative c'' { \clef bass; \property Staff.instrument = "Zager" \property Staff.instr = "Zag." @@ -45,7 +45,7 @@ zager = \type Staff = zager \notes \relative c { f e d c } -zoger = \type Staff = zoger \notes \relative c { +zoger = \type Staff = zoger \notes \relative c'' { \clef bass; \property Staff.instrument = "Zoger" \property Staff.instr = "Zog." @@ -76,7 +76,7 @@ zagers = \type GrandStaff < > \paper{ linewidth = 40.0\mm; - \translator { \HaraKiriStaffContext } +% \translator { \HaraKiriStaffContext } %uh? % \translator { \OrchestralScoreContext } % \translator { \OrchestralPartStaffContext } diff --git a/input/test/incipit.ly b/input/test/incipit.ly new file mode 100644 index 0000000000..150367dbbb --- /dev/null +++ b/input/test/incipit.ly @@ -0,0 +1,36 @@ +%{ + Test of how to make an ``incipit'' to indicate scordatora + tuning of a violin part, using the clefStyle property. + The two first bars of Biber's Rosary sonata III. + + /Mats B +%} + +\version "1.0.14"; + +incipit = \notes\relative c'{ + +} + +violin = \notes\relative c''{ + \specialkey \keysignature f' fis'' g' gis''; + \time 2/2; + + a4. b8 c4 fis | + gis~ gis8 fis16^\trill ()e b8 c \type Staff<{\voiceone a d}{\voicetwo es,4}>| +} + +\score{ + \notes{ + \property Staff.clefStyle = "transparent" + \incipit + \property Staff.clefStyle = "fullSizeChanges" \clef "treble"; \bar ""; + \violin + } + \paper{ + \translator{\StaffContext + timeSignatureStyle = "C"; + } + } +} + diff --git a/input/test/script-column.fly b/input/test/script-column.fly new file mode 100644 index 0000000000..381c5fbcfd --- /dev/null +++ b/input/test/script-column.fly @@ -0,0 +1,3 @@ +%c''4^|^.^"foo"^"klap" +c''4^|^.^"foo"^"klap"^"puk"^\fermata^\stopped +c4_|_._"foo"_"klap"_"puk"_\fermata_\stopped diff --git a/lily/afm-reader.cc b/lily/afm-reader.cc index 5a606bd28d..7663aab22b 100644 --- a/lily/afm-reader.cc +++ b/lily/afm-reader.cc @@ -47,6 +47,8 @@ read_char_metric (String s, int size) String c = strip_leading_white (a[i]); Array b = String_convert::split_arr (c, ' '); + if (!b.size ()) + continue; if (b[0] == "C") char_metric.C_ = b[1].value_i (); else if (b[0] == "WX") @@ -71,7 +73,10 @@ Adobe_font_metric::read_char_metrics (Data_file &input, int size) Adobe_font_char_metric afm_char =read_char_metric (s, size); char_metrics_.push (afm_char); int i = char_metrics_.size ()-1; - ascii_to_metric_idx_ [afm_char.C_] = i; + + // TFM files uses neg. charcodes to store Space + if (afm_char.C_ >= 0) + ascii_to_metric_idx_ [afm_char.C_] = i; name_to_metric_dict_ [afm_char.N_] = i; } } diff --git a/lily/axis-align-item.cc b/lily/axis-align-item.cc index a8859ba588..8990872b21 100644 --- a/lily/axis-align-item.cc +++ b/lily/axis-align-item.cc @@ -1,5 +1,5 @@ /* - axis-align-item.cc -- implement + axis-align-item.cc -- implement Axis_align_item source file of the GNU LilyPond music typesetter @@ -12,3 +12,9 @@ Axis_align_item::Axis_align_item () { } + +void +Axis_align_item::do_print () const +{ + Axis_group_item::do_print (); +} diff --git a/lily/axis-group-spanner.cc b/lily/axis-group-spanner.cc index 58214f5137..b625c6c6b3 100644 --- a/lily/axis-group-spanner.cc +++ b/lily/axis-group-spanner.cc @@ -34,15 +34,24 @@ Axis_group_spanner::do_break_processing_if_unbroken() item_l->find_prebroken_piece (my_line); add_element (broken_item_l); } - remove_element (elems[i]); + + Spanner *spanner_l = dynamic_cast (elems[i]); + if (spanner_l) + { + Spanner *broken_spanner_l = + spanner_l->find_broken_piece (my_line); + add_element (broken_spanner_l); + } + remove_element (elems[i]); } + } } void Axis_group_spanner::do_break_processing() { - DOUT << "do_break_processing ()\n"; + bool breaking_self_b = ! Spanner::line_l(); if (!breaking_self_b) { diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index da300420b1..0e0c79cc84 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -190,6 +190,11 @@ Clef_engraver::create_clef() { Clef_item *c= new Clef_item; c->set_elt_property (break_priority_scm_sym, gh_int2scm (-2)); // ugh + String clefstyle = get_property ("clefStyle", 0); + if (clefstyle.length_i ()) + c->set_elt_property (style_scm_sym, + gh_str02scm (clefstyle.ch_C())); + announce_element (Score_element_info (c, clef_req_l_)); clef_p_ = c; } diff --git a/lily/clef-item.cc b/lily/clef-item.cc index 282bd535ec..2e65640039 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -19,10 +19,15 @@ void Clef_item::do_pre_processing() { dim_cache_[Y_AXIS].translate (y_position_i_ * staff_line_leading_f () / 2.0); - if (break_status_dir() != RIGHT) - { - symbol_ += "_change"; - } + SCM style_sym =get_elt_property (style_scm_sym); + String style; + if (style_sym != SCM_BOOL_F) + style = ly_scm2string (SCM_CDR(style_sym)); + + if (break_status_dir() != RIGHT && style != "fullSizeChanges") + symbol_ += "_change"; + if (style == "transparent") + set_elt_property (transparent_scm_sym, SCM_BOOL_T); } /* @@ -46,7 +51,7 @@ Clef_item::do_add_processing () SCM octave_dir = remove_elt_property (octave_dir_scm_sym); if (octave_dir != SCM_BOOL_F) { - Direction d = Direction (gh_int2scm (SCM_CDR(octave_dir))); + Direction d = Direction (gh_scm2int (SCM_CDR(octave_dir))); g = new G_text_item; pscore_l_->typeset_element (g); diff --git a/lily/collision.cc b/lily/collision.cc index 706301aad1..56676c1d99 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -19,7 +19,6 @@ Collision::Collision() void Collision::add_column (Note_column* ncol_l) { - // ugh. Fixme. clash_l_arr_.push (ncol_l); add_element (ncol_l); add_dependency (ncol_l); @@ -33,7 +32,7 @@ int idx (int dir, bool h_shift_b) assert (abs (dir) == 1); int j = dir > 0 ? 0 : 3; if (h_shift_b) - j += dir; + j += dir; return j; } @@ -49,22 +48,22 @@ void Collision::do_pre_processing() { if (clash_l_arr_.size() <= 1) - return; + return; /* [stem up, stem up shifted, stem down shifted, stem down] - */ + */ Array clash_group_arr_a[4]; for (int i=0; i < clash_l_arr_.size(); i++) { Note_column* c_l = clash_l_arr_[i]; - if (! c_l->dir_) + Direction d = c_l->dir (); + if (!d) { warning (_ ("No stem direction set. Ignoring column in clash.")); continue; } - int d = (c_l->dir_); SCM shift = c_l->remove_elt_property (horizontal_shift_scm_sym); bool shift_b = (shift != SCM_BOOL_F); @@ -130,6 +129,7 @@ Collision::do_pre_processing() x_off[idx (d, true)] = d *1.0 ; } while ((d *= -1) != 1); + if (!middle.empty_b() && middle.length() < 2 && col_l_a[idx (1,0)] && col_l_a[idx (-1,0)]) { // reproduction of bugfix at 3am ? @@ -151,13 +151,8 @@ Collision::do_pre_processing() { if (col_l_a[j]) { - /* collision.cc:138: request for method `translate' is ambiguous - - (shaddup) - */ Offset o (x_off[j] * wid_f, 0); col_l_a[j]->translate (o); - // ((Score_element*)col_l_a[j])->translate (o); } } } diff --git a/lily/command-request.cc b/lily/command-request.cc index 904c74da9a..84ff56f9f7 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -10,17 +10,6 @@ #include "debug.hh" #include "musical-request.hh" -void -Command_script_req::do_print() const -{} -Command_script_req::Command_script_req(){} -Command_script_req::~Command_script_req(){} - - - - - - void Cadenza_req::do_print() const { @@ -58,14 +47,11 @@ Bar_req::do_equal_b (Request*r) const void Bar_req::do_print() const { +#ifndef NPRINT DOUT << type_str_; +#endif } -void -Bracket_req::do_print () const -{ - Span_req::do_print (); -} Bar_req::Bar_req (String s) { @@ -87,21 +73,6 @@ Partial_measure_req::do_equal_b (Request* r) const - -void -Timing_req::do_print() const{} - - - - -void -Command_req::do_print() const{} - - - -void -Barcheck_req::do_print() const{} - bool Barcheck_req::do_equal_b (Request*r) const { @@ -109,9 +80,6 @@ Barcheck_req::do_equal_b (Request*r) const return b; } - - - void Clef_change_req::do_print() const { @@ -125,11 +93,6 @@ Clef_change_req::Clef_change_req (String s) clef_str_ = s; } - - - - - void Partial_measure_req::do_print() const { @@ -184,11 +147,6 @@ Tempo_req::do_equal_b (Request *r) const return t&& t->dur_.length_mom ()== dur_.length_mom () && metronome_i_ == t->metronome_i_; } - - - - - void Measure_grouping_req::do_print() const { @@ -333,13 +291,6 @@ Break_req::Break_req () penalty_i_ = 0; } -void -Break_req::do_print () const -{ -} - - - Mark_req::Mark_req (String s) { str_ = s; diff --git a/lily/direction.cc b/lily/direction.cc index a0ac3e6bbf..f4b46b1f5e 100644 --- a/lily/direction.cc +++ b/lily/direction.cc @@ -9,8 +9,8 @@ #include "direction.hh" -#if 0 -String direction_str (Direction d, Axis a) +String +direction_str (Direction d, Axis a) { String s("center"); if (a == Y_AXIS) @@ -23,4 +23,3 @@ String direction_str (Direction d, Axis a) } return s; } -#endif diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index f3e72a2df3..e2188d4eb7 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -101,6 +101,9 @@ Dynamic_engraver::do_process_requests() text_p_->style_str_ = prop.length_i () ? prop : "dynamic"; staff_side_p_ = new G_staff_side_item; + staff_side_p_->set_elt_property (script_priority_scm_sym, + gh_int2scm (100)); + staff_side_p_->set_victim (text_p_); staff_side_p_->axis_ = Y_AXIS; diff --git a/lily/extender-engraver.cc b/lily/extender-engraver.cc index f0478bebe2..1f616ec795 100644 --- a/lily/extender-engraver.cc +++ b/lily/extender-engraver.cc @@ -8,7 +8,6 @@ #include "musical-request.hh" #include "extender-engraver.hh" #include "extender-spanner.hh" -#include "text-def.hh" #include "score-column.hh" #include "g-text-item.hh" diff --git a/lily/g-script-column-engraver.cc b/lily/g-script-column-engraver.cc new file mode 100644 index 0000000000..831f28bc64 --- /dev/null +++ b/lily/g-script-column-engraver.cc @@ -0,0 +1,93 @@ +/* + g-script-column-engraver.cc -- implement G_script_column_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ + +#include "engraver.hh" +#include "g-script-column.hh" +#include "g-staff-side.hh" + +/** + Find potentially colliding scripts, and put them in a + G_script_column, that will fix the collisions. */ +class G_script_column_engraver : public Engraver +{ + G_script_column *scol_p_; + Link_array script_l_arr_; + Link_array staff_side_l_arr_; +public: + G_script_column_engraver (); + VIRTUAL_COPY_CONS(Translator); +protected: + virtual void acknowledge_element (Score_element_info); + virtual void process_acknowledged (); + virtual void do_pre_move_processing (); + virtual void do_post_move_processing (); +}; + + +G_script_column_engraver::G_script_column_engraver() +{ + scol_p_ =0; +} + +void +G_script_column_engraver::do_pre_move_processing () +{ + if (scol_p_) + { + typeset_element (scol_p_); + scol_p_ =0; + } +} + +void +G_script_column_engraver::do_post_move_processing () +{ + script_l_arr_.clear (); + staff_side_l_arr_.clear (); +} + +void +G_script_column_engraver::acknowledge_element( Score_element_info inf) +{ + Item *thing = dynamic_cast(inf.elem_l_); + if (!thing) + return; + + Dimension_cache * parcache = thing->dim_cache_[Y_AXIS].parent_l_; + if (!parcache || !thing) + return ; + + Graphical_element *parent = parcache->element_l (); + + if (G_staff_side_item * ss = dynamic_cast(parent)) + { + if (!ss->breakable_b ()) + { + script_l_arr_.push (thing); + } + } +} + +void +G_script_column_engraver::process_acknowledged () +{ + if (!scol_p_ && script_l_arr_.size () > 1) + { + scol_p_ = new G_script_column; + announce_element (Score_element_info (scol_p_, 0)); + } + + if (scol_p_) + { + for (int i=0; i < script_l_arr_.size (); i++) + scol_p_->add_staff_sided (script_l_arr_[i]); + script_l_arr_.clear (); + } +} +ADD_THIS_TRANSLATOR(G_script_column_engraver); diff --git a/lily/g-script-column.cc b/lily/g-script-column.cc new file mode 100644 index 0000000000..d6f3d8b9f8 --- /dev/null +++ b/lily/g-script-column.cc @@ -0,0 +1,76 @@ +/* + g-script-column.cc -- implement G_script_column + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ +#include "g-script-column.hh" +#include "g-staff-side.hh" + +static G_staff_side_item * +get_g_staff_side (Item *i) +{ + Graphical_element *e1 = i->dim_cache_[Y_AXIS].parent_l_->element_l (); + + return dynamic_cast(e1); +} + +void +G_script_column::add_staff_sided (Item *i) +{ + SCM p = get_g_staff_side (i)->get_elt_property (script_priority_scm_sym); + if (p == SCM_BOOL_F) + return; + + staff_sided_item_l_arr_.push (i); + add_dependency (i); +} + +static int +staff_side_compare (Item * const &i1, + Item * const &i2) +{ + Score_element *e1 = get_g_staff_side (i1); + Score_element *e2 = get_g_staff_side (i2); + + SCM p1 = e1->get_elt_property (script_priority_scm_sym); + SCM p2 = e2->get_elt_property (script_priority_scm_sym); + + return gh_scm2int (SCM_CDR(p1)) - gh_scm2int (SCM_CDR(p2)); +} + +void +G_script_column::do_pre_processing () +{ + Drul_array > arrs; + + for (int i=0; i < staff_sided_item_l_arr_.size (); i++) + { + G_staff_side_item * ip = get_g_staff_side (staff_sided_item_l_arr_[i]); + arrs[ip->dir_].push (staff_sided_item_l_arr_[i]); + } + + Direction d = DOWN; + do { + Link_array &arr(arrs[d]); + + arr.sort (staff_side_compare); + + Item * last = 0; + for (int i=0; i < arr.size (); i++) + { + G_staff_side_item * gs = get_g_staff_side (arr[i]); + if (last) + { + gs->add_support (last); + gs->add_support (get_g_staff_side (last)); + } + + gs->remove_elt_property (script_priority_scm_sym); + last = arr[i]; + } + + } while (flip (&d) != DOWN); +} diff --git a/lily/g-script-engraver.cc b/lily/g-script-engraver.cc new file mode 100644 index 0000000000..7ddb4f7028 --- /dev/null +++ b/lily/g-script-engraver.cc @@ -0,0 +1,135 @@ +/* + script-engraver.cc -- implement G_script_engraver + + (c) 1997--1999 Han-Wen Nienhuys +*/ + +#include "g-script-engraver.hh" +#include "g-script.hh" +#include "g-stem-staff-side.hh" +#include "musical-request.hh" +#include "stem.hh" +#include "staff-symbol.hh" +#include "rhythmic-head.hh" + +G_script_engraver::G_script_engraver() +{ + do_post_move_processing(); +} + +bool +G_script_engraver::do_try_music (Music *r_l) +{ + if (Articulation_req *mr = dynamic_cast (r_l)) + { + for (int i=0; i < script_req_l_arr_.size(); i++) + { + if (script_req_l_arr_[i]->equal_b (mr)) + return true; + } + script_req_l_arr_.push (mr); + return true; + } + return false; +} + +void +G_script_engraver::do_process_requests() +{ + for (int i=0; i < script_req_l_arr_.size(); i++) + { + Articulation_req* l=script_req_l_arr_[i]; + + + SCM list = gh_eval_str (("(articulation-to-scriptdef \"" + l->articulation_str_ + "\")").ch_C()); + + if (list == SCM_BOOL_F) + { + l->warning(_f("don't know how to interpret articulation `%s'\n", + l->articulation_str_.ch_C())); + continue; + } + G_script *p =new G_script; + G_stem_staff_side_item * ss =new G_stem_staff_side_item; + list = SCM_CDR (list); + + p->indices_drul_[LEFT] = ly_scm2string(SCM_CAAR (list)); + p->indices_drul_[RIGHT] = ly_scm2string(SCM_CDAR (list)); + list = SCM_CDR(list); + bool follow_staff = gh_scm2bool (SCM_CAR(list)); + list = SCM_CDR(list); + int relative_stem_dir = gh_scm2int (SCM_CAR(list)); + list = SCM_CDR(list); + int force_dir =gh_scm2int (SCM_CAR(list)); + list = SCM_CDR(list); + SCM priority = SCM_CAR(list); + + if (relative_stem_dir) + ss->relative_dir_ = relative_stem_dir; + else + ss->dir_ = force_dir; + + if (l->dir_) + ss->dir_ = l->dir_; + + ss->staff_support_b_ = !follow_staff; + p->set_staff_side (ss); + ss->set_elt_property (script_priority_scm_sym, priority); + ss->set_elt_property (padding_scm_sym, gh_double2scm(1.0)); + script_p_arr_.push (p); + staff_side_p_arr_.push (ss); + + announce_element (Score_element_info (p, l)); + announce_element (Score_element_info (ss, l)); + } +} + +void +G_script_engraver::acknowledge_element (Score_element_info inf) +{ + if (Stem *s = dynamic_cast(inf.elem_l_)) + { + for (int i=0; i < staff_side_p_arr_.size(); i++) + if (G_stem_staff_side_item * ss = dynamic_cast(staff_side_p_arr_[i])) + { + ss->set_stem (s); + ss->add_support (s); + } + } + else if (Rhythmic_head * rh = dynamic_cast(inf.elem_l_)) + { + for (int i=0; i < staff_side_p_arr_.size(); i++) + { + G_staff_side_item * ss = dynamic_cast(staff_side_p_arr_[i]); + + if (!ss->dim_cache_[X_AXIS].parent_l_) + { + ss->dim_cache_[X_AXIS].parent_l_ = &inf.elem_l_->dim_cache_[X_AXIS]; + } + ss->add_support (rh); + } + } +} + +void +G_script_engraver::do_pre_move_processing() +{ + for (int i=0; i < script_p_arr_.size(); i++) + { + typeset_element (script_p_arr_[i]); + typeset_element (staff_side_p_arr_[i]); + } + script_p_arr_.clear(); + staff_side_p_arr_.clear (); +} + +void +G_script_engraver::do_post_move_processing() +{ + script_req_l_arr_.clear(); +} + + + +ADD_THIS_TRANSLATOR(G_script_engraver); + diff --git a/lily/g-script.cc b/lily/g-script.cc new file mode 100644 index 0000000000..867bcf7dd5 --- /dev/null +++ b/lily/g-script.cc @@ -0,0 +1,75 @@ +/* + g-script.cc -- implement G_script + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ + +/* + + TODO: Quantisation support (staccato dots between stafflines) + +*/ +#include "debug.hh" +#include "g-script.hh" +#include "lookup.hh" +#include "g-staff-side.hh" + +G_script::G_script () +{ + staff_side_l_ =0; +} + +void +G_script::do_substitute_element_pointer (Score_element*o, Score_element*n) +{ + if (o == staff_side_l_) + staff_side_l_ = dynamic_cast(n); +} + + + +Molecule +G_script::get_molecule(Direction d) const +{ + return lookup_l ()->afm_find ("scripts-" + indices_drul_[d]); +} + + +void +G_script::do_pre_processing () +{ + Graphical_element * e + = staff_side_l_->dim_cache_[X_AXIS].parent_l_->element_l(); + translate_axis (e->extent (X_AXIS).center (), X_AXIS); +} + +void +G_script::do_post_processing () +{ + Direction d = staff_side_l_->dir_; + Molecule m (get_molecule(d)); + translate_axis (- m.dim_[Y_AXIS][Direction (-d)], Y_AXIS); +} + +void +G_script::set_staff_side (G_staff_side_item*g) +{ + staff_side_l_ = g; + add_dependency (g); + dim_cache_[Y_AXIS].parent_l_ = & g->dim_cache_[Y_AXIS]; +} + +Molecule* +G_script::do_brew_molecule_p () const +{ + return new Molecule (get_molecule (staff_side_l_->dir_)); +} + +void +G_script::do_print () const +{ + DOUT << "Indices: " << indices_drul_[LEFT] << ", " << indices_drul_[RIGHT]; +} diff --git a/lily/g-staff-side.cc b/lily/g-staff-side.cc index 20812e55ad..4d74c16628 100644 --- a/lily/g-staff-side.cc +++ b/lily/g-staff-side.cc @@ -9,31 +9,33 @@ #include "g-staff-side.hh" #include "staff-symbol.hh" +#include "debug.hh" G_staff_side_item::G_staff_side_item () { dir_ = CENTER; to_position_l_ = 0; set_elt_property (transparent_scm_sym, SCM_BOOL_T); - + staff_support_b_ = true; axis_ = Y_AXIS; } + void G_staff_side_item::do_pre_processing () { if (!dir_) - set_default_direction (); + dir_ = get_default_direction (); if (axis_ == X_AXIS) position_self (); } -void -G_staff_side_item::set_default_direction () +Direction +G_staff_side_item::get_default_direction () const { - dir_ = DOWN; + return DOWN; } @@ -66,6 +68,7 @@ G_staff_side_item::do_substitute_element_pointer (Score_element*o, Score_element void G_staff_side_item::position_self () { + Interval dim; Dimension_cache *common = 0; if (support_l_arr_.size ()) @@ -85,15 +88,21 @@ G_staff_side_item::position_self () dim = Interval(0,0); common = dim_cache_[axis_].parent_l_; } - Interval sym_dim = to_position_l_->extent (axis_); + + + Interval sym_dim + = to_position_l_ + ? to_position_l_->extent (axis_) + : Interval(0,0); + Real off = dim_cache_[axis_].relative_coordinate (common); - SCM pad = remove_elt_property (padding_scm_sym); + SCM pad = remove_elt_property (padding_scm_sym); if (pad != SCM_BOOL_F) { - off -= gh_scm2double (SCM_CDR(pad)) * dir_; + off += gh_scm2double (SCM_CDR(pad)) * dir_; } - dim_cache_[axis_].set_offset (dim[dir_] - sym_dim[-dir_] - off); + dim_cache_[axis_].set_offset (dim[dir_] - sym_dim[-dir_] + off); } void @@ -107,8 +116,38 @@ G_staff_side_item::do_post_processing () void G_staff_side_item::do_add_processing () { - if (axis_ == Y_AXIS && staff_symbol_l ()) + if (staff_support_b_ + && axis_ == Y_AXIS && staff_symbol_l ()) { add_support (staff_symbol_l ()); } } + +Interval +G_staff_side_item::do_height () const +{ + Interval i; + if (to_position_l_) + return to_position_l_->extent (Y_AXIS); + return i; +} + +Interval +G_staff_side_item::do_width () const +{ + Interval i; + if (to_position_l_) + return to_position_l_->extent (X_AXIS); + return i; +} +void +G_staff_side_item::do_print () const +{ +#ifndef NPRINT + if (to_position_l_) + DOUT << "positioning " << to_position_l_->name(); + + DOUT << "axis == " << axis_name_str (axis_) + << ", dir == " << to_str (dir_ ); +#endif +} diff --git a/lily/g-stem-staff-side.cc b/lily/g-stem-staff-side.cc new file mode 100644 index 0000000000..446e0649a6 --- /dev/null +++ b/lily/g-stem-staff-side.cc @@ -0,0 +1,55 @@ +/* + g-stem-staff-side.cc -- implement G_stem_staff_side + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ + +#include "g-stem-staff-side.hh" +#include "stem.hh" + +G_stem_staff_side_item::G_stem_staff_side_item () +{ + stem_l_ =0; + relative_dir_ = CENTER; +} + +void +G_stem_staff_side_item::do_substitute_element_pointer (Score_element*o, + Score_element*n) +{ + if (o == stem_l_) + { + stem_l_ = dynamic_cast (n); + } +} + +void +G_stem_staff_side_item::set_stem (Stem*s) +{ + stem_l_ =s; + add_dependency (s); +} + + +Direction +G_stem_staff_side_item::get_default_direction () const +{ + return relative_dir_ * stem_l_->dir_; +} + +void +G_stem_staff_side_item::do_pre_processing () +{ + SCM p = remove_elt_property (padding_scm_sym); + if (p != SCM_BOOL_F && stem_l_) + { + p = SCM_CDR (p); + set_elt_property (padding_scm_sym, + gh_double2scm(stem_l_->staff_line_leading_f () + * gh_scm2double (p))); + } + G_staff_side_item :: do_pre_processing (); +} diff --git a/lily/g-text-item.cc b/lily/g-text-item.cc index 1854e96c5b..6f54c2ad0a 100644 --- a/lily/g-text-item.cc +++ b/lily/g-text-item.cc @@ -8,7 +8,7 @@ */ #include "g-text-item.hh" - +#include "debug.hh" #include "molecule.hh" #include "paper-def.hh" #include "lookup.hh" @@ -25,3 +25,9 @@ G_text_item::G_text_item () { style_str_ = "roman"; } + +void +G_text_item::do_print () const +{ + DOUT << "text= " << text_str_; +} diff --git a/lily/identifier.cc b/lily/identifier.cc index bf9205579f..8419dd3607 100644 --- a/lily/identifier.cc +++ b/lily/identifier.cc @@ -13,7 +13,6 @@ #include "identifier.hh" #include "my-lily-lexer.hh" #include "debug.hh" -#include "script-def.hh" #include "request.hh" #include "translator.hh" #include "notename-table.hh" @@ -82,7 +81,6 @@ Class ## _identifier::do_print () const { \ -DEFAULT_PRINT(General_script_def); DEFAULT_PRINT(Translator); DEFAULT_PRINT(Music); DEFAULT_PRINT(Request); @@ -99,7 +97,6 @@ Class ## _identifier::do_str () const { \ DUMMY_STR(Notename_table); -DUMMY_STR(General_script_def); DUMMY_STR(Translator); DUMMY_STR(Music); DUMMY_STR(Request); @@ -171,7 +168,6 @@ IMPLEMENT_ID_CLASS(Translator); IMPLEMENT_ID_CLASS(int); IMPLEMENT_ID_CLASS(Real); IMPLEMENT_ID_CLASS(String); -IMPLEMENT_ID_CLASS(General_script_def); IMPLEMENT_ID_CLASS(Music); IMPLEMENT_ID_CLASS(Score); IMPLEMENT_ID_CLASS(Request); @@ -181,7 +177,6 @@ IMPLEMENT_ID_CLASS(Notename_table); VIRTUAL_ACCESSOR(Music); VIRTUAL_ACCESSOR(Request); VIRTUAL_ACCESSOR(Translator); -VIRTUAL_ACCESSOR(General_script_def); DEFAULT_ACCESSOR(Notename_table); DEFAULT_ACCESSOR(Duration); DEFAULT_ACCESSOR(int); diff --git a/lily/include/axis-align-item.hh b/lily/include/axis-align-item.hh index 659919425b..b6a0ab5231 100644 --- a/lily/include/axis-align-item.hh +++ b/lily/include/axis-align-item.hh @@ -19,7 +19,8 @@ class Axis_align_item : public virtual Align_element, public: Axis_align_item (); protected: - virtual void do_print () const {} + virtual void do_print ()const; + }; #endif /* AXIS_ALIGN_ITEM_HH */ diff --git a/lily/include/axis-group-spanner.hh b/lily/include/axis-group-spanner.hh index 40753a8a9a..0de8cc51ef 100644 --- a/lily/include/axis-group-spanner.hh +++ b/lily/include/axis-group-spanner.hh @@ -7,8 +7,8 @@ */ -#ifndef SPAN_AXIS_GROUP_HH -#define SPAN_AXIS_GROUP_HH +#ifndef AXIS_GROUP_SPANNER_HH +#define AXIS_GROUP_SPANNER_HH #include "spanner.hh" #include "axis-group-element.hh" diff --git a/lily/include/clef-item.hh b/lily/include/clef-item.hh index effd9886b5..c37277e312 100644 --- a/lily/include/clef-item.hh +++ b/lily/include/clef-item.hh @@ -7,7 +7,7 @@ #ifndef CLEFITEM_HH #define CLEFITEM_HH #include "item.hh" -#include "text-def.hh" + #include "direction.hh" #include "pointer.hh" #include "staff-symbol-referencer.hh" diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index 75004fb803..63f8c11135 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -15,44 +15,30 @@ #include "duration.hh" #include "musical-pitch.hh" -/** Request which are assumed to be "happening" before the - musical requests. Not coupled to a note or rest. */ -class Command_req : public virtual Request { -public: - REQUESTMETHODS(Command_req); - -}; - - -class Break_req : public Command_req { +class Break_req : public Request { public: enum { DISALLOW = -10000, FORCE = 10000 }; int penalty_i_; Break_req (); - REQUESTMETHODS (Break_req); +protected: + VIRTUAL_COPY_CONS(Music); }; -class Mark_req : public Command_req { +class Mark_req : public Request { public: Mark_req (String); String str_; - REQUESTMETHODS (Mark_req); -}; - -class Command_script_req : public Command_req, public Script_req { -public: - // huh? - Command_script_req(); - ~Command_script_req(); - REQUESTMETHODS(Command_script_req); +protected: + virtual void do_print () const; + VIRTUAL_COPY_CONS(Music); }; /** Baseclass for time_signature/partial req. It has to be handled by Staff_{walker,column} baseclass. */ -class Timing_req : public Command_req { +class Timing_req : public Request { public: - REQUESTMETHODS(Timing_req); + VIRTUAL_COPY_CONS(Music); }; @@ -63,7 +49,9 @@ public: int metronome_i_; Tempo_req(); - REQUESTMETHODS(Tempo_req); +protected: + virtual void do_print () const; + VIRTUAL_COPY_CONS(Music); bool do_equal_b (Request *) const; }; @@ -72,7 +60,9 @@ public: Moment length_mom_; Partial_measure_req (Moment); - REQUESTMETHODS(Partial_measure_req); +protected: + VIRTUAL_COPY_CONS(Music); + virtual void do_print () const; bool do_equal_b (Request*) const; }; @@ -81,11 +71,14 @@ public: */ class Time_signature_change_req : public Timing_req { public: - int beats_i_, one_beat_i_; + int beats_i_; + int one_beat_i_; Time_signature_change_req(); +protected: + virtual void do_print () const; bool do_equal_b (Request*) const; - REQUESTMETHODS(Time_signature_change_req); + VIRTUAL_COPY_CONS(Music); }; /// toggle Cadenza mode @@ -93,35 +86,42 @@ class Cadenza_req : public Timing_req { public: /// turn on? bool on_b_; - bool do_equal_b (Request*) const; Cadenza_req (bool); - REQUESTMETHODS(Cadenza_req); +protected: + virtual void do_print () const; + + bool do_equal_b (Request*) const; + VIRTUAL_COPY_CONS(Music); }; /// check if we're at start of a measure. class Barcheck_req : public Timing_req { public: bool do_equal_b (Request *) const; - REQUESTMETHODS(Barcheck_req); + VIRTUAL_COPY_CONS(Music); }; class Measure_grouping_req : public Timing_req { public: Array beat_i_arr_; Array elt_length_arr_; +protected: + virtual void do_print () const; bool do_equal_b (Request *) const; - REQUESTMETHODS(Measure_grouping_req); + VIRTUAL_COPY_CONS(Music); }; /** draw a (repeat)-bar. This something different than #Barcheck_req#, the latter should only happen at the start of a measure. */ -class Bar_req : public Command_req { +class Bar_req : public Request { public: String type_str_; Bar_req (String); +protected: + virtual void do_print () const; bool do_equal_b (Request*) const; - REQUESTMETHODS(Bar_req); + VIRTUAL_COPY_CONS(Music); }; @@ -130,14 +130,13 @@ public: Routines for sharps and flats are separated, so that caller may identify non-conventional keys. */ -class Key_change_req : public Command_req { +class Key_change_req : public Request { public: Array pitch_arr_; int modality_i_; bool ordinary_key_b_; Key_change_req(); - REQUESTMETHODS(Key_change_req); /// squash the octaves to 1 void squash_octaves(); @@ -146,22 +145,27 @@ public: /// return number of sharps in key int sharps_i(); + bool minor_b() const; +protected: + VIRTUAL_COPY_CONS(Music); void transpose (Musical_pitch d); - bool minor_b() const; + virtual void do_print () const; }; -class Clef_change_req : public Command_req { +class Clef_change_req : public Request { public: String clef_str_; Clef_change_req (String); - REQUESTMETHODS(Clef_change_req); +protected: + virtual void do_print () const; + VIRTUAL_COPY_CONS(Music); }; -class Bracket_req : public Span_req, public Command_req { +class Bracket_req : public Span_req { public: - REQUESTMETHODS(Bracket_req); + VIRTUAL_COPY_CONS(Music); }; diff --git a/lily/include/g-script-column.hh b/lily/include/g-script-column.hh new file mode 100644 index 0000000000..62caab8b48 --- /dev/null +++ b/lily/include/g-script-column.hh @@ -0,0 +1,30 @@ +/* + g-script-column.hh -- declare G_script_column + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ + +#ifndef G_SCRIPT_COLUMN_HH +#define G_SCRIPT_COLUMN_HH + +#include "item.hh" + +class G_script_column : public Item +{ + /** + Array of objects that are placed by staffsides + */ + Link_array staff_sided_item_l_arr_; +public: + void add_staff_sided (Item*); +protected: + virtual void do_pre_processing (); +}; + + +#endif /* G_SCRIPT_COLUMN_HH */ + + diff --git a/lily/include/g-script-engraver.hh b/lily/include/g-script-engraver.hh new file mode 100644 index 0000000000..7f1774c6de --- /dev/null +++ b/lily/include/g-script-engraver.hh @@ -0,0 +1,31 @@ +/* + script-engraver.hh -- part of GNU LilyPond + + (c) 1997--1999 Han-Wen Nienhuys +*/ + + +#ifndef G_SCRIPT_GRAV +#define G_SCRIPT_GRAV + +#include "engraver.hh" + + +class G_script_engraver : public Engraver { + Link_array script_p_arr_; + Link_array staff_side_p_arr_; + Link_array script_req_l_arr_; + +public: + VIRTUAL_COPY_CONS(Translator); + + G_script_engraver(); +protected: + virtual bool do_try_music (Music*); + virtual void do_process_requests (); + virtual void do_pre_move_processing (); + virtual void do_post_move_processing (); + virtual void acknowledge_element (Score_element_info); +}; + +#endif // G_SCRIPT_GRAV diff --git a/lily/include/g-script.hh b/lily/include/g-script.hh new file mode 100644 index 0000000000..cbc5f6ee1b --- /dev/null +++ b/lily/include/g-script.hh @@ -0,0 +1,40 @@ +/* + g-script.hh -- declare G_script + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ + +#ifndef G_STEM_SCRIPT_HH +#define G_STEM_SCRIPT_HH + +#include "item.hh" +#include "drul-array.hh" + +/** + articulation marks (and the like) that are attached to notes/stems. + Needs support from G_staff_side for proper operation. + */ +class G_script : public Item +{ + G_staff_side_item * staff_side_l_; + + Molecule get_molecule (Direction d) const; +public: + Drul_array indices_drul_; + G_script (); + void set_staff_side (G_staff_side_item*); + +protected: +virtual void do_print () const; + virtual void do_substitute_element_pointer (Score_element*o, + Score_element*n); + virtual void do_pre_processing (); + virtual void do_post_processing (); + Molecule* do_brew_molecule_p () const; +}; + +#endif /* G_STEM_SCRIPT_HH */ + diff --git a/lily/include/g-staff-side.hh b/lily/include/g-staff-side.hh index c463360e27..e6808863a6 100644 --- a/lily/include/g-staff-side.hh +++ b/lily/include/g-staff-side.hh @@ -13,22 +13,38 @@ #include "item.hh" #include "staff-symbol-referencer.hh" +/** + Position myself next to a set of elements. Configurable in axis + and direction. + + Properties: + + padding :: Real + + Amount of extra space to add. +*/ class G_staff_side_item : public Item, public Staff_symbol_referencer { void position_self (); + public: Score_element * to_position_l_; Direction dir_; Link_array support_l_arr_; Axis axis_; + //junkme. + bool staff_support_b_; G_staff_side_item (); void set_victim (Score_element*); void add_support (Score_element*); - virtual void set_default_direction (); VIRTUAL_COPY_CONS(Score_element); + virtual Direction get_default_direction () const; protected: + virtual Interval do_height () const; + virtual Interval do_width () const; + virtual void do_print () const; virtual void do_add_processing (); virtual void do_substitute_element_pointer (Score_element*,Score_element*); virtual void do_pre_processing (); diff --git a/lily/include/g-stem-staff-side.hh b/lily/include/g-stem-staff-side.hh new file mode 100644 index 0000000000..59e51cec9d --- /dev/null +++ b/lily/include/g-stem-staff-side.hh @@ -0,0 +1,40 @@ +/* + g-stem-staff-side.hh -- declare G_stem_staff_side + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ + +#ifndef G_STEM_STAFF_SIDE_HH +#define G_STEM_STAFF_SIDE_HH + +#include "g-staff-side.hh" +/** + Position self, analogous to G_staff_side_item, but use Stem direction + for determining direction. + + Properties: + + padding :: Real + + Padding in staffline leading + + */ +class G_stem_staff_side_item : public G_staff_side_item +{ + Stem *stem_l_; +public: + Direction relative_dir_; + + void set_stem (Stem*); + G_stem_staff_side_item (); +protected: + virtual Direction get_default_direction ()const; + virtual void do_pre_processing (); + virtual void do_substitute_element_pointer (Score_element*o,Score_element*e); +}; + +#endif /* G_STEM_STAFF_SIDE_HH */ + diff --git a/lily/include/g-text-item.hh b/lily/include/g-text-item.hh index 2362a5d9be..3edfe6c72c 100644 --- a/lily/include/g-text-item.hh +++ b/lily/include/g-text-item.hh @@ -12,6 +12,9 @@ #include "item.hh" +/** + Print a text in specified style. + */ class G_text_item : public Item { public: @@ -21,6 +24,7 @@ public: G_text_item (); VIRTUAL_COPY_CONS (Score_element); protected: + virtual void do_print () const; virtual Molecule *do_brew_molecule_p () const; }; diff --git a/lily/include/identifier.hh b/lily/include/identifier.hh index 0ebfc65bcd..4d705020fb 100644 --- a/lily/include/identifier.hh +++ b/lily/include/identifier.hh @@ -18,7 +18,7 @@ class Notename_table_identifier; class Translator_identifier; class Music_identifier; -class General_script_def_identifier; +class Articulation_req_identifier; class Symtables_identifier; class Midi_def_identifier; class Paper_def_identifier; @@ -54,7 +54,6 @@ struct Identifier : public Input { IDACCESSOR(Translator) IDACCESSOR(Notename_table) IDACCESSOR(Music) - IDACCESSOR(General_script_def) IDACCESSOR(Symtables) IDACCESSOR(Midi_def) IDACCESSOR(Paper_def) diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 367ff2febd..68667ae067 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -19,6 +19,7 @@ struct Abbreviation_req; struct Adobe_font_metric; struct Adobe_font_char_metric; struct All_font_metrics; +struct Articulation_req; struct Atom; struct Audio_element; struct Audio_column; @@ -81,6 +82,8 @@ struct Engraver; struct Engraver_group_engraver; struct Extender; struct Extender_req; +struct G_script; +struct G_script_req; struct G_staff_side_item; struct G_text_item; struct General_script_def; diff --git a/lily/include/line-of-score.hh b/lily/include/line-of-score.hh index 187947afec..2410acc285 100644 --- a/lily/include/line-of-score.hh +++ b/lily/include/line-of-score.hh @@ -8,27 +8,30 @@ #define SCORELINE_HH #include "colhpos.hh" -#include "spanner.hh" +#include "axis-group-spanner.hh" #include "super-element.hh" /// the columns of a score that form one line. -class Line_of_score : public Spanner, public Super_element +class Line_of_score : public Axis_group_spanner, public Super_element { -public: Link_array cols_; +public: + Line_of_score(); - void add_element (Score_element *); - /// is #c# contained in #*this#? bool contains_b (Paper_column const *c) const; Link_array get_lines() const; Line_of_score * set_breaking (Array const&, int j) const; + + void output_all (); + void add_column (Paper_column*); + protected: + virtual void do_substitute_element_pointer (Score_element*, Score_element*); virtual Link_array get_extra_dependencies () const; - virtual Interval do_width() const; virtual void do_print() const; VIRTUAL_COPY_CONS(Score_element); }; diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index 9290359b1e..827e094f03 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -39,9 +39,9 @@ public: Molecule flag (int, Direction) const; Molecule hairpin (Real width, bool decresc, bool continued) const; Molecule plet (Real dy, Real dx, Direction dir) const; - Molecule rest (int, bool outside) const; + Molecule rest (int, bool outside, String) const; Molecule rule_symbol (Real height, Real width) const; - Molecule script (String idx) const; + Molecule stem (Real y1_pos, Real y2_pos) const; Molecule slur (Array controls) const; Molecule streepje (int type) const; diff --git a/lily/include/ly-symbols.hh b/lily/include/ly-symbols.hh index 1e2c85eecb..322d4ab8cb 100644 --- a/lily/include/ly-symbols.hh +++ b/lily/include/ly-symbols.hh @@ -47,6 +47,7 @@ DECLARE_LY_SYMBOL(pianobrace); DECLARE_LY_SYMBOL(placebox); DECLARE_LY_SYMBOL(rulesym); DECLARE_LY_SYMBOL(rulethickness); +DECLARE_LY_SYMBOL(script_priority); DECLARE_LY_SYMBOL(staffheight); DECLARE_LY_SYMBOL(style); DECLARE_LY_SYMBOL(text); diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 28d949b497..b4950a7971 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -15,84 +15,88 @@ #include "duration.hh" #include "musical-pitch.hh" -/** - A request which is coupled to a note (that has duration). - Base class only - */ -class Musical_req : public virtual Request { -public: - - - REQUESTMETHODS(Musical_req); -}; - - /** a request with a duration. This request is used only used as a base class. */ -class Rhythmic_req : public virtual Musical_req { +class Rhythmic_req : public virtual Request { public: Duration duration_; - + virtual void do_print () const; + + bool do_equal_b (Request*) const; void compress (Moment); virtual Moment length_mom () const; static int compare (Rhythmic_req const&,Rhythmic_req const&); - REQUESTMETHODS(Rhythmic_req); + VIRTUAL_COPY_CONS(Music); }; class Skip_req : public Rhythmic_req { public: - REQUESTMETHODS(Skip_req); + VIRTUAL_COPY_CONS(Music); }; -struct Spacing_req :virtual Request { - Moment next; - Real distance; - Real strength; - Spacing_req(); - REQUESTMETHODS(Spacing_req); -}; -struct Abbreviation_req : public Musical_req { - REQUESTMETHODS (Abbreviation_req); +struct Abbreviation_req : public Request { + VIRTUAL_COPY_CONS (Abbreviation_req); Abbreviation_req (); int type_i_; + virtual void do_print () const; }; -class Blank_req : public Spacing_req, Rhythmic_req { -public: - REQUESTMETHODS(Spacing_req); -}; /** a syllable or lyric is a string with rhythm. */ class Lyric_req : public Rhythmic_req { public: + virtual void do_print () const; String text_str_; - REQUESTMETHODS(Lyric_req); + VIRTUAL_COPY_CONS(Music); +}; + + +class Articulation_req : public G_script_req +{ +public: + String articulation_str_; +protected: + virtual bool do_equal_b (Request*) const; + virtual void do_print () const; + VIRTUAL_COPY_CONS(Music); }; +class Text_script_req : public G_script_req { +public: + String text_str_; + + // should be generic property of some kind.. + String style_str_; +protected: + VIRTUAL_COPY_CONS(Music); + virtual void do_print () const; +}; /// request which has some kind of pitch -struct Melodic_req :virtual Musical_req +struct Melodic_req :virtual Request { Musical_pitch pitch_; + + static int compare (Melodic_req const&,Melodic_req const&); + +protected: /// transpose. #delta# is relative to central c. virtual void transpose (Musical_pitch delta); - Melodic_req(); - bool do_equal_b (Request*) const; - static int compare (Melodic_req const&,Melodic_req const&); - REQUESTMETHODS(Melodic_req); + virtual bool do_equal_b (Request*) const; + virtual void do_print () const; + VIRTUAL_COPY_CONS(Music); }; /// specify tonic of a chord struct Tonic_req : public Melodic_req { - Tonic_req (); - REQUESTMETHODS(Tonic_req); + VIRTUAL_COPY_CONS(Music); }; /// Put a note of specified type, height, and with accidental on the staff. @@ -104,8 +108,10 @@ public: /// Cautionary, i.e. parenthesized accidental. bool cautionary_b_; Note_req(); +protected: + virtual void do_print () const; bool do_equal_b (Request*) const; - REQUESTMETHODS(Note_req); + VIRTUAL_COPY_CONS(Music); }; /** @@ -113,7 +119,7 @@ Put a rest on the staff. Why a request? It might be a good idea to not typeset t */ class Rest_req : public Rhythmic_req { public: - REQUESTMETHODS(Rest_req); + VIRTUAL_COPY_CONS(Music); }; /** @@ -122,24 +128,17 @@ public: */ class Multi_measure_rest_req : public Rhythmic_req { public: - REQUESTMETHODS(Multi_measure_rest_req); + VIRTUAL_COPY_CONS(Music); }; -class Musical_span_req : public Span_req, public virtual Musical_req -{ -public: - REQUESTMETHODS(Musical_span_req); - -}; - /** Start / stop an abbreviation beam at this note. */ -class Abbreviation_beam_req : public Musical_span_req { +class Abbreviation_beam_req : public Span_req { public: - REQUESTMETHODS (Abbreviation_beam_req); + VIRTUAL_COPY_CONS(Abbreviation_beam_req); Abbreviation_beam_req (); @@ -149,46 +148,49 @@ public: /// a slur -class Slur_req : public Musical_span_req { +class Slur_req : public Span_req { public: - REQUESTMETHODS(Slur_req); + VIRTUAL_COPY_CONS(Music); }; /// an extender line class Extender_req : public Request { public: - REQUESTMETHODS(Extender_req); - Extender_req (); -}; + VIRTUAL_COPY_CONS(Music); -class Musical_script_req : public Musical_req, public Script_req { -public: - REQUESTMETHODS(Musical_script_req); }; -class Dynamic_req : public virtual Musical_req { +class Dynamic_req : public virtual Request { public: - REQUESTMETHODS(Dynamic_req); + VIRTUAL_COPY_CONS(Music); }; - +/* + merge with Articulation_req? + */ class Absolute_dynamic_req : public Dynamic_req { public: String loudness_str_; - virtual bool do_equal_b (Request*) const; - String loudness_str () const; Absolute_dynamic_req(); - REQUESTMETHODS(Absolute_dynamic_req); + +protected: + virtual void do_print () const; + virtual bool do_equal_b (Request*) const; + VIRTUAL_COPY_CONS(Music); }; -class Span_dynamic_req : public Dynamic_req, public Musical_span_req { +class Span_dynamic_req : public Dynamic_req, public Span_req { public: - virtual bool do_equal_b (Request*) const; + /// Grow or shrink the volume: 1=cresc, -1 = decresc Direction dynamic_dir_; + Span_dynamic_req(); - REQUESTMETHODS(Span_dynamic_req); +protected: + virtual bool do_equal_b (Request*) const; + virtual void do_print () const; + VIRTUAL_COPY_CONS(Music); }; #endif // MUSICALREQUESTS_HH diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh index 8fd5af02b1..db18a621c9 100644 --- a/lily/include/note-column.hh +++ b/lily/include/note-column.hh @@ -11,13 +11,13 @@ #define NOTE_COLUMN_HH #include "item.hh" -#include "script-column.hh" +#include "axis-group-item.hh" /** a struct for treating a group of noteheads (noteheads, stem (chord) and scripts) as a single entity. */ -class Note_column : public Script_column { +class Note_column : public Axis_group_item { protected: - virtual void do_pre_processing(); + virtual void do_print () const; virtual void do_substitute_element_pointer (Score_element*,Score_element*); public: @@ -27,10 +27,9 @@ public: JUNKME.v */ - Direction dir_; + Direction dir () const; Stem* stem_l_; - Link_array head_l_arr_; Link_array rest_l_arr_; @@ -38,14 +37,12 @@ public: // Interval width () const; void translate_rests(int dy); - Note_column (); void set_stem (Stem*); void set_dotcol (Dot_column*); void add_head (Rhythmic_head*); bool rest_b () const; - virtual void add_script (Script*s); void sort (); }; diff --git a/lily/include/paper-outputter.hh b/lily/include/paper-outputter.hh index ef4d41a2c2..1b62555d03 100644 --- a/lily/include/paper-outputter.hh +++ b/lily/include/paper-outputter.hh @@ -35,7 +35,7 @@ public: void output_molecule (Molecule const *, Offset, char const *); void output_comment (String s); void output_scheme (SCM scm); - void start_line (); + void start_line (Real height); void stop_line (); void switch_to_font (String fontname); diff --git a/lily/include/request.hh b/lily/include/request.hh index 8cd5e4abdd..72134e8c33 100644 --- a/lily/include/request.hh +++ b/lily/include/request.hh @@ -25,14 +25,9 @@ */ class Request : public Music { - public: - virtual ~Request(){} - - VIRTUAL_COPY_CONS(Music); - bool equal_b (Request*) const; protected: virtual bool do_equal_b (Request*) const; @@ -40,26 +35,27 @@ protected: }; -#define REQUESTMETHODS(T) \ -\ -VIRTUAL_COPY_CONS(Request);\ -virtual void do_print() const - +class G_script_req : public virtual Request +{ +public: + Direction dir_; + VIRTUAL_COPY_CONS(Music); +}; /** Put a script above or below this ``note'' or bar. eg upbow, downbow. Why a request? These symbols may conflict with slurs and brackets, so this also a request */ -class Script_req : public virtual Request { +class Script_req : public virtual G_script_req { public: - Direction dir_; General_script_def *scriptdef_p_; bool do_equal_b (Request*) const; Script_req(); - REQUESTMETHODS(Script_req); + VIRTUAL_COPY_CONS(Music); + virtual void do_print () const; ~Script_req(); Script_req (Script_req const&); }; @@ -73,10 +69,12 @@ class Span_req : public virtual Request { public: /// should the spanner start or stop, or is it unwanted? Direction spantype_; - bool do_equal_b (Request*) const; - REQUESTMETHODS(Span_req); Span_req(); +protected: + virtual bool do_equal_b (Request*) const; + virtual void do_print() const; + VIRTUAL_COPY_CONS(Music); }; /** @@ -84,13 +82,13 @@ public: */ class Tie_req : public Request { public: - REQUESTMETHODS(Tie_req); + VIRTUAL_COPY_CONS(Music); }; /** Start / stop a beam at this note */ class Beam_req : public Span_req { public: - REQUESTMETHODS(Beam_req); + VIRTUAL_COPY_CONS(Music); }; #endif diff --git a/lily/include/rhythmic-column-engraver.hh b/lily/include/rhythmic-column-engraver.hh index b9101c84d7..c4514f00bb 100644 --- a/lily/include/rhythmic-column-engraver.hh +++ b/lily/include/rhythmic-column-engraver.hh @@ -14,7 +14,6 @@ #include "parray.hh" class Rhythmic_column_engraver :public Engraver { - Link_array