* Michael Krause <m.krause@tu-harburg.de>, breathing signs
+ * Dirk Lattermann <dlatt@datenrat.de>, minor improvements on
+ accidentals/ties/multi measure rests
+
* Werner Lemberg <wl@gnu.org>, misc bugfixes, some Beam and Stem
code.
+pl7.mb1
+ - bf: timeSignatureStyle works again
+pl 7.hwn1
+ - Dirk Latterman key/mmrest patches
+ - Offset callbacks in Dimension_cache
+ - Junked Staff_side_*
+ - Staff_sidify: interface class.
+ - prelude-{1,2} fixes.
+
+***********
pl 6.uu2
- bf: PS font selecting.
@mudelafile{multi-measure-rest.ly}
+If @code{Score.skipBars} is set,
+the signs for four, two, and one measure rest are combined to
+produce the graphical representation of rests for up to 10 bars.
+The number of bars will be written above the sign.
+
+@mudelafile{mm-rest2.ly}
+
+A sharp sign after a double sharp sign, as well as a flat sign
+after a double flat sign is automatically prepended with a
+natural sign.
+
+@mudelafile{double-single-acc.ly}
+
@section Stems
Stem tremolos (official naming?) or rolls are tremolo signs that look
mf/ital-*.mf (these were taken from the CM fonts)
@item @email{m.krause@@tu-harburg.de, Michael Krause},
breathing signs
+@item @email{dlatt@@datenrat.de, Dirk Lattermann},
+ minor improvements on accidentals/ties/multi measure rests
@item @email{wl@@gnu.org, Werner Lemberg},
misc bugfixes, some Beam and Stem code.
@item @email{drl@@vuse.vanderbilt.edu, David R. Linn},
include $(depth)/make/stepmake.make
-
dvi: $(DVI_FILES)
ps: $(PS_FILES)
"GNU LilyPond has no connection with the music package Rosegarden, other
than the names being similar :-)"
-
-
@end ignore
@contents
. * make all Feta (including dynamics) available to the user in
textual scripts. Examples: "D.S. al \coda", "\mf espress.".
-
. * Write script that uses --find-old-relative to do auto relativization.
. * Junk shared cruft (duration, moment) in lib/
PACKAGE_NAME=LilyPond
MAJOR_VERSION=1
MINOR_VERSION=3
-PATCH_LEVEL=7
+PATCH_LEVEL=8
MY_PATCH_LEVEL=
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
--- /dev/null
+\score { \notes {
+c4 \clef bass ; c4}}
--- /dev/null
+\version "1.3.5";
+\score{
+ \notes\relative c'{
+ [c16 \stemdown c'' \stemboth c,, d]
+ \stemdown [d'' a \stemboth c,, g,]
+ \stemup [g c' \stemboth a'' d']
+ }
+}
\version "1.3.5";
m = \notes \relative c''{
-c1 | c2 c | c c | c c | c c | c c | c c | c c |
+c1 | c2 c | c c | c c | \break c c | c c | c c | c c |
}
\score{ <
textheight = 260.\mm;
\translator {
\OrchestralScoreContext
+ barNumberScriptPadding = 10;
minVerticalAlign = 2.2*\staffheight;
}
\translator { \StaffContext
\score {
- \notes { \time 2/2; c'2 c'2 \time 2/2; }
+ \notes { \time 2/2; f''2 c'2 \time 2/2; }
\paper { linewidth = 2.5 \cm;
indent = 0.0;
}
\context Staff = bass { \property Staff.instrument = "Left " \clef bass; c4 }>
\paper {
+\translator { \ScoreContext
+ textVerticalAlignment = #0
+ }
\translator { \StaffContext \consists "Staff_margin_engraver"; }
\translator { \PianoStaffContext \consists "Staff_margin_engraver"; }
}}
-thenotes = \notes \relative cis' { \time 4/4; gis'2 gis ~ |
-gis gis4 gis |
+thenotes = \notes \relative cis' { \time 4/4;
+gis'2 gis ~ |
+gis4 gis8 ~ gis g4 gis |
g2 gis ~ |
gis g4 gis |
g2 gis( |
-)g gis4 gis | }
+)g! gis4 gis |
+
+\key a \major;
+gis2 g ~ |
+g4 gis8 ~ gis g4 gis |
+g2 gis ~ |
+gis g4 gis |
+g2 gis( |
+)g! gis4 gis |
+}
\score { < \context Staff \thenotes
\context NoteNames \thenotes
Adobe_font_char_metric::name ()
{
return N_;
-
}
int &
Bar_script_engraver::Bar_script_engraver ()
{
axis_ = Y_AXIS;
- staff_side_p_ = 0;
text_p_ =0;
hang_on_clef_b_ = false;
visibility_lambda_
Bar_script_engraver::attach_script_to_item (Item *i)
{
Axis other_axis = Axis((axis_ + 1)%2);
- if (staff_side_p_ && !staff_side_p_->parent_l(other_axis))
+ if (text_p_ && !text_p_->parent_l(other_axis))
{
- staff_side_p_->set_parent (i,other_axis);
- staff_side_p_->set_parent (i,axis_);
+ text_p_->set_parent (i,other_axis);
+ text_p_->set_parent (i,axis_);
if (!text_p_->parent_l(other_axis))
text_p_->set_parent (i,other_axis);
- staff_side_p_->add_support (i);
+
+ Staff_sidify (text_p_).add_support (i);
/*
- How do we make sure that staff_side_p_ has a dependency from
+ How do we make sure that text_p_ has a dependency from
someone else? We can't use I for that, so we use some other element.
*/
- // staff_side_p_->set_elt_property ("dangling", SCM_BOOL_T)
- get_staff_info ().command_pcol_l ()->add_dependency (staff_side_p_);
+ // text_p_->set_elt_property ("dangling", SCM_BOOL_T)
+ get_staff_info ().command_pcol_l ()->add_dependency (text_p_);
}
}
typeset_element (text_p_);
text_p_ =0;
}
-
- if (staff_side_p_)
- {
- typeset_element (staff_side_p_);
- staff_side_p_ = 0;
- }
}
void
Bar_script_engraver::create_items (Request *rq)
{
- if (staff_side_p_ || text_p_)
+ if (text_p_)
return;
- staff_side_p_ = new Staff_side_item;
- staff_side_p_->axis_ = axis_;
- staff_side_p_->set_elt_property ("breakable", SCM_BOOL_T); // ugh
-
-
text_p_ = new Text_item;
text_p_->set_elt_property ("breakable", SCM_BOOL_T); // ugh
+ Staff_sidify staffside(text_p_);
+ staffside.set_axis (axis_);
SCM prop = get_property (type_ + "Direction", 0);
- if (isdir_b (prop))
+ if (!isdir_b (prop))
{
- staff_side_p_->set_direction ( to_dir (prop));
- }
- else
- {
- staff_side_p_->set_direction ( UP);
+ prop = gh_int2scm (UP);
}
+ text_p_->set_elt_property ("direction", prop);
- staff_side_p_->set_victim(text_p_);
-
SCM padding = get_property (type_ + "ScriptPadding", 0);
if (gh_number_p(padding))
{
- staff_side_p_->set_elt_property ("padding", padding);
+ text_p_->set_elt_property ("padding", padding);
}
else
{
- staff_side_p_
+ text_p_
->set_elt_property ("padding",
gh_double2scm(paper_l ()->get_var ("interline")));
}
- staff_side_p_->set_elt_property ("visibility-lambda",
- visibility_lambda_);
text_p_->set_elt_property ("visibility-lambda",
visibility_lambda_);
announce_element (Score_element_info (text_p_, rq));
- announce_element (Score_element_info (staff_side_p_, rq));
}
dyn_b_drul_[LEFT] = dyn_b_drul_[RIGHT] =false;
}
-
-
-
Molecule
Crescendo::get_symbol () const
{
#include "dimension-cache.hh"
#include "parray.hh"
+#include "graphical-element.hh"
Dimension_cache::Dimension_cache (Dimension_cache const &d)
{
init();
callback_l_ = d.callback_l_;
empty_b_ = d.empty_b_;
- offset_ = d.offset_; //let's hope others will copy the refpoint appropriately.
+ basic_offset_ = d.basic_offset_;
+ extra_offset_ = d.extra_offset_;
+ off_valid_b_ = d.off_valid_b_;
+ off_callback_l_ = d.off_callback_l_;
}
Dimension_cache::Dimension_cache ()
Dimension_cache::init()
{
callback_l_ =0;
- offset_ =0.0;
+
+ basic_offset_ =0.0;
+ extra_offset_ =0.0;
+
elt_l_ = 0;
dim_.set_empty ();
parent_l_ =0;
valid_b_ = false;
empty_b_ = false;
+ off_valid_b_ = false;
+ off_callback_l_ =0;
}
void
Dimension_cache::invalidate ()
{
+ off_valid_b_ =false;
valid_b_ = false;
- invalidate_dependencies ();
}
-void
-Dimension_cache::invalidate_dependencies ()
-{
- for (int i=0; i < dependencies_l_arr_.size (); i++)
- {
- Dimension_cache * g = dependencies_l_arr_[i];
- if (g->valid_b_)
- {
- g->invalidate ();
- }
- }
-}
void
Dimension_cache::set_offset (Real x)
{
- invalidate_dependencies ();
- offset_ = x;
+ // ugh!
+ /*
+
+ UGH ! UGH !
+
+ */
+
+ basic_offset_ = x;
}
void
Dimension_cache::translate (Real x)
{
- invalidate_dependencies ();
- offset_ += x;
+ basic_offset_ += x;
}
Real
*/
if (refp == parent_l_)
- return offset_;
+ return get_offset ();
+ else
+ return get_offset () + parent_l_->relative_coordinate (refp);
+}
+
+Axis
+Dimension_cache::axis () const
+{
+ if (elt_l_-> dim_cache_[X_AXIS] == this)
+ return X_AXIS;
else
- return offset_ + parent_l_->relative_coordinate (refp);
+ return Y_AXIS;
+}
+
+Real
+Dimension_cache::get_offset () const
+{
+ if (!off_valid_b_ && off_callback_l_ )
+ {
+ Dimension_cache *d = (Dimension_cache*) this;
+ d->off_valid_b_ = true;
+ d->basic_offset_ = (*off_callback_l_) (d);
+ }
+
+ return basic_offset_ + extra_offset_;
}
Dimension_cache *
callback_l_ =c;
}
+void
+Dimension_cache::set_offset_callback (Offset_cache_callback c)
+{
+ off_callback_l_ =c;
+}
*/
#include "directional-element.hh"
-#include "property-inspect.hh"
+
Directional_element::Directional_element ()
{
class Dynamic_engraver : public Engraver
{
Text_item * text_p_;
- Staff_side_item * staff_side_p_;
- Staff_side_spanner * ss_span_p_;
- Staff_side_spanner * to_end_ss_span_p_;
-
-
Crescendo * to_end_cresc_p_;
Crescendo * cresc_p_;
+
Span_req * cresc_req_l_;
Array<Request*> dynamic_req_l_arr_;
void typeset_all ();
{
do_post_move_processing();
text_p_ =0;
- staff_side_p_ =0;
+
to_end_cresc_p_ = cresc_p_ = 0;
- ss_span_p_ = to_end_ss_span_p_=0;
+
cresc_req_l_ = 0;
}
Dynamic_engraver::do_process_requests()
{
Crescendo* new_cresc_p=0;
- Staff_side_spanner * new_sss_p =0;
+
for (int i=0; i < dynamic_req_l_arr_.size(); i++)
{
if (Text_script_req *absd =
text_p_ = new Text_item;
text_p_->text_str_ = loud; // ugh
text_p_->set_elt_property ("style", gh_str02scm ("dynamic"));
-
- staff_side_p_ = new Staff_side_item;
- staff_side_p_->set_elt_property ("script-priority",
- gh_int2scm (100));
-
- staff_side_p_->set_victim (text_p_);
- staff_side_p_->axis_ = Y_AXIS;
- staff_side_p_->set_direction (DOWN);
+ text_p_->set_elt_property ("script-priority",
+ gh_int2scm (100));
+ Staff_sidify (text_p_).set_axis (Y_AXIS);
- SCM prop = get_property ("verticalDirection", 0);
- if (isdir_b (prop))
+ if (absd->get_direction ())
{
- staff_side_p_->set_direction (to_dir (prop));
+ text_p_->set_elt_property ("direction", gh_int2scm (absd->get_direction ()));
}
- prop = get_property ("dynamicDirection", 0);
- if (gh_number_p(prop))
- {
- staff_side_p_->set_direction (to_dir (prop));
- }
- if (absd->get_direction ())
+
+ /*
+ UGH UGH
+ */
+ SCM prop = get_property ("dynamicDirection", 0);
+ if (!isdir_b (prop))
{
- staff_side_p_->set_direction (absd->get_direction ());
+ prop = get_property ("verticalDirection", 0);
}
+ if (isdir_b (prop) && to_dir (prop))
+ text_p_->set_elt_property ("direction", prop);
+
+
prop = get_property ("dynamicPadding", 0);
if (gh_number_p(prop))
{
- staff_side_p_->set_elt_property ("padding", prop);
+ text_p_->set_elt_property ("padding", prop);
}
announce_element (Score_element_info (text_p_, absd));
- announce_element (Score_element_info (staff_side_p_, absd));
}
else if (Span_req *span_l
= dynamic_cast <Span_req *> (dynamic_req_l_arr_[i]))
{
assert (!to_end_cresc_p_);
to_end_cresc_p_ =cresc_p_;
- to_end_ss_span_p_ = ss_span_p_ ;
cresc_p_ = 0;
- ss_span_p_ =0;
-
-
-
-
- SCM prop = get_property ("verticalDirection", 0);
- if (isdir_b (prop))
- {
- to_end_ss_span_p_->set_direction (to_dir (prop));
- }
- prop = get_property ("dynamicDirection", 0);
- if (isdir_b (prop))
- {
- to_end_ss_span_p_->set_direction (to_dir (prop));
- }
- prop = get_property ("dynamicPadding", 0);
- if (gh_number_p(prop))
- {
- to_end_ss_span_p_->set_elt_property ("padding",prop);
- }
}
}
else if (span_l->span_dir_ == START)
assert (!new_cresc_p);
new_cresc_p = new Crescendo;
new_cresc_p->grow_dir_ = (span_l->span_type_str_ == "crescendo") ? BIGGER : SMALLER;
- announce_element (Score_element_info (new_cresc_p, span_l));
- new_sss_p = new Staff_side_spanner;
- new_sss_p->set_victim (new_cresc_p);
- new_sss_p->axis_ = Y_AXIS;
- // UGH.!
- // new_sss_p->set_elt_property ("dangling", SCM_BOOL_T);
- announce_element (Score_element_info (new_sss_p, span_l));
+ Staff_sidify (new_cresc_p).set_axis (Y_AXIS);
+ announce_element (Score_element_info (new_cresc_p, span_l));
}
}
}
{
::warning (_ ("Too many crescendi here"));
typeset_element (cresc_p_);
- typeset_element (ss_span_p_);
+
cresc_p_ = 0;
- ss_span_p_ =0;
}
cresc_p_ = new_cresc_p;
- ss_span_p_ = new_sss_p;
cresc_p_->set_bounds(LEFT,get_staff_info().musical_pcol_l ());
- ss_span_p_->set_bounds (LEFT,get_staff_info().musical_pcol_l ());
+
if (text_p_)
{
cresc_p_->dyn_b_drul_[LEFT] = true;
if (cresc_p_)
{
typeset_element (cresc_p_ );
- typeset_element (ss_span_p_);
- ss_span_p_ =0;
cresc_req_l_->warning (_ ("unended crescendo"));
cresc_p_ =0;
}
if (to_end_cresc_p_)
{
to_end_cresc_p_->set_bounds(RIGHT,get_staff_info().musical_pcol_l ());
- to_end_ss_span_p_->set_bounds(RIGHT,get_staff_info().musical_pcol_l ());
+
typeset_element (to_end_cresc_p_);
- typeset_element (to_end_ss_span_p_);
+
to_end_cresc_p_ =0;
- to_end_ss_span_p_ =0;
+
}
if (text_p_)
{
typeset_element (text_p_);
- typeset_element (staff_side_p_);
text_p_ =0;
- staff_side_p_ =0;
}
}
|| dynamic_cast<Note_head *> (i.elem_l_)
)
{
- if (staff_side_p_)
- staff_side_p_->add_support (i.elem_l_);
+ if (text_p_)
+ Staff_sidify (text_p_).add_support (i.elem_l_);
- if (to_end_ss_span_p_)
- to_end_ss_span_p_->add_support (i.elem_l_);
+ if (to_end_cresc_p_)
+ Staff_sidify (to_end_cresc_p_).add_support (i.elem_l_);
- if (ss_span_p_)
- ss_span_p_->add_support (i.elem_l_);
+ if (cresc_p_)
+ Staff_sidify(cresc_p_).add_support (i.elem_l_);
}
}
e->set_parent (this, as[i]);
- e->dim_cache_[as[i]]->dependencies_l_arr_.push (dim_cache_[as[i]]);
+ // e->dim_cache_[as[i]]->dependencies_l_arr_.push (dim_cache_[as[i]]);
}
assert (e->parent_l(Y_AXIS) == this || e->parent_l (X_AXIS) == this);
elem_l_arr_.push (e);
if (e->parent_l (a) != this)
continue;
e->set_parent (0, a);
- e->dim_cache_[a]->dependencies_l_arr_.clear ();
+ // e->dim_cache_[a]->dependencies_l_arr_.clear ();
}
}
public:
VIRTUAL_COPY_CONS(Translator);
protected:
- Staff_side_item* staff_side_p_;
Text_item* text_p_;
Protected_scm visibility_lambda_;
String type_;
#ifndef CRESCENDO_HH
#define CRESCENDO_HH
-#include "spanner.hh"
+#include "directional-spanner.hh"
/**
The hairpin symbol. (cresc)
+
+ (normal spanner?)
*/
-class Crescendo : public Spanner {
+class Crescendo : public Directional_spanner {
public:
int grow_dir_;
#include "parray.hh"
class Dimension_cache;
-typedef Interval (*Dim_cache_callback)(Dimension_cache *);
+typedef Interval (*Dim_cache_callback)(Dimension_cache const *);
+typedef Real (*Offset_cache_callback)(Dimension_cache const *);
/**
Adminstration of offset dimension info.
/**
The offset wrt. to the center of #parent_l_#
*/
- Real offset_;
+
+ Real extra_offset_;
+ Real basic_offset_;
+
+ bool off_valid_b_;
+
+
Graphical_element *elt_l_;
Dim_cache_callback callback_l_;
friend class Graphical_element;
void init ();
public:
+ Offset_cache_callback off_callback_l_;
+
+ Axis axis () const;
+ Real get_offset () const;
void set_callback (Dim_cache_callback);
/** The #offset_# is defined with regard to this graphical_element/
dimension_cache. */
-
+ void set_offset_callback (Offset_cache_callback);
Dimension_cache * parent_l_;
- Link_array<Dimension_cache> dependencies_l_arr_;
- Graphical_element *element_l () { return elt_l_; }
+
+ Graphical_element *element_l () const { return elt_l_; }
void invalidate ();
void invalidate_dependencies ();
public:
Array<int> accidental_i_arr_;
+ Array<bool> internal_forceacc_b_arr_;
void clear ();
Octave_key();
void set (int i, int acc);
Octave_key const& oct (int) const;
void set (int name, int acc);
void set (Musical_pitch);
+ void set_internal_forceacc (Musical_pitch);
+ void clear_internal_forceacc (Musical_pitch);
bool different_acc (Musical_pitch) const;
+ bool internal_forceacc (Musical_pitch) const;
+ bool double_to_single_acc (Musical_pitch) const;
Key();
void print () const;
void read_lily_scm_file (String);
void init_lily_guile ();
+bool isdir_b (SCM s);
+Direction to_dir (SCM s);
void init_ly_protection ();
/* end define */
+
#endif // LILY_GUILE_HH
{
Musical_pitch pitch_;
bool cautionary_b_;
+ bool natural_b_;
Local_key_cautionary_tuple ()
{
cautionary_b_ = false;
+ natural_b_ = false;
}
static int compare (Local_key_cautionary_tuple const&s1, Local_key_cautionary_tuple const&s2)
{
public:
int c0_position_i_;
Local_key_item ();
- void add_pitch (Musical_pitch, bool cautionary);
+ void add_pitch (Musical_pitch, bool cautionary, bool natural);
protected:
virtual void do_pre_processing();
virtual void do_substitute_element_pointer (Score_element*,Score_element*);
#include "direction.hh"
#include "lily-guile.hh"
-bool isdir_b (SCM s);
-Direction to_dir (SCM s);
#endif /* PROPERTY_INSPECT_HH */
{
public:
Stem * stem_l_;
- int balltype_i_;
-
Dots * dots_l_;
+ int balltype_i_;
void add_dots (Dots *);
Rhythmic_head ();
#funcptr# is the function to call to update this element.
*/
void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr);
-
+ static SCM handle_broken_smobs (SCM, Line_of_score*);
virtual Score_element *find_broken_piece (Line_of_score*) const;
protected:
/// generate rods & springs
virtual void do_space_processing ();
- /// do postbreak substs on array of pointers.
- virtual void do_substitute_arrays ();
-
virtual void do_breakable_col_processing ();
/// do calculations after determining horizontal spacing
virtual void do_post_processing ();
virtual void handle_broken_dependents ();
virtual Link_array<Score_element> get_extra_dependencies () const;
- static Interval dim_cache_callback (Dimension_cache*);
+ static Interval dim_cache_callback (Dimension_cache const*);
public:
DECLARE_SMOBS;
class Script_engraver : public Engraver {
Link_array<Script> script_p_arr_;
- Link_array<Staff_side_item> staff_side_p_arr_;
Link_array<Articulation_req> script_req_l_arr_;
public:
Articulation marks (and the like) that are attached to notes/stems.
Needs support from Staff_side for proper operation. Staff_side
handles the positioning.
-
*/
class Script : public Item
{
- Staff_side_item * staff_side_l_;
-
Molecule get_molecule (Direction d) const;
public:
- Script ();
- void set_staff_side (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;
#include "staff-symbol-referencer.hh"
#include "directional-element.hh"
-/**
- Position myself next to a set of elements. Configurable in axis
- and direction.
-
- Properties:
-
- padding :: Real
-
- Amount of extra space to add.
-*/
-class Staff_side_element : public Staff_symbol_referencer,
- public Directional_element
+struct Staff_sidify
{
- void position_self ();
-
+ Score_element * elt_l_;
public:
- Score_element * to_position_l_;
-
+ Staff_sidify (Score_element*);
+ static Real position_self (Dimension_cache const *);
- Link_array<Score_element> support_l_arr_;
- Axis axis_;
- //junkme.
- bool staff_support_b_;
+ void set_axis (Axis);
+ Axis get_axis () const;
- Staff_side_element ();
- void set_victim (Score_element*);
+ bool is_staff_side_b ();
void add_support (Score_element*);
+ Real aligned_position (Dimension_cache const*);
- VIRTUAL_COPY_CONS(Score_element);
- virtual Direction get_default_direction () const;
-protected:
- virtual Interval do_height () 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 ();
- virtual void do_post_processing ();
+
+ Direction get_direction () const;
+ void set_direction (Direction);
};
-class Staff_side_item : public Staff_side_element, public Item
-{
-public:
- VIRTUAL_COPY_CONS(Score_element);
-protected:
- virtual Interval do_width () const;
- virtual void do_print () const;
-};
-class Staff_side_spanner : public Staff_side_element, public Spanner
-{
-public:
- VIRTUAL_COPY_CONS(Score_element);
-protected:
- virtual void do_print () const;
-};
#endif /* STAFF_SIDE_HH */
#ifndef Stem_STAFF_SIDE_HH
#define Stem_STAFF_SIDE_HH
+#error
+
#include "staff-side.hh"
/**
Position self, analogous to Staff_side_item, but use Stem direction
#include "string.hh"
#include "lily-proto.hh"
#include "virtual-methods.hh"
-#include "property-inspect.hh"
+#include "lily-guile.hh"
#include "dictionary.hh"
#include "parray.hh"
#include "input.hh"
Octave_key::print () const
{
for (int i= 0; i < 7 ; i++)
- DEBUG_OUT << "note " << i << " acc: " << accidental_i_arr_[i] << '\n';
+ DEBUG_OUT << "note " << i << " acc: " << accidental_i_arr_[i] << " iforce: " << internal_forceacc_b_arr_[i] << '\n';
}
Octave_key::Octave_key()
{
accidental_i_arr_.set_size (7);
+ internal_forceacc_b_arr_.set_size(7);
clear ();
}
Octave_key::clear ()
{
for (int i= 0; i < 7 ; i++)
+ {
accidental_i_arr_[i] = 0;
+ internal_forceacc_b_arr_[i] = false;
+ }
}
Key::Key()
octaves_[i].set (p.notename_i_,p.accidental_i_);
}
+void
+Key::set_internal_forceacc (Musical_pitch p)
+{
+ int i = octave_to_index (p.octave_i_);
+ octaves_[i].internal_forceacc_b_arr_[p.notename_i_] = true;
+}
+
+void
+Key::clear_internal_forceacc (Musical_pitch p)
+{
+ int i = octave_to_index (p.octave_i_);
+ octaves_[i].internal_forceacc_b_arr_[p.notename_i_] = false;
+}
+
void
Key::set (int n, int a)
{
{
return oct (p.octave_i_).acc (p.notename_i_) == p.accidental_i_;
}
+
+
+bool
+Key::internal_forceacc (Musical_pitch p)const
+{
+ return oct (p.octave_i_).internal_forceacc_b_arr_[p.notename_i_];
+}
+
+
+bool
+Key::double_to_single_acc (Musical_pitch p) const
+{
+ return ((oct (p.octave_i_).acc (p.notename_i_) == -2
+ && p.accidental_i_ == -1)
+
+ || (oct (p.octave_i_).acc (p.notename_i_) == 2
+ && p.accidental_i_ == 1));
+}
#include "simple-file-storage.hh"
#include "file-path.hh"
#include "debug.hh"
+#include "direction.hh"
SCM
ly_str02scm (char const*c)
{
return scm_ihashv (s, ~1u);
}
+
+
+
+bool
+isdir_b (SCM s)
+{
+ if (gh_number_p (s))
+ {
+ int i = gh_scm2int (s);
+ return i>= -1 && i <= 1;
+ }
+ return false;
+}
+
+Direction
+to_dir (SCM s)
+{
+ return (Direction) gh_scm2int (s);
+}
void
Local_key_engraver::process_acknowledged ()
{
- if (!key_item_p_ && mel_l_arr_.size())
+ if (!key_item_p_ && mel_l_arr_.size())
{
- SCM f = get_property ("forgetAccidentals",0);
- bool forget = gh_boolean_p (f) && gh_scm2bool(f);
- for (int i=0; i < mel_l_arr_.size(); i++)
- {
- Item * support_l = support_l_arr_[i];
- Note_req * note_l = mel_l_arr_[i];
-
- if (tied_l_arr_.find_l (support_l) && !forget)
- local_key_.set (note_l->pitch_);
-
- if (!note_l->forceacc_b_
- && local_key_.different_acc (note_l->pitch_))
- continue;
- if (!key_item_p_)
+ SCM f = get_property ("forgetAccidentals",0);
+ bool forget = gh_boolean_p (f) && gh_scm2bool(f);
+ for (int i=0; i < mel_l_arr_.size(); i++)
{
- key_item_p_ = new Local_key_item;
- announce_element (Score_element_info (key_item_p_, 0));
- }
-
- key_item_p_->add_pitch (note_l->pitch_,
- note_l->cautionary_b_);
- key_item_p_->add_support (support_l);
+ Item * support_l = support_l_arr_[i];
+ Note_req * note_l = mel_l_arr_[i];
+
+ /* see if there's a tie that "changes" the accidental */
+ /* works because if there's a tie, the note to the left
+ is of the same pitch as the actual note */
+ bool tie_changes = tied_l_arr_.find_l (support_l)
+ && !local_key_.different_acc (note_l->pitch_);
+
+ if (!forget
+
+ && ((note_l->forceacc_b_
+ || !local_key_.different_acc (note_l->pitch_)
+ || local_key_.internal_forceacc (note_l->pitch_)))
+
+ && !tie_changes)
+ {
+ if (!key_item_p_)
+ {
+ key_item_p_ = new Local_key_item;
+ announce_element (Score_element_info (key_item_p_, 0));
+ }
+
+ key_item_p_->add_pitch (note_l->pitch_,
+ note_l->cautionary_b_,
+ local_key_.double_to_single_acc(note_l->pitch_));
+ key_item_p_->add_support (support_l);
+ }
- if (!forget)
- local_key_.set (note_l->pitch_);
- }
+ if (!forget)
+ {
+ local_key_.set (note_l->pitch_);
+ if (!tied_l_arr_.find_l (support_l))
+ {
+ local_key_.clear_internal_forceacc (note_l->pitch_);
+ }
+ else if (tie_changes)
+ {
+ local_key_.set_internal_forceacc (note_l->pitch_);
+ }
+ }
+ }
}
- if (key_item_p_ && grace_align_l_)
+ if (key_item_p_ && grace_align_l_)
{
- grace_align_l_->add_support (key_item_p_);
- grace_align_l_ =0;
+ grace_align_l_->add_support (key_item_p_);
+ grace_align_l_ =0;
}
}
}
void
-Local_key_item::add_pitch (Musical_pitch p, bool cautionary)
+Local_key_item::add_pitch (Musical_pitch p, bool cautionary, bool natural)
{
for (int i=0; i< accidental_arr_.size(); i++)
if (!Musical_pitch::compare (p, accidental_arr_[i].pitch_))
return;
+ /* maybe natural (and cautionary) should be modif. nonetheless? */
Local_key_cautionary_tuple t;
t.pitch_ = p;
t.cautionary_b_ = cautionary;
+ t.natural_b_ = natural;
accidental_arr_.push (t);
}
{
Note_head *note_p = new Note_head;
Note_req * note_req_l = note_req_l_arr_[i];
- note_p->balltype_i_ = note_req_l->duration_.durlog_i_;
+
+ note_p->balltype_i_ = note_req_l->duration_.durlog_i_ <? 2;
if (note_req_l->duration_.dots_i_)
{
*/
-#include "property-inspect.hh"
-
-bool
-isdir_b (SCM s)
-{
- if (gh_number_p (s))
- {
- int i = gh_scm2int (s);
- return i>= -1 && i <= 1;
- }
- return false;
-}
-
-Direction
-to_dir (SCM s)
-{
- return (Direction) gh_scm2int (s);
-}
#include <string.h>
+#include "misc.hh"
#include "paper-score.hh"
#include "paper-def.hh"
#include "lookup.hh"
Interval
-Score_element::dim_cache_callback (Dimension_cache*c)
+Score_element::dim_cache_callback (Dimension_cache const*c)
{
- Score_element * e =dynamic_cast<Score_element*>( c->element_l());
+ Score_element * e =dynamic_cast<Score_element*> (c->element_l());
if(e->dim_cache_[X_AXIS] == c)
return e->do_width ();
else
return e->do_height ();
}
+
+
+Real
+set_alignment_callback (Dimension_cache const *c)
+{
+ String s ("self-alignment-");
+ Axis ax = c->axis ();
+ s += (ax == X_AXIS) ? "X" : "Y";
+ Score_element *elm = dynamic_cast<Score_element*> (c->element_l ());
+ SCM align (elm->get_elt_property (s));
+ if (isdir_b (align))
+ {
+ Direction d = to_dir (align);
+ Interval ext(elm->extent (ax));
+ if (d)
+ {
+ return - ext[d];
+ }
+ return - ext.center ();
+ }
+ else
+ return 0.0;
+}
+
+
Score_element::Score_element()
{
output_p_ =0;
if (status_i_)
return;
status_i_ ++;
+
+ if (get_elt_property ("self-alignment-X") != SCM_UNDEFINED)
+ {
+ dim_cache_[X_AXIS]->set_offset_callback (set_alignment_callback);
+ }
+
+ if (get_elt_property ("self-alignment-Y") != SCM_UNDEFINED)
+ {
+ dim_cache_[Y_AXIS]->set_offset_callback (set_alignment_callback);
+ }
+
do_add_processing();
}
void
Score_element::calculate_dependencies (int final, int busy,
- Score_element_method_pointer funcptr)
+ Score_element_method_pointer funcptr)
{
assert (status_i_ >=0);
old->do_substitute_element_pointer (this, 0);
}
+
+/**
+ Do break substitution, and return new value.
+ */
+SCM
+Score_element::handle_broken_smobs (SCM s, Line_of_score * line)
+{
+ if (SMOB_IS_TYPE_B (Score_element, s))
+ {
+ Score_element *sc = SMOB_TO_TYPE (Score_element, s);
+ Score_element * br =0;
+ if (sc->line_l () != line)
+ {
+ br = sc->find_broken_piece (line);
+ }
+
+ if (br)
+ return br->self_scm_;
+ }
+ else if (gh_pair_p (s))
+ {
+ /*
+ UGH! breaks on circular lists.
+ */
+ gh_set_car_x (s, handle_broken_smobs (gh_car (s), line));
+ gh_set_cdr_x (s, handle_broken_smobs (gh_cdr (s), line));
+ }
+ return s;
+}
+
void
Score_element::handle_broken_dependencies()
{
if (!line)
return;
- do_substitute_arrays ();
+ element_property_alist_ = handle_broken_smobs (element_property_alist_, line);
Link_array<Score_element> new_deps;
/*
- This sux.
-
- unlike with spanners, the number of items can increase
-
- span: item1
-
- becomes
-
- span: item1 item2 item3
-
- How to let span (a derived class) know that this happened?
-
-
TODO: cleanify.
*/
void
Score_element::handle_prebroken_dependencies()
{
- /* dynamic_cast<Item*> (this) &&
- if (!break_status_dir ())
- return;
- */
+ element_property_alist_
+ = handle_broken_smobs (element_property_alist_, line_l ());
+
Link_array<Score_element> old_arr, new_arr;
for (int i=0; i < dependency_size(); i++)
{
}
-void
-Score_element::do_substitute_arrays ()
-{
-}
Score_element*
scm_puts ("#<Score_element ", port);
scm_puts ((char *)sc->name (), port);
+ scm_puts ("properties = ", port);
+ scm_display (sc->element_property_alist_, port);
scm_puts (" >", port);
return 1;
}
{
Script_column *scol_p_;
Link_array<Item> script_l_arr_;
- Link_array<Staff_side_item> staff_side_l_arr_;
+
public:
Script_column_engraver ();
VIRTUAL_COPY_CONS(Translator);
Script_column_engraver::do_post_move_processing ()
{
script_l_arr_.clear ();
- staff_side_l_arr_.clear ();
+
}
void
if (!thing)
return;
- Graphical_element *parent = thing->parent_l(Y_AXIS);
-
-
- if (Staff_side_item * ss = dynamic_cast<Staff_side_item*>(parent))
+ if (Staff_sidify (thing).is_staff_side_b ())
{
- if (!ss->breakable_b () && ss->axis_ == Y_AXIS)
+ if (!thing->breakable_b () && Staff_sidify (thing).get_axis () == Y_AXIS)
{
script_l_arr_.push (thing);
}
#include "staff-side.hh"
#include "dimension-cache.hh"
-static Staff_side_item *
-get_Staff_side (Item *i)
-{
- Graphical_element *e1 = i->parent_l(Y_AXIS);
-
- return dynamic_cast<Staff_side_item*>(e1);
-}
void
Script_column::add_staff_sided (Item *i)
{
- SCM p = get_Staff_side (i)->get_elt_property ("script-priority");
+ SCM p = i->get_elt_property ("script-priority");
if (p == SCM_UNDEFINED)
return;
staff_side_compare (Item * const &i1,
Item * const &i2)
{
- Score_element *e1 = get_Staff_side (i1);
- Score_element *e2 = get_Staff_side (i2);
-
- SCM p1 = e1->get_elt_property ("script-priority");
- SCM p2 = e2->get_elt_property ("script-priority");
+ SCM p1 = i1->get_elt_property ("script-priority");
+ SCM p2 = i2->get_elt_property ("script-priority");
return gh_scm2int (p1) - gh_scm2int (p2);
}
for (int i=0; i < staff_sided_item_l_arr_.size (); i++)
{
- Staff_side_item * ip = get_Staff_side (staff_sided_item_l_arr_[i]);
- arrs[ip->get_direction ()].push (staff_sided_item_l_arr_[i]);
+ Staff_sidify st (staff_sided_item_l_arr_[i]);
+ arrs[st.get_direction ()].push (staff_sided_item_l_arr_[i]);
}
Direction d = DOWN;
Item * last = 0;
for (int i=0; i < arr.size (); i++)
{
- Staff_side_item * gs = get_Staff_side (arr[i]);
+ Staff_sidify s (arr[i]);
if (last)
{
- gs->add_support (last);
- gs->add_support (get_Staff_side (last));
+ s.add_support (last);
}
- gs->remove_elt_property ("script-priority");
+ arr[i]->remove_elt_property ("script-priority");
last = arr[i];
}
#include "script-engraver.hh"
#include "script.hh"
-#include "stem-staff-side.hh"
+#include "staff-side.hh"
#include "musical-request.hh"
#include "stem.hh"
#include "staff-symbol.hh"
continue;
}
Script *p =new Script;
- Stem_staff_side_item * ss =new Stem_staff_side_item;
-
+ Staff_sidify stafy (p);
+
list = gh_cdr (list);
p->set_elt_property ("molecule",
SCM_CAR(list));
list = SCM_CDR(list);
SCM priority = SCM_CAR(list);
+
if (relative_stem_dir)
- ss->relative_dir_ = (Direction)relative_stem_dir;
+ p->set_elt_property ("side-relative-direction", gh_int2scm (relative_stem_dir));
else
- ss->set_direction ((Direction)force_dir);
-
- SCM dir_prop (get_property ("articulationScriptVerticalDirection", 0));
- if (gh_number_p(dir_prop))
- ss->set_direction (to_dir (dir_prop));
+ stafy.set_direction ((Direction)force_dir);
if (l->get_direction ())
- ss->set_direction (l->get_direction ());
-
- SCM paddingprop = get_property ("articulationScriptPadding", 0);
- if (gh_number_p(paddingprop))
- {
- ss->set_elt_property ("padding", paddingprop);
- }
+ stafy.set_direction (l->get_direction ());
SCM axisprop = get_property ("scriptHorizontal",0);
if (gh_boolean_p (axisprop) && gh_scm2bool (axisprop))
- ss->axis_ = X_AXIS;
-
+ stafy.set_axis (X_AXIS);
+ else
+ stafy.set_axis (Y_AXIS);
+
if (follow_staff && !gh_boolean_p (axisprop) && gh_scm2bool (axisprop))
- ss->set_elt_property ("no-staff-support", SCM_BOOL_T);
+ p->set_elt_property ("no-staff-support", SCM_BOOL_T);
- p->set_staff_side (ss);
- ss->set_elt_property ("script-priority", priority);
- if (gh_number_p (paddingprop))
- ss->set_elt_property ("padding", paddingprop);
-
+ p->set_elt_property ("script-priority", priority);
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));
}
}
{
if (Stem *s = dynamic_cast<Stem*>(inf.elem_l_))
{
- for (int i=0; i < staff_side_p_arr_.size(); i++)
- if (Stem_staff_side_item * ss = dynamic_cast<Stem_staff_side_item*>(staff_side_p_arr_[i]))
- {
- ss->set_stem (s);
- ss->add_support (s);
- }
+ for (int i=0; i < script_p_arr_.size(); i++)
+ {
+ Staff_sidify stafy (script_p_arr_[i]);
+ stafy.elt_l_->set_elt_property ("direction-source", s->self_scm_);
+ stafy.add_support (s);
+ }
}
else if (Rhythmic_head * rh = dynamic_cast<Rhythmic_head*>(inf.elem_l_))
{
- for (int i=0; i < staff_side_p_arr_.size(); i++)
+ for (int i=0; i < script_p_arr_.size(); i++)
{
- Staff_side_item * ss = dynamic_cast<Staff_side_item*>(staff_side_p_arr_[i]);
+ Staff_sidify stafy(script_p_arr_[i]);
- if (!ss->parent_l (X_AXIS))
+ if (!stafy.elt_l_->parent_l (X_AXIS))
{
- ss->set_parent (inf.elem_l_, X_AXIS);
+ stafy.elt_l_->set_parent (inf.elem_l_, X_AXIS);
}
- if (ss->axis_ == X_AXIS
- && !ss->parent_l (Y_AXIS))
- ss->set_parent (rh, Y_AXIS);
+ if (stafy.get_axis () == X_AXIS
+ && !stafy.elt_l_->parent_l (Y_AXIS))
+ stafy.elt_l_->set_parent (rh, Y_AXIS);
- ss->add_support (rh);
+ stafy.add_support (rh);
}
}
}
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
#include "paper-def.hh"
#include "dimension-cache.hh"
-Script::Script ()
-{
- staff_side_l_ =0;
-}
-
-void
-Script::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
- if (o == staff_side_l_)
- staff_side_l_ = dynamic_cast<Staff_side_item*>(n);
-}
-
-
Molecule
Script::get_molecule(Direction d) const
/*
center my self on the note head.
*/
- Graphical_element * e = staff_side_l_->parent_l(X_AXIS);
+ Graphical_element * e = parent_l(X_AXIS);
translate_axis (e->extent (X_AXIS).center (), X_AXIS);
}
void
Script::do_post_processing ()
{
- Direction d = staff_side_l_->get_direction ();
+ Direction d = Staff_sidify (this).get_direction ();
Molecule m (get_molecule(d));
/*
UGH UGH UGH
*/
+#if 0
if (staff_side_l_->get_elt_property ("no-staff-support") == SCM_UNDEFINED)
translate_axis (- m.dim_[Y_AXIS][Direction (-d)], Y_AXIS);
+#endif
}
-void
-Script::set_staff_side (Staff_side_item*g)
-{
- staff_side_l_ = g;
- add_dependency (g);
- set_parent (g, Y_AXIS);
-}
Molecule*
Script::do_brew_molecule_p () const
{
- return new Molecule (get_molecule (staff_side_l_->get_direction ()));
+ Direction dir = DOWN;
+ SCM d = get_elt_property ("direction");
+ if (isdir_b (d))
+ dir = to_dir (d);
+
+ return new Molecule (get_molecule (dir));
}
-void
-Script::do_print () const
-{
-}
{
create_items (0);
text_p_->text_str_ = ly_scm2string (long_name);
- staff_side_p_->set_direction (LEFT);
+ text_p_->set_elt_property ("direction", gh_int2scm (LEFT));
Bar_script_engraver::attach_script_to_item (i);
/*
/*
- g-staff-side.cc -- implement Staff_side_element
+ staff-side.cc -- implement Staff_side_element
source file of the GNU LilyPond music typesetter
#include "dimensions.hh"
#include "dimension-cache.hh"
-Staff_side_element::Staff_side_element ()
+Staff_sidify::Staff_sidify (Score_element *e)
{
- to_position_l_ = 0;
- set_elt_property ("transparent", SCM_BOOL_T);
- axis_ = Y_AXIS;
+ elt_l_ = e;
}
+
void
-Staff_side_element::do_pre_processing ()
+Staff_sidify::add_support (Score_element*e)
{
- if (!get_direction ())
- set_direction (get_default_direction ());
-
- if (axis_ == X_AXIS)
- position_self ();
+ SCM sup = elt_l_->get_elt_property ("side-support");
+ elt_l_->set_elt_property ("side-support",
+ gh_cons (e->self_scm_,sup));
}
-Direction
-Staff_side_element::get_default_direction () const
+Real
+Staff_sidify::aligned_position (Dimension_cache const *c)
{
- return DOWN;
+ return position_self (c);
}
-void
-Staff_side_element::set_victim (Score_element *e)
-{
- add_dependency (e);
- to_position_l_ = e;
- to_position_l_->set_parent (this, axis_);
-}
-
-void
-Staff_side_element::add_support (Score_element*e)
+Direction
+Staff_sidify::get_direction () const
{
- add_dependency (e);
- support_l_arr_.push (e);
-}
+ SCM d = elt_l_->get_elt_property ("direction");
+ if (isdir_b (d))
+ return to_dir (d) ? to_dir (d) : DOWN;
+ Direction relative_dir = UP;
+ SCM reldir = elt_l_->get_elt_property ("side-relative-direction"); // should use a lambda.
+ if (isdir_b (d))
+ {
+ relative_dir = to_dir (reldir);
+ }
+
+ SCM other_elt = elt_l_->get_elt_property ("direction-source");
+ if (SMOB_IS_TYPE_B (Score_element, other_elt))
+ {
+ Score_element * e = SMOB_TO_TYPE(Score_element,other_elt);
-void
-Staff_side_element::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
- Staff_symbol_referencer::do_substitute_element_pointer (o,n);
- if (o == to_position_l_)
- to_position_l_ = n;
- else
- support_l_arr_.unordered_substitute (o,n);
+ return relative_dir * Staff_sidify (e).get_direction ();
+ }
+
+ return DOWN;
}
-
-void
-Staff_side_element::position_self ()
+
+/**
+ Callback that does the aligning.
+ */
+Real
+Staff_sidify::position_self (Dimension_cache const * c)
{
- if (to_position_l_ &&
- to_position_l_->get_elt_property ("transparent") != SCM_UNDEFINED)
- return;
+ Score_element * me = dynamic_cast<Score_element*> (c->element_l ());
- Axis other = Axis ((axis_ + 1) % NO_AXES);
- if (parent_l (axis_)->empty_b (axis_)
- &&parent_l (axis_)->empty_b (other)) // guh
+ Interval dim;
+ Axis axis = c->axis ();
+ Graphical_element *common = me->parent_l (axis);
+ SCM support = me->get_elt_property ("side-support");
+ for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
{
- warning (_("No support; erasing script"));
- to_position_l_->set_empty (X_AXIS,Y_AXIS);
- to_position_l_->set_elt_property ("transparent", SCM_BOOL_T);
- set_empty (X_AXIS, Y_AXIS);
- return ;
+ assert (SMOB_IS_TYPE_B (Score_element, gh_car (s)));
+ Score_element * e = SMOB_TO_TYPE(Score_element, gh_car (s));
+ common = common->common_refpoint (e, axis);
}
- Interval dim;
- Graphical_element *common = 0;
- if (support_l_arr_.size ())
+ for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
{
- common = common_refpoint (typecast_array (support_l_arr_, (Graphical_element*)0),
- axis_);
-
- for (int i=0; i < support_l_arr_.size (); i++)
- {
- Score_element * e = support_l_arr_ [i];
- Real coord = e->relative_coordinate (common, axis_);
+ Score_element * e = SMOB_TO_TYPE(Score_element, gh_car (s));
+ Real coord = e->relative_coordinate (common, axis);
- dim.unite (coord + e->extent (axis_));
- }
+ dim.unite (coord + e->extent (axis));
}
- else
- common = parent_l (axis_);
+
if (dim.empty_b ())
{
dim = Interval(0,0);
}
-
- Interval sym_dim
- = to_position_l_
- ? to_position_l_->extent (axis_)
- : Interval(0,0);
+ Real off = me->parent_l (axis)->relative_coordinate (common, axis);
- Real off = relative_coordinate (common, axis_);
- SCM pad = remove_elt_property ("padding");
+ Direction dir = Staff_sidify (me).get_direction ();
+
+ SCM pad = me->remove_elt_property ("padding");
if (pad != SCM_UNDEFINED)
{
- off += gh_scm2double (pad) * get_direction ();
+ off += gh_scm2double (pad) * dir;
}
- Real total_off = dim[get_direction ()] + off;
+ Real total_off = dim[dir] + off;
- /*
- "no-staff-support" is ugh bugfix to get staccato dots right.
- */
- if (to_position_l_ && to_position_l_->get_elt_property ("no-staff-support") == SCM_UNDEFINED)
- total_off += - sym_dim[-get_direction ()];
-
- dim_cache_[axis_]->set_offset (total_off);
if (fabs (total_off) > 100 CM)
programming_error ("Huh ? Improbable staff side dim.");
-}
-
-void
-Staff_side_element::do_post_processing ()
-{
- if (axis_ == Y_AXIS)
- position_self ();
-}
-
-void
-Staff_side_element::do_add_processing ()
-{
- if (get_elt_property ("no-staff-support") == SCM_UNDEFINED
- && axis_ == Y_AXIS && staff_symbol_l ())
- {
- add_support (staff_symbol_l ());
- }
-}
-
-Interval
-Staff_side_element::do_height () const
-{
- Interval i;
- if (to_position_l_)
- return to_position_l_->extent (Y_AXIS);
- return i;
+ return total_off;
}
void
-Staff_side_element::do_print () const
+Staff_sidify::set_axis (Axis a)
{
-#ifndef NPRINT
- if (to_position_l_)
- DEBUG_OUT << "positioning " << to_position_l_->name();
+ if (elt_l_->get_elt_property ("transparent") == SCM_UNDEFINED)
+ elt_l_->set_elt_property ("side-support" ,SCM_EOL);
- DEBUG_OUT << "axis == " << axis_name_str (axis_)
- << ", dir == " << to_str ((int)get_direction () );
-#endif
+ Axis other = Axis ((a +1)%2);
+ elt_l_->dim_cache_[a]->set_offset_callback (position_self);
+ elt_l_->dim_cache_[other]->set_offset_callback (0);
}
-
-Interval
-Staff_side_item::do_width () const
+Axis
+Staff_sidify::get_axis () const
{
- Interval i;
- if (to_position_l_)
- return to_position_l_->extent (X_AXIS);
- return i;
+ if (elt_l_->dim_cache_[X_AXIS]->off_callback_l_ == position_self) // UGH.
+ return X_AXIS;
+ else
+ return Y_AXIS;
}
void
-Staff_side_item::do_print () const
+Staff_sidify::set_direction (Direction d)
{
- Staff_side_element::do_print ();
+ elt_l_->set_elt_property ("direction", gh_int2scm (d));
}
-void
-Staff_side_spanner::do_print () const
+bool
+Staff_sidify::is_staff_side_b ()
{
- Staff_side_element::do_print ();
+ return elt_l_->get_elt_property ("side-support") != SCM_UNDEFINED;
}
-
-/*
- g-stem-staff-side.cc -- implement Stem_staff_side
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-
-#include "dimension-cache.hh"
-#include "stem-staff-side.hh"
-#include "stem.hh"
-#include "staff-symbol.hh"
-#include "paper-def.hh"
-
-Stem_staff_side_item::Stem_staff_side_item ()
-{
- stem_l_ =0;
- relative_dir_ = CENTER;
-}
-
-void
-Stem_staff_side_item::do_substitute_element_pointer (Score_element*o,
- Score_element*n)
-{
- if (o == stem_l_)
- {
- stem_l_ = dynamic_cast<Stem*> (n);
- }
- Staff_side_item::do_substitute_element_pointer (o,n);
-}
-
-void
-Stem_staff_side_item::set_stem (Stem*s)
-{
- stem_l_ =s;
- add_dependency (s);
-}
-
-
-Direction
-Stem_staff_side_item::get_default_direction () const
-{
- return (Direction)(relative_dir_ * stem_l_->get_direction ());
-}
-
-void
-Stem_staff_side_item::do_pre_processing ()
-{
- SCM p = remove_elt_property ("padding");
- Real pad = paper_l ()->get_var ("articulation_script_padding_default");
- if (get_elt_property ("no-staff-support") != SCM_UNDEFINED)
- pad =0.0;
-
- Real il = (stem_l_) ? stem_l_->staff_line_leading_f (): paper_l ()->get_var ("interline");
-
- if (p != SCM_UNDEFINED)
- {
- pad = gh_scm2double (p);
- }
- pad *= il ;
- set_elt_property ("padding",
- gh_double2scm(pad));
-
- Staff_side_item::do_pre_processing ();
-}
-
-void
-Stem_staff_side_item::do_post_processing ()
-{
- Staff_side_item::do_post_processing ();
-
- /*
- Ugh: try to get staccato dots right.
-
- TODO:
-
-
- should use general no_staff_line_collision elt property, and use
- the same elt prop also for positioning slurs, ties and dots.
- */
- if (get_elt_property ("no-staff-support") != SCM_UNDEFINED)
- {
- Graphical_element * c =common_refpoint (staff_symbol_l (), Y_AXIS);
- Real staff_coord = staff_symbol_l ()->relative_coordinate (c, Y_AXIS);
- Real self_coord = relative_coordinate (c, Y_AXIS);
- Real now_coord = self_coord - staff_coord;
-
- Real desired_coord = ceil (get_direction () * 2.0 * now_coord / staff_line_leading_f ());
- if (! (int (desired_coord) % 2))
- {
- desired_coord ++;
- }
-
- translate_axis (desired_coord * get_direction () * staff_line_leading_f () / 2.0 - now_coord, Y_AXIS);
- }
-}
#include "stem.hh"
#include "staff-symbol.hh"
+/**
+ typeset directions that are plain text.
+ */
class Text_engraver : public Engraver
{
Link_array<Text_script_req> reqs_;
- Link_array<Staff_side_item> positionings_;
Link_array<Text_item> texts_;
public:
- Text_engraver();
+
VIRTUAL_COPY_CONS(Translator);
protected:
virtual bool do_try_music (Music* m);
virtual void acknowledge_element (Score_element_info);
};
-Text_engraver::Text_engraver ()
-{
-
-}
bool
Text_engraver::do_try_music (Music *m)
{
if (Note_head *n = dynamic_cast<Note_head*> (i.elem_l_))
{
- for (int i=0; i < positionings_.size (); i++)
+ for (int i=0; i < texts_.size (); i++)
{
- positionings_[i]->add_support (n);
- if (positionings_[i]->axis_ == X_AXIS
- && !positionings_[i]->parent_l (Y_AXIS))
- positionings_[i]->set_parent (n, Y_AXIS);
+ Staff_sidify st (texts_[i]);
+ st.add_support (n);
+ if (st.get_axis( ) == X_AXIS
+ && !texts_[i]->parent_l (Y_AXIS))
+ texts_[i]->set_parent (n, Y_AXIS);
}
}
if (Stem *n = dynamic_cast<Stem*> (i.elem_l_))
{
- for (int i=0; i < positionings_.size (); i++)
+ for (int i=0; i < texts_.size (); i++)
{
- positionings_[i]->add_support (n);
+ Staff_sidify st(texts_[i]);
+ st.add_support (n);
}
}
}
Text_script_req * r = reqs_[i];
Text_item *text = new Text_item;
- Staff_side_item *ss = new Staff_side_item;
-
-
+ Staff_sidify stafy (text);
SCM axisprop = get_property ("scriptHorizontal",0);
if (gh_boolean_p (axisprop) && gh_scm2bool (axisprop))
{
- ss->axis_ = X_AXIS;
- text->set_parent (ss, Y_AXIS);
-
+ stafy.set_axis (X_AXIS);
+ // text->set_parent (ss, Y_AXIS);
}
- ss->set_victim (text);
- ss->set_elt_property ("script-priority",
+ else
+ stafy.set_axis (Y_AXIS);
+
+ text->set_elt_property ("script-priority",
gh_int2scm (200));
- ss->set_direction (r->get_direction ());
-
+ if (r->get_direction ())
+ stafy.set_direction (r->get_direction ());
+
text->text_str_ = r->text_str_;
if (r->style_str_.length_i ())
}
announce_element (Score_element_info (text, r));
- announce_element (Score_element_info (ss, r));
-
texts_.push (text);
- positionings_.push (ss);
}
}
for (int i=0; i < texts_.size (); i++)
{
typeset_element (texts_[i]);
- typeset_element (positionings_[i]);
}
texts_.clear ();
- positionings_.clear ();
}
void
{
if (time_signature_p_)
{
+ SCM sigstyle = get_property ("timeSignatureStyle", 0);
+ if (gh_string_p (sigstyle))
+ {
+ time_signature_p_->set_elt_property ("style", sigstyle);
+ }
typeset_element (time_signature_p_);
time_signature_p_ =0;
}
\name GrandStaff;
\consists "Span_bar_engraver";
\consists "Piano_bar_engraver";
-
+ \consists "Property_engraver";
+ Generic_property_list = #generic-grand-staff-properties
\accepts "Staff";
};
\translator{\GrandStaffContext}
Begin3
Title: LilyPond
-Version: 1.3.7
-Entered-date: 18NOV99
+Version: 1.3.8
+Entered-date: 24NOV99
Description:
Keywords: music notation typesetting midi fonts engraving
Author: hanwen@cs.uu.nl (Han-Wen Nienhuys)
janneke@gnu.org (Jan Nieuwenhuizen)
Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert
- 1000k lilypond-1.3.7.tar.gz
+ 1000k lilypond-1.3.8.tar.gz
Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
- 1000k lilypond-1.3.7.tar.gz
+ 1000k lilypond-1.3.8.tar.gz
Copying-policy: GPL
End
Name: lilypond
-Version: 1.3.7
+Version: 1.3.8
Release: 1
Copyright: GPL
Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.7.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.8.tar.gz
Summary: A program for printing sheet music.
URL: http://www.cs.uu.nl/~hanwen/lilypond
# get Packager from (undocumented?) ~/.rpmmacros!
\version "1.3.4";
+
+lowstaff = \translator "Staff" = "lower"
+upstaff = \translator "Staff" = "upper"
+
% upper = \context Staff \notes\relative c {
upper = \context Staff=upper \notes\relative c {
\context Voice=i
r c, g' b r c, fis a |
r b, d a' r b, d g
r a, c g' r a, c f! |
+
% ugh arpeggio
- <
- { \stemup f4 r }
- \context Voice=ii { \stemdown <g,4 d'> r }
- >
+ <f4 d b4>
+ r4
+
\stemboth
- \translator Staff=lower\stemup
+ \stemup
r16 g,, b d
- [ f \translator Staff=upper\stemdown g16 b d ] |
+ [ f \upstaff \stemdown g16 b d ] |
\stemup b
- \translator Staff=lower\stemdown
+ \lowstaff \stemdown
[ g b d ] f
- \translator Staff=upper\stemup
+ \upstaff
[ g16 b d ] b
- \translator Staff=lower\stemup
- \clef "violin";
[ g b d ]
\stemup
+
% urg, below translator change affects previous beam too!?
% howto separate translator command from previous beam end?
- \translator Staff=upper f g b f |
+ \upstaff f g b f |
\stemboth
e c' g f e c' g e
d c' f, e d b' f d |
c4 e g^"\\textsharp"-\mordent g,4 |
d'4-\mordent f a-\mordent^"\\textsharp" a,4 |
e' e'-\mordent a, b-\upprall |
- c4 e, fis gis-\downprall |
+ c4 e, fis gis-\upprall |
a4 c, d e-\upprall |
f4 e d-\prall c |
g'-\mordent^"\\textsharp" g, g'-\mordent g, |
r8 c' e g e c bes' g |
a c, f a f c c' a |
b g b d b g f' d |
- <
- {\stemup e2 r4 e }
- \context Voice = ii {\stemdown <c2 g > r4 <c g > }
- >
- \stemboth |
- <
- { \stemup d2 r4 d }
- \context Voice = ii { \stemdown <c2 a > r4 <c a > }
- >
- \stemboth |
- <
- { \stemup d8 }
- \context Voice = ii { \stemdown <b 8 g > }
+ <e2 c g>
+ r4
+ <e c g >
+ <d2 c a>
+ r4
+ <d c a>
+ < { \stemup [d8 g, 8 b d] }
+ \context Voice = ii < \stemdown b g >
>
- \stemboth
- g, 8 b d
- <
- { \stemup b 4 e }
- \context Voice = ii { \stemdown g, 4 b }
- >
- \stemboth |
+
+ <b4 g>
+ <e b>
+ c2
+ r4
<
- { \stemup c2 r4 < {c ~ c8} {a 4 ~ a 8} > }
- \context Voice=ii { \stemdown c2 r4 e, 4 ~ e 8 }
+ { \stemup c ~ c8}
+ \context Voice=ii { \stemdown <e,4 a> ~ <e8 a> }
>
\stemboth
d, fis a fis d c' a |
b g b d b g f'! d |
e g, c e c g g' e |
fis a, c fis c a a' fis |
- <
- { \stemup g2 }
- \context Voice = ii { \stemdown <d2 b > }
- >
- \stemboth
- r4 b4 |
- c,8 e g c g e bes' g |
+ <g2 d b>
+ r4 b,4 |
+ c8 e g c g e bes' g |
a16 g f e d c b ! a
b g a b c d e f |
g4
- <
- { \stemup c,2 b 4 }
- \context Voice=ii { \stemdown g 2 d 4 }
- >
- \stemboth
- <
- { \stemup c1 }
- \context Voice=ii { \stemdown e, 1}
- >
- \stemboth
+ <g,2 c>
+ <d4 b'>
+ <e1 c'>
\bar "|.";
}
g'8 g, b d b g f'! d |
e c e g e c c' e, |
- f1 |
+ f1 ~ |
f8 d e c g'4 g, |
- <c1 c,1>
+ c,1
\bar "|.";
}
r16 [fis, c es] [c fis, c fis,] r fis, r fis, |
r16 [g, b, d] [b, g, b, d] [es c a, fis] |
-
- \context Staff <
- \context Voice=i {\stemup g4-\fermata}
- \context Voice=ii {\stemdown <b,4 d>}
- >
- \stemboth
+
+ <g4 d b>
\bar "|.";
}
g,4 r [es8 c] |
g,4 r [es8 c] |
g,4 r r |
- g,2._\fermata
+ g,4_\fermata
\bar "|.";
}
% r16_"legato"
r16
\property Voice . textStyle = "finger"
- d'( fis d a' b cis a
+ d' fis d a' b cis a
d cis d e d fis e d |
\property Voice . textStyle = "finger"
\stemup
- )cis4 fis ~ fis8 fis e4 ~ |
- e16 \stemboth a,16( cis a d e fis d
+ cis4 fis ~ fis8 fis e4 ~ |
+ e16 \stemboth a,16 cis a d e fis d
g fis g a g b a g |
\stemup
- )fis4 e8 a <fis4 d> <gis e> |
+ fis4 e8 a <fis4 d> <gis e> |
%5
- <a4( e> <fis d> < )g!16 d> fis g a
+ <a4 e> <fis d> < g!16 d> fis g a
\stemboth
g b a g |
\property Voice . textStyle = "italic"
fis e fis g fis a g fis
\property Voice . textStyle = "finger"
-% e4-"2\\_5" ~ e16 e,( fis g |
- e4 ~ e16 e,( fis g |
+% e4-"2\\_5" ~ e16 e, fis g |
+ e4 ~ e16 e, fis g |
\property Voice . textStyle = "italic"
a g a b a c b a
g fis g a g b a g |
\stemup
- )fis4
+ fis4
\skip 4*7; |
%10
\property Voice . textStyle = "finger"
b4 a ~ a8 g ~ g16 fis8 e16 |
fis8 e~ e d~ d4 cis |
- d2 ~ d16 a( b cis )d4 |
+ d2 ~ d16 a b cis d4 |
\bar "|.";
}
\context Voice=ii
\stemup
\property Voice . textStyle = "finger"
- fis4( e8 a4 a4 gis8 |
- ) a8
+ fis4 e8 a4 a4 gis8 |
+ a8
\translator Staff=upper \stemdown
a'4 a8 b4. cis8 ~ |
%5
r8 a4 a8
\translator Staff=lower \stemup
- g8( fis )e4 ~ |
+ g8 fis e4 ~ |
e4 d ~ d16 d cis b cis4 ~ |
cis8 a d4. d4^> cis8 |
\translator Staff=upper \stemdown
\context Voice=iii
\stemdown
d4 cis b e |
- a16 a,( cis a d e fis d
+ a16 a, cis a d e fis d
g fis g a g b a g |
- )fis4 fis e a |
- d16 \stemboth d,( fis d a' b cis a
- d cis d e d fis e ) d |
+ fis4 fis e a |
+ d16 \stemboth d, fis d a' b cis a
+ d cis d e d fis e d |
%5
cis b cis d c e d c
- \stemdown b4 cis8 b( |
- a )fis b a gis e a g |
+ \stemdown b4 cis8 b |
+ a fis b a gis e a g |
fis4. d8 e4 a4 |
\stemboth
- r16 d,( fis d )g8-. g,-.
- r16 e'( g e )a8-. a,-. |
- r16 fis'( a fis )b8-. b,-. r16 g'( b g )d'8-. d,-. |
+ r16 d, fis d g8 g,
+ r16 e' g e a8 a, |
+ r16 fis' a fis b8 b, r16 g' b g d'8 d, |
%10
- r16 d,16( fis d a' b cis a d b d b
+ r16 d,16 fis d a' b cis a d b d b
fis' g a fis |
- )fis16 g,( b g d' e fis d )g8-. g,-. r16 cis( e cis |
- )fis8-. fis,-. \stemdown r16 b( d b )e8-. e,-.
+ fis16 g, b g d' e fis d g8 g, r16 cis e cis |
+ fis8 fis, \stemdown r16 b d b e e,
r16 a cis a |
\stemboth
d e fis d g fis e d cis! a b cis
cis bes' g e a g |
f d f a f a |
d a d f d f |
- b ( f e d c b |
+ b f e d c b |
%10
- a gis fis )e d' b |
+ a gis fis e d' b |
<
{
\stemup
\context Voice=ii { \stemdown a4 r r | a4 r r }
> |
\stemboth
- a'8( es d c bes a |
- g fis e! )d c' a |
+ a'8 es d c bes a |
+ g fis e! d c' a |
%15
bes8-\mordent d8 bes g g'4 |
r8 d c bes a-\prall g |
\property StaffGroup.timeSignatureStyle = "old"
\time 4/4;
\tempo 4=100;
+ \repeat "volta" 2 {
\skip 1*31;
+ }
+ \repeat "volta" 2 {
\property StaffGroup.timeSignatureStyle = "1"
\time 3/2;
\tempo 2=140;
\property StaffGroup.timeSignatureStyle = "old"
\time 4/4;
\tempo 4=100;
+ s1
+ }
+ \repeat "volta" 2 {
+ \skip 1*12;
+ \cadenzaOn
+ s\breve
+ \cadenzaOff
+ }
}
vi1=\context Staff = vi1 <
\property Staff.instrument = "Violin 1"
\property Staff.midiInstrument = "recorder" % The default midi violin is terrible
+ \repeat "volta" 2 {
d8 d d d d4 a16 b c a |
b8 g g g16 a b8 g g g16 a |
b8 g g a16 b c4 b |
r8 g g g16 f e4 d |
r8 d16 a b8 b16 c a2 |
b1 |
-
- \repeat "semi" 2 {
+ }
+
+ \repeat "volta" 2 {
r4 d d d d d |
e1. |
r4 c c c c c |
a4 c8 b a4 b8 c f,4 g8 a |
d,4 g g g g g |
a d,8 c b4 c8 d a2 |
+ b1 |
}
- \repeat "semi" 2 {
- b1 |
+ \repeat "volta" 2 {
d8 d d d d4 a16 b c a |
b8 g g g16 a b8 g g g16 a |
b8 g c2 b4 |
\property Staff.instrument = "Violin 2"
\property Staff.midiInstrument = "recorder" % The default midi violin is terrible
+ \repeat "volta" 2 {
r1 | r | r |
d8 d d d d4 a16 b c a |
b8 g g g16 a b8 g g g16 a |
e4 d r8 c16 g b8 b16 c |
a4 g2 fis4 |
g1 |
+ }
- \repeat "semi" 2 {
+ \repeat "volta" 2 {
r1. |
r4 g'8 f e4 f8 g c,4 d8 e |
a,1. |
c,4 a a a a a |
b d8 c b4 c8 d d,4 e |
fis2 g fis! |
+ g1 |
}
- \repeat "semi" 2 {
- g1 |
+ \repeat "volta" 2 {
r1 | r1 |
g'8 g g g g4 d16 e f d |
e8 c c c16 d e8 g, g g16 a |
\property Staff.midiInstrument = "bassoon" % The default midi violin is terrible
+ \repeat "volta" 2 {
G2 d^"4 3" | G1 |
g2 c4 G | d1^"3 4 3" |
G1 | g2 c4 G |
G1^"3 4 3" | c4 B c g |
c B c G | d1^"3 4 3" |
G1 |
+ }
- \repeat "semi" 2 {
+ \repeat "volta" 2 {
g1. | c |
f | d^"\\textsharp" |
g | c |
d^"\\textsharp" | e |
f | g1 B2 |
d1.^"3 4 3" |
+ G1 |
}
- \repeat "semi" 2 {
- G1 |
+ \repeat "volta" 2 {
g2 fis | g G |
g1^"3 4 3" | c |
G^"3 4 3" | c2 G |
(list 'verticalDirection dir? 'direction)
)
))
-
+
+(define generic-script-properties
+ (cons "Script" (list
+ (list 'articulationScriptVerticalDirection dir? 'direction)
+ (list 'articulationScriptPadding number? 'padding)
+
+ ))
+ )
+
+
+
(define generic-text-properties
(cons "Text_item" (list
(list 'textStyle string? 'style)
(list 'textScriptPadding number? 'padding)
+ (list 'textVerticalAlignment dir? 'self-alignment-Y)
+ (list 'textHorizontalAlignment dir? 'self-alignment-X)
)
))
+(define generic-crescendo-properties
+ (cons "Crescendo" (list
+ (list 'dynamicDirection dir? 'direction)
+ (list 'verticalDirection dir? 'direction)
+ (list 'dynamicPadding number? 'padding)
+ )))
+
(define generic-bar-properties
(cons "Staff_bar" (list
(list 'barSize number? 'bar-size))
generic-beam-properties
generic-text-properties
generic-note-column-properties
+ generic-crescendo-properties
generic-All-properties
))
(define generic-grace-properties generic-voice-properties)
(define generic-staff-properties
(list
+ generic-text-properties
generic-bar-properties
generic-timesig-properties
generic-clef-properties
generic-All-properties
)
)
+(define generic-grand-staff-properties
+ (list
+ generic-text-properties
+ generic-bar-properties
+ ))
+
(define generic-thread-properties
(list generic-All-properties
m = re.search( '@settitle (.*)\n', s)
if m:
- print 'title found! '
header.title = m.group (1)
m = re.search( '@author (.*)\n', s)
if m: