+1.3.32.jcn1
+===========
+
+* Removed duplicate lily/output-property-engraver.hh.
+
+* Removed optional use of vanilla spanner in Dynamic_engraver.
+
+* Fixed (measured) tremolo for Stem and Beam. Merged declarations
+ stem-engraver.hh and chord-tremolo-engraver.hh into their .cc
+ implementation file. Also fixed looks of Chord tremolo, input and
+ implementation is still ugly.
+
+* Added *.yy and *.ll to TAGS, to that tags-find-replace doesn't omit
+ parser and lexer.
+
1.3.31.jcn5
===========
@section Stems
-Stem tremolos (official naming?) or rolls are tremolo signs that look
-like beam segments crossing stems. If the stem is in a beam, the
-tremolo must be parallel to the beam. If the stem is invisible
-(eg. on a whole note), the tremolo must be centered on the note.
+Stem tremolos or rolls are tremolo signs that look like beam segments
+crossing stems. If the stem is in a beam, the tremolo must be parallel
+to the beam. If the stem is invisible (eg. on a whole note), the
+tremolo must be centered on the note.
-@c @mu delafile{stem-tremolo.ly}
+@mudelafile{stem-tremolo.ly}
Chord tremolos look like beams, but are a kind of repeat symbol.
To avoid confusion, chord tremolo beams do not reach the stems, but
as half notes cannot appear in a regular beam, and should reach the
stems.
-@c miudelafile{chord-tremolo.sly}
+@mudelafile{chord-tremolo.sly}
Beams, stems and noteheads often have communication troubles, since
the two systems for y dimensions (1 unit = staffspace, 1 unit = 1
@cindex tremolo marks
-@node tremolo, , , Reference Manual
+@node stem tremolo, , , Reference Manual
Tremolo marks can be printed on a single note by adding
`@code{:}[@var{length}]' after the note. The length must be at
least 8. A @var{length} value of 8 gives one line across
the note stem. If the length is omitted, then the last value is
-used, or the value of the @code{abbrev}@indexcode{abbrev} property if there was
+used, or the value of the @code{tremoloFlags}@indexcode{tremoloFlags} property if there was
no last value.
@mudela[verbatim,fragment,center]
MAJOR_VERSION=1
MINOR_VERSION=3
PATCH_LEVEL=32
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=jcn1
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
\version "1.3.5";
\score{
- \notes \transpose c'''{
+ \context Voice\notes \relative c''{
+ %%?
+ \property Voice.textVerticalDirection = #1
+ %% burp, is this in staff or half spaces, or what?
+ \property Voice.textScriptPadding = #15
+ a1:4^":4" a:8^":8" c:16^":16" a:32^":32" a^"x" a:^":"
+ a4:4 c:8 a:16 c:32 a a: a2:
+ \break
\stemup
-% \stemdown
- % default abbreviations
- c4 c4: c4:32 c4: c4 c2.
- a,1
- a,1:32
- c,4:8 c': c,4:16 c':
- [ c,8:16 c, c, c, ]
- [ a a a a ]
- [ c, f, b, e ]
- [ c,16:32 c, c, c, ] [ a16:32 a a a ]
-% % there's still some hairy beam bugfixing todo
- [ c'8:16 g d a, ]
- [ c,8:32 f, b, e ]
- [ c'16:32 g d a, ]
-
-
+ a4:32 a'4:64
+ \stemdown
+ c,4:32 c,4:64
+ \stemboth
+ c'8:16 c c c
+ a': a a: a
+ c,16:32 c: c c a16:32 a: a a
+ c8:16 g: d: a:
+ c8:32 f: b: e:
}
}
if (d == STOP && !beam_p_)
{
- m->warning (_ ("no beam to end"));
+ m->warning (_ ("can't find start of beam"));
return false;
}
reqs_drul_[d ] = c;
if (reqs_drul_[STOP])
{
if (!beam_p_)
- reqs_drul_[STOP]->warning (_("no beam to end"));
+ reqs_drul_[STOP]->warning (_("can't find start of beam"));
prev_start_req_ =0;
finished_beam_p_ = beam_p_;
finished_beam_info_p_ = beam_info_p_;
{
if (beam_p_)
{
- reqs_drul_[START]->warning (_ ("Already have a beam"));
+ reqs_drul_[START]->warning (_ ("already have a beam"));
return;
}
typeset_beam ();
if (beam_p_)
{
- prev_start_req_->warning (_ ("unfinished beam"));
+ prev_start_req_->warning (_ ("unterminated beam"));
finished_beam_p_ = beam_p_;
finished_beam_info_p_ = beam_info_p_;
typeset_beam ();
Rhythmic_req *rhythmic_req = dynamic_cast <Rhythmic_req *> (info.req_l_);
if (!rhythmic_req)
{
- String s = _ ("Stem must have Rhythmic structure");
+ String s = _ ("stem must have Rhythmic structure");
if (info.req_l_)
info.req_l_->warning (s);
else
if (rhythmic_req->duration_.durlog_i_<= 2)
{
- rhythmic_req->warning (_ ("Stem doesn't fit in beam"));
- prev_start_req_->warning (_ ("Beam was started here"));
+ rhythmic_req->warning (_ ("stem doesn't fit in beam"));
+ prev_start_req_->warning (_ ("beam was started here"));
/*
don't return, since
*/
#include "timing-translator.hh"
-#include "chord-tremolo-engraver.hh"
#include "stem.hh"
#include "beam.hh"
#include "musical-request.hh"
#include "misc.hh"
#include "warn.hh"
#include "score-engraver.hh"
+#include "engraver.hh"
+#include "drul-array.hh"
+#include "timing-engraver.hh"
+#include "beaming.hh"
+
+/**
+ Generate a beam tremolo. Eat stems.
+
+ UGH. Derive me from Beam_engraver.
+
+ */
+class Chord_tremolo_engraver : public Engraver
+{
+public:
+ VIRTUAL_COPY_CONS(Translator);
+
+
+ Chord_tremolo_engraver();
+
+protected:
+ virtual void do_removal_processing();
+ virtual void do_process_requests();
+ virtual bool do_try_music (Music*);
+ virtual void acknowledge_element (Score_element_info);
+ virtual void do_pre_move_processing();
+ virtual void do_post_move_processing();
+
+private:
+ void typeset_beam ();
+ Drul_array<Chord_tremolo_req*> reqs_drul_;
+ Chord_tremolo_req* prev_start_req_;
+ Beam* beam_p_;
+ Beam* finished_beam_p_;
+
+ /// location within measure where beam started.
+ Moment beam_start_location_;
+
+ /// moment (global time) where beam started.
+ Moment beam_start_mom_;
+ Beaming_info_list * beam_info_p_;
+ Beaming_info_list * finished_beam_info_p_;
+};
ADD_THIS_TRANSLATOR (Chord_tremolo_engraver);
Chord_tremolo_engraver::Chord_tremolo_engraver ()
{
reqs_drul_[LEFT] = reqs_drul_[RIGHT] = 0;
- abeam_p_ = 0;
- finished_abeam_p_ = 0;
+ beam_p_ = 0;
+ finished_beam_p_ = 0;
prev_start_req_ = 0;
+ finished_beam_info_p_=0;
+ beam_info_p_ =0;
}
bool
if (reqs_drul_[d] && !reqs_drul_[d]->equal_b (b))
return false;
- if ((d == STOP) && !abeam_p_)
+ if ((d == STOP) && !beam_p_)
{
- m->warning (_ ("no tremolo beam to end"));
+ m->warning (_ ("can't find start of chord tremolo"));
return false;
}
{
if (reqs_drul_[STOP])
{
- if (!abeam_p_)
- reqs_drul_[STOP]->warning (_ ("no tremolo beam to end"));
+ if (!beam_p_)
+ reqs_drul_[STOP]->warning (_ ("can't find start of chord tremolo"));
+
prev_start_req_ = 0;
- finished_abeam_p_ = abeam_p_;
- abeam_p_ = 0;
+
+ finished_beam_p_ = beam_p_;
+ beam_p_ = 0;
+
+ finished_beam_info_p_ = beam_info_p_;
+ beam_info_p_ = 0;
}
- if (abeam_p_)
+ if (beam_p_)
{
Score_engraver * e = 0;
Translator * t = daddy_grav_l ();
if (reqs_drul_[START])
{
- if (abeam_p_)
+ if (beam_p_)
{
- reqs_drul_[START]->warning (_ ("Already have a tremolo beam"));
+ reqs_drul_[START]->warning (_ ("already have a chord tremolo"));
return;
}
prev_start_req_ = reqs_drul_[START];
- abeam_p_ = new Beam;
- abeam_p_->set_elt_property ("chord-tremolo", SCM_BOOL_T);
+ beam_p_ = new Beam;
+ beam_p_->set_elt_property ("chord-tremolo", SCM_BOOL_T);
+ Translator * t = daddy_grav_l ()->get_simple_translator ("Timing_engraver");
+ Timing_engraver *timer = dynamic_cast<Timing_engraver*> (t);
+ beam_start_location_ = (t) ? timer->measure_position () : Moment (0);
+ beam_start_mom_ = now_mom();
+ beam_info_p_ = new Beaming_info_list;
- announce_element (Score_element_info (abeam_p_, reqs_drul_[LEFT]));
+ announce_element (Score_element_info (beam_p_, reqs_drul_[LEFT]));
}
}
reqs_drul_ [START] = 0;
}
+
void
Chord_tremolo_engraver::do_pre_move_processing ()
{
void
Chord_tremolo_engraver::typeset_beam ()
{
- if (finished_abeam_p_)
+ if (finished_beam_p_)
{
- typeset_element (finished_abeam_p_);
- finished_abeam_p_ = 0;
+ finished_beam_info_p_->beamify ();
+ finished_beam_p_->set_beaming (finished_beam_info_p_);
+ typeset_element (finished_beam_p_);
+ finished_beam_p_ = 0;
+ delete finished_beam_info_p_;
+ finished_beam_info_p_ =0;
reqs_drul_[STOP] = 0;
}
Chord_tremolo_engraver::do_removal_processing ()
{
typeset_beam ();
- if (abeam_p_)
+ if (beam_p_)
{
- prev_start_req_->warning (_ ("unfinished tremolo beam"));
- finished_abeam_p_ = abeam_p_;
+ prev_start_req_->warning (_ ("unterminated chord tremolo"));
+ finished_beam_p_ = beam_p_;
+ finished_beam_info_p_ = beam_info_p_;
typeset_beam ();
}
}
void
-Chord_tremolo_engraver::acknowledge_element (Score_element_info i)
+Chord_tremolo_engraver::acknowledge_element (Score_element_info info)
{
- if (abeam_p_)
+ if (beam_p_)
{
- if (Stem* s = dynamic_cast<Stem *> (i.elem_l_))
+ if (Stem* s = dynamic_cast<Stem *> (info.elem_l_))
{
int type_i = prev_start_req_->type_i_;
s->set_elt_property ("duration-log", gh_int2scm (intlog2 (type_i) - 2));
s->set_beaming (s->flag_i (), LEFT);
s->set_beaming ( s->flag_i (), RIGHT);
-
-#if 0
+ /*
+ URG: this sets the direction of the Stem s.
+ It's amazing Mike:
+
+ Stem:: type_i () ->first_head ()->get_direction () ->
+ directional_element (me).set (d);
+
+ */
+ SCM d = s->get_elt_property ("direction");
if (s->type_i () != 1)
{
int gap_i =s->flag_i () - ((s->type_i () >? 2) - 2);
- s->set_elt_property ("beam-gap", gh_int2scm(gap_i));
+ beam_p_->set_elt_property ("beam-gap", gh_int2scm(gap_i));
}
-#else
- if (s->type_i () != 1)
+ s->set_elt_property ("direction", d);
+
+ if (Rhythmic_req* r = dynamic_cast <Rhythmic_req *> (info.req_l_))
{
- int gap_i =s->flag_i () - ((s->type_i () >? 2) - 2);
- abeam_p_->set_elt_property ("beam-gap", gh_int2scm(gap_i));
+ beam_p_->add_stem (s);
+ Moment stem_location = now_mom () -
+ beam_start_mom_ + beam_start_location_;
+ beam_info_p_->add_stem (stem_location,
+ (r->duration_.durlog_i_ - 2) >? 1);
+ }
+ else
+ {
+ String s = _ ("stem must have Rhythmic structure");
+ if (info.req_l_)
+ info.req_l_->warning (s);
+ else
+ ::warning (s);
}
-#endif
-
- abeam_p_->add_stem (s);
}
}
}
#include "staff-symbol-referencer.hh"
#include "translator-group.hh"
-/*
- Wat mij betreft wel DYN_LINE
- */
-#define DYN_LINE
-
-
-#ifdef DYN_LINE
class Dynamic_line_spanner : public Spanner
{
public:
}
-#endif
-/*
- TODO:
- Baseline alignment / character metrics of dynamic symbols.
- */
-
/**
print text & hairpin dynamics.
*/
Span_req * span_start_req_l_;
Drul_array<Span_req*> span_req_l_drul_;
-#ifdef DYN_LINE
Dynamic_line_spanner* line_spanner_;
-#else
- Spanner* line_spanner_;
-#endif
Moment last_request_mom_;
void typeset_all ();
{
if ((span_req_l_drul_[START] || text_req_l_) && !line_spanner_)
{
-#ifdef DYN_LINE
line_spanner_ = new Dynamic_line_spanner;
-#else
- line_spanner_ = new Spanner;
- line_spanner_->set_elt_property ("transparent", SCM_BOOL_T);
side_position (line_spanner_).set_axis (Y_AXIS);
-#endif
announce_element (Score_element_info
(line_spanner_,
text_req_l_ ? text_req_l_ : span_req_l_drul_[START]));
if (span_req_l_drul_[START] || text_req_l_)
last_request_mom_ = now_mom ();
-#ifndef DYN_LINE
- if (line_spanner_)
- {
- /*
- Generic property will handle this for a Dynamic_line_spanner
- */
- Direction dir = DOWN;
- SCM s = get_property ("dynamicDirection");
- if (!isdir_b (s))
- {
- s = get_property ("verticalDirection");
- }
-
- if (isdir_b (s) && to_dir (s))
- dir = to_dir (s);
-
- line_spanner_->set_elt_property ("direction", gh_int2scm ((int)dir));
-
- s = get_property ("dynamicPadding");
- Real padding;
- if (gh_number_p (s))
- padding = gh_scm2double (s);
- else
- padding = 2;
- line_spanner_->set_elt_property ("padding", gh_double2scm (padding));
- }
-#endif
-
if (text_req_l_)
{
String loud = text_req_l_->text_str_;
{
assert (!finished_cresc_p_);
cresc_p_->set_bounds(RIGHT, get_staff_info ().musical_pcol_l ());
+ cresc_p_->add_dependency (get_staff_info ().musical_pcol_l ());
finished_cresc_p_ = cresc_p_;
cresc_p_ = 0;
span_start_req_l_ = 0;
cresc_p_->set_bounds(LEFT, get_staff_info ().musical_pcol_l ());
cresc_p_->set_bounds(RIGHT, get_staff_info ().musical_pcol_l ());
+ cresc_p_->add_dependency (get_staff_info ().musical_pcol_l ());
// arrragh, brr, urg: we know how wide text is, no?
if (text_p_)
assert (line_spanner_);
cresc_p_->set_parent (line_spanner_, Y_AXIS);
+ cresc_p_->add_dependency (line_spanner_);
announce_element (Score_element_info (cresc_p_, span_req_l_drul_[START]));
}
}
typeset_all ();
if (line_spanner_)
{
-#ifndef DYN_LINE
- Direction dir = directional_element (line_spanner_).get ();
- Real staff_space = Staff_symbol_referencer_interface (line_spanner_).staff_space ();
- SCM s = line_spanner_->get_elt_property ("padding");
- line_spanner_->translate_axis (gh_scm2double (s) * staff_space * (int)dir, Y_AXIS);
-#endif
typeset_element (line_spanner_);
line_spanner_ = 0;
}
{
if (finished_cresc_p_)
{
- finished_cresc_p_->set_bounds (RIGHT, get_staff_info ().musical_pcol_l ());
+ //finished_cresc_p_->set_bounds (RIGHT, get_staff_info ().musical_pcol_l ());
typeset_element (finished_cresc_p_);
finished_cresc_p_ =0;
}
*/
if (line_spanner_ && last_request_mom_ < now_mom ())
{
-#ifndef DYN_LINE
- Direction dir = directional_element (line_spanner_).get ();
- Real staff_space = Staff_symbol_referencer_interface (line_spanner_).staff_space ();
- SCM s = line_spanner_->get_elt_property ("padding");
- line_spanner_->translate_axis (gh_scm2double (s) * staff_space * (int)dir, Y_AXIS);
-#endif
typeset_element (line_spanner_);
line_spanner_ = 0;
}
if (Note_column* n = dynamic_cast<Note_column*> (i.elem_l_))
{
side_position (line_spanner_).add_support (n);
-#ifdef DYN_LINE
line_spanner_->add_column (n);
-#else
- if (!line_spanner_->spanned_drul_[LEFT])
- line_spanner_->set_bounds (LEFT, n);
- line_spanner_->set_bounds (RIGHT, n);
-
- line_spanner_->add_dependency (n);
-#endif
}
}
}
-/*
- chord-tremolo-engraver.hh -- declare Chord_tremolo_engraver
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
- Jan Nieuwenhuizen <janneke@gnu.org>
-*/
-
-
-#ifndef Chord_tremolo_ENGRAVER_HH
-#define Chord_tremolo_ENGRAVER_HH
-
-#include "engraver.hh"
-#include "drul-array.hh"
-
-/**
- Generate an abbreviation beam. Eat stems.
-
- UGH. Derive me from Beam_engraver.
-
- */
-class Chord_tremolo_engraver : public Engraver
-{
-public:
- VIRTUAL_COPY_CONS(Translator);
-
-
- Chord_tremolo_engraver();
-
-protected:
- virtual void do_removal_processing();
- virtual void do_process_requests();
- virtual bool do_try_music (Music*);
- virtual void acknowledge_element (Score_element_info);
- virtual void do_pre_move_processing();
- virtual void do_post_move_processing();
-
-private:
- void typeset_beam ();
- Drul_array<Chord_tremolo_req*> reqs_drul_;
- Chord_tremolo_req* prev_start_req_;
- Beam* abeam_p_;
- Beam* finished_abeam_p_;
-};
-
-#endif // Chord_tremolo_ENGRAVER_HH
struct Chord;
struct Chord_name;
struct Chord_name_engraver;
-struct Chord_tremolo;
struct Chord_tremolo_engraver;
struct Chord_tremolo_req;
struct Clef_change_req;
VIRTUAL_COPY_CONS(Music);
};
/**
- Start / stop an abbreviation beam. */
+ Start / stop a tremolo beam. */
class Chord_tremolo_req : public Span_req
{
public:
Duration default_duration_;
Musical_pitch default_pitch_;
Scope *default_header_p_;
- int abbrev_beam_type_i_;
+ int chord_tremolo_type_i_;
bool first_b_;
int fatal_error_i_;
Sources * source_l_;
Simultaneous_music* get_rest_element (String, Duration *);
Simultaneous_music* get_word_element (String, Duration*);
String notename_str (Melodic_req* melodic);
- void set_abbrev_beam (int type_i);
+ void set_chord_tremolo (int type_i);
void set_last_duration (Duration const *);
void set_last_pitch (Musical_pitch const *);
friend int yyparse (void*);
-/*
- stem-engraver.hh -- declare Stem_engraver
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef STEM_GRAV_HH
-#define STEM_GRAV_HH
-
-#include "engraver.hh"
-
-/**
- Make stems upon receiving noteheads.
- */
-class Stem_engraver : public Engraver
-{
- int default_abbrev_i_;
- Stem *stem_p_;
- Stem_tremolo *abbrev_p_;
- Rhythmic_req *rhythmic_req_l_;
- Tremolo_req* abbrev_req_l_;
-protected:
- virtual void do_creation_processing ();
- virtual void acknowledge_element (Score_element_info);
- virtual void do_pre_move_processing ();
- virtual bool do_try_music (Music*);
-
-public:
- VIRTUAL_COPY_CONS(Translator);
- Stem_engraver();
-
-};
-
-#endif // STEM_GRAV_HH
first_b_ = true;
source_l_ = source_l;
lexer_p_ = 0;
- abbrev_beam_type_i_ = 0;
+ chord_tremolo_type_i_ = 0;
default_duration_.durlog_i_ = 2;
error_level_i_ = 0;
}
void
-My_lily_parser::set_abbrev_beam (int type_i)
+My_lily_parser::set_chord_tremolo (int type_i)
{
- abbrev_beam_type_i_ = type_i;
+ chord_tremolo_type_i_ = type_i;
}
-/*
- output-property-engraver.cc -- implement Output_property_engraver
-
- source file of the GNU LilyPond music typesetter
-
- (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-
-#include "output-property.hh"
-#include "engraver.hh"
-
-class Output_property_engraver : public Engraver
-{
-public:
- Output_property_engraver();
- VIRTUAL_COPY_CONS(Translator);
-protected:
-
- Link_array<Output_property> props_;
-
- virtual void do_acknowledge_element (Score_element_info);
- virtual bool do_try_music (Music*);
-};
-
-
-Output_property_engraver::do_try_music (Music* m)
-{
- if (Output_property * o = dynamic_cast<Output_property*> (m))
- {
- props_.push (m);
- return true;
- }
- return false;
-}
-
-void
-Output_property_engraver::do_acknowledge_element (Score_element_info i)
-{
- for (int i=props_.size (); i--; )
- {
- Output_property * o = props_[i];
- SCM pred = gh_car (o->pred_sym_val_list_);
- /*
- should typecheck pred.
- */
- SCM result=gh_apply (pred,
- gh_listify (i.elem_l_->self_scm_, SCM_UNDEFINED));
- if (to_boolean (result))
- {
- i.elem_l_->set_elt_property (gh_cadr (o->pred_sym_val_list_),
- gh_caddr (o->pred_sym_val_list_));
- }
- }
-}
-
-void
-Output_property_engraver::do_pre_move_processing ()
-{
- props_.clear ();
-}
%type <i> sub_quotes sup_quotes
%type <music> simple_element request_chord command_element Simple_music Composite_music
%type <music> Alternative_music Repeated_music
-%type <i> abbrev_type
+%type <i> tremolo_type
%type <i> int unsigned
%type <i> script_dir
%type <i> optional_modality
%type <music_list> Music_list
%type <paper> paper_block paper_def_body
%type <real> real real_with_dimension
-%type <request> abbrev_command_req
+%type <request> shorthand_command_req
%type <request> post_request
%type <request> command_req verbose_command_req
%type <request> extender_req
;
command_req:
- abbrev_command_req
+ shorthand_command_req
| verbose_command_req semicolon { $$ = $1; }
;
-abbrev_command_req:
+shorthand_command_req:
extender_req {
$$ = $1;
}
| '[' ':' unsigned {
if (!is_duration_b ($3))
THIS->parser_error (_f ("not a duration: %d", $3));
- else if ($3 < 8)
- THIS->parser_error (_ ("Can't abbreviate"));
else
- THIS->set_abbrev_beam ($3);
+ THIS->set_chord_tremolo ($3);
Chord_tremolo_req* a = new Chord_tremolo_req;
a->span_dir_ = START;
- a->type_i_ = THIS->abbrev_beam_type_i_;
+ // urg
+ a->type_i_ = THIS->chord_tremolo_type_i_;
$$=a;
}
| ']' {
- if (!THIS->abbrev_beam_type_i_)
+ /* URG
+ */
+ if (!THIS->chord_tremolo_type_i_)
{
Span_req*b= new Span_req;
b->span_dir_ = STOP;
{
Chord_tremolo_req* a = new Chord_tremolo_req;
a->span_dir_ = STOP;
- a->type_i_ = THIS->abbrev_beam_type_i_;
- THIS->set_abbrev_beam (0);
+ a->type_i_ = THIS->chord_tremolo_type_i_;
+ THIS->set_chord_tremolo (0);
$$ = a;
}
}
sp_p->set_spot (THIS->here_input ());
$$ = sp_p;
}
- | abbrev_type {
+ | tremolo_type {
Tremolo_req* a = new Tremolo_req;
a->set_spot (THIS->here_input ());
a->type_i_ = $1;
;
-abbrev_type:
+tremolo_type:
':' {
$$ =0;
}
| ':' unsigned {
if (!is_duration_b ($2))
THIS->parser_error (_f ("not a duration: %d", $2));
- else if ($2 < 8)
- THIS->parser_error (_ ("Can't abbreviate"));
$$ = $2;
}
;
n->pitch_ = *$1;
n->duration_ = *$4;
- if (THIS->abbrev_beam_type_i_)
+ /*
+ URG
+ */
+ if (THIS->chord_tremolo_type_i_)
{
if (n->duration_.plet_b ())
- THIS->parser_error (_ ("Can't abbreviate tuplet"));
+ // urg, burp. what nonsense / silly implementation
+ THIS->parser_error (_ ("can't put stem tremolo on tuplet"));
else
n->duration_.set_plet (1, 2);
}
*/
#include "staff-symbol-referencer.hh"
-#include "stem-engraver.hh"
#include "note-head.hh"
#include "stem.hh"
#include "musical-request.hh"
#include "stem-tremolo.hh"
#include "staff-info.hh"
#include "translator-group.hh"
+#include "engraver.hh"
-Stem_engraver::Stem_engraver()
+/**
+ Make stems upon receiving noteheads.
+ */
+class Stem_engraver : public Engraver
{
- abbrev_req_l_ = 0;
+
+public:
+ VIRTUAL_COPY_CONS (Translator);
+ Stem_engraver();
+
+protected:
+ virtual void do_creation_processing ();
+ virtual void acknowledge_element (Score_element_info);
+ virtual void do_pre_move_processing ();
+ virtual bool do_try_music (Music*);
+
+private:
+ int default_tremolo_type_i_;
+ Stem *stem_p_;
+ Stem_tremolo *tremolo_p_;
+ Rhythmic_req *rhythmic_req_l_;
+ Tremolo_req* tremolo_req_l_;
+};
+
+ADD_THIS_TRANSLATOR (Stem_engraver);
+
+Stem_engraver::Stem_engraver ()
+{
+ tremolo_req_l_ = 0;
stem_p_ = 0;
- abbrev_p_ = 0;
- default_abbrev_i_ = 16;
+ tremolo_p_ = 0;
+ default_tremolo_type_i_ = 16;
rhythmic_req_l_ =0;
}
void
Stem_engraver::do_creation_processing ()
{
- SCM prop = get_property ("abbrev");
+ /*
+ huh, why only at creation time?
+ */
+ SCM prop = get_property ("tremoloFlags");
if (gh_number_p(prop))
{
- default_abbrev_i_ = gh_scm2int (prop);
+ default_tremolo_type_i_ = gh_scm2int (prop);
}
}
stem_p_->set_elt_property ("duration-log", gh_int2scm (duration_log));
- if (abbrev_req_l_)
+ if (tremolo_req_l_)
{
/*
- suggests typing of:
- c8:16 c: c: c:
- hmm, which isn't so bad?
- */
- int t = abbrev_req_l_->type_i_;
- if (!t)
- t = default_abbrev_i_;
+ Stem tremolo is never applied to a note by default,
+ is must me requested. But there is a default for the
+ tremolo value:
+
+ c4:8 c c:
+
+ the first and last (quarter) note bothe get one tremolo flag.
+ */
+ int requested_type = tremolo_req_l_->type_i_;
+ if (!requested_type)
+ requested_type = default_tremolo_type_i_;
else
- default_abbrev_i_ = t;
+ default_tremolo_type_i_ = requested_type;
- if (t)
+ if (requested_type)
{
- abbrev_p_ = new Stem_tremolo;
- announce_element (Score_element_info (abbrev_p_, abbrev_req_l_));
- abbrev_p_->set_elt_property ("tremolo-flags", gh_int2scm (intlog2 (t) - (duration_log>? 2)));
+ tremolo_p_ = new Stem_tremolo;
+ announce_element (Score_element_info (tremolo_p_, tremolo_req_l_));
+ /*
+ The number of tremolo flags is the number of flags of
+ the tremolo-type minus the number of flags of the note
+ itself.
+ */
+ int tremolo_flags = intlog2 (requested_type) - 2
+ - (duration_log > 2 ? duration_log - 2 : 0);
+ if (tremolo_flags < 0)
+ tremolo_flags = 0;
+ tremolo_p_->set_elt_property ("tremolo-flags",
+ gh_int2scm (tremolo_flags));
}
}
-
- // must give the request, to preserve the rhythmic info.
announce_element (Score_element_info (stem_p_, r));
}
void
Stem_engraver::do_pre_move_processing()
{
- if (abbrev_p_)
+ if (tremolo_p_)
{
- abbrev_p_->set_stem (stem_p_);
- typeset_element (abbrev_p_);
- abbrev_p_ = 0;
+ tremolo_p_->set_stem (stem_p_);
+ typeset_element (tremolo_p_);
+ tremolo_p_ = 0;
}
if (stem_p_)
daddy_trans_l_->set_property ("stemRightBeamCount", SCM_UNDEFINED);
}
+
// UGH. Should mark non-forced instead.
+
+ /*
+ aargh: I don't get it. direction is being set (and then set
+ to forced), if we have a Chord_tremolo.
+ */
SCM dir = stem_p_->get_elt_property ("direction");
if (gh_number_p (dir) && to_dir(dir))
{
stem_p_->set_elt_property ("dir-forced", SCM_BOOL_T);
}
-
typeset_element(stem_p_);
stem_p_ = 0;
}
- abbrev_req_l_ = 0;
+
+
+ tremolo_req_l_ = 0;
}
bool
{
if (Tremolo_req* a = dynamic_cast <Tremolo_req *> (r))
{
- abbrev_req_l_ = a;
+ tremolo_req_l_ = a;
return true;
}
return false;
}
-
-ADD_THIS_TRANSLATOR(Stem_engraver);
-
/*
- abbrev.cc -- implement Stem_tremolo
+ stem-tremolo.cc -- implement Stem_tremolo
source file of the GNU LilyPond music typesetter
#include "staff-symbol-referencer.hh"
#include "directional-element-interface.hh"
+/*
+ TODO:
+ lengthen stem if necessary
+ */
+
Stem_tremolo::Stem_tremolo ()
{
set_elt_property ("stem", SCM_EOL);
Molecule
Stem_tremolo::do_brew_molecule () const
{
- Stem * st = stem_l ();
- int mult =0;
- if (Beam * b = st->beam_l ())
- {
- mult = b->get_multiplicity ();
- }
+ Stem * stem = stem_l ();
+ Beam * beam = stem->beam_l ();
- Real interbeam_f = paper_l ()->interbeam_f (mult);
- Real w = gh_scm2double (get_elt_property ("beam-width"));
- Real space = Staff_symbol_referencer_interface (st).staff_space ();
- Real half_staff_space = space / 2;
- Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));
-
- int beams_i = 0;
- Real dydx = 0.25;
-
- if (st && st->beam_l ())
+ Real dydx;
+ if (beam)
{
Real dy = 0;
- SCM s = st->beam_l ()->get_elt_property ("height");
+ SCM s = beam->get_elt_property ("height");
if (gh_number_p (s))
dy = gh_scm2double (s);
- Real dx = st->beam_l ()->last_visible_stem ()->hpos_f ()
- - st->beam_l ()->first_visible_stem ()->hpos_f ();
- dydx = dy/dx;
-
- // ugh, rather calc from Stem_tremolo_req
- beams_i = st->beam_count(RIGHT) >? st->beam_count (LEFT);
- }
-
- Molecule a (lookup_l ()->beam (dydx, w, beam_f));
- a.translate (Offset (-w/2, w / 2 * dydx));
+ Real dx = beam->last_visible_stem ()->hpos_f ()
+ - beam->first_visible_stem ()->hpos_f ();
+ dydx = dx ? dy/dx : 0;
+ }
+ else
+ // urg
+ dydx = 0.25;
+
+ Real thick = gh_scm2double (get_elt_property ("beam-thickness"));
+ Real width = gh_scm2double (get_elt_property ("beam-width"));
+ Molecule a (lookup_l ()->beam (dydx, width, thick));
+ a.translate (Offset (-width/2, width / 2 * dydx));
- int abbrev_flags = 1;
- {
- SCM a = get_elt_property ("abbrev-flags");
- if (gh_number_p (a))
- abbrev_flags = gh_scm2int (a);
- }
-
+ int tremolo_flags;
+ SCM s = get_elt_property ("tremolo-flags");
+ if (gh_number_p (s))
+ tremolo_flags = gh_scm2int (s);
+ else
+ // huh?
+ tremolo_flags = 1;
+
+ int mult = beam ? beam->get_multiplicity () : 0;
+ Real interbeam_f = paper_l ()->interbeam_f (mult);
Molecule mol;
- for (int i = 0; i < abbrev_flags; i++)
+ for (int i = 0; i < tremolo_flags; i++)
{
Molecule b (a);
b.translate_axis (interbeam_f * i, Y_AXIS);
mol.add_molecule (b);
}
- mol.translate_axis (-mol.extent ()[Y_AXIS].center (), Y_AXIS);
-
- if (st)
- {
- if (st->beam_l ())
- {
- mol.translate (Offset(st->hpos_f () - hpos_f (),
- st->stem_end_position () * half_staff_space -
- directional_element (st->beam_l ()).get () * beams_i * interbeam_f));
- }
- else
- {
- /*
- Beams should intersect one beamthickness below staff end
- */
- Real dy = - mol.extent ()[Y_AXIS].length () / 2 * st->get_direction ();
-
- /*
- uhg. Should use relative coords and placement
- */
- Real whole_note_correction = (st && st->invisible_b( ))
- ? 0.0 // -st->get_direction () * st->note_delta_f ()/2
- : 0.0;
-
- dy += st->stem_end_position ();
- mol.translate (Offset(st->hpos_f () - hpos_f ()+
- whole_note_correction, dy));
- }
+ if (tremolo_flags)
+ mol.translate_axis (-mol.extent ()[Y_AXIS].center (), Y_AXIS);
+
+ Real half_space = Staff_symbol_referencer_interface (stem).staff_space ()
+ / 2;
+ if (beam)
+ {
+ // ugh, rather calc from Stem_tremolo_req
+ int beams_i = stem->beam_count(RIGHT) >? stem->beam_count (LEFT);
+ mol.translate (Offset(stem->hpos_f () - hpos_f (),
+ stem->stem_end_position () * half_space -
+ directional_element (beam).get () * beams_i * interbeam_f));
+ }
+ else
+ {
+ /*
+ Beams should intersect one beamthickness below stem end
+ */
+ Real dy = stem->stem_end_position () * half_space;
+ dy -= mol.extent ()[Y_AXIS].length () / 2 * stem->get_direction ();
/*
- there used to be half a page of code that was long commented out.
- Removed in 1.1.35
- */
+ uhg. Should use relative coords and placement
+ */
+ Real whole_note_correction;
+ if (stem->invisible_b ())
+ whole_note_correction = -stem->get_direction ()
+ * stem->support_head ()->extent (X_AXIS).length () / 2;
+ else
+ whole_note_correction = 0;
+
+ mol.translate (Offset (stem->hpos_f () - hpos_f () +
+ whole_note_correction, dy));
}
return mol;
{
Stem * me = (Stem*) this;
d = get_default_dir ();
+ // urg, AAARGH!
directional_element (me).set (d);
}
return d ;
};
\translator { \LyricsContext }
-\translator{
+ChordNameVoiceContext = \translator {
\type "Engraver_group_engraver";
- \consists "Output_property_engraver";
+ \name ChordNameVoice ;
+ \consists "Output_property_engraver";
\consistsend "Axis_group_engraver";
- \name ChordNameVoice ;
\consists "Separating_line_group_engraver";
\consists "Chord_name_engraver";
-}
-
+};
+\translator {\ChordNameVoiceContext}
ChordNameContext = \translator {
\type "Engraver_group_engraver";
\name ChordNames;
+
+ \consists "Output_property_engraver";
\accepts "ChordNameVoice";
\consistsend "Axis_group_engraver";
};
O_FILES+=$(addprefix $(outdir)/, $(CC_FILES:.cc=.o) $(LL_FILES:.ll=.o) $(YY_FILES:.yy=.o))
-TAGS_FILES += $(TCC_FILES) $(HH_FILES) $(INL_FILES) $(CC_FILES)
+TAGS_FILES += $(TCC_FILES) $(HH_FILES) $(INL_FILES) $(CC_FILES) $(YY_FILES) $(LL_FILES)