Show a summary of usage.
-=item B<-i,--init=>F<FILE>
+=item B<-i,--init=>F<FILE>,
-set init file to F<FILE> (default: F<symbol.ly>).
+Set init file to F<FILE> (default: F<symbol.ly>).
-=item B<--include, -I>=F<DIRECTORY>
+=item B<--include, -I>=F<DIRECTORY>,
-add F<DIRECTORY> to the search path for input files.
+Add F<DIRECTORY> to the search path for input files.
-=item B<--ignore-version, -V>
+=item B<--ignore-version, -V>,
-make incompatible mudela version non-fatal.
+Make incompatible mudela version non-fatal.
=back
=item *
-Multiple staffs in one score. Each staff can have a different meters.
+Multiple staffs in one score. Each staff can have different meters.
=item *
-beams, slurs, ties, chords, super/subscripts (accents and text),
+Beams, slurs, ties, chords, super/subscripts (accents and text)
triplets, general n-plet (triplet, quadruplets, etc.), lyrics,
-transposition dynamics (both absolute and hairpin style)
+transposition dynamics (both absolute and hairpin style).
=item *
-multiple voices within one staff; beams optionally shared
+Multiple voices within one staff; beams optionally shared
between voices. Up to four voices is handled cleanly.
=item *
-multiple scores within one input file. Each score is output to
+Multiple scores within one input file. Each score is output to
a different file.
=item *
-clef changes, meter changes, cadenza-mode, key changes, repeat bars
+Clef changes, meter changes, cadenza-mode, key changes, repeat bars.
=back
=item *
-if the bug has been fixed in a newer release.
+If the bug has been fixed in a newer release.
=item *
-if the bug has been found earlier, consult F<TODO> and F<BUGS>
+If the bug has been found earlier, consult F<TODO> and F<BUGS>.
=back
=over 4
=item *
-send a copy of the input which causes the error
+Send a copy of the input which causes the error.
=item *
-send a description of the platform you use
+Send a description of the platform you use.
=item *
-send a description of the LilyPond version you use (with
-compile/configure options please)
+Send a description of the LilyPond version you use (with
+compile/configure options please).
=item *
-send a description of the bug itself.
+Send a description of the bug itself.
=item *
-send it to bug-gnu-music@vuse.vanderbilt.edu
+Send it to bug-gnu-music@vuse.vanderbilt.edu.
=back
+pl 12.jcn2
+ - typesetting abbreviation beams; abbreviation-*
+ - some simple abbrev fixes + code cleanup (dank je, lieverd)
+
+pl 12.jcn1
+ - typesetting simple abbreviations: c4:16 === [c16 c c c]
+
pl 12
- bf: don't redefine tex primitives like \textfont and \mathfont
- nicer broken slurs (?)
TOPLEVEL_PATCH_LEVEL = 12
# use to send patches, always empty for released version:
-TOPLEVEL_MY_PATCH_LEVEL =
+TOPLEVEL_MY_PATCH_LEVEL = .jcn2
-$convert_mudela_version = "0.1.1";
+$convert_mudela_version = "0.1.2";
use Getopt::Long;
{
s/\\tempo (.*):(.*);/\\tempo $1 = $2;/g
}
+
###############################################################
sub last_conversion
. " -h, --help print this help\n"
. " -o, --output=FILE name output file\n"
. " -s, --show-rules print all known conversion rules\n"
- . " -t, --to=VERSION convert to version VERSION\n"
+ . " -t, --to=VERSION convert to version VERSION\n"
}
"0.0.59" => \&convert_0_0_58_to_0_0_59,
"0.0.60" => \&convert_0_0_59_to_0_0_60,
"0.0.61" => \&convert_0_0_60_to_0_0_61,
- "0.1.1" => \&convert_0_1_0_to_0_1_1
+ "0.1.1" => \&convert_0_1_0_to_0_1_1,
+ "0.1.2" => \&no_conv
);
\alias "Voice_group";
\consists "Dynamic_engraver";
\consists "Stem_engraver";
- \consists "Beam_engraver";
+ \consists "Beam_engraver";
+ \consists "Abbreviation_beam_engraver";
\consists "Script_engraver";
\consists "Note_column_engraver";
\consists "Slur_engraver";
arithmetic_multiplier = 6.\pt;
%
- interbeam = 2.667\pt;
+ interbeam = 3.333\pt;
gourlay_energybound = 100000.;
gourlay_maxmeasures = 12.;
% symbol.ly
-\version "0.1.1";
+\version "0.1.2";
breve = \duration { -1 0 }
longa = \duration { -2 0 }
--- /dev/null
+%{MudelaHeader
+
+ filename: abbrev.ly
+ title:
+ description:
+ composer(s):
+ entered-by: jcn
+ copyright: PD
+
+ Tested Features: simple abbreviations
+EndMudelaHeader
+%}
+
+\version "0.1.2";
+
+\score{
+ \melodic{
+ \octave c'';
+ \meter 4/4;
+ 'a1
+ 'a1:32
+ 'c4:8 c' 'c4:16 c'
+ [ 'c8:16 'c 'c 'c ] [ a a a a ]
+ [ 'c 'f 'b e ]
+ [ 'c16:32 'c 'c 'c ] [ a16:32 a a a ]
+%% % there's still some hairy beam bugfixing todo
+%% [ c'8:16 g d 'a ]
+%% [ c'16:32 g d 'a ]
+%% [ 'c8:32 'f 'b e ]
+ [:16 c4 e]
+ [:16 e4 g]
+ [:16 e2 g]
+ [:16 e1 g]
+ }
+ \paper{
+ }
+% oeps
+ \midi{ }
+}
+
Tested Features: cadenza mode
%}
-\version "0.1.1";
+\version "0.1.2";
cad = \melodic {\id "Staff" "french horn";
Tested Features:test the Collision resolution
EndMudelaHeader
%}
-\version "0.1.1";
+\version "0.1.2";
% (maybe even sooner :-)
%
-\version "0.1.1";
+\version "0.1.2";
alto = \melodic{
%{
%}
-\version "0.1.1";
+\version "0.1.2";
global =
Tested Features: local key, key, forced accidentals
EndMudelaHeader
%}
-\version "0.1.1";
+\version "0.1.2";
blah = \melodic{
Tested Features: example file with comments
%}
-\version "0.1.1";
+\version "0.1.2";
% the % is a comment.
%}
-\version "0.1.1";
+\version "0.1.2";
\score{
\melodic
% \lbheel \lbheel \lfheel \lftoe
% \rbheel \rbtoe \rfheel \rftoe
-\version "0.1.1";
+\version "0.1.2";
\score{
\melodic {
copyright Public Domain"
}
-\version "0.1.1";
+\version "0.1.2";
% should add \need{dutch.ini} for
% correct parsing of note names
-\version "0.1.1";
+\version "0.1.2";
ritme = \melodic{ %\octave ;
\partial 8;
% scales with accents.
%
-\version "0.1.1";
+\version "0.1.2";
blah = \melodic {
\meter 6/8;
\octave 'c ;
Tested Features: scripts, text.
EndMudelaHeader
%}
-\version "0.1.1";
+\version "0.1.2";
blah = \melodic {
Tested Features:breaking algorithm, chords, multivoice, accents
%}
-\version "0.1.1";
+\version "0.1.2";
%% Stuff from MPP version
% \lefttitle{Menuetto}
EndMudelaHeader
%}
-\version "0.1.1";
+\version "0.1.2";
\score{
\melodic{\octave c';
multiple \paper{}s in one \score
%}
-\version "0.1.1";
+\version "0.1.2";
commands = \melodic{
\skip 2.*4;
%}
-\version "0.1.1";
+\version "0.1.2";
toccata_commands = \melodic{
\meter 4/4;
Tested Features lyrics and chords
%}
-\version "0.1.1";
+\version "0.1.2";
melodie = \melodic {
\clef"violin";
Tested Features: lyrics
%}
-\version "0.1.1";
+\version "0.1.2";
melody = \melodic{
\clef violin;
Tested Features: stem direction, multivoice, forced accidentals.
%}
-\version "0.1.1";
+\version "0.1.2";
% should add \need{dutch.ini} for
% correct parsing of note names
--- /dev/null
+/*
+ abbreviation-beam-engraver.cc -- implement Abbreviation_beam_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ Jan Nieuwenhuizen <jan@digicash.com>
+*/
+
+#include "duration-convert.hh"
+#include "time-description.hh"
+#include "abbreviation-beam-engraver.hh"
+#include "stem.hh"
+#include "abbreviation-beam.hh"
+#include "musical-request.hh"
+#include "misc.hh"
+
+IMPLEMENT_IS_TYPE_B1 (Abbreviation_beam_engraver, Engraver);
+ADD_THIS_ENGRAVER (Abbreviation_beam_engraver);
+
+Abbreviation_beam_engraver::Abbreviation_beam_engraver ()
+{
+ span_reqs_drul_[LEFT] = span_reqs_drul_[RIGHT] = 0;
+ abeam_p_ = 0;
+}
+
+bool
+Abbreviation_beam_engraver::do_try_request (Request*r)
+{
+ Musical_req* mus_l = r->musical ();
+ if (!mus_l)
+ return false;
+
+ Abbreviation_beam_req * b = mus_l->abbrev_beam ();
+
+ if (!b)
+ return false;
+
+ if (bool (abeam_p_) == bool (b->spantype == Span_req::START))
+ return false;
+
+ Direction d = (!abeam_p_) ? LEFT : RIGHT;
+ if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (mus_l))
+ return false;
+
+ span_reqs_drul_[d] = b;
+ return true;
+}
+
+void
+Abbreviation_beam_engraver::do_process_requests ()
+{
+ if (!abeam_p_ && span_reqs_drul_[LEFT]) {
+ abeam_p_ = new Abbreviation_beam;
+ announce_element (Score_elem_info (abeam_p_, span_reqs_drul_[LEFT]));
+ }
+}
+
+void
+Abbreviation_beam_engraver::do_pre_move_processing ()
+{
+ if (abeam_p_ && span_reqs_drul_[RIGHT]) {
+ typeset_element (abeam_p_);
+ abeam_p_ = 0;
+
+ span_reqs_drul_[RIGHT] =
+ span_reqs_drul_[LEFT] = 0;
+ }
+}
+
+void
+Abbreviation_beam_engraver::do_removal_processing ()
+{
+ if (abeam_p_)
+ {
+ span_reqs_drul_[LEFT]->warning ("unterminated beam");
+ typeset_element (abeam_p_);
+ abeam_p_ = 0;
+ }
+}
+
+
+void
+Abbreviation_beam_engraver::acknowledge_element (Score_elem_info i)
+{
+ if (!abeam_p_ || !i.elem_l_->is_type_b (Stem::static_name ()))
+ return;
+
+ Stem* s = (Stem*)i.elem_l_->item ();
+// Rhythmic_req *rhythmic_req = i.req_l_->musical ()->rhythmic ();
+// s->flag_i_ = Duration_convert::type2_i (rhythmic_req->duration_.durlog_i_);
+ int type_i = span_reqs_drul_[LEFT]->type_i_;
+ s->flag_i_ = intlog2 (type_i) - 2;
+ if (span_reqs_drul_[RIGHT])
+ s->beams_left_i_ = s->flag_i_;
+ else
+ s->beams_right_i_ = s->flag_i_;
+ abeam_p_->add (s);
+}
--- /dev/null
+/*
+ abbreviation-beam.cc -- implement Abbreviation_beam
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ Jan Nieuwenhuizen <jan@digicash.com>
+*/
+
+#include "p-col.hh"
+#include "varray.hh"
+#include "proto.hh"
+#include "dimen.hh"
+#include "abbreviation-beam.hh"
+#include "misc.hh"
+#include "debug.hh"
+#include "symbol.hh"
+#include "molecule.hh"
+#include "leastsquares.hh"
+#include "stem.hh"
+#include "paper-def.hh"
+#include "lookup.hh"
+#include "stem-info.hh"
+
+
+IMPLEMENT_IS_TYPE_B1 (Abbreviation_beam, Spanner);
+
+Abbreviation_beam::Abbreviation_beam ()
+ : Beam ()
+{
+}
+
+Molecule*
+Abbreviation_beam::brew_molecule_p () const
+{
+ /*
+ todo
+ */
+ return Beam::brew_molecule_p ();
+#if 0
+ Molecule *mol_p = new Molecule;
+ // huh? inter-what
+ // Real inter_f = paper ()->interbeam_f ();
+ Real inter_f = paper ()->internote_f ();
+ Real x0 = stems[0]->hpos_f ();
+ for (int j=0; j <stems.size (); j++)
+ {
+ Stem *i = stems[j];
+ Stem * prev = (j > 0)? stems[j-1] : 0;
+ Stem * next = (j < stems.size ()-1) ? stems[j+1] :0;
+
+ Molecule sb = stem_beams (i, next, prev);
+ Real x = i->hpos_f ()-x0;
+ sb.translate (Offset (x, (x * slope + left_pos)* inter_f));
+ mol_p->add (sb);
+ }
+ mol_p->translate (x0 - spanned_drul_[LEFT]->absolute_coordinate (X_AXIS), X_AXIS);
+ return mol_p;
+#endif
+}
+
+void
+Abbreviation_beam::do_print () const
+{
+#ifndef NPRINT
+ Beam::do_print ();
+ Spanner::do_print ();
+#endif
+}
+
+/*
+ beams to go with one stem.
+ */
+Molecule
+Abbreviation_beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
+{
+ /*
+ todo
+ - shorter beams (not reaching outer "stems")
+ for [:16 c4 c4] and [:16 c1 c1]
+ - centered beam on [:16 c1 c1] heads, rather than "stems"
+ */
+ return Beam::stem_beams (here, next, prev);
+}
void
Beam_engraver::acknowledge_element (Score_elem_info i)
{
- if (beam_p_ && i.elem_l_->is_type_b (Stem::static_name()))
+ if (!beam_p_ || !i.elem_l_->is_type_b (Stem::static_name ()))
+ return;
+
+ Stem* s = (Stem*)i.elem_l_->item();
+ Rhythmic_req *rhythmic_req = i.req_l_->musical ()->rhythmic ();
+ if (rhythmic_req->duration_.durlog_i_<= 2)
{
- Stem * s = (Stem*)i.elem_l_->item();
- Rhythmic_req *rhythmic_req = i.req_l_->musical ()->rhythmic ();
- if (rhythmic_req->duration_.durlog_i_<= 2)
- {
- rhythmic_req->warning ("Stem doesn't fit in Beam");
- return ;
- }
-
- /*
- TODO: do something sensible if it doesn't fit in the beam.
- */
- current_grouping_p_->add_child (get_staff_info().time_C_->whole_in_measure_,
- rhythmic_req->duration());
- /*
- TODO
- should change rep. of flags too.k
- */
- s->flag_i_ = Duration_convert::type2_i
- (rhythmic_req->duration_.durlog_i_);
- s->print_flag_b_ = false;
- beam_p_->add (s);
+ rhythmic_req->warning ("Stem doesn't fit in Beam");
+ return;
}
+
+ /*
+ TODO: do something sensible if it doesn't fit in the beam.
+ */
+ current_grouping_p_->add_child (get_staff_info().time_C_->whole_in_measure_,
+ rhythmic_req->duration ());
+ /*
+ TODO
+ should change repr. of flags too.
+ */
+ s->flag_i_ = Duration_convert::type2_i (rhythmic_req->duration_.durlog_i_);
+ beam_p_->add (s);
}
-
+
IMPLEMENT_IS_TYPE_B1(Beam_engraver, Engraver);
ADD_THIS_ENGRAVER(Beam_engraver);
#include "paper-def.hh"
#include "lookup.hh"
#include "grouping.hh"
+#include "stem-info.hh"
+IMPLEMENT_IS_TYPE_B1(Beam, Spanner);
-struct Stem_info {
- Real x;
- int dir_;
- Real idealy_f_;
- Real miny_f_;
- int beams_i_;
-
- Stem_info(){}
- Stem_info (Stem const *);
-};
-
-Stem_info::Stem_info (Stem const *s)
+Beam::Beam()
{
- x = s->hpos_f();
- dir_ = s->dir_;
- beams_i_ = intlog2(s->flag_i_) - 2;
+ slope = 0;
+ left_pos = 0.0;
+}
- /*
- [todo]
- * get algorithm
- * runtime
-
- Breitkopf + H\"artel:
- miny_f_ = interline + #beams * interbeam
- ideal8 = 2 * interline + interbeam
- ideal16,32,64,128 = 1.5 * interline + #beams * interbeam
-
- * B\"arenreiter:
- miny_f_ = interline + #beams * interbeam
- ideal8,16 = 2 interline + #beams * interbeam
- ideal32,64,128 = 1.5 interline + #beams * interbeam
-
- */
+void
+Beam::add (Stem*s)
+{
+ stems.push (s);
+ s->add_dependency (this);
+ s->beam_l_ = this;
- Real notehead_y = s->paper()->interline_f ();
- // huh? why do i need the / 2
- // Real interbeam_f = s->paper()->interbeam_f ();
- Real interbeam_f = s->paper()->interbeam_f () / 2;
-
- /* well eh, huh?
- idealy_f_ = dir_ * s->stem_start_f() + beams_i_ * interbeam_f;
- if (beams_i_ < 3)
- idealy_f_ += 2 * interline_f;
- else
- idealy_f_ += 1.5 * interline_f;
- */
-
- idealy_f_ = dir_ * s->stem_end_f();
-
- miny_f_ = dir_ * s->stem_start_f() + notehead_y + beams_i_ * interbeam_f;
-
- idealy_f_ = miny_f_ >? idealy_f_;
- // assert (miny_f_ <= idealy_f_);
+ if (!spanned_drul_[LEFT])
+ set_bounds(LEFT,s);
+ set_bounds(RIGHT,s);
}
+Molecule*
+Beam::brew_molecule_p() const
+{
+ Molecule *mol_p = new Molecule;
+ // huh? inter-what
+ // Real inter_f = paper()->interbeam_f ();
+ Real inter_f = paper()->internote_f ();
+ Real x0 = stems[0]->hpos_f();
+ for (int j=0; j <stems.size(); j++)
+ {
+ Stem *i = stems[j];
+ Stem * prev = (j > 0)? stems[j-1] : 0;
+ Stem * next = (j < stems.size()-1) ? stems[j+1] :0;
-/* *************** */
-
+ Molecule sb = stem_beams (i, next, prev);
+ Real x = i->hpos_f()-x0;
+ sb.translate (Offset (x, (x * slope + left_pos)* inter_f));
+ mol_p->add (sb);
+ }
+ mol_p->translate (x0 - spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), X_AXIS);
+ return mol_p;
+}
Offset
Beam::center() const
return Offset (w, (left_pos + w* slope)*paper()->internote_f ());
}
+void
+Beam::do_pre_processing()
+{
+ if (!dir_)
+ set_default_dir();
+}
-Beam::Beam()
+void
+Beam::do_print() const
{
- slope = 0;
- left_pos = 0.0;
+#ifndef NPRINT
+ DOUT << "slope " <<slope << "left ypos " << left_pos;
+ Spanner::do_print();
+#endif
}
void
-Beam::add (Stem*s)
+Beam::do_post_processing()
{
- stems.push (s);
- s->add_dependency (this);
- s->print_flag_b_ = false;
+ if (stems.size() < 2)
+ {
+ warning ("Beam with less than 2 stems");
+ transparent_b_ = true;
+ return ;
+ }
+ solve_slope();
+ set_stemlens();
+}
- if (!spanned_drul_[LEFT])
- set_bounds(LEFT,s);
- set_bounds(RIGHT,s);
+void
+Beam::do_substitute_dependent (Score_elem*o,Score_elem*n)
+{
+ if (o->is_type_b (Stem::static_name()))
+ stems.substitute ((Stem*)o->item(), n?(Stem*) n->item ():0);
+}
+
+Interval
+Beam::do_width() const
+{
+ return Interval (stems[0]->hpos_f(),
+ stems.top()->hpos_f ());
}
void
}
}
-
-void
-Beam::do_post_processing()
-{
- if (stems.size() < 2)
- {
- warning ("Beam with less than 2 stems");
- transparent_b_ = true;
- return ;
- }
- solve_slope();
- set_stemlens();
-}
-
void
Beam::set_grouping (Rhythmic_grouping def, Rhythmic_grouping cur)
{
}
}
-void
-Beam::do_pre_processing()
-{
- if (!dir_)
- set_default_dir();
-
-}
-
-
-Interval
-Beam::do_width() const
-{
- return Interval (stems[0]->hpos_f(),
- stems.top()->hpos_f ());
-}
-
/*
beams to go with one stem.
*/
leftbeams.add (rightbeams);
return leftbeams;
}
-
-
-Molecule*
-Beam::brew_molecule_p() const
-{
-
- Molecule *mol_p = new Molecule;
- // huh? inter-what
- // Real inter_f = paper()->interbeam_f ();
- Real inter_f = paper()->internote_f ();
- Real x0 = stems[0]->hpos_f();
- for (int j=0; j <stems.size(); j++)
- {
- Stem *i = stems[j];
- Stem * prev = (j > 0)? stems[j-1] : 0;
- Stem * next = (j < stems.size()-1) ? stems[j+1] :0;
-
- Molecule sb = stem_beams (i, next, prev);
- Real x = i->hpos_f()-x0;
- sb.translate (Offset (x, (x * slope + left_pos)* inter_f));
- mol_p->add (sb);
- }
- mol_p->translate (x0 - spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), X_AXIS);
- return mol_p;
-}
-
-
-IMPLEMENT_IS_TYPE_B1(Beam, Spanner);
-
-void
-Beam::do_print() const
-{
-#ifndef NPRINT
- DOUT << "slope " <<slope << "left ypos " << left_pos;
- Spanner::do_print();
-#endif
-}
-
-void
-Beam::do_substitute_dependent (Score_elem*o,Score_elem*n)
-{
- if (o->is_type_b (Stem::static_name()))
- {
- stems.substitute ((Stem*)o->item(), n?(Stem*) n->item ():0);
- }
-}
--- /dev/null
+/*
+ abbreviation-beam-engraver.hh -- declare Abbreviation_beam_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ Jan Nieuwenhuizen <jan@digicash.com>
+*/
+
+
+#ifndef ABBREVIATION_BEAM_ENGRAVER_HH
+#define ABBREVIATION_BEAM_ENGRAVER_HH
+
+#include "engraver.hh"
+#include "drul-array.hh"
+
+class Abbreviation_beam; // move me to lily-proto
+
+/**
+ Generate an abbreviation beam. Eat stems.
+ */
+class Abbreviation_beam_engraver : public Engraver
+{
+public:
+ DECLARE_MY_RUNTIME_TYPEINFO;
+
+ Abbreviation_beam_engraver();
+
+protected:
+ virtual void do_removal_processing();
+ virtual void do_process_requests();
+ virtual bool do_try_request (Request*);
+ virtual void acknowledge_element (Score_elem_info);
+ virtual void do_pre_move_processing();
+
+private:
+ Drul_array<Abbreviation_beam_req *> span_reqs_drul_;
+ Abbreviation_beam* abeam_p_;
+};
+
+#endif // ABBREVIATION_BEAM_ENGRAVER_HH
--- /dev/null
+/*
+ abbreviation-beam-engraver.hh -- declare Abbreviation_beam_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ Jan Nieuwenhuizen <jan@digicash.com>
+*/
+
+#ifndef ABBREVIATION_BEAM_HH
+#define ABBREVIATION_BEAM_HH
+
+#include "beam.hh"
+
+/** a beam connects multiple stems Beam adjusts the stems its owns to
+ make sure that they reach the beam and that point in the correct
+ direction */
+class Abbreviation_beam : public Beam {
+public:
+ DECLARE_MY_RUNTIME_TYPEINFO;
+
+ Abbreviation_beam();
+
+ SCORE_ELEM_CLONE(Abbreviation_beam);
+
+protected:
+ virtual void do_print() const;
+ virtual Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
+ virtual Molecule* brew_molecule_p() const;
+};
+
+#endif // ABBREVIATION_BEAM_HH
+
void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current);
void set_stemlens();
SCORE_ELEM_CLONE(Beam);
+
protected:
- virtual Interval do_width() const;
- virtual Offset center() const;
- virtual void set_default_dir();
+ Interval do_width() const;
+ Offset center() const;
+ void set_default_dir();
virtual void do_pre_processing();
virtual void do_post_processing();
virtual void do_substitute_dependent (Score_elem*, Score_elem*);
virtual void do_print() const;
-private:
- Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
- void solve_slope();
- Molecule*brew_molecule_p() const;
+ virtual Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
+ virtual void solve_slope();
+ virtual Molecule*brew_molecule_p() const;
};
#endif // BEAM_HH
struct Absolute_dynamic_req;
+struct Abbreviation_req;
+struct Abbreviation_beam_req;
+struct Abbreviation_beam_engraver;
struct Axis_group_element;
struct Axis_group;
struct Translator;
struct Bar_req;
struct Barcheck_req;
struct Beam;
+struct Beam_engraver;
struct Beam_req;
struct Blank_req;
struct Box;
virtual Melodic_req *melodic() { return 0; }
virtual Slur_req *slur() { return 0 ; }
virtual Beam_req *beam() { return 0 ; }
+ virtual Abbreviation_beam_req* abbrev_beam() { return 0 ; }
virtual Rhythmic_req*rhythmic() { return 0; }
virtual Musical_script_req*musicalscript() { return 0; }
virtual Text_req*text() { return 0; }
virtual Absolute_dynamic_req * absdynamic() { return 0; }
virtual Tie_req * tie() { return 0; }
virtual Span_dynamic_req * span_dynamic() { return 0; }
+ virtual Abbreviation_req* abbrev() { return 0; }
REQUESTMETHODS(Musical_req, musical);
};
public:
REQUESTMETHODS(Skip_req, skip);
};
+
struct Spacing_req :virtual Request {
Moment next;
Real distance;
REQUESTMETHODS(Spacing_req, spacing);
};
+struct Abbreviation_req : public Musical_req {
+ REQUESTMETHODS (Abbreviation_req, abbrev);
+ Abbreviation_req ();
+ int type_i_;
+};
+
class Blank_req : public Spacing_req, Rhythmic_req {
public:
REQUESTMETHODS(Spacing_req, spacing);
Beam_req();
};
+/**
+ Start / stop an abbreviation beam at this note.
+ */
+class Abbreviation_beam_req : public Span_req {
+public:
+ REQUESTMETHODS (Abbreviation_beam_req, abbrev_beam);
+
+ Abbreviation_beam_req ();
+
+ int type_i_;
+};
+
/**
Start a tie at this voice element, end it at the next
*/
void set_last_duration (Duration const *);
void set_default_duration (Duration const *);
+ void set_last_abbrev (int type_i);
+ void set_abbrev_beam (int type_i);
void set_duration_mode (String s);
friend int yyparse (void*);
+
public:
+ int abbrev_beam_type_i_;
+ int default_abbrev_type_i_;
int default_octave_i_;
Duration default_duration_;
Plet plet_;
Direction dir_;
Stem *stem_p_;
Rhythmic_req *rhythmic_req_l_;
+ Abbreviation_req* abbrev_req_l_;
protected:
virtual void acknowledge_element (Score_elem_info);
virtual void do_pre_move_processing ();
+ virtual bool do_try_request (Request*);
virtual void set_feature (Feature dir_i_);
public:
--- /dev/null
+/*
+ stem-info.hh -- declare Stem_info
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+*/
+
+
+#ifndef STEM_INFO_HH
+#define STEM_INFO_HH
+
+#include "real.hh"
+
+struct Stem_info {
+ Real x;
+ int dir_;
+ Real idealy_f_;
+ Real miny_f_;
+ int beams_i_;
+
+ Stem_info();
+ Stem_info (Stem const *);
+};
+
+#endif // STEM_INFO_HH
#include "item.hh"
#include "varray.hh"
#include "moment.hh"
+#include "molecule.hh"
/**the rule attached to the ball.
Stem size depends on flag.
*/
class Stem : public Item {
+
+ Molecule abbrev_mol () const;
Real stem_bottom_f_, stem_top_f_;
Link_array<Note_head> rest_l_arr_;
public:
+ /// abbrev flag? + count
+ int abbrev_flag_i_;
+
/// flagtype? 4 none, 8 8th flag, 0 = beam.
int flag_i_;
+ /**
+ don't print flag when in beam.
+ our beam, for aligning abbrev flags
+ */
+ Beam* beam_l_;
+
int beams_left_i_;
int beams_right_i_;
- /// false if in beam
- bool print_flag_b_;
-
Direction dir_;
-
/* *************** */
Stem ();
#endif
}
+IMPLEMENT_IS_TYPE_B1(Spacing_req,Request);
+
Spacing_req::Spacing_req()
{
next = 0;
strength = 0;
}
-IMPLEMENT_IS_TYPE_B1(Spacing_req,Request);
-
void
Spacing_req::do_print() const
{
#endif
}
+IMPLEMENT_IS_TYPE_B1 (Abbreviation_req, Musical_req);
+
+Abbreviation_req::Abbreviation_req ()
+{
+ type_i_ = 0;
+}
+
+void
+Abbreviation_req::do_print() const
+{
+#ifndef NPRINT
+ DOUT << "type " << type_i_ << "\n";
+#endif
+}
+
IMPLEMENT_IS_TYPE_B2(Blank_req,Spacing_req,Rhythmic_req);
}
/* *************** */
+
+IMPLEMENT_IS_TYPE_B1(Beam_req,Span_req);
+
Beam_req::Beam_req()
{
nplet = 0;
}
-IMPLEMENT_IS_TYPE_B1(Beam_req,Span_req);
void
-Beam_req::do_print() const{}
+Beam_req::do_print() const
+{
+}
+
/* *************** */
+IMPLEMENT_IS_TYPE_B1 (Abbreviation_beam_req, Span_req);
+
+Abbreviation_beam_req::Abbreviation_beam_req ()
+{
+ type_i_ = 0;
+}
+
+void
+Abbreviation_beam_req::do_print () const
+{
+}
+
IMPLEMENT_IS_TYPE_B1(Slur_req,Span_req);
+
void
-Slur_req::do_print() const{}
-/* *************** */
+Slur_req::do_print() const
+{
+}
+/* *************** */
bool
Span_req:: do_equal_b (Request*r) const
#include "header.hh"
+My_lily_parser::My_lily_parser (Sources * source_l)
+{
+ first_b_ = true;
+ source_l_ = source_l;
+ lexer_p_ = 0;
+ abbrev_beam_type_i_ = 0;
+ default_abbrev_type_i_ = 0;
+ default_duration_.durlog_i_ = 2;
+ default_octave_i_ = 0;
+ textstyle_str_="roman"; // in lexer?
+ error_level_i_ = 0;
+ last_duration_mode_b_ = true;
+ fatal_error_i_ = 0;
+ default_header_p_ =0;
+}
+
+My_lily_parser::~My_lily_parser()
+{
+ delete lexer_p_;
+ delete default_header_p_;
+}
+
+
void
My_lily_parser::clear_notenames()
{
lexer_p_->clear_notenames();
}
+
void
My_lily_parser::set_version_check (bool ig)
{
}
}
-My_lily_parser::~My_lily_parser()
-{
- delete lexer_p_;
- delete default_header_p_;
-}
-
void
My_lily_parser::remember_spot()
{
last_duration_mode_b_ = (s== "LAST");
}
+void
+My_lily_parser::set_abbrev_beam (int type_i)
+{
+ abbrev_beam_type_i_ = type_i;
+}
+
+void
+My_lily_parser::set_last_abbrev (int type_i)
+{
+ default_abbrev_type_i_ = type_i;
+}
+
void
My_lily_parser::set_default_duration (Duration const *d)
{
last_duration_mode_b_ = false;
default_duration_ = *d;
+ set_last_abbrev (0);
}
{
if (last_duration_mode_b_)
default_duration_ = *d;
+ set_last_abbrev (0);
}
v->add (rq);
+ // too bad parser reads (default) duration via member access,
+ // this hack will do for now..
+ if (abbrev_beam_type_i_)
+ {
+ assert (!duration_p->plet_b ());
+ duration_p->set_plet (1, 2);
+ }
rq->set_duration (*duration_p);
rq->set_spot (here_input());
delete duration_p ;
case '[':
case ']':
{
- Beam_req*b = new Beam_req;
- int p_i=plet_.type_i_ ; // ugh . Should junk?
- if (p_i!= 1)
- b->nplet = p_i;
- req_p = b;
+ if (!abbrev_beam_type_i_)
+ {
+ Beam_req*b = new Beam_req;
+ int p_i=plet_.type_i_ ; // ugh . Should junk?
+ if (p_i!= 1)
+ b->nplet = p_i;
+ req_p = b;
+ }
+ else
+ {
+ Abbreviation_beam_req* a = new Abbreviation_beam_req;
+ a->type_i_ = abbrev_beam_type_i_;
+ if (c==']')
+ abbrev_beam_type_i_ = 0;
+ req_p = a;
+ }
}
break;
return req_p;
}
-My_lily_parser::My_lily_parser (Sources * source_l)
-{
- first_b_ = true;
- source_l_ = source_l;
- lexer_p_ = 0;
- default_duration_.durlog_i_ = 2;
- default_octave_i_ = 0;
- textstyle_str_="roman"; // in lexer?
- error_level_i_ = 0;
- last_duration_mode_b_ = true;
- fatal_error_i_ = 0;
- default_header_p_ =0;
-}
-
void
My_lily_parser::add_requests (Chord*v)
{
#include <iostream.h>
// mmm
-#define MUDELA_VERSION "0.1.1"
+#define MUDELA_VERSION "0.1.2"
#include "script-def.hh"
#include "symtable.hh"
Interval *interval;
Lookup*lookup;
Melodic_req * melreq;
+ Musical_req* musreq;
Music_output_def * outputdef;
Midi_def* midi;
Moment *moment;
%type <header> mudela_header mudela_header_body
%type <box> box
%type <c> open_request_parens close_request_parens
+%type <c> open_abbrev_parens
%type <c> open_plet_parens close_plet_parens
%type <music> simple_element music_elt full_element lyrics_elt command_elt
+%type <i> abbrev_type
%type <i> int
%type <i> script_dir
%type <id> identifier_init
%type <paper> paper_block paper_body
%type <real> dim real
%type <real> unit
-%type <request> post_request pre_request command_req verbose_command_req
%type <request> abbrev_command_req
+%type <request> post_request pre_request command_req verbose_command_req
%type <request> script_req dynamic_req
%type <score> score_block score_body
%type <script> script_definition script_body mudela_script gen_script_def
}
;
+open_abbrev_parens:
+ '[' ':' INT {
+ $$ = '[';
+ if (!Duration::duration_type_b ($3))
+ THIS->parser_error ("Not a duration");
+ else if ($3 < 8)
+ THIS->parser_error ("Can't abbreviate");
+ else
+ THIS->set_abbrev_beam ($3);
+ }
+ ;
+
open_plet_parens:
'[' INT '/' INT {
$$ = '[';
| '[' {
$$='[';
}
+ | open_abbrev_parens {
+ }
| open_plet_parens {
}
;
;
+abbrev_type:
+ /* */
+ {
+ $$ = THIS->default_abbrev_type_i_;
+ }
+ | ':' int {
+ if (!Duration::duration_type_b ($2))
+ THIS->parser_error ("Not a duration");
+ else if ($2 < 8)
+ THIS->parser_error ("Can't abbreviate");
+ else
+ THIS->set_last_abbrev ($2);
+ $$ = THIS->default_abbrev_type_i_;
+ }
+ ;
+
music_elt:
- steno_note_req notemode_duration {
- if (!THIS->lexer_p_->note_state_b())
- THIS->parser_error("have to be in Note mode for notes");
+ steno_note_req notemode_duration abbrev_type {
+ if (!THIS->lexer_p_->note_state_b ())
+ THIS->parser_error ("have to be in Note mode for notes");
$1->set_duration (*$2);
- $$ = THIS->get_note_element($1, $2);
+ int durlog_i = $2->durlog_i_;
+ Chord* c = THIS->get_note_element ($1, $2);
+ $$ = c;
+ if ($3) {
+ Abbreviation_req* a = new Abbreviation_req;
+ a->type_i_ = $3;
+ c->add (a);
+ }
}
| RESTNAME notemode_duration {
$$ = THIS->get_rest_element(*$1, $2);
#include "stem.hh"
#include "musical-request.hh"
#include "duration-convert.hh"
+#include "misc.hh"
Stem_engraver::Stem_engraver()
{
- stem_p_ =0;
- dir_ =CENTER;
+ abbrev_req_l_ = 0;
+ stem_p_ = 0;
+ dir_ = CENTER;
}
void
{
Rhythmic_req * r = i.req_l_->musical()->rhythmic();
stem_p_ = new Stem;
- stem_p_->flag_i_ = Duration_convert::type2_i(r->duration_.durlog_i_);
+ int durlog_i = r->duration_.durlog_i_;
+ stem_p_->flag_i_ = Duration_convert::type2_i(durlog_i);
+ if (abbrev_req_l_)
+ stem_p_->abbrev_flag_i_ = intlog2 (abbrev_req_l_->type_i_)
+ - (durlog_i>? 2);
announce_element (Score_elem_info (stem_p_, r));
}
stem_p_->add (h);
{
if (dir_)
stem_p_->dir_ = dir_;
-
+
typeset_element(stem_p_);
- stem_p_ =0;
+ stem_p_ = 0;
}
+ abbrev_req_l_ = 0;
+}
+
+bool
+Stem_engraver::do_try_request (Request* r)
+{
+ Musical_req* mus_l = r->musical ();
+ if (!mus_l)
+ return false;
+
+ Abbreviation_req* a = mus_l->abbrev ();
+ if (!a)
+ return false;
+
+ abbrev_req_l_ = a;
+
+ return true;
}
void
--- /dev/null
+/*
+ stem-info.cc -- implement Stem_info
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+
+*/
+
+#include "proto.hh"
+#include "dimen.hh"
+#include "misc.hh"
+#include "debug.hh"
+#include "symbol.hh"
+#include "stem.hh"
+#include "paper-def.hh"
+#include "lookup.hh"
+#include "stem-info.hh"
+
+Stem_info::Stem_info ()
+{
+}
+
+Stem_info::Stem_info (Stem const *s)
+{
+ x = s->hpos_f();
+ dir_ = s->dir_;
+ beams_i_ = intlog2(s->flag_i_) - 2;
+
+ /*
+ [todo]
+ * get algorithm
+ * runtime
+
+ Breitkopf + H\"artel:
+ miny_f_ = interline + #beams * interbeam
+ ideal8 = 2 * interline + interbeam
+ ideal16,32,64,128 = 1.5 * interline + #beams * interbeam
+
+ * B\"arenreiter:
+ miny_f_ = interline + #beams * interbeam
+ ideal8,16 = 2 interline + #beams * interbeam
+ ideal32,64,128 = 1.5 interline + #beams * interbeam
+
+ */
+
+ Real notehead_y = s->paper()->interline_f ();
+ // huh? why do i need the / 2
+ // Real interbeam_f = s->paper()->interbeam_f ();
+ Real interbeam_f = s->paper()->interbeam_f () / 2;
+
+ /* well eh, huh?
+ idealy_f_ = dir_ * s->stem_start_f() + beams_i_ * interbeam_f;
+ if (beams_i_ < 3)
+ idealy_f_ += 2 * interline_f;
+ else
+ idealy_f_ += 1.5 * interline_f;
+ */
+
+ idealy_f_ = dir_ * s->stem_end_f();
+
+ miny_f_ = dir_ * s->stem_start_f() + notehead_y + beams_i_ * interbeam_f;
+
+ idealy_f_ = miny_f_ >? idealy_f_;
+ // assert (miny_f_ <= idealy_f_);
+}
+
#include "molecule.hh"
#include "p-col.hh"
#include "misc.hh"
+#include "beam.hh"
const int STEMLEN=7;
-int
-Stem::min_head_i() const
-{
- int m = 1000;
- for (int i =0; i < head_l_arr_.size(); i++)
- m = m <? head_l_arr_[i]->position_i_;
- return m;
-}
+IMPLEMENT_IS_TYPE_B1 (Stem,Item);
-int
-Stem::max_head_i() const
-{
- int m = -1000;
- for (int i =0; i < head_l_arr_.size(); i++)
- m = m >? head_l_arr_[i]->position_i_;
- return m;
-
-}
-/*
- TODO: staff-size
- */
Stem::Stem ()
{
+ /*
+ TODO: staff-size
+ */
+ abbrev_flag_i_ = 0;
+ beam_l_ = 0;
beams_left_i_ = 0;
beams_right_i_ = 0;
dir_ =CENTER;
staff_size_i_ = 8;
- print_flag_b_=true;
stem_xoffset_f_ =0;
}
+int
+Stem::min_head_i () const
+{
+ int m = 1000;
+ for (int i =0; i < head_l_arr_.size (); i++)
+ m = m <? head_l_arr_[i]->position_i_;
+ return m;
+}
-IMPLEMENT_IS_TYPE_B1(Stem,Item);
+int
+Stem::max_head_i () const
+{
+ int m = -1000;
+ for (int i =0; i < head_l_arr_.size (); i++)
+ m = m >? head_l_arr_[i]->position_i_;
+ return m;
+
+}
void
-Stem::do_print() const
+Stem::do_print () const
{
#ifndef NPRINT
- DOUT << "flag "<< flag_i_ << " print_flag_b_ " << print_flag_b_;
+ DOUT << "flag "<< flag_i_ << " print_flag? " << !(bool)beam_l_ << "abbrev_flag_i_" << abbrev_flag_i_;
#endif
}
Real
-Stem::stem_length_f() const
+Stem::stem_length_f () const
{
return stem_top_f_-stem_bottom_f_ ;
}
Real
-Stem::stem_start_f() const
+Stem::stem_start_f () const
{
return (dir_ < 0)? stem_top_f_ : stem_bottom_f_;
}
Real
-Stem::stem_end_f() const
+Stem::stem_end_f () const
{
return (dir_ < 0)? stem_bottom_f_ : stem_top_f_;
}
Stem::set_stemend (Real se)
{
// todo: margins
- if (! ((dir_ > 0 && se >= max_head_i()) ||
- (se <= min_head_i() && dir_ <0)))
+ if (! ((dir_ > 0 && se >= max_head_i ()) ||
+ (se <= min_head_i () && dir_ <0)))
warning ("Weird stem size; check for narrow beams");
- stem_top_f_ = (dir_ < 0) ? max_head_i() : se;
- stem_bottom_f_ = (dir_ < 0) ? se : min_head_i();
+ stem_top_f_ = (dir_ < 0) ? max_head_i () : se;
+ stem_bottom_f_ = (dir_ < 0) ? se : min_head_i ();
}
void
{
n->add_dependency (this);
if (n->rest_b_)
- {
rest_l_arr_.push (n);
- }
- else if (n->balltype_i_ == 0)
- {
- whole_l_arr_.push (n);
- return;
- }
- else
- {
+ else
head_l_arr_.push (n);
- }
+
+#if 0
+ else if (1) //why different? (n->balltype_i_)
+ head_l_arr_.push (n);
+ else
+ whole_l_arr_.push (n);
+#endif
}
bool
-Stem::invisible_b() const
+Stem::invisible_b () const
{
return !head_l_arr_.size();
}
// if dir_ is set we return fake values.
int
-Stem::get_center_distance_from_top()
+Stem::get_center_distance_from_top ()
{
if (dir_)
return (dir_ > 0) ? 0 : 1;
int staff_center = staff_size_i_ / 2;
- int max = max_head_i() - staff_center;
+ int max = max_head_i () - staff_center;
return max >? 0;
}
// if dir_ is set we return fake values.
int
-Stem::get_center_distance_from_bottom()
+Stem::get_center_distance_from_bottom ()
{
if (dir_)
return (dir_ > 0) ? 1 : 0;
int staff_center = staff_size_i_ / 2;
- int min = staff_center - min_head_i();
+ int min = staff_center - min_head_i ();
return min >? 0;
}
Direction
-Stem::get_default_dir()
+Stem::get_default_dir ()
{
if (dir_)
return dir_;
- return (get_center_distance_from_top() >=
- get_center_distance_from_bottom()) ? -1 : 1;
+ return (get_center_distance_from_top () >=
+ get_center_distance_from_bottom ()) ?
+ (Direction)-1 : (Direction)1;
}
void
-Stem::set_default_dir()
+Stem::set_default_dir ()
{
- dir_ = get_default_dir();
+ dir_ = get_default_dir ();
}
void
-Stem::set_default_stemlen()
+Stem::set_default_stemlen ()
{
if (!dir_)
- set_default_dir();
+ set_default_dir ();
-
// ugh... how about non 5-line staffs?
- if ((max_head_i() < -2 && dir_ == 1)
- ||(min_head_i() > staff_size_i_ && dir_ == -1))
+ bool on_ledger_line_b = ((max_head_i () < -2 && dir_ == 1)
+// || (min_head_i () > staff_size_i_ && dir_ == -1));
+ || (min_head_i () > staff_size_i_ + 3 && dir_ == -1));
+ if (on_ledger_line_b)
{
- set_stemend (staff_size_i_ /2 -1);
+ set_stemend (staff_size_i_ / 2 - 1);
}
else
{
- set_stemend ((dir_ > 0) ? max_head_i() + STEMLEN :
- min_head_i() - STEMLEN);
-
+ Real dy = paper ()->interbeam_f ();
+ Real len = STEMLEN;
+ // ugh, should get nice *rule* for this
+ if (abbrev_flag_i_ > 1)
+ len += (abbrev_flag_i_ - 1)* dy / 2;
+ set_stemend ((dir_ > 0) ? max_head_i () + len :
+ min_head_i () - len);
}
}
-
void
-Stem::set_default_extents()
+Stem::set_default_extents ()
{
- if (!stem_length_f())
- set_default_stemlen();
+ if (!stem_length_f ())
+ set_default_stemlen ();
set_stemend ((dir_< 0) ?
- max_head_i()-stem_length_f (): min_head_i () +stem_length_f ());
+ max_head_i ()-stem_length_f (): min_head_i () +stem_length_f ());
if (dir_ > 0){
- stem_xoffset_f_ = paper()->note_width ()-paper ()->rule_thickness ();
+ stem_xoffset_f_ = paper ()->note_width ()-paper ()->rule_thickness ();
}
else
stem_xoffset_f_ = 0;
*/
void
-Stem::set_noteheads()
+Stem::set_noteheads ()
{
- if (!head_l_arr_.size())
+ if (!head_l_arr_.size ())
return;
head_l_arr_.sort (Note_head::compare);
if (dir_ < 0)
- head_l_arr_.reverse();
+ head_l_arr_.reverse ();
head_l_arr_[0]->extremal_i_ = -1;
- head_l_arr_.top()->extremal_i_ = 1;
+ head_l_arr_.top ()->extremal_i_ = 1;
int parity=1;
int lastpos = head_l_arr_[0]->position_i_;
- for (int i=1; i < head_l_arr_.size(); i ++)
+ for (int i=1; i < head_l_arr_.size (); i ++)
{
int dy =abs (lastpos- head_l_arr_[i]->position_i_);
}
void
-Stem::do_pre_processing()
+Stem::do_pre_processing ()
{
if (stem_bottom_f_== stem_top_f_)
- set_default_extents();
- set_noteheads();
+ set_default_extents ();
+ set_noteheads ();
flag_i_ = dir_*abs (flag_i_);
- transparent_b_ = invisible_b();
- empty_b_ = invisible_b();
+ transparent_b_ = invisible_b ();
+ empty_b_ = invisible_b ();
}
-
Interval
-Stem::do_width() const
+Stem::do_width () const
{
- if (!print_flag_b_ || abs (flag_i_) <= 4)
+ if (beam_l_ || abs (flag_i_) <= 4)
return Interval (0,0); // TODO!
- Paper_def*p= paper();
- Interval r (p->lookup_l()->flag (flag_i_).dim.x ());
+ Paper_def*p= paper ();
+ Interval r (p->lookup_l ()->flag (flag_i_).dim.x ());
r+= stem_xoffset_f_;
return r;
}
+Molecule
+Stem::abbrev_mol () const
+{
+ Real dy = paper ()->interbeam_f ();
+ Real w = 1.5 * paper ()->lookup_l ()->ball (2).dim.x ().length ();
+ Real beamdy = paper ()->interline_f () / 2;
+
+ int beams_i = 0;
+ Real slope = paper ()->internote_f () / 4;
+
+ if (beam_l_) {
+ // huh?
+ slope = 2 * beam_l_->slope;
+ // ugh, rather calc from Abbreviation_req
+ beams_i = beams_right_i_ >? beams_left_i_;
+ }
+ paper()->lookup_l ()->beam (slope, 20 PT);
+
+ Molecule beams;
+ Atom a (paper ()->lookup_l ()->beam (slope, w));
+ a.translate (Offset(- w / 2, stem_end_f () - (w / 2 * slope)));
+ // ugh
+ if (!beams_i)
+ a.translate (dy + beamdy - dir_ * dy, Y_AXIS);
+ else
+ a.translate (2 * beamdy - dir_ * (beamdy - dy), Y_AXIS);
+
+ for (int i = 0; i < abbrev_flag_i_; i++)
+ {
+ Atom b (a);
+ b.translate (-dir_ * dy * (beams_i + i), Y_AXIS);
+ beams.add (b);
+ }
+
+ return beams;
+}
+
Molecule*
-Stem::brew_molecule_p() const
+Stem::brew_molecule_p () const
{
- Molecule *out =0;
-
Real bot = stem_bottom_f_;
Real top = stem_top_f_;
assert (bot!=top);
- Paper_def *p =paper();
+ Paper_def *p =paper ();
- Real dy = p->internote_f();
- Symbol ss =p->lookup_l()->stem (bot*dy,top*dy);
+ Real dy = p->internote_f ();
+ Symbol ss =p->lookup_l ()->stem (bot*dy,top*dy);
- out = new Molecule (Atom (ss));
+ Molecule* mol_p = new Molecule;
+ if (head_l_arr_.size() && head_l_arr_[0]->balltype_i_)
+ mol_p->add (Atom (ss));
- if (print_flag_b_&&abs (flag_i_) > 4)
+ if (!beam_l_ && abs (flag_i_) > 4)
{
- Symbol fl = p->lookup_l()->flag (flag_i_);
+ Symbol fl = p->lookup_l ()->flag (flag_i_);
Molecule m (fl);
if (flag_i_ < -4){
- out->add_bottom (m);
+ mol_p->add_bottom (m);
}
else if (flag_i_ > 4)
{
- out->add_top (m);
+ mol_p->add_top (m);
}
else
assert (false);
+ assert (!abbrev_flag_i_);
}
- out->translate (stem_xoffset_f_, X_AXIS);
- return out;
+ if (abbrev_flag_i_)
+ mol_p->add (abbrev_mol ());
+
+ mol_p->translate (stem_xoffset_f_, X_AXIS);
+ return mol_p;
}
Real
-Stem::hpos_f() const
+Stem::hpos_f () const
{
- return Item::hpos_f() + stem_xoffset_f_;
+ return Item::hpos_f () + stem_xoffset_f_;
}
void
Stem::do_substitute_dependency (Score_elem*o,Score_elem*n)
{
- Item * o_l = o->item();
- Item * n_l = n? n->item():0;
- whole_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l);
+ Item * o_l = o->item ();
+ Item * n_l = n? n->item ():0;
+// whole_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l);
head_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l);
rest_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l);
}
*os_p_ << filename_str_g;
*os_p_ << "\n\n";
// ugh
- *os_p_ << "\\version \"0.1.1\";\n";
+ *os_p_ << "\\version \"0.1.2\";\n";
}
void